Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from datetime import datetime, timedelta
|
| 3 |
|
| 4 |
-
# --- 1. 主題配色
|
| 5 |
theme = gr.themes.Soft(
|
| 6 |
primary_hue="amber",
|
| 7 |
neutral_hue="zinc",
|
|
@@ -17,24 +17,23 @@ theme = gr.themes.Soft(
|
|
| 17 |
block_title_text_color="#d4af37",
|
| 18 |
button_primary_background_fill="#d4af37",
|
| 19 |
button_primary_text_color="#000000",
|
| 20 |
-
# ⚠️ 已移除報錯的 table_row_focus_background_fill
|
| 21 |
)
|
| 22 |
|
| 23 |
-
# --- 2. CSS
|
| 24 |
custom_css = """
|
| 25 |
-
/* 隱藏 footer */
|
| 26 |
footer {display: none !important;}
|
| 27 |
|
| 28 |
-
/* 強制讓所有容器允許內容溢出
|
| 29 |
.gradio-container, .block, .row, .column {
|
| 30 |
overflow: visible !important;
|
| 31 |
}
|
| 32 |
|
| 33 |
-
/* 下拉選單樣式修正
|
| 34 |
.options, .wrap .options {
|
| 35 |
background-color: #262626 !important;
|
| 36 |
border: 1px solid #d4af37 !important;
|
| 37 |
-
z-index: 10000 !important;
|
| 38 |
box-shadow: 0 5px 15px rgba(0,0,0,0.5);
|
| 39 |
}
|
| 40 |
|
|
@@ -64,7 +63,7 @@ h3 {
|
|
| 64 |
}
|
| 65 |
"""
|
| 66 |
|
| 67 |
-
# --- 核心邏輯
|
| 68 |
def get_date_options():
|
| 69 |
options = []
|
| 70 |
today = datetime.now()
|
|
@@ -135,6 +134,14 @@ with gr.Blocks(theme=theme, css=custom_css, title="Booking") as demo:
|
|
| 135 |
gr.HTML("<div style='height: 20px'></div>")
|
| 136 |
submit_btn = gr.Button("確認預約 Request Booking", size="lg", variant="primary")
|
| 137 |
output_msg = gr.HTML(label="系統訊息")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
booking_date.change(update_time_slots, inputs=booking_date, outputs=[time_slot, status_box])
|
| 140 |
submit_btn.click(handle_booking, inputs=[cust_name, cust_tel, booking_date, time_slot, pax_count], outputs=output_msg)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from datetime import datetime, timedelta
|
| 3 |
|
| 4 |
+
# --- 1. 主題配色 ---
|
| 5 |
theme = gr.themes.Soft(
|
| 6 |
primary_hue="amber",
|
| 7 |
neutral_hue="zinc",
|
|
|
|
| 17 |
block_title_text_color="#d4af37",
|
| 18 |
button_primary_background_fill="#d4af37",
|
| 19 |
button_primary_text_color="#000000",
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
+
# --- 2. CSS ---
|
| 23 |
custom_css = """
|
| 24 |
+
/* 隱藏 Gradio 原生 footer */
|
| 25 |
footer {display: none !important;}
|
| 26 |
|
| 27 |
+
/* 強制讓所有容器允許內容溢出 */
|
| 28 |
.gradio-container, .block, .row, .column {
|
| 29 |
overflow: visible !important;
|
| 30 |
}
|
| 31 |
|
| 32 |
+
/* 下拉選單樣式修正 */
|
| 33 |
.options, .wrap .options {
|
| 34 |
background-color: #262626 !important;
|
| 35 |
border: 1px solid #d4af37 !important;
|
| 36 |
+
z-index: 10000 !important;
|
| 37 |
box-shadow: 0 5px 15px rgba(0,0,0,0.5);
|
| 38 |
}
|
| 39 |
|
|
|
|
| 63 |
}
|
| 64 |
"""
|
| 65 |
|
| 66 |
+
# --- 核心邏輯 ---
|
| 67 |
def get_date_options():
|
| 68 |
options = []
|
| 69 |
today = datetime.now()
|
|
|
|
| 134 |
gr.HTML("<div style='height: 20px'></div>")
|
| 135 |
submit_btn = gr.Button("確認預約 Request Booking", size="lg", variant="primary")
|
| 136 |
output_msg = gr.HTML(label="系統訊息")
|
| 137 |
+
|
| 138 |
+
# --- 新增的頁尾宣告區 ---
|
| 139 |
+
gr.HTML("""
|
| 140 |
+
<div style="text-align: center; margin-top: 50px; padding-top: 20px; border-top: 1px solid #333; color: #666; font-size: 0.8rem; line-height: 1.6;">
|
| 141 |
+
<p>© 2026 CIE CIE TAIPEI. All Rights Reserved.</p>
|
| 142 |
+
<p style="margin-top: 5px; color: #888;">內容涉及酒類產品訊息,請勿轉發分享給未達法定購買年齡者;未滿十八歲請勿飲酒。<br>喝酒不開車,開車不喝酒。</p>
|
| 143 |
+
</div>
|
| 144 |
+
""")
|
| 145 |
|
| 146 |
booking_date.change(update_time_slots, inputs=booking_date, outputs=[time_slot, status_box])
|
| 147 |
submit_btn.click(handle_booking, inputs=[cust_name, cust_tel, booking_date, time_slot, pax_count], outputs=output_msg)
|