|
|
|
@@ -18,6 +18,8 @@ PROMO_CSV = "promo.csv"
|
|
|
|
|
TRANSAKSI_CSV = "transaksi.csv"
|
|
|
|
|
DETAIL_TRANSAKSI_CSV = "detail_transaksi.csv"
|
|
|
|
|
FAVORITE_CSV = "favorite.csv"
|
|
|
|
|
MEJA_CSV = "meja.csv"
|
|
|
|
|
PEMBAYARAN_CSV = "pembayaran.csv"
|
|
|
|
|
IMG_PREVIEW_SIZE = (120, 80)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -63,6 +65,8 @@ def init_db_csv():
|
|
|
|
|
ensure_file(TRANSAKSI_CSV, ["id", "user_id", "nomor_meja", "total", "status", "promo_code", "subtotal", "item_discount", "promo_discount", "tanggal"])
|
|
|
|
|
ensure_file(DETAIL_TRANSAKSI_CSV, ["id", "transaksi_id", "menu_id", "qty", "harga_satuan", "subtotal_item"])
|
|
|
|
|
ensure_file(FAVORITE_CSV, ["user_id", "menu_id", "order_count", "last_ordered"])
|
|
|
|
|
ensure_file(MEJA_CSV, ["nomor_meja", "status", "transaksi_id"])
|
|
|
|
|
ensure_file(PEMBAYARAN_CSV, ["id", "transaksi_id", "metode_pembayaran", "jumlah_bayar", "status_pembayaran", "tanggal_bayar", "struk"])
|
|
|
|
|
|
|
|
|
|
seed_defaults()
|
|
|
|
|
|
|
|
|
@@ -126,6 +130,18 @@ def seed_defaults():
|
|
|
|
|
})
|
|
|
|
|
write_all(PROMO_CSV, ["code","type","value","min_total"], rows)
|
|
|
|
|
|
|
|
|
|
# Seed meja (10 meja default)
|
|
|
|
|
meja_rows = read_all(MEJA_CSV)
|
|
|
|
|
if not meja_rows:
|
|
|
|
|
rows = []
|
|
|
|
|
for i in range(1, 11): # Meja 1-10
|
|
|
|
|
rows.append({
|
|
|
|
|
"nomor_meja": str(i),
|
|
|
|
|
"status": "kosong",
|
|
|
|
|
"transaksi_id": ""
|
|
|
|
|
})
|
|
|
|
|
write_all(MEJA_CSV, ["nomor_meja", "status", "transaksi_id"], rows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|