1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[395],{5470:(e,t,a)=>{"use strict";a.d(t,{CalendarClient:()=>A});var r=a(95155),s=a(11518),l=a.n(s),n=a(12115),i=a(74266),d=a(51314),o=a(90940),c=a(44396),m=a(34483),u=a(88482),f=a(97168),g=a(34964),x=a(69074),p=a(5196),h=a(54416),v=a(381),y=a(84616),b=a(51154),j=a(99840),N=a(89852),w=a(99474),C=a(82714),k=a(37777),S=a(54239);a(35279);var D=a(16946),E=a(95139);(0,S.E)("fr",D.fr);let I=["#4f46e5","#0891b2","#0e7490","#16a34a","#65a30d","#ca8a04","#d97706","#dc2626","#e11d48","#9333ea","#7c3aed","#2563eb"];function T(e){let{open:t,onClose:a,onSave:s,onDelete:l,initialData:i}=e,[d,o]=(0,n.useState)((null==i?void 0:i.name)||""),[c,m]=(0,n.useState)((null==i?void 0:i.color)||"#4f46e5"),[u,g]=(0,n.useState)((null==i?void 0:i.description)||""),[v,y]=(0,n.useState)(!1),[b,k]=(0,n.useState)(!1),S=(null==i?void 0:i.name)==="Calendrier principal";(0,n.useEffect)(()=>{t&&(o((null==i?void 0:i.name)||""),m((null==i?void 0:i.color)||"#4f46e5"),g((null==i?void 0:i.description)||""),k(!I.includes((null==i?void 0:i.color)||"#4f46e5")))},[t,i]);let D=async e=>{e.preventDefault(),y(!0);try{await s({id:null==i?void 0:i.id,name:d,color:c,description:u}),T()}catch(e){console.error("Erreur lors de la cr\xe9ation du calendrier:",e)}finally{y(!1)}},E=async()=>{if((null==i?void 0:i.id)&&l&&!S&&confirm("\xcates-vous s\xfbr de vouloir supprimer ce calendrier ? Tous les \xe9v\xe9nements associ\xe9s seront \xe9galement supprim\xe9s.")){y(!0);try{await l(i.id),T()}catch(e){console.error("Erreur lors de la suppression du calendrier:",e)}finally{y(!1)}}},T=()=>{o(""),m("#4f46e5"),g(""),k(!1),a()};return(0,r.jsx)(j.lG,{open:t,onOpenChange:e=>!e&&a(),children:(0,r.jsxs)(j.Cf,{className:"sm:max-w-md rounded-xl",children:[(0,r.jsx)(j.c7,{children:(0,r.jsxs)(j.L3,{className:"flex items-center text-xl font-semibold text-gray-900",children:[(0,r.jsx)(x.A,{className:"w-5 h-5 mr-2 text-indigo-600"}),(null==i?void 0:i.id)?"Modifier le calendrier":"Cr\xe9er un nouveau calendrier"]})}),(0,r.jsxs)("form",{onSubmit:D,children:[(0,r.jsxs)("div",{className:"space-y-5 py-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{htmlFor:"calendar-name",className:"text-gray-700",children:"Nom"}),(0,r.jsx)(N.p,{id:"calendar-name",value:d,onChange:e=>o(e.target.value),placeholder:"Nom du calendrier",required:!0,disabled:S,className:"rounded-lg border-gray-300 focus:border-indigo-500 focus:ring-indigo-500"})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(C.J,{className:"text-gray-700",children:"Couleur"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-3 mb-3",children:[I.map(e=>(0,r.jsx)("button",{type:"button",className:"w-8 h-8 rounded-full flex items-center justify-center transition-all ".concat(c!==e||b?"hover:scale-110":"ring-2 ring-offset-2 ring-gray-400"),style:{backgroundColor:e},onClick:()=>{m(e),k(!1)},children:c===e&&!b&&(0,r.jsx)(p.A,{className:"w-4 h-4 text-white"})},e)),(0,r.jsx)("button",{type:"button",className:"w-8 h-8 rounded-full flex items-center justify-center bg-gradient-to-r from-purple-500 via-pink-500 to-red-500 transition-all ".concat(b?"ring-2 ring-offset-2 ring-gray-400":"hover:scale-110"),onClick:()=>k(!0),children:b&&(0,r.jsx)(p.A,{className:"w-4 h-4 text-white"})})]}),b&&(0,r.jsxs)("div",{className:"flex items-center gap-4 mt-2 p-3 bg-gray-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex flex-1 items-center gap-3",children:[(0,r.jsx)(N.p,{id:"calendar-color",type:"color",value:c,onChange:e=>m(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded border-gray-300"}),(0,r.jsx)(N.p,{type:"text",value:c,onChange:e=>m(e.target.value),placeholder:"#RRGGBB",className:"w-28 rounded-lg"})]}),(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg shadow-sm",style:{backgroundColor:c}})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{htmlFor:"calendar-description",className:"text-gray-700",children:"Description (optionnelle)"}),(0,r.jsx)(w.T,{id:"calendar-description",value:u,onChange:e=>g(e.target.value),placeholder:"Description du calendrier",rows:3,className:"rounded-lg border-gray-300 focus:border-indigo-500 focus:ring-indigo-500"})]})]}),(0,r.jsx)(j.Es,{className:"mt-6 border-t border-gray-100 pt-4",children:(0,r.jsxs)("div",{className:"flex justify-between w-full",children:[(null==i?void 0:i.id)&&!S&&(0,r.jsxs)(f.$,{type:"button",variant:"destructive",onClick:E,disabled:v||S,children:[(0,r.jsx)(h.A,{className:"w-4 h-4 mr-2"}),"Supprimer"]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(f.$,{type:"button",variant:"outline",onClick:a,disabled:v,className:"rounded-lg border-gray-300 text-gray-700 hover:bg-gray-50",children:"Annuler"}),(0,r.jsx)(f.$,{type:"submit",disabled:!d||v||S,className:"rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white",children:v?"Enregistrement...":(null==i?void 0:i.id)?"Mettre \xe0 jour":"Cr\xe9er"})]})]})})]})]})})}function A(e){var t;let{initialCalendars:a,userId:s,userProfile:x}=e,[h,D]=(0,n.useState)(a.map(e=>({...e,events:e.events||[]}))),[I,A]=(0,n.useState)((null==(t=a[0])?void 0:t.id)||""),[F,R]=(0,n.useState)("dayGridMonth"),[O,M]=(0,n.useState)(!1),[H,J]=(0,n.useState)(!1),[L,z]=(0,n.useState)(null),[G,$]=(0,n.useState)(null),[P,_]=(0,n.useState)(!1),[U,B]=(0,n.useState)(null),[Z,V]=(0,n.useState)({title:"",description:null,start:"",end:"",allDay:!1,location:null,calendarId:I}),[X,W]=(0,n.useState)(null),[q,Y]=(0,n.useState)([]),[K,Q]=(0,n.useState)({totalEvents:0,upcomingEvents:0,completedEvents:0,meetingHours:0}),[ee,et]=(0,n.useState)([]);(0,n.useEffect)(()=>{h.length>0&&(et(h.map(e=>e.id)),ea(),er())},[h]);let ea=()=>{let e=new Date,t={totalEvents:0,upcomingEvents:0,completedEvents:0,meetingHours:0};h.forEach(a=>{a.events.forEach(a=>{t.totalEvents++;let r=new Date(a.start),s=new Date(a.end);r>e?t.upcomingEvents++:s<e&&t.completedEvents++;let l=(s.getTime()-r.getTime())/36e5;t.meetingHours+=l})}),Q(t)},er=()=>{let e=new Date;Y(h.flatMap(e=>e.events).filter(t=>new Date(t.start)>e).sort((e,t)=>new Date(e.start).getTime()-new Date(t.start).getTime()).slice(0,5))},es=async()=>{try{_(!0);let e=await fetch("/api/calendars");if(!e.ok)throw Error("Failed to fetch calendars");let t=await e.json();console.log("Raw calendars data:",t);let a=t.map(e=>({...e,events:Array.isArray(e.events)?e.events.map(e=>({...e,start:new Date(e.start),end:new Date(e.end)})):[]}));console.log("Setting calendars with processed events:",a),D(a),ea(),er(),el.current&&el.current.getApi().refetchEvents()}catch(e){console.error("Error fetching calendars:",e),B(e instanceof Error?e.message:"Failed to fetch calendars")}finally{_(!1)}},el=(0,n.useRef)(null),en=async e=>{try{if(_(!0),!(await fetch("/api/calendars",{method:e.id?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,userId:s})})).ok)throw Error("Failed to save calendar");await es(),J(!1)}catch(e){console.error("Error saving calendar:",e),B(e instanceof Error?e.message:"Failed to save calendar")}finally{_(!1)}},ei=async e=>{try{if(_(!0),!(await fetch("/api/calendars/".concat(e),{method:"DELETE"})).ok)throw Error("Failed to delete calendar");if(await es(),J(!1),I===e){var t;let a=h.filter(t=>t.id!==e);A((null==(t=a[0])?void 0:t.id)||"")}}catch(e){console.error("Error deleting calendar:",e),B(e instanceof Error?e.message:"Failed to delete calendar")}finally{_(!1)}},ed=async()=>{try{if(!Z.title||!Z.start||!Z.end||!Z.calendarId){console.log("Form validation failed:",{title:Z.title,start:Z.start,end:Z.end,calendarId:Z.calendarId}),B("Veuillez remplir tous les champs obligatoires et s\xe9lectionner un calendrier");return}_(!0);let e={...Z,start:new Date(Z.start).toISOString(),end:new Date(Z.end).toISOString(),userId:s,...L?{id:L.id}:{},allDay:Z.allDay};console.log("Submitting event with data:",e);let t=await fetch("/api/events",{method:L?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();if(console.log("Response from server:",a),!t.ok)throw console.error("Error response:",a),Error(a.error||"Failed to save event");M(!1),V({title:"",description:null,start:"",end:"",allDay:!1,location:null,calendarId:I}),z(null),B(null);let r=h.map(t=>t.id===e.calendarId?{...t,events:[...t.events,a]}:t);D(r),await es()}catch(e){console.error("Error saving event:",e),B(e instanceof Error?e.message:"Failed to save event")}finally{_(!1)}},eo=async()=>{if((null==L?void 0:L.id)&&confirm("\xcates-vous s\xfbr de vouloir supprimer cet \xe9v\xe9nement ?"))try{_(!0);let e=await fetch("/api/events/".concat(L.id),{method:"DELETE"});if(!e.ok){let t=await e.json();throw Error(t.message||"Failed to delete event")}let t=h.map(e=>({...e,events:e.events.filter(e=>e.id!==L.id)}));D(t),M(!1),z(null),V({title:"",description:null,start:"",end:"",allDay:!1,location:null,calendarId:I}),el.current&&el.current.getApi().refetchEvents()}catch(e){console.error("Error deleting event:",e),B(e instanceof Error?e.message:"Failed to delete event")}finally{_(!1)}},ec=e=>{R(e),el.current&&el.current.getApi().changeView(e)},em=e=>e?new Date(e):new Date,eu=e=>{if(e)if(e>em(Z.end)){let t=new Date(e);t.setHours(e.getHours()+1),V({...Z,start:e.toISOString(),end:t.toISOString()})}else V({...Z,start:e.toISOString()})},ef=e=>{if(e)if(e<em(Z.start)){let t=new Date(e);t.setHours(e.getHours()-1),V({...Z,start:t.toISOString(),end:e.toISOString()})}else V({...Z,end:e.toISOString()})};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)(u.Zp,{className:"p-4",children:[(0,r.jsxs)("div",{className:"jsx-82cd74ef5c10b128 flex items-center justify-between mb-4",children:[(0,r.jsx)("div",{className:"jsx-82cd74ef5c10b128 flex items-center gap-4",children:(0,r.jsxs)(f.$,{onClick:()=>{z(null),V({title:"",description:null,start:new Date().toISOString(),end:new Date(new Date().setHours(new Date().getHours()+1)).toISOString(),allDay:!1,location:null,calendarId:I}),M(!0)},className:"bg-primary hover:bg-primary/90 text-white",children:[(0,r.jsx)(y.A,{className:"mr-2 h-4 w-4"}),(0,r.jsx)("span",{className:"jsx-82cd74ef5c10b128 font-medium",children:"Nouvel \xe9v\xe9nement"})]})}),(0,r.jsx)(g.tU,{value:F,className:"w-auto",children:(0,r.jsxs)(g.j7,{children:[(0,r.jsx)(g.Xi,{value:"dayGridMonth",onClick:()=>ec("dayGridMonth"),children:"Mois"}),(0,r.jsx)(g.Xi,{value:"timeGridWeek",onClick:()=>ec("timeGridWeek"),children:"Semaine"}),(0,r.jsx)(g.Xi,{value:"timeGridDay",onClick:()=>ec("timeGridDay"),children:"Jour"})]})})]}),(0,r.jsx)(()=>(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:h.map(e=>(0,r.jsxs)("div",{className:"relative group",children:[(0,r.jsxs)(f.$,{variant:ee.includes(e.id)?"secondary":"ghost",className:"flex items-center gap-2 pr-8",onClick:()=>{ee.includes(e.id)?et(ee.filter(t=>t!==e.id)):et([...ee,e.id])},children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),(0,r.jsx)("span",{children:e.name}),(0,r.jsx)("div",{className:"ml-2",children:ee.includes(e.id)?(0,r.jsx)(p.A,{className:"h-4 w-4"}):null})]}),"Calendrier principal"!==e.name&&(0,r.jsx)(f.$,{variant:"ghost",size:"icon",className:"absolute right-0 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),$(e),J(!0)},children:(0,r.jsx)(v.A,{className:"h-4 w-4"})})]},e.id))}),{className:"jsx-82cd74ef5c10b128"}),(0,r.jsx)(l(),{id:"82cd74ef5c10b128",children:".fc .fc-daygrid-day-frame{min-height:100px!important;max-height:100px!important;overflow-y:auto!important}.fc .fc-daygrid-day-events{margin-bottom:0!important}.fc .fc-daygrid-day-frame::-webkit-scrollbar{width:4px}.fc .fc-daygrid-day-frame::-webkit-scrollbar-track{background:transparent}.fc .fc-daygrid-day-frame::-webkit-scrollbar-thumb{background:#888;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.fc .fc-daygrid-day-frame::-webkit-scrollbar-thumb:hover{background:#555}.fc .fc-daygrid-day-frame::-webkit-scrollbar{display:none}.fc .fc-daygrid-day-frame:hover::-webkit-scrollbar{display:block}"}),P?(0,r.jsxs)("div",{className:"jsx-82cd74ef5c10b128 h-96 flex items-center justify-center",children:[(0,r.jsx)(b.A,{className:"h-8 w-8 animate-spin text-primary"}),(0,r.jsx)("span",{className:"jsx-82cd74ef5c10b128 ml-2",children:"Chargement des \xe9v\xe9nements..."})]}):(0,r.jsx)(i.A,{ref:el,plugins:[d.A,o.A,c.Ay],initialView:F,headerToolbar:{left:"prev,next today",center:"title",right:""},events:h.filter(e=>ee.includes(e.id)).flatMap(e=>(e.events||[]).map(t=>({id:t.id,title:t.title,start:new Date(t.start),end:new Date(t.end),allDay:t.isAllDay,description:t.description,location:t.location,calendarId:t.calendarId,backgroundColor:"".concat(e.color,"dd"),borderColor:e.color,textColor:"#ffffff",extendedProps:{calendarName:e.name,location:t.location,description:t.description,calendarId:t.calendarId,originalEvent:t,color:e.color}}))),eventContent:e=>(0,r.jsx)(k.Bc,{children:(0,r.jsxs)(k.m_,{children:[(0,r.jsx)(k.k$,{asChild:!0,children:(0,r.jsx)("div",{style:{backgroundColor:"".concat(e.event.backgroundColor),boxShadow:"inset 0 0 0 1px ".concat(e.event.borderColor,", 0 2px 4px ").concat(e.event.borderColor,"40")},className:"jsx-82cd74ef5c10b128 px-2 py-1 overflow-hidden w-full transition-all rounded-sm hover:brightness-110",children:(0,r.jsxs)("div",{className:"jsx-82cd74ef5c10b128 flex items-center gap-1.5 text-xs text-white",children:[!e.event.allDay&&(0,r.jsx)("span",{className:"jsx-82cd74ef5c10b128 font-medium whitespace-nowrap shrink-0",children:"object"==typeof e.event.start&&e.event.start instanceof Date?e.event.start.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):""}),(0,r.jsx)("span",{className:"jsx-82cd74ef5c10b128 font-medium truncate max-w-[calc(100%-4.5rem)]",children:e.event.title})]})})}),(0,r.jsx)(k.ZI,{children:(0,r.jsxs)("div",{className:"jsx-82cd74ef5c10b128 text-sm",children:[(0,r.jsx)("p",{className:"jsx-82cd74ef5c10b128 font-medium",children:e.event.title}),!e.event.allDay&&(0,r.jsx)("p",{className:"jsx-82cd74ef5c10b128 text-xs text-gray-400 mt-1",children:"object"==typeof e.event.start&&e.event.start instanceof Date?e.event.start.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):""})]})})]})}),eventClassNames:"rounded-md overflow-hidden",dayCellContent:e=>(0,r.jsx)("div",{className:"jsx-82cd74ef5c10b128 text-xs font-medium",children:e.dayNumberText}),locale:m.A,selectable:!0,selectMirror:!0,dayMaxEventRows:!1,dayMaxEvents:!1,weekends:!0,select:e=>{let t=new Date(e.start),a=new Date(e.end);if(console.log("Date select handler - Current state:",{calendars:h.map(e=>({id:e.id,name:e.name})),selectedCalendarId:I,availableCalendars:h.length}),!I&&h.length>0){let r=h[0];console.log("No calendar selected, selecting first calendar:",r),A(r.id),V({title:"",description:null,start:t.toISOString(),end:a.toISOString(),allDay:e.allDay,location:null,calendarId:r.id})}else V({title:"",description:null,start:t.toISOString(),end:a.toISOString(),allDay:e.allDay,location:null,calendarId:I});M(!0)},eventClick:e=>{let t=e.event,a=new Date(t.start),r=new Date(t.end||t.start);z(t.extendedProps.originalEvent),V({title:t.title,description:t.extendedProps.description,start:a.toISOString().slice(0,16),end:r.toISOString().slice(0,16),allDay:t.isAllDay,location:t.extendedProps.location,calendarId:t.extendedProps.calendarId}),M(!0)},height:"auto",aspectRatio:1.8,slotMinTime:"06:00:00",slotMaxTime:"22:00:00",allDaySlot:!0,allDayText:"",views:{timeGridWeek:{allDayText:"",dayHeaderFormat:{weekday:"long",day:"numeric",month:"numeric"}},timeGridDay:{allDayText:"",dayHeaderFormat:{weekday:"long",day:"numeric",month:"numeric"}}},slotLabelFormat:{hour:"2-digit",minute:"2-digit",hour12:!1}})]}),(0,r.jsx)(T,{open:H,onClose:()=>J(!1),onSave:en,onDelete:ei,initialData:G||void 0}),(0,r.jsx)(j.lG,{open:O,onOpenChange:e=>{if(!e){var t;M(!1),V({title:"",description:null,start:"",end:"",allDay:!1,location:null,calendarId:I||(null==(t=h[0])?void 0:t.id)}),z(null),B(null)}},children:(0,r.jsxs)(j.Cf,{className:"sm:max-w-lg",children:[(0,r.jsx)(j.c7,{children:(0,r.jsx)(j.L3,{className:"text-gray-800",children:L?"Modifier l'\xe9v\xe9nement":"Nouvel \xe9v\xe9nement"})}),U&&(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 text-red-600 px-4 py-2 rounded-md text-sm",children:U}),(0,r.jsxs)("div",{className:"space-y-4 py-4",children:[(0,r.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)(C.J,{htmlFor:"title",className:"text-base font-semibold text-gray-800",children:"Titre"}),(0,r.jsx)(N.p,{id:"title",placeholder:"Titre de l'\xe9v\xe9nement",value:Z.title,onChange:e=>V({...Z,title:e.target.value}),className:"bg-white text-gray-900"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{className:"text-base font-semibold text-gray-800",children:"Calendrier"}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:h.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>{V(t=>({...t,calendarId:e.id}))},className:"flex items-center gap-2 px-3 py-2 rounded-lg transition-all ".concat(Z.calendarId===e.id?"bg-white ring-2 ring-primary":"bg-white hover:bg-gray-50 border border-gray-200"),children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.color}}),(0,r.jsx)("span",{className:"text-sm ".concat(Z.calendarId===e.id?"font-medium text-gray-900":"text-gray-700"),children:e.name})]},e.id))})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{className:"text-gray-800",children:"D\xe9but"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(S.Ay,{selected:em(Z.start),onChange:eu,dateFormat:"dd/MM/yyyy",locale:"fr",className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary bg-white text-gray-900",placeholderText:"Date",customInput:(0,r.jsx)(N.p,{className:"bg-white text-gray-900"})})}),(0,r.jsx)(S.Ay,{selected:em(Z.start),onChange:eu,showTimeSelect:!0,showTimeSelectOnly:!0,timeIntervals:15,timeCaption:"Heure",dateFormat:"HH:mm",className:"w-32 bg-white text-gray-900",customInput:(0,r.jsx)(N.p,{className:"bg-white text-gray-900"})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{className:"text-gray-800",children:"Fin"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(S.Ay,{selected:em(Z.end),onChange:ef,dateFormat:"dd/MM/yyyy",locale:"fr",className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary bg-white text-gray-900",placeholderText:"Date",customInput:(0,r.jsx)(N.p,{className:"bg-white text-gray-900"}),minDate:em(Z.start)})}),(0,r.jsx)(S.Ay,{selected:em(Z.end),onChange:ef,showTimeSelect:!0,showTimeSelectOnly:!0,timeIntervals:15,timeCaption:"Heure",dateFormat:"HH:mm",className:"w-32 bg-white text-gray-900",customInput:(0,r.jsx)(N.p,{className:"bg-white text-gray-900"})})]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(E.S,{id:"allDay",checked:Z.allDay,onCheckedChange:e=>V({...Z,allDay:e})}),(0,r.jsx)(C.J,{htmlFor:"allDay",className:"text-gray-800",children:"Toute la journ\xe9e"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{className:"text-gray-800",children:"Lieu"}),(0,r.jsx)(N.p,{value:Z.location||"",onChange:e=>V({...Z,location:e.target.value}),placeholder:"Ajouter un lieu",className:"bg-white text-gray-900"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(C.J,{className:"text-gray-800",children:"Description"}),(0,r.jsx)(w.T,{value:Z.description||"",onChange:e=>V({...Z,description:e.target.value}),placeholder:"Ajouter une description",className:"bg-white text-gray-900"})]})]}),(0,r.jsxs)(j.Es,{children:[L&&(0,r.jsx)(f.$,{variant:"destructive",onClick:eo,disabled:P,children:P?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Suppression..."]}):"Supprimer"}),(0,r.jsxs)("div",{className:"flex space-x-2",children:[(0,r.jsx)(f.$,{variant:"outline",onClick:()=>M(!1),disabled:P,className:"bg-white hover:bg-gray-50 text-gray-900 border-gray-200",children:"Annuler"}),(0,r.jsx)(f.$,{onClick:ed,disabled:P,className:"bg-blue-600 hover:bg-blue-700 text-white",children:P?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):L?"Mettre \xe0 jour":"Cr\xe9er"})]})]})]})})]})}},31930:(e,t,a)=>{Promise.resolve().then(a.bind(a,5470))},34964:(e,t,a)=>{"use strict";a.d(t,{Xi:()=>o,av:()=>c,j7:()=>d,tU:()=>i});var r=a(95155),s=a(12115),l=a(30064),n=a(53999);let i=l.bL,d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.B8,{ref:t,className:(0,n.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",a),...s})});d.displayName=l.B8.displayName;let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.l9,{ref:t,className:(0,n.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...s})});o.displayName=l.l9.displayName;let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.UC,{ref:t,className:(0,n.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...s})});c.displayName=l.UC.displayName},37777:(e,t,a)=>{"use strict";a.d(t,{Bc:()=>i,ZI:()=>c,k$:()=>o,m_:()=>d});var r=a(95155),s=a(12115),l=a(78082),n=a(53999);let i=l.Kq,d=l.bL,o=l.l9,c=s.forwardRef((e,t)=>{let{className:a,sideOffset:s=4,...i}=e;return(0,r.jsx)(l.UC,{ref:t,sideOffset:s,className:(0,n.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...i})});c.displayName=l.UC.displayName},53999:(e,t,a)=>{"use strict";a.d(t,{cn:()=>l});var r=a(52596),s=a(39688);function l(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.QP)((0,r.$)(t))}},82714:(e,t,a)=>{"use strict";a.d(t,{J:()=>o});var r=a(95155),s=a(12115),l=a(72797),n=a(74466),i=a(53999);let d=(0,n.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.b,{ref:t,className:(0,i.cn)(d(),a),...s})});o.displayName=l.b.displayName},88482:(e,t,a)=>{"use strict";a.d(t,{BT:()=>o,Wu:()=>c,ZB:()=>d,Zp:()=>n,aR:()=>i});var r=a(95155),s=a(12115),l=a(53999);let n=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",a),...s})});n.displayName="Card";let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",a),...s})});i.displayName="CardHeader";let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",a),...s})});d.displayName="CardTitle";let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",a),...s})});o.displayName="CardDescription";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",a),...s})});c.displayName="CardContent",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",a),...s})}).displayName="CardFooter"},89852:(e,t,a)=>{"use strict";a.d(t,{p:()=>n});var r=a(95155),s=a(12115),l=a(53999);let n=s.forwardRef((e,t)=>{let{className:a,type:s,...n}=e;return(0,r.jsx)("input",{type:s,className:(0,l.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:t,...n})});n.displayName="Input"},95139:(e,t,a)=>{"use strict";a.d(t,{S:()=>d});var r=a(95155),s=a(12115),l=a(15630),n=a(5196),i=a(53999);let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.bL,{ref:t,className:(0,i.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...s,children:(0,r.jsx)(l.C1,{className:(0,i.cn)("flex items-center justify-center text-current"),children:(0,r.jsx)(n.A,{className:"h-4 w-4"})})})});d.displayName=l.bL.displayName},97168:(e,t,a)=>{"use strict";a.d(t,{$:()=>o,r:()=>d});var r=a(95155),s=a(12115),l=a(99708),n=a(74466),i=a(53999);let d=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=s.forwardRef((e,t)=>{let{className:a,variant:s,size:n,asChild:o=!1,...c}=e,m=o?l.DX:"button";return(0,r.jsx)(m,{className:(0,i.cn)(d({variant:s,size:n,className:a})),ref:t,...c})});o.displayName="Button"},99474:(e,t,a)=>{"use strict";a.d(t,{T:()=>n});var r=a(95155),s=a(12115),l=a(53999);let n=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:t,...s})});n.displayName="Textarea"},99840:(e,t,a)=>{"use strict";a.d(t,{Cf:()=>u,Es:()=>g,L3:()=>x,ZJ:()=>c,c7:()=>f,lG:()=>d,rr:()=>p,zM:()=>o});var r=a(95155),s=a(12115),l=a(45821),n=a(54416),i=a(53999);let d=l.bL,o=l.l9,c=l.ZL;l.bm;let m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.hJ,{ref:t,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s})});m.displayName=l.hJ.displayName;let u=s.forwardRef((e,t)=>{let{className:a,children:s,...d}=e;return(0,r.jsxs)(c,{children:[(0,r.jsx)(m,{}),(0,r.jsxs)(l.UC,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...d,children:[s,(0,r.jsxs)(l.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(n.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=l.UC.displayName;let f=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let g=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};g.displayName="DialogFooter";let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.hE,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});x.displayName=l.hE.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.VY,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});p.displayName=l.VY.displayName}},e=>{var t=t=>e(e.s=t);e.O(0,[5302,4020,6018,5579,4277,5685,5652,1736,7272,8441,1684,7358],()=>t(31930)),_N_E=e.O()}]); |