Spaces:
Sleeping
Sleeping
Commit ·
0a6e75a
1
Parent(s): ca9bd67
Add the comment to Agency pregeneration
Browse files- index.html +75 -70
- index.js +92 -0
- style.css +27 -0
index.html
CHANGED
|
@@ -441,6 +441,55 @@
|
|
| 441 |
<legend>🏗 Caractéristiques de la recherche</legend>
|
| 442 |
<div class="form-grid">
|
| 443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
<div class="form-group span-2">
|
| 445 |
<label>Type de recherche</label>
|
| 446 |
<div class="search-tabs" role="tablist" aria-label="Type de recherche">
|
|
@@ -450,46 +499,46 @@
|
|
| 450 |
</label>
|
| 451 |
<label class="radio-pill search-tab">
|
| 452 |
<input type="radio" name="type_search" value="achat" />
|
| 453 |
-
Achat
|
| 454 |
</label>
|
| 455 |
</div>
|
| 456 |
</div>
|
| 457 |
|
| 458 |
-
<div class="form-group">
|
| 459 |
<label>Type de logement</label>
|
| 460 |
<div class="radio-group">
|
| 461 |
<label class="radio-pill">
|
| 462 |
<input type="radio" name="type_logement" value="studio" />
|
| 463 |
-
Studio
|
| 464 |
</label>
|
| 465 |
<label class="radio-pill">
|
| 466 |
<input type="radio" name="type_logement" value="maison" />
|
| 467 |
-
Maison
|
| 468 |
</label>
|
| 469 |
<label class="radio-pill">
|
| 470 |
<input type="radio" name="type_logement" value="t1t2" />
|
| 471 |
-
T1/T2
|
| 472 |
</label>
|
| 473 |
<label class="radio-pill">
|
| 474 |
<input type="radio" name="type_logement" value="t3plus" />
|
| 475 |
-
T3+
|
| 476 |
</label>
|
| 477 |
</div>
|
| 478 |
</div>
|
| 479 |
|
| 480 |
-
<div class="form-group">
|
| 481 |
-
<label for="surface">Surface (m²)</label>
|
| 482 |
<input type="number" id="surface" min="0" step="0.5" />
|
| 483 |
</div>
|
| 484 |
<div class="form-group">
|
| 485 |
-
<label for="etage">Étage</label>
|
| 486 |
<input type="text" id="etage" placeholder="RDC, 1er…" />
|
| 487 |
</div>
|
| 488 |
|
| 489 |
<div class="search-panel span-2" data-search-panel="location">
|
| 490 |
<div class="search-panel-title">🔁 Recherche location</div>
|
| 491 |
<div class="form-grid">
|
| 492 |
-
<div class="form-group">
|
| 493 |
<label>Type de bail</label>
|
| 494 |
<div class="radio-group">
|
| 495 |
<label class="radio-pill">
|
|
@@ -503,7 +552,7 @@
|
|
| 503 |
</div>
|
| 504 |
</div>
|
| 505 |
|
| 506 |
-
<div class="form-group">
|
| 507 |
<legend>💶 Finances</legend>
|
| 508 |
<label for="loyer_hc">Loyer hors charges (€)</label>
|
| 509 |
<input type="number" id="loyer_hc" min="0" step="1" oninput="calcLoyerCC()" />
|
|
@@ -511,9 +560,9 @@
|
|
| 511 |
<div class="form-group">
|
| 512 |
<label for="charges">Provisions charges (€)</label>
|
| 513 |
<input type="number" id="charges" min="0" step="1" oninput="calcLoyerCC()" />
|
| 514 |
-
</div>
|
| 515 |
|
| 516 |
-
<div class="form-group span-2">
|
| 517 |
<label>Charges comprenant</label>
|
| 518 |
<div class="checkbox-group">
|
| 519 |
<label class="check-pill">
|
|
@@ -533,9 +582,9 @@
|
|
| 533 |
⚡ Électricité
|
| 534 |
</label>
|
| 535 |
</div>
|
| 536 |
-
</div>
|
| 537 |
|
| 538 |
-
<div class="form-group loyer-total">
|
| 539 |
<label for="loyer_cc">Loyer total CC (€) — calculé auto</label>
|
| 540 |
<input type="number" id="loyer_cc" min="0" readonly class="input-readonly" />
|
| 541 |
</div>
|
|
@@ -547,13 +596,13 @@
|
|
| 547 |
<div class="form-group">
|
| 548 |
<label for="frais_agence">Frais d'agence (€)</label>
|
| 549 |
<input type="number" id="frais_agence" min="0" />
|
| 550 |
-
</div>
|
| 551 |
<div class="form-group">
|
| 552 |
<label for="disponibilite">Disponibilité</label>
|
| 553 |
<input type="date" id="disponibilite" />
|
| 554 |
</div>
|
| 555 |
|
| 556 |
-
<div class="form-group">
|
| 557 |
<label>Chauffage</label>
|
| 558 |
<div class="radio-group">
|
| 559 |
<label class="radio-pill">
|
|
@@ -569,11 +618,7 @@
|
|
| 569 |
</div>
|
| 570 |
</div>
|
| 571 |
|
| 572 |
-
|
| 573 |
-
<label for="facture_energie_exemple">Facture énergie exemple (€/mois)</label>
|
| 574 |
-
<input type="text" id="facture_energie_exemple"
|
| 575 |
-
placeholder="Ex : ~80 €/mois hiver" />
|
| 576 |
-
</div>
|
| 577 |
</div>
|
| 578 |
</div>
|
| 579 |
|
|
@@ -590,51 +635,6 @@
|
|
| 590 |
|
| 591 |
</div>
|
| 592 |
</fieldset>
|
| 593 |
-
<!-- ── SECTION 2 : Identification ── -->
|
| 594 |
-
|
| 595 |
-
<fieldset>
|
| 596 |
-
<legend>📍 Identification du bien</legend>
|
| 597 |
-
<div class="form-grid">
|
| 598 |
-
<div class="form-group span-2">
|
| 599 |
-
<label for="adresse">Adresse complète</label>
|
| 600 |
-
<input type="text" id="adresse"
|
| 601 |
-
placeholder="Ex : 9 rue des flanders, 67000 Picaddily" />
|
| 602 |
-
</div>
|
| 603 |
-
<div class="form-group">
|
| 604 |
-
<label for="date_visite">Date de visite</label>
|
| 605 |
-
<input type="date" id="date_visite" />
|
| 606 |
-
</div>
|
| 607 |
-
<div class="form-group">
|
| 608 |
-
<label for="heure_visite">Heure</label>
|
| 609 |
-
<input type="time" id="heure_visite" />
|
| 610 |
-
</div>
|
| 611 |
-
<div class="form-group">
|
| 612 |
-
<label for="contact_nom">Contact</label>
|
| 613 |
-
<input type="text" id="contact_nom" placeholder="Agence / Propriétaire" />
|
| 614 |
-
</div>
|
| 615 |
-
<div class="form-group">
|
| 616 |
-
<label for="contact_tel">Téléphone</label>
|
| 617 |
-
<input type="tel" id="contact_tel" placeholder="06 …" />
|
| 618 |
-
</div>
|
| 619 |
-
</div>
|
| 620 |
-
</fieldset>
|
| 621 |
-
|
| 622 |
-
<!-- ── SECTION 2 : Images ── -->
|
| 623 |
-
<fieldset>
|
| 624 |
-
<legend>📷 Images</legend>
|
| 625 |
-
<div class="form-grid">
|
| 626 |
-
<div class="form-group span-2">
|
| 627 |
-
<label for="images">Ajouter des images</label>
|
| 628 |
-
<input type="file" id="images" accept="image/*" multiple />
|
| 629 |
-
<div class="form-help">Formats image acceptés, plusieurs fichiers possibles.</div>
|
| 630 |
-
</div>
|
| 631 |
-
<div class="form-group span-2">
|
| 632 |
-
<div id="imagePreview" class="image-preview-grid">
|
| 633 |
-
<div class="image-preview-empty">Aucune image sélectionnée</div>
|
| 634 |
-
</div>
|
| 635 |
-
</div>
|
| 636 |
-
</div>
|
| 637 |
-
</fieldset>
|
| 638 |
|
| 639 |
|
| 640 |
|
|
@@ -653,7 +653,7 @@
|
|
| 653 |
|
| 654 |
<div class="form-group span-2">
|
| 655 |
<label>Charges comprenant</label>
|
| 656 |
-
<div class="
|
| 657 |
<label class="check-pill">
|
| 658 |
<input type="checkbox" id="charges_eau_froide" />
|
| 659 |
💧 Eau froide
|
|
@@ -673,6 +673,11 @@
|
|
| 673 |
</div>
|
| 674 |
</div>
|
| 675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 676 |
<div class="form-group loyer-total">
|
| 677 |
<label for="loyer_cc">Loyer total CC (€) — calculé auto</label>
|
| 678 |
<input type="number" id="loyer_cc" min="0" readonly class="input-readonly" />
|
|
@@ -686,10 +691,10 @@
|
|
| 686 |
<label for="frais_agence">Frais d'agence (€)</label>
|
| 687 |
<input type="number" id="frais_agence" min="0" />
|
| 688 |
</div>
|
| 689 |
-
<div class="form-group">
|
| 690 |
<label for="disponibilite">Disponibilité</label>
|
| 691 |
<input type="date" id="disponibilite" />
|
| 692 |
-
</div>
|
| 693 |
|
| 694 |
<!-- Coût total entrée calculé -->
|
| 695 |
<div class="form-group span-2 cout-entree-block">
|
|
|
|
| 441 |
<legend>🏗 Caractéristiques de la recherche</legend>
|
| 442 |
<div class="form-grid">
|
| 443 |
|
| 444 |
+
|
| 445 |
+
<!-- ── SECTION 2 : Identification ── -->
|
| 446 |
+
|
| 447 |
+
<fieldset>
|
| 448 |
+
<legend>📍 Identification du bien</legend>
|
| 449 |
+
<div class="form-grid">
|
| 450 |
+
<div class="form-group span-2">
|
| 451 |
+
<label for="adresse"> 📍 Adresse complète</label>
|
| 452 |
+
<input type="text" id="adresse"
|
| 453 |
+
placeholder="Ex : 9 rue des flanders, 67000 Picaddily" />
|
| 454 |
+
</div>
|
| 455 |
+
<div class="form-group">
|
| 456 |
+
<label for="date_visite">📆 Date de visite</label>
|
| 457 |
+
<input type="date" id="date_visite" />
|
| 458 |
+
</div>
|
| 459 |
+
<div class="form-group">
|
| 460 |
+
<label for="heure_visite">⌚️ Heure</label>
|
| 461 |
+
<input type="time" id="heure_visite" />
|
| 462 |
+
</div>
|
| 463 |
+
<div class="form-group">
|
| 464 |
+
<label for="contact_nom">📇 Contact</label>
|
| 465 |
+
<input type="text" id="contact_nom" placeholder="Agence / Propriétaire" />
|
| 466 |
+
</div>
|
| 467 |
+
<div class="form-group">
|
| 468 |
+
<label for="contact_tel">☎️ Téléphone</label>
|
| 469 |
+
<input type="tel" id="contact_tel" placeholder="06 …" />
|
| 470 |
+
</div>
|
| 471 |
+
</div>
|
| 472 |
+
</fieldset>
|
| 473 |
+
|
| 474 |
+
<!-- ── SECTION 2 : Images ── -->
|
| 475 |
+
<fieldset>
|
| 476 |
+
<legend>📷 Images</legend>
|
| 477 |
+
<div class="form-grid">
|
| 478 |
+
<div class="form-group span-2">
|
| 479 |
+
<label for="images">Ajouter des images</label>
|
| 480 |
+
<input type="file" id="images" accept="image/*" multiple />
|
| 481 |
+
<div class="form-help">Formats image acceptés, plusieurs fichiers possibles.
|
| 482 |
+
</div>
|
| 483 |
+
</div>
|
| 484 |
+
<div class="form-group span-2">
|
| 485 |
+
<div id="imagePreview" class="image-preview-grid">
|
| 486 |
+
<div class="image-preview-empty">Aucune image sélectionnée</div>
|
| 487 |
+
</div>
|
| 488 |
+
</div>
|
| 489 |
+
</div>
|
| 490 |
+
</fieldset>
|
| 491 |
+
|
| 492 |
+
|
| 493 |
<div class="form-group span-2">
|
| 494 |
<label>Type de recherche</label>
|
| 495 |
<div class="search-tabs" role="tablist" aria-label="Type de recherche">
|
|
|
|
| 499 |
</label>
|
| 500 |
<label class="radio-pill search-tab">
|
| 501 |
<input type="radio" name="type_search" value="achat" />
|
| 502 |
+
💶 Achat
|
| 503 |
</label>
|
| 504 |
</div>
|
| 505 |
</div>
|
| 506 |
|
| 507 |
+
<div class="form-group span-2">
|
| 508 |
<label>Type de logement</label>
|
| 509 |
<div class="radio-group">
|
| 510 |
<label class="radio-pill">
|
| 511 |
<input type="radio" name="type_logement" value="studio" />
|
| 512 |
+
🛖 Studio
|
| 513 |
</label>
|
| 514 |
<label class="radio-pill">
|
| 515 |
<input type="radio" name="type_logement" value="maison" />
|
| 516 |
+
🏡 Maison
|
| 517 |
</label>
|
| 518 |
<label class="radio-pill">
|
| 519 |
<input type="radio" name="type_logement" value="t1t2" />
|
| 520 |
+
🏠T1/T2
|
| 521 |
</label>
|
| 522 |
<label class="radio-pill">
|
| 523 |
<input type="radio" name="type_logement" value="t3plus" />
|
| 524 |
+
🏘️ T3+
|
| 525 |
</label>
|
| 526 |
</div>
|
| 527 |
</div>
|
| 528 |
|
| 529 |
+
<div class="form-group span-1">
|
| 530 |
+
<label for="surface">📏 Surface (m²)</label>
|
| 531 |
<input type="number" id="surface" min="0" step="0.5" />
|
| 532 |
</div>
|
| 533 |
<div class="form-group">
|
| 534 |
+
<label for="etage">🚪 Étage</label>
|
| 535 |
<input type="text" id="etage" placeholder="RDC, 1er…" />
|
| 536 |
</div>
|
| 537 |
|
| 538 |
<div class="search-panel span-2" data-search-panel="location">
|
| 539 |
<div class="search-panel-title">🔁 Recherche location</div>
|
| 540 |
<div class="form-grid">
|
| 541 |
+
<div class="form-group span-2">
|
| 542 |
<label>Type de bail</label>
|
| 543 |
<div class="radio-group">
|
| 544 |
<label class="radio-pill">
|
|
|
|
| 552 |
</div>
|
| 553 |
</div>
|
| 554 |
|
| 555 |
+
<!-- <div class="form-group">
|
| 556 |
<legend>💶 Finances</legend>
|
| 557 |
<label for="loyer_hc">Loyer hors charges (€)</label>
|
| 558 |
<input type="number" id="loyer_hc" min="0" step="1" oninput="calcLoyerCC()" />
|
|
|
|
| 560 |
<div class="form-group">
|
| 561 |
<label for="charges">Provisions charges (€)</label>
|
| 562 |
<input type="number" id="charges" min="0" step="1" oninput="calcLoyerCC()" />
|
| 563 |
+
</div> -->
|
| 564 |
|
| 565 |
+
<!-- <div class="form-group span-2">
|
| 566 |
<label>Charges comprenant</label>
|
| 567 |
<div class="checkbox-group">
|
| 568 |
<label class="check-pill">
|
|
|
|
| 582 |
⚡ Électricité
|
| 583 |
</label>
|
| 584 |
</div>
|
| 585 |
+
</div> -->
|
| 586 |
|
| 587 |
+
<!-- <div class="form-group loyer-total">
|
| 588 |
<label for="loyer_cc">Loyer total CC (€) — calculé auto</label>
|
| 589 |
<input type="number" id="loyer_cc" min="0" readonly class="input-readonly" />
|
| 590 |
</div>
|
|
|
|
| 596 |
<div class="form-group">
|
| 597 |
<label for="frais_agence">Frais d'agence (€)</label>
|
| 598 |
<input type="number" id="frais_agence" min="0" />
|
| 599 |
+
</div> -->
|
| 600 |
<div class="form-group">
|
| 601 |
<label for="disponibilite">Disponibilité</label>
|
| 602 |
<input type="date" id="disponibilite" />
|
| 603 |
</div>
|
| 604 |
|
| 605 |
+
<div class="form-group span-2">
|
| 606 |
<label>Chauffage</label>
|
| 607 |
<div class="radio-group">
|
| 608 |
<label class="radio-pill">
|
|
|
|
| 618 |
</div>
|
| 619 |
</div>
|
| 620 |
|
| 621 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
</div>
|
| 623 |
</div>
|
| 624 |
|
|
|
|
| 635 |
|
| 636 |
</div>
|
| 637 |
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 638 |
|
| 639 |
|
| 640 |
|
|
|
|
| 653 |
|
| 654 |
<div class="form-group span-2">
|
| 655 |
<label>Charges comprenant</label>
|
| 656 |
+
<div class="radio-group">
|
| 657 |
<label class="check-pill">
|
| 658 |
<input type="checkbox" id="charges_eau_froide" />
|
| 659 |
💧 Eau froide
|
|
|
|
| 673 |
</div>
|
| 674 |
</div>
|
| 675 |
|
| 676 |
+
|
| 677 |
+
<div class="form-group">
|
| 678 |
+
<label for="facture_energie_exemple">Facture énergie exemple (€/mois)</label>
|
| 679 |
+
<input type="text" id="facture_energie_exemple" placeholder="Ex : ~80 €/mois hiver" />
|
| 680 |
+
</div>
|
| 681 |
<div class="form-group loyer-total">
|
| 682 |
<label for="loyer_cc">Loyer total CC (€) — calculé auto</label>
|
| 683 |
<input type="number" id="loyer_cc" min="0" readonly class="input-readonly" />
|
|
|
|
| 691 |
<label for="frais_agence">Frais d'agence (€)</label>
|
| 692 |
<input type="number" id="frais_agence" min="0" />
|
| 693 |
</div>
|
| 694 |
+
<!-- <div class="form-group">
|
| 695 |
<label for="disponibilite">Disponibilité</label>
|
| 696 |
<input type="date" id="disponibilite" />
|
| 697 |
+
</div> -->
|
| 698 |
|
| 699 |
<!-- Coût total entrée calculé -->
|
| 700 |
<div class="form-group span-2 cout-entree-block">
|
index.js
CHANGED
|
@@ -46,6 +46,7 @@ let imagesToRemove = []; // Chemins d'images à supprimer
|
|
| 46 |
let currentImageOrder = []; // Ordre actuel des images existantes
|
| 47 |
let currentDetailImages = [];
|
| 48 |
let currentGalleryIndex = 0;
|
|
|
|
| 49 |
|
| 50 |
/* ═══════════════════════════════════════════════════════════════
|
| 51 |
INIT
|
|
@@ -845,6 +846,12 @@ function bindEvents() {
|
|
| 845 |
if (e.target === e.currentTarget) closeDetail();
|
| 846 |
});
|
| 847 |
document.getElementById("detailBody").addEventListener("click", (e) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
const item = e.target.closest(".detail-gallery-item");
|
| 849 |
if (!item) return;
|
| 850 |
e.preventDefault();
|
|
@@ -1468,6 +1475,7 @@ function closeDetail() {
|
|
| 1468 |
document.getElementById("detailOverlay").classList.add("hidden");
|
| 1469 |
document.body.style.overflow = "";
|
| 1470 |
currentDetailId = null;
|
|
|
|
| 1471 |
}
|
| 1472 |
|
| 1473 |
function openGallery(index = 0) {
|
|
@@ -1509,6 +1517,7 @@ function stepGallery(delta) {
|
|
| 1509 |
}
|
| 1510 |
|
| 1511 |
function renderDetail(f) {
|
|
|
|
| 1512 |
// Titre modal
|
| 1513 |
document.getElementById("detailTitle").textContent =
|
| 1514 |
"📍" + f.adresse || "Détail de la fiche";
|
|
@@ -1604,6 +1613,18 @@ function renderDetail(f) {
|
|
| 1604 |
</div>
|
| 1605 |
</div>
|
| 1606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1607 |
<!-- Finances -->
|
| 1608 |
<div class="detail-section">
|
| 1609 |
<div class="detail-section-title">💶 Finances</div>
|
|
@@ -1721,6 +1742,77 @@ function renderDetail(f) {
|
|
| 1721 |
document.getElementById("detailBody").innerHTML = html;
|
| 1722 |
}
|
| 1723 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1724 |
/* ─── Helpers rendu détail ──────────────────────────────────── */
|
| 1725 |
function chargesDetail(f) {
|
| 1726 |
const items = [];
|
|
|
|
| 46 |
let currentImageOrder = []; // Ordre actuel des images existantes
|
| 47 |
let currentDetailImages = [];
|
| 48 |
let currentGalleryIndex = 0;
|
| 49 |
+
let currentDetailFiche = null;
|
| 50 |
|
| 51 |
/* ═══════════════════════════════════════════════════════════════
|
| 52 |
INIT
|
|
|
|
| 846 |
if (e.target === e.currentTarget) closeDetail();
|
| 847 |
});
|
| 848 |
document.getElementById("detailBody").addEventListener("click", (e) => {
|
| 849 |
+
const messageButton = e.target.closest("[data-message-action]");
|
| 850 |
+
if (messageButton) {
|
| 851 |
+
handleMessageAction(messageButton.dataset.messageAction);
|
| 852 |
+
return;
|
| 853 |
+
}
|
| 854 |
+
|
| 855 |
const item = e.target.closest(".detail-gallery-item");
|
| 856 |
if (!item) return;
|
| 857 |
e.preventDefault();
|
|
|
|
| 1475 |
document.getElementById("detailOverlay").classList.add("hidden");
|
| 1476 |
document.body.style.overflow = "";
|
| 1477 |
currentDetailId = null;
|
| 1478 |
+
currentDetailFiche = null;
|
| 1479 |
}
|
| 1480 |
|
| 1481 |
function openGallery(index = 0) {
|
|
|
|
| 1517 |
}
|
| 1518 |
|
| 1519 |
function renderDetail(f) {
|
| 1520 |
+
currentDetailFiche = f;
|
| 1521 |
// Titre modal
|
| 1522 |
document.getElementById("detailTitle").textContent =
|
| 1523 |
"📍" + f.adresse || "Détail de la fiche";
|
|
|
|
| 1613 |
</div>
|
| 1614 |
</div>
|
| 1615 |
|
| 1616 |
+
<!-- Message bailleur -->
|
| 1617 |
+
<div class="detail-section">
|
| 1618 |
+
<div class="detail-section-title">✉️ Message bailleur</div>
|
| 1619 |
+
<div class="message-generator">
|
| 1620 |
+
<textarea id="landlordMessage" class="message-generator-text" rows="8">${escapeHtml(generateLandlordMessage(f))}</textarea>
|
| 1621 |
+
<div class="message-generator-actions">
|
| 1622 |
+
<button class="btn btn-outline btn-small" type="button" data-message-action="regenerate">↻ Régénérer</button>
|
| 1623 |
+
<button class="btn btn-primary btn-small" type="button" data-message-action="copy">📋 Copier</button>
|
| 1624 |
+
</div>
|
| 1625 |
+
</div>
|
| 1626 |
+
</div>
|
| 1627 |
+
|
| 1628 |
<!-- Finances -->
|
| 1629 |
<div class="detail-section">
|
| 1630 |
<div class="detail-section-title">💶 Finances</div>
|
|
|
|
| 1742 |
document.getElementById("detailBody").innerHTML = html;
|
| 1743 |
}
|
| 1744 |
|
| 1745 |
+
function handleMessageAction(action) {
|
| 1746 |
+
const textarea = document.getElementById("landlordMessage");
|
| 1747 |
+
if (!textarea) return;
|
| 1748 |
+
|
| 1749 |
+
if (action === "regenerate") {
|
| 1750 |
+
textarea.value = generateLandlordMessage(currentDetailFiche || {});
|
| 1751 |
+
textarea.focus();
|
| 1752 |
+
showToast("✉️ Message régénéré", "success");
|
| 1753 |
+
return;
|
| 1754 |
+
}
|
| 1755 |
+
|
| 1756 |
+
if (action === "copy") {
|
| 1757 |
+
copyTextToClipboard(textarea.value.trim());
|
| 1758 |
+
}
|
| 1759 |
+
}
|
| 1760 |
+
|
| 1761 |
+
async function copyTextToClipboard(text) {
|
| 1762 |
+
if (!text) {
|
| 1763 |
+
showToast("⚠️ Aucun message à copier", "warn");
|
| 1764 |
+
return;
|
| 1765 |
+
}
|
| 1766 |
+
|
| 1767 |
+
try {
|
| 1768 |
+
if (navigator.clipboard?.writeText) {
|
| 1769 |
+
await navigator.clipboard.writeText(text);
|
| 1770 |
+
} else {
|
| 1771 |
+
const textarea = document.getElementById("landlordMessage");
|
| 1772 |
+
textarea?.select();
|
| 1773 |
+
document.execCommand("copy");
|
| 1774 |
+
}
|
| 1775 |
+
showToast("✅ Message copié", "success");
|
| 1776 |
+
} catch {
|
| 1777 |
+
showToast("❌ Impossible de copier le message", "error");
|
| 1778 |
+
}
|
| 1779 |
+
}
|
| 1780 |
+
|
| 1781 |
+
function generateLandlordMessage(f) {
|
| 1782 |
+
const isLocation =
|
| 1783 |
+
f?.type_search === "location" ||
|
| 1784 |
+
(!f?.type_search && (parseFloat(f?.loyer_cc) > 0 || f?.type_bail));
|
| 1785 |
+
const address = f?.adresse ? ` situé ${f.adresse}` : "";
|
| 1786 |
+
const type = f?.type_logement ? ` (${labelType(f.type_logement)})` : "";
|
| 1787 |
+
const rent = f?.loyer_cc
|
| 1788 |
+
? `, affiché à ${Number(f.loyer_cc).toLocaleString("fr-FR")} € charges comprises`
|
| 1789 |
+
: f?.loyer_hc
|
| 1790 |
+
? `, affiché à ${Number(f.loyer_hc).toLocaleString("fr-FR")} € hors charges`
|
| 1791 |
+
: "";
|
| 1792 |
+
const availability = f?.disponibilite
|
| 1793 |
+
? `\n\nJ'ai noté une disponibilité au ${formatDate(f.disponibilite)}.`
|
| 1794 |
+
: "";
|
| 1795 |
+
const visit = f?.date_visite
|
| 1796 |
+
? `\n\nJe serais disponible pour une visite le ${formatDate(f.date_visite)}${f.heure_visite ? ` à ${f.heure_visite}` : ""}, ou sur un autre créneau à votre convenance.`
|
| 1797 |
+
: "\n\nJe serais disponible rapidement pour organiser une visite, selon vos créneaux.";
|
| 1798 |
+
const documents =
|
| 1799 |
+
"\n\nJe peux transmettre rapidement un dossier complet. Je dispose de ressources suffisantes pour présenter une candidature sérieuse et, si nécessaire, de garanties adaptées.";
|
| 1800 |
+
|
| 1801 |
+
if (!isLocation) {
|
| 1802 |
+
return `Bonjour,\n\nJe vous contacte au sujet de votre annonce pour le bien${address}${type}${rent}.\n\nLe bien m'intéresse et je souhaiterais savoir s'il est toujours disponible, ainsi que les prochaines modalités pour avancer.${visit}\n\nMerci par avance pour votre retour.\n\nCordialement,`;
|
| 1803 |
+
}
|
| 1804 |
+
|
| 1805 |
+
return `Bonjour,\n\nJe vous contacte au sujet de votre annonce pour le logement${address}${type}${rent}.\n\nLe logement m'intéresse beaucoup et je souhaiterais savoir s'il est toujours disponible.${availability}${visit}${documents}\n\nMerci par avance pour votre retour.\n\nCordialement,`;
|
| 1806 |
+
}
|
| 1807 |
+
|
| 1808 |
+
function escapeHtml(value) {
|
| 1809 |
+
return String(value ?? "")
|
| 1810 |
+
.replace(/&/g, "&")
|
| 1811 |
+
.replace(/</g, "<")
|
| 1812 |
+
.replace(/>/g, ">")
|
| 1813 |
+
.replace(/"/g, """);
|
| 1814 |
+
}
|
| 1815 |
+
|
| 1816 |
/* ─── Helpers rendu détail ──────────────────────────────────── */
|
| 1817 |
function chargesDetail(f) {
|
| 1818 |
const items = [];
|
style.css
CHANGED
|
@@ -1301,6 +1301,33 @@ textarea {
|
|
| 1301 |
font-weight: 800;
|
| 1302 |
color: var(--c-primary);
|
| 1303 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1304 |
|
| 1305 |
/* Critères vue detail */
|
| 1306 |
.detail-criteria {
|
|
|
|
| 1301 |
font-weight: 800;
|
| 1302 |
color: var(--c-primary);
|
| 1303 |
}
|
| 1304 |
+
.message-generator {
|
| 1305 |
+
display: grid;
|
| 1306 |
+
gap: 0.65rem;
|
| 1307 |
+
}
|
| 1308 |
+
.message-generator-text {
|
| 1309 |
+
width: 100%;
|
| 1310 |
+
min-height: 11rem;
|
| 1311 |
+
resize: vertical;
|
| 1312 |
+
border: 1px solid var(--c-border);
|
| 1313 |
+
border-radius: var(--radius-sm);
|
| 1314 |
+
padding: 0.8rem 0.9rem;
|
| 1315 |
+
color: var(--c-text);
|
| 1316 |
+
background: #fff;
|
| 1317 |
+
font: inherit;
|
| 1318 |
+
font-size: 0.92rem;
|
| 1319 |
+
line-height: 1.5;
|
| 1320 |
+
}
|
| 1321 |
+
.message-generator-text:focus {
|
| 1322 |
+
outline: 2px solid #bfdbfe;
|
| 1323 |
+
border-color: var(--c-primary);
|
| 1324 |
+
}
|
| 1325 |
+
.message-generator-actions {
|
| 1326 |
+
display: flex;
|
| 1327 |
+
justify-content: flex-end;
|
| 1328 |
+
gap: 0.5rem;
|
| 1329 |
+
flex-wrap: wrap;
|
| 1330 |
+
}
|
| 1331 |
|
| 1332 |
/* Critères vue detail */
|
| 1333 |
.detail-criteria {
|