1import{j as s,C as m,aF as q,ac as G,ad as Q,r as z,u as B,a as X,T as Y,M as Z,br as E,s as F,$ as I,aw as R,cK as K,bC as ee,z as $}from"./index-DTrCVgc5.js";import{T as se}from"./TrackAndTrace-DoP4kf-j.js";import{b as le}from"./bannerVerifyV-Bin2vX3f.js";import{M as ce}from"./MyInput-JnVqlEeh.js";import{n as ie}from"./nodata-BNzO7U9g.js";import"./jspdf.plugin.autotable-DpJjOLcF.js";import"./vendor-PZf6EGI5.js";import"./index-B_r6-QMX.js";function V({data:e,noTopBorder:p}){var l,t;return s.jsxs("div",{className:`w-full ${p?"":"border "} rounded-lg p-5 card`,children:[s.jsxs("div",{className:"grid lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2",children:[s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Challan Number"}),s.jsx("div",{children:e==null?void 0:e.challan_no})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Challan Place"}),s.jsx("div",{children:e==null?void 0:e.challan_place})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Challan Date And Time"}),s.jsx("div",{children:e!=null&&e.challan_date_time?e==null?void 0:e.challan_date_time:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"DL no"}),s.jsx("div",{children:(e==null?void 0:e.dl_no)===null?"NA":e==null?void 0:e.dl_no})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Owner Name"}),s.jsx("div",{children:e!=null&&e.owner_name?e==null?void 0:e.owner_name:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Court Name"}),s.jsx("div",{children:e!=null&&e.court_name?e==null?void 0:e.court_name:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Court Address"}),s.jsx("div",{children:e!=null&&e.court_address?e==null?void 0:e.court_address:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Date of proceeding"}),s.jsx("div",{children:e!=null&&e.date_of_proceeding?e==null?void 0:e.date_of_proceeding:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Department"}),s.jsx("div",{children:e!=null&&e.department?e==null?void 0:e.department:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Fine Imposed (INR)"}),s.jsx("div",{className:"text-red-500",children:e==null?void 0:e.fine_imposed})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Remark"}),s.jsx("div",{children:e==null?void 0:e.remark})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Challan Status"}),s.jsx("div",{children:e==null?void 0:e.challan_status})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"State Code"}),s.jsx("div",{children:e==null?void 0:e.state_code})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Name of violator"}),s.jsx("div",{children:e==null?void 0:e.name_of_violator})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Sent to reg court"}),s.jsx("div",{children:e==null?void 0:e.sent_to_reg_court})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Sent to virtual court"}),s.jsx("div",{children:e==null?void 0:e.sent_to_virtual_court})]}),(e==null?void 0:e.received_amount)!==void 0&&s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Received Amount"}),s.jsx("div",{children:e==null?void 0:e.received_amount})]}),(e==null?void 0:e.receipt_no)!==void 0&&s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Receipt No"}),s.jsx("div",{children:e!=null&&e.receipt_no?e==null?void 0:e.receipt_no:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Sent to court on"}),s.jsx("div",{children:e!=null&&e.sent_to_court_on?e==null?void 0:e.sent_to_court_on:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Driver Name"}),s.jsx("div",{children:e!=null&&e.driver_name?e==null?void 0:e.driver_name:"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"RTO District Name"}),s.jsx("div",{children:e!=null&&e.rto_district_name||e!=null&&e.rto_distric_name?(e==null?void 0:e.rto_district_name)||(e==null?void 0:e.rto_distric_name):"NA"})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Amount of fine Imposed"}),s.jsx("div",{children:e!=null&&e.amount_of_fine_imposed?e==null?void 0:e.amount_of_fine_imposed:"NA"})]})]}),s.jsx("p",{className:"text-center text-white",style:{background:m.ThemeBlue},children:"Offence Details"}),s.jsx("div",{className:"grid lg:grid-cols-2 md:grid-cols-2 sm:grid-cols-2",children:((l=e==null?void 0:e.offence_details)==null?void 0:l.length)>0?(t=e==null?void 0:e.offence_details)==null?void 0:t.map((r,x)=>s.jsxs(q.Fragment,{children:[s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Act"}),s.jsx("div",{children:r==null?void 0:r.act})]}),s.jsxs("div",{className:"p-2 border",children:[s.jsx("div",{className:"text-black",children:"Name"}),s.jsx("div",{children:r==null?void 0:r.name})]})]},x)):"No Data Found"})]})}const W=({PDFHEad:e=[],tableName:p,PDFBODY:l=[]})=>{const t=()=>{const x=l.length,v=Math.max(3e3,50+x*30),d=new Q("landscape","pt",[v,3e3]),n=l.map(j=>r(j));
1d.autoTable({head:e,body:n,styles:{fontSize:10,cellPadding:5},theme:"grid",startY:20}),d.save(p)};function r(x){const v=x.findIndex(n=>Array.isArray(n)&&n.length>0&&"act"in(n[0]||{}));let d=[...x];if(v!==-1){const j=x[v].map(c=>{const o=(c==null?void 0:c.act)===null||(c==null?void 0:c.act)===void 0||typeof(c==null?void 0:c.act)=="object"?"N/A":String(c.act),b=(c==null?void 0:c.name)===null||(c==null?void 0:c.name)===void 0||typeof(c==null?void 0:c.name)=="object"?"N/A":String(c.name);return`Act: ${o}, Name: ${b}`}).join(` 2`);return d.splice(v,1,j),d}else return d.push("No Offence Details Found"),d}return s.jsx("div",{children:s.jsxs("button",{className:"px-4 py-2 shadow rounded-md text-white text-xs flex items-center gap-x-3",style:{background:m.ThemeBlue},onClick:t,children:[s.jsx("div",{children:"Download PDF"}),s.jsx(G,{size:20})]})})};function ne(){var n,j,c,o,b,N,a,f,i,u,_,g,k,y,D,A,w,S,T,P,C,J,M,H,U,L;const[e,p]=z.useState("activeChallan"),l=B(h=>h.EChallanReducer),t=h=>{p(h)};var r=((j=(n=l==null?void 0:l.challans)==null?void 0:n.Disposed_data)==null?void 0:j.length)!==0&&Object.keys((o=(c=l==null?void 0:l.challans)==null?void 0:c.Disposed_data)==null?void 0:o[0]).map(h=>h.toUpperCase()),x=((N=(b=l==null?void 0:l.challans)==null?void 0:b.Pending_data)==null?void 0:N.length)!==0&&Object.keys((f=(a=l==null?void 0:l.challans)==null?void 0:a.Pending_data)==null?void 0:f[0]).map(h=>h.toUpperCase()),v=((u=(i=l==null?void 0:l.challans)==null?void 0:i.Disposed_data)==null?void 0:u.map(h=>Object.values(h)))||[],d=((g=(_=l==null?void 0:l.challans)==null?void 0:_.Pending_data)==null?void 0:g.map(h=>Object.values(h)))||[];return s.jsxs("div",{className:"my-10",children:[s.jsxs("div",{className:"flex items-center justify-center gap-x-5",children:[s.jsx("div",{style:{background:e==="activeChallan"?m.ThemeBlue:"white",border:`1px solid ${m.ThemeBlue}`},className:`px-10 py-3 ${e==="activeChallan"?"text-white ":"text-black"} rounded-md `,onClick:()=>t("activeChallan"),children:" Active Challan "}),s.jsx("div",{style:{background:e==="DisposedChallan"?m.ThemeBlue:"white",border:`1px solid ${m.ThemeBlue}`},className:`px-10 py-3 ${e==="DisposedChallan"?"text-white":"text-black"} rounded-md`,onClick:()=>t("DisposedChallan"),children:" Disposed Challan "})]}),e==="activeChallan"&&((y=Object.keys((k=l==null?void 0:l.challans)==null?void 0:k.Pending_data))==null?void 0:y.length)!==0&&s.jsx("div",{className:"mt-10",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between w-full items-center",children:[s.jsxs("div",{className:"text-black font-bold mt-2",children:["E-Challan |",s.jsx("span",{style:{color:m.ThemeBlue},children:" Active "})]}),s.jsx(W,{PDFHEad:e==="activeChallan"?[x]:[r],PDFBODY:d,tableName:"Activechallan.pdf",mainHeading:"E-Challan | Active"})]}),((D=l==null?void 0:l.challans)==null?void 0:D.Pending_data)&&((w=(A=l==null?void 0:l.challans)==null?void 0:A.Pending_data)==null?void 0:w.map((h,O)=>s.jsxs("div",{children:[s.jsxs("div",{style:{color:m.ThemeBlue},className:"my-3",children:["Active Challan ",O+1]}),s.jsx(V,{data:h})]},O)))]})}),e==="DisposedChallan"&&((T=Object.keys((S=l==null?void 0:l.challans)==null?void 0:S.Disposed_data))==null?void 0:T.length)!==0&&s.jsxs("div",{className:"mt-10",children:[s.jsxs("div",{className:"flex justify-between w-full items-center",children:[s.jsxs("div",{className:"text-black font-bold mt-2",children:["E-Challan | ",s.jsx("span",{style:{color:m.ThemeBlue},children:"Disposed "})]}),s.jsx(W,{PDFHEad:e==="activeChallan"?[x]:[r],PDFBODY:v,tableName:"Disposedchallan.pdf",mainHeading:"E-Challan | Active"})]}),s.jsx("div",{className:"flex flex-wrap flex-col gap-5",children:((P=l==null?void 0:l.challans)==null?void 0:P.Disposed_data)&&((J=(C=l==null?void 0:l.challans)==null?void 0:C.Disposed_data)==null?void 0:J.map((h,O)=>s.jsxs("div",{children:[s.jsxs("div",{style:{color:m.ThemeBlue},className:"my-3",children:["Disposed Challan ",O+1]}),s.jsx(V,{data:h})]})))})]}),(l==null?void 0:l.challans)!==null&&(((H=(M=l==null?void 0:l.challans)==null?void 0:M.Disposed_data)==null?void 0:H.length)===0&&e==="DisposedChallan"||((L=(U=l==null?void 0:l.challans)==null?void 0:U.Pending_data)==null?void 0:L.length)===0&&e==="activeChallan")?s.jsxs("div",{className:" flex flex-col text-center items-center justify-center pt-32",children:[s.jsx("img",{src:ie,className:"w-96"}),s.jsx("div",{children:"No data found!"})]}):""]})}function je(){var c;const e=B(o=>o.ApiReducer),p=B(o=>o.SubscriptionReducer),[l,t]=z.useState(!1),r=B(o=>o.EChallanReducer),x=B(o=>
2o.UserReducer),[v,d]=z.useState(!1),n=X(),j=()=>{var o,b,N,a,f;((o=e==null?void 0:e.apiJson)==null?void 0:o.vehiclenumber)===void 0?n(F({vehiclenumber:"Vehicle number is required"},I)):R.test((b=e==null?void 0:e.apiJson)==null?void 0:b.vehiclenumber)?(n(F({},I)),n(K(null)),(N=e==null?void 0:e.apiJson)!=null&&N.vehiclenumber&&((a=e==null?void 0:e.apiJson)==null?void 0:a.vehiclenumber)!==""&&(t(!0),se(ee,{vehicleNumber:(f=e==null?void 0:e.apiJson)==null?void 0:f.vehiclenumber},!1,n,p,x).then(i=>{var u,_,g,k,y,D,A,w,S,T,P,C;t(!1),i=="complete"?d("profileComplitionAlert"):((k=(g=(_=(u=i==null?void 0:i.doc)==null?void 0:u.response)==null?void 0:_[0])==null?void 0:g.response)==null?void 0:k.message)==="Record finds successfully"?n(K((w=(A=(D=(y=i==null?void 0:i.doc)==null?void 0:y.response)==null?void 0:D[0])==null?void 0:A.response)==null?void 0:w.data)):((C=(P=(T=(S=i==null?void 0:i.doc)==null?void 0:S.response)==null?void 0:T[0])==null?void 0:P.response)==null?void 0:C.code)==="305"?$.error("No Records Found"):(i==null?void 0:i.status)===201?$.error("Please try again later"):(i==null?void 0:i.status)===500&&$.error("Server did not respond")}))):n(F({vehiclenumber:"Invalid vehicle number"},I))};return s.jsxs("main",{className:" mb-10",children:[s.jsx("div",{className:"-mx-10 ",style:{backgroundImage:`url( ${le})`,backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"cover"},children:s.jsx("div",{className:"",style:{background:"rgba(0, 0, 0, 0.80)"},children:s.jsx("div",{style:{height:"55vh"},className:"flex items-center",children:s.jsx("div",{className:"flex justify-between gap-x-10 px-20",children:s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center",children:s.jsx(Y,{size:"5xl",color:m.WHITE,font:"bold",title:"Know Your Challan"})}),s.jsx("div",{className:"mt-2",children:s.jsx(Y,{size:"xl",color:"#7fdef4",font:"medium",title:"Stay Informed, Stay Safe"})}),s.jsx("div",{className:"mt-5",children:s.jsx(ce,{error:!!((c=e==null?void 0:e.apiJsonError)!=null&&c.vehiclenumber),uppercase:!0,name:"vehiclenumber",placeholder:"Enter vehicle number",type2Loader:""})}),s.jsx("div",{className:"mt-5 ",children:s.jsx(Z,{type:l?"loader":!1,title:"Search",font:"font-bold",width:40,onClick:j})})]})})})})}),(r==null?void 0:r.challans)&&s.jsx(ne,{}),v==="profileComplitionAlert"&&s.jsx(E,{closeState:d,alert:v})]})}
2export{je 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.