1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4504],{16677:(e,s,r)=>{"use strict";r.r(s),r.d(s,{default:()=>p});var t=r(95155),i=r(12115),a=r(97168),l=r(69074),d=r(4516),n=r(17580),c=r(14186),o=r(70333),m=r(47835),x=r(99890),h=r(62525),u=r(14503),g=r(35695);function p(){let[e,s]=(0,i.useState)(null),[r,p]=(0,i.useState)(!0),[b,f]=(0,i.useState)(!1),{toast:j}=(0,u.dj)(),y=(0,g.useParams)(),N=(0,g.useRouter)(),v=y.missionId;(0,i.useEffect)(()=>{let e=async()=>{try{p(!0);let e=await fetch("/api/missions/".concat(v));if(!e.ok)throw Error("Failed to fetch mission details");let r=await e.json();console.log("Mission details:",r),s(r)}catch(e){console.error("Error fetching mission details:",e),j({title:"Erreur",description:"Impossible de charger les d\xe9tails de la mission",variant:"destructive"})}finally{p(!1)}};v&&e()},[v,j]);let w=async()=>{if(confirm("\xcates-vous s\xfbr de vouloir supprimer cette mission ? Cette action est irr\xe9versible."))try{if(f(!0),!(await fetch("/api/missions/".concat(v),{method:"DELETE"})).ok)throw Error("Failed to delete mission");j({title:"Mission supprim\xe9e",description:"La mission a \xe9t\xe9 supprim\xe9e avec succ\xe8s"}),N.push("/missions")}catch(e){console.error("Error deleting mission:",e),j({title:"Erreur",description:"Impossible de supprimer la mission",variant:"destructive"})}finally{f(!1)}};if(r)return(0,t.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50",children:(0,t.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-600"})});if(!e)return(0,t.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50 px-4",children:(0,t.jsxs)("div",{className:"text-center bg-white p-8 rounded-lg shadow-sm border border-gray-200 max-w-md",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-2",children:"Mission non trouv\xe9e"}),(0,t.jsx)("p",{className:"text-gray-600 mb-6",children:"Cette mission n'existe pas ou a \xe9t\xe9 supprim\xe9e."}),(0,t.jsx)(a.$,{onClick:()=>window.history.back(),className:"bg-blue-600 hover:bg-blue-700 text-white",children:"Retour aux missions"})]})});let k=(e=>{let s=e&&e.length>0?e[0]:null,r=s?s.replace("odd-",""):null;return{number:r,label:r?"ODD ".concat(r):"Non cat\xe9goris\xe9",iconPath:r?"/F SDG Icons 2019 WEB/F-WEB-Goal-".concat(r.padStart(2,"0"),".png"):""}})(e.oddScope);return(0,t.jsxs)("div",{className:"bg-gray-50 min-h-screen p-6",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 mb-6 p-6",children:(0,t.jsxs)("div",{className:"flex justify-between items-start",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:e.name}),(0,t.jsx)("div",{className:"flex items-center text-gray-500 text-sm gap-4",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(l.A,{className:"h-4 w-4 mr-1"}),new Date(e.createdAt).toLocaleDateString("fr-FR",{day:"2-digit",month:"long",year:"numeric"})]})})]}),(0,t.jsx)("div",{className:"w-24 h-24 rounded-md overflow-hidden flex-shrink-0",children:e.logoUrl?(0,t.jsx)("img",{src:e.logoUrl,alt:e.name,className:"w-full h-full object-cover rounded-md",onError:s=>{console.error("Logo failed to load:",{missionId:e.id,missionName:e.name,logoUrl:e.logoUrl,logoPath:e.logo}),s.currentTarget.style.display="none";let r=s.currentTarget.parentElement;r&&(r.classList.add("bg-gray-100"),r.classList.add("flex"),r.classList.add("items-center"),r.classList.add("justify-center"),r.innerHTML='<span class="text-2xl font-medium text-gray-400">'.concat(e.name.slice(0,2).toUpperCase(),"</span>"))}}):(0,t.jsx)("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-2xl font-medium text-gray-400",children:e.name.slice(0,2).toUpperCase()})})})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg p-4 flex items-center shadow-sm border border-gray-100",children:[(0,t.jsx)("div",{className:"bg-amber-50 p-3 rounded-full mr-3",children:(0,t.jsx)(d.A,{className:"h-5 w-5 text-amber-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:"Type de mission"}),(0,t.jsx)("p",{className:"text-gray-800 font-medium",children:(e=>{switch(e){case"remote":return"\xc0 distance";case"onsite":return"Sur site";case"hybrid":return"Hybride";default:return e}})(e.missionType)})]})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg p-4 flex items-center shadow-sm border border-gray-100",children:[(0,t.jsx)("div",{className:"bg-blue-50 p-3 rounded-full mr-3",children:(0,t.jsx)(n.A,{className:"h-5 w-5 text-blue-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:"Donneur d'ordre"}),(0,t.jsx)("p",{className:"text-gray-800 font-medium",children:e.donneurDOrdre||"Non sp\xe9cifi\xe9"})]})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg p-4 flex items-center shadow-sm border border-gray-100",children:[(0,t.jsx)("div",{className:"bg-green-50 p-3 rounded-full mr-3",children:(0,t.jsx)(c.A,{className:"h-5 w-5 text-green-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:"Dur\xe9e"}),(0,t.jsx)("p",{className:"text-gray-800 font-medium",children:(e=>{switch(e){case"short":return"< 1 mois";case"medium":return"1-3 mois";case"long":return"> 3 mois";default:return e}})(e.projection)})]})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg p-4 flex items-center shadow-sm border border-gray-100",children:[(0,t.jsx)("div",{className:"bg-purple-50 p-3 rounded-full mr-3",children:(0,t.jsx)(o.A,{className:"h-5 w-5 text-purple-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:"Niveau"}),(0,t.jsx)("p",{className:"text-gray-800 font-medium",children:(e=>{switch(e){case"a":return"Apprentissage";case"b":return"Basique";case"c":return"Complexe";case"s":return"Sp\xe9cial";default:return e}})(e.niveau)})]})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg p-4 flex items-center shadow-sm border border-gray-100",children:[(0,t.jsx)("div",{className:"bg-indigo-50 p-3 rounded-full mr-3",children:(0,t.jsx)(m.A,{className:"h-5 w-5 text-indigo-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:"Participation"}),(0,t.jsx)("p",{className:"text-gray-800 font-medium",children:e.participation||"Non sp\xe9cifi\xe9"})]})]}),k.number&&(0,t.jsxs)("div",{className:"bg-white rounded-lg p-4 flex items-center shadow-sm border border-gray-100",children:[(0,t.jsx)("div",{className:"bg-red-50 p-3 rounded-full mr-3 flex items-center justify-center",children:(0,t.jsx)("img",{src:k.iconPath,alt:k.label,className:"h-8 w-8"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:"Objectif"}),(0,t.jsx)("p",{className:"text-gray-800 font-medium",children:"D\xe9veloppement durable"})]})]})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 mb-6 p-6",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:"Description de la mission"}),(0,t.jsx)("div",{className:"text-gray-700 whitespace-pre-wrap",children:e.intention||"Aucune description disponible pour cette mission."})]}),e.attachments&&e.attachments.length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 mb-6 p-6",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:"Documents"}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:e.attachments.map(e=>{var s;return(0,t.jsxs)("a",{href:e.publicUrl,target:"_blank",rel:"noopener noreferrer",className:"bg-green-50 p-4 rounded-lg flex flex-col hover:bg-green-100 transition-colors",children:[(0,t.jsx)("div",{className:"text-green-700 mb-2",children:(0,t.jsx)(x.A,{className:"h-10 w-10"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-gray-800 mb-1 truncate",children:e.filename}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:(null==(s=e.fileType.split("/")[1])?void 0:s.toUpperCase())||"Fichier"})]})]},e.id)})})]}),e.profils&&e.profils.length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 mb-6 p-6",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:"Profils recherch\xe9s"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.profils.map((e,s)=>(0,t.jsx)("span",{className:"bg-red-50 text-red-800 px-3 py-2 rounded-full text-sm",children:e},s))})]}),e.services&&e.services.length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 mb-6 p-6",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:"Services"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.services.map((e,s)=>(0,t.jsx)("span",{className:"bg-blue-50 text-blue-800 px-3 py-2 rounded-full text-sm",children:e},s))})]}),(0,t.jsx)("div",{className:"flex justify-end gap-4 mb-8",children:(0,t.jsxs)(a.$,{variant:"outline",className:"flex items-center gap-2 border-red-600 text-red-600 hover:bg-red-50 bg-white",onClick:w,disabled:b,children:[b?(0,t.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-t-2 border-b-2 border-red-600"}):(0,t.jsx)(h.A,{className:"h-4 w-4"}),"Supprimer"]})})]})}},17580:(e,s,r)=>{"use strict";r.d(s,{A:()=>t});let t=(0,r(19946).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"}]])},48586:(e,s,r)=>{Promise.resolve().then(r.bind(r,16677))},62525:(e,s,r)=>{"use strict";r.d(s,{A:()=>t});let t=(0,r(19946).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}},e=>{var s=s=>e(e.s=s);e.O(0,[4277,7570,8441,1684,7358],()=>s(48586)),_N_E=e.O()}]); |