Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -860,8 +860,14 @@ def autofill_delete_target(evt: gr.SelectData, df_data):
|
|
| 860 |
# 🖥️ 網頁介面 (UI)
|
| 861 |
# ----------------------------
|
| 862 |
custom_css = """
|
| 863 |
-
|
| 864 |
-
.menu-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 865 |
.action-btn {
|
| 866 |
font-size: 18px !important;
|
| 867 |
font-weight: bold !important;
|
|
@@ -1001,12 +1007,8 @@ with gr.Blocks(theme=gr.themes.Soft(), title="簡易訂單管理系統", css=cus
|
|
| 1001 |
gr.HTML("<div style='text-align: center; font-weight: bold; color: #64748b; font-size: 0.9em;'>圖示</div>")
|
| 1002 |
with gr.Column(scale=1, min_width=150):
|
| 1003 |
gr.HTML("<div style='display: flex; width: 100%; text-align: center; font-weight: bold; color: #64748b; font-size: 0.9em;'><div style='flex: 1;'>商品名稱</div><div style='flex: 1;'>規格</div><div style='flex: 1;'>單價</div></div>")
|
| 1004 |
-
with gr.Column(scale=0, min_width=
|
| 1005 |
-
gr.HTML("<div></div>")
|
| 1006 |
-
with gr.Column(scale=0, min_width=45):
|
| 1007 |
-
gr.HTML("<div style='text-align: center; font-weight: bold; color: #64748b; font-size: 0.9em;'>數量</div>") # 對齊輸入框
|
| 1008 |
-
with gr.Column(scale=0, min_width=36):
|
| 1009 |
-
gr.HTML("<div></div>") # 對齊加號按鈕
|
| 1010 |
# --------------------------------------------------
|
| 1011 |
|
| 1012 |
for item, details in items_by_cat[cat]:
|
|
@@ -1063,12 +1065,12 @@ with gr.Blocks(theme=gr.themes.Soft(), title="簡易訂單管理系統", css=cus
|
|
| 1063 |
"""
|
| 1064 |
gr.Markdown(info_html)
|
| 1065 |
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
|
| 1071 |
-
|
| 1072 |
|
| 1073 |
minus_btn.click(
|
| 1074 |
fn=None, inputs=[qty_box], outputs=[qty_box],
|
|
|
|
| 860 |
# 🖥️ 網頁介面 (UI)
|
| 861 |
# ----------------------------
|
| 862 |
custom_css = """
|
| 863 |
+
/* 強制橫排且不換行,確保選單和說明永遠左右對齊 */
|
| 864 |
+
.menu-row { border-bottom: 1px solid #e5e7eb; padding: 12px 0; align-items: center; flex-wrap: nowrap !important; gap: 8px !important; }
|
| 865 |
+
.menu-header { border-bottom: 2px solid #cbd5e1; padding: 8px 0; align-items: center; flex-wrap: nowrap !important; gap: 8px !important; background-color: #f8fafc; border-radius: 8px 8px 0 0; margin-bottom: 8px; }
|
| 866 |
+
|
| 867 |
+
/* 獨立控制數量群組 */
|
| 868 |
+
.qty-group { display: flex !important; flex-wrap: nowrap !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 4px !important; width: 100% !important; background: transparent !important; }
|
| 869 |
+
.qty-group > * { margin: 0 !important; }
|
| 870 |
+
|
| 871 |
.action-btn {
|
| 872 |
font-size: 18px !important;
|
| 873 |
font-weight: bold !important;
|
|
|
|
| 1007 |
gr.HTML("<div style='text-align: center; font-weight: bold; color: #64748b; font-size: 0.9em;'>圖示</div>")
|
| 1008 |
with gr.Column(scale=1, min_width=150):
|
| 1009 |
gr.HTML("<div style='display: flex; width: 100%; text-align: center; font-weight: bold; color: #64748b; font-size: 0.9em;'><div style='flex: 1;'>商品名稱</div><div style='flex: 1;'>規格</div><div style='flex: 1;'>單價</div></div>")
|
| 1010 |
+
with gr.Column(scale=0, min_width=120):
|
| 1011 |
+
gr.HTML("<div style='text-align: center; font-weight: bold; color: #64748b; font-size: 0.9em; width: 100%;'>數量</div>")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1012 |
# --------------------------------------------------
|
| 1013 |
|
| 1014 |
for item, details in items_by_cat[cat]:
|
|
|
|
| 1065 |
"""
|
| 1066 |
gr.Markdown(info_html)
|
| 1067 |
|
| 1068 |
+
# ====== 數量操作區:打包成獨立群組,強制綁定成橫列 ======
|
| 1069 |
+
with gr.Column(scale=0, min_width=120):
|
| 1070 |
+
with gr.Row(elem_classes="qty-group"):
|
| 1071 |
+
minus_btn = gr.Button("➖", elem_classes="action-btn", variant="secondary")
|
| 1072 |
+
qty_box = gr.Textbox(value="0", show_label=False, interactive=True, elem_classes="qty-input", container=False)
|
| 1073 |
+
plus_btn = gr.Button("➕", elem_classes="action-btn", variant="secondary")
|
| 1074 |
|
| 1075 |
minus_btn.click(
|
| 1076 |
fn=None, inputs=[qty_box], outputs=[qty_box],
|