mirror of
https://github.com/Hestia-Homes/insight.git
synced 2026-06-08 11:17:25 +00:00
got the link working
This commit is contained in:
parent
6bb2128c6a
commit
c249ebb62d
1 changed files with 21 additions and 8 deletions
|
|
@ -254,37 +254,50 @@ def update_tables(selected_date, n_clicks):
|
|||
|
||||
return planned_records, completed_records
|
||||
|
||||
|
||||
def id_to_link(deal_id):
|
||||
url = f"https://app.hubspot.com/contacts/145275138/record/0-3/{deal_id}"
|
||||
return html.Li(
|
||||
html.A(deal_id, href=url, target="_blank", style={"textDecoration": "none"})
|
||||
)
|
||||
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Callback: Modal for Planned + Completed tables
|
||||
# -----------------------------------------------------
|
||||
@app.callback(
|
||||
Output("hubspot-modal", "is_open"),
|
||||
Output("modal-body", "children"),
|
||||
Output("planned-table", "selected_rows"),
|
||||
Output("completed-table", "selected_rows"),
|
||||
Input("planned-table", "selected_rows"),
|
||||
Input("completed-table", "selected_rows"),
|
||||
Input("close-modal", "n_clicks"),
|
||||
State("planned-table", "data"),
|
||||
State("completed-table", "data"),
|
||||
State("hubspot-modal", "is_open"),
|
||||
State("hubspot-modal", "is_open")
|
||||
)
|
||||
def open_modal(planned_rows, completed_rows, close_click,
|
||||
planned_data, completed_data, is_open):
|
||||
|
||||
if close_click:
|
||||
return False, ""
|
||||
return False, "", [], []
|
||||
|
||||
# Planned table click
|
||||
# Planned table
|
||||
if planned_rows:
|
||||
row = planned_data[planned_rows[0]]
|
||||
return True, html.Ul([html.Li(i) for i in row["HubSpot IDs"].split(", ")])
|
||||
ids = row["HubSpot IDs"].split(", ")
|
||||
links = [id_to_link(i) for i in ids]
|
||||
return True, html.Ul(links), [], []
|
||||
|
||||
# Completed table click
|
||||
# Completed table
|
||||
if completed_rows:
|
||||
row = completed_data[completed_rows[0]]
|
||||
return True, html.Ul([html.Li(i) for i in row["HubSpot IDs"].split(", ")])
|
||||
|
||||
return False, ""
|
||||
ids = row["HubSpot IDs"].split(", ")
|
||||
links = [id_to_link(i) for i in ids]
|
||||
return True, html.Ul(links), [], []
|
||||
|
||||
return False, "", [], []
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue