yym68686 commited on
Commit
776255b
·
1 Parent(s): eb0ff00

🐛 Bug: Fix the bug where the sheet cannot be closed when clicking the cancel button without filling in the content on the frontend add model sheet.

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -1363,6 +1363,7 @@ async def get_edit_sheet(row_id: str, x_api_key: str = Depends(get_api_key)):
1363
 
1364
  @frontend_router.get("/add-provider-sheet", response_class=HTMLResponse, dependencies=[Depends(frontend_rate_limit_dependency)])
1365
  async def get_add_provider_sheet():
 
1366
  edit_sheet_content = sheet.SheetContent(
1367
  sheet.SheetHeader(
1368
  sheet.SheetTitle("Add New Provider"),
@@ -1393,7 +1394,7 @@ async def get_add_provider_sheet():
1393
  form.FormField("Notes", "notes", placeholder="Enter any additional notes"),
1394
  Div(
1395
  button.button("Submit", variant="primary", type="submit"),
1396
- button.button("Cancel", variant="outline", class_="ml-2"),
1397
  class_="flex justify-end mt-4"
1398
  ),
1399
  hx_post="/submit/new",
@@ -1407,7 +1408,7 @@ async def get_add_provider_sheet():
1407
  )
1408
 
1409
  result = sheet.Sheet(
1410
- "add-provider-sheet",
1411
  Div(),
1412
  edit_sheet_content,
1413
  width="80%",
 
1363
 
1364
  @frontend_router.get("/add-provider-sheet", response_class=HTMLResponse, dependencies=[Depends(frontend_rate_limit_dependency)])
1365
  async def get_add_provider_sheet():
1366
+ sheet_id = "add-provider-sheet"
1367
  edit_sheet_content = sheet.SheetContent(
1368
  sheet.SheetHeader(
1369
  sheet.SheetTitle("Add New Provider"),
 
1394
  form.FormField("Notes", "notes", placeholder="Enter any additional notes"),
1395
  Div(
1396
  button.button("Submit", variant="primary", type="submit"),
1397
+ button.button("Cancel", variant="outline", type="button", class_="ml-2", onclick=f"toggleSheet('{sheet_id}')"),
1398
  class_="flex justify-end mt-4"
1399
  ),
1400
  hx_post="/submit/new",
 
1408
  )
1409
 
1410
  result = sheet.Sheet(
1411
+ sheet_id,
1412
  Div(),
1413
  edit_sheet_content,
1414
  width="80%",