1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[669],{9497:function(e,t,s){let l=s(7294),a=l.forwardRef(function({title:e,titleId:t,...s},a){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},s),e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"}))});e.exports=a},8710:function(e,t,s){let l=s(7294),a=l.forwardRef(function({title:e,titleId:t,...s},a){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},s),e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z",clipRule:"evenodd"}))});e.exports=a},3223:function(e,t,s){let l=s(7294),a=l.forwardRef(function({title:e,titleId:t,...s},a){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},s),e?l.createElement("title",{id:t},e):null,l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"}))});e.exports=a},5764:function(e,t,s){let l=s(7294),a=l.forwardRef(function({title:e,titleId:t,...s},a){return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},s),e?l.createElement("title",{id:t},e):null,l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.exports=a},3746:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/reservations",function(){return s(4111)}])},8793:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});var l=s(5893);function a(e){let{children:t}=e;return(0,l.jsx)("h1",{className:"mb-4 text-3xl font-extrabold leading-none tracking-tight text-gray-900 text-gray-700",children:t})}},5221:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});var l=s(5893);function a(e){let{children:t}=e;return(0,l.jsx)("h5",{className:"text-xl font-bold text-gray-900",children:t})}},4111:function(e,t,s){"use strict";s.r(t),s.d(t,{ReservationContext:function(){return L},default:function(){return I}});var l=s(5893),a=s(7484),n=s.n(a),i=s(5675),r=s.n(i),o=s(7294),c=s(8793),d=s(5221),x=s(4938),m=s(4080),u=s(2560),f=s(5764),h=s(3771),p=s(4126),g=s(1991),j=s(8710);function y(e){let{children:t}=e;return(0,l.jsx)("div",{className:"rounded-md bg-red-50 p-4 z-50 w-full",children:(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)(j,{className:"h-5 w-5 text-red-400","aria-hidden":"true"})}),(0,l.jsx)("div",{className:"ml-3",children:(0,l.jsx)("p",{className:"text-sm font-medium text-red-800",children:t})})]})})}var w=s(3201),b=s(9497);function v(e){let{steps:t}=e;return(0,l.jsx)("nav",{"aria-label":"Progress",children:(0,l.jsx)("ol",{role:"list",className:"flex items-center",children:t.map((e,s)=>(0,l.jsx)("li",{className:function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter(Boolean).join(" ")}(s!==t.length-1?"pr-8 sm:pr-20":"","relative"),children:"complete"===e.status?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:(0,l.jsx)("div",{className:"h-0.5 w-full bg142814"})}),(0,l.jsxs)("a",{href:"#",className:"relative flex h-8 w-8 items-center justify-center rounded-full bg-white hover:bg-gray-100 border-2 border142814",children:[(0,l.jsx)(b,{className:"h-5 w-5 text142814","aria-hidden":"true"}),(0,l.jsx)("span",{className:"sr-only",children:e.name})]})]}):"current"===e.status?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:(0,l.jsx)("div",{className:"h-0.5 w-full bg-gray-200"})}),(0,l.jsxs)("a",{href:"#",className:"relative flex h-8 w-8 items-center justify-center rounded-full border-2 border142814 bg-white","aria-current":"step",children:[(0,l.jsx)("span",{className:"h-2.5 w-2.5 rounded-full bg142814","aria-hidden":"true"}),(0,l.jsx)("span",{className:"sr-only",children:e.name})]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"absolute inset-0 flex items-center","aria-hidden":"true",children:(0,l.jsx)("div",{className:"h-0.5 w-full bg-gray-200"})}),(0,l.jsxs)("a",{href:"#",className:"group relative flex h-8 w-8 items-center justify-center rounded-full border-2 border-gray-300 bg-white hover:border-gray-400",children:[(0,l.jsx)("span",{className:"h-2.5 w-2.5 rounded-full bg-transparent group-hover:bg-gray-300","aria-hidden":"true"}),(0,l.jsx)("span",{className:"sr-only",children:e.name})]})]})},e.name))})})}function N(){let[e,t]=(0,o.useState)(""),[s,a]=(0,o.useState)(!1),[n,i]=(0,o.useState)(null),[r,c]=(0,o.useState)(null),[x,m]=(0,o.useState)(null),[u,j]=(0,o.useState)(null),[w,b]=(0,o.useState)(null),[N,k]=(0,o.useState)(null),[C,R]=(0,o.useState)(null),[S,E]=(0,o.useState)(!1),[Z,F]=(0,o.useState)(1),{user:O}=(0,h.E)(),[M,P]=(0,o.useState)([{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}]),{selectedReservation:z,updateIsReservationModalOpen:D,updateReservation:T}=(0,o.useContext)(L);async function _(t){switch(t.preventDefault(),a(!0),n){case"SHOP":let s=await p.O.from("Partner").select("*").eq("code",e).eq("cityRef",z.parkingSpotRef.cityRef);if(s.data.length>0){c(s.data[0].id);let e=M;e[0].status="complete",e[1].status="current",P(e)}else E(!0);break;case"EVENT":let l=await p.O.from("Event").select("*").eq("code",e).eq("cityRef",z.parkingSpotRef.cityRef);if(l.data.length>0){m(l.data[0].id);let e=M;e[0].status="complete",e[1].status="current",P(e)}else E(!0);break;default:let i=await p.O.from("Mission").select("*").eq("code",e).eq("cityRef",z.parkingSpotRef.cityRef);if(i.data.length>0){j(i.data[0].id),b(i.data[0].type);let e=M;e[0].status="complete",e[1].status="current",P(e)}else E(!0)}a(!1)}async function q(e){a(!0),await p.O.from("Transaction").insert({partnerRef
1:r,cityRef:z.parkingSpotRef.cityRef,user_id:O.id,value:e}),await p.O.from("Reservation").update({paid:!0}).eq("id",z.id);let t=M;t[1].status="complete",t[2].status="complete",P(t),T(z.id),a(!1)}async function V(e){a(!0),await p.O.from("Transaction").insert({eventRef:x,cityRef:z.parkingSpotRef.cityRef,user_id:O.id,value:e}),await p.O.from("Reservation").update({paid:!0}).eq("id",z.id);let t=M;t[1].status="complete",t[2].status="complete",P(t),T(z.id),a(!1)}async function A(e){a(!0),await p.O.from("Transaction").insert({missionRef:u,cityRef:z.parkingSpotRef.cityRef,user_id:O.id,value:e,timeSpent:N}),await p.O.from("Reservation").update({paid:!0}).eq("id",z.id);let t=M;t[1].status="complete",t[2].status="complete",P(t),T(z.id),a(!1)}return(0,l.jsx)("div",{children:(0,l.jsxs)("div",{className:"flex flex-col gap-6 justify-center items-center",children:[(0,l.jsx)(v,{steps:M}),"current"===M[0].status&&(0,l.jsxs)(l.Fragment,{children:[S&&(0,l.jsx)(y,{children:"Code incorrect"}),null===n?(0,l.jsxs)("div",{className:"w-full my-4 flex flex-col gap-4",children:[(0,l.jsx)("p",{className:"text-sm text-gray-900",children:"S\xe9lectionnez le type de code que vous poss\xe9dez."}),(0,l.jsx)("button",{onClick:()=>i("SHOP"),className:"rounded-md bg142814 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex",children:"Commer\xe7ant"}),(0,l.jsx)("button",{onClick:()=>i("EVENT"),className:"rounded-md bg142814 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex",children:"\xc9v\xe9nement"}),(0,l.jsx)("button",{onClick:()=>i("MISSION"),className:"rounded-md bg142814 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex",children:"Mission"})]}):(0,l.jsxs)("form",{className:"flex flex-col gap-4 justify-center",onSubmit:_,children:[(0,l.jsxs)("div",{className:"",children:[(0,l.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium leading-6 text-gray-900",children:["SHOP"===n&&"Code commer\xe7ant/producteur","MISSION"===n&&"Code mission","EVENT"===n&&"Code \xe9v\xe9nement"]}),(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsx)("div",{className:"flex rounded-md shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-inset focus-within:ring142814",children:(0,l.jsx)("input",{type:"text",name:"name",id:"name",autoComplete:"username",className:"block flex-1 border-0 bg-transparent p-1.5 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6 min-w-[200px]",value:e,onChange:e=>{E(!1),t(e.target.value)},required:!0})})})]}),(0,l.jsx)("button",{type:"submit",className:"rounded-md bg142814 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Valider"})]})]}),"current"===M[1].status&&(0,l.jsxs)(l.Fragment,{children:["SHOP"===n&&!s&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{className:"text-gray-700 text-sm font-semibold",children:["Afin d'aider la commune \xe0 faire sa compta,",(0,l.jsx)("br",{})," j'ai consomm\xe9 :"]}),(0,l.jsxs)("form",{className:"flex flex-col gap-4 justify-center w-full",children:[(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),q("Moins de 5â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Moins de 5â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),q("Entre 5⬠et 20â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 5⬠et 20â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),q("Entre 20⬠et 50â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 20⬠et 50â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),q("Entre 50⬠et 100â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 50⬠et 100â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),q("Plus de 100â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Plus de 100â¬"})]})]}),"EVENT"===n&&!s&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("p",{className:"text-gray-700 text-sm font-semibold",children:["Afin d'aider la commune \xe0 faire sa compta,",(0,l.jsx)("br",{})," j'ai consomm\xe9 :"]}),(0,l.jsxs)("form",{className:"flex flex-col gap-4 justify-center w-full",children:[(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),V("Moins de 5â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Moins de 5â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),V("Entre 5⬠et 20â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 5⬠et 20â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),V("Entre 20⬠et 50â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 20⬠et 50â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),V("Entre 50⬠et 100â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 50⬠et 100â¬"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),V("Plus de 100â¬")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Plus de 100â¬"})]})]}),"MISSION"===n&&!s&&(0,l.jsxs)(l.Fragment,{children:[1===Z?(0,l.jsx)("p",{className:"text-gray-700 text-sm font-semibold",children:"J'ai consacr\xe9 \xe0 la commune :"}):(0,l.jsx)("p",{className:"text-gray-700 text-sm font-semibold",children:"J'ai ramass\xe9 entre :"}),1===Z?(0,l.jsxs)("div",{className:"flex flex-col gap-4 w-full justify-center",children:[(0,l.jsx)("button",{onClick:()=>{k("Entre 5 et 30 minutes"),"Ramassage de d\xe9chets"===w?F(2):A("Entre 5 et 30 minutes")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 5 et 30 minutes"}),(0,l.jsx)("button",{onClick:()=>{k("Entre 30 minutes et 1 heure"),"Ramassage de d\xe9chets"===w?F(2):A("Entre 30 minutes et 1 heure")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 30 minutes et 1 heure"}),(0,l.jsx)("button",{onClick:()=>{k("Entre 1 heure et 2 heures"),"Ramassage de d\xe9chets"===w?F(2):A("Entre 1 heure et 2 heures")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 1 heure et 2 heures"}),(0,l.jsx)("button",{onClick:()=>{k("Plus de 2 heures"),"Ramassage de d\xe9chets"===w?F(2):A("Plus de 2 heures")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Plus de 2 heures"})]}):(0,l.jsxs)("form",{className:"flex flex-col gap-4 justify-center w-full",children:[(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),A("Entre 0 et 500 g")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 0 et 500 g"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),A("Entre 500 g et 1 kg")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Entre 500 g et 1 kg"}),(0,l.jsx)("button",{type:"submit",onClick:e=>{e.preventDefault(),A("Plus d'un kg")},className:"rounded-md bg142814 px-3 py-6 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:s?(0,l.jsx)(g.Z,{textColor:"text-white"}):"Plus d'un kg"})]})]})]}),"complete"===M[2].status&&(0,l.jsxs)("div",{className:"flex flex-col gap-4 items-center",children:[(0,l.jsx)(d.Z,{children:"F\xe9licitations !"}),(0,l.jsx)("p",{className:"text-sm text-gray-700",children:"Vous avez valid\xe9 votre r\xe9servation."}),(0,l.jsx)(f,{className:"w-36 h-36 text142814"}),(0,l.jsx)("button",{type:"submit",onClick:()=>{D(!1)},className:"rounded-md bg142814 px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center flex w-full",children:"Fermer"})]})]})})}function k(){let{isReservationModalOpen:e,updateIsReservationModalOpen:t}=(0,o.useContext)(L);return(0,l.jsx)(m.u.Root,{show:e,as:o.Fragment,children:(0,l.jsxs)(u.V,{as:"div",className:"relative z-50",onClose:()=>t(!1),children:[(0,l.jsx)(m.u.Child,{as:o.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,l.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,l.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,l.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,l.jsx)(m.u.Child,{as:o.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,l.jsx)(u.V.Panel,{className:"relative transform overflow-x-hidden h-[90%] rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6 w-full sm:w-auto",children:(0,l.jsx)(N,{})})})})})]})})}var C=s(9570);function R(){let{cancelReservation:e,updateIsCancelReservationModalOpen:t}=(0,o.useContext)(L);return(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)("h2",{className:"text-base font-semibold leading-7 text-gray-900",children:"Souhaitez-vous vraiment annuler cette r\xe9servation ?"}),(0,l.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,l.jsx)("button",{type:"button",className:"rounded-md bg-gray-900 px-2.5 py-1.5 text-sm font-semibold text-white hover:opacity-90",onClick:()=>t(!1),children:"Retour"}),(0,l.jsx)("button",{type:"button",className:"rounded-md bg-red-500 px-2.5 py-1.5 text-sm font-semibold text-white hover:opacity-90 border-none",onClick:()=>e(),children:"Annuler ma r\xe9servation"})]})]})}function S(){let{isCancelReservationModalOpen:e,updateIsCancelReservationModalOpen:t}=(0,o.useContext)(L);return(0,l.jsx)(m.u.Root,{show:e,as:o.Fragment,children:(0,l.jsxs)(u.V,{as:"div",className:"relative z-50",onClose:()=>t(!1),children:[(0,l.jsx)(m.u.Child,{as:o.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,l.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,l.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,l.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,l.jsx)(m.u.Child,{as:o.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,l.jsx)(u.V.Panel,{className:"relative transform overflow-x-hidden h-[90%] rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6 w-full sm:w-auto",children:(0,l.jsx)(R,{})})})})})]})})}var E=s(6010),Z=s(5176),F=s(7069),O=s(3223),M=s(3156),P=s(8099),z=s(206),D=s(3474),T=s(6249),_=s(8885),q=s(3122);function V(){let{selectedReservation:e,updateIsVisualizeReservationOpen:t}=(0,o.useContext)(L);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"absolute z-[60] w-full flex items-center justify-between p-4",children:(0,l.jsx)("div",{onClick:()=>t(!1),className:"w-10 h-10 bg-white border rounded-full flex items-center justify-center cursor-pointer hover:bg-gray-100",children:(0,l.jsx)(O,{className:"w-5 h-5 text-gray-900"})})}),null!==e.parkingSpotRef.imageUrl?(0,l.jsx)("div",{className:"xs:w-screen w-[400px] relative",children:(0,l.jsx)(r(),{src:e.parkingSpotRef.imageUrl,alt:e.parkingSpotRef.name,width:600,height:450,className:"sm:rounded-t-lg"})}):(0,l.jsx)("div",{className:"xs:w-screen sm:w-full flex items-center justify-center bg-gray-300 min-h-[300px]",children:(0,l.jsx)(r(),{src:"/images/logo-light.png",alt:e.parkingSpotRef.name,width:80,height:80,className:"rounded-l-lg"})}),(0,l.jsxs)("div",{className:"p-4",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center",children:[(0,l.jsxs)("h1",{className:"text-xl font-semibold leading-7 text-gray-900 flex items-center",children:[void 0!==e.parkingSpotRef.name&&e.parkingSpotRef.name,(0,l.jsxs)("span",{className:"text-sm text-slate-400 ml-2",children:["(R\xe9f. #",e.parkingSpotRef.id,")"]})]}),(0,l.jsx)("div",{className:"mt-4"})]}),(0,l.jsx)("h2",{className:"text-base font-semibold leading-7 text-gray-900 flex",children:"Description de l'emplacement"}),(0,l.jsx)("p",{className:"mt-1 text-sm leading-5 text-slate-600",children:e.parkingSpotRef.description}),(0,l.jsx)("div",{className:"mt-4 mb-4",children:(0,l.jsx)(w.Z,{})}),(0,l.jsx)("h2",{className:"text-base font-semibold leading-7 text-gray-900 flex",children:"Ce que propose l'emplacement"}),(0,l.jsxs)("div",{className:"width-100 flex mt-4 gap-20",children:[(0,l.jsxs)("div",{className:"width-50 flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(Z,{className:"w-4 h-4 text-black"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Nuit calme"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(M.Z,{size:16,color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Acc\xe8s toilettes"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(P.Z,{size:16,color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Acc\xe8s douche"})]})]}),(0,l.jsxs)("div",{className:"width-50 flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(F,{className:"w-4 h-4 text-black"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Tri s\xe9lectif"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(z.Z,{color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Acc\xe8s sentiers"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(D.Z,{color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Tables \xe0 manger"})]})]})]}),(0,l.jsx)("div",{className:"mt-4 mb-4",children:(0,l.jsx)(w.Z,{})}),(0,l.jsx)("h2",{className
1:"text-base font-semibold leading-7 text-gray-900",children:"Missions disponibles"}),(0,l.jsxs)("div",{className:"width-100 flex flex-col gap-2 mt-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(T.Z,{size:16,color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Consommer chez les commer\xe7ants"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(_.Z,{size:16,color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Participer \xe0 un \xe9v\xe9nement"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(q.Z,{size:16,color:"#000",weight:"fill"}),(0,l.jsx)("p",{className:"text-sm leading-5 text-slate-600",children:"Nettoyer un lieu"})]})]}),(0,l.jsx)("div",{className:"mt-4 mb-4",children:(0,l.jsx)(w.Z,{})}),(0,l.jsx)("h2",{className:"text-base font-semibold leading-7 text-gray-900 flex",children:"Charte de l'emplacement"}),(0,l.jsx)("p",{className:"mt-1 text-sm leading-5 text-slate-600",children:e.parkingSpotRef.charte})]})]})}function A(){let{updateIsVisualizeReservationOpen:e,isVisualizeReservationOpen:t}=(0,o.useContext)(L),s=(0,o.useRef)(null);return(0,l.jsx)(m.u.Root,{show:t,as:o.Fragment,children:(0,l.jsxs)(u.V,{initialFocus:s,as:"div",className:"relative z-[100]",onClose:()=>e(!1),children:[(0,l.jsx)(m.u.Child,{as:o.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,l.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,l.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,l.jsx)("div",{className:"flex min-h-full items-end justify-center text-center sm:items-center sm:p-0",children:(0,l.jsx)(m.u.Child,{as:o.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,l.jsx)(u.V.Panel,{className:"relative transform overflow-x-hidden overflow-y-scroll no-scrollbar xs:w-screen xs:h-screen xs:rounded-none sm:h-[90%] sm:rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-[400px] ",children:(0,l.jsx)("div",{ref:s,className:"mx-auto max-w-[7xl] sm:h-[500px] overflow-x-hidden no-scrollbar",children:(0,l.jsx)(V,{})})})})})})]})})}s(9564);let L=(0,o.createContext)();function I(){let{loading:e,user:t,userInfos:s}=(0,h.E)(),[a,i]=(0,o.useState)([]),[m,u]=(0,o.useState)([]),[f,g]=(0,o.useState)(null),[j,y]=(0,o.useState)(!0),[w,b]=(0,o.useState)(!1),[v,N]=(0,o.useState)(!1),[R,Z]=(0,o.useState)(!1),[F,O]=(0,o.useState)(null);async function M(){await p.O.from("Reservation").delete().eq("id",F.id);let e=a.filter(e=>e.id!==F.id);u(e),i(e),N(!1)}return(0,o.useEffect)(()=>{async function t(){let{data:e,error:t}=await p.O.from("Reservation").select("\n id, startDate, endDate, paid, parkingSpotRef(*)\n ").eq("user_id",s[0].id).order("id",{ascending:!1});e&&i(e)}!e&&s.length>0&&t()},[s,e]),(0,o.useEffect)(()=>{if(a.length>0&&j){let e=a;u(e=e.filter(e=>!1===e.paid))}if(a.length>0&&!j){let e=a;u(e=e.filter(e=>!0===e.paid))}},[a,j]),(0,o.useEffect)(()=>{null!==f&&i(f),g(null)},[f]),(0,l.jsx)(L.Provider,{value:{isReservationModalOpen:w,updateIsReservationModalOpen:function(e){b(e)},selectedReservation:F,updateReservation:function(e){let t=a;for(let s=0;s<t.length;s++)t[s].id===e&&(t[s].paid=!0);g(t)},isCancelReservationModalOpen:v,updateIsCancelReservationModalOpen:function(e){N(e)},cancelReservation:M,updateIsVisualizeReservationOpen:function(e){Z(e)},isVisualizeReservationOpen:R},children:(0,l.jsxs)(x.Z,{children:[(0,l.jsx)(k,{}),(0,l.jsx)(S,{}),(0,l.jsx)(A,{}),(0,l.jsxs)("div",{className:"mt-4 mb-4",children:[(0,l.jsx)(c.Z,{children:"Mes r\xe9servations"}),(0,l.jsxs)("div",{className:"w-full mt-4 overflow-x-scroll no-scrollbar gap-2 flex",children:[(0,l.jsx)("div",{onClick:()=>{y(!0)},className:(0,E.Z)(j?"border-gray-700":"border-transparent hover:border-gray-400","flex flex-col items-center cursor-pointer shrink-0 !w-[90px] justify-center pb-[7px] border-b-[3px]"),children:(0,l.jsx)("span",{className:(0,E.Z)(j?"text-gray-700":"text-gray-400","rounded-md text-xs font-semibold linkMenuChild"),children:"En cours"})}),(0,l.jsx)("div",{onClick:()=>{y(!1)},className:(0,E.Z)(j?"border-transparent hover:border-gray-400":"border-gray-700","flex flex-col items-center cursor-pointer shrink-0 !w-[90px] justify-center pb-[7px] border-b-[3px]"),children:(0,l.jsx)("span",{className:(0,E.Z)(j?"text-gray-400":"text-gray-700","rounded-md text-xs font-semibold linkMenuChild"),children:"Archiv\xe9es"})})]}),(0,l.jsxs)("div",{className:"flex flex-col w-full h-[80vh] overflow-x-hidden no-scrollbar",children:[m.map(e=>(0,l.jsx)("div",{className:"py-4 border-b",children:(0,l.jsxs)("div",{onClick:()=>{O(e),Z(!0)},className:"w-full h-[150px] flex xs:flex-col sm:flex-row justify-between xs:h-auto p-4 hover:bg-teal-50 cursor-pointer rounded-xl",children:[(0,l.jsxs)("div",{className:"flex xs:order-1 sm:order-0",children:[(0,l.jsx)("div",{className:"",children:null!==e.parkingSpotRef.imageUrl?(0,l.jsx)("div",{className:"w-[75px] h-[75px] sm:w-[150px] sm:h-[150px] relative",children:(0,l.jsx)(r(),{src:e.parkingSpotRef.imageUrl,alt:e.parkingSpotRef.name,fill:!0,className:"rounded-xl"})}):(0,l.jsx)("div",{className:"w-[75px] h-[75px] sm:w-[150px] sm:h-[150px] bg-gray-200 flex items-center justify-center rounded-xl",children:(0,l.jsx)(r(),{src:"/images/logo-light.png",alt:e.parkingSpotRef.name,width:40,height:40,className:"rounded-xl"})})}),(0,l.jsxs)("div",{className:"flex flex-col pl-6 gap-1",children:[(0,l.jsx)(d.Z,{children:e.parkingSpotRef.name}),(0,l.jsx)("p",{className:"text-gray-700 text-sm",children:e.parkingSpotRef.address}),(0,l.jsx)("p",{className:"text-gray-500 text-sm",children:n()(e.startDate).format("DD/MM/YYYY")+" - "+n()(e.endDate).format("DD/MM/YYYY")})]})]}),(0,l.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"flex gap-3 xs:pl-0 sm:pl-6 xs:mb-4 sm:mb-0 xs:order-0 sm:order-1",children:[(0,l.jsx)("a",{href:"https://www.google.fr/maps/dir//'".concat(e.parkingSpotRef.latitude,",").concat(e.parkingSpotRef.longitude,"'/@").concat(e.parkingSpotRef.latitude,",").concat(e.parkingSpotRef.longitude,",15z"),target:"_blank",rel:"noreferrer",children:(0,l.jsx)("div",{className:"flex items-center justify-center w-7 h-7 bg142814 cursor-pointer rotate-45 rounded-sm mt-1 ml-2",children:(0,l.jsx)(l.Fragment,{children:(0,l.jsx)(C.Z,{size:18,color:"#fff",weight:"bold",className:"-rotate-45"})})})}),e.paid?(0,l.jsx)("div",{className:"flex flex-col gap-2 text-center",children:(0,l.jsx)("button",{type:"button",disabled:!0,className:"inline-flex items-center gap-x-1.5 rounded-md bg142814 px-3 py-2 text-sm font-semibold text-white shadow-sm w-full justify-center min-w-[65px]",children:"Pay\xe9"})}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"flex flex-col gap-2 text-center",children:(0,l.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),O(e),b(!0)},className:"inline-flex items-center gap-x-1.5 rounded-md bg-black px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-slate-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 w-full justify-center",children:"Finaliser"})}),(0,l.jsx)("div",{className:"flex flex-col gap-2 text-center",children:(0,l.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),O(e),N(!0)},className:"inline-flex items-center gap-x-1.5 rounded-md bg-red-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:opacity-90 w-full justify-center",children:"Annuler"})})]})]})]})},e.id)),0===m.length&&(0,l.jsx)("p",{className:"mt-4 text-sm text-gray-900",children:"Aucun r\xe9sultat."})]})]})]})})}}},function(e){e.O(0,[634,739,268,267,685,774,888,179],function(){return e(e.s=3746)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.