GoogleCalc commited on
Commit
1d5593e
Β·
verified Β·
1 Parent(s): 3339da2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -56
app.py CHANGED
@@ -1232,64 +1232,60 @@ with gr.Column(scale=1, min_width=350):
1232
  wrap=True,
1233
  )
1234
 
1235
- # ============================================================
1236
- # ADMIN-ONLY ANALYTICS TAB
1237
- # ============================================================
1238
 
1239
- with gr.TabItem("πŸ”’ Admin"):
1240
- gr.Markdown("### πŸ”’ Admin Dashboard")
1241
-
1242
- with gr.Group(elem_classes="admin-login"):
1243
- gr.Markdown("Enter admin password to view analytics and download data.")
1244
-
1245
- with gr.Row():
1246
- admin_password_input = gr.Textbox(
1247
- label="Admin Password",
1248
- placeholder="Enter password...",
1249
- type="password",
1250
- scale=2,
1251
- )
1252
- login_btn = gr.Button("Login", variant="primary", scale=1)
1253
- logout_btn = gr.Button("Logout", variant="secondary", scale=1)
1254
-
1255
- # Analytics output
1256
- admin_output = gr.Markdown("πŸ”’ Enter password to view analytics.")
1257
-
1258
- # Export buttons
1259
- with gr.Row():
1260
- export_leads_btn = gr.Button("πŸ“₯ Export Leads (CSV)", variant="secondary")
1261
- export_leads_output = gr.File(label="Download Leads CSV")
1262
-
1263
- with gr.Row():
1264
- export_calc_btn = gr.Button("πŸ“₯ Export Calculations (CSV)", variant="secondary")
1265
- export_calc_output = gr.File(label="Download Calculations CSV")
1266
-
1267
- # Login/Logout events
1268
- login_btn.click(
1269
- fn=admin_login,
1270
- inputs=[admin_password_input],
1271
- outputs=[admin_output, admin_password_input, logout_btn],
1272
- )
1273
-
1274
- logout_btn.click(
1275
- fn=logout_admin,
1276
- inputs=[],
1277
- outputs=[admin_output, admin_password_input, logout_btn],
1278
- )
1279
-
1280
- # Export events
1281
- export_leads_btn.click(
1282
- fn=export_leads_wrapper,
1283
- inputs=[],
1284
- outputs=[export_leads_output],
1285
- )
1286
-
1287
- export_calc_btn.click(
1288
- fn=export_calculations_wrapper,
1289
- inputs=[],
1290
- outputs=[export_calc_output],
1291
  )
1292
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1293
  # ============================================================
1294
  # BREED REFERENCE
1295
  # ============================================================
 
1232
  wrap=True,
1233
  )
1234
 
1235
+ # ============================================================
1236
+ # ADMIN-ONLY ANALYTICS TAB
1237
+ # ============================================================
1238
 
1239
+ with gr.TabItem("πŸ”’ Admin"):
1240
+ gr.Markdown("### πŸ”’ Admin Dashboard")
1241
+
1242
+ with gr.Group(elem_classes="admin-login"):
1243
+ gr.Markdown("Enter admin password to view analytics and download data.")
1244
+
1245
+ with gr.Row():
1246
+ admin_password_input = gr.Textbox(
1247
+ label="Admin Password",
1248
+ placeholder="Enter password...",
1249
+ type="password",
1250
+ scale=2,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1251
  )
1252
+ login_btn = gr.Button("Login", variant="primary", scale=1)
1253
+ logout_btn = gr.Button("Logout", variant="secondary", scale=1)
1254
+
1255
+ admin_output = gr.Markdown("πŸ”’ Enter password to view analytics.")
1256
+
1257
+ with gr.Row():
1258
+ export_leads_btn = gr.Button("πŸ“₯ Export Leads (CSV)", variant="secondary")
1259
+ export_leads_output = gr.File(label="Download Leads CSV")
1260
+
1261
+ with gr.Row():
1262
+ export_calc_btn = gr.Button("πŸ“₯ Export Calculations (CSV)", variant="secondary")
1263
+ export_calc_output = gr.File(label="Download Calculations CSV")
1264
+
1265
+ # Login/Logout events
1266
+ login_btn.click(
1267
+ fn=admin_login,
1268
+ inputs=[admin_password_input],
1269
+ outputs=[admin_output, admin_password_input, logout_btn],
1270
+ )
1271
+
1272
+ logout_btn.click(
1273
+ fn=logout_admin,
1274
+ inputs=[],
1275
+ outputs=[admin_output, admin_password_input, logout_btn],
1276
+ )
1277
+
1278
+ export_leads_btn.click(
1279
+ fn=export_leads_wrapper,
1280
+ inputs=[],
1281
+ outputs=[export_leads_output],
1282
+ )
1283
+
1284
+ export_calc_btn.click(
1285
+ fn=export_calculations_wrapper,
1286
+ inputs=[],
1287
+ outputs=[export_calc_output],
1288
+ )
1289
  # ============================================================
1290
  # BREED REFERENCE
1291
  # ============================================================