Merge branch 'main' of https://git-eng.ukwms.ac.id/5803025001/Python-Menu
This commit is contained in:
commit
0a67591be8
BIN
project/__pycache__/admin_dashboard.cpython-313.pyc
Normal file
BIN
project/__pycache__/admin_dashboard.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
project/__pycache__/kasir_dashboard.cpython-313.pyc
Normal file
BIN
project/__pycache__/kasir_dashboard.cpython-313.pyc
Normal file
Binary file not shown.
BIN
project/__pycache__/login.cpython-313.pyc
Normal file
BIN
project/__pycache__/login.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
project/__pycache__/pemilik_dashboard.cpython-313.pyc
Normal file
BIN
project/__pycache__/pemilik_dashboard.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -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()
|
||||
|
||||
@ -71,6 +71,4 @@ class KasirPage:
|
||||
|
||||
def logout(self):
|
||||
self.frame.destroy()
|
||||
from main import LoginScreen
|
||||
LoginScreen(self.parent)
|
||||
|
||||
self.controller.show_frame("Login")
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -35,6 +35,4 @@ class PemilikPage:
|
||||
|
||||
def logout(self):
|
||||
self.frame.destroy()
|
||||
from main import LoginScreen
|
||||
LoginScreen(self.parent)
|
||||
|
||||
self.controller.show_frame("Login")
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user