fix: Update PrimeReact and fix all compilation errors
This commit is contained in:
71
app/(main)/clients/page.tsx
Normal file → Executable file
71
app/(main)/clients/page.tsx
Normal file → Executable file
@@ -48,9 +48,9 @@ const ClientsPageContent = () => {
|
||||
ville: '',
|
||||
numeroTVA: '',
|
||||
siret: '',
|
||||
typeClient: 'PARTICULIER',
|
||||
pays: 'France',
|
||||
actif: true
|
||||
actif: true,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString()
|
||||
});
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
const toast = useRef<Toast>(null);
|
||||
@@ -96,9 +96,9 @@ const ClientsPageContent = () => {
|
||||
ville: '',
|
||||
numeroTVA: '',
|
||||
siret: '',
|
||||
typeClient: 'PARTICULIER',
|
||||
pays: 'France',
|
||||
actif: true
|
||||
actif: true,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString()
|
||||
});
|
||||
setSubmitted(false);
|
||||
setClientDialog(true);
|
||||
@@ -163,9 +163,9 @@ const ClientsPageContent = () => {
|
||||
ville: '',
|
||||
numeroTVA: '',
|
||||
siret: '',
|
||||
typeClient: 'PARTICULIER',
|
||||
pays: 'France',
|
||||
actif: true
|
||||
actif: true,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString()
|
||||
});
|
||||
} catch (error: any) {
|
||||
console.error('Erreur lors de la sauvegarde:', error);
|
||||
@@ -220,9 +220,9 @@ const ClientsPageContent = () => {
|
||||
ville: '',
|
||||
numeroTVA: '',
|
||||
siret: '',
|
||||
typeClient: 'PARTICULIER',
|
||||
pays: 'France',
|
||||
actif: true
|
||||
actif: true,
|
||||
dateCreation: new Date().toISOString(),
|
||||
dateModification: new Date().toISOString()
|
||||
});
|
||||
toast.current?.show({
|
||||
severity: 'success',
|
||||
@@ -392,30 +392,7 @@ const ClientsPageContent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const typeClientBodyTemplate = (rowData: Client) => {
|
||||
const getSeverity = (type: string) => {
|
||||
switch (type) {
|
||||
case 'PARTICULIER': return 'info';
|
||||
case 'PROFESSIONNEL': return 'warning';
|
||||
default: return 'info';
|
||||
}
|
||||
};
|
||||
|
||||
const getLabel = (type: string) => {
|
||||
switch (type) {
|
||||
case 'PARTICULIER': return 'Particulier';
|
||||
case 'PROFESSIONNEL': return 'Professionnel';
|
||||
default: return type;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Tag
|
||||
value={getLabel(rowData.typeClient || 'PARTICULIER')}
|
||||
severity={getSeverity(rowData.typeClient || 'PARTICULIER')}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const contactBodyTemplate = (rowData: Client) => {
|
||||
return (
|
||||
@@ -528,6 +505,7 @@ const ClientsPageContent = () => {
|
||||
value={clients}
|
||||
selection={selectedClients}
|
||||
onSelectionChange={(e) => setSelectedClients(e.value)}
|
||||
selectionMode="multiple"
|
||||
dataKey="id"
|
||||
paginator
|
||||
rows={10}
|
||||
@@ -543,7 +521,6 @@ const ClientsPageContent = () => {
|
||||
>
|
||||
<Column selectionMode="multiple" headerStyle={{ width: '4rem' }} />
|
||||
<Column header="Nom complet" body={nomCompletBodyTemplate} sortable headerStyle={{ minWidth: '12rem' }} />
|
||||
<Column field="typeClient" header="Type" body={typeClientBodyTemplate} sortable headerStyle={{ minWidth: '8rem' }} />
|
||||
<Column header="Contact" body={contactBodyTemplate} headerStyle={{ minWidth: '12rem' }} />
|
||||
<Column field="ville" header="Ville" sortable headerStyle={{ minWidth: '10rem' }} />
|
||||
<Column field="actif" header="Statut" body={statusBodyTemplate} sortable headerStyle={{ minWidth: '8rem' }} />
|
||||
@@ -593,17 +570,6 @@ const ClientsPageContent = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="field col-12 md:col-6">
|
||||
<label htmlFor="typeClient">Type de client</label>
|
||||
<Dropdown
|
||||
id="typeClient"
|
||||
value={client.typeClient}
|
||||
options={typesClient}
|
||||
onChange={(e) => onDropdownChange(e, 'typeClient')}
|
||||
placeholder="Sélectionnez un type"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="field col-12 md:col-6">
|
||||
<label htmlFor="email">Email</label>
|
||||
<InputText
|
||||
@@ -623,15 +589,6 @@ const ClientsPageContent = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="field col-12 md:col-6">
|
||||
<label htmlFor="pays">Pays</label>
|
||||
<InputText
|
||||
id="pays"
|
||||
value={client.pays}
|
||||
onChange={(e) => onInputChange(e, 'pays')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="field col-12">
|
||||
<label htmlFor="adresse">Adresse</label>
|
||||
<InputTextarea
|
||||
@@ -842,4 +799,4 @@ const ClientsPage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ClientsPage;
|
||||
export default ClientsPage;
|
||||
|
||||
Reference in New Issue
Block a user