Checkpoint: Ajout de 3 champs métier aux factures (Service concerné, Type d'achat, Ventilation comptable) avec interface d'administration pour gérer les listes enrichissables. Les champs apparaissent dans la liste des factures et dans le formulaire d'édition.
This commit is contained in:
@@ -26,6 +26,9 @@ export default function InvoiceDetail() {
|
||||
deliveryNoteNumber: "",
|
||||
orderNumber: "",
|
||||
totalAmount: "",
|
||||
serviceConcerne: "",
|
||||
typeAchat: "",
|
||||
ventilationComptable: "",
|
||||
});
|
||||
|
||||
// Initialize form data when invoice loads
|
||||
@@ -40,6 +43,9 @@ export default function InvoiceDetail() {
|
||||
deliveryNoteNumber: invoice.deliveryNoteNumber || "",
|
||||
orderNumber: invoice.orderNumber || "",
|
||||
totalAmount: invoice.totalAmount ? invoice.totalAmount.toString() : "",
|
||||
serviceConcerne: invoice.serviceConcerne || "",
|
||||
typeAchat: invoice.typeAchat || "",
|
||||
ventilationComptable: invoice.ventilationComptable || "",
|
||||
});
|
||||
}
|
||||
}, [invoice]);
|
||||
@@ -79,6 +85,9 @@ export default function InvoiceDetail() {
|
||||
deliveryNoteNumber: formData.deliveryNoteNumber || undefined,
|
||||
orderNumber: formData.orderNumber || undefined,
|
||||
totalAmount: formData.totalAmount ? formData.totalAmount : undefined,
|
||||
serviceConcerne: formData.serviceConcerne || undefined,
|
||||
typeAchat: (formData.typeAchat as "CAPEX" | "OPEX" | "") || undefined,
|
||||
ventilationComptable: formData.ventilationComptable || undefined,
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -321,6 +330,75 @@ export default function InvoiceDetail() {
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Business Fields Card */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Champs métier</CardTitle>
|
||||
<CardDescription>
|
||||
Informations de classification comptable
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div>
|
||||
<Label htmlFor="serviceConcerne">Service concerné</Label>
|
||||
{isEditing ? (
|
||||
<select
|
||||
id="serviceConcerne"
|
||||
value={formData.serviceConcerne}
|
||||
onChange={(e) => setFormData({ ...formData, serviceConcerne: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-md"
|
||||
>
|
||||
<option value="">Sélectionner...</option>
|
||||
<option value="DSI">DSI</option>
|
||||
<option value="TRAVAUX">TRAVAUX</option>
|
||||
<option value="AUTRE">AUTRE</option>
|
||||
</select>
|
||||
) : (
|
||||
<div className="text-sm mt-1">{invoice.serviceConcerne || "-"}</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="typeAchat">Type d'achat</Label>
|
||||
{isEditing ? (
|
||||
<select
|
||||
id="typeAchat"
|
||||
value={formData.typeAchat}
|
||||
onChange={(e) => setFormData({ ...formData, typeAchat: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-md"
|
||||
>
|
||||
<option value="">Sélectionner...</option>
|
||||
<option value="CAPEX">CAPEX</option>
|
||||
<option value="OPEX">OPEX</option>
|
||||
</select>
|
||||
) : (
|
||||
<div className="text-sm mt-1">{invoice.typeAchat || "-"}</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="ventilationComptable">Ventilation comptable</Label>
|
||||
{isEditing ? (
|
||||
<select
|
||||
id="ventilationComptable"
|
||||
value={formData.ventilationComptable}
|
||||
onChange={(e) => setFormData({ ...formData, ventilationComptable: e.target.value })}
|
||||
className="w-full px-3 py-2 border rounded-md"
|
||||
>
|
||||
<option value="">Sélectionner...</option>
|
||||
<option value="TOUS">TOUS</option>
|
||||
<option value="PA">PA</option>
|
||||
<option value="HEP">HEP</option>
|
||||
<option value="SANITAIRE">SANITAIRE</option>
|
||||
<option value="AUTRE">AUTRE</option>
|
||||
</select>
|
||||
) : (
|
||||
<div className="text-sm mt-1">{invoice.ventilationComptable || "-"}</div>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Info Card */}
|
||||
<Card>
|
||||
|
||||
Reference in New Issue
Block a user