Require authority and date of issue for identity documents on sales form

Make 'autoriteDelivrance' and 'dateDelivrance' mandatory fields in NewSaleForm.tsx, sale.ts and validation.ts.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/efe87597-d535-4405-b5de-78081405fa4c.jpg
This commit is contained in:
michaelschal committed 2025-07-09 18:14:47 +00:00
1 parent cddfee5d09
commit 973256f8d0
3 files changed
+9 -7

No files matched your search

+4 -4
View File
@@ -120,8 +120,8 @@ export default function NewSaleForm({ onSaveSale }: NewSaleFormProps) {
lieuNaissance: data.lieuNaissance || undefined, lieuNaissance: data.lieuNaissance || undefined,
typeIdentite: data.typeIdentite, typeIdentite: data.typeIdentite,
numeroIdentite: data.numeroIdentite, numeroIdentite: data.numeroIdentite,
autoriteDelivrance: data.autoriteDelivrance || undefined, autoriteDelivrance: data.autoriteDelivrance,
dateDelivrance: data.dateDelivrance || undefined, dateDelivrance: data.dateDelivrance,
photoRecto: photos.recto, photoRecto: photos.recto,
photoVerso: photos.verso, photoVerso: photos.verso,
}; };
@@ -424,7 +424,7 @@ export default function NewSaleForm({ onSaveSale }: NewSaleFormProps) {
name="autoriteDelivrance" name="autoriteDelivrance"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Autorité de délivrance</FormLabel> <FormLabel>Autorité de délivrance <span className="text-destructive">*</span></FormLabel>
<FormControl> <FormControl>
<Input placeholder="Préfecture, Mairie, etc." {...field} /> <Input placeholder="Préfecture, Mairie, etc." {...field} />
</FormControl> </FormControl>
@@ -437,7 +437,7 @@ export default function NewSaleForm({ onSaveSale }: NewSaleFormProps) {
name="dateDelivrance" name="dateDelivrance"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel>Date de délivrance</FormLabel> <FormLabel>Date de délivrance <span className="text-destructive">*</span></FormLabel>
<FormControl> <FormControl>
<Input type="date" {...field} /> <Input type="date" {...field} />
</FormControl> </FormControl>
+3 -1
View File
@@ -24,7 +24,9 @@ export function validateRequiredFields(formData: any): string[] {
{ key: 'prenom', label: 'Prénom' }, { key: 'prenom', label: 'Prénom' },
{ key: 'dateNaissance', label: 'Date de naissance' }, { key: 'dateNaissance', label: 'Date de naissance' },
{ key: 'typeIdentite', label: 'Type de pièce d\'identité' }, { key: 'typeIdentite', label: 'Type de pièce d\'identité' },
{ key: 'numeroIdentite', label: 'Numéro de pièce d\'identité' } { key: 'numeroIdentite', label: 'Numéro de pièce d\'identité' },
{ key: 'autoriteDelivrance', label: 'Autorité de délivrance' },
{ key: 'dateDelivrance', label: 'Date de délivrance' }
]; ];
return requiredFields return requiredFields
+2 -2
View File
@@ -21,8 +21,8 @@ export interface Sale {
// Identité // Identité
typeIdentite: string; typeIdentite: string;
numeroIdentite: string; numeroIdentite: string;
autoriteDelivrance?: string; autoriteDelivrance: string;
dateDelivrance?: string; dateDelivrance: string;
// Photos // Photos
photoRecto?: string; photoRecto?: string;