mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 22:48:15 +02:00
feat: add mobile page for managing credit notes (Avoirs) with search, filter, and CRUD functionalities
This commit is contained in:
1 parent
4a25c2040b
commit
77bbeed9c0
1 file changed
+40
-27
@@ -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,34 +346,45 @@ export default function MobileAvoirsPage() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormField
|
</FormItem>
|
||||||
control={form.control}
|
|
||||||
name="comment"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Commentaire / Raison</FormLabel>
|
|
||||||
<FormControl>
|
|
||||||
<Textarea placeholder="Erreur prix, manquant..." {...field} />
|
|
||||||
</FormControl>
|
|
||||||
</FormItem>
|
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button type="submit" className="w-full bg-indigo-600 hover:bg-indigo-700 h-12 text-lg font-bold shadow-lg mt-4" disabled={createMutation.isPending}>
|
<FormField
|
||||||
{createMutation.isPending ? "Création..." : "Créer la demande"}
|
control={form.control}
|
||||||
</Button>
|
name="commercialProcessed"
|
||||||
</form>
|
render={({ field }) => (
|
||||||
</Form>
|
<FormItem className="flex flex-row items-center space-x-3 space-y-0 p-2 bg-gray-50 rounded mt-2">
|
||||||
</SheetContent>
|
<FormControl>
|
||||||
</Sheet>
|
<Checkbox
|
||||||
|
checked={field.value}
|
||||||
|
onCheckedChange={field.onChange}
|
||||||
|
/>
|
||||||
|
</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>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* FAB */}
|
<Button type="submit" className="w-full bg-indigo-600 hover:bg-indigo-700 h-12 text-lg font-bold shadow-lg mt-4" disabled={createMutation.isPending}>
|
||||||
<Button
|
{createMutation.isPending ? "Création..." : "Créer la demande"}
|
||||||
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"
|
</Button>
|
||||||
onClick={() => setIsCreateOpen(true)}
|
</form>
|
||||||
>
|
</Form>
|
||||||
<Plus className="h-6 w-6 text-white" />
|
</SheetContent>
|
||||||
</Button>
|
</Sheet>
|
||||||
</MobileLayout>
|
|
||||||
|
{/* FAB */ }
|
||||||
|
<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"
|
||||||
|
onClick={() => setIsCreateOpen(true)}
|
||||||
|
>
|
||||||
|
<Plus className="h-6 w-6 text-white" />
|
||||||
|
</Button>
|
||||||
|
</MobileLayout >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user