3 lines
56 KiB
JavaScript
3 lines
56 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 r(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"===r(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 s=r(a),i=new Intl.NumberFormat({en:"en-US",fr:"fr-FR",ar:"ar-MA"}[s],{minimumFractionDigits:2,maximumFractionDigits:2}).format(e/100),n=l(s,t);return"en"===s?`${n} ${i}`:`${i} ${n}`},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 r=e.e&&e.e.__createBinding||(Object.create?function(e,t,a,r){void 0===r&&(r=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,r,l)}:function(e,t,a,r){void 0===r&&(r=a),e[r]=t[a]}),l=e.e&&e.e.__exportStar||function(e,t){for(var a in e)"default"===a||Object.prototype.hasOwnProperty.call(t,a)||r(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)},64659,e=>{"use strict";let t=(0,e.i(75254).default)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",0,t],64659)},88143,(e,t,a)=>{"use strict";function r({widthInt:e,heightInt:t,blurWidth:a,blurHeight:l,blurDataURL:s,objectFit:i}){let n=a?40*a:e,o=l?40*l:t,c=n&&o?`viewBox='0 0 ${n} ${o}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${c}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${c?"none":"contain"===i?"xMidYMid":"cover"===i?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${s}'/%3E%3C/svg%3E`}Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},87690,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return s},imageConfigDefault:function(){return i}};for(var l in r)Object.defineProperty(a,l,{enumerable:!0,get:r[l]});let s=["default","imgix","cloudinary","akamai","custom"],i={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},8927,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"getImgProps",{enumerable:!0,get:function(){return c}}),e.r(33525);let r=e.r(43369),l=e.r(88143),s=e.r(87690),i=["-moz-initial","fill","none","scale-down",void 0];function n(e){return void 0!==e.default}function o(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function c({src:e,sizes:t,unoptimized:a=!1,priority:d=!1,preload:u=!1,loading:p,className:m,quality:f,width:h,height:g,fill:x=!1,style:v,overrideSrc:b,onLoad:y,onLoadingComplete:j,placeholder:w="empty",blurDataURL:N,fetchPriority:C,decoding:k="async",layout:S,objectFit:E,objectPosition:A,lazyBoundary:P,lazyRoot:R,...L},D){var M;let O,_,T,{imgConf:I,showAltText:F,blurComplete:z,defaultLoader:U}=D,B=I||s.imageConfigDefault;if("allSizes"in B)O=B;else{let e=[...B.deviceSizes,...B.imageSizes].sort((e,t)=>e-t),t=B.deviceSizes.sort((e,t)=>e-t),a=B.qualities?.sort((e,t)=>e-t);O={...B,allSizes:e,deviceSizes:t,qualities:a}}if(void 0===U)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let V=L.loader||U;delete L.loader,delete L.srcSet;let q="__next_img_default"in V;if(q){if("custom"===O.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
|
||
Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=V;V=t=>{let{config:a,...r}=t;return e(r)}}if(S){"fill"===S&&(x=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[S];e&&(v={...v,...e});let a={responsive:"100vw",fill:"100vw"}[S];a&&!t&&(t=a)}let $="",G=o(h),H=o(g);if((M=e)&&"object"==typeof M&&(n(M)||void 0!==M.src)){let t=n(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(_=t.blurWidth,T=t.blurHeight,N=N||t.blurDataURL,$=t.src,!x)if(G||H){if(G&&!H){let e=G/t.width;H=Math.round(t.height*e)}else if(!G&&H){let e=H/t.height;G=Math.round(t.width*e)}}else G=t.width,H=t.height}let Y=!d&&!u&&("lazy"===p||void 0===p);(!(e="string"==typeof e?e:$)||e.startsWith("data:")||e.startsWith("blob:"))&&(a=!0,Y=!1),O.unoptimized&&(a=!0),q&&!O.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(a=!0);let X=o(f),K=Object.assign(x?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:E,objectPosition:A}:{},F?{}:{color:"transparent"},v),W=z||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,l.getImageBlurSvg)({widthInt:G,heightInt:H,blurWidth:_,blurHeight:T,blurDataURL:N||"",objectFit:K.objectFit})}")`:`url("${w}")`,J=i.includes(K.objectFit)?"fill"===K.objectFit?"100% 100%":"cover":K.objectFit,Z=W?{backgroundSize:J,backgroundPosition:K.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:W}:{},Q=function({config:e,src:t,unoptimized:a,width:l,quality:s,sizes:i,loader:n}){if(a){if(t.startsWith("/")&&!t.startsWith("//")){let e=(0,r.getDeploymentId)();if(e){let a=t.indexOf("?");if(-1!==a){let r=new URLSearchParams(t.slice(a+1));r.get("dpl")||(r.append("dpl",e),t=t.slice(0,a)+"?"+r.toString())}else t+=`?dpl=${e}`}}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:o,kind:c}=function({deviceSizes:e,allSizes:t},a,r){if(r){let a=/(^|\s)(1?\d?\d)vw/g,l=[];for(let e;e=a.exec(r);)l.push(parseInt(e[2]));if(l.length){let a=.01*Math.min(...l);return{widths:t.filter(t=>t>=e[0]*a),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof a?{widths:e,kind:"w"}:{widths:[...new Set([a,2*a].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,l,i),d=o.length-1;return{sizes:i||"w"!==c?i:"100vw",srcSet:o.map((a,r)=>`${n({config:e,src:t,quality:s,width:a})} ${"w"===c?a:r+1}${c}`).join(", "),src:n({config:e,src:t,quality:s,width:o[d]})}}({config:O,src:e,unoptimized:a,width:G,quality:X,sizes:t,loader:V}),ee=Y?"lazy":p;return{props:{...L,loading:ee,fetchPriority:C,width:G,height:H,decoding:k,className:m,style:{...K,...Z},sizes:Q.sizes,srcSet:Q.srcSet,src:b||Q.src},meta:{unoptimized:a,preload:u||d,placeholder:w,fill:x}}}},98879,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return n}});let r=e.r(71645),l="u"<typeof window,s=l?()=>{}:r.useLayoutEffect,i=l?()=>{}:r.useEffect;function n(e){let{headManager:t,reduceComponentsToState:a}=e;function n(){if(t&&t.mountedInstances){let e=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(a(e))}}return l&&(t?.mountedInstances?.add(e.children),n()),s(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),s(()=>(t&&(t._pendingUpdate=n),()=>{t&&(t._pendingUpdate=n)})),i(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},25633,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={default:function(){return h},defaultHead:function(){return u}};for(var l in r)Object.defineProperty(a,l,{enumerable:!0,get:r[l]});let s=e.r(63141),i=e.r(51836),n=e.r(43476),o=i._(e.r(71645)),c=s._(e.r(98879)),d=e.r(42732);function u(){return[(0,n.jsx)("meta",{charSet:"utf-8"},"charset"),(0,n.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function p(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===o.default.Fragment?e.concat(o.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}e.r(33525);let m=["name","httpEquiv","charSet","itemProp"];function f(e){let t,a,r,l;return e.reduce(p,[]).reverse().concat(u().reverse()).filter((t=new Set,a=new Set,r=new Set,l={},e=>{let s=!0,i=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){i=!0;let a=e.key.slice(e.key.indexOf("$")+1);t.has(a)?s=!1:t.add(a)}switch(e.type){case"title":case"base":a.has(e.type)?s=!1:a.add(e.type);break;case"meta":for(let t=0,a=m.length;t<a;t++){let a=m[t];if(e.props.hasOwnProperty(a))if("charSet"===a)r.has(a)?s=!1:r.add(a);else{let t=e.props[a],r=l[a]||new Set;("name"!==a||!i)&&r.has(t)?s=!1:(r.add(t),l[a]=r)}}}return s})).reverse().map((e,t)=>{let a=e.key||t;return o.default.cloneElement(e,{key:a})})}let h=function({children:e}){let t=(0,o.useContext)(d.HeadManagerContext);return(0,n.jsx)(c.default,{reduceComponentsToState:f,headManager:t,children:e})};("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},18556,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"ImageConfigContext",{enumerable:!0,get:function(){return s}});let r=e.r(63141)._(e.r(71645)),l=e.r(87690),s=r.default.createContext(l.imageConfigDefault)},65856,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"RouterContext",{enumerable:!0,get:function(){return r}});let r=e.r(63141)._(e.r(71645)).default.createContext(null)},70965,(e,t,a)=>{"use strict";function r(e,t){let a=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-a)<Math.abs(e-a)?t:e,t.qualities[0]):a}Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"findClosestQuality",{enumerable:!0,get:function(){return r}})},1948,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return i}});let r=e.r(70965),l=e.r(43369);function s({config:e,src:t,width:a,quality:i}){let n=(0,l.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")){let e=t.indexOf("?");if(-1!==e){let a=new URLSearchParams(t.slice(e+1)),r=a.get("dpl");if(r){n=r,a.delete("dpl");let l=a.toString();t=t.slice(0,e)+(l?"?"+l:"")}}}if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
|
||
Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let o=(0,r.findClosestQuality)(i,e);return`${e.path}?url=${encodeURIComponent(t)}&w=${a}&q=${o}${t.startsWith("/")&&n?`&dpl=${n}`:""}`}s.__next_img_default=!0;let i=s},5500,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"Image",{enumerable:!0,get:function(){return y}});let r=e.r(63141),l=e.r(51836),s=e.r(43476),i=l._(e.r(71645)),n=r._(e.r(74080)),o=r._(e.r(25633)),c=e.r(8927),d=e.r(87690),u=e.r(18556);e.r(33525);let p=e.r(65856),m=r._(e.r(1948)),f=e.r(18581),h={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/dashboard/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,a,r,l,s,i){let n=e?.src;e&&e["data-loaded-src"]!==n&&(e["data-loaded-src"]=n,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&l(!0),a?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,l=!1;a.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>l,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{l=!0,t.stopPropagation()}})}r?.current&&r.current(e)}}))}function x(e){return i.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let v=(0,i.forwardRef)(({src:e,srcSet:t,sizes:a,height:r,width:l,decoding:n,className:o,style:c,fetchPriority:d,placeholder:u,loading:p,unoptimized:m,fill:h,onLoadRef:v,onLoadingCompleteRef:b,setBlurComplete:y,setShowAltText:j,sizesInput:w,onLoad:N,onError:C,...k},S)=>{let E=(0,i.useCallback)(e=>{e&&(C&&(e.src=e.src),e.complete&&g(e,u,v,b,y,m,w))},[e,u,v,b,y,C,m,w]),A=(0,f.useMergedRef)(S,E);return(0,s.jsx)("img",{...k,...x(d),loading:p,width:l,height:r,decoding:n,"data-nimg":h?"fill":"1",className:o,style:c,sizes:a,srcSet:t,src:e,ref:A,onLoad:e=>{g(e.currentTarget,u,v,b,y,m,w)},onError:e=>{j(!0),"empty"!==u&&y(!0),C&&C(e)}})});function b({isAppRouter:e,imgAttributes:t}){let a={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...x(t.fetchPriority)};return e&&n.default.preload?(n.default.preload(t.src,a),null):(0,s.jsx)(o.default,{children:(0,s.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...a},"__nimg-"+t.src+t.srcSet+t.sizes)})}let y=(0,i.forwardRef)((e,t)=>{let a=(0,i.useContext)(p.RouterContext),r=(0,i.useContext)(u.ImageConfigContext),l=(0,i.useMemo)(()=>{let e=h||r||d.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),a=e.deviceSizes.sort((e,t)=>e-t),l=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:a,qualities:l,localPatterns:"u"<typeof window?r?.localPatterns:e.localPatterns}},[r]),{onLoad:n,onLoadingComplete:o}=e,f=(0,i.useRef)(n);(0,i.useEffect)(()=>{f.current=n},[n]);let g=(0,i.useRef)(o);(0,i.useEffect)(()=>{g.current=o},[o]);let[x,y]=(0,i.useState)(!1),[j,w]=(0,i.useState)(!1),{props:N,meta:C}=(0,c.getImgProps)(e,{defaultLoader:m.default,imgConf:l,blurComplete:x,showAltText:j});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v,{...N,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:f,onLoadingCompleteRef:g,setBlurComplete:y,setShowAltText:w,sizesInput:e.sizes,ref:t}),C.preload?(0,s.jsx)(b,{isAppRouter:!a,imgAttributes:N}):null]})});("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},94909,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={default:function(){return d},getImageProps:function(){return c}};for(var l in r)Object.defineProperty(a,l,{enumerable:!0,get:r[l]});let s=e.r(63141),i=e.r(8927),n=e.r(5500),o=s._(e.r(1948));function c(e){let{props:t}=(0,i.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/dashboard/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,a]of Object.entries(t))void 0===a&&delete t[e];return{props:t}}let d=n.Image},57688,(e,t,a)=>{t.exports=e.r(94909)},12426,e=>{"use strict";let t=(0,e.i(75254).default)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);e.s(["DollarSign",0,t],12426)},7233,e=>{"use strict";let t=(0,e.i(75254).default)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],7233)},88511,e=>{"use strict";let t=(0,e.i(75254).default)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);e.s(["Edit",0,t],88511)},69074,e=>{"use strict";let t=(0,e.i(75254).default)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);e.s(["Upload",0,t],69074)},37727,e=>{"use strict";let t=(0,e.i(75254).default)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",0,t],37727)},98841,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(7233),l=e.i(88511),s=e.i(75254);let i=(0,s.default)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),n=(0,s.default)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var o=e.i(69074),c=e.i(37727),d=e.i(64659),u=e.i(12426),p=e.i(57688),m=e.i(22016),f=e.i(94327),h=e.i(64712),g=e.i(56322);let x={AVAILABLE:"badge-green",RESERVED:"badge-blue",READY:"badge-purple",RENTED:"badge-indigo",RETURNED:"badge-amber",NEEDS_CLEANING:"badge-amber",MAINTENANCE:"badge-amber",DAMAGE_REVIEW:"badge-red",OUT_OF_SERVICE:"badge-red"},v=["AVAILABLE","RESERVED","READY","RENTED","RETURNED","NEEDS_CLEANING","MAINTENANCE","DAMAGE_REVIEW","OUT_OF_SERVICE"],b={AVAILABLE:"bg-green-500",RESERVED:"bg-blue-500",READY:"bg-teal-500",RENTED:"bg-indigo-500",RETURNED:"bg-amber-400",NEEDS_CLEANING:"bg-amber-500",MAINTENANCE:"bg-orange-500",DAMAGE_REVIEW:"bg-red-400",OUT_OF_SERVICE:"bg-red-600"};function y({vehicleId:e,vehicleName:r,open:l,onClose:s,onSaved:i}){let{dict:n}=(0,g.useDashboardI18n)(),o=n.fleet,c=new Date().toISOString().slice(0,10),[d,u]=(0,a.useState)({type:"",description:"",cost:"",mileage:"",performedAt:c,nextDueAt:""}),[p,m]=(0,a.useState)(!1),[h,x]=(0,a.useState)(null),v=()=>{u({type:"",description:"",cost:"",mileage:"",performedAt:c,nextDueAt:""}),x(null),s()},b=async t=>{if(t.preventDefault(),!d.type)return void x(o.maintenanceTypeRequired);m(!0),x(null);try{await (0,f.apiFetch)(`/vehicles/${e}/maintenance`,{method:"POST",body:JSON.stringify({type:d.type,description:d.description||void 0,cost:d.cost?Math.round(100*parseFloat(d.cost)):void 0,mileage:d.mileage?parseInt(d.mileage):void 0,performedAt:new Date(d.performedAt).toISOString(),nextDueAt:d.nextDueAt?new Date(d.nextDueAt).toISOString():void 0})}),i(),v()}catch(e){x(e.message??o.failedToSave)}finally{m(!1)}};return l?(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-blue-950/40",onClick:e=>{e.target===e.currentTarget&&v()},children:(0,t.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-md mx-4 p-6",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-1",children:o.logMaintenance}),(0,t.jsx)("p",{className:"text-sm text-slate-500 mb-5",children:o.maintenanceSubtitle(r)}),h&&(0,t.jsx)("div",{className:"px-3 py-2 mb-4 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:h}),(0,t.jsxs)("form",{onSubmit:b,className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:o.typeLabel}),(0,t.jsx)("input",{className:"input-field",placeholder:o.typePlaceholder,value:d.type,onChange:e=>u({...d,type:e.target.value}),autoFocus:!0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:o.description}),(0,t.jsx)("textarea",{className:"input-field resize-none",rows:2,placeholder:o.descriptionPlaceholder,value:d.description,onChange:e=>u({...d,description:e.target.value})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:o.date}),(0,t.jsx)("input",{type:"date",className:"input-field",value:d.performedAt,onChange:e=>u({...d,performedAt:e.target.value})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:o.nextDueDate}),(0,t.jsx)("input",{type:"date",className:"input-field",value:d.nextDueAt,onChange:e=>u({...d,nextDueAt:e.target.value})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:o.cost}),(0,t.jsx)("input",{type:"number",className:"input-field",placeholder:"0.00",min:"0",step:"0.01",value:d.cost,onChange:e=>u({...d,cost:e.target.value})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:o.odometer}),(0,t.jsx)("input",{type:"number",className:"input-field",placeholder:"e.g. 52000",min:"0",value:d.mileage,onChange:e=>u({...d,mileage:e.target.value})})]})]}),(0,t.jsxs)("div",{className:"flex gap-3 pt-1",children:[(0,t.jsx)("button",{type:"button",onClick:v,className:"btn-secondary flex-1",children:o.skip}),(0,t.jsx)("button",{type:"submit",disabled:p,className:"btn-primary flex-1",children:p?o.saving:o.saveLog})]})]})]})}):null}function j({vehicleId:e,status:r,onStatusChange:l}){let{dict:s}=(0,g.useDashboardI18n)(),i=s.fleet,[n,o]=(0,a.useState)(!1),[c,u]=(0,a.useState)(!1),[p,m]=(0,a.useState)({top:0,left:0}),h=(0,a.useRef)(null),y=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!n)return;let e=e=>{h.current?.contains(e.target)||y.current?.contains(e.target)||o(!1)},t=()=>o(!1);return document.addEventListener("mousedown",e),window.addEventListener("scroll",t,!0),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("scroll",t,!0)}},[n]);let w=async t=>{if(t===r)return void o(!1);o(!1),u(!0);try{await (0,f.apiFetch)(`/vehicles/${e}/status`,{method:"PATCH",body:JSON.stringify({status:t})}),l(e,t)}catch(e){alert(e.message)}finally{u(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{ref:h,onClick:()=>{if(h.current){let e=h.current.getBoundingClientRect();m({top:e.bottom+4,left:e.left})}o(!0)},disabled:c,className:`inline-flex items-center gap-1 ${x[r]} cursor-pointer select-none`,children:[c?"…":i.statusLabels[r],(0,t.jsx)(d.ChevronDown,{className:"w-3 h-3 opacity-60"})]}),n&&(0,t.jsx)("div",{ref:y,style:{top:p.top,left:p.left},className:"fixed z-50 min-w-[160px] rounded-xl border border-slate-100 bg-white shadow-lg py-1",children:v.map(e=>(0,t.jsxs)("button",{onClick:()=>w(e),className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-start hover:bg-slate-50 transition-colors ${e===r?"font-semibold":""}`,children:[(0,t.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${b[e]}`}),i.statusLabels[e]]},e))})]})}let w=["White","Black","Silver","Gray","Red","Blue","Green","Yellow","Orange","Brown","Beige","Gold"],N=["Audi","BMW","Chevrolet","Citroën","Dacia","Fiat","Ford","Honda","Hyundai","Kia","Mazda","Mercedes-Benz","Nissan","Opel","Peugeot","Renault","Seat","Skoda","Suzuki","Toyota","Volkswagen","Volvo"],C={Audi:["A1","A3","A4","A5","A6","A7","A8","Q2","Q3","Q5","Q7","Q8","TT"],BMW:["116i","118i","120i","218i","316i","318i","320i","325i","X1","X2","X3","X4","X5","X6","X7"],Chevrolet:["Aveo","Captiva","Cruze","Malibu","Spark","Trax"],Citroën:["Berlingo","C1","C3","C3 Aircross","C4","C4 Cactus","C5","C5 Aircross","Jumpy","SpaceTourer"],Dacia:["Dokker","Duster","Jogger","Lodgy","Logan","Sandero","Spring"],Fiat:["500","500X","Bravo","Doblo","Ducato","Panda","Punto","Tipo"],Ford:["B-Max","C-Max","EcoSport","Edge","Explorer","Fiesta","Focus","Fusion","Kuga","Mondeo","Mustang","Puma","Ranger","S-Max","Transit"],Honda:["Accord","Civic","CR-V","HR-V","Jazz","Pilot"],Hyundai:["Accent","Creta","Elantra","i10","i20","i30","ix35","Kona","Santa Fe","Sonata","Tucson"],Kia:["Carnival","Ceed","Niro","Optima","Picanto","Rio","Sorento","Soul","Sportage","Stinger"],Mazda:["2","3","6","CX-3","CX-5","CX-9","MX-5"],"Mercedes-Benz":["A-Class","B-Class","C-Class","CLA","E-Class","GLA","GLB","GLC","GLE","GLS","S-Class","Sprinter","Vito"],Nissan:["Juke","Leaf","Micra","Murano","Navara","Note","Pathfinder","Patrol","Pulsar","Qashqai","X-Trail"],Opel:["Astra","Corsa","Crossland","Grandland","Insignia","Meriva","Mokka","Zafira"],Peugeot:["108","208","2008","3008","308","4008","408","5008","508","Boxer","Expert","Partner","Traveller"],Renault:["Arkana","Captur","Clio","Duster","Espace","Grand Scenic","Kadjar","Kangoo","Koleos","Laguna","Master","Megane","Scenic","Talisman","Trafic","Twingo","Zoe"],Seat:["Arona","Arosa","Ateca","Ibiza","Leon","Tarraco","Toledo"],Skoda:["Fabia","Karoq","Kodiaq","Octavia","Rapid","Scala","Superb","Yeti"],Suzuki:["Alto","Baleno","Celerio","Ignis","Jimny","S-Cross","Swift","Vitara"],Toyota:["Auris","Avensis","Aygo","Camry","Corolla","C-HR","Fortuner","Hilux","Land Cruiser","Prius","RAV4","Rush","Urban Cruiser","Yaris"],Volkswagen:["Amarok","Arteon","Caddy","Golf","ID.3","ID.4","Passat","Polo","Sharan","T-Cross","T-Roc","Tiguan","Touareg","Touran","Transporter","Up"],Volvo:["S60","S90","V40","V60","V90","XC40","XC60","XC90"]};function k(e){return e.split(",").map(e=>e.trim()).filter(Boolean)}function S({open:e,onClose:r,onSaved:l}){let{dict:s}=(0,g.useDashboardI18n)(),i=s.fleet,[n,d]=(0,a.useState)({make:"",model:"",year:new Date().getFullYear(),category:"ECONOMY",licensePlate:"",vin:"",color:"",seats:5,transmission:"MANUAL",fuelType:"GASOLINE",mileage:"",pickupLocations:"",allowDifferentDropoff:!1,dropoffLocations:""}),[u,m]=(0,a.useState)(""),[h,x]=(0,a.useState)(""),[v,b]=(0,a.useState)(""),[y,j]=(0,a.useState)([]),[E,A]=(0,a.useState)([]),[P,R]=(0,a.useState)(!1),[L,D]=(0,a.useState)(null),M=(0,a.useRef)(null),O=()=>{d({make:"",model:"",year:new Date().getFullYear(),category:"ECONOMY",licensePlate:"",vin:"",color:"",seats:5,transmission:"MANUAL",fuelType:"GASOLINE",mileage:"",pickupLocations:"",allowDifferentDropoff:!1,dropoffLocations:""}),m(""),x(""),b(""),E.forEach(e=>URL.revokeObjectURL(e)),j([]),A([]),D(null),r()},_=async e=>{if(e.preventDefault(),!n.make)return void D(i.makeMissing);if(!n.model)return void D(i.modelMissing);if(!n.licensePlate)return void D(i.plateMissing);if(n.allowDifferentDropoff&&0===k(n.dropoffLocations).length)return void D(i.dropoffLocationsRequired);R(!0),D(null);try{let e=await (0,f.apiFetch)("/vehicles",{method:"POST",body:JSON.stringify({...n,year:Number(n.year),seats:Number(n.seats),vin:n.vin.trim()||void 0,mileage:n.mileage?Number(n.mileage):void 0,pickupLocations:k(n.pickupLocations),allowDifferentDropoff:n.allowDifferentDropoff,dropoffLocations:n.allowDifferentDropoff?k(n.dropoffLocations):[]})});if(y.length>0){let t=new FormData;y.forEach(e=>t.append("photos",e)),await (0,f.apiFetch)(`/vehicles/${e.id}/photos`,{method:"POST",body:t})}l(),O()}catch(e){D(e.message??i.failedToAdd)}finally{R(!1)}};if(!e)return null;let T=n.make&&C[n.make]?C[n.make]:null;return(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-blue-950/40",onClick:e=>{e.target===e.currentTarget&&O()},children:(0,t.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg mx-4 p-6 max-h-[90vh] overflow-y-auto",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-5",children:i.addNewVehicle}),L&&(0,t.jsx)("div",{className:"px-3 py-2 mb-4 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:L}),(0,t.jsxs)("form",{onSubmit:_,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.make}),(0,t.jsxs)("select",{className:"input-field",value:h,onChange:e=>{x(e.target.value),b(""),"custom"!==e.target.value?d({...n,make:e.target.value,model:""}):d({...n,make:"",model:""})},children:[(0,t.jsx)("option",{value:"",children:i.selectMake}),N.map(e=>(0,t.jsx)("option",{value:e,children:e},e)),(0,t.jsx)("option",{value:"custom",children:i.other})]}),"custom"===h&&(0,t.jsx)("input",{className:"input-field mt-2",placeholder:i.typeMake,required:!0,value:n.make,onChange:e=>d({...n,make:e.target.value}),autoFocus:!0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.model}),T?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("select",{className:"input-field",value:v,onChange:e=>{b(e.target.value),"custom"!==e.target.value?d({...n,model:e.target.value}):d({...n,model:""})},children:[(0,t.jsx)("option",{value:"",children:i.selectModel}),T.map(e=>(0,t.jsx)("option",{value:e,children:e},e)),(0,t.jsx)("option",{value:"custom",children:i.other})]}),"custom"===v&&(0,t.jsx)("input",{className:"input-field mt-2",placeholder:i.typeModel,required:!0,value:n.model,onChange:e=>d({...n,model:e.target.value}),autoFocus:!0})]}):(0,t.jsx)("input",{className:"input-field",placeholder:i.typeModel,required:!0,value:n.model,onChange:e=>d({...n,model:e.target.value})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.year}),(0,t.jsx)("input",{type:"number",className:"input-field",min:"1990",max:new Date().getFullYear()+1,required:!0,value:n.year,onChange:e=>d({...n,year:Number(e.target.value)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.category}),(0,t.jsx)("select",{className:"input-field",value:n.category,onChange:e=>d({...n,category:e.target.value}),children:["ECONOMY","COMPACT","MIDSIZE","FULLSIZE","SUV","LUXURY","VAN","TRUCK"].map(e=>(0,t.jsx)("option",{value:e,children:i.categoryLabels[e]},e))})]})]}),(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.licensePlate}),(0,t.jsx)("input",{className:"input-field",placeholder:"AB-1234-CD",required:!0,value:n.licensePlate,onChange:e=>d({...n,licensePlate:e.target.value})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.vin}),(0,t.jsx)("input",{className:"input-field",placeholder:"1HGCM82633A123456",value:n.vin,onChange:e=>d({...n,vin:e.target.value})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.color}),(0,t.jsxs)("select",{className:"input-field",value:u,onChange:e=>{m(e.target.value),"custom"!==e.target.value?d({...n,color:e.target.value}):d({...n,color:""})},children:[(0,t.jsx)("option",{value:"",children:i.select}),w.map(e=>(0,t.jsx)("option",{value:e,children:e},e)),(0,t.jsx)("option",{value:"custom",children:i.other})]}),"custom"===u&&(0,t.jsx)("input",{className:"input-field mt-2",placeholder:i.typeColor,value:n.color,onChange:e=>d({...n,color:e.target.value}),autoFocus:!0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.seats}),(0,t.jsx)("input",{type:"number",className:"input-field",min:"2",max:"15",value:n.seats,onChange:e=>d({...n,seats:Number(e.target.value)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.transmission}),(0,t.jsxs)("select",{className:"input-field",value:n.transmission,onChange:e=>d({...n,transmission:e.target.value}),children:[(0,t.jsx)("option",{value:"MANUAL",children:i.manual}),(0,t.jsx)("option",{value:"AUTOMATIC",children:i.automatic})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.fuelType}),(0,t.jsx)("select",{className:"input-field",value:n.fuelType,onChange:e=>d({...n,fuelType:e.target.value}),children:["GASOLINE","DIESEL","ELECTRIC","HYBRID"].map(e=>(0,t.jsx)("option",{value:e,children:i.fuelTypeLabels[e]},e))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.odometer}),(0,t.jsx)("input",{type:"number",className:"input-field",placeholder:"e.g. 45000",min:"0",value:n.mileage,onChange:e=>d({...n,mileage:e.target.value})})]})]}),(0,t.jsxs)("div",{className:"space-y-4 rounded-xl border border-slate-200 bg-slate-50 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.pickupLocations}),(0,t.jsx)("textarea",{className:"input-field resize-none",rows:2,placeholder:i.pickupLocationsPlaceholder,value:n.pickupLocations,onChange:e=>d({...n,pickupLocations:e.target.value})}),(0,t.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:i.locationHint})]}),(0,t.jsxs)("label",{className:"flex items-center gap-3 rounded-lg border border-slate-200 bg-white px-3 py-3 text-sm font-medium text-slate-700",children:[(0,t.jsx)("input",{type:"checkbox",checked:n.allowDifferentDropoff,onChange:e=>d({...n,allowDifferentDropoff:e.target.checked,dropoffLocations:e.target.checked?n.dropoffLocations:""}),className:"h-4 w-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"}),(0,t.jsx)("span",{children:i.allowDifferentDropoff})]}),n.allowDifferentDropoff&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.dropoffLocations}),(0,t.jsx)("textarea",{className:"input-field resize-none",rows:2,placeholder:i.dropoffLocationsPlaceholder,value:n.dropoffLocations,onChange:e=>d({...n,dropoffLocations:e.target.value})}),(0,t.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:i.locationHint})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-medium text-slate-500 mb-1.5",children:i.photosLabel}),E.length>0&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:E.map((e,a)=>(0,t.jsxs)("div",{className:"relative h-24 rounded-lg overflow-hidden bg-slate-100 group",children:[(0,t.jsx)(p.default,{src:e,alt:`preview ${a+1}`,fill:!0,className:"object-cover",unoptimized:!0}),(0,t.jsx)("button",{type:"button",onClick:()=>{let e,t;return URL.revokeObjectURL(E[a]),e=y.filter((e,t)=>t!==a),t=E.filter((e,t)=>t!==a),void(j(e),A(t))},className:"absolute top-1 right-1 p-0.5 bg-blue-950/60 text-white rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:(0,t.jsx)(c.X,{className:"w-3 h-3"})})]},a))}),y.length<10&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{let t=Array.from(e.target.files??[]);if(!t.length)return;let a=[...y,...t].slice(0,10);j(a),A(a.map(e=>URL.createObjectURL(e))),e.target.value=""}}),(0,t.jsxs)("button",{type:"button",onClick:()=>M.current?.click(),className:"w-full flex items-center justify-center gap-2 px-4 py-3 border-2 border-dashed border-slate-200 rounded-xl text-sm text-slate-500 hover:border-slate-300 hover:text-slate-700 transition-colors",children:[(0,t.jsx)(o.Upload,{className:"w-4 h-4"}),0===y.length?i.clickToAddPhotos:i.addMorePhotos]})]})]}),(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,t.jsx)("button",{type:"button",onClick:O,className:"btn-secondary flex-1",children:i.cancel}),(0,t.jsx)("button",{type:"submit",disabled:P,className:"btn-primary flex-1",children:P?i.adding:i.addVehicle})]})]})]})})}e.s(["default",0,function(){let{dict:e}=(0,g.useDashboardI18n)(),s=e.fleet,[o,c]=(0,a.useState)([]),[d,p]=(0,a.useState)(!0),[x,b]=(0,a.useState)(null),[w,N]=(0,a.useState)(!1),[C,k]=(0,a.useState)(""),[E,A]=(0,a.useState)(""),[P,R]=(0,a.useState)(""),[L,D]=(0,a.useState)(""),[M,O]=(0,a.useState)(null),_=()=>{p(!0),(0,f.apiFetch)("/vehicles?pageSize=100").then(e=>c(e??[])).catch(e=>b(e.message)).finally(()=>p(!1))};(0,a.useEffect)(()=>{_()},[]);let T=async(e,t)=>{try{await (0,f.apiFetch)(`/vehicles/${e}`,{method:"PATCH",body:JSON.stringify({isPublished:!t})}),c(a=>a.map(a=>a.id===e?{...a,isPublished:!t}:a))}catch(e){alert(e.message)}},I=new Set(["AVAILABLE","RESERVED","READY","RENTED"]),F=(e,t)=>{let a=I.has(t);if(c(r=>r.map(r=>r.id===e?{...r,status:t,isPublished:a}:r)),A(""),"MAINTENANCE"===t){let t=o.find(t=>t.id===e);t&&O({vehicleId:e,vehicleName:`${t.make} ${t.model}`})}},z=o.filter(e=>(!C||!!`${e.make} ${e.model} ${e.licensePlate} ${e.vin??""}`.toLowerCase().includes(C.toLowerCase()))&&(!E||e.status===E)&&(!P||e.category===P)&&("published"!==L||!!e.isPublished)&&("unpublished"!==L||!e.isPublished));return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-slate-900",children:s.heading}),(0,t.jsx)("p",{className:"text-sm text-slate-500 mt-0.5",children:s.vehicleCount(o.length)})]}),(0,t.jsxs)("button",{onClick:()=>N(!0),className:"btn-primary",children:[(0,t.jsx)(r.Plus,{className:"w-4 h-4"})," ",s.addVehicle]})]}),(0,t.jsxs)("div",{className:"card p-4 flex flex-wrap gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-48",children:[(0,t.jsx)(n,{className:"w-4 h-4 text-slate-400"}),(0,t.jsx)("input",{className:"flex-1 text-sm outline-none placeholder:text-slate-400",placeholder:s.searchPlaceholder,value:C,onChange:e=>k(e.target.value)})]}),(0,t.jsxs)("select",{className:"input-field w-36",value:E,onChange:e=>A(e.target.value),children:[(0,t.jsx)("option",{value:"",children:s.allStatuses}),v.map(e=>(0,t.jsx)("option",{value:e,children:s.statusLabels[e]},e))]}),(0,t.jsxs)("select",{className:"input-field w-36",value:P,onChange:e=>R(e.target.value),children:[(0,t.jsx)("option",{value:"",children:s.allCategories}),["ECONOMY","COMPACT","MIDSIZE","FULLSIZE","SUV","LUXURY","VAN","TRUCK"].map(e=>(0,t.jsx)("option",{value:e,children:s.categoryLabels[e]},e))]}),(0,t.jsxs)("select",{className:"input-field w-36",value:L,onChange:e=>D(e.target.value),children:[(0,t.jsx)("option",{value:"",children:s.allVisibility}),(0,t.jsx)("option",{value:"published",children:s.published}),(0,t.jsx)("option",{value:"unpublished",children:s.unpublished})]})]}),(0,t.jsx)("div",{className:"card overflow-hidden",children:d?(0,t.jsx)("div",{className:"flex items-center justify-center h-48",children:(0,t.jsx)("div",{className:"w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"})}):x?(0,t.jsx)("div",{className:"p-8 text-center",children:(0,t.jsx)("p",{className:"text-red-600 font-medium",children:x})}):(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-slate-100 bg-slate-50",children:[(0,t.jsx)("th",{className:"text-start px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:s.colVehicle}),(0,t.jsx)("th",{className:"text-start px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:s.colCategory}),(0,t.jsx)("th",{className:"text-start px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:s.colStatus}),(0,t.jsx)("th",{className:"text-start px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:s.colDailyRate}),(0,t.jsx)("th",{className:"text-start px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:s.colPublished}),(0,t.jsx)("th",{className:"text-end px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:s.colActions})]})}),(0,t.jsxs)("tbody",{className:"divide-y divide-slate-100",children:[z.map(e=>(0,t.jsxs)("tr",{className:"hover:bg-slate-50 transition-colors",children:[(0,t.jsx)("td",{className:"px-6 py-4",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm font-semibold text-slate-900",children:[e.make," ",e.model]}),(0,t.jsxs)("p",{className:"text-xs text-slate-400",children:[e.year," · ",e.licensePlate,e.vin?` \xb7 ${e.vin}`:""]})]})}),(0,t.jsx)("td",{className:"px-6 py-4",children:(0,t.jsx)("span",{className:"badge-gray",children:s.categoryLabels[e.category]??e.category})}),(0,t.jsx)("td",{className:"px-6 py-4",children:(0,t.jsx)(j,{vehicleId:e.id,status:e.status,onStatusChange:F})}),(0,t.jsxs)("td",{className:"px-6 py-4 text-sm font-medium text-slate-900",children:[(0,h.formatCurrency)(e.dailyRate,"MAD"),s.perDay]}),(0,t.jsx)("td",{className:"px-6 py-4",children:(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("button",{onClick:()=>T(e.id,e.isPublished),className:["relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus:outline-none",e.isPublished?"bg-blue-600":"bg-slate-200"].join(" "),children:(0,t.jsx)("span",{className:["pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform transition duration-200",e.isPublished?"ltr:translate-x-5 rtl:-translate-x-5":"translate-x-0"].join(" ")})})})}),(0,t.jsx)("td",{className:"px-6 py-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 rtl:justify-start",children:[(0,t.jsx)(m.default,{href:`/fleet/${e.id}?tab=pricing`,title:"Manage pricing","aria-label":"Manage pricing",className:"p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-lg transition-colors",children:(0,t.jsx)(u.DollarSign,{className:"w-4 h-4"})}),(0,t.jsx)(m.default,{href:`/fleet/${e.id}`,className:"p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-lg transition-colors",children:(0,t.jsx)(i,{className:"w-4 h-4"})}),(0,t.jsx)(m.default,{href:`/fleet/${e.id}`,className:"p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-lg transition-colors",children:(0,t.jsx)(l.Edit,{className:"w-4 h-4"})})]})})]},e.id)),0===z.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:6,className:"px-6 py-12 text-center text-sm text-slate-400",children:0===o.length?s.noVehicles:s.noMatch})})]})]})})}),(0,t.jsx)(S,{open:w,onClose:()=>N(!1),onSaved:_}),M&&(0,t.jsx)(y,{vehicleId:M.vehicleId,vehicleName:M.vehicleName,open:!0,onClose:()=>O(null),onSaved:()=>O(null)})]})}],98841)}]); |