diff --git a/cafe.db b/cafe.db index fcac585..07b375d 100644 Binary files a/cafe.db and b/cafe.db differ diff --git a/project/__pycache__/admin_dashboard.cpython-313.pyc b/project/__pycache__/admin_dashboard.cpython-313.pyc new file mode 100644 index 0000000..45ffb15 Binary files /dev/null and b/project/__pycache__/admin_dashboard.cpython-313.pyc differ diff --git a/project/__pycache__/admin_menu.cpython-313.pyc b/project/__pycache__/admin_menu.cpython-313.pyc index e2e6777..ebe070f 100644 Binary files a/project/__pycache__/admin_menu.cpython-313.pyc and b/project/__pycache__/admin_menu.cpython-313.pyc differ diff --git a/project/__pycache__/database.cpython-313.pyc b/project/__pycache__/database.cpython-313.pyc index 5712a62..d7073ef 100644 Binary files a/project/__pycache__/database.cpython-313.pyc and b/project/__pycache__/database.cpython-313.pyc differ diff --git a/project/__pycache__/kasir.cpython-313.pyc b/project/__pycache__/kasir.cpython-313.pyc index 58b88b1..dab37c6 100644 Binary files a/project/__pycache__/kasir.cpython-313.pyc and b/project/__pycache__/kasir.cpython-313.pyc differ diff --git a/project/__pycache__/kasir_dashboard.cpython-313.pyc b/project/__pycache__/kasir_dashboard.cpython-313.pyc new file mode 100644 index 0000000..3736a14 Binary files /dev/null and b/project/__pycache__/kasir_dashboard.cpython-313.pyc differ diff --git a/project/__pycache__/login.cpython-313.pyc b/project/__pycache__/login.cpython-313.pyc new file mode 100644 index 0000000..4338316 Binary files /dev/null and b/project/__pycache__/login.cpython-313.pyc differ diff --git a/project/__pycache__/pembeli_menu.cpython-313.pyc b/project/__pycache__/pembeli_menu.cpython-313.pyc index cbaca1c..33b128f 100644 Binary files a/project/__pycache__/pembeli_menu.cpython-313.pyc and b/project/__pycache__/pembeli_menu.cpython-313.pyc differ diff --git a/project/__pycache__/pemilik.cpython-313.pyc b/project/__pycache__/pemilik.cpython-313.pyc index 1333135..982a984 100644 Binary files a/project/__pycache__/pemilik.cpython-313.pyc and b/project/__pycache__/pemilik.cpython-313.pyc differ diff --git a/project/__pycache__/pemilik_dashboard.cpython-313.pyc b/project/__pycache__/pemilik_dashboard.cpython-313.pyc new file mode 100644 index 0000000..d3362e8 Binary files /dev/null and b/project/__pycache__/pemilik_dashboard.cpython-313.pyc differ diff --git a/project/__pycache__/waiter_dashboard.cpython-313.pyc b/project/__pycache__/waiter_dashboard.cpython-313.pyc index 02bd477..259d2c6 100644 Binary files a/project/__pycache__/waiter_dashboard.cpython-313.pyc and b/project/__pycache__/waiter_dashboard.cpython-313.pyc differ diff --git a/project/database.py b/project/database.py index 2bbf052..37243a2 100644 --- a/project/database.py +++ b/project/database.py @@ -7,6 +7,7 @@ def setup_database(): db = connect() cur = db.cursor() + # Users cur.execute(""" CREATE TABLE IF NOT EXISTS users( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -16,6 +17,7 @@ def setup_database(): ) """) + # Menu cur.execute(""" CREATE TABLE IF NOT EXISTS menu( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -25,14 +27,16 @@ def setup_database(): ) """) + # Orders cur.execute(""" CREATE TABLE IF NOT EXISTS orders( id INTEGER PRIMARY KEY AUTOINCREMENT, nama TEXT, - harga REAL + total REAL ) """) + # Pembayaran cur.execute(""" CREATE TABLE IF NOT EXISTS pembayaran( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -41,19 +45,28 @@ def setup_database(): ) """) + # User default cur.execute("SELECT COUNT(*) FROM users") if cur.fetchone()[0] == 0: users = [ ("admin","admin","admin"), ("kasir","kasir","kasir"), ("pembeli","pembeli","pembeli"), - ("pemilik","pemilik","pemilik"), - ("waiter","waiter","waiter") + ("pemilik","pemilik","pemilik") ] - cur.executemany( - "INSERT INTO users(username,password,role) VALUES (?,?,?)", - users - ) + cur.executemany("INSERT INTO users(username,password,role) VALUES (?,?,?)", users) + db.commit() + + # Menu default + cur.execute("SELECT COUNT(*) FROM menu") + if cur.fetchone()[0] == 0: + menu = [ + ("Mie Ayam", 18000, "mie ayam.webp"), + ("Mie Kuah", 10000, "mie kuah.webp"), + ("Es Teh Manis", 5000, "es teh.webp"), + ("Jus Jeruk", 8000, "jus jeruk.webp") + ] + cur.executemany("INSERT INTO menu(nama,harga,gambar) VALUES (?,?,?)", menu) db.commit() db.close() diff --git a/project/kasir.py b/project/kasir.py index 5f9c45d..1955564 100644 --- a/project/kasir.py +++ b/project/kasir.py @@ -71,6 +71,4 @@ class KasirPage: def logout(self): self.frame.destroy() - from main import LoginScreen - LoginScreen(self.parent) - + self.controller.show_frame("Login") diff --git a/project/main.py b/project/main.py index 23cb139..3d5bcf4 100644 --- a/project/main.py +++ b/project/main.py @@ -3,8 +3,6 @@ from database import setup_database, connect from pembeli_menu import PembeliMenu from kasir import KasirPage from pemilik import PemilikPage -from admin_menu import AdminMenu -from waiter_dashboard import WaiterDashboard from tkinter import messagebox # --- Login Screen --- @@ -38,19 +36,10 @@ class LoginScreen: self.frame.destroy() if role=="pembeli": PembeliMenu(self.root) - elif role=="kasir": - KasirPage(self.root, self.root) - + KasirPage(self.root) elif role=="pemilik": - PemilikPage(self.root, self.root) - - elif role == "admin": - AdminMenu(self.root) - - elif role == "waiter": - WaiterDashboard(self.root) - + PemilikPage(self.root) else: messagebox.showerror("Error","Role tidak dikenali") else: diff --git a/project/pemilik.py b/project/pemilik.py index 7d1007c..8a62bf5 100644 --- a/project/pemilik.py +++ b/project/pemilik.py @@ -35,6 +35,4 @@ class PemilikPage: def logout(self): self.frame.destroy() - from main import LoginScreen - LoginScreen(self.parent) - + self.controller.show_frame("Login") diff --git a/project/waiter_dashboard.py b/project/waiter_dashboard.py index a325494..4fb7fc0 100644 --- a/project/waiter_dashboard.py +++ b/project/waiter_dashboard.py @@ -1,17 +1,10 @@ import tkinter as tk -class WaiterDashboard: - def __init__(self, parent): - self.parent = parent - self.frame = tk.Frame(parent) - self.frame.pack(fill="both", expand=True) +class WaiterDashboard(tk.Frame): + def __init__(self, parent, controller): + super().__init__(parent) - tk.Label(self.frame, text="WAITER", font=("Arial", 20, "bold")).pack(pady=20) - tk.Label(self.frame, text="(Input pesanan manual)").pack() + tk.Label(self, text="WAITER", font=("Arial", 20, "bold")).pack(pady=20) + tk.Label(self, text="(Input pesanan manual)").pack() - tk.Button(self.frame, text="Logout", command=self.logout).pack(pady=10) - - def logout(self): - self.frame.destroy() - from main import LoginScreen - LoginScreen(self.parent) + tk.Button(self, text="Logout", command=lambda: controller.show_frame("Login")).pack(pady=10)