PageSourceSearch

https://zovv.ai/assets/ReportsPage-DDijY3gl.js

js zovv.ai collected 2026-10-05 14:49:53 UTC 10,032 bytes, 1 lines download raw bytes

1import{u as K,G as I,d as B,K as V,j as e,k as q,r as u,o as U,V as d}from"./index-CcaPaFKR.js";import{r as C}from"./reservationsApi-BGopPkcT.js";import{F as X}from"./BuildingStorefrontIcon-ihjDpJY4.js";import{F as Y}from"./BriefcaseIcon-CU0eq2HW.js";import{F as H}from"./GlobeAltIcon-DVSJsy2T.js";import{F as M}from"./BanknotesIcon-Dyd5gLyk.js";import{F as T}from"./ArrowPathIcon-BMdAPMn-.js";const J=new Set(["organization_admin","organization_user"]),Q=[{value:"",label:"All Suppliers"},{value:"priceline",label:"Priceline"},{value:"expedia",label:"Expedia"},{value:"amadeus avh",label:"Amadeus AVH"}],S=[{id:"supplier",label:"Supplier Bookings",title:"Supplier Bookings Report",description:"Confirmed bookings made through suppliers within a date range.",Icon:X},{id:"zovvpro",label:"ZovvPro",title:"ZovvPro Client Report",description:"Inquiries from ZovvPro clients filtered by client and date.",Icon:Y},{id:"zovvgo",label:"ZovvGO",title:"ZovvGO Client Report",description:"Supplier reservations for ZovvGO clients filtered by client and date.",Icon:H},{id:"invoice",label:"Invoices",title:"Invoice Report",description:"Invoices, credit notes and additional services in a date range.",Icon:B},{id:"revenue",label:"Revenue",title:"Revenue Report",description:"Finance-grade revenue export — invoices, credits and supplier costs.",Icon:M},{id:"zovvpay",label:"ZovvPay",title:"ZovvPay Report",description:"Virtual card export — cards, captured amounts and linked bookings.",Icon:V},{id:"extension_report",label:"Check-in & Extensions",title:"Check-in & Extension List",description:"Color-coded XLSX grouped by project: guests in house as of the report date plus arrivals in the following week, CM guests in their own section.",Icon:T}],W=Object.fromEntries(S.map(r=>[r.id,r])),g="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-accent-300 focus:border-accent-300 hover:border-gray-300 transition-colors",x="block text-xs font-medium uppercase tracking-wide text-gray-500 mb-1.5",p=()=>new Date().toISOString().slice(0,10),D=({loading:r,onClick:l,label:o="Generate & Send Report"})=>e.jsxs("button",{onClick:l,disabled:r,className:"w-full mt-2 flex items-center justify-center gap-2 bg-primary-600 text-white py-2.5 rounded-lg text-sm font-medium shadow-sm hover:bg-primary-700 active:bg-primary-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[r?e.jsx(T,{className:"h-4 w-4 animate-spin"}):e.jsx(U,{className:"h-4 w-4 -rotate-12"}),r?"Requesting…":o]}),O=({footerNote:r="Report will be emailed to your account.",children:l})=>e.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-100 p-7",children:[e.jsx("div",{className:"space-y-5",children:l}),e.jsx("p",{className:"text-xs text-gray-400 text-center mt-5",children:r})]}),ee=()=>{const[r,l]=u.useState(""),[o,s]=u.useState(""),[n,v]=u.useState(""),[i,c]=u.useState(!1),y=async()=>{if(!r||!o){d.error("Please select both check-in dates.");return}if(r>p()||o>p()){d.error("Dates cannot be in the future.");return}c(!0);try{const a={check_in__gte:r,check_in__lte:o};n&&(a.supplier=n);const _=await C.exportReport("supplier",a);d.success(`Report will be sent to ${_.email} shortly.`,{duration:5e3})}catch{d.error("Failed to generate report. Please try again.")}finally{c(!1)}};return e.jsxs(O,{children:[e.jsxs("div",{children:[e.jsx("label",{className:x,children:"Supplier"}),e.jsx("select",{value:n,onChange:a=>v(a.target.value),className:g,children:Q.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:x,children:"Check-in From"}),e.jsx("input",{type:"date",value:r,max:p(),onChange:a=>l(a.target.value),className:g})]}),e.jsxs("div",{children:[e.jsx("label",{className:x,children:"Check-in To"}),e.jsx("input",{type:"date",value:o,max:p(),onChange:a=>s(a.target.value),className:g})]})]}),e.jsx(D,{loading:i,onClick:y})]})},h=({reportName:r,primaryLabel:l,primaryKeys:o,showClient:s=!0,showDateTypeToggle:n=!0,showOutstandingOption:v=!1,supportsCustomFields:i=!1,footerNote:c,allowFutureForPrimary:y=!1})=>{const[a,_]=I(),[z,L]=u.useState([]),[$,P]=u.useState(!1),w=a.get("client")||"",f=n&&a.get("dateType")||"primary",E=v?["primary","created","outstanding"]:["primary","created"],A=t=>t==="primary"?l:t==="created"?"Created Date":"Outstanding",R=f!=="outstanding",F=f==="primary"&&y,b=a.get("from")||"",j=a.get("to")||"",N=(t,m)=>{_(G=>{const k=new URLSearchParams(G);return m?k.set(t,m):k.delete(t),k})};u.useEffect(()=>{s&&C.getClientOrganizations().then(t=>{const m=t.results||t||[];L(Array.isArray(m)?m:[])}).catch(()=>{})},[s]);const Z=async()=>
1{if(R&&(!b||!j)){d.error("Please select both dates.");return}if(R&&!F&&(b>p()||j>p())){d.error("Dates cannot be in the future.");return}P(!0);try{const t={};s&&w&&(t.client_organization=w),f==="primary"?(t[o[0]]=b,t[o[1]]=j):f==="created"?(t.created_at__gte=b,t.created_at__lte=j):t.outstanding="true";const m=await C.exportReport(r,t);d.success(`Report will be sent to ${m.email} shortly.`,{duration:5e3})}catch{d.error("Failed to generate report. Please try again.")}finally{P(!1)}};return e.jsxs(O,{footerNote:c,children:[s&&e.jsxs("div",{children:[e.jsx("label",{className:x,children:"Client"}),e.jsxs("select",{value:w,onChange:t=>N("client",t.target.value),className:g,children:[e.jsx("option",{value:"",children:"All Clients"}),z.map(t=>e.jsx("option",{value:t.id,children:t.client_name},t.id))]}),i&&!w&&e.jsx("p",{className:"mt-1.5 text-xs text-gray-500",children:"Pick a single client to include their custom fields in the export."})]}),n&&e.jsxs("div",{children:[e.jsx("label",{className:x,children:"Filter by"}),e.jsx("div",{className:"inline-flex rounded-lg border border-gray-200 bg-gray-50 p-0.5",children:E.map(t=>e.jsx("button",{onClick:()=>N("dateType",t),className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${f===t?"bg-white text-primary-700 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:A(t)},t))})]}),R&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:x,children:"From"}),e.jsx("input",{type:"date",value:b,max:F?void 0:p(),onChange:t=>N("from",t.target.value),className:g})]}),e.jsxs("div",{children:[e.jsx("label",{className:x,children:"To"}),e.jsx("input",{type:"date",value:j,max:F?void 0:p(),onChange:t=>N("to",t.target.value),className:g})]})]}),e.jsx(D,{loading:$,onClick:Z})]})},le=()=>{const r=K(i=>i.user),[l,o]=I(),s=l.get("section")||"supplier",n=W[s]??S[0];if(!J.has((r==null?void 0:r.user_type)??""))return e.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 text-gray-500 text-sm",children:"Access restricted to OPS users only."});const v=i=>{o({section:i})};return e.jsxs("div",{className:"flex min-h-screen bg-gray-50",children:[e.jsx("aside",{className:"w-64 shrink-0 border-r border-gray-200 bg-white",children:e.jsxs("div",{className:"sticky top-0 px-4 pt-8 pb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 mb-6",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary-50 flex items-center justify-center",children:e.jsx(q,{className:"h-4 w-4 text-primary-600"})}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"Reports"})]}),e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-gray-400 px-2 mb-2",children:"Exports"}),e.jsx("nav",{className:"space-y-0.5",children:S.map(i=>{const c=s===i.id,y=i.Icon;return e.jsxs("button",{onClick:()=>v(i.id),className:`w-full flex items-center gap-3 text-left pl-2.5 pr-3 py-2 rounded-lg text-sm transition-colors relative ${c?"bg-primary-50 text-primary-700 font-medium":"text-gray-600 hover:bg-gray-50 hover:text-gray-900"}`,children:[c&&e.jsx("span",{className:"absolute left-0 top-1.5 bottom-1.5 w-0.5 bg-primary-600 rounded-r"}),e.jsx(y,{className:`h-4 w-4 shrink-0 ${c?"text-primary-600":"text-gray-400"}`}),e.jsx("span",{className:"truncate",children:i.label})]},i.id)})})]})}),e.jsx("main",{className:"flex-1 px-8 py-12",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-8",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl bg-primary-50 flex items-center justify-center shrink-0",children:e.jsx(n.Icon,{className:"h-6 w-6 text-primary-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-900 leading-tight",children:n.title}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:n.description})]})]}),s==="supplier"&&e.jsx(ee,{}),s==="zovvpro"&&e.jsx(h,{reportName:"zovvpro",primaryLabel:"Check-in Date",primaryKeys:["check_in__gte","check_in__lte"],supportsCustomFields:!0,allowFutureForPrimary:!0}),s==="zovvgo"&&e.jsx(h,{reportName:"zovvgo",primaryLabel:"Check-in Date",primaryKeys:["check_in__gte","check_in__lte"],supportsCustomFields:!0,allowFutureForPrimary:!0}),s==="invoice"&&e.jsx(h,{reportName:"invoice",primaryLabel:"Invoice Date",primaryKeys:["from_date__gte","from_date__lte"],showOutstandingOption:!0,supportsCustomFields:!0}),s==="revenue"&&e.jsx(h,{reportName:"revenue_detailed",primaryLabel:"Invoice Date",primaryKeys:["from_date","to_date"],showClient:!1,showDateTypeToggle:!1,footerNote:"Report will be emailed to the finance team."}),s==="zovvpay"&&e.jsx(h,{reportName:"zovvpay",primaryLabel:"Created Date",primaryKeys:["created_at__gte","created_at__lte"],showClient:!1,showDateTypeToggle:!1,footerNote:"Report will be emailed to the finance team."}),s==="extension_report"&&e.jsx(h,{reportName:"extension_report",primaryLabel:"Report Date",primaryKeys:["window_start","window_end"],showDateTypeToggle:!1,allowFutureForPrimary:!0,footerNote:"The To date is the report date: guests in house as of that date, plus arrivals during the following week (guests checked out by then are excluded)."})]})})]})};export{le 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.