|
@@ -319,7 +319,7 @@ export default function Charges() {
|
|
|
const closeLeaseExercise = async (leaseBilan) => {
|
|
const closeLeaseExercise = async (leaseBilan) => {
|
|
|
if (!filterProperty || !filterYear || !leaseBilan?.lease_id) return
|
|
if (!filterProperty || !filterYear || !leaseBilan?.lease_id) return
|
|
|
if (!confirm(
|
|
if (!confirm(
|
|
|
- `Clôturer l'exercice ${filterYear} pour le bail de ${leaseBilan.tenant_name} ?\n\n` +
|
|
|
|
|
|
|
+ `Clôturer le bilan annuel des charges ${filterYear} pour ${leaseBilan.tenant_name} ?\n\n` +
|
|
|
`Le calcul se fera au prorata d'occupation (${leaseBilan.occupied_days}/${leaseBilan.year_days} jours).\n\n` +
|
|
`Le calcul se fera au prorata d'occupation (${leaseBilan.occupied_days}/${leaseBilan.year_days} jours).\n\n` +
|
|
|
`Cette opération est définitive.`
|
|
`Cette opération est définitive.`
|
|
|
)) return
|
|
)) return
|
|
@@ -331,12 +331,12 @@ export default function Charges() {
|
|
|
const reg = data.regularizations?.[0]
|
|
const reg = data.regularizations?.[0]
|
|
|
if (reg) {
|
|
if (reg) {
|
|
|
toast.success(
|
|
toast.success(
|
|
|
- `Bail clôturé (${filterYear}) : ${reg.tenant} | Prorata ${reg.occupied_days}/${reg.year_days} jours | ` +
|
|
|
|
|
|
|
+ `Bilan annuel clôturé (${filterYear}) : ${reg.tenant} | Prorata ${reg.occupied_days}/${reg.year_days} jours | ` +
|
|
|
`${reg.trop_percu >= 0 ? '-' : '+'}${Math.abs(reg.trop_percu).toFixed(2)} € sur le prochain loyer`,
|
|
`${reg.trop_percu >= 0 ? '-' : '+'}${Math.abs(reg.trop_percu).toFixed(2)} € sur le prochain loyer`,
|
|
|
{ duration: 6000 }
|
|
{ duration: 6000 }
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
- toast.success(`Bail clôturé pour ${filterYear}`)
|
|
|
|
|
|
|
+ toast.success(`Bilan annuel clôturé pour ${filterYear}`)
|
|
|
}
|
|
}
|
|
|
await loadBilan()
|
|
await loadBilan()
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -714,7 +714,7 @@ export default function Charges() {
|
|
|
disabled={closingLeaseId === b.lease_id}
|
|
disabled={closingLeaseId === b.lease_id}
|
|
|
className="flex items-center gap-2 text-sm px-3 py-2 rounded-lg bg-orange-500 hover:bg-orange-600 text-white font-semibold transition-colors disabled:opacity-60"
|
|
className="flex items-center gap-2 text-sm px-3 py-2 rounded-lg bg-orange-500 hover:bg-orange-600 text-white font-semibold transition-colors disabled:opacity-60"
|
|
|
>
|
|
>
|
|
|
- {closingLeaseId === b.lease_id ? '⏳ Clôture…' : '✅ Clôturer ce bail'}
|
|
|
|
|
|
|
+ {closingLeaseId === b.lease_id ? '⏳ Clôture du bilan…' : '✅ Clôturer le bilan annuel'}
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|