1import{r,u as J,j as i,c as k,g as C,O as m,q as _,fp as G}from"./index-H6FW8B51.js";import{M as W,D as L,C as B,g as R,H as x,a as A,S as N,b as F,c as K,d as $}from"./JobCard-CYgkyKLS.js";import{p as Q}from"./RazorPayPayment-VJqeWSZt.js";import"./CalendarMonth-B8VbNuiq.js";import"./Final-Logo-white-pikpaprt-CVPzBpgi.js";const V=m.div` 2 width: 100%; 3`,X=m(G)` 4 display: flex; 5 justify-content: space-between; 6`,Y=m.button` 7 border: none; 8 font-weight: 900; 9 border-radius: 7px; 10 padding: 10px; 11 font-size: 1em; 12 background: #cccccc; 13 margin-right: 10px; 14 cursor: pointer; 15 background: ${l=>l.active?"#FFCF31":"#cccccc"}; 16`,Z=m.button` 17 border: none; 18 font-weight: 900; 19 border-radius: 7px; 20 padding: 10px; 21 font-size: 1em; 22 background: #cccccc; 23 cursor: pointer; 24 background: ${l=>l.active?"#FFCF31":"#cccccc"}; 25`,j=m.p` 26 border: none; 27 width: 10%; 28 border-radius: 9px; 29 font-weight: 900; 30 text-align: center; 31 color: white; 32 margin-right: 1%; 33 padding: 5px; 34 white-space: nowrap; 35 cursor: pointer; 36 &:hover { 37 transform: scale(1.1); 38 } 39 @media (max-width: 800px) { 40 width: 30%; 41 } 42`,c=JSON.parse(localStorage.getItem("user")||"{}"),et=()=>{const[l,b]=r.useState(!0),[S,w]=r.useState(!1),[f,z]=r.useState([]),[y,M]=r.useState([]),[d,I]=r.useState("service"),O=J(),P=()=>{localStorage.removeItem("majorServiceCart"),localStorage.removeItem("minorServiceCart"),localStorage.removeItem("sparesList"),localStorage.removeItem("packagesList"),localStorage.removeItem("AMCCart"),setTimeout(()=>{window.location.reload()},1500)},D=(t,s)=>{O.push({pathname:_.UserInvoices,state:{data:t,activeButton:s}})},H=()=>{b(!0),w(!1),I("service")},T=()=>{b(!1),w(!0),I("retail")},E=async()=>{var t,s,h,v,p,u;try{if(d==="service"){let n=`${k.baseUrl}/customer/web-invoices?id=${c.id}&phone_number=${c==null?void 0:c.phoneNumber}&type=service`;const o=await C(n),e=(h=(s=(t=o==null?void 0:o.data)==null?void 0:t.responseResult)==null?void 0:s.result)==null?void 0:h.data;e!=null&&e.length&&z(e)}else if(d==="retail"){let n=`${k.baseUrl}/customer/web-invoices?id=${c.id}&phone_number=${c==null?void 0:c.phoneNumber}&type=retail`;const o=await C(n),e=(u=(p=(v=o==null?void 0:o.data)==null?void 0:v.responseResult)==null?void 0:p.result)==null?void 0:u.data;e!=null&&e.length&&M(e)}}catch{console.log("Bad API request")}};r.useEffect(()=>{E()},[d]);const U=f.filter(t=>t.orderId!==void 0),q=t=>{var p,u;const s=U.filter(n=>(n==null?void 0:n.id)===t),h=(p=s[0])==null?void 0:p.orderId,v=(u=s[0])==null?void 0:u.amount;return{orderId:h,amount:v}};return i.jsxs(V,{children:[i.jsxs(X,{children:[i.jsx("div",{children:i.jsx("h3",{style:{padding:"5px",fontWeight:900},children:"Invoice List"})}),i.jsxs("div",{style:{marginTop:"1.5%",marginRight:"5%"},children:[i.jsx(Y,{active:l,onClick:H,children:"Service"}),i.jsx(Z,{active:S,onClick:T,children:"Order"})]})]}),l&&(f==null?void 0:f.map((t,s)=>i.jsxs(W,{children:[i.jsxs(L,{children:[i.jsx(B,{initials:R(t==null?void 0:t.centreName)}),i.jsx("span",{style:{fontSize:"22px",fontWeight:900,marginTop:"7px",marginLeft:"10px"},children:t==null?void 0:t.centreName})]}),i.jsx(x,{}),i.jsxs(A,{children:[i.jsxs(N,{children:[i.jsx("span",{style:{fontWeight:900,whiteSpace:"nowrap"},children:"Invoice Date:"}),i.jsx("span",{style:{marginLeft:"10px",fontWeight:900,color:"#ff5c00"},children:t==null?void 0:t.invoiceDate})]}),i.jsx(F,{children:i.jsxs("p",{style:{fontWeight:900},children:["Due Date :"," ",i.jsx("span",{style:{fontWeight:900,color:"#ff5c00"},children:t==null?void 0:t.invoiceDueDate})]})})]}),i.jsx(x,{}),i.jsxs(K,{children:[i.jsxs("p",{style:{marginLeft:"1%",fontWeight:900},children:[t==null?void 0:t.vehicleBrand," - ",t==null?void 0:t.vehicleModel]}),i.jsxs("p",{style:{marginLeft:"5.5%",fontWeight:900},children:["Bike No :"," ",i.jsx("span",{style:{fontWeight:900,color:"#ff5c00"},children:t==null?void 0:t.vehicleNo})]})]}),i.jsx(x,{}),i.jsxs($,{children:[i.jsxs("p",{style:{fontWeight:900,marginLeft:"1%"},children:["Amount:",i.jsxs("span",{style:{fontWeight:900,color:"#ff5c00",fontSize:"1.5em"},children:["â¹ ",((t==null?void 0:t.amount)||0).toFixed(2)]})]}),i.jsxs("div",{style:{display:"flex",marginRight:"5%"},children:[i.jsx(j,{style:{background:"#cccccc",color:"black",width:"150px",padding:"10px",marginRight:"3%"},onClick:()=>D(t,d),children:"Invoice Detail"}),(t==null?void 0:t.orderId)&&i.jsx(j,{style:{background:(t==null?void 0:t.status)==="paymentDue"?"#dd3437":"#00BD13",width:"100%"},onClick:(t==null?void 0:t.status)==="paymentDue"?()=>{const h=q(t==null?void 0:t.id);Q(h,P)}:void 0,children:(t==null?void 0:t.status)==="paymentDue"?"Payment Due":t==null?void 0:t.status})]})]})]},s))),S&&(y==null?void 0:y.map((t,s)=>i.jsxs(W,{onClick:()=>D(t,d),children:[i.jsxs(L,{children:[i.jsx(B,{initials:R((t==null?void 0:t.centreName)??"")}),i.jsx("span",{style:{fontSize:"22px",fontWeight:900,marginTop:"7px",marginLeft:"10px"},children:t==null?void 0:t.centreName})]}),i.jsx(x,{}),i.jsxs(A,{children:[i.jsxs(N,{children:[i.jsx("span",{style:{fontWeight:900,whiteSpace:"nowrap"},children:"Invoice Date:"}),i.jsx("span",{style:{marginLeft:"10px",fontWeight:900,color:"#ff5c00"},children:t==null?void 0:t.invoiceDate})]}),i.jsx(F,{children:i.jsxs("p",{style:{fontWeight:900},children:["Due Date :"," ",i.jsx("span",{style:{fontWeight:900,color:"#ff5c00"},children:t==null?void 0:t.invoiceDueDate})]})})]}),i.jsx(x,{}),i.jsxs($,{children:[i.jsxs("p",{style:{fontWeight:900,marginLeft:"1%"},children:["Amount:"," ",i.jsx("span",{style:{fontWeight:900,color:"#ff5c00",fontSize:"1.5em"},children:t==null?void 0:t.amount})]}),i.jsxs("div",{style:{display:"flex",marginRight:"5%"},children:[i.jsx(j,{style:{background:"#cccccc",color:"black",width:"150px",padding:"10px",marginRight:"3%"},onClick:()=>D(t,d),children:"Invoice Detail"}),i.jsx(j,{style:{background:(t==null?void 0:t.status)==="paymentDue"?"#dd3437":"#00BD13",width:"100%"},onClick:(t==null?void 0:t.status)==="paymentDue"?()=>console.log("here"):void 0,children:(t==null?void 0:t.status)==="paymentDue"?"Payment Due":t==null?void 0:t.status})]})]})]},s)))]})};export{et 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.