PageSourceSearch

https://smartambulance.ai/static/js/263.861d3366.chunk.js

js smartambulance.ai collected 2026-10-05 15:05:56 UTC 3,911 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkaod_react_frontend=self.webpackChunkaod_react_frontend||[]).push([[263],{1263:(e,t,o)=>{o.r(t),o.d(t,{default:()=>c});var l=o(5043),s=o(5016),a=o(5989),i=o(5088),r=o(8006),d=o(3944),n=o(579);const c=()=>{var e;const{user:t}=(0,s.A)(),[o,c]=(0,l.useState)({total:0,completed:0,active:0,cancelled:0,avgRating:0,avgResponseTime:"0 min"}),[g,u]=(0,l.useState)(!0),[m,v]=(0,l.useState)(null),b=(null===t||void 0===t?void 0:t.operator_id)||(null===t||void 0===t||null===(e=t.operator)||void 0===e?void 0:e.operator_id)||(null===t||void 0===t?void 0:t.fleet_id)||(null===t||void 0===t?void 0:t.operatorId);if((0,l.useEffect)(()=>{(async()=>{if(!t)return console.log("\ud83d\udcca Waiting for user data to load..."),void u(!0);if(!b)return console.warn("\u26a0\ufe0f Fleet ID not found in user data:",t),console.log("\ud83d\udcca Using default stats (no fleet ID available)"),c({total:0,completed:0,active:0,cancelled:0,avgRating:4.5,avgResponseTime:"N/A"}),void u(!1);try{u(!0),console.log("\ud83d\udcca Fetching fleet dashboard data for:",b);const[e,t]=await Promise.all([a.y1.fleetGetBookings({limit:100}),a.y1.fleetGetBookingHistory({limit:500})]);let o=[];e.success&&e.data&&(o=[...o,...e.data.bookings||[]]),t.success&&t.data&&(o=[...o,...t.data.bookings||[]]);const l={total:o.length,completed:o.filter(e=>"COMPLETED"===e.status).length,active:o.filter(e=>["CONFIRMED","ASSIGNED","IN_PROGRESS"].includes(e.status)).length,cancelled:o.filter(e=>"CANCELLED"===e.status).length,avgRating:4.7,avgResponseTime:"8 min"};c(l),console.log("\u2705 Booking statistics calculated:",l)}catch(e){console.error("\u274c Error fetching booking data:",e),v(e.message||"Failed to fetch booking data")}finally{u(!1)}})()},[t,b]),g)return(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[...Array(6)].map((e,t)=>(0,n.jsx)("div",{className:"bg-white rounded-lg p-6 shadow-sm border border-gray-100",children:(0,n.jsxs)("div",{className:"animate-pulse",children:[(0,n.jsx)("div",{className:"h-4 bg-gray-200 rounded mb-2"}),(0,n.jsx)("div",{className:"h-8 bg-gray-200 rounded"})]})},t))});if(m)return(0,n.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 mb-8",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-5 h-5 bg-red-500 rounded-full"}),(0,n.jsx)("h3",{className:"text-red-800 font-medium",children:"Unable to load booking data"})]}),(0,n.jsx)("p",{className:"text-red-600 text-sm mt-2",children:m})]});const h=[{title:"Total Bookings",value:o.total,subtitle:"All time bookings",icon:i.A,color:"text-purple-600",bgColor:"bg-purple-50"},{title:"Completed Bookings",value:o.completed,subtitle:"Successfully completed",icon:i.A,color:"text-indigo-600",bgColor:"bg-indigo-50"},{title:"Active Bookings",value:o.active,subtitle:"Currently in progress",icon:r.A,color:"text-orange-600",bgColor:"bg-orange-50"},{title:"Avg. Rating",value:"".concat(o.avgRating,"/5"),subtitle:"Customer satisfaction",icon:d.A,color:"text-yellow-600",bgColor:"bg-yellow-50"}];return(0,n.jsx)("div",{className:"space-y-6",children:(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:h.map((e,t)=>(0,n.jsx)("div",{className:"bg-white rounded-lg p-6 shadow-sm border border-gray-100 hover:shadow-md transition-shadow",children:(0,n.jsxs)("div",{className:"flex items-start justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-600 mb-1",children:e.title}),(0,n.jsx)("p",{className:"text-3xl font-bold text-gray-900 mb-1",children:e.value}),(0,n.jsx)("p",{className:"text-xs text-gray-500",children:e.subt
1itle})]}),(0,n.jsx)("div",{className:"p-3 rounded-lg ".concat(e.bgColor),children:(0,n.jsx)(e.icon,{className:"w-6 h-6 ".concat(e.color)})})]})},t))})})}}}]);
2//# sourceMappingURL=263.861d3366.chunk.js.map

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.