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()
|
db = connect()
|
||||||
cur = db.cursor()
|
cur = db.cursor()
|
||||||
|
|
||||||
|
# Users
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS users(
|
CREATE TABLE IF NOT EXISTS users(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
@ -16,6 +17,7 @@ def setup_database():
|
|||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# Menu
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS menu(
|
CREATE TABLE IF NOT EXISTS menu(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
@ -25,14 +27,16 @@ def setup_database():
|
|||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# Orders
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS orders(
|
CREATE TABLE IF NOT EXISTS orders(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
nama TEXT,
|
nama TEXT,
|
||||||
harga REAL
|
total REAL
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# Pembayaran
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS pembayaran(
|
CREATE TABLE IF NOT EXISTS pembayaran(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
@ -41,19 +45,28 @@ def setup_database():
|
|||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
# User default
|
||||||
cur.execute("SELECT COUNT(*) FROM users")
|
cur.execute("SELECT COUNT(*) FROM users")
|
||||||
if cur.fetchone()[0] == 0:
|
if cur.fetchone()[0] == 0:
|
||||||
users = [
|
users = [
|
||||||
("admin","admin","admin"),
|
("admin","admin","admin"),
|
||||||
("kasir","kasir","kasir"),
|
("kasir","kasir","kasir"),
|
||||||
("pembeli","pembeli","pembeli"),
|
("pembeli","pembeli","pembeli"),
|
||||||
("pemilik","pemilik","pemilik"),
|
("pemilik","pemilik","pemilik")
|
||||||
("waiter","waiter","waiter")
|
|
||||||
]
|
]
|
||||||
cur.executemany(
|
cur.executemany("INSERT INTO users(username,password,role) VALUES (?,?,?)", users)
|
||||||
"INSERT INTO users(username,password,role) VALUES (?,?,?)",
|
db.commit()
|
||||||
users
|
|
||||||
)
|
# 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.commit()
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
|
|||||||
@ -71,6 +71,4 @@ class KasirPage:
|
|||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
self.frame.destroy()
|
self.frame.destroy()
|
||||||
from main import LoginScreen
|
self.controller.show_frame("Login")
|
||||||
LoginScreen(self.parent)
|
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,6 @@ from database import setup_database, connect
|
|||||||
from pembeli_menu import PembeliMenu
|
from pembeli_menu import PembeliMenu
|
||||||
from kasir import KasirPage
|
from kasir import KasirPage
|
||||||
from pemilik import PemilikPage
|
from pemilik import PemilikPage
|
||||||
from admin_menu import AdminMenu
|
|
||||||
from waiter_dashboard import WaiterDashboard
|
|
||||||
from tkinter import messagebox
|
from tkinter import messagebox
|
||||||
|
|
||||||
# --- Login Screen ---
|
# --- Login Screen ---
|
||||||
@ -38,19 +36,10 @@ class LoginScreen:
|
|||||||
self.frame.destroy()
|
self.frame.destroy()
|
||||||
if role=="pembeli":
|
if role=="pembeli":
|
||||||
PembeliMenu(self.root)
|
PembeliMenu(self.root)
|
||||||
|
|
||||||
elif role=="kasir":
|
elif role=="kasir":
|
||||||
KasirPage(self.root, self.root)
|
KasirPage(self.root)
|
||||||
|
|
||||||
elif role=="pemilik":
|
elif role=="pemilik":
|
||||||
PemilikPage(self.root, self.root)
|
PemilikPage(self.root)
|
||||||
|
|
||||||
elif role == "admin":
|
|
||||||
AdminMenu(self.root)
|
|
||||||
|
|
||||||
elif role == "waiter":
|
|
||||||
WaiterDashboard(self.root)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
messagebox.showerror("Error","Role tidak dikenali")
|
messagebox.showerror("Error","Role tidak dikenali")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -35,6 +35,4 @@ class PemilikPage:
|
|||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
self.frame.destroy()
|
self.frame.destroy()
|
||||||
from main import LoginScreen
|
self.controller.show_frame("Login")
|
||||||
LoginScreen(self.parent)
|
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,10 @@
|
|||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
class WaiterDashboard:
|
class WaiterDashboard(tk.Frame):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent, controller):
|
||||||
self.parent = parent
|
super().__init__(parent)
|
||||||
self.frame = tk.Frame(parent)
|
|
||||||
self.frame.pack(fill="both", expand=True)
|
|
||||||
|
|
||||||
tk.Label(self.frame, text="WAITER", font=("Arial", 20, "bold")).pack(pady=20)
|
tk.Label(self, text="WAITER", font=("Arial", 20, "bold")).pack(pady=20)
|
||||||
tk.Label(self.frame, text="(Input pesanan manual)").pack()
|
tk.Label(self, text="(Input pesanan manual)").pack()
|
||||||
|
|
||||||
tk.Button(self.frame, text="Logout", command=self.logout).pack(pady=10)
|
tk.Button(self, text="Logout", command=lambda: controller.show_frame("Login")).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