1 line
53 KiB
JavaScript
1 line
53 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78740,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.SEVERITY_COLORS=a.DAMAGE_ZONE_COORDS=void 0,a.DAMAGE_ZONE_COORDS={hood:{x:48,y:8,w:64,h:28},roof:{x:48,y:52,w:64,h:56},trunk:{x:48,y:124,w:64,h:28},"front-bumper":{x:48,y:0,w:64,h:10},"rear-bumper":{x:48,y:150,w:64,h:10},"front-left-fender":{x:20,y:10,w:30,h:35},"front-right-fender":{x:110,y:10,w:30,h:35},"front-left-door":{x:20,y:52,w:30,h:30},"front-right-door":{x:110,y:52,w:30,h:30},"rear-left-door":{x:20,y:82,w:30,h:30},"rear-right-door":{x:110,y:82,w:30,h:30},"rear-left-fender":{x:20,y:112,w:30,h:35},"rear-right-fender":{x:110,y:112,w:30,h:35},windshield:{x:52,y:38,w:56,h:18},"rear-window":{x:52,y:104,w:56,h:18},"left-mirror":{x:8,y:50,w:14,h:10},"right-mirror":{x:138,y:50,w:14,h:10},"front-left-wheel":{x:10,y:24,w:22,h:26},"front-right-wheel":{x:128,y:24,w:22,h:26},"rear-left-wheel":{x:10,y:110,w:22,h:26},"rear-right-wheel":{x:128,y:110,w:22,h:26},interior:{x:55,y:58,w:50,h:44},"under-hood":{x:52,y:10,w:56,h:20},undercarriage:{x:52,y:130,w:56,h:20}},a.SEVERITY_COLORS={SCRATCH:"#F59E0B",DENT:"#EF4444",CRACK:"#8B5CF6",MISSING:"#374151",OTHER:"#6B7280"}},33556,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.FUEL_POLICY_LABELS=void 0,a.FUEL_POLICY_LABELS={FULL_TO_FULL:{en:"Full-to-Full: Return vehicle with a full tank. A refueling fee applies if returned with less fuel.",fr:"Plein à plein : retournez le véhicule avec le plein. Des frais de ravitaillement s'appliquent sinon.",ar:"ممتلئ إلى ممتلئ: يجب إعادة السيارة بخزان ممتلئ. رسوم إضافية في حال الإعادة بمستوى أقل."},FULL_TO_EMPTY:{en:"Full-to-Empty: Vehicle is provided with a full tank. No refund for unused fuel upon return.",fr:"Plein à vide : le véhicule est livré avec le plein. Aucun remboursement n'est accordé pour le carburant non utilisé.",ar:"ممتلئ إلى فارغ: تُسلَّم السيارة بخزان ممتلئ. لا استرداد للوقود غير المستخدم."},SAME_TO_SAME:{en:"Same-to-Same: Return vehicle with the same fuel level as at pickup.",fr:"Même niveau : retournez le véhicule avec le même niveau de carburant qu'au départ.",ar:"نفس المستوى: أعد السيارة بنفس مستوى الوقود عند الاستلام."},PREPAID:{en:"Prepaid Fuel: You pre-purchase a full tank at a fixed rate. Return at any fuel level.",fr:"Carburant prépayé : vous achetez un plein à tarif fixe à l'avance. Retour possible avec n'importe quel niveau.",ar:"الوقود المدفوع مسبقاً: تدفع مقدماً ثمن خزان كامل بسعر ثابت. يمكن إعادة السيارة بأي مستوى."},FREE:{en:"Fuel Included: Fuel cost is included in the rental price.",fr:"Carburant inclus : le coût du carburant est inclus dans le tarif de location.",ar:"الوقود مشمول: تكلفة الوقود مشمولة في سعر الإيجار."}}},89456,(e,t,a)=>{"use strict";function s(e){if(e)return e;let t="object"==typeof globalThis&&"document"in globalThis?globalThis.document?.documentElement?.lang:void 0;return"en"===t||"fr"===t||"ar"===t?t:"en"}function l(e,t="MAD"){return"ar"===s(e)?"درهم":"MAD"}Object.defineProperty(a,"__esModule",{value:!0}),a.PLAN_FEATURES=a.PLAN_PRICES=void 0,a.getCurrencyLabel=l,a.formatCurrency=function(e,t="MAD",a){let r=s(a),n=new Intl.NumberFormat({en:"en-US",fr:"fr-FR",ar:"ar-MA"}[r],{minimumFractionDigits:2,maximumFractionDigits:2}).format(e/100),i=l(r,t);return"en"===r?`${i} ${n}`:`${n} ${i}`},a.PLAN_PRICES={STARTER:{MONTHLY:{MAD:2990},ANNUAL:{MAD:29900}},GROWTH:{MONTHLY:{MAD:3990},ANNUAL:{MAD:39900}},PRO:{MONTHLY:{MAD:99900},ANNUAL:{MAD:999e3}}},a.PLAN_FEATURES={STARTER:["Up to 10 vehicles","1 user account","Basic analytics","Marketplace listing"],GROWTH:["Up to 50 vehicles","5 user accounts","Full analytics","Priority marketplace placement","Custom branding"],PRO:["Unlimited vehicles","Unlimited user accounts","Advanced reports","API access","Dedicated support"]}},82110,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.defaultMarketplaceHomepageContent=a.defaultMarketplaceHomepageSections=void 0,a.cloneMarketplaceHomepageContent=function(){return JSON.parse(JSON.stringify(a.defaultMarketplaceHomepageContent))},a.resolveMarketplaceHomepageSections=function(e){let t=e?.length?e:a.defaultMarketplaceHomepageSections;return t.filter((e,a)=>t.indexOf(e)===a)},a.defaultMarketplaceHomepageSections=["hero","surface","pillars","audiences","features","steps","closing"],a.defaultMarketplaceHomepageContent={en:{sections:a.defaultMarketplaceHomepageSections,heroKicker:"RentalDriveGo",heroTitle:"Marketplace discovery with a sharper front door.",heroBody:"Rental companies run private operations, renters browse a shared marketplace, and every booking ends on the company’s own branded checkout.",startTrial:"Start free trial",exploreVehicles:"Explore vehicles",surfaceLabel:"Marketplace surface",surfaceTitle:"Designed for two audiences at once.",surfaceBody:"Operators need control, renters need confidence. The marketplace should show both without feeling like a template.",liveLabel:"Live network",trustedFleets:"Trusted fleets",brandedFlows:"Branded booking flows",multiTenant:"Multi-tenant operations",companyKicker:"Operator workflow",companyTitle:"Manage inventory, offers, billing, and staff from one control layer.",companyBody:"Publish inventory once, decide what appears publicly, and keep contracts, payments, and reporting isolated per company.",renterKicker:"Renter experience",renterTitle:"Let renters compare quickly, then hand them off to the right company site.",renterBody:"The marketplace works as a discovery engine, not a dead-end aggregator. Search here, reserve there, and pay direct.",pillars:[["Unified publishing","Vehicle photos, pricing, and offers flow from one admin workflow into marketplace discovery and branded booking pages."],["Qualified discovery","Featured offers, location-aware browsing, and company reputation signals help renters narrow options fast."],["Direct revenue path","Bookings move into the company’s own payment flow, so customer ownership and cash collection stay with the business."]].map(([e,t])=>({title:e,body:t})),metrics:[["01","Shared marketplace visibility"],["02","Direct company checkout"],["03","Company-owned payments"]].map(([e,t])=>({value:e,label:t})),featureLabel:"What the product covers",features:["Fleet management with multi-photo uploads","Marketplace offers and redirect booking flow","Branded public booking site per company","Customer CRM, analytics, and billing controls"],stepsTitle:"How companies launch",steps:[["1","Create your company workspace","Pick a plan, launch your 90-day trial, and verify the owner account."],["2","Publish vehicles and offers","Upload photos once and control what appears on the marketplace and branded site."],["3","Accept bookings on your own site","Renters discover your fleet on RentalDriveGo, then pay you directly on your branded booking flow."]].map(([e,t,a])=>({step:e,title:t,body:a})),stepLabel:"Step",readyKicker:"Ready to launch",readyTitle:"The marketplace homepage should explain the product in seconds.",readyBody:"Use the marketplace to attract demand, then move renters into a branded experience that keeps pricing, payments, and trust tied to your company.",viewPricing:"View pricing",createWorkspace:"Create workspace"},fr:{sections:a.defaultMarketplaceHomepageSections,heroKicker:"RentalDriveGo",heroTitle:"Une vitrine marketplace plus claire et plus percutante.",heroBody:"Les entreprises de location gèrent leurs opérations en privé, les clients parcourent une marketplace commune et chaque réservation se finalise sur le parcours de paiement aux couleurs de l'entreprise.",startTrial:"Commencer l’essai gratuit",exploreVehicles:"Explorer les véhicules",surfaceLabel:"Vitrine marketplace",surfaceTitle:"Pensée pour deux audiences à la fois.",surfaceBody:"Les opérateurs veulent du contrôle, les clients veulent de la confiance. La marketplace doit montrer les deux sans ressembler à un modèle générique.",liveLabel:"Réseau actif",trustedFleets:"Flottes fiables",brandedFlows:"Parcours de marque",multiTenant:"Opérations multi-tenant",companyKicker:"Flux opérateur",companyTitle:"Pilotez l’inventaire, les offres, la facturation et l’équipe depuis un seul centre de contrôle.",companyBody:"Publiez une seule fois, choisissez ce qui apparaît publiquement, et gardez contrats, paiements et rapports isolés par entreprise.",renterKicker:"Expérience client",renterTitle:"Laissez les clients comparer rapidement, puis redirigez-les vers le bon site d’entreprise.",renterBody:"La marketplace sert de moteur de découverte, pas d’agrégateur sans suite. Recherche ici, réservation là-bas, paiement direct.",pillars:[["Publication unifiée","Les photos, tarifs et offres circulent depuis un seul flux d’administration vers la découverte marketplace et les pages de réservation de marque."],["Découverte qualifiée","Offres mises en avant, navigation par localisation et signaux de réputation aident les clients à filtrer rapidement."],["Revenus en direct","Les réservations basculent vers le paiement propre à l’entreprise afin de préserver la relation client et l’encaissement."]].map(([e,t])=>({title:e,body:t})),metrics:[["01","Visibilité marketplace partagée"],["02","Paiement direct entreprise"],["03","Paiements gérés par l’entreprise"]].map(([e,t])=>({value:e,label:t})),featureLabel:"Ce que couvre le produit",features:["Gestion de flotte avec téléversement de plusieurs photos","Offres marketplace et redirection vers la réservation","Site public de réservation par entreprise","CRM client, analytics et contrôle de facturation"],stepsTitle:"Comment les entreprises démarrent",steps:[["1","Créez votre espace entreprise","Choisissez un plan, lancez votre essai de 90 jours et vérifiez le compte propriétaire."],["2","Publiez véhicules et offres","Téléversez une seule fois et contrôlez ce qui apparaît sur la marketplace et le site de marque."],["3","Acceptez les réservations sur votre site","Les clients découvrent votre flotte sur RentalDriveGo puis paient directement via votre parcours de réservation."]].map(([e,t,a])=>({step:e,title:t,body:a})),stepLabel:"Étape",readyKicker:"Prêt à démarrer",readyTitle:"La page d’accueil marketplace doit présenter le produit en quelques secondes.",readyBody:"Utilisez la marketplace pour capter la demande, puis orientez les clients vers une expérience de marque où les prix, les paiements et la confiance restent attachés à votre entreprise.",viewPricing:"Voir les tarifs",createWorkspace:"Créer l’espace"},ar:{sections:a.defaultMarketplaceHomepageSections,heroKicker:"RentalDriveGo",heroTitle:"واجهة سوق أكثر وضوحاً وتأثيراً.",heroBody:"شركات التأجير تدير عملياتها بشكل خاص، والمستأجرون يتصفحون سوقاً مشتركاً، وكل حجز ينتهي في صفحة دفع تحمل هوية الشركة ذاتها.",startTrial:"ابدأ التجربة المجانية",exploreVehicles:"استكشف السيارات",surfaceLabel:"واجهة السوق",surfaceTitle:"مصممة لجمهورين في الوقت نفسه.",surfaceBody:"المشغلون يريدون التحكم، والمستأجرون يريدون الثقة. يجب أن تُظهر المنصة الأمرين معاً من دون أن تبدو كقالب عادي.",liveLabel:"شبكة نشطة",trustedFleets:"أساطيل موثوقة",brandedFlows:"مسارات حجز مخصصة",multiTenant:"عمليات متعددة الشركات",companyKicker:"سير عمل المشغل",companyTitle:"تحكم في المخزون والعروض والفوترة والفريق من طبقة تشغيل واحدة.",companyBody:"انشر المخزون مرة واحدة، وحدد ما يظهر للعامة، واحتفظ بالعقود والمدفوعات والتقارير معزولة لكل شركة.",renterKicker:"تجربة المستأجر",renterTitle:"دع المستأجرين يقارنون بسرعة ثم وجّههم إلى موقع الشركة المناسب.",renterBody:"هذه المنصة محرك لاكتشاف الخيارات، وليست مُجمِّعاً بلا مسار واضح. ابحث هنا، احجز هناك، وادفع مباشرة للشركة.",pillars:[["نشر موحد","صور السيارات والأسعار والعروض تنتقل من سير إدارة واحد إلى السوق وصفحات الحجز ذات الهوية الخاصة."],["اكتشاف مؤهل","تساعد العروض المميزة، والتصفح حسب الموقع، وإشارات السمعة المستأجرين على تحديد خياراتهم بسرعة."],["مسار إيراد مباشر","تنتقل الحجوزات إلى صفحة الدفع الخاصة بالشركة حتى تبقى علاقة العميل والتحصيل المالي بيد الشركة نفسها."]].map(([e,t])=>({title:e,body:t})),metrics:[["01","ظهور مشترك في السوق"],["02","دفع مباشر للشركة"],["03","مدفوعات مملوكة للشركة"]].map(([e,t])=>({value:e,label:t})),featureLabel:"ما الذي يقدمه المنتج",features:["إدارة الأسطول مع رفع عدة صور","عروض السوق والتحويل إلى مسار الحجز","موقع حجز عام مخصص لكل شركة","إدارة العملاء والتحليلات والفوترة"],stepsTitle:"كيف تبدأ الشركات",steps:[["1","أنشئ مساحة عمل شركتك","اختر الخطة وابدأ تجربتك لمدة 14 يوماً ثم فعّل حساب المالك."],["2","انشر السيارات والعروض","ارفع الصور مرة واحدة وتحكم فيما يظهر في السوق وفي الموقع المخصص."],["3","استقبل الحجوزات على موقعك","يكتشف المستأجرون أسطولك على RentalDriveGo ثم يدفعون مباشرة عبر مسار الحجز الخاص بك."]].map(([e,t,a])=>({step:e,title:t,body:a})),stepLabel:"الخطوة",readyKicker:"جاهز للانطلاق",readyTitle:"يجب أن تشرح الصفحة الرئيسية قيمة المنصة خلال ثوانٍ.",readyBody:"استخدم السوق لجذب الطلب، ثم انقل المستأجرين إلى تجربة تحمل هوية شركتك، بحيث تبقى الأسعار والمدفوعات والثقة مرتبطة بنشاطك.",viewPricing:"عرض الأسعار",createWorkspace:"إنشاء المساحة"}}},64712,(e,t,a)=>{"use strict";var s=e.e&&e.e.__createBinding||(Object.create?function(e,t,a,s){void 0===s&&(s=a);var l=Object.getOwnPropertyDescriptor(t,a);(!l||("get"in l?!t.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return t[a]}}),Object.defineProperty(e,s,l)}:function(e,t,a,s){void 0===s&&(s=a),e[s]=t[a]}),l=e.e&&e.e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||s(t,e,a)};Object.defineProperty(a,"__esModule",{value:!0}),l(e.r(78740),a),l(e.r(33556),a),l(e.r(89456),a),l(e.r(82110),a)},51951,e=>{"use strict";var t=e.i(43476);let a={MINOR:"#f59e0b",MODERATE:"#f97316",MAJOR:"#dc2626"},s={FRONT:{x:161,y:4,w:251,h:108},TOP:{x:150,y:112,w:273,h:613},REAR:{x:156,y:724,w:252,h:123},LEFT:{x:4,y:114,w:146,h:618},RIGHT:{x:423,y:114,w:146,h:618}};function l(e,l,r){let n,{cx:i,cy:o}={cx:(n=s[e.viewType??"TOP"]).x+e.x/100*n.w,cy:n.y+e.y/100*n.h},d=a[e.severity];return"comparison"===r?(0,t.jsxs)("g",{children:[(0,t.jsx)("circle",{cx:i,cy:o,r:"9",fill:"rgba(255,255,255,0.92)",stroke:d,strokeWidth:"2.5",strokeDasharray:"5 4"}),(0,t.jsx)("circle",{cx:i,cy:o,r:"4",fill:d,opacity:"0.28"})]},`comparison-${e.viewType??"TOP"}-${e.x}-${e.y}-${l}`):(0,t.jsx)("circle",{cx:i,cy:o,r:"7.5",fill:d,stroke:"white",strokeWidth:"2.5"},`current-${e.viewType??"TOP"}-${e.x}-${e.y}-${l}`)}e.s(["default",0,function({points:e,comparisonPoints:a=[],interactive:r=!1,className:n="",onAddPoint:i}){return(0,t.jsxs)("svg",{viewBox:"0 0 573 876",className:n,onClick:function(e){if(!r||!i)return;let t=function(e,t,a){let l=(e-a.left)/a.width*573,r=(t-a.top)/a.height*876,n=Object.entries(s).find(([,e])=>l>=e.x&&l<=e.x+e.w&&r>=e.y&&r<=e.y+e.h);if(!n)return null;let[i,o]=n;return{viewType:i,x:(l-o.x)/o.w*100,y:(r-o.y)/o.h*100}}(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect());t&&i(t.viewType,t.x,t.y)},children:[(0,t.jsx)("rect",{x:"1.5",y:"1.5",width:570,height:873,rx:"18",fill:"#fff",stroke:"#cbd5e1",strokeWidth:"3"}),(0,t.jsx)("image",{href:"/dashboard/vehicle-condition-template.png",x:"0",y:"0",width:573,height:876,preserveAspectRatio:"xMidYMid meet"}),a.map((e,t)=>l(e,t,"comparison")),e.map((e,t)=>l(e,t,"current"))]})}])},73068,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(18566),l=e.i(64712),r=e.i(94327),n=e.i(56322),i=e.i(51951);let o=["FULL","SEVEN_EIGHTHS","THREE_QUARTERS","FIVE_EIGHTHS","HALF","THREE_EIGHTHS","QUARTER","ONE_EIGHTH","EMPTY"],d=["SCRATCH","DENT","CRACK","CHIP","MISSING","STAIN","OTHER"],c={MINOR:"#f59e0b",MODERATE:"#f97316",MAJOR:"#dc2626"};function u(e){return`${e.viewType}:${e.x.toFixed(2)}:${e.y.toFixed(2)}:${e.damageType}:${e.severity}`}function m({reservationId:e,type:s,initialInspection:l,comparisonPoints:p=[],editable:h=!0,readOnlyMessage:x,onSaved:b}){let g,{dict:f}=(0,n.useDashboardI18n)(),v=f.reservations,y="CHECKOUT"===s?[...p,...l?.damagePoints?.filter(e=>e.isPreExisting)??[]].filter((e,t,a)=>a.findIndex(t=>u(t)===u(e))===t):[],[N,k]=(0,a.useState)({id:l?.id??`${s.toLowerCase()}-draft`,type:s,mileage:l?.mileage??null,fuelLevel:l?.fuelLevel??"FULL",fuelCharge:l?.fuelCharge??null,generalCondition:l?.generalCondition??"",employeeNotes:l?.employeeNotes??"",customerAgreed:l?.customerAgreed??!1,damagePoints:(g=l?.damagePoints??[],"CHECKOUT"===s?g.filter(e=>!e.isPreExisting):g)}),[j,w]=(0,a.useState)("SCRATCH"),[C,L]=(0,a.useState)("MINOR"),[R,T]=(0,a.useState)(!1),[E,A]=(0,a.useState)(null);async function P(){T(!0),A(null);try{let t,a=(t=[...y.map(({viewType:e,x:t,y:a,damageType:s,severity:l,description:r})=>({viewType:e,x:t,y:a,damageType:s,severity:l,...r?{description:r}:{},isPreExisting:!0})),...N.damagePoints.map(({viewType:e,x:t,y:a,damageType:s,severity:l,description:r,isPreExisting:n})=>({viewType:e,x:t,y:a,damageType:s,severity:l,...r?{description:r}:{},isPreExisting:n}))],{...null!==N.mileage?{mileage:N.mileage}:{},fuelLevel:N.fuelLevel,...null!==N.fuelCharge?{fuelCharge:N.fuelCharge}:{},...N.generalCondition?{generalCondition:N.generalCondition}:{},...N.employeeNotes?{employeeNotes:N.employeeNotes}:{},customerAgreed:N.customerAgreed,damagePoints:t}),l=await (0,r.apiFetch)(`/reservations/${e}/inspections/${s.toLowerCase()}`,{method:"PUT",body:JSON.stringify(a)});k({...l,damagePoints:"CHECKOUT"===s?l.damagePoints.filter(e=>!e.isPreExisting):l.damagePoints}),b(l)}catch(e){A(e.message??v.failedSaveInspection)}finally{T(!1)}}return(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-base font-semibold text-slate-900",children:v.inspectionCardTitle(s)}),(0,t.jsx)("p",{className:"mt-1 text-sm text-slate-500",children:v.inspectionSubtitle})]}),(0,t.jsx)("button",{onClick:P,disabled:R||!h,className:"btn-primary",children:R?v.savingInspection:v.saveInspection})]}),E&&(0,t.jsx)("div",{className:"mt-4 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:E}),!h&&x&&(0,t.jsx)("div",{className:"mt-4 rounded-xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600",children:x}),(0,t.jsxs)("div",{className:"mt-5 grid gap-6 xl:grid-cols-[1.1fr_0.9fr]",children:[(0,t.jsxs)("div",{className:"rounded-2xl border border-slate-200 bg-slate-50 p-4",children:[(0,t.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-2 text-xs",children:d.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>w(e),disabled:!h,className:`rounded-full px-3 py-1.5 font-semibold ${j===e?"bg-blue-700 text-white":"bg-white text-slate-600"}`,children:v.damageTypeLabels[e]},e))}),(0,t.jsx)("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-xs",children:Object.keys(c).map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>L(e),disabled:!h,className:"rounded-full px-3 py-1.5 font-semibold text-white",style:{backgroundColor:c[e],opacity:C===e?1:.55},children:v.severityLabels[e]},e))}),"CHECKOUT"===s&&y.length>0&&(0,t.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-3 rounded-2xl border border-slate-200 bg-slate-100 px-3 py-2 text-xs text-slate-600",children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-3.5 w-3.5 rounded-full border-2 border-dashed border-slate-500 bg-white"}),v.inspectionCardTitle("CHECKIN")]}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-3.5 w-3.5 rounded-full bg-blue-700"}),v.inspectionCardTitle("CHECKOUT")]})]}),(0,t.jsx)(i.default,{points:N.damagePoints,comparisonPoints:y,interactive:h,onAddPoint:h?function(e,t,a){k(l=>({...l,damagePoints:[...l.damagePoints,{viewType:e,x:t,y:a,damageType:j,severity:C,description:"",isPreExisting:"CHECKIN"===s}]}))}:void 0,className:`w-full rounded-2xl border border-slate-200 bg-white ${h?"cursor-crosshair":"cursor-default"}`}),(0,t.jsx)("p",{className:"mt-2 text-xs text-slate-500",children:v.diagramHelp})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:v.mileageLabel}),(0,t.jsx)("input",{type:"number",className:"input-field",value:N.mileage??"",disabled:!h,onChange:e=>k(t=>({...t,mileage:e.target.value?Number(e.target.value):null}))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:v.fuelLevelLabel}),(0,t.jsx)("select",{className:"input-field",value:N.fuelLevel,disabled:!h,onChange:e=>k(t=>({...t,fuelLevel:e.target.value})),children:o.map(e=>(0,t.jsx)("option",{value:e,children:v.fuelLevels[e]},e))})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:v.generalConditionLabel}),(0,t.jsx)("textarea",{className:"input-field min-h-24",value:N.generalCondition??"",disabled:!h,onChange:e=>k(t=>({...t,generalCondition:e.target.value}))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:v.employeeNotesLabel}),(0,t.jsx)("textarea",{className:"input-field min-h-24",value:N.employeeNotes??"",disabled:!h,onChange:e=>k(t=>({...t,employeeNotes:e.target.value}))})]}),(0,t.jsxs)("label",{className:"flex items-center gap-3 text-sm font-medium text-slate-700",children:[(0,t.jsx)("input",{type:"checkbox",checked:N.customerAgreed,disabled:!h,onChange:e=>k(t=>({...t,customerAgreed:e.target.checked}))}),v.customerAcknowledged]}),(0,t.jsxs)("div",{className:"rounded-2xl border border-slate-200",children:[(0,t.jsx)("div",{className:"border-b border-slate-200 px-4 py-3",children:(0,t.jsx)("p",{className:"text-sm font-semibold text-slate-900",children:v.damageMarkersHeading})}),(0,t.jsxs)("div",{className:"divide-y divide-slate-100",children:[N.damagePoints.map((e,a)=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"font-medium text-slate-900",children:[v.damageTypeLabels[e.damageType]," · ",v.severityLabels[e.severity]]}),(0,t.jsxs)("p",{className:"text-xs text-slate-500",children:[e.viewType," · x ",e.x.toFixed(1)," · y ",e.y.toFixed(1)]})]}),(0,t.jsx)("button",{type:"button",onClick:()=>{k(e=>({...e,damagePoints:e.damagePoints.filter((e,t)=>t!==a)}))},disabled:!h,className:"rounded-full border border-slate-300 px-3 py-1 text-xs font-semibold text-slate-600 disabled:cursor-not-allowed disabled:opacity-50",children:v.removeMarker})]},`${e.x}-${e.y}-${a}`)),0===N.damagePoints.length&&(0,t.jsx)("div",{className:"px-4 py-6 text-sm text-slate-400",children:v.noMarkers})]})]})]})]})]})}function p({reservationId:e,type:s,editable:l,title:n,readOnlyMessage:i}){let[o,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!1),[m,h]=(0,a.useState)(null),x=(0,a.useRef)(null),b=(0,a.useCallback)(async()=>{try{let t=await (0,r.apiFetch)(`/reservations/${e}/photos`);d(t.filter(e=>e.type===s))}catch{}},[e,s]);async function g(t){if(t&&0!==t.length){u(!0),h(null);try{for(let a of Array.from(t)){let t=new FormData;t.append("photo",a),t.append("type",s),await (0,r.apiFetch)(`/reservations/${e}/photos`,{method:"POST",body:t})}await b()}catch(e){h(e.message??"Upload failed")}finally{u(!1),x.current&&(x.current.value="")}}}async function f(t){h(null);try{await (0,r.apiFetch)(`/reservations/${e}/photos/${t}`,{method:"DELETE"}),d(e=>e.filter(e=>e.id!==t))}catch(e){h(e.message??"Delete failed")}}return(0,a.useEffect)(()=>{b()},[b]),(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-base font-semibold text-slate-900",children:n}),l&&(0,t.jsx)("button",{type:"button",disabled:c,onClick:()=>x.current?.click(),className:"btn-secondary text-xs",children:c?"Uploading…":"+ Add photos"})]}),!l&&i&&(0,t.jsx)("p",{className:"mb-4 text-xs text-slate-500",children:i}),(0,t.jsx)("input",{ref:x,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>g(e.target.files)}),m&&(0,t.jsx)("p",{className:"mb-3 text-xs text-red-600",children:m}),0===o.length?(0,t.jsx)("p",{className:"text-sm text-slate-400",children:"No photos yet."}):(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4",children:o.map(e=>(0,t.jsxs)("div",{className:"group relative aspect-square overflow-hidden rounded-xl border border-slate-200",children:[(0,t.jsx)("img",{src:e.url,alt:"",className:"h-full w-full object-cover"}),l&&(0,t.jsx)("button",{type:"button",onClick:()=>f(e.id),className:"absolute right-1 top-1 hidden h-6 w-6 items-center justify-center rounded-full bg-black/60 text-white group-hover:flex","aria-label":"Delete photo",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",className:"h-3 w-3",children:(0,t.jsx)("path",{d:"M5.28 4.22a.75.75 0 0 0-1.06 1.06L6.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L8 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L9.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L8 6.94 5.28 4.22Z"})})})]},e.id))})]})}let h={en:{editBooking:"Edit booking",saveBooking:"Save booking",editReturn:"Edit return",saveReturn:"Save return",cancelEdit:"Cancel",closeReservation:"Close reservation",bookingDetails:"Booking details",returnDetails:"Return closing",startLabel:"Start date & time",endLabel:"End date & time",pickupLabel:"Pickup location",returnLabel:"Return location",depositLabel:"Deposit",paymentModeLabel:"Payment mode",bookingNotesLabel:"Booking notes",returnChargeLabel:"Damage charge",returnChargeNoteLabel:"Return note",paymentModeEmpty:"Not set",noLocation:"Not provided",failedSave:"Failed to save reservation",failedClose:"Failed to close reservation",contractLockMessage:"Contract generated. Booking details are locked and remain view-only until the vehicle is returned.",activeLockMessage:"Rental is in progress. Booking details are view-only until the vehicle is returned.",returnLockMessage:"Vehicle returned. Only the return section and the check-out inspection can still be edited before closing the reservation.",closedLockMessage:"Reservation closed. No further editing is allowed.",closedMeta:"Closed",checkoutSummary:"Check-out status",checkoutPending:"Waiting for return edits",checkoutReady:"Return section open",checkoutClosed:"Reservation closed",checkInReadOnly:"Check-in inspection is only editable after the reservation is confirmed and before return.",checkOutReadOnly:"Check-out inspection becomes editable once the vehicle is returned.",inspectionClosed:"This reservation is closed. Inspection edits are disabled.",licenseImageLabel:"License image",noLicenseImage:"No license image uploaded.",pickupPhotosTitle:"Pickup photos",dropoffPhotosTitle:"Return photos",pickupPhotosReadOnly:"Pickup photos can be added once the reservation is confirmed.",dropoffPhotosReadOnly:"Return photos become available once the vehicle is checked out.",extendBtn:"Extend rental",extendTitle:"Extend rental",extendNewEnd:"New return date & time",extendReason:"Reason for extension",extendReasonPlaceholder:"e.g. Customer requested 2 extra days",extendSubmit:"Confirm extension",extendCancel:"Cancel",extendFailed:"Failed to extend reservation"},fr:{editBooking:"Modifier la réservation",saveBooking:"Enregistrer la réservation",editReturn:"Modifier le retour",saveReturn:"Enregistrer le retour",cancelEdit:"Annuler",closeReservation:"Clôturer la réservation",bookingDetails:"Détails de la réservation",returnDetails:"Clôture du retour",startLabel:"Date et heure de départ",endLabel:"Date et heure de retour",pickupLabel:"Lieu de départ",returnLabel:"Lieu de retour",depositLabel:"Dépôt",paymentModeLabel:"Mode de paiement",bookingNotesLabel:"Notes de réservation",returnChargeLabel:"Frais de dommage",returnChargeNoteLabel:"Note de retour",paymentModeEmpty:"Non défini",noLocation:"Non renseigné",failedSave:"Échec de la sauvegarde de la réservation",failedClose:"Échec de la clôture de la réservation",contractLockMessage:"Le contrat a été généré. Les détails de la réservation sont verrouillés jusqu’au retour du véhicule.",activeLockMessage:"La location est en cours. Les détails de la réservation sont en lecture seule jusqu’au retour du véhicule.",returnLockMessage:"Le véhicule est de retour. Seule la section de retour et l’inspection de retour peuvent encore être modifiées avant la clôture.",closedLockMessage:"La réservation est clôturée. Aucune autre modification n’est autorisée.",closedMeta:"Clôturée",checkoutSummary:"Statut du retour",checkoutPending:"En attente des modifications de retour",checkoutReady:"Section retour ouverte",checkoutClosed:"Réservation clôturée",checkInReadOnly:"L’inspection de départ est modifiable après confirmation et avant le retour.",checkOutReadOnly:"L’inspection de retour devient modifiable une fois le véhicule retourné.",inspectionClosed:"Cette réservation est clôturée. Les modifications d’inspection sont désactivées.",licenseImageLabel:"Image du permis",noLicenseImage:"Aucune image de permis téléversée.",pickupPhotosTitle:"Photos de départ",dropoffPhotosTitle:"Photos de retour",pickupPhotosReadOnly:"Les photos de départ sont disponibles après confirmation de la réservation.",dropoffPhotosReadOnly:"Les photos de retour sont disponibles après la restitution du véhicule.",extendBtn:"Prolonger la location",extendTitle:"Prolonger la location",extendNewEnd:"Nouvelle date de retour",extendReason:"Motif de prolongation",extendReasonPlaceholder:"ex. Le client a demandé 2 jours supplémentaires",extendSubmit:"Confirmer la prolongation",extendCancel:"Annuler",extendFailed:"Échec de la prolongation"},ar:{editBooking:"تعديل الحجز",saveBooking:"حفظ الحجز",editReturn:"تعديل الإرجاع",saveReturn:"حفظ الإرجاع",cancelEdit:"إلغاء",closeReservation:"إغلاق الحجز",bookingDetails:"تفاصيل الحجز",returnDetails:"إقفال الإرجاع",startLabel:"تاريخ ووقت البداية",endLabel:"تاريخ ووقت النهاية",pickupLabel:"موقع الاستلام",returnLabel:"موقع الإرجاع",depositLabel:"العربون",paymentModeLabel:"طريقة الدفع",bookingNotesLabel:"ملاحظات الحجز",returnChargeLabel:"رسوم الأضرار",returnChargeNoteLabel:"ملاحظة الإرجاع",paymentModeEmpty:"غير محدد",noLocation:"غير متوفر",failedSave:"فشل حفظ الحجز",failedClose:"فشل إغلاق الحجز",contractLockMessage:"تم إنشاء العقد. تفاصيل الحجز مقفلة وتبقى للعرض فقط حتى عودة السيارة.",activeLockMessage:"التأجير قيد التنفيذ. تفاصيل الحجز للعرض فقط حتى عودة السيارة.",returnLockMessage:"تمت إعادة السيارة. يمكن تعديل قسم الإرجاع وفحص الإرجاع فقط قبل إغلاق الحجز.",closedLockMessage:"تم إغلاق الحجز. لا يُسمح بأي تعديل إضافي.",closedMeta:"مغلق",checkoutSummary:"حالة الإرجاع",checkoutPending:"بانتظار تعديلات الإرجاع",checkoutReady:"قسم الإرجاع مفتوح",checkoutClosed:"تم إغلاق الحجز",checkInReadOnly:"يمكن تعديل فحص الاستلام بعد تأكيد الحجز وقبل الإرجاع فقط.",checkOutReadOnly:"يصبح فحص الإرجاع قابلاً للتعديل بعد عودة السيارة.",inspectionClosed:"هذا الحجز مغلق. تم تعطيل تعديل الفحص.",licenseImageLabel:"صورة الرخصة",noLicenseImage:"لم يتم رفع صورة الرخصة.",pickupPhotosTitle:"صور الاستلام",dropoffPhotosTitle:"صور الإرجاع",pickupPhotosReadOnly:"تتوفر صور الاستلام بعد تأكيد الحجز.",dropoffPhotosReadOnly:"تتوفر صور الإرجاع بعد إعادة السيارة.",extendBtn:"تمديد التأجير",extendTitle:"تمديد التأجير",extendNewEnd:"تاريخ الإرجاع الجديد",extendReason:"سبب التمديد",extendReasonPlaceholder:"مثال: طلب العميل يومين إضافيين",extendSubmit:"تأكيد التمديد",extendCancel:"إلغاء",extendFailed:"فشل تمديد الحجز"}};function x(e){let t=new Date(e),a=t.getTimezoneOffset();return new Date(t.getTime()-6e4*a).toISOString().slice(0,16)}function b(e){return{startDate:x(e.startDate),endDate:x(e.endDate),pickupLocation:e.pickupLocation??"",returnLocation:e.returnLocation??"",depositAmount:String(e.depositAmount??0),paymentMode:e.paymentMode??"",notes:e.notes??"",damageChargeAmount:null!==e.damageChargeAmount&&void 0!==e.damageChargeAmount?String(e.damageChargeAmount):"",damageChargeNote:e.damageChargeNote??""}}function g(e){return new Date(e).toISOString()}e.s(["default",0,function(){let e=(0,s.useParams)(),{dict:i,language:o}=(0,n.useDashboardI18n)(),d=i.reservations,c=h[o],u="fr"===o?"fr-FR":"ar"===o?"ar-MA":"en-US",[x,f]=(0,a.useState)(null),[v,y]=(0,a.useState)([]),[N,k]=(0,a.useState)(null),[j,w]=(0,a.useState)(null),[C,L]=(0,a.useState)(null),[R,T]=(0,a.useState)(null),[E,A]=(0,a.useState)(!1),[P,M]=(0,a.useState)(!1),[O,S]=(0,a.useState)({newEndDate:"",reason:""}),[D,I]=(0,a.useState)(null);async function F(){try{let[t,a]=await Promise.all([(0,r.apiFetch)(`/reservations/${e.id}`),(0,r.apiFetch)(`/reservations/${e.id}/inspections`)]);f(t),y(a),k(b(t)),w(null),L(null)}catch(e){L(e.message??d.failedToLoad)}}async function B(t){A(!0),T(null);let a="confirm"===t?d.failedConfirm:"checkin"===t?d.failedCheckIn:d.failedCheckOut;try{await (0,r.apiFetch)(`/reservations/${e.id}/${t}`,{method:"POST",body:JSON.stringify({})}),await F()}catch(e){T(e.message??a)}finally{A(!1)}}async function H(t){if(N){A(!0),T(null);try{let a="booking"===t?{startDate:g(N.startDate),endDate:g(N.endDate),pickupLocation:N.pickupLocation||null,returnLocation:N.returnLocation||null,depositAmount:Number(N.depositAmount||0),paymentMode:N.paymentMode||null,notes:N.notes||null}:{returnLocation:N.returnLocation||null,damageChargeAmount:N.damageChargeAmount?Number(N.damageChargeAmount):0,damageChargeNote:N.damageChargeNote||null};await (0,r.apiFetch)(`/reservations/${e.id}`,{method:"PATCH",body:JSON.stringify(a)}),await F()}catch(e){T(e.message??c.failedSave)}finally{A(!1)}}}async function _(){A(!0),T(null);try{await (0,r.apiFetch)(`/reservations/${e.id}/close`,{method:"POST",body:JSON.stringify({})}),await F()}catch(e){T(e.message??c.failedClose)}finally{A(!1)}}async function U(t){A(!0),T(null);try{await (0,r.apiFetch)(`/reservations/${e.id}/additional-drivers/${t}/approval`,{method:"PATCH",body:JSON.stringify({approved:!0})}),await F()}catch(e){T(e.message??d.failedApproveDriver)}finally{A(!1)}}async function $(){if(O.newEndDate&&O.reason.trim()){A(!0),I(null);try{await (0,r.apiFetch)(`/reservations/${e.id}/extend`,{method:"POST",body:JSON.stringify({newEndDate:new Date(O.newEndDate).toISOString(),reason:O.reason})}),M(!1),S({newEndDate:"",reason:""}),await F()}catch(e){I(e.message??c.extendFailed)}finally{A(!1)}}}(0,a.useEffect)(()=>{F()},[e.id]);let K=e=>new Date(e).toLocaleDateString(u,{month:"short",day:"numeric",year:"numeric"});if(C)return(0,t.jsx)("div",{className:"card p-6 text-sm text-red-600",children:C});if(!x||!N)return(0,t.jsx)("div",{className:"card p-6 text-sm text-slate-500",children:d.loadingReservation});let q=v.find(e=>"CHECKIN"===e.type),V=v.find(e=>"CHECKOUT"===e.type),z="booking"!==j,G="return"!==j,Y="";x.workflow.closed?Y=c.closedLockMessage:x.workflow.returnEditable?Y=c.returnLockMessage:x.workflow.contractGenerated?Y=c.contractLockMessage:"ACTIVE"===x.status&&(Y=c.activeLockMessage);let J=x.workflow.closed?c.inspectionClosed:c.checkInReadOnly,W=x.workflow.closed?c.inspectionClosed:c.checkOutReadOnly;return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h2",{className:"text-xl font-semibold text-slate-900",children:["Reservation ",x.id.slice(-8).toUpperCase()]}),(0,t.jsxs)("p",{className:"mt-1 text-sm text-slate-500",children:[x.source," · ",x.status," · ",x.paymentStatus]}),x.workflow.closedAt&&(0,t.jsxs)("p",{className:"mt-2 text-xs text-slate-500",children:[c.closedMeta," ",K(x.workflow.closedAt),x.workflow.closedBy?` \xb7 ${x.workflow.closedBy}`:""]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3",children:[null===j&&x.workflow.coreEditable&&(0,t.jsx)("button",{disabled:E,onClick:()=>w("booking"),className:"btn-secondary",children:c.editBooking}),"booking"===j&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{disabled:E,onClick:()=>H("booking"),className:"btn-primary",children:E?d.working:c.saveBooking}),(0,t.jsx)("button",{disabled:E,onClick:()=>{k(b(x)),w(null)},className:"btn-secondary",children:c.cancelEdit})]}),null===j&&x.workflow.returnEditable&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{disabled:E,onClick:()=>w("return"),className:"btn-secondary",children:c.editReturn}),(0,t.jsx)("button",{disabled:E,onClick:_,className:"btn-primary",children:E?d.working:c.closeReservation})]}),"return"===j&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{disabled:E,onClick:()=>H("return"),className:"btn-primary",children:E?d.working:c.saveReturn}),(0,t.jsx)("button",{disabled:E,onClick:()=>{k(b(x)),w(null)},className:"btn-secondary",children:c.cancelEdit})]}),"DRAFT"===x.status&&(0,t.jsx)("button",{disabled:E,onClick:()=>B("confirm"),className:"btn-primary",children:E?d.working:d.confirmReservation}),"CONFIRMED"===x.status&&(0,t.jsx)("button",{disabled:E,onClick:()=>B("checkin"),className:"btn-primary",children:E?d.working:d.checkInVehicle}),"ACTIVE"===x.status&&(0,t.jsx)("button",{disabled:E,onClick:()=>B("checkout"),className:"btn-primary",children:E?d.working:d.checkOutVehicle}),["CONFIRMED","ACTIVE"].includes(x.status)&&!x.workflow.closed&&(0,t.jsx)("button",{disabled:E,onClick:()=>{M(!0),I(null)},className:"btn-secondary",children:c.extendBtn})]})]}),P&&(0,t.jsxs)("div",{className:"card border border-blue-200 bg-blue-50 p-5 space-y-4",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold text-slate-900",children:c.extendTitle}),(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-slate-700",children:c.extendNewEnd}),(0,t.jsx)("input",{type:"datetime-local",className:"input-field",value:O.newEndDate,onChange:e=>S(t=>({...t,newEndDate:e.target.value}))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-slate-700",children:c.extendReason}),(0,t.jsx)("input",{className:"input-field",placeholder:c.extendReasonPlaceholder,value:O.reason,onChange:e=>S(t=>({...t,reason:e.target.value}))})]})]}),D&&(0,t.jsx)("p",{className:"text-xs text-red-600",children:D}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)("button",{disabled:E,onClick:$,className:"btn-primary text-sm",children:E?d.working:c.extendSubmit}),(0,t.jsx)("button",{onClick:()=>{M(!1),S({newEndDate:"",reason:""})},className:"btn-secondary text-sm",children:c.extendCancel})]})]}),Y&&(0,t.jsx)("div",{className:"card border border-slate-200 bg-slate-50 p-4 text-sm text-slate-700",children:Y}),R&&(0,t.jsx)("div",{className:"card p-4 text-sm text-red-600",children:R}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:d.sectionCustomer}),(0,t.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,t.jsxs)("p",{className:"font-medium text-slate-900",children:[x.customer.firstName," ",x.customer.lastName]}),(0,t.jsx)("p",{className:"text-slate-600",children:x.customer.email}),(0,t.jsx)("p",{className:"text-slate-600",children:x.customer.phone??d.noPhone}),(0,t.jsxs)("p",{className:"text-slate-600",children:[d.licenseLabel," ",x.customer.driverLicense??d.notCaptured]}),(0,t.jsxs)("div",{className:"pt-2",children:[(0,t.jsx)("p",{className:"text-slate-600",children:c.licenseImageLabel}),x.customer.licenseImageUrl?(0,t.jsx)("a",{href:x.customer.licenseImageUrl,target:"_blank",rel:"noreferrer",className:"mt-2 block max-w-sm",children:(0,t.jsx)("img",{src:x.customer.licenseImageUrl,alt:"Driver license",className:"h-40 w-full rounded-xl border border-slate-200 object-cover"})}):(0,t.jsx)("p",{className:"text-xs text-slate-500",children:c.noLicenseImage})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[(0,t.jsx)("span",{className:"badge-gray",children:x.customer.licenseValidationStatus}),x.customer.flagged&&(0,t.jsx)("span",{className:"badge-red",children:d.flaggedBadge})]})]})]}),(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:d.sectionVehicle}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-slate-600",children:[(0,t.jsxs)("p",{className:"font-medium text-slate-900",children:[x.vehicle.make," ",x.vehicle.model]}),(0,t.jsx)("p",{children:x.vehicle.licensePlate}),(0,t.jsxs)("p",{children:[K(x.startDate)," - ",K(x.endDate)]}),(0,t.jsxs)("p",{children:[c.paymentModeLabel,": ",(0,t.jsx)("span",{className:"font-medium text-slate-900",children:x.paymentMode||c.paymentModeEmpty})]})]})]})]}),(0,t.jsxs)("div",{className:"grid gap-6 xl:grid-cols-[1.05fr_0.95fr]",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:c.bookingDetails}),(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.startLabel}),(0,t.jsx)("input",{type:"datetime-local",className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.startDate,disabled:z,onChange:e=>k(t=>t?{...t,startDate:e.target.value}:t)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.endLabel}),(0,t.jsx)("input",{type:"datetime-local",className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.endDate,disabled:z,onChange:e=>k(t=>t?{...t,endDate:e.target.value}:t)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.pickupLabel}),(0,t.jsx)("input",{className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.pickupLocation,disabled:z,onChange:e=>k(t=>t?{...t,pickupLocation:e.target.value}:t)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.returnLabel}),(0,t.jsx)("input",{className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.returnLocation,disabled:z,onChange:e=>k(t=>t?{...t,returnLocation:e.target.value}:t)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.depositLabel}),(0,t.jsx)("input",{type:"number",min:"0",className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.depositAmount,disabled:z,onChange:e=>k(t=>t?{...t,depositAmount:e.target.value}:t)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.paymentModeLabel}),(0,t.jsx)("input",{className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.paymentMode,disabled:z,onChange:e=>k(t=>t?{...t,paymentMode:e.target.value}:t)})]})]}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.bookingNotesLabel}),(0,t.jsx)("textarea",{className:"input-field min-h-24 disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.notes,disabled:z,onChange:e=>k(t=>t?{...t,notes:e.target.value}:t)})]})]}),(0,t.jsx)(p,{reservationId:x.id,type:"PICKUP",editable:x.workflow.checkInInspectionEditable,title:c.pickupPhotosTitle,readOnlyMessage:c.pickupPhotosReadOnly}),(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:c.returnDetails}),(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.returnLabel}),(0,t.jsx)("input",{className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.returnLocation,disabled:G,onChange:e=>k(t=>t?{...t,returnLocation:e.target.value}:t)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.returnChargeLabel}),(0,t.jsx)("input",{type:"number",min:"0",className:"input-field disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.damageChargeAmount,disabled:G,onChange:e=>k(t=>t?{...t,damageChargeAmount:e.target.value}:t)})]})]}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-slate-700",children:c.returnChargeNoteLabel}),(0,t.jsx)("textarea",{className:"input-field min-h-24 disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500",value:N.damageChargeNote,disabled:G,onChange:e=>k(t=>t?{...t,damageChargeNote:e.target.value}:t)})]}),(0,t.jsxs)("div",{className:"mt-4 rounded-2xl border border-slate-200 px-4 py-3 text-sm text-slate-600",children:[(0,t.jsxs)("span",{className:"font-medium text-slate-900",children:[c.checkoutSummary,":"]})," ",x.workflow.closed?c.checkoutClosed:x.workflow.returnEditable?c.checkoutReady:c.checkoutPending]})]}),(0,t.jsx)(p,{reservationId:x.id,type:"DROPOFF",editable:x.workflow.checkOutInspectionEditable,title:c.dropoffPhotosTitle,readOnlyMessage:c.dropoffPhotosReadOnly}),(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:d.sectionCharges}),(0,t.jsxs)("dl",{className:"grid gap-3 text-sm sm:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{className:"text-slate-500",children:d.chargeDiscount}),(0,t.jsx)("dd",{className:"text-slate-900",children:(0,l.formatCurrency)(x.discountAmount,"MAD")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{className:"text-slate-500",children:d.chargeInsurance}),(0,t.jsx)("dd",{className:"text-slate-900",children:(0,l.formatCurrency)(x.insuranceTotal,"MAD")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{className:"text-slate-500",children:d.chargeAdditionalDrivers}),(0,t.jsx)("dd",{className:"text-slate-900",children:(0,l.formatCurrency)(x.additionalDriverTotal,"MAD")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{className:"text-slate-500",children:d.chargePricingAdjustments}),(0,t.jsx)("dd",{className:"text-slate-900",children:(0,l.formatCurrency)(x.pricingRulesTotal,"MAD")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{className:"text-slate-500",children:d.chargeGrandTotal}),(0,t.jsx)("dd",{className:"font-semibold text-slate-900",children:(0,l.formatCurrency)(x.totalAmount,"MAD")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("dt",{className:"text-slate-500",children:c.returnChargeLabel}),(0,t.jsx)("dd",{className:"text-slate-900",children:(0,l.formatCurrency)(x.damageChargeAmount??0,"MAD")})]})]}),x.insurances.length>0&&(0,t.jsxs)("div",{className:"mt-5",children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-semibold text-slate-900",children:d.appliedInsurance}),(0,t.jsx)("div",{className:"space-y-2",children:x.insurances.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-slate-200 px-4 py-3 text-sm",children:[(0,t.jsx)("span",{className:"text-slate-700",children:e.policyName}),(0,t.jsx)("span",{className:"font-semibold text-slate-900",children:(0,l.formatCurrency)(e.totalCharge,"MAD")})]},e.id))})]}),x.pricingRulesApplied&&x.pricingRulesApplied.length>0&&(0,t.jsxs)("div",{className:"mt-5",children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-semibold text-slate-900",children:d.pricingRulesApplied}),(0,t.jsx)("div",{className:"space-y-2",children:x.pricingRulesApplied.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-slate-200 px-4 py-3 text-sm",children:[(0,t.jsx)("span",{className:"text-slate-700",children:e.name}),(0,t.jsxs)("span",{className:e.amount<0?"font-semibold text-emerald-700":"font-semibold text-orange-700",children:[e.amount<0?"-":"+",(0,l.formatCurrency)(Math.abs(e.amount),"MAD")]})]},`${e.name}-${e.amount}`))})]})]}),(0,t.jsx)(m,{reservationId:x.id,type:"CHECKIN",initialInspection:q,editable:x.workflow.checkInInspectionEditable,readOnlyMessage:J,onSaved:e=>y(t=>[...t.filter(t=>t.type!==e.type),e])}),(0,t.jsx)(m,{reservationId:x.id,type:"CHECKOUT",initialInspection:V,comparisonPoints:q?.damagePoints??[],editable:x.workflow.checkOutInspectionEditable,readOnlyMessage:W,onSaved:e=>y(t=>[...t.filter(t=>t.type!==e.type),e])})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:d.sectionAdditionalDrivers}),(0,t.jsxs)("div",{className:"space-y-3",children:[x.additionalDrivers.map(e=>(0,t.jsxs)("div",{className:"rounded-2xl border border-slate-200 p-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"font-medium text-slate-900",children:[e.firstName," ",e.lastName]}),(0,t.jsxs)("p",{className:"text-sm text-slate-500",children:[d.driverLicenseLabel," ",e.driverLicense]}),(0,t.jsxs)("p",{className:"mt-1 text-sm text-slate-600",children:[d.driverChargeLabel," ",(0,l.formatCurrency)(e.totalCharge,"MAD")]})]}),e.requiresApproval&&!e.approvedAt?(0,t.jsx)("button",{onClick:()=>U(e.id),disabled:E,className:"rounded-full bg-orange-600 px-4 py-2 text-xs font-semibold text-white",children:d.approveBtn}):(0,t.jsx)("span",{className:e.approvedAt?"badge-green":"badge-gray",children:e.approvedAt?d.approvedBadge:d.noApprovalNeeded})]}),e.approvalNote&&(0,t.jsx)("p",{className:"mt-2 text-xs text-orange-700",children:e.approvalNote})]},e.id)),0===x.additionalDrivers.length&&(0,t.jsx)("div",{className:"text-sm text-slate-400",children:d.noAdditionalDrivers})]})]}),(0,t.jsxs)("div",{className:"card p-6",children:[(0,t.jsx)("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:d.sectionInspectionSummary}),(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-slate-200 px-4 py-3",children:[(0,t.jsx)("span",{className:"text-slate-600",children:d.checkInInspectionLabel}),(0,t.jsx)("span",{className:q?"badge-green":"badge-gray",children:q?d.savedBadge:d.pendingBadge})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-slate-200 px-4 py-3",children:[(0,t.jsx)("span",{className:"text-slate-600",children:d.checkOutInspectionLabel}),(0,t.jsx)("span",{className:V?"badge-green":"badge-gray",children:V?d.savedBadge:d.pendingBadge})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-slate-200 px-4 py-3",children:[(0,t.jsx)("span",{className:"text-slate-600",children:c.returnLabel}),(0,t.jsx)("span",{className:"font-medium text-slate-900",children:x.returnLocation??c.noLocation})]})]})]})]})]})]})}],73068)}]); |