Add direct test button to create announcements with simplified validation

Introduce a direct test button in the AnnouncementCard component for easier debugging and validation testing.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/e437ffed-c31b-44eb-9fd5-b6f9faa8e7ce/aVFsaJG
This commit is contained in:
michaelschal committed 2025-08-16 12:27:13 +00:00
1 parent 3134732cb2
commit 6be4e2a0e4
2 files changed
+23 -2

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

+23 -2
View File
@@ -19,8 +19,12 @@ import { z } from "zod";
import { safeFormat, safeDate } from "@/lib/dateUtils";
import { useToast } from "@/hooks/use-toast";
const formSchema = insertAnnouncementSchema.extend({
groupId: z.coerce.number().optional(),
// Schéma simplifié pour tester
const formSchema = z.object({
title: z.string().min(1, "Le titre est obligatoire"),
content: z.string().min(1, "Le contenu est obligatoire"),
priority: z.enum(["normal", "important", "urgent"]).default("normal"),
groupId: z.number().optional().nullable(),
});
export default function AnnouncementCard() {
@@ -284,6 +288,23 @@ export default function AnnouncementCard() {
>
Annuler
</Button>
<Button
type="button"
variant="secondary"
onClick={() => {
console.log('🔥 [TEST] Direct test button clicked');
const testData = {
title: "Test Direct",
content: "Test contenu direct",
priority: "normal" as const,
groupId: null,
};
console.log('🔥 [TEST] Test data:', testData);
createMutation.mutate(testData);
}}
>
Test Direct
</Button>
<Button
type="submit"
disabled={createMutation.isPending}