feat: add mobile page for managing credit notes (Avoirs) with search, filter, and CRUD functionalities

This commit is contained in:
Michael committed 2025-12-10 16:31:58 +01:00
1 parent 4a25c2040b
commit 77bbeed9c0
1 file changed
+21 -8
+21 -8
View File
@@ -11,6 +11,7 @@ import { Card, CardContent } from "@/components/ui/card";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { Checkbox } from "@/components/ui/checkbox";
import { import {
FileText, FileText,
Search, Search,
@@ -63,6 +64,7 @@ const avoirSchema = z.object({
invoiceReference: z.string().optional(), invoiceReference: z.string().optional(),
amount: z.coerce.number().optional(), amount: z.coerce.number().optional(),
comment: z.string().optional(), comment: z.string().optional(),
commercialProcessed: z.boolean().default(false),
status: z.enum(["En attente de demande", "Demandé", "Reçu"]).default("En attente de demande"), status: z.enum(["En attente de demande", "Demandé", "Reçu"]).default("En attente de demande"),
}); });
@@ -132,6 +134,7 @@ export default function MobileAvoirsPage() {
invoiceReference: "", invoiceReference: "",
amount: 0, amount: 0,
comment: "", comment: "",
commercialProcessed: false,
status: "En attente de demande" status: "En attente de demande"
} }
}); });
@@ -148,8 +151,7 @@ export default function MobileAvoirsPage() {
createMutation.mutate({ createMutation.mutate({
...data, ...data,
groupId, groupId
commercialProcessed: false
}); });
}; };
@@ -344,15 +346,26 @@ export default function MobileAvoirsPage() {
/> />
</div> </div>
</FormItem>
)}
/>
<FormField <FormField
control={form.control} control={form.control}
name="comment" name="commercialProcessed"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem className="flex flex-row items-center space-x-3 space-y-0 p-2 bg-gray-50 rounded mt-2">
<FormLabel>Commentaire / Raison</FormLabel>
<FormControl> <FormControl>
<Textarea placeholder="Erreur prix, manquant..." {...field} /> <Checkbox
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl> </FormControl>
<div className="space-y-1 leading-none">
<FormLabel className="font-normal text-sm text-gray-700">
Déjà traité par commercial
</FormLabel>
</div>
</FormItem> </FormItem>
)} )}
/> />
@@ -365,13 +378,13 @@ export default function MobileAvoirsPage() {
</SheetContent> </SheetContent>
</Sheet> </Sheet>
{/* FAB */} {/* FAB */ }
<Button <Button
className="fixed bottom-20 right-4 h-14 w-14 rounded-full shadow-lg bg-indigo-600 hover:bg-indigo-700 p-0 flex items-center justify-center z-50" className="fixed bottom-20 right-4 h-14 w-14 rounded-full shadow-lg bg-indigo-600 hover:bg-indigo-700 p-0 flex items-center justify-center z-50"
onClick={() => setIsCreateOpen(true)} onClick={() => setIsCreateOpen(true)}
> >
<Plus className="h-6 w-6 text-white" /> <Plus className="h-6 w-6 text-white" />
</Button> </Button>
</MobileLayout> </MobileLayout >
); );
} }