Spaces:
Running
Running
Update src/modules/Check_Up_Loans.py
Browse files- src/modules/Check_Up_Loans.py +11 -11
src/modules/Check_Up_Loans.py
CHANGED
|
@@ -587,7 +587,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 587 |
else f"<span class='badge-update'>Version V{selected_loan.get('Version', '?')}</span>"
|
| 588 |
)
|
| 589 |
st.markdown(
|
| 590 |
-
f"
|
| 591 |
f"pour **{display_id}** {source_badge_html}",
|
| 592 |
unsafe_allow_html=True,
|
| 593 |
)
|
|
@@ -1104,7 +1104,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1104 |
),
|
| 1105 |
)
|
| 1106 |
submit_update = st.form_submit_button(
|
| 1107 |
-
"
|
| 1108 |
)
|
| 1109 |
|
| 1110 |
# =========================================================================
|
|
@@ -1173,7 +1173,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1173 |
ws_update.update_cell(row_index, col_date_modif_idx, now_str)
|
| 1174 |
|
| 1175 |
time.sleep(1)
|
| 1176 |
-
st.success(f"
|
| 1177 |
|
| 1178 |
# ------------------------------------------------------------------
|
| 1179 |
# B — Création de la nouvelle version dans Prets_Update
|
|
@@ -1230,7 +1230,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1230 |
ws_pu.append_row(_sanitize_row(new_row))
|
| 1231 |
time.sleep(1)
|
| 1232 |
st.success(
|
| 1233 |
-
f"
|
| 1234 |
f"(V{next_version}) → statut **ACTIF**"
|
| 1235 |
)
|
| 1236 |
|
|
@@ -1269,7 +1269,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1269 |
st.session_state.new_df_amort = df_amort_nouveau.copy()
|
| 1270 |
|
| 1271 |
st.cache_data.clear()
|
| 1272 |
-
st.success("
|
| 1273 |
|
| 1274 |
except Exception as e:
|
| 1275 |
st.error(f"❌ Erreur lors de la mise à jour : {e}")
|
|
@@ -1283,7 +1283,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1283 |
|
| 1284 |
if st.session_state.get("loan_updated", False):
|
| 1285 |
st.markdown('<div class="checkup-section-divider"></div>', unsafe_allow_html=True)
|
| 1286 |
-
st.markdown(f"###
|
| 1287 |
|
| 1288 |
loan_data_pdf = st.session_state.new_loan_data
|
| 1289 |
client_data_pdf = st.session_state.new_client_data
|
|
@@ -1295,7 +1295,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1295 |
with col_pdf1:
|
| 1296 |
pdf_contrat = generer_contrat_pret(loan_data_pdf, client_data_pdf, df_amort_pdf)
|
| 1297 |
st.download_button(
|
| 1298 |
-
"
|
| 1299 |
pdf_contrat,
|
| 1300 |
f"Contrat_{st.session_state.new_loan_id}.pdf",
|
| 1301 |
"application/pdf",
|
|
@@ -1305,7 +1305,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1305 |
with col_pdf2:
|
| 1306 |
pdf_dette = generer_reconnaissance_dette(loan_data_pdf, client_data_pdf)
|
| 1307 |
st.download_button(
|
| 1308 |
-
"
|
| 1309 |
pdf_dette,
|
| 1310 |
f"Dette_{st.session_state.new_loan_id}.pdf",
|
| 1311 |
"application/pdf",
|
|
@@ -1316,7 +1316,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1316 |
if garant_data_pdf:
|
| 1317 |
pdf_caution = generer_contrat_caution(loan_data_pdf, garant_data_pdf)
|
| 1318 |
st.download_button(
|
| 1319 |
-
"
|
| 1320 |
pdf_caution,
|
| 1321 |
f"Caution_{st.session_state.new_loan_id}.pdf",
|
| 1322 |
"application/pdf",
|
|
@@ -1326,7 +1326,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1326 |
st.info("Pas de garant")
|
| 1327 |
|
| 1328 |
with col_reset:
|
| 1329 |
-
if st.button("
|
| 1330 |
for key in [
|
| 1331 |
"loan_updated", "new_loan_id", "new_loan_data",
|
| 1332 |
"new_client_data", "new_garant_data", "new_df_amort",
|
|
@@ -1338,7 +1338,7 @@ def show_check_up_loans(client, sheet_name):
|
|
| 1338 |
|
| 1339 |
# Récapitulatif
|
| 1340 |
st.markdown("---")
|
| 1341 |
-
with st.expander("
|
| 1342 |
col_r1, col_r2 = st.columns(2)
|
| 1343 |
with col_r1:
|
| 1344 |
st.markdown("### Ancienne version")
|
|
|
|
| 587 |
else f"<span class='badge-update'>Version V{selected_loan.get('Version', '?')}</span>"
|
| 588 |
)
|
| 589 |
st.markdown(
|
| 590 |
+
f"Aucun remboursement détecté — **Modification autorisée** "
|
| 591 |
f"pour **{display_id}** {source_badge_html}",
|
| 592 |
unsafe_allow_html=True,
|
| 593 |
)
|
|
|
|
| 1104 |
),
|
| 1105 |
)
|
| 1106 |
submit_update = st.form_submit_button(
|
| 1107 |
+
"VALIDER LA MISE À JOUR", use_container_width=True
|
| 1108 |
)
|
| 1109 |
|
| 1110 |
# =========================================================================
|
|
|
|
| 1173 |
ws_update.update_cell(row_index, col_date_modif_idx, now_str)
|
| 1174 |
|
| 1175 |
time.sleep(1)
|
| 1176 |
+
st.success(f"{display_id} → statut **UPDATED**")
|
| 1177 |
|
| 1178 |
# ------------------------------------------------------------------
|
| 1179 |
# B — Création de la nouvelle version dans Prets_Update
|
|
|
|
| 1230 |
ws_pu.append_row(_sanitize_row(new_row))
|
| 1231 |
time.sleep(1)
|
| 1232 |
st.success(
|
| 1233 |
+
f"Nouvelle version créée : **{new_id_updated}** "
|
| 1234 |
f"(V{next_version}) → statut **ACTIF**"
|
| 1235 |
)
|
| 1236 |
|
|
|
|
| 1269 |
st.session_state.new_df_amort = df_amort_nouveau.copy()
|
| 1270 |
|
| 1271 |
st.cache_data.clear()
|
| 1272 |
+
st.success("Mise à jour effectuée avec succès !")
|
| 1273 |
|
| 1274 |
except Exception as e:
|
| 1275 |
st.error(f"❌ Erreur lors de la mise à jour : {e}")
|
|
|
|
| 1283 |
|
| 1284 |
if st.session_state.get("loan_updated", False):
|
| 1285 |
st.markdown('<div class="checkup-section-divider"></div>', unsafe_allow_html=True)
|
| 1286 |
+
st.markdown(f"### Documents du prêt **{st.session_state.new_loan_id}**")
|
| 1287 |
|
| 1288 |
loan_data_pdf = st.session_state.new_loan_data
|
| 1289 |
client_data_pdf = st.session_state.new_client_data
|
|
|
|
| 1295 |
with col_pdf1:
|
| 1296 |
pdf_contrat = generer_contrat_pret(loan_data_pdf, client_data_pdf, df_amort_pdf)
|
| 1297 |
st.download_button(
|
| 1298 |
+
"Contrat de Prêt",
|
| 1299 |
pdf_contrat,
|
| 1300 |
f"Contrat_{st.session_state.new_loan_id}.pdf",
|
| 1301 |
"application/pdf",
|
|
|
|
| 1305 |
with col_pdf2:
|
| 1306 |
pdf_dette = generer_reconnaissance_dette(loan_data_pdf, client_data_pdf)
|
| 1307 |
st.download_button(
|
| 1308 |
+
"Reconnaissance Dette",
|
| 1309 |
pdf_dette,
|
| 1310 |
f"Dette_{st.session_state.new_loan_id}.pdf",
|
| 1311 |
"application/pdf",
|
|
|
|
| 1316 |
if garant_data_pdf:
|
| 1317 |
pdf_caution = generer_contrat_caution(loan_data_pdf, garant_data_pdf)
|
| 1318 |
st.download_button(
|
| 1319 |
+
"Contrat Caution",
|
| 1320 |
pdf_caution,
|
| 1321 |
f"Caution_{st.session_state.new_loan_id}.pdf",
|
| 1322 |
"application/pdf",
|
|
|
|
| 1326 |
st.info("Pas de garant")
|
| 1327 |
|
| 1328 |
with col_reset:
|
| 1329 |
+
if st.button("Nouvelle Mise à Jour", use_container_width=True, type="primary"):
|
| 1330 |
for key in [
|
| 1331 |
"loan_updated", "new_loan_id", "new_loan_data",
|
| 1332 |
"new_client_data", "new_garant_data", "new_df_amort",
|
|
|
|
| 1338 |
|
| 1339 |
# Récapitulatif
|
| 1340 |
st.markdown("---")
|
| 1341 |
+
with st.expander("Récapitulatif de la mise à jour"):
|
| 1342 |
col_r1, col_r2 = st.columns(2)
|
| 1343 |
with col_r1:
|
| 1344 |
st.markdown("### Ancienne version")
|