diff --git a/backend/core/models/events.go b/backend/core/models/events.go index 35f4589..f350f13 100644 --- a/backend/core/models/events.go +++ b/backend/core/models/events.go @@ -18,7 +18,7 @@ type Event struct { bun.BaseModel `bun:"table:events"` EventID uuid.UUID `bun:"event_id,type:uuid,pk,default:gen_random_uuid()" json:"id"` - Title string `bun:"title,notnull,default:'no title'" json:"title"` + Title string `bun:"title,notnull" json:"title"` CreationDate time.Time `bun:"creation_date,notnull,default:current_timestamp" json:"creationDate"` ScheduleStart time.Time `bun:"schedule_start,notnull" json:"start"` ScheduleEnd time.Time `bun:"schedule_end,notnull" json:"end"` diff --git a/frontend/components/planning.tsx b/frontend/components/planning.tsx index 3805fe3..067e209 100644 --- a/frontend/components/planning.tsx +++ b/frontend/components/planning.tsx @@ -28,10 +28,13 @@ import { Button } from "@/components/ui/button"; import { KeyedMutator } from "swr"; import { getCookie } from "cookies-next"; import { useTheme } from "next-themes"; -import { Checkbox } from "@radix-ui/react-checkbox"; +import { Checkbox } from "@/components/ui/checkbox"; +import { eventNames } from "process"; +import { useSearchParams } from "next/navigation"; +import { CheckedState } from "@radix-ui/react-checkbox"; interface CalendarEventExternalDB extends CalendarEventExternal { - status: "Active" | "Inactive" + status: "Active" | "Inactive" } const Planning: React.FC<{ @@ -183,7 +186,7 @@ const Planning: React.FC<{ end: `${new Date(newEvent.end).toISOString()}`, title: newEvent.title, status: eventStatus - } + } const res = await request( `/events/new`, { @@ -291,6 +294,9 @@ const EventDialog: React.FC< onActiveStateChange, event, }) => { + + const [checked, setChecked] = useState(event.status === "Active") + return ( @@ -379,18 +385,23 @@ const EventDialog: React.FC< Rendre cette évènement actif ? { - const isChecked = typeof e === "boolean" ? e : false; - if (onActiveStateChange != undefined) { - onActiveStateChange(isChecked) + const booleanCheck = !!e + setChecked(prev => { return !prev }) + if (onActiveStateChange) { + onActiveStateChange(booleanCheck) } }} /> +
+ Date syntax : yyyy-MM-dd HH:mm +
{onUpdate && (