Update app.py
Browse files
app.py
CHANGED
|
@@ -208,7 +208,7 @@ def create_salesforce_record(score, checklist_summary, missing_summary, status,
|
|
| 208 |
else:
|
| 209 |
logging.warning(f"No PDF file found at {pdf_path}. Skipping attachment and URL update.")
|
| 210 |
|
| 211 |
-
return f"Record created successfully. Record ID: {record_id}. PDF attached and URL set to: {pdf_download_url}"
|
| 212 |
except SalesforceError as e:
|
| 213 |
logging.error(f"Salesforce error while creating Project_Closure_Handover__c record: {str(e)}")
|
| 214 |
logging.error("Possible issues: Object permissions, field-level security, validation rules, or required fields.")
|
|
@@ -390,7 +390,7 @@ with gr.Blocks(css="""
|
|
| 390 |
gr.Markdown(
|
| 391 |
"""
|
| 392 |
# Project Closure Readiness Evaluator
|
| 393 |
-
Evaluate project readiness, generate a PDF report with signature slots.
|
| 394 |
"""
|
| 395 |
)
|
| 396 |
with gr.Row():
|
|
@@ -408,7 +408,7 @@ with gr.Blocks(css="""
|
|
| 408 |
value="Open Items",
|
| 409 |
allow_custom_value=False
|
| 410 |
)
|
| 411 |
-
submit_btn = gr.Button("Evaluate and
|
| 412 |
with gr.Column(scale=3):
|
| 413 |
score_output = gr.Number(label="Readiness Score (%)")
|
| 414 |
progress_output = gr.HTML(label="Alert Indicator: Progress")
|
|
@@ -421,6 +421,7 @@ with gr.Blocks(css="""
|
|
| 421 |
open_punch_items_output = gr.Number(label="Open Punch Items (Debug)")
|
| 422 |
pdf_output = gr.File(label="Download PDF Report", type="filepath", interactive=False)
|
| 423 |
pdf_debug = gr.Textbox(label="PDF Debug Output")
|
|
|
|
| 424 |
|
| 425 |
# Chain the evaluation, PDF generation, and Salesforce record creation
|
| 426 |
submit_btn.click(
|
|
@@ -437,9 +438,9 @@ with gr.Blocks(css="""
|
|
| 437 |
).then(
|
| 438 |
fn=create_salesforce_record,
|
| 439 |
inputs=[
|
| 440 |
-
score_output, checklist_output,
|
| 441 |
gr.State(), gr.State(), gr.State(), gr.State(), open_punch_items_output, pdf_output
|
| 442 |
],
|
| 443 |
-
outputs=
|
| 444 |
)
|
| 445 |
demo.launch()
|
|
|
|
| 208 |
else:
|
| 209 |
logging.warning(f"No PDF file found at {pdf_path}. Skipping attachment and URL update.")
|
| 210 |
|
| 211 |
+
return f"Record created successfully. Record ID: {record_id}. PDF attached and URL set to: {pdf_download_url}. Project ID: {project_id}"
|
| 212 |
except SalesforceError as e:
|
| 213 |
logging.error(f"Salesforce error while creating Project_Closure_Handover__c record: {str(e)}")
|
| 214 |
logging.error("Possible issues: Object permissions, field-level security, validation rules, or required fields.")
|
|
|
|
| 390 |
gr.Markdown(
|
| 391 |
"""
|
| 392 |
# Project Closure Readiness Evaluator
|
| 393 |
+
Evaluate project readiness, generate a PDF report with signature slots, and save to Salesforce.
|
| 394 |
"""
|
| 395 |
)
|
| 396 |
with gr.Row():
|
|
|
|
| 408 |
value="Open Items",
|
| 409 |
allow_custom_value=False
|
| 410 |
)
|
| 411 |
+
submit_btn = gr.Button("Evaluate, Generate PDF, and Save to Salesforce")
|
| 412 |
with gr.Column(scale=3):
|
| 413 |
score_output = gr.Number(label="Readiness Score (%)")
|
| 414 |
progress_output = gr.HTML(label="Alert Indicator: Progress")
|
|
|
|
| 421 |
open_punch_items_output = gr.Number(label="Open Punch Items (Debug)")
|
| 422 |
pdf_output = gr.File(label="Download PDF Report", type="filepath", interactive=False)
|
| 423 |
pdf_debug = gr.Textbox(label="PDF Debug Output")
|
| 424 |
+
salesforce_output = gr.Textbox(label="Salesforce Save Status")
|
| 425 |
|
| 426 |
# Chain the evaluation, PDF generation, and Salesforce record creation
|
| 427 |
submit_btn.click(
|
|
|
|
| 438 |
).then(
|
| 439 |
fn=create_salesforce_record,
|
| 440 |
inputs=[
|
| 441 |
+
score_output, checklist_output, missing_summary, status_output,
|
| 442 |
gr.State(), gr.State(), gr.State(), gr.State(), open_punch_items_output, pdf_output
|
| 443 |
],
|
| 444 |
+
outputs=[salesforce_output]
|
| 445 |
)
|
| 446 |
demo.launch()
|