Compare commits
No commits in common. "a90c1898a8404159dc761cda70b7c9dc81ccc489" and "12c3ff8c55d3015ff996b6a252b2ed2cd42db845" have entirely different histories.
a90c1898a8
...
12c3ff8c55
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -7,7 +7,6 @@ def setup_database():
|
||||
db = connect()
|
||||
cur = db.cursor()
|
||||
|
||||
# Users
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS users(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@ -17,7 +16,6 @@ def setup_database():
|
||||
)
|
||||
""")
|
||||
|
||||
# Menu
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS menu(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@ -27,16 +25,14 @@ def setup_database():
|
||||
)
|
||||
""")
|
||||
|
||||
# Orders
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS orders(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
nama TEXT,
|
||||
total REAL
|
||||
harga REAL
|
||||
)
|
||||
""")
|
||||
|
||||
# Pembayaran
|
||||
cur.execute("""
|
||||
CREATE TABLE IF NOT EXISTS pembayaran(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
@ -45,28 +41,19 @@ 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")
|
||||
("pemilik","pemilik","pemilik"),
|
||||
("waiter","waiter","waiter")
|
||||
]
|
||||
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)
|
||||
cur.executemany(
|
||||
"INSERT INTO users(username,password,role) VALUES (?,?,?)",
|
||||
users
|
||||
)
|
||||
db.commit()
|
||||
|
||||
db.close()
|
||||
|
||||
@ -71,4 +71,6 @@ class KasirPage:
|
||||
|
||||
def logout(self):
|
||||
self.frame.destroy()
|
||||
self.controller.show_frame("Login")
|
||||
from main import LoginScreen
|
||||
LoginScreen(self.parent)
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@ 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 ---
|
||||
@ -36,10 +38,19 @@ class LoginScreen:
|
||||
self.frame.destroy()
|
||||
if role=="pembeli":
|
||||
PembeliMenu(self.root)
|
||||
|
||||
elif role=="kasir":
|
||||
KasirPage(self.root)
|
||||
KasirPage(self.root, self.root)
|
||||
|
||||
elif role=="pemilik":
|
||||
PemilikPage(self.root)
|
||||
PemilikPage(self.root, self.root)
|
||||
|
||||
elif role == "admin":
|
||||
AdminMenu(self.root)
|
||||
|
||||
elif role == "waiter":
|
||||
WaiterDashboard(self.root)
|
||||
|
||||
else:
|
||||
messagebox.showerror("Error","Role tidak dikenali")
|
||||
else:
|
||||
|
||||
@ -35,4 +35,6 @@ class PemilikPage:
|
||||
|
||||
def logout(self):
|
||||
self.frame.destroy()
|
||||
self.controller.show_frame("Login")
|
||||
from main import LoginScreen
|
||||
LoginScreen(self.parent)
|
||||
|
||||
|
||||
@ -1,10 +1,17 @@
|
||||
import tkinter as tk
|
||||
|
||||
class WaiterDashboard(tk.Frame):
|
||||
def __init__(self, parent, controller):
|
||||
super().__init__(parent)
|
||||
class WaiterDashboard:
|
||||
def __init__(self, parent):
|
||||
self.parent = parent
|
||||
self.frame = tk.Frame(parent)
|
||||
self.frame.pack(fill="both", expand=True)
|
||||
|
||||
tk.Label(self, text="WAITER", font=("Arial", 20, "bold")).pack(pady=20)
|
||||
tk.Label(self, text="(Input pesanan manual)").pack()
|
||||
tk.Label(self.frame, text="WAITER", font=("Arial", 20, "bold")).pack(pady=20)
|
||||
tk.Label(self.frame, text="(Input pesanan manual)").pack()
|
||||
|
||||
tk.Button(self, text="Logout", command=lambda: controller.show_frame("Login")).pack(pady=10)
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user