PageSourceSearch

https://omniscient-sky-charter-go.base44.app/assets/QuotePreview-Cr0lR2lE.js

js omniscient-sky-charter-go.base44.app collected 2026-10-03 03:07:22 UTC 9,884 bytes, 1 lines download raw bytes

1import{j as e,b as P,k as N,r as l,m as q,d as L,a as H,D as C}from"./index-CFVHlxky.js";import{S as D,a as F,b as U,c as $,d as B}from"./select-uwNoA0YQ.js";import{U as M}from"./users-NJOokOEl.js";import{C as R}from"./clock-BqUZNHO6.js";import{G as E}from"./gauge-DKmBv5nB.js";import{L as G}from"./luggage-Cq9zleMX.js";import{F as K}from"./file-text-TzyucgnX.js";import"./chevron-up-DzTj-76L.js";const j={"Super Light Jet":{passengers:5,rangeHours:3.5,speedKnots:350,luggage:"moderate",cabinHeight:"1.45m"},"Light Jet":{passengers:7,rangeHours:4,speedKnots:450,luggage:"moderate",cabinHeight:"1.45m"},"Midsize Jet":{passengers:8,rangeHours:4.5,speedKnots:470,luggage:"spacious",cabinHeight:"1.70m"},"Super Midsize Jet":{passengers:9,rangeHours:5.5,speedKnots:500,luggage:"spacious",cabinHeight:"1.83m"},"Heavy Jet":{passengers:14,rangeHours:6,speedKnots:500,luggage:"large",cabinHeight:"1.88m"},"Ultra-Long Range Jet":{passengers:16,rangeHours:8,speedKnots:530,luggage:"large",cabinHeight:"1.91m"}},_={"Super Light Jet":{exterior:"https://media.base44.com/images/public/6a50ec7f62fd37fce458e6dd/9a7a1ad6d_generated_image.png",interior:"https://media.base44.com/images/public/6a50ec7f62fd37fce458e6dd/0501ea19a_generated_image.png"},"Light Jet":{exterior:"https://images.unsplash.com/photo-1474302770737-173ee21bab63?fm=jpg&q=80&w=800&auto=format&fit=crop",interior:"https://images.unsplash.com/photo-1625513123245-fcb02d69ad12?fm=jpg&q=80&w=800&auto=format&fit=crop"},"Midsize Jet":{exterior:"https://images.unsplash.com/photo-1619659085985-f51a00f0160a?fm=jpg&q=80&w=800&auto=format&fit=crop",interior:"https://images.unsplash.com/photo-1700811476970-2b42838f5f09?fm=jpg&q=80&w=800&auto=format&fit=crop"},"Super Midsize Jet":{exterior:"https://media.base44.com/images/public/6a50ec7f62fd37fce458e6dd/54109f81b_generated_image.png",interior:"https://media.base44.com/images/public/6a50ec7f62fd37fce458e6dd/2231cdc17_generated_image.png"},"Heavy Jet":{exterior:"https://images.unsplash.com/photo-1540962351504-03099e0a754b?fm=jpg&q=80&w=800&auto=format&fit=crop",interior:"https://images.unsplash.com/photo-1569629743817-70d8db6c323b?fm=jpg&q=80&w=800&auto=format&fit=crop"},"Ultra-Long Range Jet":{exterior:"https://images.unsplash.com/photo-1684838200815-36eef38f353c?fm=jpg&q=80&w=800&auto=format&fit=crop",interior:"https://images.unsplash.com/photo-1556388158-158ea5ccacbd?fm=jpg&q=80&w=800&auto=format&fit=crop"}};function A(r,a="GBP"){return(a==="GBP"?"GBP ":a==="USD"?"$":a+" ")+Number(r||0).toLocaleString("en-GB",{minimumFractionDigits:0,maximumFractionDigits:0})}function f({icon:r,label:a,value:m,isBest:p}){return e.jsxs("div",{className:`flex items-center gap-2 py-2.5 px-4 border-t border-border ${p?"bg-gold/5":""}`,children:[e.jsx(r,{className:"w-3.5 h-3.5 text-gold/60 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:a}),e.jsx("p",{className:"text-sm text-foreground",children:m})]})]})}function z({enquiry:r}){const a=r==null?void 0:r.quoted_aircraft;if(!a||!Array.isArray(a)||a.length===0)return null;const m=(r==null?void 0:r.quote_currency)||"GBP",p=Math.min(...a.filter(t=>t.price!=null).map(t=>t.price)),c=Math.max(...a.map(t=>{var i;return((i=j[t.category])==null?void 0:i.passengers)||0})),x=Math.max(...a.map(t=>{var i;return((i=j[t.category])==null?void 0:i.rangeHours)||0}));return e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(P,{className:"w-4 h-4 text-gold"}),e.jsx("p",{className:"text-xs uppercase tracking-[0.3em] text-gold",children:"Aircraft Comparison"})]}),e.jsx("h2",{className:"text-xl font-heading font-light text-foreground mb-1",children:"Side-by-Side Options"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Compare the aircraft categories you've quoted for this enquiry — highlighting the best value, highest capacity, and longest range."}),e.jsx("div",{className:"overflow-x-auto pb-2",children:e.jsx("div",{className:"flex gap-4 min-w-fit",children:a.map((t,i)=>{const d=t.category||"Light Jet",o=j[d]||j["Light Jet"],u=_[d]||_["Light Jet"],n=t.price!=null&&t.price===p,h=o.passengers===c,g=o.rangeHours===x;return e.jsxs("div",{className:`flex flex-col w-72 shrink-0 rounded-lg border bg-card overflow-hidden ${n?"border-gold":"border-border"}`,children:[e.jsxs("div",{className:`px-4 py-3 ${n?"gold-gradient":"bg-secondary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:`text-sm font-heading font-medium ${n?"text-primary-foreground":"text-foreground"}`,children:d}),n&&e.jsx("span",{className:"text-[10px] uppercase tracking-wider bg-primary-foreground
1/20 text-primary-foreground px-2 py-0.5 rounded-sm",children:"Best Value"})]}),t.aircraft_name&&e.jsx("p",{className:`text-xs mt-0.5 ${n?"text-primary-foreground/80":"text-muted-foreground"}`,children:t.aircraft_name})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-px bg-border",children:[e.jsx("div",{className:"aspect-square bg-background overflow-hidden",children:e.jsx("img",{src:u.exterior,alt:`${d} exterior`,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"aspect-square bg-background overflow-hidden",children:e.jsx("img",{src:u.interior,alt:`${d} interior`,className:"w-full h-full object-cover"})})]}),e.jsxs("div",{className:"px-4 py-3 border-b border-border text-center",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-0.5",children:"Quoted Price"}),e.jsx("p",{className:"text-2xl font-heading font-bold text-gold",children:t.price!=null?A(t.price,m):"TBD"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(f,{icon:M,label:"Passengers",value:`${o.passengers} max`,isBest:h}),e.jsx(f,{icon:R,label:"Typical Range",value:`${o.rangeHours} hrs flight`,isBest:g}),e.jsx(f,{icon:E,label:"Max Speed",value:`${o.speedKnots} knots`}),e.jsx(f,{icon:G,label:"Luggage",value:e.jsx("span",{className:"capitalize",children:o.luggage})}),e.jsx(f,{icon:P,label:"Cabin Height",value:o.cabinHeight})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-border bg-secondary/50 space-y-1.5",children:[n&&e.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-gold",children:[e.jsx(N,{className:"w-3 h-3"})," Lowest quoted price"]}),h&&e.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-gold",children:[e.jsx(N,{className:"w-3 h-3"})," Most passenger seats"]}),g&&e.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-gold",children:[e.jsx(N,{className:"w-3 h-3"})," Longest flight range"]})]})]},i)})})})]})}function Z(){const[r,a]=l.useState([]),[m,p]=l.useState(!0),[c,x]=l.useState(null),[t,i]=l.useState(null),[d,o]=l.useState(!1),[u,n]=l.useState(null),[h]=q(),g=h.get("enquiry_id"),w=r.find(s=>s.id===c)||null;return l.useEffect(()=>{L.entities.Enquiry.list("-created_date",50).then(s=>{a(s),g?x(g):s.length>0&&x(s[0].id)}).finally(()=>p(!1))},[g]),l.useEffect(()=>{c&&(o(!0),n(null),i(null),L.functions.invoke("sendQuotePDF",{enquiry_id:c,preview:!0}).then(s=>{var S;if(s.data&&typeof s.data=="object"&&s.data.error){n(s.data.error);return}const k=((S=s.data)==null?void 0:S.pdf_base64)||s.data,v=atob(k),y=new Uint8Array(v.length);for(let b=0;b<v.length;b++)y[b]=v.charCodeAt(b);const J=new Blob([y],{type:"application/pdf"});i(URL.createObjectURL(J))}).catch(s=>{n(s.message||"Failed to generate PDF preview.")}).finally(()=>o(!1)))},[c]),l.useEffect(()=>()=>{t&&URL.revokeObjectURL(t)},[t]),m?e.jsx("div",{className:"min-h-[80vh] flex items-center justify-center",children:e.jsx(H,{className:"w-6 h-6 text-gold animate-spin"})}):e.jsx("div",{className:"px-6 lg:px-8 py-16",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(K,{className:"w-4 h-4 text-gold"}),e.jsx("p",{className:"text-xs uppercase tracking-[0.3em] text-gold",children:"Communications Preview"})]}),e.jsx("h1",{className:"text-3xl font-heading font-light text-foreground",children:"Quote PDF Preview"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This is exactly what the client receives when a booking is confirmed — the formal PDF quote with aircraft images, flight details, and total pricing."})]}),e.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Select Enquiry:"}),e.jsxs(D,{value:c,onValueChange:x,children:[e.jsx(F,{className:"bg-card border-border w-full max-w-md",children:e.jsx(U,{placeholder:"Select an enquiry"})}),e.jsx($,{children:r.map(s=>e.jsxs(B,{value:s.id,children:[s.full_name," — ",s.departure_location," to ",s.destination_location]},s.id))})]})]}),u&&e.jsx("div",{className:"mb-6 bg-destructive/10 border border-destructive/30 text-destructive text-sm px-4 py-3 rounded-lg",children:u}),w&&e.jsx(z,{enquiry:w}),d?e.jsxs("div",{className:"flex items-center justify-center py-24 border border-border rounded-lg",children:[e.jsx(H,{className:"w-6 h-6 text-gold animate-spin"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"Generating PDF..."})]}):t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4 flex justify-end",children:e.jsxs("a",{href:t,download:`quote-PJC-${c?String(c).slice(-6).toUpperCase():"preview"}.pdf`,className:"inline-flex items-center gap-1.5 px-4 py-2 text-xs tracking-wide rounded-sm gold-gradient text-primary-foreground hover:opacity-90",children:[e.jsx(C,{className:"w-3.5 h-3.5"})," Download PDF"]})}),e.jsx("div",{className:"border border-border rounded-lg overflow-hidden bg-white",children:e.jsx("iframe",{src:t,title:"Quote PDF Preview",className:"w-full",style:{height:"80vh",border:"none"}})})]}):null]})})}export{Z as default};

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.