PageSourceSearch

https://cabscarhire.com/assets/js/PublicAccountPage-ByLYtnNy.js

js cabscarhire.com collected 2026-10-09 22:12:57 UTC 9,348 bytes, 1 lines download raw bytes

1import{r as P,j as e,ai as p,ad as n,T as r,aj as K,ac as c,Y as i,az as N,aX as u,aY as m,ae as T}from"./ui-vendor-DcqczWg0.js";import{u as V,b as R,o as A,s as a,e as O,g as G}from"./form-vendor-DByqpEq1.js";import{c as Y,u as W,b as $}from"./query-vendor-DdVZ69Gq.js";import{o as X,a as J,g as b,p as Z,s as _,t as ee,v as te}from"./index-BTzz-bOt.js";import{F as D}from"./FormDateTimePicker-DL0Hg4xy.js";import{F as w}from"./FormSelect-RcCoR39P.js";import{F as re}from"./FormTextArea-Cb4m0tnv.js";import{F as M}from"./FormTextField-d7YI4Qa_.js";import{f as Q}from"./currency-CbQUp0c2.js";import{f as j}from"./dates-BO9LrDoS.js";import{u as se}from"./usePublicSite-C6NNUITv.js";import"./mui-icons-DlWpn-C2.js";import"./mui-pickers-Cyb4kCyh.js";import"./publicSiteApi-BIvHrut9.js";const ne=A({email:a().email(),bookingReference:a().min(4)}),ae=A({pickupBranchId:a().uuid(),returnBranchId:a().uuid(),vehicleCategoryId:a().uuid(),selectedVehicleId:a().uuid().nullable(),pickupAtUtc:a().min(1),returnAtUtc:a().min(1),notes:a().default(""),extras:O(A({code:a(),quantity:G()})).default([])});function ve(){var F,U;const{customer:f,isAuthenticated:y,login:L}=X(),l=J(),B=Y(),g=se(),[k,q]=P.useState(!1),[H,v]=P.useState(null),S=V({resolver:R(ne),defaultValues:{email:"",bookingReference:""}}),o=V({resolver:R(ae),defaultValues:{pickupBranchId:"",returnBranchId:"",vehicleCategoryId:"",selectedVehicleId:null,pickupAtUtc:"",returnAtUtc:"",notes:"",extras:[]}}),h=W({queryKey:["public","portal","bookings"],queryFn:ee,enabled:y}),x=W({queryKey:["public","portal","reservations"],queryFn:te,enabled:y}),C=$({mutationFn:Z,onSuccess:()=>{B.invalidateQueries({queryKey:["public","portal"]}),l.showSuccess("Booking cancelled successfully.")},onError:t=>l.showError(b(t,"Failed to cancel booking."))}),I=$({mutationFn:({quoteId:t,payload:d})=>_(t,d),onSuccess:()=>{v(null),B.invalidateQueries({queryKey:["public","portal"]}),l.showSuccess("Booking updated successfully.")},onError:t=>l.showError(b(t,"Failed to update booking."))});return e.jsxs(p,{children:[e.jsx(p,{sx:{minHeight:{xs:200,md:260},display:"grid",placeItems:"center",color:"white",textAlign:"center",background:"linear-gradient(135deg, #111111 0%, #9c1f2b 100%)"},children:e.jsxs(n,{spacing:1,children:[e.jsx(p,{component:"img",src:"/images/shared/brand/cabs-logo-white.png",alt:"CABS Car Hire",sx:{width:210,maxWidth:"70vw",height:"auto",alignSelf:"center",mb:2}}),e.jsx(r,{variant:"h1",sx:{fontSize:{xs:42,md:68}},children:"CUSTOMER ACCOUNT"}),e.jsx(r,{sx:{fontSize:{xs:18,md:24},opacity:.96},children:"Manage your bookings and review your confirmed reservations"})]})}),e.jsx(K,{maxWidth:"xl",sx:{py:8},children:e.jsxs(n,{spacing:3,children:[e.jsx(c,{severity:"info",action:e.jsx(i,{component:N,to:"/account/portal",size:"small",children:"Go to my account"}),children:"Have a password-protected CABS account? Sign in at the new customer account page to review, accept or reject your quote and manage your documents."}),y?e.jsxs(e.Fragment,{children:[e.jsxs(c,{severity:"success",children:["Signed in as ",f==null?void 0:f.fullName,"."]}),e.jsx(u,{children:e.jsxs(m,{children:[e.jsx(r,{variant:"h2",color:"primary.main",mb:2,sx:{fontSize:{xs:30,md:42}},children:"Booking requests"}),h.isLoading?e.jsx(n,{alignItems:"center",py:4,children:e.jsx(T,{})}):h.isError?e.jsx(c,{severity:"error",action:e.jsx(i,{size:"small",onClick:()=>h.refetch(),children:"Retry"}),children:"Failed to load bookings."}):(F=h.data)!=null&&F.bookings.length?e.jsx(n,{spacing:2,children:h.data.bookings.map(t=>{var d,z,E;return e.jsx(u,{variant:"outlined",children:e.jsx(m,{children:e.jsxs(n,{spacing:1.5,children:[e.jsxs(n,{direction:{xs:"column",md:"row"},justifyContent:"space-between",children:[e.jsx(r,{variant:"h5",sx:{fontSize:{xs:20,md:24}},children:t.quoteNumber}),e.jsx(r,{fontWeight:700,children:Q(t.estimatedTotalAmount+t.depositAmount)})]}),e.jsxs(r,{color:"text.secondary",sx:{fontSize:{xs:14,md:16}},children:[t.vehicleCategoryName," | ",t.pickupBranchName," to ",t.returnBranchName]}),t.selectedVehicleDisplay?e.jsxs(r,{color:"text.secondary",sx:{fontSize:{xs:14,md:16},overflowWrap:"anywhere"},children:["Vehicle: ",t.selectedVehicleDisplay]}):null,e.jsxs(r,{color:"text.secondary",sx:{fontSize:{xs:14,md:16}},children:[j(t.pickupAtUtc)," to ",j(t.returnAtUtc)]}),t.extras.length?e.jsxs(r,{color:"text.secondary",sx:{fontSize:{xs:14,md:16},overflowWrap:"anywhere"},children:["Extras: ",t.extras.map(s=>`${s.code}${s.quantity>1?` x ${s.quantity}`:""}
1`).join(", ")]}):null,e.jsxs(r,{children:["Status: ",t.status]}),e.jsxs(n,{direction:{xs:"column",sm:"row"},spacing:1,children:[e.jsx(i,{variant:"contained",disabled:t.status!=="Draft",onClick:()=>{v(t.quoteId),o.reset({pickupBranchId:t.pickupBranchId,returnBranchId:t.returnBranchId,vehicleCategoryId:t.vehicleCategoryId,selectedVehicleId:t.selectedVehicleId??null,pickupAtUtc:t.pickupAtUtc,returnAtUtc:t.returnAtUtc,notes:t.notes??"",extras:t.extras})},children:"Edit booking"}),e.jsx(i,{variant:"outlined",color:"error",disabled:t.status!=="Draft"||C.isPending,onClick:()=>C.mutate(t.quoteId),children:C.isPending?"Cancelling...":"Cancel booking"}),t.status==="Draft"&&e.jsx(i,{component:N,to:`/checkout/${t.quoteId}`,variant:"contained",color:"success",children:"Continue to payment"})]}),H===t.quoteId?e.jsx(u,{variant:"outlined",sx:{bgcolor:"#faf7f3"},children:e.jsx(m,{children:e.jsxs(n,{spacing:2,component:"form",onSubmit:o.handleSubmit(s=>I.mutate({quoteId:t.quoteId,payload:s})),children:[e.jsxs(p,{display:"grid",gap:2,sx:{gridTemplateColumns:{xs:"1fr",md:"repeat(2, minmax(0, 1fr))"}},children:[e.jsx(w,{control:o.control,name:"pickupBranchId",label:"Pickup branch",fullWidth:!0,options:((d=g.data)==null?void 0:d.branches.map(s=>({label:`${s.name} (${s.city})`,value:s.id})))??[]}),e.jsx(w,{control:o.control,name:"returnBranchId",label:"Return branch",fullWidth:!0,options:((z=g.data)==null?void 0:z.branches.map(s=>({label:`${s.name} (${s.city})`,value:s.id})))??[]}),e.jsx(w,{control:o.control,name:"vehicleCategoryId",label:"Vehicle category",fullWidth:!0,options:((E=g.data)==null?void 0:E.categories.map(s=>({label:`${s.code} — ${s.name}`,value:s.id})))??[]}),e.jsx(D,{control:o.control,name:"pickupAtUtc",label:"Pickup date/time"}),e.jsx(D,{control:o.control,name:"returnAtUtc",label:"Return date/time"})]}),t.selectedVehicleDisplay?e.jsxs(c,{severity:"info",children:["Selected vehicle: ",e.jsx("strong",{children:t.selectedVehicleDisplay}),". If the updated dates make this car unavailable, the update will be rejected and you can rebook with a new quote."]}):null,e.jsx(re,{control:o.control,name:"notes",label:"Notes"}),e.jsxs(n,{direction:{xs:"column",sm:"row"},spacing:1,children:[e.jsx(i,{type:"submit",variant:"contained",disabled:I.isPending,children:I.isPending?"Saving...":"Save changes"}),e.jsx(i,{variant:"outlined",onClick:()=>v(null),children:"Cancel"})]})]})})}):null]})})},t.quoteId)})}):e.jsx(c,{severity:"info",children:"No bookings are linked to this account."})]})}),e.jsx(u,{children:e.jsxs(m,{children:[e.jsx(r,{variant:"h2",color:"primary.main",mb:2,sx:{fontSize:{xs:30,md:42}},children:"Confirmed reservations"}),x.isLoading?e.jsx(n,{alignItems:"center",py:4,children:e.jsx(T,{})}):x.isError?e.jsx(c,{severity:"error",action:e.jsx(i,{size:"small",onClick:()=>x.refetch(),children:"Retry"}),children:"Failed to load reservations."}):(U=x.data)!=null&&U.reservations.length?e.jsx(n,{spacing:2,children:x.data.reservations.map(t=>e.jsx(u,{variant:"outlined",children:e.jsx(m,{children:e.jsxs(n,{spacing:1.5,children:[e.jsxs(n,{direction:{xs:"column",md:"row"},justifyContent:"space-between",children:[e.jsx(r,{variant:"h5",sx:{fontSize:{xs:20,md:24}},children:t.reservationNumber}),e.jsx(r,{fontWeight:700,children:Q(t.estimatedTotalAmount)})]}),e.jsxs(r,{color:"text.secondary",sx:{fontSize:{xs:14,md:16}},children:[t.vehicleCategoryName," | ",t.pickupBranchName," to ",t.returnBranchName]}),e.jsxs(r,{color:"text.secondary",sx:{fontSize:{xs:14,md:16}},children:[j(t.pickupAtUtc)," to ",j(t.returnAtUtc)]}),e.jsxs(r,{children:["Status: ",t.status]})]})})},t.reservationId))}):e.jsx(c,{severity:"info",children:"No confirmed reservations are linked to this account yet."})]})})]}):e.jsx(u,{children:e.jsx(m,{sx:{p:{xs:3,md:5}},children:e.jsxs(n,{spacing:2.5,component:"form",onSubmit:S.handleSubmit(async t=>{try{q(!0),await L(t.email,t.bookingReference),l.showSuccess("Customer portal access granted.")}catch(d){l.showError(b(d,"Failed to access customer account."))}finally{q(!1)}}),children:[e.jsx(r,{variant:"h2",color:"primary.main",sx:{fontSize:{xs:30,md:42}},children:"Sign in with your quote or reservation reference"}),e.jsx(r,{color:"text.secondary",sx:{fontSize:{xs:15,md:16},lineHeight:1.55},children:"Use the same email address and the quote or reservation reference from your confirmation to open your customer portal."}),e.jsxs(p,{display:"grid",gap:2,sx:{gridTemplateColumns:{xs:"1fr",md:"repeat(2, minmax(0, 1fr))"}},children:[e.jsx(M,{control:S.control,name:"email",label:"Email",fullWidth:!0}),e.jsx(M,{control:S.control,name:"bookingReference",label:"Quote or reservation reference",fullWidth:!0})]}),e.jsx(i,{type:"submit",variant:"contained",disabled:k,sx:{width:{xs:"100%",md:260}},children:k?"ACCESSING ACCOUNT...":"ACCESS ACCOUNT"})]})})})]})})]})}export{ve as PublicAccountPage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.