NeahNew/.next/server/app/missions/new/page.js
2025-05-06 23:01:34 +02:00

1 line
63 KiB
JavaScript

(()=>{var e={};e.id=9217,e.ids=[9217],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},11723:e=>{"use strict";e.exports=require("querystring")},12412:e=>{"use strict";e.exports=require("assert")},14985:e=>{"use strict";e.exports=require("dns")},15150:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>r});let r=(0,a(12907).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/alma/Documents/NeahNew/app/missions/new/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/alma/Documents/NeahNew/app/missions/new/page.tsx","default")},19121:e=>{"use strict";e.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:e=>{"use strict";e.exports=require("os")},23026:(e,s,a)=>{"use strict";a.d(s,{A:()=>r});let r=(0,a(62688).A)("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},24791:(e,s,a)=>{Promise.resolve().then(a.bind(a,80982))},27910:e=>{"use strict";e.exports=require("stream")},28354:e=>{"use strict";e.exports=require("util")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:e=>{"use strict";e.exports=require("path")},34631:e=>{"use strict";e.exports=require("tls")},40799:(e,s,a)=>{Promise.resolve().then(a.bind(a,15150))},41204:e=>{"use strict";e.exports=require("string_decoder")},41312:(e,s,a)=>{"use strict";a.d(s,{A:()=>r});let r=(0,a(62688).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},49829:(e,s,a)=>{"use strict";a.d(s,{C1:()=>A,bL:()=>C});var r=a(43210),t=a(98599),l=a(11273),i=a(70569),n=a(65551),d=a(83721),c=a(18853),o=a(46059);a(51215);var m=a(8730),x=a(60687),h=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,s)=>{let a=r.forwardRef((e,a)=>{let{asChild:r,...t}=e,l=r?m.DX:s;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,x.jsx)(l,{...t,ref:a})});return a.displayName=`Primitive.${s}`,{...e,[s]:a}},{}),u="Checkbox",[p,g]=(0,l.A)(u),[b,j]=p(u),f=r.forwardRef((e,s)=>{let{__scopeCheckbox:a,name:l,checked:d,defaultChecked:c,required:o,disabled:m,value:u="on",onCheckedChange:p,form:g,...j}=e,[f,v]=r.useState(null),y=(0,t.s)(s,e=>v(e)),C=r.useRef(!1),A=!f||g||!!f.closest("form"),[S=!1,z]=(0,n.i)({prop:d,defaultProp:c,onChange:p}),P=r.useRef(S);return r.useEffect(()=>{let e=f?.form;if(e){let s=()=>z(P.current);return e.addEventListener("reset",s),()=>e.removeEventListener("reset",s)}},[f,z]),(0,x.jsxs)(b,{scope:a,state:S,disabled:m,children:[(0,x.jsx)(h.button,{type:"button",role:"checkbox","aria-checked":w(S)?"mixed":S,"aria-required":o,"data-state":k(S),"data-disabled":m?"":void 0,disabled:m,value:u,...j,ref:y,onKeyDown:(0,i.m)(e.onKeyDown,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,i.m)(e.onClick,e=>{z(e=>!!w(e)||!e),A&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())})}),A&&(0,x.jsx)(N,{control:f,bubbles:!C.current,name:l,value:u,checked:S,required:o,disabled:m,form:g,style:{transform:"translateX(-100%)"},defaultChecked:!w(c)&&c})]})});f.displayName=u;var v="CheckboxIndicator",y=r.forwardRef((e,s)=>{let{__scopeCheckbox:a,forceMount:r,...t}=e,l=j(v,a);return(0,x.jsx)(o.C,{present:r||w(l.state)||!0===l.state,children:(0,x.jsx)(h.span,{"data-state":k(l.state),"data-disabled":l.disabled?"":void 0,...t,ref:s,style:{pointerEvents:"none",...e.style}})})});y.displayName=v;var N=e=>{let{control:s,checked:a,bubbles:t=!0,defaultChecked:l,...i}=e,n=r.useRef(null),o=(0,d.Z)(a),m=(0,c.X)(s);r.useEffect(()=>{let e=n.current,s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(o!==a&&s){let r=new Event("click",{bubbles:t});e.indeterminate=w(a),s.call(e,!w(a)&&a),e.dispatchEvent(r)}},[o,a,t]);let h=r.useRef(!w(a)&&a);return(0,x.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l??h.current,...i,tabIndex:-1,ref:n,style:{...e.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function w(e){return"indeterminate"===e}function k(e){return w(e)?"indeterminate":e?"checked":"unchecked"}var C=f,A=y},55192:(e,s,a)=>{"use strict";a.d(s,{BT:()=>c,Wu:()=>o,ZB:()=>d,Zp:()=>i,aR:()=>n});var r=a(60687),t=a(43210),l=a(96241);let i=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("div",{ref:a,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...s}));i.displayName="Card";let n=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("div",{ref:a,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",e),...s}));n.displayName="CardHeader";let d=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("div",{ref:a,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",e),...s}));d.displayName="CardTitle";let c=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("div",{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",e),...s}));c.displayName="CardDescription";let o=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("div",{ref:a,className:(0,l.cn)("p-6 pt-0",e),...s}));o.displayName="CardContent",t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("div",{ref:a,className:(0,l.cn)("flex items-center p-6 pt-0",e),...s})).displayName="CardFooter"},55511:e=>{"use strict";e.exports=require("crypto")},55591:e=>{"use strict";e.exports=require("https")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63974:(e,s,a)=>{"use strict";a.d(s,{bq:()=>x,eb:()=>g,gC:()=>p,l6:()=>o,yv:()=>m});var r=a(60687),t=a(43210),l=a(28695),i=a(78272),n=a(3589),d=a(13964),c=a(96241);let o=l.bL;l.YJ;let m=l.WT,x=t.forwardRef(({className:e,children:s,...a},t)=>(0,r.jsxs)(l.l9,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...a,children:[s,(0,r.jsx)(l.In,{asChild:!0,children:(0,r.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]}));x.displayName=l.l9.displayName;let h=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)(l.PP,{ref:a,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",e),...s,children:(0,r.jsx)(n.A,{className:"h-4 w-4"})}));h.displayName=l.PP.displayName;let u=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)(l.wn,{ref:a,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",e),...s,children:(0,r.jsx)(i.A,{className:"h-4 w-4"})}));u.displayName=l.wn.displayName;let p=t.forwardRef(({className:e,children:s,position:a="popper",...t},i)=>(0,r.jsx)(l.ZL,{children:(0,r.jsxs)(l.UC,{ref:i,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[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","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...t,children:[(0,r.jsx)(h,{}),(0,r.jsx)(l.LM,{className:(0,c.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(u,{})]})}));p.displayName=l.UC.displayName,t.forwardRef(({className:e,...s},a)=>(0,r.jsx)(l.JU,{ref:a,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=l.JU.displayName;let g=t.forwardRef(({className:e,children:s,...a},t)=>(0,r.jsxs)(l.q7,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(l.VF,{children:(0,r.jsx)(d.A,{className:"h-4 w-4"})})}),(0,r.jsx)(l.p4,{children:s})]}));g.displayName=l.q7.displayName,t.forwardRef(({className:e,...s},a)=>(0,r.jsx)(l.wv,{ref:a,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=l.wv.displayName},64543:(e,s,a)=>{Promise.resolve().then(a.bind(a,69560))},69560:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>r});let r=(0,a(12907).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/alma/Documents/NeahNew/app/missions/layout.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/alma/Documents/NeahNew/app/missions/layout.tsx","default")},74075:e=>{"use strict";e.exports=require("zlib")},77751:(e,s,a)=>{Promise.resolve().then(a.bind(a,95708))},78464:(e,s,a)=>{"use strict";a.d(s,{A:()=>r});let r=(0,a(62688).A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])},79428:e=>{"use strict";e.exports=require("buffer")},79551:e=>{"use strict";e.exports=require("url")},80982:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>n});var r=a(60687);a(43210);var t=a(85814),l=a.n(t),i=a(16189);function n({children:e}){let s=(0,i.usePathname)();return(0,r.jsx)("main",{className:"w-full h-screen bg-white",children:(0,r.jsxs)("div",{className:"w-full h-full px-4 pt-12 pb-4 flex",children:[(0,r.jsxs)("div",{className:"w-[234px] min-w-[234px] bg-pink-50 border-r border-gray-100 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"bg-pink-50 py-4 px-6 border-b border-pink-100",children:[(0,r.jsx)("h2",{className:"text-lg font-medium text-gray-800",children:"CAP"}),(0,r.jsx)("p",{className:"text-xs text-gray-600",children:"Centre d'Administration et de Pilotage"})]}),(0,r.jsxs)("nav",{className:"mt-4",children:[(0,r.jsx)(l(),{href:"/missions",passHref:!0,children:(0,r.jsx)("div",{className:`px-6 py-[10px] ${"/missions"===s?"bg-white":""} hover:bg-white`,children:(0,r.jsx)("span",{className:"text-sm font-normal text-gray-700",children:"Mes Missions"})})}),(0,r.jsx)(l(),{href:"/missions/new",passHref:!0,children:(0,r.jsx)("div",{className:`px-6 py-[10px] ${"/missions/new"===s?"bg-white":""} hover:bg-white`,children:(0,r.jsx)("span",{className:"text-sm font-normal text-gray-700",children:"Nouvelle Mission"})})})]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto bg-white",children:e})]})})}},81630:e=>{"use strict";e.exports=require("http")},82905:(e,s,a)=>{"use strict";a.r(s),a.d(s,{GlobalError:()=>i.a,__next_app__:()=>m,pages:()=>o,routeModule:()=>x,tree:()=>c});var r=a(65239),t=a(48088),l=a(88170),i=a.n(l),n=a(30893),d={};for(let e in n)0>["default","tree","pages","GlobalError","__next_app__","routeModule"].indexOf(e)&&(d[e]=()=>n[e]);a.d(s,d);let c={children:["",{children:["missions",{children:["new",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(a.bind(a,15150)),"/Users/alma/Documents/NeahNew/app/missions/new/page.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(a.bind(a,69560)),"/Users/alma/Documents/NeahNew/app/missions/layout.tsx"]}]},{layout:[()=>Promise.resolve().then(a.bind(a,58014)),"/Users/alma/Documents/NeahNew/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(a.t.bind(a,57398,23)),"next/dist/client/components/not-found-error"],forbidden:[()=>Promise.resolve().then(a.t.bind(a,89999,23)),"next/dist/client/components/forbidden-error"],unauthorized:[()=>Promise.resolve().then(a.t.bind(a,65284,23)),"next/dist/client/components/unauthorized-error"]}]}.children,o=["/Users/alma/Documents/NeahNew/app/missions/new/page.tsx"],m={require:a,loadChunk:()=>Promise.resolve()},x=new r.AppPageRouteModule({definition:{kind:t.RouteKind.APP_PAGE,page:"/missions/new/page",pathname:"/missions/new",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},83997:e=>{"use strict";e.exports=require("tty")},91645:e=>{"use strict";e.exports=require("net")},93661:(e,s,a)=>{"use strict";a.d(s,{A:()=>r});let r=(0,a(62688).A)("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]])},94735:e=>{"use strict";e.exports=require("events")},95708:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>K});var r=a(60687),t=a(43210),l=a(85910),i=a(68988),n=a(24934),d=a(15616),c=a(63974),o=a(93437),m=a(55192),x=a(59821),h=a(11860),u=a(78464),p=a(62688);let g=(0,p.A)("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);var b=a(93613),j=a(13964),f=a(41312),v=a(99270),y=a(23026);let N=(0,p.A)("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var w=a(70333),k=a(55629),C=a(41862),A=a(82136);function S({type:e,missionId:s,onUploadComplete:a,onFileSelect:l,maxSize:i=5242880,acceptedFileTypes:d="logo"===e?"image/*":".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png",isNewMission:c=!1}){console.log("FileUpload component initialized with props:",{type:e,missionId:s,hasMissionId:!!s,maxSize:i,acceptedFileTypes:d});let{data:o}=(0,A.useSession)(),[m,x]=(0,t.useState)(!1),[u,p]=(0,t.useState)(!1),[b,f]=(0,t.useState)(0),[v,y]=(0,t.useState)(null),[N,k]=(0,t.useState)(null),S=(0,t.useRef)(null),z=(0,t.useRef)(!0),P=s=>{if(s.size>i)return k(`File size exceeds the limit of ${i/1048576}MB`),!1;if("logo"===e&&!s.type.startsWith("image/"))return k("Only image files are allowed for logo"),!1;if("attachment"===e){let e=s.name.split(".").pop()?.toLowerCase(),a=["pdf","doc","docx","xls","xlsx","jpg","jpeg","png"];if(e&&!a.includes(e))return k(`File type .${e} is not allowed. Allowed types: ${a.join(", ")}`),!1}return k(null),!0},M=async()=>{if(!v){console.error("Upload failed: No file selected"),(0,w.oR)({title:"Upload failed",description:"No file selected. Please select a file first.",variant:"destructive"});return}if(!o?.user?.id){console.error("Upload failed: No user session"),(0,w.oR)({title:"Authentication required",description:"You need to be logged in to upload files. Please log in and try again.",variant:"destructive"});return}if(c){l&&l(v),(0,w.oR)({title:"File selected",description:"The file will be uploaded when you save the mission.",variant:"default"});return}if(!s){console.error("Upload failed: Missing mission ID"),(0,w.oR)({title:"Upload failed",description:"Missing mission ID. Please refresh the page and try again.",variant:"destructive"});return}console.log("Starting upload process...",{fileName:v.name,fileSize:v.size,fileType:v.type,missionId:s,userId:o.user.id,uploadType:e}),p(!0),f(0);try{let r=new FormData;r.append("file",v),r.append("missionId",s),r.append("type",e),console.log("FormData prepared, sending to API...");let t=await fetch("/api/missions/upload",{method:"POST",body:r});if(console.log("API response received:",{status:t.status,statusText:t.statusText,ok:t.ok}),!t.ok){let e=await t.json();throw console.error("API returned error:",e),Error(e.error||"Upload failed")}let l=await t.json();console.log("Upload successful, result:",l),z.current&&(f(100),setTimeout(()=>{z.current&&(y(null),p(!1),f(0),a&&a(l)),(0,w.oR)({title:"File uploaded successfully",description:"logo"===e?"Logo has been updated":`${v.name} has been added to attachments`,variant:"default"})},1e3))}catch(e){console.error("Upload error details:",e),z.current&&p(!1),(0,w.oR)({title:"Upload failed",description:e instanceof Error?e.message:"An error occurred during upload",variant:"destructive"})}};return(0,r.jsx)("div",{className:"w-full",children:v?(0,r.jsxs)("div",{className:"border rounded-md p-4 bg-white",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0 h-10 w-10 bg-gray-100 rounded-md flex items-center justify-center",children:"logo"===e?(0,r.jsx)("img",{src:URL.createObjectURL(v),alt:"Preview",className:"h-full w-full object-cover rounded-md"}):(0,r.jsx)("div",{className:"text-xs font-bold bg-blue-100 text-blue-600 h-full w-full rounded-md flex items-center justify-center",children:v.name.split(".").pop()?.toUpperCase()})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900 truncate",children:v.name}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:[(v.size/1024).toFixed(2)," KB"]})]})]}),(0,r.jsx)("div",{className:"flex items-center space-x-2",children:u?(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(C.A,{className:"animate-spin h-4 w-4 mr-1 text-blue-500"}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:[b,"%"]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.$,{variant:"ghost",size:"sm",className:"text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>{y(null),k(null)},children:(0,r.jsx)(h.A,{className:"h-4 w-4"})}),!c&&(0,r.jsxs)(n.$,{variant:"default",size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:M,children:[(0,r.jsx)(j.A,{className:"h-4 w-4 mr-1"}),"Upload"]})]})})]}),u&&(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5 mt-3",children:(0,r.jsx)("div",{className:"bg-blue-600 h-1.5 rounded-full",style:{width:`${b}%`}})})]}):(0,r.jsx)("div",{className:`border-2 border-dashed rounded-md p-6 text-center transition-colors ${m?"border-blue-500 bg-blue-50":"border-gray-300 bg-gray-50"}`,onDragOver:e=>{e.preventDefault(),e.stopPropagation(),x(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),x(!1)},onDrop:e=>{if(e.preventDefault(),e.stopPropagation(),x(!1),e.dataTransfer.files&&e.dataTransfer.files.length>0){let s=e.dataTransfer.files[0];P(s)&&(y(s),c&&l&&l(s))}},children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center",children:[(0,r.jsx)(g,{className:"h-10 w-10 text-gray-400 mb-2"}),(0,r.jsx)("p",{className:"text-sm mb-2 font-medium text-gray-700",children:"logo"===e?"Upload logo image":"Upload attachment"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:"Drag and drop or click to browse"}),(0,r.jsx)(n.$,{variant:"outline",size:"sm",className:"bg-white text-gray-700 border-gray-300 hover:bg-gray-50",onClick:()=>S.current?.click(),children:"Browse Files"}),(0,r.jsx)("input",{type:"file",ref:S,className:"hidden",onChange:e=>{if(e.target.files&&e.target.files.length>0){let s=e.target.files[0];P(s)&&(y(s),c&&l&&l(s))}},accept:d}),N&&(0,r.jsx)("p",{className:"text-xs text-red-500 mt-2",children:N})]})})})}let z=(0,p.A)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var P=a(10022);let M=(0,p.A)("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),R=(0,p.A)("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]),q=(0,p.A)("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]),E=(0,p.A)("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]),$=(0,p.A)("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),D=(0,p.A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);var F=a(88233),L=a(8126);function U({missionId:e,initialAttachments:s=[],allowUpload:a=!0,allowDelete:l=!0,onAttachmentAdded:i,onAttachmentDeleted:d}){let{data:c}=(0,A.useSession)(),[o,m]=(0,t.useState)(s),[x,h]=(0,t.useState)(!1),[p,g]=(0,t.useState)(null),[b,j]=(0,t.useState)(!1),f=async()=>{if(p)try{if(!(await fetch(`/api/missions/${e}/attachments/${p.id}`,{method:"DELETE"})).ok)throw Error("Failed to delete attachment");m(e=>e.filter(e=>e.id!==p.id)),d&&d(p.id),(0,w.oR)({title:"Success",description:"Attachment deleted successfully",variant:"default"})}catch(e){console.error("Error deleting attachment:",e),(0,w.oR)({title:"Error",description:"Failed to delete attachment",variant:"destructive"})}finally{g(null)}},v=e=>{if(e.startsWith("image/"))return(0,r.jsx)(z,{className:"h-5 w-5 text-blue-500"});if(e.includes("pdf"))return(0,r.jsx)(P.A,{className:"h-5 w-5 text-red-500"});if(e.includes("spreadsheet")||e.includes("excel")||e.includes("csv"))return(0,r.jsx)(M,{className:"h-5 w-5 text-green-500"});if(e.includes("zip")||e.includes("compressed"))return(0,r.jsx)(R,{className:"h-5 w-5 text-purple-500"});if(e.includes("video"))return(0,r.jsx)(q,{className:"h-5 w-5 text-pink-500"});else if(e.includes("audio"))return(0,r.jsx)(E,{className:"h-5 w-5 text-orange-500"});else return(0,r.jsx)(u.A,{className:"h-5 w-5 text-gray-500"})},y=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`;return(0,r.jsxs)("div",{className:"space-y-4",children:[a&&!b&&(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"bg-white text-gray-700 border-gray-300 hover:bg-gray-50",children:[(0,r.jsx)($,{className:"h-4 w-4 mr-1"}),"Add Attachment"]})}),b&&(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h4",{className:"text-sm font-medium mb-2 text-gray-700",children:"Upload New Attachment"}),(0,r.jsx)(S,{type:"attachment",missionId:e,onUploadComplete:e=>{e?.attachment&&(m(s=>[...s,e.attachment]),j(!1),i&&i(e.attachment))},isNewMission:!1}),(0,r.jsx)("div",{className:"mt-2 flex justify-end",children:(0,r.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>j(!1),className:"text-gray-500",children:"Cancel"})})]}),x?(0,r.jsx)("div",{className:"flex justify-center items-center p-8",children:(0,r.jsx)(C.A,{className:"h-8 w-8 animate-spin text-gray-400"})}):0===o.length?(0,r.jsxs)("div",{className:"text-center p-8 bg-gray-50 border border-gray-200 rounded-md",children:[(0,r.jsx)(u.A,{className:"h-10 w-10 text-gray-300 mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No attachments yet"}),a&&(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"mt-4 bg-white text-gray-700 border-gray-300 hover:bg-gray-50",children:[(0,r.jsx)($,{className:"h-4 w-4 mr-1"}),"Add your first attachment"]})]}):(0,r.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,r.jsx)("ul",{className:"divide-y",children:o.map(s=>(0,r.jsxs)("li",{className:"flex items-center justify-between p-3 hover:bg-gray-50",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:v(s.fileType)}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-medium text-sm text-gray-900",children:s.filename}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:[y(s.fileSize)," • ",new Date(s.createdAt).toLocaleDateString()]})]})]}),(0,r.jsxs)("div",{className:"flex space-x-1",children:[(0,r.jsx)(n.$,{variant:"ghost",size:"sm",asChild:!0,className:"text-gray-500 hover:text-gray-700 hover:bg-gray-100",children:(0,r.jsx)("a",{href:`/api/missions/${e}/attachments/download/${s.id}`,download:s.filename,children:(0,r.jsx)(D,{className:"h-4 w-4"})})}),l&&(0,r.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>g(s),className:"text-red-500 hover:text-red-700 hover:bg-red-50",children:(0,r.jsx)(F.A,{className:"h-4 w-4"})})]})]},s.id))})}),(0,r.jsx)(L.Lt,{open:!!p,onOpenChange:e=>!e&&g(null),children:(0,r.jsxs)(L.EO,{children:[(0,r.jsxs)(L.wd,{children:[(0,r.jsx)(L.r7,{children:"Delete Attachment"}),(0,r.jsxs)(L.$v,{children:['Are you sure you want to delete "',p?.filename,'"? This action cannot be undone.']})]}),(0,r.jsxs)(L.ck,{children:[(0,r.jsx)(L.Zr,{children:"Cancel"}),(0,r.jsx)(L.Rx,{onClick:f,className:"bg-red-600 hover:bg-red-700 text-white",children:"Delete"})]})]})})]})}var T=a(16189);function I(){let e=(0,T.useRouter)(),[s,a]=(0,t.useState)([]),[p,C]=(0,t.useState)([]),[A,z]=(0,t.useState)(""),[P,M]=(0,t.useState)("users"),[R,q]=(0,t.useState)(null),[E,$]=(0,t.useState)(null),[D,F]=(0,t.useState)(null),[L,I]=(0,t.useState)([]),[O,V]=(0,t.useState)(""),[G,B]=(0,t.useState)("general"),[_,H]=(0,t.useState)(!1),[X,Z]=(0,t.useState)(null),[J,W]=(0,t.useState)([]),[K,Y]=(0,t.useState)({}),[Q,ee]=(0,t.useState)([]),[es,ea]=(0,t.useState)([]),[er,et]=(0,t.useState)(!0),el=null!==R&&null!==E&&null!==D,ei=Q.filter(e=>(e.username?.toLowerCase()||"").includes(A.toLowerCase())||(e.email?.toLowerCase()||"").includes(A.toLowerCase())||(e.firstName?.toLowerCase()||"").includes(A.toLowerCase())||(e.lastName?.toLowerCase()||"").includes(A.toLowerCase())),en=es.filter(e=>(e.name?.toLowerCase()||"").includes(A.toLowerCase())),ed=e=>R===e||E===e||D===e||L.includes(e),ec=e=>{let s=[];return R===e&&s.push("temps"),E===e&&s.push("parole"),D===e&&s.push("memoire"),L.includes(e)&&s.push("volontaire"),s},eo=e=>{switch(e){case"temps":return"Gardien du Temps";case"parole":return"Gardien de la Parole";case"memoire":return"Gardien de la M\xe9moire";case"volontaire":return"Volontaire";default:return""}},em=(e,s)=>{L.includes(e)&&I(s=>s.filter(s=>s!==e)),"temps"===s?q(e):"parole"===s?$(e):"memoire"===s&&F(e),(0,w.oR)({title:"R\xf4le assign\xe9",description:`L'utilisateur a \xe9t\xe9 assign\xe9 comme ${eo(s)}`})},ex=e=>{eh(e),I(s=>[...s,e]),(0,w.oR)({title:"R\xf4le assign\xe9",description:"L'utilisateur a \xe9t\xe9 assign\xe9 comme Volontaire"})},eh=e=>{R===e&&q(null),E===e&&$(null),D===e&&F(null),L.includes(e)&&I(s=>s.filter(s=>s!==e))},eu=async e=>{try{let s=await fetch(`/api/groups/${e}/members`);if(!s.ok)throw Error("Failed to fetch group members");return await s.json()}catch(s){return console.error(`Error fetching members for group ${e}:`,s),(0,w.oR)({title:"Erreur",description:"Erreur lors de la r\xe9cup\xe9ration des membres du groupe",variant:"destructive"}),[]}},ep=async(e,s)=>{try{et(!0);let a=await eu(e);Array.isArray(a)&&a.length>0?(ee(a),M("users"),z(""),(0,w.oR)({title:`Membres de ${s}`,description:`${a.length} membres trouv\xe9s et affich\xe9s ci-dessous`})):(0,w.oR)({title:`Membres de ${s}`,description:"Aucun membre trouv\xe9 dans ce groupe"})}catch(e){console.error("Error handling group members:",e),(0,w.oR)({title:"Erreur",description:"Erreur lors de l'affichage des membres du groupe",variant:"destructive"})}finally{et(!1)}},eg=()=>{let e=["general","details","attachments","skills","membres"],s=e.indexOf(G);s<e.length-1&&B(e[s+1])},eb=()=>"membres"===G,ej=()=>{let e={name:!!K.name,oddScope:Array.isArray(K.oddScope)&&K.oddScope.length>0,niveau:!!K.niveau,intention:!!K.intention,missionType:!!K.missionType,donneurDOrdre:!!K.donneurDOrdre,projection:!!K.projection,participation:!!K.participation,gardiens:null!==R&&null!==E&&null!==D},s=Object.values(e).every(e=>!0===e);if(!s){let s=Object.entries(e).filter(([e,s])=>!1===s).map(([e,s])=>e);(0,w.oR)({title:"Champs obligatoires manquants",description:`Veuillez remplir tous les champs obligatoires: ${s.join(", ")}`,variant:"destructive"})}return s},ef=async()=>{if(ej()){H(!0);try{let a={...K,services:s,profils:p,guardians:{"gardien-temps":R,"gardien-parole":E,"gardien-memoire":D},volunteers:L},r=await fetch("/api/missions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){let e=await r.json();throw Error(e.error||"Failed to create mission")}let t=await r.json(),l=t.mission?.id;if(!l)throw Error("Failed to get new mission ID");if(X){console.log("Uploading logo for new mission:",l);let e=new FormData;e.append("file",X),e.append("missionId",l),e.append("type","logo");let s=await fetch("/api/missions/upload",{method:"POST",body:e});if(s.ok)console.log("Logo uploaded successfully");else{console.error("Failed to upload logo - Status:",s.status,s.statusText);try{let e=await s.json().catch(()=>null);if(e)console.error("Error details:",e);else{console.error("No JSON error details available - Response may be empty");let e=Object.fromEntries(s.headers.entries());console.error("Response headers:",e)}}catch(e){console.error("Error parsing response:",e)}}}if(J.length>0){console.log(`Uploading ${J.length} attachments for new mission:`,l);let e=J.map(async e=>{let s=new FormData;s.append("file",e),s.append("missionId",l),s.append("type","attachment");try{let a=await fetch("/api/missions/upload",{method:"POST",body:s});if(a.ok)return console.log(`Attachment ${e.name} uploaded successfully`),!0;console.error(`Failed to upload attachment ${e.name} - Status:`,a.status,a.statusText);try{let e=await a.json().catch(()=>null);if(e)console.error("Error details:",e);else{console.error("No JSON error details available - Response may be empty");let e=Object.fromEntries(a.headers.entries());console.error("Response headers:",e)}}catch(e){console.error("Error parsing response:",e)}return!1}catch(s){return console.error(`Error uploading attachment ${e.name}:`,s),!1}}),s=(await Promise.allSettled(e)).filter(e=>"fulfilled"===e.status&&!0===e.value).length;console.log(`Uploaded ${s} of ${J.length} attachments`)}(0,w.oR)({title:"Mission cr\xe9\xe9e avec succ\xe8s",description:"Tous les gardiens ont \xe9t\xe9 assign\xe9s et la mission a \xe9t\xe9 enregistr\xe9e."}),e.push("/missions")}catch(e){console.error("Error creating mission:",e),(0,w.oR)({title:"Erreur",description:e instanceof Error?e.message:"Une erreur est survenue lors de la cr\xe9ation de la mission",variant:"destructive"})}finally{H(!1)}}},ev=(e,s)=>{Y(a=>({...a,[e]:s}))};return(0,r.jsx)("div",{className:"w-full",children:(0,r.jsx)(m.Zp,{className:"border shadow-sm bg-white",children:(0,r.jsxs)(m.Wu,{className:"pt-6",children:[(0,r.jsxs)(l.tU,{value:G,onValueChange:B,className:"w-full",children:[(0,r.jsxs)(l.j7,{className:"mb-4 bg-gray-100",children:[(0,r.jsx)(l.Xi,{value:"general",className:"data-[state=active]:bg-blue-600 data-[state=active]:text-white",children:"General"}),(0,r.jsx)(l.Xi,{value:"details",className:"data-[state=active]:bg-blue-600 data-[state=active]:text-white",children:"Details"}),(0,r.jsx)(l.Xi,{value:"attachments",className:"data-[state=active]:bg-blue-600 data-[state=active]:text-white",children:"Attachments"}),(0,r.jsx)(l.Xi,{value:"skills",className:"data-[state=active]:bg-blue-600 data-[state=active]:text-white",children:"Skills"}),(0,r.jsx)(l.Xi,{value:"membres",className:"data-[state=active]:bg-blue-600 data-[state=active]:text-white",children:"Membres"})]}),(0,r.jsx)(l.av,{value:"general",className:"space-y-6",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Nom de la Mission",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(i.p,{placeholder:"Nom de la mission",className:"bg-white border-gray-300",value:K.name||"",onChange:e=>ev("name",e.target.value)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:"Logo"}),(0,r.jsx)(S,{type:"logo",missionId:O||"",isNewMission:!O,onFileSelect:e=>{Z(e),console.log("Logo file selected for later upload:",e.name)},onUploadComplete:e=>{e?.filePath&&Y(s=>({...s,logo:e.filePath}))}})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["ODD scope",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(c.l6,{onValueChange:e=>ev("oddScope",[e]),children:[(0,r.jsx)(c.bq,{className:"bg-white border-gray-300",children:(0,r.jsx)(c.yv,{placeholder:"Choisir le scope"})}),(0,r.jsxs)(c.gC,{children:[(0,r.jsx)(c.eb,{value:"odd-1",children:"1. Pas de pauvret\xe9"}),(0,r.jsx)(c.eb,{value:"odd-2",children:'2. Faim "z\xe9ro"'}),(0,r.jsx)(c.eb,{value:"odd-3",children:"3. Bonne sant\xe9 et bien-\xeatre"}),(0,r.jsx)(c.eb,{value:"odd-4",children:"4. \xc9ducation de qualit\xe9"}),(0,r.jsx)(c.eb,{value:"odd-5",children:"5. \xc9galit\xe9 entre les sexes"}),(0,r.jsx)(c.eb,{value:"odd-6",children:"6. Eau propre et assainissement"}),(0,r.jsx)(c.eb,{value:"odd-7",children:"7. \xc9nergie propre et d'un co\xfbt abordable"}),(0,r.jsx)(c.eb,{value:"odd-8",children:"8. Travail d\xe9cent et croissance \xe9conomique"}),(0,r.jsx)(c.eb,{value:"odd-9",children:"9. Industrie, innovation et infrastructure"}),(0,r.jsx)(c.eb,{value:"odd-10",children:"10. In\xe9galit\xe9s r\xe9duites"}),(0,r.jsx)(c.eb,{value:"odd-11",children:"11. Villes et communaut\xe9s durables"}),(0,r.jsx)(c.eb,{value:"odd-12",children:"12. Consommation et production responsables"}),(0,r.jsx)(c.eb,{value:"odd-13",children:"13. Mesures relatives \xe0 la lutte contre les changements climatiques"}),(0,r.jsx)(c.eb,{value:"odd-14",children:"14. Vie aquatique"}),(0,r.jsx)(c.eb,{value:"odd-15",children:"15. Vie terrestre"}),(0,r.jsx)(c.eb,{value:"odd-16",children:"16. Paix, justice et institutions efficaces"}),(0,r.jsx)(c.eb,{value:"odd-17",children:"17. Partenariats pour la r\xe9alisation des objectifs"})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Niveau",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(c.l6,{onValueChange:e=>ev("niveau",e),children:[(0,r.jsx)(c.bq,{className:"bg-white border-gray-300",children:(0,r.jsx)(c.yv,{placeholder:"Choisir un niveau"})}),(0,r.jsxs)(c.gC,{children:[(0,r.jsx)(c.eb,{value:"a",children:"A- Apprentissage"}),(0,r.jsx)(c.eb,{value:"b",children:"B- Basique"}),(0,r.jsx)(c.eb,{value:"c",children:"C- Complexe"}),(0,r.jsx)(c.eb,{value:"s",children:"S- Sp\xe9cial"})]})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Intention",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)("div",{className:"border rounded-md border-gray-300",children:[(0,r.jsxs)("div",{className:"bg-gray-50 p-2 border-b flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-gray-700",children:"Paragraphe"}),(0,r.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,r.jsx)(n.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-gray-700",children:"B"}),(0,r.jsx)(n.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-gray-700",children:"I"}),(0,r.jsx)(n.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-gray-700",children:"•"}),(0,r.jsx)(n.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-gray-700",children:"1."}),(0,r.jsx)(n.$,{variant:"ghost",size:"icon",className:"h-8 w-8 text-gray-700",children:'"'})]})]}),(0,r.jsx)(d.T,{className:"min-h-[200px] border-0 bg-white",value:K.intention||"",onChange:e=>ev("intention",e.target.value)})]})]})]})}),(0,r.jsx)(l.av,{value:"details",className:"space-y-6",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Type de mission",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(c.l6,{onValueChange:e=>ev("missionType",e),children:[(0,r.jsx)(c.bq,{className:"bg-white border-gray-300",children:(0,r.jsx)(c.yv,{placeholder:"Type de location"})}),(0,r.jsxs)(c.gC,{children:[(0,r.jsx)(c.eb,{value:"remote",children:"Remote"}),(0,r.jsx)(c.eb,{value:"onsite",children:"Sur Site"}),(0,r.jsx)(c.eb,{value:"hybrid",children:"Hybride"})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Donneur d'ordre",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(c.l6,{onValueChange:e=>ev("donneurDOrdre",e),children:[(0,r.jsx)(c.bq,{className:"bg-white border-gray-300",children:(0,r.jsx)(c.yv,{placeholder:"S\xe9lectionner"})}),(0,r.jsxs)(c.gC,{children:[(0,r.jsx)(c.eb,{value:"individual",children:"Individu"}),(0,r.jsx)(c.eb,{value:"group",children:"ONG"}),(0,r.jsx)(c.eb,{value:"organization",children:"Start-ups"})]})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Projection",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(c.l6,{onValueChange:e=>ev("projection",e),children:[(0,r.jsx)(c.bq,{className:"bg-white border-gray-300",children:(0,r.jsx)(c.yv,{placeholder:"Select duration"})}),(0,r.jsxs)(c.gC,{children:[(0,r.jsx)(c.eb,{value:"short",children:"Short Term (< 1 month)"}),(0,r.jsx)(c.eb,{value:"medium",children:"Medium Term (1-3 months)"}),(0,r.jsx)(c.eb,{value:"long",children:"Long Term (> 3 months)"})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:"Services"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mb-2",children:s.map(e=>(0,r.jsxs)(x.E,{className:"bg-blue-100 text-blue-800 hover:bg-blue-200 px-2 py-1",children:[e,(0,r.jsx)("button",{type:"button",onClick:()=>a(s.filter(s=>s!==e)),className:"ml-1 text-blue-600 hover:text-blue-800",children:(0,r.jsx)(h.A,{size:14})})]},e))}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"gite",checked:s.includes("Gite"),onCheckedChange:e=>{e?a([...s,"Gite"]):a(s.filter(e=>"Gite"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"gite",className:"text-sm text-gray-700",children:"Gite"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"artlab",checked:s.includes("ArtLab"),onCheckedChange:e=>{e?a([...s,"ArtLab"]):a(s.filter(e=>"ArtLab"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"artlab",className:"text-sm text-gray-700",children:"ArtLab"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"calcul",checked:s.includes("Calcul"),onCheckedChange:e=>{e?a([...s,"Calcul"]):a(s.filter(e=>"Calcul"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"calcul",className:"text-sm text-gray-700",children:"Calcul"})]})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:["Participation",(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(c.l6,{onValueChange:e=>ev("participation",e),children:[(0,r.jsx)(c.bq,{className:"bg-white border-gray-300",children:(0,r.jsx)(c.yv,{placeholder:"Select participation"})}),(0,r.jsxs)(c.gC,{children:[(0,r.jsx)(c.eb,{value:"volontaire",children:"Volontaire"}),(0,r.jsx)(c.eb,{value:"cooptation",children:"Cooptation"})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:"Location"}),(0,r.jsx)(i.p,{placeholder:"Enter location",className:"bg-white border-gray-300"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:"Language"}),(0,r.jsx)(i.p,{placeholder:"Enter language",className:"bg-white border-gray-300"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:"Profils"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mb-2",children:p.map(e=>(0,r.jsxs)(x.E,{className:"bg-blue-100 text-blue-800 hover:bg-blue-200 px-2 py-1",children:[e,(0,r.jsx)("button",{type:"button",onClick:()=>C(p.filter(s=>s!==e)),className:"ml-1 text-blue-600 hover:text-blue-800",children:(0,r.jsx)(h.A,{size:14})})]},e))}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"dataintelligence",checked:p.includes("DataIntelligence"),onCheckedChange:e=>{e?C([...p,"DataIntelligence"]):C(p.filter(e=>"DataIntelligence"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"dataintelligence",className:"text-sm text-gray-700",children:"DataIntelligence"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"expression",checked:p.includes("Expression"),onCheckedChange:e=>{e?C([...p,"Expression"]):C(p.filter(e=>"Expression"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"expression",className:"text-sm text-gray-700",children:"Expression"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"mediation",checked:p.includes("Mediation"),onCheckedChange:e=>{e?C([...p,"Mediation"]):C(p.filter(e=>"Mediation"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"mediation",className:"text-sm text-gray-700",children:"Mediation"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"investigation",checked:p.includes("Investigation"),onCheckedChange:e=>{e?C([...p,"Investigation"]):C(p.filter(e=>"Investigation"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"investigation",className:"text-sm text-gray-700",children:"Investigation"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"coding",checked:p.includes("Coding"),onCheckedChange:e=>{e?C([...p,"Coding"]):C(p.filter(e=>"Coding"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"coding",className:"text-sm text-gray-700",children:"Coding"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"lean",checked:p.includes("Lean"),onCheckedChange:e=>{e?C([...p,"Lean"]):C(p.filter(e=>"Lean"!==e))},className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"lean",className:"text-sm text-gray-700",children:"Lean"})]})]})]})]})]})}),(0,r.jsx)(l.av,{value:"attachments",className:"space-y-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700",children:"Attachements"}),O?(0,r.jsx)(U,{missionId:O||"",allowUpload:!0,allowDelete:!0}):(0,r.jsx)("div",{className:"space-y-4",children:(0,r.jsxs)("div",{className:"border rounded-md p-4 bg-white",children:[(0,r.jsx)("h4",{className:"text-sm font-medium mb-3 text-gray-700",children:"Add Attachments"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:"Attachments will be uploaded when you save the mission."}),J.length>0&&(0,r.jsxs)("div",{className:"mb-4 border rounded-md p-3 bg-gray-50",children:[(0,r.jsxs)("h5",{className:"text-sm font-medium mb-2 text-gray-700",children:["Selected Files (",J.length,")"]}),(0,r.jsx)("ul",{className:"divide-y divide-gray-200",children:J.map((e,s)=>(0,r.jsxs)("li",{className:"py-2 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(u.A,{className:"h-4 w-4 text-gray-500 mr-2"}),(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,r.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>{W(e=>e.filter((e,a)=>a!==s))},className:"text-red-500 hover:text-red-700 hover:bg-red-50 h-7 w-7 p-0",children:(0,r.jsx)(h.A,{className:"h-4 w-4"})})]},s))})]}),(0,r.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,r.jsxs)("label",{className:"flex flex-col items-center justify-center w-full h-32 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center pt-5 pb-6",children:[(0,r.jsx)(g,{className:"w-8 h-8 mb-3 text-gray-400"}),(0,r.jsxs)("p",{className:"mb-2 text-sm text-gray-500",children:[(0,r.jsx)("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"PDF, DOC, DOCX, XLS, XLSX, JPG, JPEG, PNG"})]}),(0,r.jsx)("input",{type:"file",className:"hidden",onChange:e=>{if(e.target.files&&e.target.files.length>0){let s=e.target.files[0];W(e=>[...e,s])}}})]})})]})})]})}),(0,r.jsx)(l.av,{value:"skills",className:"space-y-6",children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,r.jsx)("h3",{className:"text-lg font-medium text-gray-700",children:"Skills"}),(0,r.jsx)(n.$,{variant:"outline",size:"sm",className:"bg-white text-gray-700 border-gray-300 hover:bg-gray-50",children:"Select / Deselect All"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"photoshop",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"photoshop",className:"text-sm text-gray-700",children:"Adobe Photoshop"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"xd",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"xd",className:"text-sm text-gray-700",children:"Adobe XD"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"android",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"android",className:"text-sm text-gray-700",children:"Android Developer"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"artist",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"artist",className:"text-sm text-gray-700",children:"Artist"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"computer",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"computer",className:"text-sm text-gray-700",children:"Computer"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"developer",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"developer",className:"text-sm text-gray-700",children:"Developer"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"frontend",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"frontend",className:"text-sm text-gray-700",children:"Front end Developer"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"ios",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"ios",className:"text-sm text-gray-700",children:"iOS Developer"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"support",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"support",className:"text-sm text-gray-700",children:"Support Agent"})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.S,{id:"writer",className:"border-gray-300"}),(0,r.jsx)("label",{htmlFor:"writer",className:"text-sm text-gray-700",children:"Writer"})]})]})]})}),(0,r.jsx)(l.av,{value:"membres",className:"space-y-6",children:(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,r.jsx)("h3",{className:"text-lg font-medium text-gray-700",children:"Les Gardiens de l'Intention"}),(0,r.jsxs)("div",{className:"flex items-center",children:[!el&&(0,r.jsxs)("div",{className:"flex items-center text-amber-600 mr-3 text-sm",children:[(0,r.jsx)(b.A,{size:16,className:"mr-1"}),"Les 3 gardiens doivent \xeatre assign\xe9s"]}),el&&(0,r.jsxs)("div",{className:"flex items-center text-green-600 mr-3 text-sm",children:[(0,r.jsx)(j.A,{size:16,className:"mr-1"}),"Tous les gardiens sont assign\xe9s"]})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"border rounded-md p-4 bg-white",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,r.jsx)("h4",{className:"font-medium text-gray-800",children:"Gardien du Temps"}),R&&(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>eh(R),className:"text-red-600 hover:bg-red-50 hover:text-red-700 border-red-200 h-8 bg-white",disabled:er,children:[(0,r.jsx)(h.A,{size:16,className:"mr-1"}),"Supprimer"]})]}),er?(0,r.jsx)("div",{className:"flex items-center py-2 px-3 bg-gray-50 border border-gray-200 rounded-md",children:(0,r.jsxs)("div",{className:"animate-pulse w-full flex items-center",children:[(0,r.jsx)("div",{className:"h-10 w-10 bg-gray-300 rounded-full mr-3"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/3"}),(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/2"})]})]})}):R?(0,r.jsx)("div",{className:"bg-blue-50 border border-blue-100 rounded-md p-3",children:(()=>{let e=Q.find(e=>e.id===R);return e?(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 font-medium mr-3",children:[e.firstName?.[0]||"",e.lastName?.[0]||""]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"font-medium text-gray-900",children:[e.firstName," ",e.lastName]}),(0,r.jsx)("div",{className:"text-sm text-gray-500",children:e.email})]})]}):"Utilisateur non trouv\xe9"})()}):(0,r.jsxs)("div",{className:"flex items-center text-gray-500 bg-gray-50 border border-gray-200 rounded-md py-2 px-3",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-full bg-gray-200 flex items-center justify-center mr-3",children:(0,r.jsx)(f.A,{size:14,className:"text-gray-400"})}),(0,r.jsx)("span",{className:"text-sm",children:"Aucun utilisateur s\xe9lectionn\xe9"})]})]}),(0,r.jsxs)("div",{className:"border rounded-md p-4 bg-white",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,r.jsx)("h4",{className:"font-medium text-gray-800",children:"Gardien de la Parole"}),E&&(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>eh(E),className:"text-red-600 hover:bg-red-50 hover:text-red-700 border-red-200 h-8 bg-white",disabled:er,children:[(0,r.jsx)(h.A,{size:16,className:"mr-1"}),"Supprimer"]})]}),er?(0,r.jsx)("div",{className:"flex items-center py-2 px-3 bg-gray-50 border border-gray-200 rounded-md",children:(0,r.jsxs)("div",{className:"animate-pulse w-full flex items-center",children:[(0,r.jsx)("div",{className:"h-10 w-10 bg-gray-300 rounded-full mr-3"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/3"}),(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/2"})]})]})}):E?(0,r.jsx)("div",{className:"bg-blue-50 border border-blue-100 rounded-md p-3",children:(()=>{let e=Q.find(e=>e.id===E);return e?(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 font-medium mr-3",children:[e.firstName?.[0]||"",e.lastName?.[0]||""]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"font-medium text-gray-900",children:[e.firstName," ",e.lastName]}),(0,r.jsx)("div",{className:"text-sm text-gray-500",children:e.email})]})]}):"Utilisateur non trouv\xe9"})()}):(0,r.jsxs)("div",{className:"flex items-center text-gray-500 bg-gray-50 border border-gray-200 rounded-md py-2 px-3",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-full bg-gray-200 flex items-center justify-center mr-3",children:(0,r.jsx)(f.A,{size:14,className:"text-gray-400"})}),(0,r.jsx)("span",{className:"text-sm",children:"Aucun utilisateur s\xe9lectionn\xe9"})]})]}),(0,r.jsxs)("div",{className:"border rounded-md p-4 bg-white",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,r.jsx)("h4",{className:"font-medium text-gray-800",children:"Gardien de la M\xe9moire"}),D&&(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>eh(D),className:"text-red-600 hover:bg-red-50 hover:text-red-700 border-red-200 h-8 bg-white",disabled:er,children:[(0,r.jsx)(h.A,{size:16,className:"mr-1"}),"Supprimer"]})]}),er?(0,r.jsx)("div",{className:"flex items-center py-2 px-3 bg-gray-50 border border-gray-200 rounded-md",children:(0,r.jsxs)("div",{className:"animate-pulse w-full flex items-center",children:[(0,r.jsx)("div",{className:"h-10 w-10 bg-gray-300 rounded-full mr-3"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/3"}),(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/2"})]})]})}):D?(0,r.jsx)("div",{className:"bg-blue-50 border border-blue-100 rounded-md p-3",children:(()=>{let e=Q.find(e=>e.id===D);return e?(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 font-medium mr-3",children:[e.firstName?.[0]||"",e.lastName?.[0]||""]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"font-medium text-gray-900",children:[e.firstName," ",e.lastName]}),(0,r.jsx)("div",{className:"text-sm text-gray-500",children:e.email})]})]}):"Utilisateur non trouv\xe9"})()}):(0,r.jsxs)("div",{className:"flex items-center text-gray-500 bg-gray-50 border border-gray-200 rounded-md py-2 px-3",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-full bg-gray-200 flex items-center justify-center mr-3",children:(0,r.jsx)(f.A,{size:14,className:"text-gray-400"})}),(0,r.jsx)("span",{className:"text-sm",children:"Aucun utilisateur s\xe9lectionn\xe9"})]})]})]})]}),(0,r.jsx)("div",{className:"bg-white border rounded-md p-4",children:(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h4",{className:"font-medium text-gray-800",children:"S\xe9lectionner des membres"}),(0,r.jsxs)("div",{className:"flex space-x-2",children:[(0,r.jsxs)(n.$,{variant:"users"===P?"default":"outline",size:"sm",onClick:()=>M("users"),className:"users"===P?"bg-blue-600 text-white hover:bg-blue-700":"text-gray-700 bg-white hover:bg-gray-50 border border-gray-300",disabled:er,children:[(0,r.jsx)(f.A,{size:16,className:"mr-1"}),"Utilisateurs"]}),(0,r.jsxs)(n.$,{variant:"groups"===P?"default":"outline",size:"sm",onClick:()=>M("groups"),className:"groups"===P?"bg-blue-600 text-white hover:bg-blue-700":"text-gray-700 bg-white hover:bg-gray-50 border border-gray-300",disabled:er,children:[(0,r.jsx)(f.A,{size:16,className:"mr-1"}),"Groupes"]})]})]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsxs)("h5",{className:"text-sm font-medium text-gray-700 mb-2",children:["Volontaires (",L.length,")"]}),L.length>0?(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mb-3",children:L.map(e=>{let s=Q.find(s=>s.id===e);return s?(0,r.jsxs)(x.E,{className:"bg-gray-100 text-gray-800 hover:bg-gray-200 px-2 py-1 flex items-center",children:[s.firstName," ",s.lastName,(0,r.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>eh(e),className:"ml-1 h-5 w-5 p-0 text-gray-500 hover:text-red-600 hover:bg-transparent",children:(0,r.jsx)(h.A,{size:12})})]},e):null})}):(0,r.jsx)("div",{className:"text-sm text-gray-500 mb-3",children:"Aucun volontaire assign\xe9"})]}),(0,r.jsxs)("div",{className:"relative mb-4",children:[(0,r.jsx)(v.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500"}),(0,r.jsx)(i.p,{type:"text",placeholder:`Rechercher ${"users"===P?"un utilisateur":"un groupe"}...`,value:A,onChange:e=>z(e.target.value),className:"pl-9 bg-white text-gray-900 border-gray-300",disabled:er})]}),er?(0,r.jsx)("div",{className:"border rounded-md p-6 flex flex-col items-center justify-center text-gray-500",children:(0,r.jsx)("div",{className:"animate-pulse space-y-4 w-full",children:[1,2,3].map(e=>(0,r.jsxs)("div",{className:"flex items-center py-3 px-4",children:[(0,r.jsx)("div",{className:"h-10 w-10 bg-gray-300 rounded-full mr-3"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/3"}),(0,r.jsx)("div",{className:"h-3 bg-gray-300 rounded w-1/2"})]}),(0,r.jsx)("div",{className:"h-7 w-16 bg-gray-300 rounded"})]},e))})}):(0,r.jsx)("div",{className:"border rounded-md max-h-[300px] overflow-y-auto",children:"users"===P?ei.length>0?(0,r.jsx)("div",{className:"divide-y divide-gray-200",children:ei.map(e=>(0,r.jsxs)("div",{className:"p-3 hover:bg-gray-50 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)("div",{className:"h-10 w-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-600 font-medium mr-3",children:[e.firstName?.[0]||"",e.lastName?.[0]||""]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"font-medium text-gray-900",children:[e.firstName," ",e.lastName]}),(0,r.jsx)("div",{className:"text-sm text-gray-500",children:e.email}),ed(e.id)&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:ec(e.id).map(e=>(0,r.jsx)(x.E,{className:`px-1.5 py-0.5 text-xs ${"volontaire"===e?"bg-gray-100 text-gray-800":"bg-blue-100 text-blue-800"}`,children:eo(e)},e))})]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsxs)(k.rI,{children:[(0,r.jsx)(k.ty,{asChild:!0,children:(0,r.jsxs)(n.$,{variant:"outline",size:"sm",className:"text-blue-600 bg-white hover:bg-blue-50 hover:text-blue-700 border-blue-200 h-8 mr-2",disabled:er,children:[(0,r.jsx)(y.A,{size:16,className:"mr-1"}),"Ajouter r\xf4le"]})}),(0,r.jsxs)(k.SQ,{align:"end",className:"bg-white border border-gray-200",children:[(0,r.jsx)(k._2,{onClick:()=>em(e.id,"temps"),className:"cursor-pointer",children:"Gardien du Temps"}),(0,r.jsx)(k._2,{onClick:()=>em(e.id,"parole"),className:"cursor-pointer",children:"Gardien de la Parole"}),(0,r.jsx)(k._2,{onClick:()=>em(e.id,"memoire"),className:"cursor-pointer",children:"Gardien de la M\xe9moire"})]})]}),(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>ex(e.id),className:"text-gray-700 bg-white hover:bg-gray-50 border-gray-300 h-8",disabled:er,children:[(0,r.jsx)(N,{size:16,className:"mr-1"}),"Volontaire"]}),ed(e.id)&&(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>eh(e.id),className:"ml-2 text-red-600 hover:bg-red-50 hover:text-red-700 border-red-200 h-8 bg-white",disabled:er,children:[(0,r.jsx)(h.A,{size:14,className:"mr-1"}),"Supprimer"]})]})]},e.id))}):(0,r.jsx)("div",{className:"p-4 text-center text-gray-500",children:"Aucun utilisateur trouv\xe9"}):en.length>0?(0,r.jsx)("div",{className:"divide-y divide-gray-200",children:en.map(e=>(0,r.jsxs)("div",{className:"p-3 hover:bg-gray-50 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"h-10 w-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-600 font-medium mr-3",children:(0,r.jsx)(f.A,{size:16})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-medium text-gray-900",children:e.name}),(0,r.jsxs)("div",{className:"text-sm text-gray-500",children:[e.membersCount," membres"]})]})]}),(0,r.jsxs)(n.$,{variant:"outline",size:"sm",onClick:()=>ep(e.id,e.name),className:"text-blue-600 bg-white hover:bg-blue-50 hover:text-blue-700 border-blue-200 h-8",disabled:er,children:[(0,r.jsx)(f.A,{size:16,className:"mr-1"}),"Voir membres"]})]},e.id))}):(0,r.jsx)("div",{className:"p-4 text-center text-gray-500",children:"Aucun groupe trouv\xe9"})})]})})]})})]}),(0,r.jsxs)("div",{className:"mt-8 flex justify-between",children:["general"!==G&&(0,r.jsxs)(n.$,{variant:"outline",className:"text-gray-700 bg-white hover:bg-gray-50 border border-gray-300",onClick:()=>{let e=["general","details","attachments","skills","membres"],s=e.indexOf(G);s>0&&B(e[s-1])},disabled:_,children:[(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2",children:[(0,r.jsx)("polyline",{points:"19 12 5 12"}),(0,r.jsx)("polyline",{points:"12 19 5 12 12 5"})]}),"Retour"]}),"general"===G&&(0,r.jsx)("div",{}),(0,r.jsx)(n.$,{className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{eb()?ef():eg()},disabled:_,children:_?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),eb()?"Enregistrement...":"Chargement..."]}):(0,r.jsxs)(r.Fragment,{children:[eb()?"Enregistrer":"Suivant",(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-2",children:[(0,r.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.jsx)("polyline",{points:"12 5 19 12 12 19"})]})]})})]})]})})})}var O=a(8730),V=a(14952),G=(a(93661),a(96241));let B=t.forwardRef(({...e},s)=>(0,r.jsx)("nav",{ref:s,"aria-label":"breadcrumb",...e}));B.displayName="Breadcrumb";let _=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("ol",{ref:a,className:(0,G.cn)("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...s}));_.displayName="BreadcrumbList";let H=t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("li",{ref:a,className:(0,G.cn)("inline-flex items-center gap-1.5",e),...s}));H.displayName="BreadcrumbItem";let X=t.forwardRef(({asChild:e,className:s,...a},t)=>{let l=e?O.DX:"a";return(0,r.jsx)(l,{ref:t,className:(0,G.cn)("transition-colors hover:text-foreground",s),...a})});X.displayName="BreadcrumbLink",t.forwardRef(({className:e,...s},a)=>(0,r.jsx)("span",{ref:a,role:"link","aria-disabled":"true","aria-current":"page",className:(0,G.cn)("font-normal text-foreground",e),...s})).displayName="BreadcrumbPage";let Z=({children:e,className:s,...a})=>(0,r.jsx)("li",{role:"presentation","aria-hidden":"true",className:(0,G.cn)("[&>svg]:w-3.5 [&>svg]:h-3.5",s),...a,children:e??(0,r.jsx)(V.A,{})});Z.displayName="BreadcrumbSeparator";var J=a(85814),W=a.n(J);function K(){return(0,r.jsxs)("div",{className:"flex flex-col h-full w-full bg-white",children:[(0,r.jsx)("div",{className:"bg-white border-b border-gray-100 py-2 px-4",children:(0,r.jsx)(B,{children:(0,r.jsxs)(_,{children:[(0,r.jsx)(H,{children:(0,r.jsx)(X,{asChild:!0,children:(0,r.jsx)(W(),{href:"/missions",children:"Missions"})})}),(0,r.jsx)(Z,{}),(0,r.jsx)(H,{children:(0,r.jsx)(X,{children:"Poster une Mission"})})]})})}),(0,r.jsx)("div",{className:"flex-1 overflow-auto p-4 bg-white",children:(0,r.jsx)(I,{})})]})}}};var s=require("../../../webpack-runtime.js");s.C(e);var a=e=>s(s.s=e),r=s.X(0,[4243,5419,8794,1642,6724,748,4543,6644,6781,5500,8734],()=>a(82905));module.exports=r})();