mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-17 12:19:05 +02:00
Show the save button at all times and improve form submission handling
Fixes button visibility and adds form submission debugging with console logs in NewSaleForm.tsx. 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/93c00a5b-c284-453f-b0ce-467e02b79bd7.jpg
This commit is contained in:
1 parent
973256f8d0
commit
2377483fd7
1 file changed
+25
-4
@@ -85,10 +85,13 @@ export default function NewSaleForm({ onSaveSale }: NewSaleFormProps) {
|
||||
const onSubmit = async (data: FormData) => {
|
||||
try {
|
||||
setIsSubmitting(true);
|
||||
console.log('Form data being submitted:', data);
|
||||
console.log('Form errors:', form.formState.errors);
|
||||
|
||||
// Validate required fields
|
||||
const missingFields = validateRequiredFields(data);
|
||||
if (missingFields.length > 0) {
|
||||
console.log('Missing fields found:', missingFields);
|
||||
toast({
|
||||
title: "Champs manquants",
|
||||
description: `Veuillez remplir: ${missingFields.join(', ')}`,
|
||||
@@ -527,13 +530,31 @@ export default function NewSaleForm({ onSaveSale }: NewSaleFormProps) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Form Actions */}
|
||||
<div className="flex justify-end space-x-4 pt-6 border-t border-gray-200">
|
||||
<Button type="button" variant="outline">
|
||||
{/* Form Actions - Always visible */}
|
||||
<div className="flex justify-end space-x-4 pt-6 border-t border-gray-200 bg-white">
|
||||
<Button type="button" variant="outline" onClick={() => {
|
||||
form.reset({
|
||||
vendeur: '',
|
||||
dateVente: new Date().toISOString().split('T')[0],
|
||||
typeArticle: '',
|
||||
categorie: '',
|
||||
quantite: '',
|
||||
gencode: '',
|
||||
nom: '',
|
||||
prenom: '',
|
||||
dateNaissance: '',
|
||||
lieuNaissance: '',
|
||||
typeIdentite: '',
|
||||
numeroIdentite: '',
|
||||
autoriteDelivrance: '',
|
||||
dateDelivrance: '',
|
||||
});
|
||||
setPhotos({});
|
||||
}}>
|
||||
<X className="h-4 w-4 mr-2" />
|
||||
Annuler
|
||||
</Button>
|
||||
<Button type="submit" disabled={isSubmitting} className="bg-success hover:bg-success/90">
|
||||
<Button type="submit" disabled={isSubmitting} className="bg-green-600 hover:bg-green-700 text-white">
|
||||
<Save className="h-4 w-4 mr-2" />
|
||||
{isSubmitting ? 'Enregistrement...' : 'Enregistrer la Vente'}
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user