Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1366,17 +1366,17 @@ with gr.Blocks(theme=gr.themes.Soft(), title="簡易訂單管理系統") as demo
|
|
| 1366 |
|
| 1367 |
with gr.Column(elem_classes="menu-card-admin"):
|
| 1368 |
with gr.Row():
|
| 1369 |
-
e_enable = gr.Checkbox(label="上架啟用", value=m.get("enable", True), min_width=50)
|
| 1370 |
-
e_seq = gr.Number(label="排序(流水號)", value=old_seq, precision=0, min_width=80)
|
| 1371 |
-
e_name = gr.Textbox(label="品項名稱", value=old_n)
|
| 1372 |
-
e_cat = gr.Dropdown(choices=existing_cats, label="分類", value=m.get("category", "未分類"), allow_custom_value=True)
|
| 1373 |
with gr.Row():
|
| 1374 |
-
e_price = gr.Number(label="價格(NT$)", value=m.get("price", 0), min_width=80)
|
| 1375 |
-
e_cost = gr.Number(label="成本(NT$)", value=m.get("cost", 0), min_width=80)
|
| 1376 |
-
e_spec = gr.Textbox(label="規格", value=m.get("spec", ""), placeholder="例如: 中杯、大份")
|
| 1377 |
with gr.Row():
|
| 1378 |
-
e_lvl = gr.Textbox(label="適用等級", value=m.get("level", "全部"), min_width=80)
|
| 1379 |
-
e_note = gr.Textbox(label="備註", value=m.get("note", ""), min_width=80)
|
| 1380 |
|
| 1381 |
with gr.Row():
|
| 1382 |
save_btn = gr.Button("💾 儲存", variant="primary")
|
|
@@ -1456,17 +1456,17 @@ with gr.Blocks(theme=gr.themes.Soft(), title="簡易訂單管理系統") as demo
|
|
| 1456 |
with gr.Column(elem_classes="menu-card-admin new-card-admin"):
|
| 1457 |
gr.Markdown("<h3 style='text-align:center; color:#3b82f6;'>✨ 新增菜單品項</h3>")
|
| 1458 |
with gr.Row():
|
| 1459 |
-
new_enable = gr.Checkbox(label="上架啟用", value=True, min_width=50)
|
| 1460 |
-
new_seq = gr.Number(label="排序(預設放最後)", value=len(MENU)+1, precision=0, min_width=80)
|
| 1461 |
-
new_name = gr.Textbox(label="品項名稱", placeholder="輸入新名稱...")
|
| 1462 |
-
new_cat = gr.Dropdown(choices=existing_cats, label="分類", value=cat_f if cat_f != "全部分類" else "未分類", allow_custom_value=True)
|
| 1463 |
with gr.Row():
|
| 1464 |
-
new_price = gr.Number(label="價格(NT$)", value=100, min_width=80)
|
| 1465 |
-
new_cost = gr.Number(label="成本(NT$)", value=50, min_width=80)
|
| 1466 |
-
new_spec = gr.Textbox(label="規格", placeholder="例如: 大杯、一份")
|
| 1467 |
with gr.Row():
|
| 1468 |
-
new_lvl = gr.Textbox(label="適用等級", value=lvl_f if lvl_f != "全部等級" else "全部", min_width=80)
|
| 1469 |
-
new_note = gr.Textbox(label="備註", placeholder="內部備註", min_width=80)
|
| 1470 |
add_btn = gr.Button("➕ 確認新增", variant="primary")
|
| 1471 |
|
| 1472 |
def add_item(seq_val, en_val, n_val, c_val, p_val, co_val, s_val, l_val, note_val, cur_cat, cur_lvl, cur_item):
|
|
|
|
| 1366 |
|
| 1367 |
with gr.Column(elem_classes="menu-card-admin"):
|
| 1368 |
with gr.Row():
|
| 1369 |
+
e_enable = gr.Checkbox(label="上架啟用", value=m.get("enable", True), min_width=50, interactive=True)
|
| 1370 |
+
e_seq = gr.Number(label="排序(流水號)", value=old_seq, precision=0, min_width=80, interactive=True)
|
| 1371 |
+
e_name = gr.Textbox(label="品項名稱", value=old_n, interactive=True)
|
| 1372 |
+
e_cat = gr.Dropdown(choices=existing_cats, label="分類", value=m.get("category", "未分類"), allow_custom_value=True, interactive=True)
|
| 1373 |
with gr.Row():
|
| 1374 |
+
e_price = gr.Number(label="價格(NT$)", value=m.get("price", 0), min_width=80, interactive=True)
|
| 1375 |
+
e_cost = gr.Number(label="成本(NT$)", value=m.get("cost", 0), min_width=80, interactive=True)
|
| 1376 |
+
e_spec = gr.Textbox(label="規格", value=m.get("spec", ""), placeholder="例如: 中杯、大份", interactive=True)
|
| 1377 |
with gr.Row():
|
| 1378 |
+
e_lvl = gr.Textbox(label="適用等級", value=m.get("level", "全部"), min_width=80, interactive=True)
|
| 1379 |
+
e_note = gr.Textbox(label="備註", value=m.get("note", ""), min_width=80, interactive=True)
|
| 1380 |
|
| 1381 |
with gr.Row():
|
| 1382 |
save_btn = gr.Button("💾 儲存", variant="primary")
|
|
|
|
| 1456 |
with gr.Column(elem_classes="menu-card-admin new-card-admin"):
|
| 1457 |
gr.Markdown("<h3 style='text-align:center; color:#3b82f6;'>✨ 新增菜單品項</h3>")
|
| 1458 |
with gr.Row():
|
| 1459 |
+
new_enable = gr.Checkbox(label="上架啟用", value=True, min_width=50, interactive=True)
|
| 1460 |
+
new_seq = gr.Number(label="排序(預設放最後)", value=len(MENU)+1, precision=0, min_width=80, interactive=True)
|
| 1461 |
+
new_name = gr.Textbox(label="品項名稱", placeholder="輸入新名稱...", interactive=True)
|
| 1462 |
+
new_cat = gr.Dropdown(choices=existing_cats, label="分類", value=cat_f if cat_f != "全部分類" else "未分類", allow_custom_value=True, interactive=True)
|
| 1463 |
with gr.Row():
|
| 1464 |
+
new_price = gr.Number(label="價格(NT$)", value=100, min_width=80, interactive=True)
|
| 1465 |
+
new_cost = gr.Number(label="成本(NT$)", value=50, min_width=80, interactive=True)
|
| 1466 |
+
new_spec = gr.Textbox(label="規格", placeholder="例如: 大杯、一份", interactive=True)
|
| 1467 |
with gr.Row():
|
| 1468 |
+
new_lvl = gr.Textbox(label="適用等級", value=lvl_f if lvl_f != "全部等級" else "全部", min_width=80, interactive=True)
|
| 1469 |
+
new_note = gr.Textbox(label="備註", placeholder="內部備註", min_width=80, interactive=True)
|
| 1470 |
add_btn = gr.Button("➕ 確認新增", variant="primary")
|
| 1471 |
|
| 1472 |
def add_item(seq_val, en_val, n_val, c_val, p_val, co_val, s_val, l_val, note_val, cur_cat, cur_lvl, cur_item):
|