NeahNew/.next/static/chunks/app/mission-tab/[missionId]/page-a64d6a85e3edb1c9.js
2025-05-06 23:01:34 +02:00

1 line
8.8 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[681],{24956:(e,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>p});var t=a(95155),r=a(12115),l=a(97168);let i=(0,a(19946).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var c=a(69074),n=a(92657),d=a(4516),m=a(14186),o=a(70333),x=a(99890),h=a(47835),g=a(14503),u=a(35695);function p(){let[e,s]=(0,r.useState)(null),[a,p]=(0,r.useState)(!0),{toast:b}=(0,g.dj)(),j=(0,u.useParams)(),f=(0,u.useRouter)(),y=j.missionId;(0,r.useEffect)(()=>{let e=async()=>{try{p(!0);let e=await fetch("/api/missions/".concat(y));if(!e.ok)throw Error("Failed to fetch mission details");let a=await e.json();console.log("Mission details:",a),s(a)}catch(e){console.error("Error fetching mission details:",e),b({title:"Erreur",description:"Impossible de charger les d\xe9tails de la mission",variant:"destructive"})}finally{p(!1)}};y&&e()},[y,b]);let N=e=>new Date(e).toLocaleDateString("fr-FR",{day:"2-digit",month:"long",year:"numeric"});if(a)return(0,t.jsx)("div",{className:"flex justify-center items-center h-[calc(100vh-64px)] 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 h-[calc(100vh-64px)] 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)(l.$,{onClick:()=>f.push("/mission-tab"),className:"bg-blue-600 hover:bg-blue-700 text-white",children:"Retour au tableau des missions"})]})});let v=(e=>{let s=e&&e.length>0?e[0]:null,a=s?s.replace("odd-",""):null;return{number:a,label:a?"ODD ".concat(a):"Non cat\xe9goris\xe9",iconPath:a?"/F SDG Icons 2019 WEB/F-WEB-Goal-".concat(a.padStart(2,"0"),".png"):""}})(e.oddScope);return(0,t.jsxs)("div",{className:"bg-gray-50 min-h-[calc(100vh-64px)] p-6 overflow-auto",children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsxs)(l.$,{variant:"ghost",className:"flex items-center text-gray-600 hover:text-gray-900",onClick:()=>f.push("/mission-tab"),children:[(0,t.jsx)(i,{className:"mr-2 h-4 w-4"}),"Retour au tableau des missions"]})}),(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.jsxs)("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)(c.A,{className:"h-4 w-4 mr-1"}),N(e.createdAt)]}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(n.A,{className:"h-4 w-4 mr-1"}),Math.floor(100*Math.random())+1," Views"]})]})]}),(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.log("Logo failed to load:",e.logoUrl),s.currentTarget.style.display="none";let a=s.currentTarget.parentElement;a&&(a.classList.add("bg-gray-100"),a.classList.add("flex"),a.classList.add("items-center"),a.classList.add("justify-center"),a.innerHTML='<span className="text-3xl font-medium text-gray-500">'.concat(e.name.slice(0,2).toUpperCase(),"</span>"))}}):(0,t.jsx)("div",{className:"bg-gray-100 w-full h-full flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-3xl font-medium text-gray-500",children:e.name.slice(0,2).toUpperCase()})})})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,t.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 p-6",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"\xc0 propos de la mission"}),(0,t.jsxs)("div",{className:"mb-6 flex flex-wrap gap-2",children:[v.number&&(0,t.jsxs)("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-2 rounded-lg",children:[(0,t.jsx)("img",{src:v.iconPath,alt:v.label,className:"w-8 h-8",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:v.label})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-2 rounded-lg",children:[(0,t.jsx)(d.A,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",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:"flex items-center gap-2 bg-gray-100 px-3 py-2 rounded-lg",children:[(0,t.jsx)(m.A,{className:"w-4 h-4 text-gray-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",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:"flex items-center gap-2 bg-gray-100 px-3 py-2 rounded-lg",children:[(0,t.jsx)(o.A,{className:"w-4 h-4 text-gray-500"}),(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Niveau: ",(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)]})]})]}),e.intention&&(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)("h3",{className:"text-md font-medium text-gray-800 mb-2",children:"Description"}),(0,t.jsx)("p",{className:"text-gray-600 whitespace-pre-line",children:e.intention})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-md font-medium text-gray-800 mb-2",children:"Mission cr\xe9\xe9e par"}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-2",children:(0,t.jsx)("span",{className:"text-xs font-medium text-blue-700",children:e.creator.email.substring(0,2).toUpperCase()})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-700",children:e.creator.email}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:N(e.createdAt)})]})]})]})]}),e.attachments&&e.attachments.length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 p-6",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Fichiers joints"}),(0,t.jsx)("div",{className:"space-y-3",children:e.attachments.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg border border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"p-2 bg-blue-100 rounded-md mr-3",children:(0,t.jsx)(x.A,{className:"h-5 w-5 text-blue-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-gray-800",children:e.filename}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:[(e.fileSize/1024).toFixed(1)," KB • ",e.fileType]})]})]}),(0,t.jsx)("a",{href:e.publicUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 font-medium",children:"T\xe9l\xe9charger"})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[e.services&&e.services.length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 p-6",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Services"}),(0,t.jsx)("div",{className:"space-y-2",children:e.services.map((e,s)=>(0,t.jsx)("div",{className:"flex items-center py-2 px-3 bg-blue-50 text-blue-700 rounded-md",children:(0,t.jsx)("span",{className:"text-sm font-medium",children:e})},s))})]}),e.profils&&e.profils.length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-100 p-6",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Profils requis"}),(0,t.jsx)("div",{className:"space-y-2",children:e.profils.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center py-2 px-3 bg-purple-50 text-purple-700 rounded-md",children:[(0,t.jsx)(h.A,{className:"h-4 w-4 mr-2"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:e})]},s))})]})]})]})]})}},55065:(e,s,a)=>{Promise.resolve().then(a.bind(a,24956))},92657:(e,s,a)=>{"use strict";a.d(s,{A:()=>t});let t=(0,a(19946).A)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])}},e=>{var s=s=>e(e.s=s);e.O(0,[4277,7570,8441,1684,7358],()=>s(55065)),_N_E=e.O()}]);