fix: Use typeFacture instead of type and add required Facture fields (dateCreation, dateModification, client)
This commit is contained in:
@@ -17,7 +17,7 @@ import { InputNumber } from 'primereact/inputnumber';
|
||||
import { factureService, clientService } from '../../../services/api';
|
||||
import { formatDate, formatCurrency } from '../../../utils/formatters';
|
||||
import { ErrorHandler } from '../../../services/errorHandler';
|
||||
import type { Facture } from '../../../types/btp';
|
||||
import type { Facture, Client } from '../../../types/btp';
|
||||
import { StatutFacture, TypeFacture } from '../../../types/btp';
|
||||
import {
|
||||
ActionButtonGroup,
|
||||
@@ -41,18 +41,20 @@ const FacturesPage = () => {
|
||||
numero: '',
|
||||
dateEmission: new Date().toISOString(),
|
||||
dateEcheance: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
datePaiement: null,
|
||||
datePaiement: undefined,
|
||||
objet: '',
|
||||
description: '',
|
||||
montantHT: 0,
|
||||
montantTTC: 0,
|
||||
tauxTVA: 20,
|
||||
statut: StatutFacture.BROUILLON,
|
||||
type: TypeFacture.FACTURE,
|
||||
typeFacture: TypeFacture.FACTURE,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString(),
|
||||
actif: true,
|
||||
client: null,
|
||||
chantier: null,
|
||||
devis: null
|
||||
client: {} as Client,
|
||||
chantier: undefined,
|
||||
devis: undefined
|
||||
});
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
const toast = useRef<Toast>(null);
|
||||
@@ -116,18 +118,20 @@ const FacturesPage = () => {
|
||||
numero: '',
|
||||
dateEmission: new Date().toISOString(),
|
||||
dateEcheance: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
datePaiement: null,
|
||||
datePaiement: undefined,
|
||||
objet: '',
|
||||
description: '',
|
||||
montantHT: 0,
|
||||
montantTTC: 0,
|
||||
tauxTVA: 20,
|
||||
statut: StatutFacture.BROUILLON,
|
||||
type: TypeFacture.FACTURE,
|
||||
typeFacture: TypeFacture.FACTURE,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString(),
|
||||
actif: true,
|
||||
client: null,
|
||||
chantier: null,
|
||||
devis: null
|
||||
client: {} as Client,
|
||||
chantier: undefined,
|
||||
devis: undefined
|
||||
});
|
||||
setSubmitted(false);
|
||||
setFactureDialog(true);
|
||||
@@ -223,18 +227,20 @@ const FacturesPage = () => {
|
||||
numero: '',
|
||||
dateEmission: new Date().toISOString(),
|
||||
dateEcheance: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
datePaiement: null,
|
||||
datePaiement: undefined,
|
||||
objet: '',
|
||||
description: '',
|
||||
montantHT: 0,
|
||||
montantTTC: 0,
|
||||
tauxTVA: 20,
|
||||
statut: StatutFacture.BROUILLON,
|
||||
type: TypeFacture.FACTURE,
|
||||
typeFacture: TypeFacture.FACTURE,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString(),
|
||||
actif: true,
|
||||
client: null,
|
||||
chantier: null,
|
||||
devis: null
|
||||
client: {} as Client,
|
||||
chantier: undefined,
|
||||
devis: undefined
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la sauvegarde:', error);
|
||||
|
||||
Reference in New Issue
Block a user