@djb25/digit-ui-module-ekyc 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),a=e(t),n=require("react-i18next"),l=require("react-router-dom"),o=require("@djb25/digit-ui-react-components"),r=require("chart.js/auto"),i=e(r),s=require("react-icons/fa"),c=require("recharts");const d=e=>{let{countData:l}=e;const{t:o}=n.useTranslation(),s=t.useRef(null),c=t.useRef(null),d=(null==l?void 0:l.total)||0,m=(null==l?void 0:l.pending)||0,u=(null==l?void 0:l.completed)||0,p=(null==l?void 0:l.completed)||0,E=p,v=d>0?Math.round(p/d*100):0,y=d>0?Math.round(E/d*100):0,g=e=>new Intl.NumberFormat("en-IN").format(e||0);t.useEffect(()=>{if(s.current){c.current&&c.current.destroy();const e=s.current.getContext("2d");c.current=new(r.Chart||i||r)(e,{type:"doughnut",data:{labels:[o("EKYC_ACTIVE"),o("EKYC_PENDING"),o("EKYC_COMPLETED")],datasets:[{data:[u,m,0],backgroundColor:["#0c2a52","#77B6EA","#c8ddf5"],borderColor:["#ffffff","#ffffff","#ffffff"],borderWidth:2,hoverOffset:4}]},options:{cutout:"75%",plugins:{legend:{display:!1}},maintainAspectRatio:!1,responsive:!0}})}return()=>{c.current&&c.current.destroy()}},[m,0,u,o]);const N=[{color:"#0c2a52",label:o("EKYC_ACTIVE"),value:u},{color:"#77B6EA",label:o("EKYC_PENDING"),value:m},{color:"#c8ddf5",label:o("EKYC_COMPLETED"),value:0}];return a.createElement("div",{className:"ekyc-employee-container"},a.createElement("div",{className:"status-cards-wrapper"},a.createElement("div",{className:"status-cards-header"},a.createElement("div",null,a.createElement("div",{className:"eyebrow"},a.createElement("span",{className:"eyebrow-dot"}),o("EKYC_INSTITUTIONAL_OVERVIEW")||"Institutional Performance Overview"),a.createElement("h1",{className:"status-cards-h1"},o("EKYC_DASHBOARD_TITLE")||"eKYC Verification Dashboard"),a.createElement("p",{className:"status-cards-subtitle"},o("EKYC_DASHBOARD_SUBTITLE")||"Real-time monitoring of consumer verification workflows across all administrative zones.")),a.createElement("div",{className:"total-applications-card"},a.createElement("div",{className:"total-label"},o("EKYC_TOTAL_APPLICATIONS")||"Total Applications Processed"),a.createElement("div",{className:"total-number"},g(d)),a.createElement("div",{className:"total-badge"},"↗ +12.4% ",o("EKYC_FROM_LAST_QUARTER")||"from last quarter"))),a.createElement("div",{className:"status-panels-grid"},a.createElement("div",{className:"status-panel"},a.createElement("div",{className:"panel-title"},o("EKYC_STATUS_BREAKDOWN")||"Status Breakdown"),a.createElement("div",{className:"panel-subtitle"},o("EKYC_VERIFICATION_LIFECYCLE")||"Verification lifecycle distribution"),a.createElement("div",{className:"breakdown-body"},a.createElement("div",{className:"status-legend"},N.map(e=>a.createElement("div",{key:e.label,className:"legend-row"},a.createElement("span",{className:"legend-label"},a.createElement("span",{className:"indicator-dot",style:{background:e.color}}),e.label),a.createElement("span",{className:"legend-value"},g(e.value))))),a.createElement("div",{className:"chart-wrapper"},a.createElement("canvas",{ref:s,style:{width:"100%",height:"100%"}}),a.createElement("div",{className:"chart-center"},a.createElement("div",{className:"chart-percentage"},v,"%"),a.createElement("div",{className:"chart-label"},o("EKYC_COMPLETE")||"Complete"))))),a.createElement("div",{className:"status-panel"},a.createElement("div",{className:"panel-title"},o("EKYC_SUBMISSION_HEALTH")||"Submission Health",a.createElement("span",{className:"optimal-badge"},o("EKYC_OPTIMAL")||"Optimal")),a.createElement("div",{className:"panel-subtitle"},o("EKYC_PLATFORM_EFFICIENCY")||"Platform operational efficiency"),a.createElement("div",{className:"health-metrics-row"},a.createElement("div",{className:"health-percentage"},y,"%"),a.createElement("div",{className:"health-trend"},"↗ +2.1%")),a.createElement("div",{className:"status-progress-bar"},a.createElement("div",{className:"progress-fill",style:{width:y+"%"}})),a.createElement("div",{className:"mini-metrics-grid"},a.createElement("div",{className:"metric-box"},a.createElement("div",{className:"metric-label"},o("EKYC_AVG_LATENCY")||"Avg Latency"),a.createElement("div",{className:"metric-value"},"1.2s")),a.createElement("div",{className:"metric-box"},a.createElement("div",{className:"metric-label"},o("EKYC_ERROR_RATE")||"Error Rate"),a.createElement("div",{className:"metric-value"},"0.04%")))))))},m=()=>{const e=Digit.ULBService.getCurrentTenantId(),{isLoading:n,data:l}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},{tenantId:e,offset:0,limit:10},{enabled:!!e}),r=t.useMemo(()=>{const e=(null==l?void 0:l.dashboardInfo)||{};return{total:e.total||0,completed:e.completed||0,pending:e.pending||0,rejected:e.rejected||0,active:e.active||0}},[l]);return n?a.createElement(o.Loader,null):a.createElement(o.Card,{className:"min-width-full"},a.createElement(d,{countData:r}))},u=e=>{var l,r,i;let{onSearch:s,searchParams:c,children:d,...m}=e;const{t:u}=n.useTranslation(),[p,E]=t.useState(()=>({...c})),v=(e,t)=>{E(a=>({...a,[e]:t}))};return a.createElement("div",{className:"ekyc-employee-container"},a.createElement("div",{className:"search-consumer-wrapper"},a.createElement("div",{className:"header-wrapper"},a.createElement(o.Card,{className:"sidebar-title-card"},a.createElement("div",{className:"icon-container"},a.createElement(o.HomeIcon,null)),a.createElement("div",{className:"title-text"},u("EKYC_SEARCH_CONSUMER_HEADER")))),a.createElement("div",{className:"main-content-wrapper"},a.createElement("div",{className:"search-stats-row"},a.createElement("div",{className:"identity-lookup-card"},a.createElement("div",{className:"lookup-card-title"},a.createElement("div",{className:"lookup-icon-bg"},a.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("circle",{cx:"11",cy:"11",r:"8"}),a.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))),a.createElement("span",{className:"lookup-title-text"},u("EKYC_IDENTITY_LOOKUP")||"Identity Lookup")),a.createElement("form",{onSubmit:e=>{e&&e.preventDefault&&e.preventDefault(),s(p)}},a.createElement("div",{className:"inputs-row"},a.createElement("div",{className:"input-group"},a.createElement("label",null,u("EKYC_K_NUMBER")||"K Number",a.createElement("span",{className:"info-badge"},"i")),a.createElement(o.TextInput,{value:null==p?void 0:p.kNumber,onChange:e=>v("kNumber",e.target.value),placeholder:u("EKYC_K_NUMBER_PLACEHOLDER")||"e.g. 8234910234"})),a.createElement("div",{className:"input-group"},a.createElement("label",null,u("EKYC_K_NAME")||"K Name",a.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),a.createElement("circle",{cx:"12",cy:"7",r:"4"}))),a.createElement(o.TextInput,{value:null==p?void 0:p.kName,onChange:e=>v("kName",e.target.value),placeholder:u("EKYC_K_NAME_PLACEHOLDER")||"Consumer name search"}))),a.createElement("div",{className:"actions-row"},a.createElement("button",{type:"button",onClick:()=>{const e={kNumber:"",kName:""};E(e),s(e)},className:"clear-btn"},u("ES_COMMON_CLEAR")||"Clear"),a.createElement("button",{type:"submit",className:"search-btn"},u("ES_COMMON_SEARCH")||"Execute Search")))),a.createElement("div",{className:"stats-column"},a.createElement("div",{className:"audits-card"},a.createElement("div",{className:"audits-label"},u("EKYC_TODAYS_AUDITS")||"Today's Audits"),a.createElement("div",{className:"audits-count"},(null===(l=m.countData)||void 0===l?void 0:l.todaysAudits)||24),a.createElement("div",{className:"audits-change"},a.createElement("span",null,"↗"),(null===(r=m.countData)||void 0===r?void 0:r.auditChange)||"12% increase from yesterday"),a.createElement("div",{className:"audits-watermark"},"M")),a.createElement("div",{className:"queue-card"},a.createElement("div",{className:"queue-label"},u("EKYC_QUEUE_STATUS")||"Queue Status"),a.createElement("div",{className:"queue-content"},a.createElement("div",{className:"queue-status-text"},(null===(i=m.countData)||void 0===i?void 0:i.pendingCount)||3," Pending"),a.createElement("div",{className:"avatar-group"},[0,1].map(e=>a.createElement("div",{key:e,className:"avatar-item"},String.fromCharCode(65+e))),a.createElement("div",{className:"avatar-more"},"+1")))))),d)))},p=e=>{let{searchParams:l,onFilterChange:r,defaultSearchParams:i,...s}=e;const{t:c}=n.useTranslation(),[d,m]=t.useState(()=>({...l}));return a.createElement(o.FilterForm,{onSubmit:()=>{r(d)},handleSubmit:e=>t=>{t&&t.preventDefault(),e()},onResetFilterForm:()=>{m({...i}),r({...i})},id:"ekyc-filter-form",onMobileExclusiveFilterPopupFormClose:s.onClose},a.createElement(o.FilterFormField,null,a.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},c("EKYC_STATUS"),":"),a.createElement(o.Dropdown,{option:[{label:c("EKYC_STATUS_ALL"),value:""},{label:c("EKYC_STATUS_ACTIVE"),value:"ACTIVE"},{label:c("EKYC_STATUS_PENDING"),value:"PENDING START"}],optionKey:"label",select:e=>{const t={...d,status:e};m(t),r(t)},selected:(null==d?void 0:d.status)||{label:c("EKYC_STATUS_ALL"),value:""}})))};function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(null,arguments)}const v={topKpis:{totalWaterConnections:2990996,totalEkycCompleted:2460810,totalPending:530186,totalRejected:224324,agencyEkycCompleted:2352069,citizenSelfEkycCompleted:638927,todaysEkyc:54684,successRate:82,rejectionPercentage:7},executiveMetrics:{totalSurveyors:186,totalSupervisors:56,activeJurisdictions:27,todaysGrowth:2.8,selfEkycAdoption:38,avgApprovalTime:"2.3 Days",riskZones:7,escalationsOpen:18},alerts:[{title:"North East District pending increased",priority:"high",change:"+22%",district:"North East District"},{title:"Agency 2 self eKYC adoption low",priority:"medium",change:"-12%",district:"West District"},{title:"Escalation raised in NWS Bhera Enclave",priority:"high",change:"+18",district:"Outer North"},{title:"Approval rate improved in East District",priority:"low",change:"+9%",district:"East District"}],heatmapData:[{district:"Outer North",intensity:82},{district:"East District",intensity:48},{district:"South District",intensity:67},{district:"North East District",intensity:74}],dailyTrend:[{label:"Mon",completed:270689,pending:491305,rejected:145810},{label:"Tue",completed:442945,pending:466563,rejected:157026},{label:"Wed",completed:615202,pending:441821,rejected:168243},{label:"Thu",completed:812067,pending:413545,rejected:179459},{label:"Fri",completed:1033540,pending:381733,rejected:190675},{label:"Sat",completed:1279621,pending:346388,rejected:201891},{label:"Sun",completed:1574918,pending:303973,rejected:213107}],selfVsAgency:[{label:"Agency1",agency:201457,citizen:758414},{label:"Agency 2",agency:164302,citizen:919322},{label:"Agency 3",agency:328451,citizen:541772}],pendingVsCompleted:[{label:"Agency1",completed:201457,pending:201457},{label:"Agency 2",completed:164302,pending:164302},{label:"Agency 3",completed:328451,pending:77278}],rejectionAnalysis:[{label:"Agency1",rejected:71990,success:72},{label:"Agency 2",rejected:81271,success:77},{label:"Agency 3",rejected:71063,success:86}],vendors:[{id:1,name:"Agency1",assignedConnections:959871,completedEkyc:201457,selfEkyc:758414,pending:201457,rejected:71990,inactiveDemand:1161328,successRate:72,progress:21,supervisors:23,activeSurveyors:64,jurisdictions:["Outer North","North West District","Model Town AC 18","Cluster 2","North District"],dailyPerformance:[{day:"Mon",completed:16116,pending:196084,rejected:53272},{day:"Tue",completed:26189,pending:192727,rejected:55072},{day:"Wed",completed:38276,pending:188698,rejected:57232},{day:"Thu",completed:52378,pending:183997,rejected:59751},{day:"Fri",completed:68495,pending:178625,rejected:62631},{day:"Sat",completed:84611,pending:173253,rejected:65510},{day:"Sun",completed:100728,pending:167880,rejected:68390}],zones:[{agency:"Agency1",district:"Outer North",cluster:"NWS Bhera Enclave",assignedConnections:102669,location:"102669",zroOffice:"NWS Bhera Enclave",assemblyConstituency:"Part of Mundka AC 08",gpsLocation:null,distanceFromFarthestPoint:null,activeDemand:202197,pppZones:15800,inactiveDemand:35265,districtwiseInactiveTotal:237462},{agency:"Agency1",district:"Outer North",cluster:"Narela",assignedConnections:99528,location:"99528",zroOffice:"Narela",assemblyConstituency:"Narela AC 01",activeDemand:99528,pppZones:19465,inactiveDemand:35265},{agency:"Agency1",district:"North West District",cluster:"Rohini AC 13",assignedConnections:71041,location:"71041",zroOffice:"Rohini",assemblyConstituency:"Rithala AC 06",activeDemand:247949,pppZones:28975,inactiveDemand:49494},{agency:"Agency1",district:"Mangol Puri AC 12",cluster:"Model Town AC 18",assignedConnections:68957,location:"68957",zroOffice:"Central North District",assemblyConstituency:"Ashok Vihar",activeDemand:231216,pppZones:16627,inactiveDemand:36915},{agency:"Agency1",district:"Timarpur AC 03",cluster:"Cluster 2",assignedConnections:34862,location:"34862",zroOffice:"Old Delhi District",assemblyConstituency:"Pratap Nagar",activeDemand:99694,pppZones:20011,inactiveDemand:48011},{agency:"Agency1",district:"Bali Maran AC 22",cluster:"North District",assignedConnections:110507,location:"110507",zroOffice:"Burari",assemblyConstituency:"Burari AC 2",activeDemand:178815,pppZones:14700,inactiveDemand:31772}]},{id:2,name:"Agency 2",assignedConnections:1083624,completedEkyc:164302,selfEkyc:919322,pending:164302,rejected:81271,inactiveDemand:1247926,successRate:77,progress:15,supervisors:14,activeSurveyors:64,jurisdictions:["West District","Janak Puri","South District"],dailyPerformance:[{day:"Mon",completed:13144,pending:159920,rejected:60140},{day:"Tue",completed:21359,pending:157182,rejected:62172},{day:"Wed",completed:31217,pending:153896,rejected:64610},{day:"Thu",completed:42718,pending:150062,rejected:67454},{day:"Fri",completed:55862,pending:145681,rejected:70705},{day:"Sat",completed:69006,pending:141299,rejected:73956},{day:"Sun",completed:82151,pending:136918,rejected:77207}],zones:[{agency:"Agency 2",district:"West District",cluster:"Rajouri Garden AC 27",assignedConnections:84506,location:"84506",zroOffice:"Rajouri Garden AC 27",assemblyConstituency:"Punjabi Bagh",activeDemand:470766,pppZones:13269,inactiveDemand:64564},{agency:"Agency 2",district:"West District",cluster:"Tilak Nagar AC 29",assignedConnections:51428,location:"51428",zroOffice:"Tilak Nagar AC 29",assemblyConstituency:"Paschim Vihar",activeDemand:470766,pppZones:6298,inactiveDemand:64564},{agency:"Agency 2",district:"Part of Uttam Nagar & Vikas puri",cluster:"Janak Puri",assignedConnections:163041,location:"163041",zroOffice:"Janakpuri",assemblyConstituency:"Janakpuri AC 30",activeDemand:369772,pppZones:25729,inactiveDemand:60534},{agency:"Agency 2",district:"South District",cluster:"South District",assignedConnections:52803,location:"52803",zroOffice:"R K Puram",assemblyConstituency:"Malviya Nagar AC 43",activeDemand:243086,pppZones:9678,inactiveDemand:39204},{agency:"Agency 2",district:"South District",cluster:"Vasant Kunz",assignedConnections:58997,location:"58997",zroOffice:"Vasant Kunj",assemblyConstituency:"Vasant Kunj",activeDemand:243086,pppZones:6691,inactiveDemand:39204}]},{id:3,name:"Agency 3",assignedConnections:947501,completedEkyc:328451,selfEkyc:541772,pending:77278,rejected:71063,inactiveDemand:1016841,successRate:86,progress:78,supervisors:19,activeSurveyors:58,jurisdictions:["East District","North East District","South East District","MNWS"],dailyPerformance:[{day:"Mon",completed:44120,pending:130002,rejected:5711},{day:"Tue",completed:58221,pending:121998,rejected:7104},{day:"Wed",completed:70218,pending:113201,rejected:8842},{day:"Thu",completed:85124,pending:104006,rejected:9911},{day:"Fri",completed:102315,pending:94441,rejected:11214},{day:"Sat",completed:121009,pending:85218,rejected:12902},{day:"Sun",completed:142118,pending:77278,rejected:14101}],zones:[{agency:"Agency 3",district:"East District",cluster:"Mayur Vihar",assignedConnections:72326,location:"72326",zroOffice:"Mayur Vihar",assemblyConstituency:"Trilokpuri AC 55",activeDemand:328564,pppZones:9691,inactiveDemand:52477},{agency:"Agency 3",district:"East District",cluster:"Yojna Vihar",assignedConnections:40651,location:"40651",zroOffice:"Yojna Vihar",assemblyConstituency:"Vishwas Nagar AC 59",activeDemand:328564,pppZones:10097,inactiveDemand:52477},{agency:"Agency 3",district:"North East District",cluster:"GTB Enclave",assignedConnections:80453,location:"80453",zroOffice:"GTB Enclave",assemblyConstituency:"Seemapuri AC 63",activeDemand:323753,pppZones:10671,inactiveDemand:50575},{agency:"Agency 3",district:"North East District",cluster:"Yamuna Vihar",assignedConnections:90599,location:"90599",zroOffice:"Yamuna Vihar",assemblyConstituency:"Mustafabad AC 69",activeDemand:323753,pppZones:18185,inactiveDemand:50575},{agency:"Agency 3",district:"South East District",cluster:"Kalkaji AC 51",assignedConnections:29188,location:"29188",zroOffice:"Kalkaji AC 51",assemblyConstituency:"Saket",activeDemand:136102,pppZones:3675,inactiveDemand:23977},{agency:"Agency 3",district:"South East District",cluster:"Okhla",assignedConnections:18473,location:"18473",zroOffice:"Sarita Vihar/Okhla",assemblyConstituency:"Okhla AC 54",activeDemand:136102,pppZones:3703,inactiveDemand:23977}]}]},y=e=>{let{data:t=[]}=e;const n=t.map(e=>({...e,agencyKyc:e.completed||0,selfKyc:Math.round(.42*(e.completed||0)),totalKyc:(e.completed||0)+Math.round(.42*(e.completed||0))}));return a.createElement("div",{className:"chart-card executive-line-chart"},a.createElement(c.ResponsiveContainer,{width:"100%",height:340},a.createElement(c.LineChart,{data:n,margin:{top:20,right:12,left:0,bottom:0}},a.createElement(c.CartesianGrid,{stroke:"#e2e8f0",strokeDasharray:"3 3",vertical:!1}),a.createElement(c.XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#64748b",fontSize:12,fontWeight:600}}),a.createElement(c.YAxis,{axisLine:!1,tickLine:!1,tick:{fill:"#64748b",fontSize:12}}),a.createElement(c.Tooltip,{cursor:{stroke:"#cbd5e1",strokeWidth:1},contentStyle:{background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:18,boxShadow:"0 10px 30px rgba(15,23,42,0.08)"},labelStyle:{color:"#0f172a",fontWeight:700,marginBottom:10}}),a.createElement(c.Legend,{verticalAlign:"top",align:"right",iconType:"circle",wrapperStyle:{paddingBottom:18,color:"#475569",fontWeight:600}}),a.createElement(c.Line,{type:"monotone",dataKey:"totalKyc",name:"Total eKYC",stroke:"#0f172a",strokeWidth:4,dot:!1,activeDot:{r:6}}),a.createElement(c.Line,{type:"monotone",dataKey:"agencyKyc",name:"Agency eKYC",stroke:"#3b82f6",strokeWidth:3,dot:{r:3},activeDot:{r:6}}),a.createElement(c.Line,{type:"monotone",dataKey:"selfKyc",name:"Self eKYC",stroke:"#10b981",strokeWidth:3,dot:{r:3},activeDot:{r:6}}))))},g=e=>{let{data:t=[],categories:n=[],xKey:l="label"}=e;return a.createElement("div",{className:"chart-card",style:{minHeight:320}},a.createElement(c.ResponsiveContainer,{width:"100%",height:320},a.createElement(c.BarChart,{data:t,margin:{top:12,right:16,left:0,bottom:0}},a.createElement(c.CartesianGrid,{stroke:"rgba(148, 163, 184, 0.12)",strokeDasharray:"4 4"}),a.createElement(c.XAxis,{dataKey:l,axisLine:!1,tickLine:!1,tick:{fill:"#cbd5e1"}}),a.createElement(c.YAxis,{axisLine:!1,tickLine:!1,tick:{fill:"#cbd5e1"}}),a.createElement(c.Tooltip,{contentStyle:{background:"#0f172a",border:"none",borderRadius:14},itemStyle:{color:"#f8fafc"}}),a.createElement(c.Legend,{verticalAlign:"top",align:"right",iconType:"circle",wrapperStyle:{color:"#cbd5e1"}}),n.map((e,t)=>a.createElement(c.Bar,{key:e.key,dataKey:e.key,name:e.name,fill:0===t?"#34d399":"#60a5fa",radius:[12,12,0,0],barSize:24})))))},N=["#22c55e","#38bdf8","#f97316","#facc15","#f43f5e"],C=e=>{let{data:t=[],dataKey:n="value",labelKey:l="label"}=e;return a.createElement("div",{className:"chart-card",style:{minHeight:320}},a.createElement(c.ResponsiveContainer,{width:"100%",height:320},a.createElement(c.PieChart,null,a.createElement(c.Pie,{data:t,dataKey:n,nameKey:l,cx:"50%",cy:"50%",outerRadius:110,innerRadius:60,paddingAngle:3,label:{fill:"#f8fafc",fontSize:12}},t.map((e,t)=>a.createElement(c.Cell,{key:"cell-"+t,fill:N[t%N.length]}))),a.createElement(c.Tooltip,{contentStyle:{background:"#0f172a",border:"none",borderRadius:14,color:"#f8fafc"}}),a.createElement(c.Legend,{verticalAlign:"bottom",align:"center",iconType:"circle",wrapperStyle:{color:"#cbd5e1",marginTop:10}}))))},b=()=>{var e;const n=l.useHistory(),o=l.useLocation(),[r,i]=t.useState(""),[c,d]=t.useState("All"),m=o.pathname.replace(/\/ceo-dashboard$/,""),u=t.useMemo(()=>v.vendors||[],[]),p=t.useMemo(()=>v.topKpis||{},[]),E=t.useMemo(()=>v.dailyTrend||[],[]),N=t.useMemo(()=>v.selfVsAgency||[],[]),b=t.useMemo(()=>v.pendingVsCompleted||[],[]),h=t.useMemo(()=>u.filter(e=>"High Priority"===c?e.successRate<70:"Watchlist"===c?e.pending>35e3:"Stable"!==c||e.successRate>=70).filter(e=>{if(!r)return!0;const t=r.toLowerCase();return e.name.toLowerCase().includes(t)||e.jurisdictions.some(e=>e.toLowerCase().includes(t))||e.zones.some(e=>{var a;return null===(a=e.location)||void 0===a?void 0:a.toLowerCase().includes(t)})}),[u,r,c]),f=t.useMemo(()=>u.flatMap(e=>e.zones.map(t=>({...t,agency:e.name}))).filter(e=>e.location).sort((e,t)=>(t.activeDemand||0)-(e.activeDemand||0)),[u]);return a.createElement("div",{className:"ekyc-dashboard-wrapper"},a.createElement("div",{className:"dashboard-shell"},a.createElement("section",{className:"kpi-grid"},[{title:"Total Water Connections",value:p.totalWaterConnections,icon:a.createElement(s.FaUsers,null),variant:"primary"},{title:"Total eKYC Completed",value:p.totalEkycCompleted,icon:a.createElement(s.FaCheckCircle,null),variant:"success"},{title:"Total Pending",value:p.totalPending,icon:a.createElement(s.FaClock,null),variant:"warning"},{title:"Total Rejected",value:p.totalRejected,icon:a.createElement(s.FaExclamationTriangle,null),variant:"danger"},{title:"Agency eKYC Completed",value:p.agencyEkycCompleted,icon:a.createElement(s.FaUserTie,null),variant:"info"},{title:"Citizen Self eKYC Completed",value:p.citizenSelfEkycCompleted,icon:a.createElement(s.FaUsers,null),variant:"secondary"},{title:"Today's eKYC",value:p.todaysEkyc,icon:a.createElement(s.FaChartLine,null),variant:"muted"},{title:"Success Rate",value:p.successRate+"%",icon:a.createElement(s.FaCheckCircle,null),variant:"success"},{title:"Rejection Percentage",value:p.rejectionPercentage+"%",icon:a.createElement(s.FaExclamationTriangle,null),variant:"danger"}].map(e=>{var t,n;return a.createElement("article",{key:e.title,className:"kpi-card card-"+e.variant},a.createElement("div",{className:"kpi-icon"},e.icon),a.createElement("div",null,a.createElement("p",{className:"kpi-title"},e.title),a.createElement("h2",null,(null===(t=e.value)||void 0===t||null===(n=t.toLocaleString)||void 0===n?void 0:n.call(t))??e.value)))})),a.createElement("section",{className:"vendor-section"},a.createElement("div",{className:"section-top"},a.createElement("div",null,a.createElement("h2",null,"Agency Performance Snapshot"),a.createElement("p",null,"Search, filter, and navigate into detailed analytics for every assigned vendor.")),a.createElement("div",{className:"vendor-filters"},a.createElement("div",{className:"search-box"},a.createElement(s.FaSearch,null),a.createElement("input",{type:"text",placeholder:"Search agency, jurisdiction, location",value:r,onChange:e=>i(e.target.value)})),a.createElement("div",{className:"status-pill-group"},["All","High Priority","Stable","Watchlist"].map(e=>a.createElement("button",{key:e,className:"status-pill "+(c===e?"active":""),onClick:()=>d(e)},e))))),a.createElement("div",{className:"vendor-grid"},h.map(e=>a.createElement("div",{key:e.id,className:"vendor-card glass-card",onClick:()=>{n.push(`${m}/vendors/${e.id}`)}},a.createElement("div",{className:"vendor-card-top"},a.createElement("div",null,a.createElement("p",{className:"vendor-chip"},e.name),a.createElement("h3",null,e.assignedConnections.toLocaleString()),a.createElement("p",{className:"vendor-subtitle"},"Assigned connections across ",e.jurisdictions.length," jurisdiction(s)")),a.createElement("div",{className:"vendor-progress-value"},e.progress,"%")),a.createElement("div",{className:"progress-bar"},a.createElement("div",{className:"progress-fill",style:{width:e.progress+"%"}})),a.createElement("div",{className:"vendor-stats-grid"},a.createElement("div",null,a.createElement("strong",null,e.completedEkyc.toLocaleString()),a.createElement("span",null,"Agency eKYC")),a.createElement("div",null,a.createElement("strong",null,e.selfEkyc.toLocaleString()),a.createElement("span",null,"Self eKYC")),a.createElement("div",null,a.createElement("strong",null,e.pending.toLocaleString()),a.createElement("span",null,"Pending")),a.createElement("div",null,a.createElement("strong",null,e.rejected.toLocaleString()),a.createElement("span",null,"Rejected"))),a.createElement("div",{className:"vendor-card-footer"},a.createElement("span",null,e.activeSurveyors," Surveyors"),a.createElement("span",null,e.supervisors," Supervisors"),a.createElement("span",null,e.jurisdictions.join(", "))),a.createElement("div",{className:"vendor-card-action"},a.createElement("span",null,"Explore analytics"),a.createElement(s.FaArrowRight,null)))))),a.createElement("section",{className:"analytics-grid"},a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Daily eKYC Trend"),a.createElement("span",{className:"badge success"},"Live index")),a.createElement(y,{data:E,dataKey:"completed",name:"Completed"})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Self vs Agency eKYC"),a.createElement("span",{className:"badge info"},"Adoption")),a.createElement(g,{data:N,categories:[{key:"agency",name:"Agency"},{key:"citizen",name:"Citizen"}]})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Pending vs Completed"),a.createElement("span",{className:"badge warning"},"Operational pulse")),a.createElement(C,{data:b,dataKey:"completed",labelKey:"label"}))),a.createElement("section",{className:"zone-section"},a.createElement("div",{className:"section-header"},a.createElement("div",null,a.createElement("h2",null,a.createElement(s.FaMapMarkedAlt,null)," Jurisdiction Performance"),a.createElement("p",null,"Top zones evaluated from the full agency dataset.")),a.createElement("button",{className:"secondary-button"},"Export Zone Data")),a.createElement("div",{className:"table-wrapper glass-card"},a.createElement("table",null,a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Agency"),a.createElement("th",null,"Location"),a.createElement("th",null,"District"),a.createElement("th",null,"Assigned"),a.createElement("th",null,"Agency eKYC"),a.createElement("th",null,"Pending"),a.createElement("th",null,"Progress"))),a.createElement("tbody",null,f.slice(0,10).map((e,t)=>{var n,l,o;return a.createElement("tr",{key:`${e.agency}-${e.location}-${t}`},a.createElement("td",null,e.agency),a.createElement("td",null,e.location),a.createElement("td",null,e.district||e.cluster),a.createElement("td",null,(null===(n=e.activeDemand)||void 0===n?void 0:n.toLocaleString())??"—"),a.createElement("td",null,(null===(l=e.pppZones)||void 0===l?void 0:l.toLocaleString())??"—"),a.createElement("td",null,(null===(o=e.inactiveDemand)||void 0===o?void 0:o.toLocaleString())??"—"),a.createElement("td",null,a.createElement("span",{className:"status-badge success"},Math.min(100,Math.round((e.pppZones||0)/Math.max(e.activeDemand||1,1)*100)),"%")))}))))),a.createElement("section",{className:"bottom-grid"},a.createElement("div",{className:"alerts-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,a.createElement(s.FaExclamationTriangle,null)," Critical Alerts")),a.createElement("div",{className:"alerts-list"},["North East District has 22% more pending accounts than last week","Agency 2 has a 12% improvement opportunity in Self eKYC adoption","Urgent: 18 supervisor escalations raised for NWS Bhera Enclave","Risk alert: Rejection trends are rising in Outer North clusters"].map(e=>a.createElement("div",{key:e,className:"alert-card"},a.createElement(s.FaExclamationTriangle,null),a.createElement("p",null,e))))),a.createElement("div",{className:"efficiency-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,a.createElement(s.FaUserTie,null)," Workforce & Efficiency")),a.createElement("div",{className:"efficiency-grid"},a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,"48"),a.createElement("p",null,"Supervisors Online")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,"168"),a.createElement("p",null,"Surveyors Active")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,null===(e=p.todayEkyc)||void 0===e?void 0:e.toLocaleString()),a.createElement("p",null,"eKYC Completed Today")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,p.successRate,"%"),a.createElement("p",null,"Operational Efficiency")))))))},h=()=>{var e,n;const o=l.useHistory(),{vendorId:r=1}=l.useParams(),i=t.useMemo(()=>v.vendors.find(e=>e.id===Number(r)),[r]),c=Digit.ULBService.getCurrentTenantId();if(Digit.Hooks.ekyc.useEkycSurveyorDashboard({},{tenantId:c,offset:0,limit:10},{enabled:!!c}),!i)return a.createElement("div",{className:"ekyc-dashboard-wrapper"},a.createElement("div",{className:"dashboard-shell"},a.createElement("div",{className:"detail-header"},a.createElement("button",{className:"back-button",onClick:()=>o.goBack()},a.createElement(s.FaArrowLeft,null)," Back")),a.createElement("div",{className:"empty-state"},a.createElement("h2",null,"Vendor analytics not found"),a.createElement("p",null,"The selected vendor does not exist in the current report. Please return to the dashboard."))));const d=i.zones.slice(0,8),m=i.dailyPerformance.map(e=>({day:e.day,completed:e.completed,pending:e.pending,rejected:e.rejected}));return a.createElement("div",{className:"ekyc-dashboard-wrapper"},a.createElement("div",{className:"dashboard-shell detail-shell"},a.createElement("section",{className:"kpi-grid detail-kpi-grid"},[{label:"Assigned Connections",value:i.assignedConnections,icon:a.createElement(s.FaUsers,null),variant:"primary"},{label:"Agency eKYC",value:i.completedEkyc,icon:a.createElement(s.FaCheckCircle,null),variant:"success"},{label:"Self eKYC",value:i.selfEkyc,icon:a.createElement(s.FaUsers,null),variant:"info"},{label:"Pending",value:i.pending,icon:a.createElement(s.FaClock,null),variant:"warning"},{label:"Rejected",value:i.rejected,icon:a.createElement(s.FaExclamationTriangle,null),variant:"danger"},{label:"Success Rate",value:i.successRate+"%",icon:a.createElement(s.FaCheckCircle,null),variant:"success"}].map(e=>{var t,n;return a.createElement("article",{key:e.label,className:"kpi-card card-"+e.variant},a.createElement("div",{className:"kpi-icon"},e.icon),a.createElement("div",null,a.createElement("p",{className:"kpi-title"},e.label),a.createElement("h2",null,(null===(t=e.value)||void 0===t||null===(n=t.toLocaleString)||void 0===n?void 0:n.call(t))??e.value)))})),a.createElement("section",{className:"analytics-grid detail-analytics-grid"},a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Daily Completion Trend"),a.createElement("span",{className:"badge success"},"Performance")),a.createElement(y,{data:m,dataKey:"completed",name:"Completed"})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Pending vs Completed"),a.createElement("span",{className:"badge warning"},"Workload")),a.createElement(g,{data:m,categories:[{key:"completed",name:"Completed"},{key:"pending",name:"Pending"}],xKey:"day"})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Self vs Agency Split"),a.createElement("span",{className:"badge info"},"Adoption")),a.createElement(C,{data:[{label:"Agency eKYC",value:i.completedEkyc},{label:"Citizen Self eKYC",value:i.selfEkyc}],dataKey:"value",labelKey:"label"}))),a.createElement("section",{className:"zone-section detail-zone-section"},a.createElement("div",{className:"section-header"},a.createElement("div",null,a.createElement("h2",null,a.createElement(s.FaMapMarkedAlt,null)," Zone-wise Jurisdiction Analytics"),a.createElement("p",null,"Drill into the current operational load and heatmap intensity for this vendor."))),a.createElement("div",{className:"table-wrapper glass-card"},a.createElement("table",null,a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Zone"),a.createElement("th",null,"Cluster"),a.createElement("th",null,"Assigned"),a.createElement("th",null,"Agency eKYC"),a.createElement("th",null,"Pending"),a.createElement("th",null,"Activity Score"))),a.createElement("tbody",null,d.map((e,t)=>{var n,l,o;return a.createElement("tr",{key:`${e.location}-${t}`},a.createElement("td",null,e.location),a.createElement("td",null,e.cluster||e.district),a.createElement("td",null,(null===(n=e.activeDemand)||void 0===n?void 0:n.toLocaleString())??"—"),a.createElement("td",null,(null===(l=e.pppZones)||void 0===l?void 0:l.toLocaleString())??"—"),a.createElement("td",null,(null===(o=e.inactiveDemand)||void 0===o?void 0:o.toLocaleString())??"—"),a.createElement("td",null,a.createElement("span",{className:"status-badge "+(e.intensityScore>65?"danger":e.intensityScore>45?"warning":"success")},e.intensityScore,"%")))}))))),a.createElement("section",{className:"bottom-grid detail-bottom-grid"},a.createElement("div",{className:"cards-summary glass-card"},a.createElement("h2",null,"Operational Efficiency"),a.createElement("div",{className:"efficiency-grid"},a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,i.activeSurveyors),a.createElement("p",null,"Active Surveyors")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,i.supervisors),a.createElement("p",null,"Supervisors")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,i.progress,"%"),a.createElement("p",null,"Execution Rate")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,null===(e=i.dailyPerformance.slice(-1)[0])||void 0===e||null===(n=e.completed)||void 0===n?void 0:n.toLocaleString()),a.createElement("p",null,"Latest Day Completed")))),a.createElement("div",{className:"cards-summary glass-card"},a.createElement("h2",null,"Supervisor Pulse"),a.createElement("div",{className:"pulse-list"},i.jurisdictions.map(e=>a.createElement("div",{key:e,className:"pulse-row"},a.createElement("span",null,e),a.createElement("span",null,Math.max(12,Math.round(38*Math.random()))," active"))))))))},f=e=>{var o,r,i,s,c,d;let{onPageSizeChange:m,formState:u,totalCount:p,table:E,dispatch:v,checkPathName:y,onSortingByData:g,tenantId:N,inboxStyles:C={},tableStyle:b={}}=e;const{t:h}=n.useTranslation(),f=l.useHistory(),[S,k]=t.useState(""),{data:T,getReview:D}=Digit.Hooks.ekyc.useEkycAPI("review",N),_=e=>{k(e),D({kno:e})},A=(null==u||null===(o=u.tableForm)||void 0===o?void 0:o.limit)||10,I=(null==u||null===(r=u.tableForm)||void 0===r?void 0:r.offset)||0,R=(null===(i=Digit.SessionStorage.get("User"))||void 0===i||null===(s=i.info)||void 0===s||null===(c=s.type)||void 0===c?void 0:c.toLowerCase())||"citizen";a.useEffect(()=>{T&&f.push(`/digit-ui/${R}/ekyc/review/${S}`,{aadhaarData:null==T?void 0:T.aadhaarData,reviewData:T})},[T]);const O=[{Header:h("EKYC_APPLICATION_NO"),accessor:"applicationNumber",disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",onClick:()=>_(o)},o)}},{Header:h("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:n}=e;return a.createElement("span",null,(null===(t=n.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:h("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:n}=e;const l=(null===(t=n.original)||void 0===t?void 0:t.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+l},h(""+l))}},{Header:h("EKYC_EKYC_STATUS"),accessor:"ekycStatus",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.ekycStatus)||(null===(n=l.original)||void 0===n?void 0:n.ekycstatus)||"NA";return a.createElement("span",{className:"ekyc-status-tag "+o},h(""+o))}},{Header:h("EKYC_REVIEW"),accessor:"review",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>_(o)},h("EKYC_REVIEW"))}}];return{disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:m,currentPage:I,onNextPage:()=>{var e;return v({action:"mutateTableForm",data:{...u.tableForm,offset:parseInt(null===(e=u.tableForm)||void 0===e?void 0:e.offset)+10},checkPathName:y})},onPrevPage:()=>{var e;return v({action:"mutateTableForm",data:{...u.tableForm,offset:parseInt(null===(e=u.tableForm)||void 0===e?void 0:e.offset)-10},checkPathName:y})},pageSizeLimit:A,onSort:g,totalRecords:p,onSearch:null==u||null===(d=u.searchForm)||void 0===d?void 0:d.message,onLastPage:()=>v({action:"mutateTableForm",data:{...u.tableForm,offset:Math.max(0,Math.ceil(p/A)-10)},checkPathName:y}),onFirstPage:()=>v({action:"mutateTableForm",data:{...u.tableForm,offset:0},checkPathName:y}),data:E,columns:O,inboxStyles:{...C},tableStyle:{...b}}};function S(e,t){try{var a=e()}catch(e){return t(e)}return a&&a.then?a.then(void 0,t):a}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var k=e=>null==e;const T=e=>"object"==typeof e;var D=e=>!k(e)&&!Array.isArray(e)&&T(e)&&!(e instanceof Date),_=e=>e.filter(Boolean),A=e=>void 0===e,I=function(e,t,a){void 0===e&&(e={});const n=_(t.split(/[,[\].]+?/)).reduce((e,t)=>k(e)?e:e[t],e);return A(n)||n===e?A(e[t])?a:e[t]:n},R=e=>"function"==typeof e;const O=t.createContext(null);O.displayName="RHFContext";const M=e=>{const{as:a,render:n}=e,l=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(a[n[l]]=e[n[l]])}return a}(e,["rules","as","render","defaultValue","control","onFocus"]),{field:o,meta:r}=function(e){let{name:a,rules:n,defaultValue:l,control:o,onFocus:r}=e;const i=t.useContext(O);if("production"!==process.env.NODE_ENV&&!o&&!i)throw new Error("📋 Controller is missing `control` prop. https://react-hook-form.com/api#Controller");const{defaultValuesRef:s,setValue:c,register:d,unregister:m,trigger:u,mode:p,reValidateMode:{isReValidateOnBlur:E,isReValidateOnChange:v},formState:y,formStateRef:{current:{isSubmitted:g,touched:N,errors:C}},updateFormState:b,readFormStateRef:h,fieldsRef:f,fieldArrayNamesRef:S,shallowFieldsStateRef:M}=o||i.control,P=!((e,t)=>[...e].some(e=>((e,t)=>RegExp(`^${t}([|.)\\d+`.replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(e))(t,e)))(S.current,a),L=()=>!A(I(M.current,a))&&P?I(M.current,a):A(l)?I(s.current,a):l,[w,K]=t.useState(L()),F=t.useRef(w),Y=t.useRef({focus:()=>null}),x=t.useRef(r||(()=>{R(Y.current.focus)&&Y.current.focus(),"production"!==process.env.NODE_ENV&&(R(Y.current.focus)||console.warn("📋 'ref' from Controller render prop must be attached to a React component or a DOM Element whose ref provides a 'focus()' method"))})),B=t.useCallback(e=>!(e=>{let{isOnBlur:t,isOnChange:a,isOnTouch:n,isTouched:l,isReValidateOnBlur:o,isReValidateOnChange:r,isBlurEvent:i,isSubmitted:s,isOnAll:c}=e;return!c&&(!s&&n?!(l||i):(s?o:t)?!i:!(s?r:a)||i)})(Object.assign({isBlurEvent:e,isReValidateOnBlur:E,isReValidateOnChange:v,isSubmitted:g,isTouched:!!I(N,a)},p)),[E,v,g,N,a,p]),U=t.useCallback(e=>{let[t]=e;const a=(e=>{return k(t=e)||!T(t)||!D(e.target)||D(e.target)&&!e.type?e:A(e.target.value)?e.target.checked:e.target.value;var t})(t);return K(a),F.current=a,a},[]),V=t.useCallback(e=>{if("production"!==process.env.NODE_ENV&&!a)return console.warn("📋 Field is missing `name` prop. https://react-hook-form.com/api#Controller");f.current[a]?f.current[a]=Object.assign({ref:f.current[a].ref},n):(d(Object.defineProperties({name:a,focus:x.current},{value:{set(e){K(e),F.current=e},get:()=>F.current}}),n),e=A(I(s.current,a))),e&&P&&K(L())},[n,a,d]);t.useEffect(()=>()=>m(a),[a]),t.useEffect(()=>{"production"!==process.env.NODE_ENV&&(A(w)&&console.warn(`📋 ${a} is missing in the 'defaultValue' prop of either its Controller (https://react-hook-form.com/api#Controller) or useForm (https://react-hook-form.com/api#useForm)`),!P&&A(l)&&console.warn("📋 Controller is missing `defaultValue` prop when using `useFieldArray`. https://react-hook-form.com/api#Controller")),V()},[V]),t.useEffect(()=>{!f.current[a]&&V(!0)});const H=t.useCallback(()=>{h.current.touched&&!I(N,a)&&(function(e,t,a){let n=-1;const l=(e=>/^\w*$/.test(e))(t)?[t]:_(t.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split(".")),o=l.length,r=o-1;for(;++n<o;){const t=l[n];let a=!0;if(n!==r){const o=e[t];a=D(o)||Array.isArray(o)?o:isNaN(+l[n+1])?{}:[]}e[t]=a,e=e[t]}}(N,a),b({touched:N})),B(!0)&&u(a)},[a,b,B,u,h]);return{field:{onChange:t.useCallback(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c(a,U(t),{shouldValidate:B(),shouldDirty:!0})},[c,a,B]),onBlur:H,name:a,value:w,ref:Y},meta:Object.defineProperties({invalid:!!I(C,a)},{isDirty:{get:()=>!!I(y.dirtyFields,a)},isTouched:{get:()=>!!I(y.touched,a)}})}}(e),i=Object.assign(Object.assign({},l),o);return a?t.isValidElement(a)?t.cloneElement(a,i):t.createElement(a,i):n?n(o,r):null},P=e=>{let{searchFormState:t,controlSearchForm:l}=e;const{t:r}=n.useTranslation(),{errors:i}=t;return a.createElement(a.Fragment,null,a.createElement("span",{className:"mobile-input"},a.createElement(o.Label,{className:"flex-roww flex-gap-2"},r("EKYC_K.NUMBER")||"K Number",a.createElement(o.CustomTooltip,{message:r("EKYC_MOBILE_NUMBER_MESSAGE")})),a.createElement(M,{name:"kNumber",control:l,defaultValue:"",rules:{pattern:{value:/^[0-9]{10}$/,message:r("ERR_INVALID_KNO")}},render:e=>{let{onChange:t,value:n}=e;return a.createElement(o.TextInput,{value:n||"",onChange:e=>t(e.target.value)})}}),(null==i?void 0:i.kNumber)&&a.createElement(o.CardLabelError,null,i.kNumber.message)))},L=e=>{var n,r,i,s;let{parentRoute:c,businessService:d="EKYC",initialStates:m={}}=e;const u=Digit.ULBService.getCurrentTenantId(),p=l.useLocation(),[v,y]=t.useReducer(function(e,t){const a=t.checkPathName?"EKYC.INBOX":"EKYC.SW.INBOX";switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set(a,{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set(a,{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set(a,{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}},{filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}}),g=t.useMemo(()=>{const e=(null==v?void 0:v.searchForm)||{};return{...e,...e.kNumber&&{kno:e.kNumber}}},[null==v?void 0:v.searchForm]),N=t.useMemo(()=>{var e,t;return{tenantId:u,offset:(null==v||null===(e=v.tableForm)||void 0===e?void 0:e.offset)||0,limit:(null==v||null===(t=v.tableForm)||void 0===t?void 0:t.limit)||10}},[u,null==v||null===(n=v.tableForm)||void 0===n?void 0:n.offset,null==v||null===(r=v.tableForm)||void 0===r?void 0:r.limit]),{isLoading:C,data:b={}}=Digit.Hooks.ekyc.useEkycApplicationList(g,N,{enabled:!!u,keepPreviousData:!0}),h=t.useMemo(()=>{var e,t;return{kno:(null==v||null===(e=v.searchForm)||void 0===e?void 0:e.kNumber)||"",name:(null==v||null===(t=v.searchForm)||void 0===t?void 0:t.kName)||""}},[null==v||null===(i=v.searchForm)||void 0===i?void 0:i.kNumber,null==v||null===(s=v.searchForm)||void 0===s?void 0:s.kName]),S=!(!h.kno&&!h.name),{isLoading:k,data:T}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:h},{enabled:!!u&&!!h.kno,keepPreviousData:!0}),D=t.useMemo(()=>S?T?[T]:[]:(null==b?void 0:b.consumerList)||[],[S,T,b]),_=t.useMemo(()=>(D||[]).map(e=>{var t,a,n,l,o,r,i,s;if(e.connectionDetails)return{applicationNo:(null===(t=e.propertyInfo)||void 0===t?void 0:t.kno)||"",connectionNo:(null===(a=e.propertyInfo)||void 0===a?void 0:a.kno)||"",owner:(null===(n=e.connectionDetails)||void 0===n?void 0:n.consumerName)||"",applicationNumber:(null===(l=e.propertyInfo)||void 0===l?void 0:l.kno)||"",citizenName:(null===(o=e.connectionDetails)||void 0===o?void 0:o.consumerName)||"",status:(null===(r=e.connectionDetails)||void 0===r?void 0:r.statusflag)||"",ekycStatus:(null===(i=e.connectionDetails)||void 0===i?void 0:i.ekycStatus)||(null===(s=e.connectionDetails)||void 0===s?void 0:s.ekycstatus)||e.ekycStatus||e.ekycstatus||"NA",sla:0};const c=[e.firstName,e.middleName,e.lastName].filter(Boolean).join(" ");return{...e,applicationNo:e.kno||e.applicationNumber||"",connectionNo:e.kno||"",owner:c||e.consumerName||e.citizenName||"",applicationNumber:e.kno||e.applicationNumber||"",citizenName:c||e.consumerName||e.citizenName||"",status:e.status||"",ekycStatus:e.ekycStatus||e.ekycstatus||"NA",sla:e.sla??0}}),[D]),A=(null==b?void 0:b.totalCount)||0,I=p.pathname.includes("ekyc/inbox"),R=t.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(P,{registerRef:t,searchFormState:n,controlSearchForm:l,className:"search"})},[]),O={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},M={kNumber:"",applicationNumber:"",consumerNo:""},L={SearchFormFields:R,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),y({action:"mutateTableForm",data:{...O},checkPathName:I}),y({action:"mutateSearchForm",data:e,checkPathName:I})},searchFormDefaultValues:null==v?void 0:v.searchForm,resetSearchFormDefaultValues:M,onSearchFormReset:e=>{e("kNumber",null),e("applicationNumber",null),e("consumerNo",null),y({action:"mutateSearchForm",data:M})},className:"search-form-wns-inbox"};t.useCallback(e=>a.createElement(a.Fragment,null),[]);const w=f({parentRoute:c,onPageSizeChange:e=>{const t=Number(e.target.value);y({action:"mutateTableForm",data:{...v.tableForm,limit:t,offset:0},checkPathName:I})},formState:v,totalCount:A,table:_,dispatch:y,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,n=a?"DESC":"ASC";v.tableForm.sortBy===t&&v.tableForm.sortOrder===n||y({action:"mutateTableForm",data:{...v.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"},checkPathName:I})}},tenantId:u,checkPathName:I,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(o.InboxComposer,E({isInboxLoading:C||k},L,{propsForInboxTable:w,formState:v,countData:b})))},w=[{name:"Amit Kumar",id:"SVR001",role:"Surveyor"},{name:"Sanjay Singh",id:"SVR002",role:"Surveyor"},{name:"Rahul Sharma",id:"SVR003",role:"Surveyor"},{name:"Priya Verma",id:"SVR004",role:"Surveyor"}],K=[{name:"MRD - 01 (Central Zone)",code:"MRD01",zone:"Central"},{name:"MRD - 02 (North Zone)",code:"MRD02",zone:"North"},{name:"MRD - 03 (South Zone)",code:"MRD03",zone:"South"},{name:"MRD - 04 (West Zone)",code:"MRD04",zone:"West"},{name:"MRD - 05 (East Zone)",code:"MRD05",zone:"East"},{name:"MRD - 06 (Rohini)",code:"MRD06",zone:"Rohini"},{name:"MRD - 07 (Dwarka)",code:"MRD07",zone:"Dwarka"}],F=()=>{const{t:e}=n.useTranslation(),[l,r]=t.useState(null),[i,s]=t.useState(null),[c,d]=t.useState([]),[m,u]=t.useState(null),[p,E]=t.useState(null),[v,y]=t.useState(null),[g,N]=t.useState(null),[C,b]=t.useState(null),h=()=>{u(null),E(null),y(null)},f=t.useMemo(()=>[{Header:e("EKYC_SURVEYOR_NAME")||"Surveyor",accessor:"surveyorName",Cell:t=>{let{row:n}=t;return m===n.original.id?a.createElement(o.Dropdown,{selected:p,select:E,option:w,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_SURVEYOR_PLACEHOLDER")||"Choose surveyor..."}):a.createElement("div",null,a.createElement("span",{className:"link"},n.original.surveyorName),a.createElement("div",{style:{fontSize:"12px",color:"#666"}},n.original.surveyorId))}},{Header:e("EKYC_MRD_ASSIGNED")||"MRD Assigned",accessor:"mrdName",Cell:t=>{let{row:n}=t;return m===n.original.id?a.createElement(o.Dropdown,{selected:v,select:y,option:K,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_MRD_PLACEHOLDER")||"Choose MRD..."}):a.createElement("div",null,a.createElement("span",null,n.original.mrdName),a.createElement("div",{style:{fontSize:"12px",color:"#666"}},n.original.zone))}},{Header:e("ES_COMMON_ACTION")||"Actions",Cell:t=>{let{row:n}=t;return m===n.original.id?a.createElement("div",{style:{display:"flex",gap:"10px"}},a.createElement("span",{style:{cursor:"pointer",color:"#f47738",fontWeight:"bold"},onClick:()=>{return t=n.original.id,void(p&&v?c.some(e=>e.id!==t&&e.surveyorId===p.id&&e.mrdCode===v.code)?b({type:"warning",message:e("EKYC_MAPPING_EXISTS")||"This mapping already exists"}):(d(e=>e.map(e=>e.id!==t?e:{...e,surveyorName:p.name,surveyorId:p.id,mrdName:v.name,mrdCode:v.code,zone:v.zone})),u(null),b({type:"success",message:e("EKYC_MAPPING_UPDATED")||"Mapping updated successfully"})):b({type:"error",message:e("EKYC_SELECT_BOTH_ERROR")||"Please select both Surveyor and MRD to save"}));var t}},e("ES_COMMON_SAVE")),a.createElement("span",{style:{cursor:"pointer",color:"#505A5F",fontWeight:"bold"},onClick:h},e("ES_COMMON_CANCEL"))):a.createElement("div",{style:{display:"flex",gap:"16px"}},a.createElement("span",{onClick:()=>(e=>{u(e.id),E(w.find(t=>t.id===e.surveyorId)||null),y(K.find(t=>t.code===e.mrdCode)||null)})(n.original),style:{cursor:"pointer"}},a.createElement(o.EditIcon,{className:"icon",fill:"#f47738"})),a.createElement("span",{onClick:()=>N(n.original),style:{cursor:"pointer"}},a.createElement(o.DeleteIcon,{className:"icon",fill:"#f47738"})))}}],[m,p,v,c,e]);return a.createElement(a.Fragment,null,a.createElement("div",{className:"side-panel-item"},a.createElement(o.Card,{className:"employeeCard filter inboxLinks",style:{marginTop:"16px"}},a.createElement("div",{className:"complaint-links-container"},a.createElement("div",{className:"header",style:{marginBottom:"0px"}},a.createElement("span",{className:"logo"},a.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.createElement("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{d:"M6.5 2H20V22H6.5A2.5 2.5 0 0 1 4 19.5V4.5A2.5 2.5 0 0 1 6.5 2Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),a.createElement("span",{className:"text"},e("EKYC_SURVEYOR_MAPPING")||"Surveyor Mapping"))))),a.createElement(o.Card,null,a.createElement(o.CardHeader,null,e("EKYC_NEW_MAPPING")||"New Mapping"),a.createElement(o.CardText,null,e("EKYC_MAPPING_SUBHEADER")||"Assign Meter Reading Dairies to surveyors to manage their data access."),a.createElement(o.LabelFieldPair,null,a.createElement(o.CardLabel,null,e("EKYC_SELECT_SURVEYOR")||"Select Surveyor"," *"),a.createElement("div",{className:""},a.createElement(o.Dropdown,{selected:l,select:r,option:w,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_SURVEYOR_PLACEHOLDER")||"Choose a surveyor..."}))),a.createElement(o.LabelFieldPair,null,a.createElement(o.CardLabel,null,e("EKYC_SELECT_MRD")||"Select MRD"," *"),a.createElement("div",{className:"field"},a.createElement(o.Dropdown,{selected:i,select:s,option:K,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_MRD_PLACEHOLDER")||"Choose an MRD..."}))),a.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"24px"}},a.createElement(o.SubmitBar,{label:e("EKYC_ADD_TO_LIST")||"Add to Mapping List",onSubmit:()=>{l&&i?c.some(e=>e.surveyorId===l.id&&e.mrdCode===i.code)?b({type:"warning",message:e("EKYC_MAPPING_EXISTS")||"This mapping already exists"}):(d(e=>[...e,{id:Date.now(),surveyorName:l.name,surveyorId:l.id,mrdName:i.name,mrdCode:i.code,zone:i.zone}]),s(null),r(null),b({type:"success",message:e("EKYC_MAPPING_ADDED")||"Mapping added successfully"})):b({type:"error",message:e("EKYC_SELECT_BOTH_ERROR")||"Please select both Surveyor and MRD"})},disabled:!l||!i}))),c.length>0&&a.createElement(o.Card,null,a.createElement(o.CardHeader,null,e("EKYC_MAPPING_SUMMARY")||"Mapping Summary"," (",c.length,")"),a.createElement(o.Table,{t:e,data:c,columns:f,getCellProps:e=>({style:{padding:"10px",fontSize:"16px"}}),tableClassName:"table digit-table"})),c.length>0&&a.createElement(o.ActionBar,null,a.createElement(o.SubmitBar,{label:e("EKYC_SAVE_MAPPINGS")||"Save Mappings",onSubmit:()=>{b(0!==c.length?{type:"success",message:e("EKYC_MAPPINGS_SAVED_SUCCESS")||"Surveyor mappings saved successfully!"}:{type:"error",message:e("EKYC_NO_MAPPINGS_TO_SAVE")||"No mappings to save"})}})),g&&a.createElement(o.Modal,{headerBarMain:e("EKYC_REMOVE_MAPPING")||"Remove Mapping",headerBarEnd:a.createElement("span",{onClick:()=>N(null),style:{cursor:"pointer",padding:"8px"}},"X"),actionSaveLabel:e("ES_COMMON_REMOVE"),actionSaveOnSubmit:()=>{d(e=>e.filter(e=>e.id!==g.id)),N(null),b({type:"success",message:e("EKYC_MAPPING_REMOVED")||"Mapping removed"})},actionCancelLabel:e("ES_COMMON_CANCEL"),actionCancelOnSubmit:()=>N(null),style:{borderRadius:"12px"}},a.createElement(o.CardText,{style:{marginTop:"16px",marginBottom:"16px"}},e("EKYC_REMOVE_MAPPING_CONFIRM_MSG")||"Are you sure you want to remove the mapping between ",a.createElement("strong",null,null==g?void 0:g.surveyorName)," and ",a.createElement("strong",null,null==g?void 0:g.mrdName),"?")),C&&a.createElement(o.Toast,{label:C.message,error:"error"===C.type,warning:"warning"===C.type,info:"info"===C.type,isDsc:!0,onClose:()=>b(null)}))},Y=e=>{let{kNumber:r,kName:i,connectionDetails:s,isLoading:c}=e;const{t:d}=n.useTranslation(),m=l.useHistory(),{path:u}=l.useRouteMatch(),[p,E]=t.useState(!1),[v,y]=t.useState({code:"SELF",name:"EKYC_SELF"});if(c)return a.createElement(o.Loader,null);if(!s)return null;const g=(null==s?void 0:s.connectionDetails)||{},N=g.statusflag||"",C="active"===(null==N?void 0:N.toLowerCase())||"A"===N;return a.createElement(a.Fragment,null,a.createElement("div",{className:"ekyc-employee-container"},a.createElement("div",{className:"connection-details-card"},a.createElement("div",{className:"details-card-header"},a.createElement("div",{className:"header-title-wrapper"},a.createElement("div",{className:"header-icon-bg"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),a.createElement("circle",{cx:"12",cy:"7",r:"4"}))),a.createElement("span",{className:"header-title-text"},d("EKYC_K_NUMBER_DETAILS")||"Consumer Identity Details")),a.createElement("span",{className:"status-badge "+(C?"active":"inactive")},C?d("EKYC_ACTIVE_CONNECTION")||"Active Connection":N||d("CS_NA"))),a.createElement("div",{className:"details-card-body"},a.createElement("div",{className:"body-content-row"},a.createElement("div",{className:"detail-section"},a.createElement("div",{className:"section-title"},d("EKYC_VERIFICATION_PARAMETERS")||"Verification Parameters"),a.createElement("div",{className:"data-grid"},a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_CONSUMER_NAME")||"Consumer Name"),a.createElement("div",{className:"data-value"},g.consumerName||i||d("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_K_NUMBER")||"K Number"),a.createElement("div",{className:"data-value blue"},r||d("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_METER_NO")||"Meter Serial No."),a.createElement("div",{className:"data-value"},g.meterNumber||d("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_CONNECTION_TYPE")||"Connection Type"),a.createElement("div",{className:"data-value"},g.connectionType||d("CS_NA"))))),a.createElement("div",{className:"vertical-divider"}),a.createElement("div",{className:"detail-section"},a.createElement("div",{className:"section-title"},d("EKYC_ADDRESS_AND_CONTACT")||"Address & Contact"),a.createElement("div",{className:"address-block"},a.createElement("div",{className:"icon-wrapper-small"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M21 10c0 7-9 13-9 13S3 17 3 10a9 9 0 0 1 18 0z"}),a.createElement("circle",{cx:"12",cy:"10",r:"3"}))),a.createElement("div",null,a.createElement("div",{className:"data-label"},d("EKYC_ADDRESS")||"Service Address"),a.createElement("div",{className:"address-text"},g.address||d("CS_NA")))),a.createElement("div",{className:"contact-row"},a.createElement("div",{className:"contact-item"},a.createElement("div",{className:"icon-wrapper-small"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2",ry:"2"}),a.createElement("line",{x1:"12",y1:"18",x2:"12.01",y2:"18"}))),a.createElement("div",null,a.createElement("div",{className:"data-label"},d("EKYC_PHONE_NO")||"Contact"),a.createElement("div",{className:"address-text"},g.phoneNumber||d("CS_NA")))),a.createElement("div",{className:"contact-item"},a.createElement("div",{className:"icon-wrapper-small"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("circle",{cx:"12",cy:"12",r:"4"}),a.createElement("path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"}))),a.createElement("div",null,a.createElement("div",{className:"data-label"},d("EKYC_EMAIL")||"Email Address"),a.createElement("div",{className:"address-text"},g.email||d("CS_NA")))))))),a.createElement("div",{className:"details-card-footer"},a.createElement("div",{className:"footer-meta-text"},null!=s&&s.lastVerified?`${d("EKYC_LAST_VERIFIED")||"Last verified:"} ${s.lastVerified}`:""),a.createElement("div",{className:"action-btns-container",style:{fontSize:"12px"}},a.createElement("button",{onClick:()=>E(!0),className:"primary-action-btn",style:{fontSize:"12px"}},d("EKYC_START_REVIEW")||"Start Review",a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),a.createElement("polyline",{points:"12 5 19 12 12 19"}))))))),p&&a.createElement(o.Modal,{headerBarMain:d("EKYC_SELECT_VERIFICATION_TYPE"),headerBarEnd:a.createElement("span",{onClick:()=>E(!1),style:{cursor:"pointer",padding:"8px"}},"X"),actionSaveLabel:d("ES_COMMON_CONFIRM"),actionSaveOnSubmit:()=>{const e=u.includes("/create-kyc")?u.replace("/create-kyc",""):u.replace("/k-details","");m.push(e+"/consumer-details",{kNumber:r,selectedOption:v,connectionDetails:s}),E(!1)},actionCancelLabel:d("ES_COMMON_CANCEL"),actionCancelOnSubmit:()=>E(!1),style:{borderRadius:"12px"}},a.createElement("div",{style:{padding:"24px"}},a.createElement(o.RadioButtons,{name:"verificationType",options:[{code:"SELF",name:"EKYC_SELF"},{code:"OTHER",name:"EKYC_OTHER"}],optionsKey:"name",selectedOption:v,onSelect:y,style:{display:"flex",flexDirection:"column",gap:"12px",buttonStyle:{borderRadius:"5px"}},t:d}))))},x=()=>{const{t:e}=n.useTranslation(),[l,r]=t.useState(()=>{const e=sessionStorage.getItem("EKYC_CREATE_SEARCH_PARAMS");return e?JSON.parse(e):{kNumber:"",kName:""}}),[i,s]=t.useState(()=>"true"===sessionStorage.getItem("EKYC_CREATE_SEARCH_PERFORMED")),[c,d]=t.useState(null),[m,p,E]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{}),v=Digit.ULBService.getCurrentTenantId(),{isLoading:y,data:g}=Digit.Hooks.ekyc.useSearchConnection({tenantId:v,details:{kno:l.kNumber,name:l.kName}},{enabled:i&&!!l.kNumber&&!!l.kName,onError:t=>{var a,n,l,o;d({error:!0,label:(null==t||null===(a=t.response)||void 0===a||null===(n=a.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.message)||e("EKYC_SEARCH_ERROR_PLEASE_ENTER_THE_CORRECT_CREDENTIALS")}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED")}});return a.createElement(u,{onSearch:t=>{if(!t.kNumber&&!t.kName)return r({kNumber:"",kName:""}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS"),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED"),void E();t.kNumber&&t.kName?(r(t),s(!0),sessionStorage.getItem("EKYC_K_NUMBER")!==t.kNumber&&(E(),Object.keys(sessionStorage).forEach(e=>{e.startsWith("EKYC_")&&"EKYC_CREATE"!==e&&sessionStorage.removeItem(e)})),sessionStorage.setItem("EKYC_CREATE_SEARCH_PARAMS",JSON.stringify(t)),sessionStorage.setItem("EKYC_CREATE_SEARCH_PERFORMED","true"),sessionStorage.setItem("EKYC_K_NUMBER",t.kNumber)):d({error:!0,label:e("EKYC_FILL_ALL_FIELDS")})},searchParams:l},i&&a.createElement(Y,{kNumber:l.kNumber,kName:l.kName,connectionDetails:g,isLoading:y}),!i&&!y&&a.createElement(o.Card,{style:{textAlign:"center",padding:"40px"}},a.createElement("div",{style:{color:"#667085"}},e("EKYC_SEARCH_TO_VIEW_DETAILS"))),c&&a.createElement(o.Toast,{error:c.error,label:c.label,onClose:()=>{d(null)},isDsc:!0}))},B=e=>{let{jumpTo:t,state:n}=e;const r=l.useHistory();return a.createElement(o.LinkButton,{label:a.createElement(o.EditIcon,{style:{width:"20px",height:"20px",fill:"#F47738"}}),style:{margin:0,padding:0},onClick:function(){r.push(t,{...n,isEditing:!0})}})},U=e=>null!=e&&""!==e?e:"N/A",V=(e,t)=>!0===e||"true"===e||"yes"===String(e).toLowerCase()?t("CORE_COMMON_YES"):!1===e||"false"===e||"no"===String(e).toLowerCase()?t("CORE_COMMON_NO"):"true"===e?t("CORE_COMMON_YES"):"false"===e?t("CORE_COMMON_NO"):void 0,H=e=>{let{title:t,fields:n,newData:l,oldData:r,t:i,jumpTo:s,state:c}=e;return a.createElement("div",{className:"review-section-wrapper",style:{marginBottom:"48px",background:"#fff",borderRadius:"12px",border:"1px solid #EAECF0",overflow:"hidden"}},a.createElement("div",{style:{padding:"20px 24px",background:"#F9FAFB",borderBottom:"1px solid #EAECF0",display:"flex",justifyContent:"space-between",alignItems:"center"}},a.createElement(o.CardSubHeader,{style:{margin:0,fontSize:"18px",color:"#101828",fontWeight:"700"}},t),s&&a.createElement(B,{jumpTo:s,state:c})),a.createElement("div",{style:{padding:"0 24px"}},a.createElement("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed"}},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"30%"}},i("EKYC_FIELD_NAME")),a.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"35%"}},i("EKYC_EXISTING_INFORMATION")),a.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"35%"}},i("EKYC_PROPOSED_UPDATES")))),a.createElement("tbody",null,n.map((e,t)=>{const n=null==l?void 0:l[e.key],o=null==r?void 0:r[e.key],s=r&&String(n)!==String(o)&&null!=o;return a.createElement("tr",{key:t,style:{borderTop:"1px solid #F2F4F7"}},a.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:"#344054",fontWeight:"500"}},i(e.label)),a.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:"#667085"}},e.isBool?V(o,i):U(o)),a.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:s?"#1B8B32":"#101828",fontWeight:s?"700":"400"}},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.isBool?V(n,i):U(n),s&&a.createElement("span",{style:{background:"#ECFDF3",color:"#067647",padding:"2px 8px",borderRadius:"12px",fontSize:"10px",fontWeight:"600"}},i("EKYC_CHANGED")))))})))))},j=()=>{var e,r,i,s,c,d,m,u,p,E,v,y,g,N,C,b,h,f,k,T,D,_,A,I,R,O,M,P,L,w,K,F,Y,x,B,U,V,j,z,W,G;const{t:$}=n.useTranslation(),Z=l.useHistory(),q=l.useLocation();let{kno:X}=l.useParams();const[J,Q]=t.useState(!1),[ee,te]=t.useState(!1),[ae,ne]=t.useState(!1),[le,oe]=t.useState(""),[re,ie]=t.useState(!1),[se,ce]=t.useState(!1),[de,me]=t.useState({error:!1,label:""}),ue=[{action:$("Approve")},{action:$("Reject")}],pe=q.state||{},{edits:Ee={}}=pe,ve=X,{aadhaarData:ye={},addressDetails:ge={},propertyDetails:Ne={},meterDetails:Ce={}}=Ee,be=Digit.ULBService.getCurrentTenantId(),he=Digit.Hooks.ekyc.useEkycWorkflow(be),{data:fe,isLoading:Se}=(Digit.Hooks.ekyc.useEkycUpdate(be),Digit.Hooks.ekyc.useEkycSearchReview({kno:ve,fetchType:"REVIEW"},be,{enabled:!!ve})),{newData:ke,oldData:Te}=((e,t)=>{const a=e&&Object.keys(e).length>0?e:(null==t?void 0:t.reviewData)||{},n=(null==a?void 0:a.applicationReviewInfo)||(null==a?void 0:a.applicationReview)||a,l=(Array.isArray(n)?n[0]:n)||{};return{newData:(null==l?void 0:l.newData)||l,oldData:(null==l?void 0:l.oldData)||null}})(fe,pe),De=e=>{if(!e)return null;const t=(null==e?void 0:e.connectionDetails)||e||{},a=(null==e?void 0:e.addressDetails)||e||{},n=(null==e?void 0:e.propertyInfo)||e||{},l=(null==e?void 0:e.meterDetails)||e||{};return{connection:{consumerName:(null==t?void 0:t.consumerName)||(null!=t&&t.firstName?[t.firstName,t.middleName,t.lastName].filter(Boolean).join(" "):null),address:(null==t?void 0:t.address)||(null==t?void 0:t.addressRaw),connectionType:(null==t?void 0:t.connectionType)||(null==t?void 0:t.connectionCategory),meterNumber:(null==t?void 0:t.meterNumber)||(null==t?void 0:t.meterNo),phoneNumber:(null==t?void 0:t.phoneNumber)||(null==t?void 0:t.mobileNo)||(null==t?void 0:t.mobileNumber),email:null==t?void 0:t.email,statusflag:(null==t?void 0:t.statusflag)||(null==t?void 0:t.statusFlag),ekycStatus:null==t?void 0:t.ekycStatus,knumber:(null==t?void 0:t.knumber)||(null==t?void 0:t.kno)},address:{fullAddress:(null==a?void 0:a.fullAddress)||(null==a?void 0:a.addressRaw),flatHouseNumber:(null==a?void 0:a.flatHouseNumber)||(null==a?void 0:a.flatNo),buildingTower:(null==a?void 0:a.buildingTower)||(null==a?void 0:a.building),landmark:null==a?void 0:a.landmark,pinCode:(null==a?void 0:a.pinCode)||(null==a?void 0:a.pincode),ward:(null==a?void 0:a.ward)||(null==a?void 0:a.locality),assembly:null==a?void 0:a.assembly,gpsValid:null==a?void 0:a.gpsValid,latitude:null==a?void 0:a.latitude,longitude:null==a?void 0:a.longitude,mobileNo:(null==a?void 0:a.mobileNo)||(null==a?void 0:a.mobileNumber),whatsappNo:null==a?void 0:a.whatsappNo,email:null==a?void 0:a.email,noOfPerson:(null==a?void 0:a.noOfPerson)||(null==a?void 0:a.noOfPersons),knumber:(null==a?void 0:a.knumber)||(null==a?void 0:a.kno),doorPhotoFilestoreId:null==a?void 0:a.doorPhotoFilestoreId},property:{kno:null==n?void 0:n.kno,pidNumber:null==n?void 0:n.pidNumber,typeOfConnection:null==n?void 0:n.typeOfConnection,connectionCategory:null==n?void 0:n.connectionCategory,userType:null==n?void 0:n.userType,numberOfFloors:(null==n?void 0:n.numberOfFloors)||(null==n?void 0:n.noOfFloor),tenantName:null==n?void 0:n.tenantName,tenantMobile:null==n?void 0:n.tenantMobile,ekycStatus:null==n?void 0:n.ekycStatus,propertyDocumentFileStoreId:null==n?void 0:n.propertyDocumentFileStoreId,buildingImageFileStoreId:null==n?void 0:n.buildingImageFileStoreId},meter:{kno:null==l?void 0:l.kno,metered:"METERED"===(null==l?void 0:l.meterStatus)||(null==l?void 0:l.metered),meterNumber:(null==l?void 0:l.meterNumber)||(null==l?void 0:l.meterNo),meterMake:null==l?void 0:l.meterMake,meterLocationAddress:null==l?void 0:l.meterLocationAddress,meterLatitude:null==l?void 0:l.meterLatitude,meterLongitude:null==l?void 0:l.meterLongitude,workingStatus:null==l?void 0:l.workingStatus,lastBillRaised:null==l?void 0:l.lastBillRaised,systemMeterId:null==l?void 0:l.systemMeterId,meterPhotoFileStoreId:null==l?void 0:l.meterPhotoFileStoreId}}},_e=De(ke),Ae=De(Te),Ie={...null==_e?void 0:_e.connection,consumerName:(null==ye?void 0:ye.name)||(null==_e||null===(e=_e.connection)||void 0===e?void 0:e.consumerName),phoneNumber:(null==ye?void 0:ye.mobileNumber)||(null==_e||null===(r=_e.connection)||void 0===r?void 0:r.phoneNumber),knumber:(null==_e||null===(i=_e.connection)||void 0===i?void 0:i.knumber)||ve},Re={...null==_e?void 0:_e.address,fullAddress:(null==ge?void 0:ge.fullAddress)||(null==_e||null===(s=_e.address)||void 0===s?void 0:s.fullAddress),flatHouseNumber:(null==ge?void 0:ge.flatHouseNumber)||(null==ge?void 0:ge.flatNo)||(null==_e||null===(c=_e.address)||void 0===c?void 0:c.flatHouseNumber),buildingTower:(null==ge?void 0:ge.buildingTower)||(null==ge?void 0:ge.building)||(null==_e||null===(d=_e.address)||void 0===d?void 0:d.buildingTower),landmark:(null==ge?void 0:ge.landmark)||(null==_e||null===(m=_e.address)||void 0===m?void 0:m.landmark),pinCode:(null==ge?void 0:ge.pinCode)||(null==ge?void 0:ge.pincode)||(null==_e||null===(u=_e.address)||void 0===u?void 0:u.pinCode),ward:(null==ge?void 0:ge.ward)||(null==_e||null===(p=_e.address)||void 0===p?void 0:p.ward),assembly:(null==ge?void 0:ge.assembly)||(null==_e||null===(E=_e.address)||void 0===E?void 0:E.assembly),gpsValid:void 0!==(null==ge?void 0:ge.gpsValid)?ge.gpsValid:null==_e||null===(v=_e.address)||void 0===v?void 0:v.gpsValid,latitude:(null==ge?void 0:ge.latitude)||(null==_e||null===(y=_e.address)||void 0===y?void 0:y.latitude),longitude:(null==ge?void 0:ge.longitude)||(null==_e||null===(g=_e.address)||void 0===g?void 0:g.longitude),mobileNo:(null==ge?void 0:ge.mobileNo)||(null==ye?void 0:ye.mobileNumber)||(null==_e||null===(N=_e.address)||void 0===N?void 0:N.mobileNo),whatsappNo:(null==ge?void 0:ge.whatsappNo)||(null==ye?void 0:ye.whatsappNumber)||(null==_e||null===(C=_e.address)||void 0===C?void 0:C.whatsappNo),email:(null==ge?void 0:ge.email)||(null==_e||null===(b=_e.address)||void 0===b?void 0:b.email),noOfPerson:(null==ge?void 0:ge.noOfPerson)||(null==ye?void 0:ye.noOfPersons)||(null==_e||null===(h=_e.address)||void 0===h?void 0:h.noOfPerson),knumber:(null==ge?void 0:ge.knumber)||(null==_e||null===(f=_e.address)||void 0===f?void 0:f.knumber)||ve,doorPhotoFilestoreId:(null==ge?void 0:ge.doorPhotoFileStoreId)||(null==_e||null===(k=_e.address)||void 0===k?void 0:k.doorPhotoFilestoreId)},Oe={...null==_e?void 0:_e.property,kno:(null==_e||null===(T=_e.property)||void 0===T?void 0:T.kno)||ve,pidNumber:(null==Ne?void 0:Ne.pidNumber)||(null==_e||null===(D=_e.property)||void 0===D?void 0:D.pidNumber),typeOfConnection:(null==Ne||null===(_=Ne.connectionTypeData)||void 0===_?void 0:_.label)||(null==_e||null===(A=_e.property)||void 0===A?void 0:A.typeOfConnection),connectionCategory:(null==Ne||null===(I=Ne.connectionCategoryData)||void 0===I?void 0:I.label)||(null==_e||null===(R=_e.property)||void 0===R?void 0:R.connectionCategory),userType:(null==Ne||null===(O=Ne.userTypeData)||void 0===O?void 0:O.label)||(null==_e||null===(M=_e.property)||void 0===M?void 0:M.userType),numberOfFloors:(null==Ne||null===(P=Ne.noOfFloorsData)||void 0===P?void 0:P.label)||(null==_e||null===(L=_e.property)||void 0===L?void 0:L.numberOfFloors),propertyDocumentFileStoreId:(null==Ne?void 0:Ne.propertyDocumentFileStoreId)||(null==_e||null===(w=_e.property)||void 0===w?void 0:w.propertyDocumentFileStoreId)},Me={...null==_e?void 0:_e.meter,kno:(null==Ce?void 0:Ce.kno)||(null==_e||null===(K=_e.meter)||void 0===K?void 0:K.kno)||ve,metered:"Metered"===(null==Ce||null===(F=Ce.meterStatusData)||void 0===F?void 0:F.value)||(null==_e||null===(Y=_e.meter)||void 0===Y?void 0:Y.metered),meterNumber:null==_e||null===(x=_e.meter)||void 0===x?void 0:x.meterNumber,meterMake:(null==Ce?void 0:Ce.meterMake)||(null==_e||null===(B=_e.meter)||void 0===B?void 0:B.meterMake),meterLocationAddress:(null==Ce?void 0:Ce.meterLocation)||(null==_e||null===(U=_e.meter)||void 0===U?void 0:U.meterLocationAddress),workingStatus:"Working"===(null==Ce||null===(V=Ce.workingStatusData)||void 0===V?void 0:V.value)||(null==_e||null===(j=_e.meter)||void 0===j?void 0:j.workingStatus),lastBillRaised:"Yes"===(null==Ce||null===(z=Ce.lastBillRaisedData)||void 0===z?void 0:z.value)||(null==_e||null===(W=_e.meter)||void 0===W?void 0:W.lastBillRaised),meterPhotoFileStoreId:(null==Ce?void 0:Ce.meterPhotoFileStoreId)||(null==_e||null===(G=_e.meter)||void 0===G?void 0:G.meterPhotoFileStoreId)},Pe=e=>{e&&(oe("https://dev-djberp.nitcon.in/filestore/v1/files/id?tenantId=dl.djb&fileStoreId="+e),ne(!0))};if(Se||ee)return a.createElement(o.Loader,null);const Le="/digit-ui/employee/ekyc";return a.createElement(t.Fragment,null,a.createElement(o.Card,{className:"overflow-y-scroll"},a.createElement(H,{title:$("EKYC_CONNECTION_DETAILS"),fields:[{label:"EKYC_K_NUMBER",key:"knumber"},{label:"EKYC_CONSUMER_NAME",key:"consumerName"},{label:"EKYC_ADDRESS",key:"address"},{label:"EKYC_CONNECTION_TYPE",key:"connectionType"},{label:"EKYC_METER_NO",key:"meterNumber"},{label:"EKYC_MOBILE_NO",key:"phoneNumber"},{label:"EKYC_EMAIL",key:"email"},{label:"EKYC_STATUS_FLAG",key:"statusflag"},{label:"EKYC_STATUS",key:"ekycStatus"}],newData:Ie,oldData:null==Ae?void 0:Ae.connection,t:$,jumpTo:`${Le}/consumer-details?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement(H,{title:$("EKYC_ADDRESS_DETAILS"),fields:[{label:"EKYC_FULL_ADDRESS",key:"fullAddress"},{label:"EKYC_FLAT_HOUSE_NO",key:"flatHouseNumber"},{label:"EKYC_BUILDING_TOWER",key:"buildingTower"},{label:"EKYC_LANDMARK",key:"landmark"},{label:"EKYC_PINCODE",key:"pinCode"},{label:"EKYC_LOCALITY",key:"ward"},{label:"EKYC_ASSEMBLY",key:"assembly"},{label:"EKYC_GPS_VALID",key:"gpsValid",isBool:!0},{label:"EKYC_LATITUDE",key:"latitude"},{label:"EKYC_LONGITUDE",key:"longitude"},{label:"EKYC_MOBILE_NO",key:"mobileNo"},{label:"EKYC_WHATSAPP_NO",key:"whatsappNo"},{label:"EKYC_EMAIL",key:"email"},{label:"EKYC_NO_OF_PERSONS",key:"noOfPerson"},{label:"EKYC_K_NUMBER",key:"knumber"}],newData:Re,oldData:null==Ae?void 0:Ae.address,t:$,jumpTo:`${Le}/address-details?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement(H,{title:$("EKYC_PROPERTY_INFO"),fields:[{label:"EKYC_CONNECTION_CATEGORY",key:"connectionCategory"},{label:"EKYC_PID_NUMBER",key:"pidNumber"},{label:"EKYC_TYPE_OF_CONNECTION",key:"typeOfConnection"},{label:"EKYC_USER_TYPE",key:"userType"},{label:"EKYC_FLOOR_COUNT",key:"numberOfFloors"},{label:"EKYC_TENANT_NAME",key:"tenantName"},{label:"EKYC_TENANT_MOBILE",key:"tenantMobile"},{label:"EKYC_STATUS",key:"ekycStatus"}],newData:Oe,oldData:null==Ae?void 0:Ae.property,t:$,jumpTo:`${Le}/property-info?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement(H,{title:$("EKYC_METER_DETAILS"),fields:[{label:"EKYC_METERED",key:"metered",isBool:!0},{label:"EKYC_METER_NO",key:"meterNumber"},{label:"EKYC_METER_MAKE",key:"meterMake"},{label:"EKYC_METER_LOCATION_ADDRESS",key:"meterLocationAddress"},{label:"EKYC_METER_LATITUDE",key:"meterLatitude"},{label:"EKYC_METER_LONGITUDE",key:"meterLongitude"},{label:"EKYC_WORKING_STATUS",key:"workingStatus",isBool:!0},{label:"EKYC_LAST_BILL_RAISED",key:"lastBillRaised",isBool:!0},{label:"EKYC_SYSTEM_METER_ID",key:"systemMeterId"}],newData:Me,oldData:null==Ae?void 0:Ae.meter,t:$,jumpTo:`${Le}/meter-details?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement("div",{style:{marginTop:"40px"}},a.createElement(o.CardSubHeader,{style:{marginBottom:"20px"}},$("EKYC_DOCUMENTS")),a.createElement(o.StatusTable,{style:{maxWidth:"600px"}},a.createElement(o.Row,{label:$("EKYC_DOOR_PHOTO"),text:$(Re.doorPhotoFilestoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Re.doorPhotoFilestoreId&&a.createElement("div",{onClick:()=>Pe(Re.doorPhotoFilestoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),a.createElement(o.Row,{label:$("EKYC_METER_PHOTO"),text:$(Me.meterPhotoFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Me.meterPhotoFileStoreId&&a.createElement("div",{onClick:()=>Pe(Me.meterPhotoFileStoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),a.createElement(o.Row,{label:$("EKYC_BUILDING_IMAGE"),text:$(Oe.buildingImageFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Oe.buildingImageFileStoreId&&a.createElement("div",{onClick:()=>Pe(Oe.buildingImageFileStoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),a.createElement(o.Row,{label:$("EKYC_PROPERTY_DOCUMENTS"),text:$(Oe.propertyDocumentFileStoreId?"EKYC_DOCS_AVAILABLE":"CS_NA"),actionButton:Oe.propertyDocumentFileStoreId&&a.createElement("div",{onClick:()=>Pe(Oe.propertyDocumentFileStoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}))),a.createElement("div",{style:{marginTop:"40px",paddingTop:"30px",borderTop:"1px solid #EAECF0"}},a.createElement(o.CheckBox,{id:"agreeDeclaration",name:"agreeDeclaration",label:a.createElement("span",{style:{fontSize:"16px",color:"#344054"}},$("EKYC_FINAL_DECLARATION")),onChange:()=>Q(!J),checked:J})),a.createElement(o.ActionBar,null,a.createElement(o.SubmitBar,{label:$("TAKE_ACTION_FOR_APPROVE_REJECT"),onSubmit:()=>ie(e=>!e),disabled:!J}),re&&a.createElement(o.Menu,{options:ue,optionKey:"action",t:$,onSelect:e=>{ie(!1),e.action===$("Approve")?function(){try{var e,t,a;const n={RequestInfo:{apiId:"Rainmaker",ver:"1.0",msgId:"message-id",tenantId:be,authToken:null===(e=Digit.UserService.getUser())||void 0===e?void 0:e.access_token},kno:ve,action:"APPROVED",remarks:"All documents verified",reviewedBy:null===(t=Digit.UserService.getUser())||void 0===t||null===(a=t.info)||void 0===a?void 0:a.userName,role:"ZRO"},l=S(function(){return Promise.resolve(he.mutateAsync(n)).then(function(e){e&&(me({error:!1,label:$("EKYC_APPLICATION_APPROVE_SUCCESSFUL")||"Application Approved Successfully"}),ce(!0),setTimeout(()=>{Z.push("/digit-ui/employee/ekyc/inbox")},2e3))})},function(e){var t,a;console.error("Approve Error:",e),me({error:!0,label:(null==e?void 0:e.message)||(null==e||null===(t=e.response)||void 0===t||null===(a=t.data)||void 0===a?void 0:a.message)||"Approve Error"}),ce(!0)});Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}():e.action===$("Reject")&&function(){try{var e,t,a;const n={RequestInfo:{apiId:"Rainmaker",ver:"1.0",msgId:"message-id",tenantId:be,authToken:null===(e=Digit.UserService.getUser())||void 0===e?void 0:e.access_token},kno:ve,action:"REJECTED",remarks:"Application rejected by reviewer",reviewedBy:null===(t=Digit.UserService.getUser())||void 0===t||null===(a=t.info)||void 0===a?void 0:a.userName,role:"ZRO"},l=S(function(){return Promise.resolve(he.mutateAsync(n)).then(function(e){e&&Z.push("/digit-ui/employee/ekyc/response",{success:!0,result:e})})},function(e){console.error("Reject Error:",e)});Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},style:{color:"#FFFFFF",fontSize:"18px"}}))),ae&&a.createElement("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.7)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e4}},a.createElement("div",{style:{position:"relative",backgroundColor:"#fff",padding:"30px",borderRadius:"12px",maxWidth:"600px",width:"100%",maxHeight:"70vh",overflow:"auto",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"}},a.createElement("div",{onClick:()=>ne(!1),style:{position:"absolute",top:"10px",right:"10px",cursor:"pointer",fontWeight:"bold",fontSize:"20px",color:"#333",background:"#eee",width:"30px",height:"30px",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%"}},"×"),a.createElement("img",{src:le,alt:"Document Preview",style:{maxWidth:"100%",height:"auto",display:"block"},onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="block"}}),a.createElement("div",{style:{display:"none",padding:"40px",textAlign:"center"}},a.createElement("p",null,$("EKYC_DOCUMENT_PREVIEW_NOT_AVAILABLE")),a.createElement(o.LinkButton,{label:$("EKYC_OPEN_IN_NEW_TAB"),onClick:()=>window.open(le,"_blank")})))),se&&a.createElement(o.Toast,{error:de.error,label:de.label,onClose:()=>ce(!1)}))},z=e=>{let{config:r,onSelect:i,formData:s}=e;const{t:c}=n.useTranslation(),d=l.useLocation(),m=d.state||{},u=Digit.ULBService.getCurrentTenantId(),p=new URLSearchParams(d.search).get("kno")||(null==m?void 0:m.kNumber)||(null==m?void 0:m.kno)||(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||sessionStorage.getItem("EKYC_K_NUMBER")||"",{isLoading:E,data:v}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:{kno:p,fetchType:"CONNECTION"}},{enabled:!!p,cacheTime:0}),y=Digit.Hooks.ekyc.useEkycUpdate(u),g=(null==s?void 0:s.aadhaarVerification)||{},[N,C]=t.useState(g.documentId||null),[b,h]=t.useState(g.documentProof||null),[f,k]=t.useState(null),[T,D]=t.useState(!1),[_,A]=t.useState(!1),[I,R]=t.useState(()=>({kno:g.kno||p||"",consumerType:g.consumerType?{name:g.consumerType}:null,occupantType:g.occupantType?{name:g.occupantType}:null,categoryType:g.categoryType?{name:g.categoryType}:null,firstName:g.firstName||"",middleName:g.middleName||"",lastName:g.lastName||"",gender:g.gender?{name:g.gender}:null,parentSpouseName:g.parentSpouseName||"",mobile:g.mobile||"",whatsapp:g.whatsapp||"",email:g.email||"",residents:g.residents||"",identityType:g.identityType?{name:g.identityType}:null,documentNumber:g.documentNumber||"",informantIsConsumer:g.informantIsConsumer??!0,informantName:g.informantName||"",informantRelation:g.informantRelation||"",documentId:g.documentId||null,documentProof:g.documentProof||null,idFile:g.idFile||null,ownerMobile:g.ownerMobile||"",tenantVerification:g.tenantVerification||"",designation:g.designation||"",department:g.department||"",employeeId:g.employeeId||"",entityName:g.entityName||"",contactPerson:g.contactPerson||"",consent:g.consent||!1})),[O,M]=t.useState(I);if(t.useEffect(()=>{const e=(e=>{if(!e)return null;const t=(null==e?void 0:e.applicationReviewInfo)||(null==e?void 0:e.applicationReview)||e,a=(Array.isArray(t)?t[0]:t)||{};return(null==a?void 0:a.newData)||a})(v)||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.connectionDetails)||e||{},a=(null==e?void 0:e.addressDetails)||{};if(t&&Object.keys(t).length>0&&!T){let e="",n="",l="";if(t.firstName)e=t.firstName,n=t.middleName||"",l=t.lastName||"";else if(t.consumerName){const a=t.consumerName.trim().split(/\s+/);e=a[0]||"",2===a.length&&(l=a[1]),a.length>2&&(n=a.slice(1,-1).join(" "),l=a[a.length-1])}const o={kno:g.kno||p||"",consumerType:g.consumerType?{name:g.consumerType}:t.consumerType?{name:t.consumerType}:null,occupantType:g.occupantType?{name:g.occupantType}:t.occupantType?{name:t.occupantType}:null,categoryType:g.categoryType?{name:g.categoryType}:null,firstName:g.firstName||e,middleName:g.middleName||n,lastName:g.lastName||l,gender:g.gender?{name:g.gender}:t.gender?{name:t.gender}:null,parentSpouseName:g.parentSpouseName||t.parentSpouse||"",mobile:g.mobile||t.phoneNumber||a.mobileNo||"",whatsapp:g.whatsapp||a.whatsappNo||"",email:g.email||t.email||a.email||"",residents:g.residents||(a.noOfPerson?String(a.noOfPerson):""),identityType:g.identityType?{name:g.identityType}:null,documentNumber:g.documentNumber||"",informantIsConsumer:g.informantIsConsumer??!0,informantName:g.informantName||t.informantName||"",informantRelation:g.informantRelation||t.informantRelation||"",documentId:g.documentId||t.documentNumber||null,documentProof:g.documentProof||null,idFile:g.idFile||null,ownerMobile:g.ownerMobile||"",tenantVerification:g.tenantVerification||"",designation:g.designation||"",department:g.department||"",employeeId:g.employeeId||"",entityName:g.entityName||"",contactPerson:g.contactPerson||"",consent:g.consent||!1};R(o),M(o),o.documentId&&C(o.documentId),o.documentProof&&h(o.documentProof),D(!0)}},[v,null==s?void 0:s.connectionDetails,T]),E)return a.createElement(o.Loader,null);const P=function(e,t,n,l,r){var i,s,c,d,m,u,p;void 0===t&&(t={});const E=(null===(i=t)||void 0===i||null===(s=i.consumerType)||void 0===s?void 0:s.name)||(null===(c=t)||void 0===c?void 0:c.consumerType),v=(null===(d=t)||void 0===d||null===(m=d.occupantType)||void 0===m?void 0:m.name)||(null===(u=t)||void 0===u?void 0:u.occupantType),y=(null===(p=t)||void 0===p?void 0:p.informantIsConsumer)??!0,g=[{label:e("Consumer Type"),isMandatory:!0,type:"custom",key:"consumerType",populators:{name:"consumerType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Individual"},{name:"Govt"},{name:"Company_Society_Org"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Occupant Type"),isMandatory:!0,type:"custom",key:"occupantType",populators:{name:"occupantType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Self"},{name:"Tenanted"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Category Type"),isMandatory:!0,type:"custom",key:"categoryType",populators:{name:"categoryType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Bulk"},{name:"Non-Bulk"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("First Name"),isMandatory:!0,type:"text",populators:{name:"firstName",validation:{required:!0}}},{label:e("Middle Name"),isMandatory:!1,type:"text",populators:{name:"middleName"}},{label:e("Last Name"),isMandatory:!1,type:"text",populators:{name:"lastName"}},{label:e("Gender"),isMandatory:!1,type:"custom",key:"gender",populators:{name:"gender",component:e=>a.createElement(o.Dropdown,{option:[{name:"Male"},{name:"Female"},{name:"Others"},{name:"Not prefer to say"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Parent/Spouse Name"),isMandatory:!1,type:"text",populators:{name:"parentSpouseName"}},{label:e("Mobile"),isMandatory:!0,type:"text",populators:{name:"mobile",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("Invalid mobile number")}},{label:e("WhatsApp"),isMandatory:!1,type:"text",populators:{name:"whatsapp"}},{label:e("Email"),isMandatory:!1,type:"text",populators:{name:"email",validation:{pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("Invalid email address")}},{label:e("No. of Residents"),isMandatory:!0,type:"text",populators:{name:"residents",validation:{required:!0,min:1}}},{label:e("Type of Identity"),isMandatory:!0,type:"custom",key:"identityType",populators:{name:"identityType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Aadhaar Card"},{name:"Driving License"},{name:"Passport"},{name:"Voter ID"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Proof of Identity"),isMandatory:!1,type:"custom",key:"idFile",populators:{name:"idFile",component:t=>a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),l(null)},message:e(t.value?"Uploaded":"No file selected")})}},{label:e("Document Number"),isMandatory:!1,type:"text",populators:{name:"documentNumber"}},{label:e("Informant Is Consumer"),isMandatory:!1,type:"custom",key:"informantIsConsumer",populators:{name:"informantIsConsumer",component:t=>a.createElement(o.CheckBox,{label:e("Yes, the informant is the consumer"),checked:t.value??!0,onChange:e=>t.onChange(e.target.checked)})}}];return y||g.push({label:e("Informant Name"),isMandatory:!1,type:"text",populators:{name:"informantName"}},{label:e("Informant Relation"),isMandatory:!1,type:"text",populators:{name:"informantRelation"}}),"Tenanted"===v&&(g.push({label:e("Document Proof"),isMandatory:!1,type:"custom",key:"documentProof",populators:{name:"documentProof",component:t=>a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),l(null)},message:e(t.value?"Uploaded":"No file selected")})}}),r||g.push({label:e("Owner Mobile"),isMandatory:!0,type:"text",populators:{name:"ownerMobile",validation:{required:!0,pattern:/^[6-9]\d{9}$/}}},{label:e("Tenant Verification"),isMandatory:!1,type:"text",populators:{name:"tenantVerification"}})),"Govt"===E&&g.push({label:e("Designation"),isMandatory:!1,type:"text",populators:{name:"designation"}},{label:e("Department"),isMandatory:!1,type:"text",populators:{name:"department"}},{label:e("Employee ID"),isMandatory:!1,type:"text",populators:{name:"employeeId"}}),"Company_Society_Org"===E&&g.push({label:e("Entity Name"),isMandatory:!1,type:"text",populators:{name:"entityName"}},{label:e("Contact Person"),isMandatory:!1,type:"text",populators:{name:"contactPerson"}}),g.push({label:e("Consent"),isMandatory:!0,type:"custom",key:"consent",populators:{name:"consent",validation:{required:!0},component:t=>a.createElement(o.CheckBox,{label:e("I hereby consent to verify my Aadhaar details."),checked:t.value??!1,onChange:e=>t.onChange(e.target.checked)})}}),[{head:e("EKYC_CONSUMER_CONNECTION"),body:g}]}(c,O,function(e,t){try{const a=e.target.files[0];if(!a)return Promise.resolve();if(a.size>2e6)return k({type:"error",message:c("Max size 2MB exceeded")}),Promise.resolve();const n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a,u)).then(function(e){var n,l,o;const r=null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.fileStoreId;r&&(t(a.name),h(a.name),C(r),k({type:"success",message:c("Upload successful")}))})},function(){k({type:"error",message:c("Upload failed")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},C,N);return a.createElement(t.Fragment,null,a.createElement(o.FormComposer,{key:T?"loaded":"loading",isDisabled:!_,label:c("ES_COMMON_CONTINUE"),config:P.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),onSubmit:function(e){try{var t,a,n,l,o;const s={kno:e.kno||p,consumerType:(null===(t=e.consumerType)||void 0===t?void 0:t.name)||e.consumerType,occupantType:(null===(a=e.occupantType)||void 0===a?void 0:a.name)||e.occupantType,categoryType:(null===(n=e.categoryType)||void 0===n?void 0:n.name)||e.categoryType,consumerName:e.consumerName||`${e.firstName||""} ${e.middleName||""} ${e.lastName||""}`.trim(),firstName:e.firstName,middleName:e.middleName,lastName:e.lastName,gender:(null===(l=e.gender)||void 0===l?void 0:l.name)||e.gender,parentSpouseName:e.parentSpouseName,relation:e.relation||g.relation||"",mobile:e.mobile,whatsapp:e.whatsapp,email:e.email,residents:e.residents,documentId:N,documentProof:b,ownerMobile:e.ownerMobile,tenantVerification:e.tenantVerification,designation:e.designation,department:e.department,employeeId:e.employeeId,landline:e.landline||g.landline||"",entityRelation:e.entityRelation||g.entityRelation||"",contactPerson:e.contactPerson,entityName:e.entityName,idProof:(null===(o=e.identityType)||void 0===o?void 0:o.name)||e.identityType,idNumber:e.documentNumber,consent:e.consent,informantIsConsumer:e.informantIsConsumer??!0,informantName:e.informantName,informantRelation:e.informantRelation},d=S(function(){return Promise.resolve(y.mutateAsync({RequestInfo:{},updateType:"CONSUMER",...s})).then(function(){k({type:"success",message:c("Data updated successfully!")}),i(r.key,s)})},function(){k({type:"error",message:c("Failed to update consumer details")})});return Promise.resolve(d&&d.then?d.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:I,onFormValueChange:(e,t)=>{var a,n,l,o;const r=((null==t||null===(a=t.consumerType)||void 0===a?void 0:a.name)||(null==t?void 0:t.consumerType))!==((null==O||null===(n=O.consumerType)||void 0===n?void 0:n.name)||(null==O?void 0:O.consumerType)),i=((null==t||null===(l=t.occupantType)||void 0===l?void 0:l.name)||(null==t?void 0:t.occupantType))!==((null==O||null===(o=O.occupantType)||void 0===o?void 0:o.name)||(null==O?void 0:O.occupantType));(r||i||(null==t?void 0:t.informantIsConsumer)!==(null==O?void 0:O.informantIsConsumer))&&M(e=>({...e,...t}));const s=null==t?void 0:t.occupantType,c=null==t?void 0:t.mobile,d=null==t?void 0:t.residents,m=null==t?void 0:t.consent,u=(null==t?void 0:t.documentId)||N,E=null==t?void 0:t.ownerMobile;let v=!0;(null==t?void 0:t.kno)||p||(v=!1),(null==t?void 0:t.consumerType)||(v=!1),s||(v=!1),(null==t?void 0:t.categoryType)||(v=!1),(null==t?void 0:t.firstName)||(v=!1),c&&/^[6-9]\d{9}$/.test(c)||(v=!1),(!d||Number(d)<=0)&&(v=!1),"Tenanted"!==(null==s?void 0:s.name)||u||E||(v=!1),m||(v=!1),v!==_&&A(v)},noCard:!1,submitInForm:!0}),f&&a.createElement(o.Toast,{error:"error"===f.type,label:f.message,onClose:()=>k(null)}))},W=[{body:[{route:"consumer-details",component:z,key:"aadhaarVerification",texts:{header:"EKYC_CONSUMER_CONNECTION",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:1,actions:"EKYC_CONSUMER_CONNECTION"}]},{route:"address-details",component:"AddressDetails",key:"addressDetails",doorImage:!0,showMapActualLocation:!1,texts:{header:"EKYC_ADDRESS_DETAILS",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:2,actions:"EKYC_ADDRESS_DETAILS"}]},{route:"property-info",component:"PropertyInfo",key:"propertyDetails",texts:{header:"EKYC_PROPERTY_INFO",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:3,actions:"EKYC_PROPERTY_INFO"}]},{route:"meter-details",component:"MeterDetails",key:"meterDetails",texts:{header:"EKYC_METER_DETAILS",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:4,actions:"EKYC_METER_DETAILS"}]}]}],G=e=>{let{path:r}=e;const i=l.useRouteMatch(),{t:s}=n.useTranslation(),c=l.useLocation(),{pathname:d}=c,m=l.useHistory();let u=[];const[p,E]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{});function v(e,t,a,n,l,o){void 0===l&&(l=!1),void 0===o&&(o=!1),E(a=>({...a,[e]:{...p[e],...t}})),o||((e,t,a,n)=>{let l=d.split("/").pop(),o=u.find(e=>n?e.key===n:e.route===l);o||(o=u.find(e=>e.route===l));let s=null;const c=u.findIndex(e=>e.route===o.route);c>-1&&c<u.length-1&&(s=u[c+1].route);let E=m.push;e&&(E=m.replace);const v=r||i.path.split("/").slice(0,-1).join("/");if(null===s)return E(v+"/review",{...p,edits:p});E(`${v}/${s}`,{...p})})(a,0,0,e)}t.useEffect(()=>{if(c.state&&Object.keys(c.state).length>0){const{edits:e,...t}=c.state;E({...p,...t,...e})}},[c.state]),W.forEach(e=>{u=u.concat(e.body)}),u.indexRoute="consumer-details";const y=u.map(e=>e.route),g=y.some(e=>d.includes(e)),N=t.useRef({});return t.useEffect(()=>{if(g){const e=d.split("/").pop();N.current[e]&&N.current[e].scrollIntoView({behavior:"smooth",block:"start"})}},[d,g]),a.createElement(a.Fragment,null,a.createElement("div",{className:"employee-form-section-wrapper"},a.createElement(o.VerticalTimeline,{config:u,showFinalStep:!0}),a.createElement("div",{className:"employee-form-section"},a.createElement(l.Switch,null,a.createElement(l.Route,{path:y.map(e=>`${r||i.path.split("/").slice(0,-1).join("/")}/${e}`)},a.createElement("div",{className:"single-page-form-container"},u.map((e,t)=>{const{component:n}=e,l="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return a.createElement("div",{key:t,ref:t=>N.current[e.route]=t,className:"form-section-unit"},a.createElement(l,{config:{...e,isCollapsible:!0,defaultOpen:!0},onSelect:v,t:s,formData:p}))}))),a.createElement(l.Route,null,a.createElement(l.Redirect,{to:`${r||i.path.split("/").slice(0,-1).join("/")}/${u.indexRoute}`}))))))},$=e=>{let{surveyor:n,closeModal:l,refetchDashboard:r}=e;const[i,s]=t.useState([]),[c,d]=t.useState(!1),[m,u]=t.useState(0),[p,E]=t.useState(10),[v,y]=t.useState(!1),[g,N]=t.useState({error:!1,label:""}),[C,b]=t.useState({kno:"",pincode:"",zoneName:"",ward:"",assembly:"",mrkey:"",ekycStatus:""}),[h,f]=t.useState(C);t.useEffect(()=>{const e=setTimeout(()=>{f(C)},500);return()=>clearTimeout(e)},[C]),t.useEffect(()=>{u(0)},[h]);const{data:S,isFetching:k}=Digit.Hooks.ekyc.useEkycApplicationList({...h.kno&&{kno:h.kno},...h.ekycStatus&&{ekycStatus:h.ekycStatus},...h.zoneName&&{zoneName:h.zoneName},...h.assembly&&{assembly:h.assembly},...h.ward&&{ward:h.ward},...h.mrkey&&{mrkey:h.mrkey},...h.pincode&&{pincode:h.pincode}},{tenantId:"dl.djb",offset:m*p,limit:p},{keepPreviousData:!0}),T=Digit.Hooks.ekyc.useEkycAssignmentCreate({onSuccess:e=>{var t;if(null!=e&&e.error)return N({error:!0,label:(null==e||null===(t=e.data)||void 0===t?void 0:t.message)||"Something went wrong"}),void y(!0);N({error:!1,label:"Assignment successful"}),y(!0),setTimeout(function(){try{return Promise.resolve(r()).then(function(){l()})}catch(e){return Promise.reject(e)}},1e3)},onError:e=>{var t,a,n;N({error:!0,label:(null==e||null===(t=e.data)||void 0===t?void 0:t.message)||(null==e||null===(a=e.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.message)||"Something went wrong"}),y(!0)}}),D=(null==S?void 0:S.consumerList)||[],_=()=>{d(!0);const e=D.map(e=>e.kno),t=e.length>0&&e.every(e=>i.includes(e));s(a=>t?a.filter(t=>!e.includes(t)):[...new Set([...a,...e])])},A=(e,t)=>{b(a=>({...a,[e]:t}))},I=t.useMemo(()=>[{Header:()=>a.createElement("input",{type:"checkbox",checked:D.length>0&&D.every(e=>i.includes(e.kno)),onChange:_}),id:"selection",Cell:e=>{let{row:t}=e;const n=t.original.kno;return a.createElement("input",{type:"checkbox",checked:i.includes(n),onChange:()=>R(n)})}},{Header:"KNO",accessor:"kno"},{Header:"Consumer Name",accessor:e=>`${e.firstName||""} ${e.middleName||""} ${e.lastName||""}`.trim(),id:"consumerName"},{Header:"Zone",accessor:"zoneName"},{Header:"Pincode",accessor:"pincode"},{Header:"Status",accessor:"status",Cell:e=>{let{value:t}=e;return a.createElement("span",{className:"status-badge "+("ACTIVE"===t?"verified":"PENDING"===t?"pending":"assigned")},t)}},{Header:"eKYC Status",accessor:"ekycStatus",Cell:e=>{let{value:t}=e;return t||"-"}}],[i,D]),R=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return a.createElement(o.Modal,{headerBarMain:"Assign KNOs to "+(null==n?void 0:n.name),headerBarEnd:a.createElement(o.Close,{onClick:l}),actionCancelLabel:"Cancel",actionCancelOnSubmit:l,actionSaveLabel:`Assign ${i.length} KNOs`,actionSaveOnSubmit:()=>{var e;const{assignmentType:t,assignmentValue:a}=(()=>{if(c){const e=[{key:"ekycStatus",type:"EKYCSTATUS"},{key:"zoneName",type:"ZONENAME"},{key:"assembly",type:"ASSEMBLY"},{key:"ward",type:"WARD"},{key:"mrkey",type:"MRKEY"},{key:"pincode",type:"PINCODE"}].find(e=>{let{key:t}=e;return h[t]});if(e)return{assignmentType:e.type,assignmentValue:h[e.key]}}return{assignmentType:"KNO",assignmentValue:i}})();T.mutate({tenantId:"dl.djb",surveyorId:null==n||null===(e=n.owner)||void 0===e?void 0:e.uuid,assignmentType:t,assignmentValue:a})}},a.createElement("div",{className:"assign-knos-modal"},a.createElement("div",{className:"filters-grid"},a.createElement("input",{className:"form-control",placeholder:"KNO",value:C.kno,onChange:e=>A("kno",e.target.value)}),a.createElement("input",{className:"form-control",placeholder:"Pincode",value:C.pincode,onChange:e=>A("pincode",e.target.value)}),a.createElement("input",{className:"form-control",placeholder:"Zone",value:C.zoneName,onChange:e=>A("zoneName",e.target.value)})),a.createElement(o.Table,{tableTitle:"eKYC Applications",tableClass:"ekycTable",data:D,columns:I,isLoading:k,totalRecords:(null==S?void 0:S.totalCount)||0,currentPage:m,pageSizeLimit:p,manualPagination:!0,isPaginationRequired:!0,onNextPage:()=>{m<((null==S?void 0:S.totalPages)||1)-1&&u(e=>e+1)},onPrevPage:()=>{m>0&&u(e=>e-1)},onFirstPage:()=>{u(0)},onLastPage:()=>{u(Math.max(((null==S?void 0:S.totalPages)||1)-1,0))},onPageSizeChange:e=>{E(Number(e.target.value)),u(0)}})),v&&a.createElement(o.Toast,{error:g.error,label:g.label,onClose:()=>y(!1)}))},Z=function(e){let{rows:t,surveyorName:a,employeeId:n,mobileNumber:l,vendorName:o,supervisorName:r,dashboardInfo:i,t:s}=e;try{const e=Digit.ULBService.getCurrentTenantId(),c=Digit.SessionStorage.get("initData"),d=(((null==c?void 0:c.tenants)||[]).find(t=>t.code===e),"Delhi Jal Board"),m="contact@delhijalboard.nic.in",u="+91-11-23538416",p=[{title:s("SURVEYOR_DETAILS"),asSectionHeader:!0,values:[{title:s("SURVEYOR_NAME"),value:a},{title:s("EMPLOYEE_ID"),value:n},{title:s("MOBILE_NUMBER"),value:l},{title:s("VENDOR_NAME"),value:o},{title:s("SUPERVISOR_NAME"),value:r}].filter(e=>e.value)},{title:s("SUMMARY_STATISTICS"),asSectionHeader:!0,values:[{title:s("TOTAL_ASSIGNED"),value:(null==i?void 0:i.total)||0},{title:s("COMPLETED"),value:(null==i?void 0:i.completed)||0},{title:s("PENDING"),value:(null==i?void 0:i.pending)||0},{title:s("SUBMITTED"),value:(null==i?void 0:i.submittedCount)||0}].filter(e=>e.value)}];return window.Digit&&window.Digit.Utils&&window.Digit.Utils.pdf&&window.Digit.Utils.pdf.generateSurveyorReport?window.Digit.Utils.pdf.generateSurveyorReport({tenantId:e,logo:null,name:d,email:m,phoneNumber:u,heading:s("EKYC_SURVEYOR_REPORT"),details:p,applicationNumber:n,rows:t,t:s}):console.error("Digit.Utils.pdf.generateSurveyorReport is not available"),Promise.resolve()}catch(e){return Promise.reject(e)}},q=()=>{var e,r,i,s,d,m,u,p,E,v,y,g,N,C,b,h,f,S,k;const T=Digit.ULBService.getCurrentTenantId(),[D,_]=t.useState(!1),[A,I]=t.useState(!1),{id:R}=l.useParams(),O=null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(r=e.info)||void 0===r?void 0:r.uuid,{t:M}=n.useTranslation(),P=R?{ids:R}:{ownerIds:O},{data:L,isLoading:w}=Digit.Hooks.fsm.useSurveyorSearch(T,P,{staleTime:Infinity}),K=null===(i=Digit.SessionStorage.get("User"))||void 0===i||null===(s=i.info)||void 0===s?void 0:s.roles.map(e=>e.code),F=t.useMemo(()=>{var e;return(null==L||null===(e=L.surveyors)||void 0===e?void 0:e[0])||null},[L]),{data:Y}=Digit.Hooks.fsm.useDsoSearch(T,{status:"ACTIVE"},{enabled:!!T}),{data:x}=Digit.Hooks.fsm.useSupervisorSearch(T,{status:"ACTIVE"},{enabled:!!T}),B=t.useMemo(()=>{var e;if(!Y||null==F||!F.vendorId)return"N/A";const t=Y.find(e=>{var t,a;return(null===(t=e.dsoDetails)||void 0===t?void 0:t.id)===F.vendorId||(null===(a=e.dsoDetails)||void 0===a?void 0:a.vendorId)===F.vendorId});return(null==t||null===(e=t.dsoDetails)||void 0===e?void 0:e.name)||F.vendorId||"N/A"},[Y,null==F?void 0:F.vendorId]),U=t.useMemo(()=>{var e;if(null==x||!x.supervisors||null==F||!F.supervisorId)return"N/A";const t=x.supervisors.find(e=>{var t;return e.id===F.supervisorId||(null===(t=e.owner)||void 0===t?void 0:t.uuid)===F.supervisorId});return(null==t?void 0:t.name)||(null==t||null===(e=t.owner)||void 0===e?void 0:e.name)||F.supervisorId||"N/A"},[x,null==F?void 0:F.supervisorId]),V=(null==F||null===(d=F.owner)||void 0===d?void 0:d.name)||(null==F?void 0:F.name)||"N/A",H=(null==F?void 0:F.employeeId)||(null==F||null===(m=F.owner)||void 0===m?void 0:m.uuid)||(null==F?void 0:F.id),j=(null==F||null===(u=F.owner)||void 0===u?void 0:u.mobileNumber)||(null==F?void 0:F.mobileNo)||"N/A",[z,W]=t.useState(0),[G,q]=t.useState(20),X={tenantId:"dl.djb",offset:z*G,limit:G,surveyorId:null==F||null===(p=F.owner)||void 0===p?void 0:p.uuid},{isFetching:J,data:Q={},refetch:ee}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},X,{enabled:!!X.tenantId&&!!X.surveyorId,keepPreviousData:!0}),te=t.useMemo(()=>[{Header:"KNO",accessor:"kno"},{Header:"Consumer Name",accessor:e=>`${e.firstName||""} ${e.middleName||""} ${e.lastName||""}`.trim(),id:"consumerName"},{Header:"Zone",accessor:"zoneName"},{Header:"Pincode",accessor:"pincode"},{Header:"Status",accessor:"status",Cell:e=>{let{value:t}=e;return a.createElement("span",{className:"status-badge "+("ACTIVE"===t?"verified":"PENDING"===t?"pending":"assigned")},t)}},{Header:"eKYC Status",accessor:"ekycStatus",Cell:e=>{let{value:t}=e;return t||"-"}}],[]),[ae,ne]=t.useState(!1),[le,oe]=t.useState({from:"",to:""}),[re,ie]=t.useState(!1),se=t.useRef(null);if(t.useEffect(()=>{const e=e=>{se.current&&!se.current.contains(e.target)&&(ne(!1),ie(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),w)return a.createElement(o.Loader,null);if(!F)return a.createElement(o.Card,null,a.createElement("div",{style:{padding:"24px"}},M("NO_SURVEYOR_FOUND")));const ce=[{name:"Completed",value:(null==F?void 0:F.completedCases)||0,color:"#10B981"},{name:"Pending",value:(null==F?void 0:F.pendingCases)||0,color:"#F59E0B"},{name:"Rejected",value:(null==F?void 0:F.rejectedCases)||0,color:"#EF4444"}],de=e=>{let{title:t,value:n,type:l,isLoading:o}=e;return a.createElement("div",{className:"stat-card "+l},o?a.createElement(a.Fragment,null,a.createElement("div",{className:"stat-title skeleton skeleton-text"}),a.createElement("div",{className:"stat-value skeleton skeleton-number"})):a.createElement(a.Fragment,null,a.createElement("div",{className:"stat-title"},t),a.createElement("div",{className:"stat-value"},n)))};return a.createElement(o.Card,{className:"surveyor-dashboard"},a.createElement("div",{className:"ekyc-dashboard-section"},a.createElement("div",{className:"ekyc-dashboard-header"},a.createElement("div",{className:"avatar"},null==V||null===(E=V.charAt(0))||void 0===E?void 0:E.toUpperCase()),a.createElement("div",{className:"header-content"},a.createElement("h2",{className:"name"},V),a.createElement("div",{className:"designation"},(null==F?void 0:F.description)||M("FIELD_SURVEYOR")),a.createElement("div",{className:"employee-id"},M("EMPLOYEE_ID"),": ",H))),a.createElement("div",{className:"report-download",ref:se},a.createElement("button",{className:"download-btn",onClick:()=>{ne(e=>!e),ie(!1)}},M("DOWNLOAD_REPORT")||"Download Report"),ae&&a.createElement("div",{className:"report-menu"},[{label:M("TODAY")||"Today",key:"today"},{label:M("THIS_WEEK")||"This Week",key:"week"},{label:M("THIS_MONTH")||"This Month",key:"month"}].map(e=>{let{label:t,key:n}=e;return a.createElement("div",{key:n,className:"menu-item",onClick:()=>(e=>{var t;const a=(null==Q||null===(t=Q.dashboardInfo)||void 0===t?void 0:t.consumerList)||[],n=(e=>{const t=new Date,a=new Date(t);return"today"===e?(a.setHours(0,0,0,0),{from:a,to:t}):"week"===e?(a.setDate(t.getDate()-t.getDay()),a.setHours(0,0,0,0),{from:a,to:t}):"month"===e?(a.setDate(1),a.setHours(0,0,0,0),{from:a,to:t}):null})(e);if(!n)return;const l=a.filter(e=>{const t=e.submittedAt||e.createdTime||e.lastModifiedTime||0;return t>=n.from.getTime()&&t<=n.to.getTime()});Z({rows:l.length?l:a,surveyorName:V,vendorName:B,supervisorName:U,employeeId:H,mobileNumber:j,dashboardInfo:null==Q?void 0:Q.dashboardInfo,t:M}),ne(!1),ie(!1)})(n)},t)}),a.createElement("div",{className:"custom-date-trigger",onClick:()=>ie(e=>!e)},M("CUSTOM_DATE")||"Custom Date"),re&&a.createElement("div",{className:"custom-picker"},a.createElement("div",{className:"date-field"},a.createElement("label",{className:"date-label"},M("FROM_DATE")||"From"),a.createElement("input",{type:"date",className:"date-input",value:le.from,onChange:e=>oe(t=>({...t,from:e.target.value}))})),a.createElement("div",{className:"date-field"},a.createElement("label",{className:"date-label"},M("TO_DATE")||"To"),a.createElement("input",{type:"date",className:"date-input",value:le.to,onChange:e=>oe(t=>({...t,to:e.target.value}))})),a.createElement("button",{className:"download-action-btn",onClick:()=>{var e;if(!le.from||!le.to)return void alert(M("SELECT_DATE_RANGE")||"Please select both From and To dates.");const t=new Date(le.from),a=new Date(le.to);a.setHours(23,59,59,999);const n=(null==Q||null===(e=Q.dashboardInfo)||void 0===e?void 0:e.consumerList)||[],l=n.filter(e=>{const n=e.createdTime||e.lastModifiedTime||0;return n>=t.getTime()&&n<=a.getTime()});Z({rows:l.length?l:n,surveyorName:V,vendorName:B,supervisorName:U,employeeId:H,mobileNumber:j,dashboardInfo:null==Q?void 0:Q.dashboardInfo,t:M}),ne(!1),ie(!1)}},M("DOWNLOAD")||"Download"))))),a.createElement("div",{className:"stats-wrapper"},a.createElement(de,{title:M("TOTAL_ASSIGNED"),value:(null==Q||null===(v=Q.dashboardInfo)||void 0===v?void 0:v.total)||0,type:"today",isLoading:J}),a.createElement(de,{title:M("COMPLETED"),value:(null==Q||null===(y=Q.dashboardInfo)||void 0===y?void 0:y.completed)||0,type:"week",isLoading:J}),a.createElement(de,{title:M("PENDING"),value:(null==Q||null===(g=Q.dashboardInfo)||void 0===g?void 0:g.pending)||0,type:"pending",isLoading:J}),a.createElement(de,{title:M("SUBMITTED"),value:(null==Q||null===(N=Q.dashboardInfo)||void 0===N?void 0:N.submittedCount)||0,type:"month",isLoading:J})),a.createElement("div",{className:"charts-wrapper"},a.createElement("div",{className:"chart-card"},a.createElement("h3",{className:"chart-title"},M("WEEKLY_SURVEY_PROGRESS")),a.createElement(c.ResponsiveContainer,{width:"100%",height:300},a.createElement(c.BarChart,{data:[{day:"Mon",completed:4},{day:"Tue",completed:6},{day:"Wed",completed:3},{day:"Thu",completed:8},{day:"Fri",completed:5},{day:"Sat",completed:7},{day:"Sun",completed:2}]},a.createElement(c.CartesianGrid,{strokeDasharray:"3 3"}),a.createElement(c.XAxis,{dataKey:"day"}),a.createElement(c.YAxis,null),a.createElement(c.Tooltip,null),a.createElement(c.Bar,{dataKey:"completed",fill:"#0B2559",radius:[6,6,0,0]})))),a.createElement("div",{className:"chart-card"},a.createElement("h3",{className:"chart-title"},M("CASE_DISTRIBUTION")),a.createElement(c.ResponsiveContainer,{width:"100%",height:300},a.createElement(c.PieChart,null,a.createElement(c.Pie,{data:ce,dataKey:"value",nameKey:"name",outerRadius:90,label:!0},ce.map((e,t)=>a.createElement(c.Cell,{key:t,fill:e.color}))),a.createElement(c.Tooltip,null),a.createElement(c.Legend,null))))),a.createElement("div",{className:"ekyc-dashboard-section"},a.createElement("div",{className:"details-grid"},a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},M("MOBILE"),":"),a.createElement("span",{className:"value"},(null==F||null===(C=F.owner)||void 0===C?void 0:C.mobileNumber)||(null==F?void 0:F.mobileNo)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},M("EMAIL"),":"),a.createElement("span",{className:"value"},(null==F||null===(b=F.owner)||void 0===b?void 0:b.emailId)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},M("GENDER"),":"),a.createElement("span",{className:"value"},(null==F||null===(h=F.owner)||void 0===h?void 0:h.gender)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},M("STATUS"),":"),a.createElement("span",{className:"value"},(null==F?void 0:F.status)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},M("SERVICE_TYPE"),":"),a.createElement("span",{className:"value"},(null==F||null===(f=F.additionalDetails)||void 0===f?void 0:f.serviceType)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},M("VENDOR_ID"),":"),a.createElement("span",{className:"value"},(null==F?void 0:F.vendorId)||"N/A")))),a.createElement(o.Card,{className:"dashboard-card"},a.createElement(o.Table,{t:M,tableTitle:M("ASSIGNED_KNOS"),tableClass:"ekycTable",data:(null==Q||null===(S=Q.dashboardInfo)||void 0===S?void 0:S.consumerList)||[],columns:te,isLoading:J,totalRecords:null==Q||null===(k=Q.dashboardInfo)||void 0===k?void 0:k.total,currentPage:z,pageSizeLimit:G,isPaginationRequired:!0,onNextPage:()=>{var e;z<((null==Q||null===(e=Q.dashboardInfo)||void 0===e?void 0:e.totalPages)||1)-1&&W(e=>e+1)},onPrevPage:()=>{z>0&&W(e=>e-1)},onFirstPage:()=>{W(0)},onLastPage:()=>{var e;W(Math.max(((null==Q||null===(e=Q.dashboardInfo)||void 0===e?void 0:e.totalPages)||1)-1,0))},onPageSizeChange:e=>{q(Number(e.target.value)),W(0)}})),(!K.includes("EKYC_SURVEYOR")||K.includes("EMPLOYEE"))&&a.createElement(o.ActionBar,null,a.createElement(o.SubmitBar,{label:M("EKYC_ASSIGN_KNOS"),onSubmit:()=>I(e=>!e)}),A&&a.createElement(o.Menu,{options:[{action:"Assign"}],optionKey:"action",t:M,onSelect:e=>{I(!1),_(!0)},style:{color:"#FFFFFF",fontSize:"18px"}})),D&&a.createElement($,{surveyor:F,closeModal:function(){try{return _(!1),Promise.resolve()}catch(e){return Promise.reject(e)}},refetchDashboard:ee}))};function X(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("EKYC.SW.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("EKYC.SW.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("EKYC.SW.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}}const J={filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}},Q=(e,t)=>[{Header:e("SURVEYOR_NAME"),accessor:"surveyorName",Cell:e=>{var n,l,o;let{row:r}=e;const i=null===(n=r.original)||void 0===n?void 0:n.id;return a.createElement("span",{className:"ekyc-application-link",style:{color:"#318ED0",cursor:"pointer",fontSize:"16px"},onClick:()=>t(i)},(null===(l=r.original)||void 0===l?void 0:l.surveyorName)||(null===(o=r.original)||void 0===o?void 0:o.name)||"NA")}},{Header:e("MOBILE_NUMBER"),accessor:"mobileNo",Cell:e=>{var t,n,l;let{row:o}=e;return a.createElement("span",null,(null===(t=o.original)||void 0===t?void 0:t.mobileNo)||(null===(n=o.original)||void 0===n||null===(l=n.owner)||void 0===l?void 0:l.mobileNumber)||"NA")}},{Header:e("STATUS"),accessor:"status",Cell:t=>{var n;let{row:l}=t;const o=(null===(n=l.original)||void 0===n?void 0:n.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+o},e(o))}},{Header:e("SERVICE_TYPE"),accessor:"serviceType",Cell:e=>{var t;let{row:n}=e;return a.createElement("span",null,(null===(t=n.original)||void 0===t?void 0:t.serviceType)||"NA")}}],ee=()=>{var e,r,i,s,c,d;let m=Digit.ULBService.getCurrentTenantId();m&&"dl"!==m||(m="dl.djb");const[u,p]=t.useReducer(X,J);let v={limit:(null==u||null===(e=u.tableForm)||void 0===e?void 0:e.limit)||10,offset:(null==u||null===(r=u.tableForm)||void 0===r?void 0:r.offset)||0,sortBy:(null==u||null===(i=u.tableForm)||void 0===i?void 0:i.sortBy)||"createdTime",sortOrder:(null==u||null===(s=u.tableForm)||void 0===s?void 0:s.sortOrder)||"DESC"};const y=(null==u||null===(c=u.searchForm)||void 0===c?void 0:c.mobileNumber)||"",g={...v,status:"ACTIVE,DISABLED"};y&&(g.mobileNumber=y);const{data:N,isLoading:C}=Digit.Hooks.fsm.useSurveyorSearch(m,g,{enabled:!!m,keepPreviousData:!0}),{isLoading:b,data:h}=Digit.Hooks.ekyc.useEkycAssignmentProgress({enabled:!!m,keepPreviousData:!0}),f=t.useMemo(()=>(null==N?void 0:N.surveyors)||[],[N]),S=t.useMemo(()=>(f||[]).map(e=>{var t,a,n,l,o;const r=(null==e?void 0:e.owner)||{},i=(null==r||null===(t=r.roles)||void 0===t||null===(a=t.map(e=>e.code))||void 0===a?void 0:a.join(", "))||"";return{...e,id:(null==e?void 0:e.id)||"",surveyorName:(null==e?void 0:e.name)||(null==r?void 0:r.name)||"",mobileNo:(null==e?void 0:e.mobileNo)||(null==r?void 0:r.mobileNumber)||"",email:(null==r?void 0:r.emailId)||"",vendorId:(null==e?void 0:e.vendorId)||"",tenantId:(null==e?void 0:e.tenantId)||"",supervisorId:(null==e?void 0:e.supervisorId)||"",status:(null==e?void 0:e.status)||"",roleCodes:i,userName:(null==r?void 0:r.userName)||"",gender:(null==r?void 0:r.gender)||"",serviceType:(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.serviceType)||"",createdTime:(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime)||0,lastModifiedTime:(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.lastModifiedTime)||0}}),[f]),k=(null==N||null===(d=N.dashboardInfo)||void 0===d?void 0:d.totalRecords)||(null==N?void 0:N.totalCount)||0,T=t.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(P,{registerRef:t,searchFormState:n,controlSearchForm:l,className:"search"})},[]),D={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},_={mobileNumber:"",applicationNumber:"",consumerNo:""},A={SearchFormFields:T,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),p({action:"mutateTableForm",data:{...D}}),p({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==u?void 0:u.searchForm,resetSearchFormDefaultValues:_,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),p({action:"mutateSearchForm",data:_})},className:"search-form-wns-inbox"},I=(e=>{var t,a,o,r,i;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:u,onSortingByData:p,inboxStyles:E={},tableStyle:v={}}=e;const{t:y}=n.useTranslation(),g=l.useHistory(),N=(null===(t=Digit.SessionStorage.get("User"))||void 0===t||null===(a=t.info)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toLowerCase())||"citizen",C=(null==c||null===(r=c.tableForm)||void 0===r?void 0:r.limit)||10,b=(null==c||null===(i=c.tableForm)||void 0===i?void 0:i.offset)||0;return{disableSort:!1,autoSort:!1,manualPagination:!0,currentPage:Math.floor(b/C),onPageSizeChange:s,onNextPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:Number(b)+Number(C)}}),onPrevPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:Number(b)-Number(C)}}),onLastPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:Math.ceil(d/C)*C-Number(C)}}),onFirstPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:0}}),totalRecords:d,onSort:p,data:m,columns:Q(y,e=>{g.push(`/digit-ui/${N}/ekyc/assign/surveyor-details/${e}`)}),inboxStyles:{...E},tableStyle:{...v}}})({onPageSizeChange:e=>{const t=Number(e.target.value);p({action:"mutateTableForm",data:{...u.tableForm,limit:t,offset:0}})},formState:u,totalCount:k,table:S,dispatch:p,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,n=a?"DESC":"ASC";u.tableForm.sortBy===t&&u.tableForm.sortOrder===n||p({action:"mutateTableForm",data:{...u.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"}})}},tenantId:m,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(o.InboxComposer,E({isInboxLoading:C},A,{propsForInboxTable:I,formState:u,countData:null==N?void 0:N.dashboardInfo,cards:[{label:"TOTAL_EKYC_APPLICATIONS",count:(null==h?void 0:h.totalKnos)||0,color:"#0B2559",filter:null,active:!0},{label:"TOTAL_ASSIGNMENTS",count:(null==h?void 0:h.totalAssignments)||0,color:"#3B82F6",filter:["ASSIGNED"]},{label:"EKYC_COMPLETED",count:(null==h?void 0:h.completedKnos)||0,color:"#10B981",filter:["COMPLETED"]},{label:"PENDING_APPLICATIONS",count:((null==h?void 0:h.totalKnos)||0)-((null==h?void 0:h.completedKnos)||0),color:"#F59E0B",filter:["PENDING"]},{label:"OVERALL_PROGRESS",count:((null==h?void 0:h.overallProgressPercent)||0)+"%",color:"#A855F7",filter:["IN_PROGRESS"]}],isCardLoading:b})))},te=e=>{let{path:t}=e;const{t:r}=n.useTranslation(),i=l.useLocation();return sessionStorage.removeItem("revalidateddone"),a.createElement(o.AppContainer,null,a.createElement("div",{className:"ground-container employee-app-container form-container"},a.createElement(o.ModuleHeader,{leftContent:a.createElement(a.Fragment,null,a.createElement(o.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=i.pathname,t=[{icon:o.HomeIcon,path:"/digit-ui/employee"},{label:r("ACTION_TEST_EKYC"),path:"/digit-ui/employee/module/details"}];return e.includes("/create-kyc")?t.push({label:r("EKYC_CREATE_KYC")}):e.includes("/consumer-details")?t.push({label:r("EKYC_CONSUMER_DETAILS")}):e.includes("/address-details")?t.push({label:r("EKYC_ADDRESS_DETAILS")}):e.includes("/property-info")?t.push({label:r("EKYC_PROPERTY_INFO")}):e.includes("/meter-details")?t.push({label:r("EKYC_METER_DETAILS")}):e.includes("/review")?(t.push({label:r("EKYC_INBOX"),path:"/digit-ui/employee/ekyc/inbox"}),t.push({label:r("EKYC_REVIEW")})):e.includes("/assign/surveyor-details")?(t.push({label:r("EKYC_ASSIGN"),path:"/digit-ui/employee/ekyc/assign"}),t.push({label:r("EKYC_SURVEYOR_DETAILS")})):e.includes("/assign")?t.push({label:r("EKYC_ASSIGN")}):e.includes("/ceo-dashboard")?t.push({label:r("CEO_M.F_DOR_FINANCE_VIEW")}):e.includes("/vendors/")?t.push({label:r("EKYC_VENDOR_DETAILS")}):e.includes("/mapping")?t.push({label:r("EKYC_MAPPING")}):e.includes("/dashboard")?t.push({label:r("EKYC_DASHBOARD")}):e.includes("/inbox")&&t.push({label:r("EKYC_INBOX")}),t})()}),a.createElement("div",{className:"employee-form"},a.createElement(l.Switch,null,a.createElement(o.PrivateRoute,{path:t+"/dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(m,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0}))}),a.createElement(o.PrivateRoute,{path:t+"/inbox",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(L,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0}))}),a.createElement(o.PrivateRoute,{path:t+"/create-kyc",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(x,null))}),a.createElement(o.PrivateRoute,{path:t+"/mapping",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(F,null))}),a.createElement(o.PrivateRoute,{path:t+"/assign",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ee,null))}),a.createElement(o.PrivateRoute,{path:t+"/assign/surveyor-details/:id",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"action"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:["consumer-details","address-details","property-info","meter-details"].map(e=>`${t}/${e}`),component:e=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(G,E({},e,{path:t})))}),a.createElement(o.PrivateRoute,{path:t+"/review/:kno",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"action"},a.createElement(j,null))}),a.createElement(o.PrivateRoute,{path:t+"/ceo-dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(b,null))}),a.createElement(o.PrivateRoute,{path:t+"/vendors/:vendorId",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(h,null))})))))},ae=e=>{let{config:r,onSelect:i,formData:s}=e;const{t:c}=n.useTranslation(),d=l.useLocation(),m=d.state||{},u=Digit.ULBService.getCurrentTenantId(),p=new URLSearchParams(d.search).get("kno")||(null==m?void 0:m.kNumber)||(null==m?void 0:m.kno)||(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||sessionStorage.getItem("EKYC_K_NUMBER"),{isLoading:E,data:v}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:{kno:p,fetchType:"PROPERTY"}},{enabled:!!p,cacheTime:0}),y=Digit.Hooks.ekyc.useEkycUpdate(u),g=(null==s?void 0:s.propertyDetails)||{},[N,C]=t.useState(null),[b,h]=t.useState(g.buildingImageId||null),[f,k]=t.useState(null),[T,D]=t.useState(!1),[_,A]=t.useState(!1),[I,R]=t.useState(()=>({pidNumber:g.pidNumber||"",propertyType:g.propertyType?{name:g.propertyType}:null,subPropertyCategory:g.subPropertyCategory?{name:g.subPropertyCategory}:null,noOfFloors:g.noOfFloors||"",floorNo:g.floorNo||"",noOfRooms:g.noOfRooms||"",noOfBeds:g.noOfBeds||"",dwellingUnits:g.dwellingUnits||"",buildingImage:g.buildingImageId?"Uploaded":null})),[O,M]=t.useState(I);if(t.useEffect(()=>{const e=(e=>{if(!e)return null;const t=(null==e?void 0:e.applicationReviewInfo)||(null==e?void 0:e.applicationReview)||e,a=(Array.isArray(t)?t[0]:t)||{};return(null==a?void 0:a.newData)||a})(v)||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.propertyInfo)||(null==e?void 0:e.propertyDetails)||e||{};if(t&&Object.keys(t).length>0&&!T){let e=null,a=null;t.subPropertyCategory&&(e=[{name:"Residential"},{name:"Commercial"},{name:"Hotel"},{name:"Hospital"},{name:"Nursing Home"}].find(e=>e.name.toLowerCase()===t.subPropertyCategory.toLowerCase())||{name:t.subPropertyCategory},a={name:t.subPropertyCategory}),t.propertyType&&(a={name:t.propertyType},t.subPropertyCategory||(e={name:t.propertyType}));const n={pidNumber:g.pidNumber||t.pidNumber||"",propertyType:g.propertyType?{name:g.propertyType}:e,subPropertyCategory:g.subPropertyCategory?{name:g.subPropertyCategory}:a,noOfFloors:g.noOfFloors||(t.numberOfFloors||t.noOfFloor?String(t.numberOfFloors||t.noOfFloor):""),floorNo:g.floorNo||t.floorNo||"",noOfRooms:g.noOfRooms||(null!=t.numberOfRooms?String(t.numberOfRooms):""),noOfBeds:g.noOfBeds||(null!=t.numberOfBeds?String(t.numberOfBeds):""),dwellingUnits:g.dwellingUnits||(null!=t.numberOfDwellingUnits?String(t.numberOfDwellingUnits):""),buildingImage:g.buildingImageId||t.buildingImageFileStoreId||null};R(n),M(n),n.buildingImage&&h(n.buildingImage),D(!0)}},[v,null==s?void 0:s.connectionDetails,T]),E)return a.createElement(o.Loader,null);const P=function(e,t,n,l,r,i,s){var c,d,m;void 0===t&&(t={});const u=(null===(c=t)||void 0===c||null===(d=c.propertyType)||void 0===d?void 0:d.name)||(null===(m=t)||void 0===m?void 0:m.propertyType),p="Hotel"===u,E="Hospital"===u||"Nursing Home"===u,v=[{label:e("PID Number"),isMandatory:!1,type:"text",populators:{name:"pidNumber"}},{label:e("Property Type"),isMandatory:!1,type:"custom",key:"propertyType",populators:{name:"propertyType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Residential"},{name:"Commercial"},{name:"Hotel"},{name:"Hospital"},{name:"Nursing Home"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Sub Property Category"),isMandatory:!1,type:"custom",key:"subPropertyCategory",populators:{name:"subPropertyCategory",component:e=>a.createElement(o.Dropdown,{option:[],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("No. of Floors"),isMandatory:!0,type:"number",populators:{name:"noOfFloors",validation:{required:!0,min:1}}},{label:e("Floor No. of this KNO"),isMandatory:!1,type:"text",populators:{name:"floorNo"}},{label:e("No of Beds"),isMandatory:E,type:"number",populators:{name:"noOfBeds",validation:E?{required:!0,min:1}:{}}},{label:e("No. of Rooms"),isMandatory:p,type:"number",populators:{name:"noOfRooms",validation:p?{required:!0,min:1}:{}}},{label:e("Number of Dwelling Units"),isMandatory:!1,type:"number",populators:{name:"dwellingUnits"}},{label:e("Building Image"),isMandatory:!0,type:"custom",key:"buildingImage",populators:{name:"buildingImage",component:t=>a.createElement("div",null,a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),i(null),s(null)},message:e(r?"Uploaded":"No file selected")}),l&&a.createElement("div",{style:{marginTop:"10px"}},a.createElement("img",{src:l,alt:"preview",style:{maxWidth:"100%",maxHeight:"200px",objectFit:"contain"}})))}}];return[{head:e("EKYC_PROPERTY_DETAILS"),body:v}]}(c,O,function(e,t){try{const a=e.target.files[0];if(!a)return Promise.resolve();if(a.size>2e6)return k({type:"error",message:c("Max size 2MB exceeded")}),Promise.resolve();const n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a,u)).then(function(e){var n,l,o;const r=null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.fileStoreId;if(r){t(a.name),h(r);const e=new FileReader;e.onloadend=()=>C(e.result),e.readAsDataURL(a),k({type:"success",message:c("Upload successful")})}})},function(){k({type:"error",message:c("Upload failed")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},N,b,C,h);return a.createElement(t.Fragment,null,a.createElement(o.FormComposer,{key:T?"loaded":"loading",isDisabled:!_,label:c("ES_COMMON_CONTINUE"),config:P.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),onSubmit:function(e){try{var t,a;const n={pidNumber:e.pidNumber,propertyType:(null===(t=e.propertyType)||void 0===t?void 0:t.name)||e.propertyType,subPropertyCategory:(null===(a=e.subPropertyCategory)||void 0===a?void 0:a.name)||e.subPropertyCategory,noOfFloors:e.noOfFloors,floorNo:e.floorNo,noOfRooms:e.noOfRooms,noOfBeds:e.noOfBeds,dwellingUnits:e.dwellingUnits,buildingImageId:b},l=S(function(){return Promise.resolve(y.mutateAsync({RequestInfo:{},updateType:"PROPERTY",kno:p,...n})).then(function(){k({type:"success",message:c("Property details updated successfully!")}),i(r.key,n)})},function(){k({type:"error",message:c("Failed to update property details")})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:I,onFormValueChange:(e,t)=>{var a,n;((null==t||null===(a=t.propertyType)||void 0===a?void 0:a.name)||(null==t?void 0:t.propertyType))!==((null==O||null===(n=O.propertyType)||void 0===n?void 0:n.name)||(null==O?void 0:O.propertyType))&&M(e=>({...e,...t}));const l=null==t?void 0:t.propertyType,o=null==t?void 0:t.noOfFloors,r=b||(null==t?void 0:t.buildingImage),i=null==t?void 0:t.noOfRooms,s=null==t?void 0:t.noOfBeds;let c=!0;l||(c=!1),(null==t?void 0:t.subPropertyCategory)||(c=!1),(!o||Number(o)<1)&&(c=!1),r||(c=!1),"Hotel"!==(null==l?void 0:l.name)||i||(c=!1),"Hospital"!==(null==l?void 0:l.name)&&"Nursing Home"!==(null==l?void 0:l.name)||s||(c=!1),c!==_&&A(c)},noCard:!1,submitInForm:!0}),f&&a.createElement(o.Toast,{error:"error"===f.type,label:f.message,onClose:()=>k(null)}))},ne=e=>{let{config:r,onSelect:i,formData:s}=e;const{t:c}=n.useTranslation(),d=l.useLocation(),m=d.state||{},u=Digit.ULBService.getCurrentTenantId(),p=new URLSearchParams(d.search).get("kno")||(null==m?void 0:m.kNumber)||(null==m?void 0:m.kno)||(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||sessionStorage.getItem("EKYC_K_NUMBER"),{isLoading:E,data:v}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:{kno:p,fetchType:"METER"}},{enabled:!!p,cacheTime:0}),y=Digit.Hooks.ekyc.useEkycUpdate(u),g=(null==s?void 0:s.meterDetails)||{},[N,C]=t.useState(null),[b,h]=t.useState(g.meterPhotoId||null),[f,k]=t.useState(null),[T,D]=t.useState(!1),[_,A]=t.useState(!1),[I,R]=t.useState(()=>({connectionCategory:g.connectionCategory||"",saType:g.saType||"",status:g.status||"",mrCode:g.mrCode||"",areaCode:g.areaCode||"",mrKey:g.mrKey||"",meterNumber:g.meterNumber||"",meterMaker:g.meterMaker||"",meterStatus:g.meterStatus?{name:g.meterStatus}:null,meterCondition:g.meterCondition?{name:g.meterCondition}:null,meterLocation:g.meterLocation?{name:g.meterLocation}:null,lastBillReceived:g.lastBillReceived?{name:g.lastBillReceived}:null,billMonthYear:g.billMonthYear?{name:g.billMonthYear}:null,reason:g.reason||"",accessToMeter:g.accessToMeter?{name:g.accessToMeter}:null,sewerConnection:g.sewerConnection?{name:g.sewerConnection}:null,septicTank:g.septicTank?{name:g.septicTank}:null,meterPhoto:g.meterPhotoId?"Uploaded":null})),[O,M]=t.useState(I);if(t.useEffect(()=>{const e=(e=>{if(!e)return null;const t=(null==e?void 0:e.applicationReviewInfo)||(null==e?void 0:e.applicationReview)||e,a=(Array.isArray(t)?t[0]:t)||{};return(null==a?void 0:a.newData)||a})(v)||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.meterDetails)||e||{};if(t&&Object.keys(t).length>0&&!T){let e=null,a=null,n=null,l=null,o=null,r=null,i=null,s=null;if(t.meterStatus?e=[{name:"Metered"},{name:"Unmetered"},{name:"Can not be identified"}].find(e=>e.name.toLowerCase()===t.meterStatus.toLowerCase())||{name:t.meterStatus}:void 0!==t.metered&&(e={name:t.metered?"Metered":"Unmetered"}),t.meterCondition&&(a=[{name:"Damaged"},{name:"Not-Damaged"}].find(e=>e.name.toLowerCase()===t.meterCondition.toLowerCase())||{name:t.meterCondition}),t.meterLocation&&(n=[{name:"Inside"},{name:"Outside"}].find(e=>e.name.toLowerCase()===t.meterLocation.toLowerCase()||t.meterLocation.toLowerCase().includes(e.name.toLowerCase()))||{name:t.meterLocation}),null!=t.lastBillRaised){const e=String(t.lastBillRaised).toLowerCase();l="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}if(t.lastBillReceivedDate){const e=t.lastBillReceivedDate.replace("-","/").split("/");o=2===e.length?{name:`${parseInt(e[0],10)}/${parseInt(e[1],10)}`}:{name:t.lastBillReceivedDate}}if(null!=t.accessToMeter){const e=String(t.accessToMeter).toLowerCase();r="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}if(null!=t.sewerConnection){const e=String(t.sewerConnection).toLowerCase();i="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}if(null!=t.septicTank){const e=String(t.septicTank).toLowerCase();s="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}const c={connectionCategory:g.connectionCategory||t.connectionCategory||"",saType:g.saType||t.saType||"",status:g.status||t.statusFlag||"",mrCode:g.mrCode||(t.mrcode?String(t.mrcode):""),areaCode:g.areaCode||(t.areacode?String(t.areacode):""),mrKey:g.mrKey||(t.mrkey?String(t.mrkey):""),meterNumber:g.meterNumber||t.meterNumber||"",meterMaker:g.meterMaker||t.meterMake||"",meterStatus:g.meterStatus?{name:g.meterStatus}:e,meterCondition:g.meterCondition?{name:g.meterCondition}:a,meterLocation:g.meterLocation?{name:g.meterLocation}:n,lastBillReceived:g.lastBillReceived?{name:g.lastBillReceived}:l,billMonthYear:g.billMonthYear?{name:g.billMonthYear}:o,reason:g.reason||t.lastBillNotRaisedReason||"",accessToMeter:g.accessToMeter?{name:g.accessToMeter}:r,sewerConnection:g.sewerConnection?{name:g.sewerConnection}:i,septicTank:g.septicTank?{name:g.septicTank}:s,meterPhoto:g.meterPhotoId||t.meterPhotoFileStoreId||null};R(c),M(c),c.meterPhoto&&h(c.meterPhoto),D(!0)}},[v,null==s?void 0:s.connectionDetails,T]),E)return a.createElement(o.Loader,null);const P=function(e,t,n,l,r,i,s){var c,d,m,u,p,E,v,y,g;void 0===t&&(t={});const N=(null===(c=t)||void 0===c||null===(d=c.meterStatus)||void 0===d?void 0:d.name)||(null===(m=t)||void 0===m?void 0:m.meterStatus),C=(null===(u=t)||void 0===u||null===(p=u.lastBillReceived)||void 0===p?void 0:p.name)||(null===(E=t)||void 0===E?void 0:E.lastBillReceived),b=(null===(v=t)||void 0===v||null===(y=v.sewerConnection)||void 0===y?void 0:y.name)||(null===(g=t)||void 0===g?void 0:g.sewerConnection),h="Can not be identified"===N,f=[];for(let e=1998;e<=2026;e++)for(let t=1;t<=12;t++)f.push({name:`${t}/${e}`});const S=[{name:"Yes"},{name:"No"}],k=[{label:e("Connection Category"),isMandatory:!0,type:"text",populators:{name:"connectionCategory",validation:{required:!0}}},{label:e("SA Type"),isMandatory:!1,type:"text",populators:{name:"saType"}},{label:e("Status"),isMandatory:!1,type:"text",populators:{name:"status"}},{label:e("MR Code"),isMandatory:!1,type:"text",populators:{name:"mrCode"}},{label:e("Area Code"),isMandatory:!1,type:"text",populators:{name:"areaCode"}},{label:e("MR Key"),isMandatory:!1,type:"text",populators:{name:"mrKey"}}];return h||(k.push({label:e("Meter Number"),isMandatory:!1,type:"text",populators:{name:"meterNumber"}},{label:e("Meter Maker"),isMandatory:!1,type:"text",populators:{name:"meterMaker"}},{label:e("Meter Condition"),isMandatory:!1,type:"custom",key:"meterCondition",populators:{name:"meterCondition",component:e=>a.createElement(o.Dropdown,{option:[{name:"Damaged"},{name:"Not-Damaged"}],optionKey:"name",selected:e.value,select:e.onChange})}}),"Metered"===N&&k.push({label:e("Meter Photo *"),isMandatory:!0,type:"custom",key:"meterPhoto",populators:{name:"meterPhoto",component:t=>a.createElement("div",null,a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),i(null),s(null)},message:e(r?"Uploaded":"No file selected")}),l&&a.createElement("div",{style:{marginTop:"10px"}},a.createElement("img",{src:l,alt:"preview",style:{maxWidth:"100%",maxHeight:"200px",objectFit:"contain"}})))}})),k.push({label:e("Meter Status"),isMandatory:!0,type:"custom",key:"meterStatus",populators:{name:"meterStatus",component:e=>a.createElement(o.Dropdown,{option:[{name:"Metered"},{name:"Unmetered"},{name:"Can not be identified"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Meter Location"),isMandatory:!0,type:"custom",key:"meterLocation",populators:{name:"meterLocation",component:e=>a.createElement(o.Dropdown,{option:[{name:"Inside"},{name:"Outside"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Last Bill Received"),isMandatory:!0,type:"custom",key:"lastBillReceived",populators:{name:"lastBillReceived",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}}),"Yes"===C?k.push({label:e("When was the last bill received *"),isMandatory:!0,type:"custom",key:"billMonthYear",populators:{name:"billMonthYear",component:e=>a.createElement(o.Dropdown,{option:f,optionKey:"name",selected:e.value,select:e.onChange})}}):"No"===C&&k.push({label:e("Reason *"),isMandatory:!0,type:"text",populators:{name:"reason",validation:{required:!0}}}),k.push({label:e("Access to Meter"),isMandatory:!1,type:"custom",key:"accessToMeter",populators:{name:"accessToMeter",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Sewer Connection"),isMandatory:!0,type:"custom",key:"sewerConnection",populators:{name:"sewerConnection",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}}),"No"===b&&k.push({label:e("Septic Tank"),isMandatory:!0,type:"custom",key:"septicTank",populators:{name:"septicTank",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}}),[{head:e("EKYC_METER_DETAILS"),body:k}]}(c,O,function(e,t){try{const a=e.target.files[0];if(!a)return Promise.resolve();if(a.size>2e6)return k({type:"error",message:c("Max size 2MB exceeded")}),Promise.resolve();const n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a,u)).then(function(e){var n,l,o;const r=null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.fileStoreId;if(r){t(a.name),h(r);const e=new FileReader;e.onloadend=()=>C(e.result),e.readAsDataURL(a),k({type:"success",message:c("Upload successful")})}})},function(){k({type:"error",message:c("Upload failed")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},N,b,C,h);return a.createElement(t.Fragment,null,a.createElement(o.FormComposer,{key:T?"loaded":"loading",isDisabled:!_,label:c("ES_COMMON_CONTINUE"),config:P.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),onSubmit:function(e){try{var t,a,n,l,o,s,d,m;const u={connectionCategory:e.connectionCategory,saType:e.saType,status:e.status,mrCode:e.mrCode,areaCode:e.areaCode,mrKey:e.mrKey,meterNumber:e.meterNumber,meterMaker:e.meterMaker,meterStatus:(null===(t=e.meterStatus)||void 0===t?void 0:t.name)||e.meterStatus,meterCondition:(null===(a=e.meterCondition)||void 0===a?void 0:a.name)||e.meterCondition,meterLocation:(null===(n=e.meterLocation)||void 0===n?void 0:n.name)||e.meterLocation,lastBillReceived:(null===(l=e.lastBillReceived)||void 0===l?void 0:l.name)||e.lastBillReceived,billMonthYear:(null===(o=e.billMonthYear)||void 0===o?void 0:o.name)||e.billMonthYear,reason:e.reason,accessToMeter:(null===(s=e.accessToMeter)||void 0===s?void 0:s.name)||e.accessToMeter,sewerConnection:(null===(d=e.sewerConnection)||void 0===d?void 0:d.name)||e.sewerConnection,septicTank:(null===(m=e.septicTank)||void 0===m?void 0:m.name)||e.septicTank,meterPhotoId:b},E=S(function(){return Promise.resolve(y.mutateAsync({RequestInfo:{},updateType:"METER",kno:p,...u})).then(function(){k({type:"success",message:c("Meter details updated successfully!")}),i(r.key,u)})},function(){k({type:"error",message:c("Failed to update meter details")})});return Promise.resolve(E&&E.then?E.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:I,onFormValueChange:(e,t)=>{var a,n,l,o,r,i;const s=((null==t||null===(a=t.meterStatus)||void 0===a?void 0:a.name)||(null==t?void 0:t.meterStatus))!==((null==O||null===(n=O.meterStatus)||void 0===n?void 0:n.name)||(null==O?void 0:O.meterStatus)),c=((null==t||null===(l=t.lastBillReceived)||void 0===l?void 0:l.name)||(null==t?void 0:t.lastBillReceived))!==((null==O||null===(o=O.lastBillReceived)||void 0===o?void 0:o.name)||(null==O?void 0:O.lastBillReceived)),d=((null==t||null===(r=t.sewerConnection)||void 0===r?void 0:r.name)||(null==t?void 0:t.sewerConnection))!==((null==O||null===(i=O.sewerConnection)||void 0===i?void 0:i.name)||(null==O?void 0:O.sewerConnection));(s||c||d)&&M(e=>({...e,...t}));const m=null==t?void 0:t.meterStatus,u=null==t?void 0:t.lastBillReceived,p=null==t?void 0:t.sewerConnection;let E=!0;(null==t?void 0:t.connectionCategory)||(E=!1),m||(E=!1),(null==t?void 0:t.meterLocation)||(E=!1),u||(E=!1),p||(E=!1),"Metered"!==(null==m?void 0:m.name)||b||(null==t?void 0:t.meterPhoto)||(E=!1),"No"!==(null==u?void 0:u.name)||(null==t?void 0:t.reason)||(E=!1),"Yes"!==(null==u?void 0:u.name)||(null==t?void 0:t.billMonthYear)||(E=!1),"No"!==(null==p?void 0:p.name)||(null==t?void 0:t.septicTank)||(E=!1),E!==_&&A(E)},noCard:!1,submitInForm:!0}),f&&a.createElement(o.Toast,{error:"error"===f.type,label:f.message,onClose:()=>k(null)}))},le=()=>{var e,t;const{t:l}=n.useTranslation(),r={moduleName:l("ACTION_TEST_EKYC"),kpis:[{count:"-",label:l("TOTAL_EKYC"),link:"/digit-ui/citizen/ekyc/dashboard"}],links:[]},i=(null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(t=e.info)||void 0===t?void 0:t.roles).map(e=>e.code);return i.includes("EKYC_SURVEYOR")&&r.links.push({label:l("SURVEYOR_DASHBOARD"),link:"/digit-ui/citizen/ekyc/surveyor-dashboard"}),(i.includes("EKYC_SUPERVISOR")||i.includes("EKYC_VENDOR"))&&r.links.push({label:l("EKYC_DASHBOARD"),link:"/digit-ui/citizen/ekyc/dashboard"},{label:l("EKYC_INBOX"),link:"/digit-ui/citizen/ekyc/inbox"},{label:l("EKYC_ASSIGN"),link:"/digit-ui/citizen/ekyc/assign"}),1===i.length&&i.includes("CITIZEN")&&r.links.push({label:l("EKYC_STATUS"),link:"/digit-ui/citizen/ekyc/:id"}),a.createElement(o.ModuleLinksView,{links:r.links})},oe=e=>{var n,r,i,s,c;let{parentRoute:d}=e;const m=Digit.ULBService.getCurrentTenantId(),u=l.useLocation(),[p,v]=t.useReducer(function(e,t){const a=t.checkPathName?"EKYC.INBOX":"EKYC.SW.INBOX";switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set(a,{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set(a,{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set(a,{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}},{filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}}),y=t.useMemo(()=>{var e,t;return{tenantId:m,offset:(null==p||null===(e=p.tableForm)||void 0===e?void 0:e.offset)||0,limit:(null==p||null===(t=p.tableForm)||void 0===t?void 0:t.limit)||10,search:(null==p?void 0:p.searchForm)||{}}},[m,null==p||null===(n=p.tableForm)||void 0===n?void 0:n.offset,null==p||null===(r=p.tableForm)||void 0===r?void 0:r.limit,null==p?void 0:p.searchForm]),g=t.useMemo(()=>{const e=(null==p?void 0:p.searchForm)||{};return{...e,...e.kNumber&&{kno:e.kNumber}}},[null==p?void 0:p.searchForm]),{isLoading:N,data:C={}}=Digit.Hooks.ekyc.useEkycApplicationList(g,y,{enabled:!!m,keepPreviousData:!0}),b=t.useMemo(()=>{var e,t;return{kno:(null==p||null===(e=p.searchForm)||void 0===e?void 0:e.kNumber)||"",name:(null==p||null===(t=p.searchForm)||void 0===t?void 0:t.kName)||""}},[null==p||null===(i=p.searchForm)||void 0===i?void 0:i.kNumber,null==p||null===(s=p.searchForm)||void 0===s?void 0:s.kName]),h=!(!b.kno&&!b.name),{isLoading:S,data:k}=Digit.Hooks.ekyc.useSearchConnection({tenantId:m,details:b},{enabled:!!m&&!!b.kno,keepPreviousData:!0}),T=t.useMemo(()=>h?k?[k]:[]:(null==C?void 0:C.consumerList)||[],[h,k,C]),D=t.useMemo(()=>(T||[]).map(e=>{var t,a,n,l,o,r,i,s;return e.connectionDetails?{applicationNo:(null===(t=e.propertyInfo)||void 0===t?void 0:t.kno)||"",connectionNo:(null===(a=e.propertyInfo)||void 0===a?void 0:a.kno)||"",owner:(null===(n=e.connectionDetails)||void 0===n?void 0:n.consumerName)||"",applicationNumber:(null===(l=e.propertyInfo)||void 0===l?void 0:l.kno)||"",citizenName:(null===(o=e.connectionDetails)||void 0===o?void 0:o.consumerName)||"",status:(null===(r=e.connectionDetails)||void 0===r?void 0:r.statusflag)||"",ekycStatus:(null===(i=e.connectionDetails)||void 0===i?void 0:i.ekycStatus)||(null===(s=e.connectionDetails)||void 0===s?void 0:s.ekycstatus)||e.ekycStatus||e.ekycstatus||"NA",sla:0}:{...e,applicationNo:e.kno||e.applicationNumber||"",connectionNo:e.connectionNo||"",owner:e.consumerName||e.citizenName||"",applicationNumber:e.kno||e.applicationNumber||"",citizenName:e.consumerName||e.citizenName||"",status:e.status||"",ekycStatus:e.ekycStatus||e.ekycstatus||"NA",sla:e.sla??0}}),[T]),_=(null==C||null===(c=C.dashboardInfo)||void 0===c?void 0:c.totalRecords)||(null==C?void 0:C.totalCount)||0,A=u.pathname.includes("ekyc/inbox"),I=t.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(P,{registerRef:t,searchFormState:n,controlSearchForm:l,className:"search"})},[]),R={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},O={kNumber:"",applicationNumber:"",consumerNo:""},M={SearchFormFields:I,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),v({action:"mutateTableForm",data:{...R},checkPathName:A}),v({action:"mutateSearchForm",data:e,checkPathName:A})},searchFormDefaultValues:null==p?void 0:p.searchForm,resetSearchFormDefaultValues:O,onSearchFormReset:e=>{e("kNumber",null),e("applicationNumber",null),e("consumerNo",null),v({action:"mutateSearchForm",data:O})},className:"search-form-wns-inbox"},L=f({parentRoute:d,onPageSizeChange:e=>{const t=Number(e.target.value);v({action:"mutateTableForm",data:{...p.tableForm,limit:t,offset:0},checkPathName:A})},formState:p,totalCount:_,table:D,dispatch:v,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,n=a?"DESC":"ASC";p.tableForm.sortBy===t&&p.tableForm.sortOrder===n||v({action:"mutateTableForm",data:{...p.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"},checkPathName:A})}},tenantId:m,checkPathName:A,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(o.InboxComposer,E({isInboxLoading:N||S},M,{propsForInboxTable:L,formState:p})))},re=()=>{const{t:e}=n.useTranslation(),t=l.useLocation(),{path:r}=l.useRouteMatch();return sessionStorage.removeItem("revalidateddone"),a.createElement(a.Fragment,null,a.createElement("div",{className:"ground-container form-container"},a.createElement(o.ModuleHeader,{leftContent:a.createElement(a.Fragment,null,a.createElement(o.ArrowLeft,{className:"icon"}),e("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const a=t.pathname,n=[{icon:o.HomeIcon,path:"/digit-ui/citizen"},{label:e("EKYC_MODULE_NAME"),path:"/digit-ui/citizen/ekyc"}];return a.includes("/create-kyc")?n.push({label:e("EKYC_CREATE_KYC")}):a.includes("/aadhaar-verification")?n.push({label:e("EKYC_AADHAAR_VERIFICATION")}):a.includes("/address-details")?n.push({label:e("EKYC_ADDRESS_DETAILS")}):a.includes("/property-info")?n.push({label:e("EKYC_PROPERTY_INFO")}):a.includes("/meter-details")?n.push({label:e("EKYC_METER_DETAILS")}):a.includes("/review")?(n.push({label:e("EKYC_INBOX"),path:"/digit-ui/citizen/ekyc/inbox"}),n.push({label:e("EKYC_REVIEW")})):a.includes("/assign/surveyor-details")?(n.push({label:e("EKYC_ASSIGN"),path:"/digit-ui/citizen/ekyc/assign"}),n.push({label:e("EKYC_SURVEYOR_DETAILS")})):a.includes("/assign")?n.push({label:e("EKYC_ASSIGN")}):a.includes("/surveyor-dashboard")?n.push({label:e("EKYC_SURVEYOR_DASHBOARD")}):a.includes("/dashboard")?n.push({label:e("EKYC_DASHBOARD")}):a.includes("/inbox")?n.push({label:e("EKYC_INBOX")}):a.includes("/status/")&&n.push({label:e("EKYC_STATUS")}),n})()}),a.createElement(l.Switch,null,a.createElement(o.PrivateRoute,{exact:!0,path:""+r,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(le,null))}),a.createElement(o.PrivateRoute,{path:r+"/dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(h,null))}),a.createElement(o.PrivateRoute,{path:r+"/inbox",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(oe,null))}),a.createElement(o.PrivateRoute,{path:r+"/aadhaar-verification",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(z,null))}),a.createElement(o.PrivateRoute,{path:r+"/property-info",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ae,null))}),a.createElement(o.PrivateRoute,{path:r+"/meter-details",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ne,null))}),a.createElement(o.PrivateRoute,{path:r+"/review",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(j,null))}),a.createElement(o.PrivateRoute,{path:r+"/assign",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ee,null))}),a.createElement(o.PrivateRoute,{path:r+"/assign/surveyor-details/:id",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"action"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:r+"/surveyor-dashboard/:id",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:r+"/surveyor-dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:r+"/status/:applicationId",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(j,null))}))))},ie=e=>{let{stateCode:n,userType:r,tenants:i}=e;const{path:s,url:c}=l.useRouteMatch(),d=Digit.StoreData.getCurrentLanguage(),{isLoading:m}=Digit.Services.useStore({stateCode:n,moduleCode:"EKYC",language:d});return Digit.SessionStorage.set("EKYC_TENANTS",i),t.useEffect(()=>Digit.LocalizationService.getLocale({modules:["rainmaker-ekyc","rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),m?a.createElement(o.Loader,{page:!0}):"employee"===r?a.createElement(te,{path:s,url:c,userType:r,tenants:i}):a.createElement(re,null)},se=e=>{let{matchPath:t}=e;const{t:l}=n.useTranslation(),r=[{link:t+"/create-kyc",i18nKey:l("EKYC_CREATE_KYC")},{link:t+"/update-kyc",i18nKey:l("EKYC_UPDATE_KYC")}];return a.createElement(o.CitizenHomeCard,{header:l("EKYC_MODULE_NAME"),links:r,Icon:()=>a.createElement(o.DocumentIcon,{className:"fill-path-primary-main"})})},ce={EKYCModule:ie,EKYCCard:()=>{const{t:e}=n.useTranslation(),t={Icon:a.createElement(o.PersonIcon,null),moduleName:e("ACTION_TEST_EKYC"),kpis:[{count:"-",label:e("TOTAL_EKYC"),link:"/digit-ui/employee/ekyc/dashboard"}],links:[{label:e("CEO_M.F_DOR_FINANCE_VIEW"),link:"/digit-ui/employee/ekyc/ceo-dashboard"},{label:e("EKYC_INBOX"),link:"/digit-ui/employee/ekyc/inbox"},{label:e("EKYC_ASSIGN"),link:"/digit-ui/employee/ekyc/assign"}]};return a.createElement(o.EmployeeModuleCard,t)},EKYCInbox:m,EKYCDesktopInbox:e=>{var r;let{filterComponent:i,...s}=e;const{data:c,isLoading:m,onSort:u,onNextPage:p,onPrevPage:E,currentPage:v,pageSizeLimit:y,onPageSizeChange:g,parentRoute:N,searchParams:C,sortParams:b,totalRecords:h,countData:f}=s,{t:S}=n.useTranslation(),k=l.useHistory(),T=Digit.ULBService.getCurrentTenantId(),D=null===(r=Digit.ComponentRegistryService)||void 0===r?void 0:r.getComponent(i),[_,A]=t.useState(""),{data:I,getReview:R}=Digit.Hooks.ekyc.useEkycAPI("review",T),O=e=>{A(e),R({kno:e})};a.useEffect(()=>{I&&k.push("/digit-ui/employee/ekyc/review",{kNumber:_,aadhaarData:null==I?void 0:I.aadhaarData,reviewData:I})},[I]);const M=t.useMemo(()=>[{Header:S("EKYC_APPLICATION_NO"),accessor:"applicationNumber",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>O(o)},o)}},{Header:S("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:n}=e;return a.createElement("span",null,(null===(t=n.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:S("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:n}=e;const l=(null===(t=n.original)||void 0===t?void 0:t.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+l},S(""+l))}},{Header:S("EKYC_EKYC_STATUS"),accessor:"ekycStatus",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.ekycStatus)||(null===(n=l.original)||void 0===n?void 0:n.ekycstatus)||"NA";return a.createElement("span",{className:"ekyc-status-tag "+o},S(""+o))}},{Header:S("EKYC_ACTION"),accessor:"status",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>O(o)},S("EKYC_REVIEW"))}}],[S,N]),P=t.useMemo(()=>(null==c?void 0:c.items)||(Array.isArray(c)?c:[]),[c]);return a.createElement("div",{className:"app-container"},a.createElement("div",{className:"inbox-container"},m&&a.createElement(o.Loader,null),a.createElement("div",{className:"side-panel-item"},a.createElement(o.InboxLinks,{headerText:s.moduleCode}),D&&a.createElement(D,{defaultSearchParams:s.defaultSearchParams,onFilterChange:s.onSearch,searchParams:C,type:"desktop",moduleCode:"EKYC"})),a.createElement("div",{className:"employee-form-content",style:{flex:1}},a.createElement(o.Card,{className:"ekyc-metrics-card"},a.createElement(d,{countData:f})),a.createElement("div",{className:"result",style:{flex:1}},a.createElement(o.Card,{className:"ekyc-table-card",style:{padding:0}},a.createElement(o.Table,{t:S,data:P,columns:M,isLoading:m,onSort:u,sortParams:b,totalRecords:h,onNextPage:p,onPrevPage:E,currentPage:v,pageSizeLimit:y,onPageSizeChange:g,getCellProps:e=>({className:"ekyc-table-cell"})}))))))},EKYCMobileInbox:e=>{var t;let{data:r,isLoading:i,onSearch:s,searchParams:c,parentRoute:m,countData:p}=e;const{t:E}=n.useTranslation(),v=(null==r||null===(t=r.items)||void 0===t?void 0:t.map(e=>({[E("EKYC_APPLICATION_NO")]:e.applicationNumber,[E("EKYC_CITIZEN_NAME")]:e.citizenName,[E("EKYC_MOBILE_NO")]:e.mobileNumber,[E("EKYC_STATUS")]:a.createElement("span",{className:"ekyc-status-tag "+e.status},E("EKYC_STATUS_"+e.status))})))||[];return a.createElement("div",{className:"inbox-wrapper"},a.createElement("div",{className:"ekyc-header-container module-header"},a.createElement(o.Header,{className:"title"},E("EKYC_INBOX_HEADER")),a.createElement(l.Link,{to:m+"/create-kyc"},a.createElement(o.SubmitBar,{label:E("EKYC_CREATE_KYC")}))),a.createElement("div",{className:"ekyc-metrics-section"},a.createElement(d,{countData:p})),a.createElement(u,{onSearch:s,searchParams:c}),a.createElement("div",{className:"mobile-data-container"},i?a.createElement(o.Loader,null):(null==v?void 0:v.length)>0?a.createElement(o.DetailsCard,{data:v,t:E,serviceRequestIdKey:E("EKYC_APPLICATION_NO"),linkPrefix:m+"/application-details/"}):a.createElement(o.Card,null,E("ES_COMMON_NO_DATA").split("\\n").map((e,t)=>a.createElement("p",{key:t,style:{textAlign:"center"}},e)))))},EKYC_INBOX_FILTER:e=>a.createElement(p,e),EkycLinks:se,AadhaarVerification:z,PropertyInfo:ae,MeterDetails:ne};exports.EkycLinks=se,exports.EkycModule=ie,exports.default=ie,exports.initEkycComponents=()=>{Object.entries(ce).forEach(e=>{let[t,a]=e;Digit.ComponentRegistryService.setComponent(t,a)})};
1
+ function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("react"),a=e(t),n=require("react-i18next"),l=require("react-router-dom"),o=require("@djb25/digit-ui-react-components"),r=require("chart.js/auto"),i=e(r),s=require("react-icons/fa"),c=require("recharts");const d=e=>{let{countData:l}=e;const{t:o}=n.useTranslation(),s=t.useRef(null),c=t.useRef(null),d=(null==l?void 0:l.total)||0,m=(null==l?void 0:l.pending)||0,u=(null==l?void 0:l.completed)||0,p=(null==l?void 0:l.completed)||0,E=p,v=d>0?Math.round(p/d*100):0,y=d>0?Math.round(E/d*100):0,g=e=>new Intl.NumberFormat("en-IN").format(e||0);t.useEffect(()=>{if(s.current){c.current&&c.current.destroy();const e=s.current.getContext("2d");c.current=new(r.Chart||i||r)(e,{type:"doughnut",data:{labels:[o("EKYC_ACTIVE"),o("EKYC_PENDING"),o("EKYC_COMPLETED")],datasets:[{data:[u,m,0],backgroundColor:["#0c2a52","#77B6EA","#c8ddf5"],borderColor:["#ffffff","#ffffff","#ffffff"],borderWidth:2,hoverOffset:4}]},options:{cutout:"75%",plugins:{legend:{display:!1}},maintainAspectRatio:!1,responsive:!0}})}return()=>{c.current&&c.current.destroy()}},[m,0,u,o]);const N=[{color:"#0c2a52",label:o("EKYC_ACTIVE"),value:u},{color:"#77B6EA",label:o("EKYC_PENDING"),value:m},{color:"#c8ddf5",label:o("EKYC_COMPLETED"),value:0}];return a.createElement("div",{className:"ekyc-employee-container"},a.createElement("div",{className:"status-cards-wrapper"},a.createElement("div",{className:"status-cards-header"},a.createElement("div",null,a.createElement("div",{className:"eyebrow"},a.createElement("span",{className:"eyebrow-dot"}),o("EKYC_INSTITUTIONAL_OVERVIEW")||"Institutional Performance Overview"),a.createElement("h1",{className:"status-cards-h1"},o("EKYC_DASHBOARD_TITLE")||"eKYC Verification Dashboard"),a.createElement("p",{className:"status-cards-subtitle"},o("EKYC_DASHBOARD_SUBTITLE")||"Real-time monitoring of consumer verification workflows across all administrative zones.")),a.createElement("div",{className:"total-applications-card"},a.createElement("div",{className:"total-label"},o("EKYC_TOTAL_APPLICATIONS")||"Total Applications Processed"),a.createElement("div",{className:"total-number"},g(d)),a.createElement("div",{className:"total-badge"},"↗ +12.4% ",o("EKYC_FROM_LAST_QUARTER")||"from last quarter"))),a.createElement("div",{className:"status-panels-grid"},a.createElement("div",{className:"status-panel"},a.createElement("div",{className:"panel-title"},o("EKYC_STATUS_BREAKDOWN")||"Status Breakdown"),a.createElement("div",{className:"panel-subtitle"},o("EKYC_VERIFICATION_LIFECYCLE")||"Verification lifecycle distribution"),a.createElement("div",{className:"breakdown-body"},a.createElement("div",{className:"status-legend"},N.map(e=>a.createElement("div",{key:e.label,className:"legend-row"},a.createElement("span",{className:"legend-label"},a.createElement("span",{className:"indicator-dot",style:{background:e.color}}),e.label),a.createElement("span",{className:"legend-value"},g(e.value))))),a.createElement("div",{className:"chart-wrapper"},a.createElement("canvas",{ref:s,style:{width:"100%",height:"100%"}}),a.createElement("div",{className:"chart-center"},a.createElement("div",{className:"chart-percentage"},v,"%"),a.createElement("div",{className:"chart-label"},o("EKYC_COMPLETE")||"Complete"))))),a.createElement("div",{className:"status-panel"},a.createElement("div",{className:"panel-title"},o("EKYC_SUBMISSION_HEALTH")||"Submission Health",a.createElement("span",{className:"optimal-badge"},o("EKYC_OPTIMAL")||"Optimal")),a.createElement("div",{className:"panel-subtitle"},o("EKYC_PLATFORM_EFFICIENCY")||"Platform operational efficiency"),a.createElement("div",{className:"health-metrics-row"},a.createElement("div",{className:"health-percentage"},y,"%"),a.createElement("div",{className:"health-trend"},"↗ +2.1%")),a.createElement("div",{className:"status-progress-bar"},a.createElement("div",{className:"progress-fill",style:{width:y+"%"}})),a.createElement("div",{className:"mini-metrics-grid"},a.createElement("div",{className:"metric-box"},a.createElement("div",{className:"metric-label"},o("EKYC_AVG_LATENCY")||"Avg Latency"),a.createElement("div",{className:"metric-value"},"1.2s")),a.createElement("div",{className:"metric-box"},a.createElement("div",{className:"metric-label"},o("EKYC_ERROR_RATE")||"Error Rate"),a.createElement("div",{className:"metric-value"},"0.04%")))))))},m=()=>{const e=Digit.ULBService.getCurrentTenantId(),{isLoading:n,data:l}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},{tenantId:e,offset:0,limit:10},{enabled:!!e}),r=t.useMemo(()=>{const e=(null==l?void 0:l.dashboardInfo)||{};return{total:e.total||0,completed:e.completed||0,pending:e.pending||0,rejected:e.rejected||0,active:e.active||0}},[l]);return n?a.createElement(o.Loader,null):a.createElement(o.Card,{className:"min-width-full"},a.createElement(d,{countData:r}))},u=e=>{var l,r,i;let{onSearch:s,searchParams:c,children:d,...m}=e;const{t:u}=n.useTranslation(),[p,E]=t.useState(()=>({...c})),v=(e,t)=>{E(a=>({...a,[e]:t}))};return a.createElement("div",{className:"ekyc-employee-container"},a.createElement("div",{className:"search-consumer-wrapper"},a.createElement("div",{className:"header-wrapper"},a.createElement(o.Card,{className:"sidebar-title-card"},a.createElement("div",{className:"icon-container"},a.createElement(o.HomeIcon,null)),a.createElement("div",{className:"title-text"},u("EKYC_SEARCH_CONSUMER_HEADER")))),a.createElement("div",{className:"main-content-wrapper"},a.createElement("div",{className:"search-stats-row"},a.createElement("div",{className:"identity-lookup-card"},a.createElement("div",{className:"lookup-card-title"},a.createElement("div",{className:"lookup-icon-bg"},a.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("circle",{cx:"11",cy:"11",r:"8"}),a.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))),a.createElement("span",{className:"lookup-title-text"},u("EKYC_IDENTITY_LOOKUP")||"Identity Lookup")),a.createElement("form",{onSubmit:e=>{e&&e.preventDefault&&e.preventDefault(),s(p)}},a.createElement("div",{className:"inputs-row"},a.createElement("div",{className:"input-group"},a.createElement("label",null,u("EKYC_K_NUMBER")||"K Number",a.createElement("span",{className:"info-badge"},"i")),a.createElement(o.TextInput,{value:null==p?void 0:p.kNumber,onChange:e=>v("kNumber",e.target.value),placeholder:u("EKYC_K_NUMBER_PLACEHOLDER")||"e.g. 8234910234"})),a.createElement("div",{className:"input-group"},a.createElement("label",null,u("EKYC_K_NAME")||"K Name",a.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),a.createElement("circle",{cx:"12",cy:"7",r:"4"}))),a.createElement(o.TextInput,{value:null==p?void 0:p.kName,onChange:e=>v("kName",e.target.value),placeholder:u("EKYC_K_NAME_PLACEHOLDER")||"Consumer name search"}))),a.createElement("div",{className:"actions-row"},a.createElement("button",{type:"button",onClick:()=>{const e={kNumber:"",kName:""};E(e),s(e)},className:"clear-btn"},u("ES_COMMON_CLEAR")||"Clear"),a.createElement("button",{type:"submit",className:"search-btn"},u("ES_COMMON_SEARCH")||"Execute Search")))),a.createElement("div",{className:"stats-column"},a.createElement("div",{className:"audits-card"},a.createElement("div",{className:"audits-label"},u("EKYC_TODAYS_AUDITS")||"Today's Audits"),a.createElement("div",{className:"audits-count"},(null===(l=m.countData)||void 0===l?void 0:l.todaysAudits)||24),a.createElement("div",{className:"audits-change"},a.createElement("span",null,"↗"),(null===(r=m.countData)||void 0===r?void 0:r.auditChange)||"12% increase from yesterday"),a.createElement("div",{className:"audits-watermark"},"M")),a.createElement("div",{className:"queue-card"},a.createElement("div",{className:"queue-label"},u("EKYC_QUEUE_STATUS")||"Queue Status"),a.createElement("div",{className:"queue-content"},a.createElement("div",{className:"queue-status-text"},(null===(i=m.countData)||void 0===i?void 0:i.pendingCount)||3," Pending"),a.createElement("div",{className:"avatar-group"},[0,1].map(e=>a.createElement("div",{key:e,className:"avatar-item"},String.fromCharCode(65+e))),a.createElement("div",{className:"avatar-more"},"+1")))))),d)))},p=e=>{let{searchParams:l,onFilterChange:r,defaultSearchParams:i,...s}=e;const{t:c}=n.useTranslation(),[d,m]=t.useState(()=>({...l}));return a.createElement(o.FilterForm,{onSubmit:()=>{r(d)},handleSubmit:e=>t=>{t&&t.preventDefault(),e()},onResetFilterForm:()=>{m({...i}),r({...i})},id:"ekyc-filter-form",onMobileExclusiveFilterPopupFormClose:s.onClose},a.createElement(o.FilterFormField,null,a.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},c("EKYC_STATUS"),":"),a.createElement(o.Dropdown,{option:[{label:c("EKYC_STATUS_ALL"),value:""},{label:c("EKYC_STATUS_ACTIVE"),value:"ACTIVE"},{label:c("EKYC_STATUS_PENDING"),value:"PENDING START"}],optionKey:"label",select:e=>{const t={...d,status:e};m(t),r(t)},selected:(null==d?void 0:d.status)||{label:c("EKYC_STATUS_ALL"),value:""}})))};function E(){return(E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(null,arguments)}const v={topKpis:{totalWaterConnections:2990996,totalEkycCompleted:2460810,totalPending:530186,totalRejected:224324,agencyEkycCompleted:2352069,citizenSelfEkycCompleted:638927,todaysEkyc:54684,successRate:82,rejectionPercentage:7},executiveMetrics:{totalSurveyors:186,totalSupervisors:56,activeJurisdictions:27,todaysGrowth:2.8,selfEkycAdoption:38,avgApprovalTime:"2.3 Days",riskZones:7,escalationsOpen:18},alerts:[{title:"North East District pending increased",priority:"high",change:"+22%",district:"North East District"},{title:"Agency 2 self eKYC adoption low",priority:"medium",change:"-12%",district:"West District"},{title:"Escalation raised in NWS Bhera Enclave",priority:"high",change:"+18",district:"Outer North"},{title:"Approval rate improved in East District",priority:"low",change:"+9%",district:"East District"}],heatmapData:[{district:"Outer North",intensity:82},{district:"East District",intensity:48},{district:"South District",intensity:67},{district:"North East District",intensity:74}],dailyTrend:[{label:"Mon",completed:270689,pending:491305,rejected:145810},{label:"Tue",completed:442945,pending:466563,rejected:157026},{label:"Wed",completed:615202,pending:441821,rejected:168243},{label:"Thu",completed:812067,pending:413545,rejected:179459},{label:"Fri",completed:1033540,pending:381733,rejected:190675},{label:"Sat",completed:1279621,pending:346388,rejected:201891},{label:"Sun",completed:1574918,pending:303973,rejected:213107}],selfVsAgency:[{label:"Agency1",agency:201457,citizen:758414},{label:"Agency 2",agency:164302,citizen:919322},{label:"Agency 3",agency:328451,citizen:541772}],pendingVsCompleted:[{label:"Agency1",completed:201457,pending:201457},{label:"Agency 2",completed:164302,pending:164302},{label:"Agency 3",completed:328451,pending:77278}],rejectionAnalysis:[{label:"Agency1",rejected:71990,success:72},{label:"Agency 2",rejected:81271,success:77},{label:"Agency 3",rejected:71063,success:86}],vendors:[{id:1,name:"Agency1",assignedConnections:959871,completedEkyc:201457,selfEkyc:758414,pending:201457,rejected:71990,inactiveDemand:1161328,successRate:72,progress:21,supervisors:23,activeSurveyors:64,jurisdictions:["Outer North","North West District","Model Town AC 18","Cluster 2","North District"],dailyPerformance:[{day:"Mon",completed:16116,pending:196084,rejected:53272},{day:"Tue",completed:26189,pending:192727,rejected:55072},{day:"Wed",completed:38276,pending:188698,rejected:57232},{day:"Thu",completed:52378,pending:183997,rejected:59751},{day:"Fri",completed:68495,pending:178625,rejected:62631},{day:"Sat",completed:84611,pending:173253,rejected:65510},{day:"Sun",completed:100728,pending:167880,rejected:68390}],zones:[{agency:"Agency1",district:"Outer North",cluster:"NWS Bhera Enclave",assignedConnections:102669,location:"102669",zroOffice:"NWS Bhera Enclave",assemblyConstituency:"Part of Mundka AC 08",gpsLocation:null,distanceFromFarthestPoint:null,activeDemand:202197,pppZones:15800,inactiveDemand:35265,districtwiseInactiveTotal:237462},{agency:"Agency1",district:"Outer North",cluster:"Narela",assignedConnections:99528,location:"99528",zroOffice:"Narela",assemblyConstituency:"Narela AC 01",activeDemand:99528,pppZones:19465,inactiveDemand:35265},{agency:"Agency1",district:"North West District",cluster:"Rohini AC 13",assignedConnections:71041,location:"71041",zroOffice:"Rohini",assemblyConstituency:"Rithala AC 06",activeDemand:247949,pppZones:28975,inactiveDemand:49494},{agency:"Agency1",district:"Mangol Puri AC 12",cluster:"Model Town AC 18",assignedConnections:68957,location:"68957",zroOffice:"Central North District",assemblyConstituency:"Ashok Vihar",activeDemand:231216,pppZones:16627,inactiveDemand:36915},{agency:"Agency1",district:"Timarpur AC 03",cluster:"Cluster 2",assignedConnections:34862,location:"34862",zroOffice:"Old Delhi District",assemblyConstituency:"Pratap Nagar",activeDemand:99694,pppZones:20011,inactiveDemand:48011},{agency:"Agency1",district:"Bali Maran AC 22",cluster:"North District",assignedConnections:110507,location:"110507",zroOffice:"Burari",assemblyConstituency:"Burari AC 2",activeDemand:178815,pppZones:14700,inactiveDemand:31772}]},{id:2,name:"Agency 2",assignedConnections:1083624,completedEkyc:164302,selfEkyc:919322,pending:164302,rejected:81271,inactiveDemand:1247926,successRate:77,progress:15,supervisors:14,activeSurveyors:64,jurisdictions:["West District","Janak Puri","South District"],dailyPerformance:[{day:"Mon",completed:13144,pending:159920,rejected:60140},{day:"Tue",completed:21359,pending:157182,rejected:62172},{day:"Wed",completed:31217,pending:153896,rejected:64610},{day:"Thu",completed:42718,pending:150062,rejected:67454},{day:"Fri",completed:55862,pending:145681,rejected:70705},{day:"Sat",completed:69006,pending:141299,rejected:73956},{day:"Sun",completed:82151,pending:136918,rejected:77207}],zones:[{agency:"Agency 2",district:"West District",cluster:"Rajouri Garden AC 27",assignedConnections:84506,location:"84506",zroOffice:"Rajouri Garden AC 27",assemblyConstituency:"Punjabi Bagh",activeDemand:470766,pppZones:13269,inactiveDemand:64564},{agency:"Agency 2",district:"West District",cluster:"Tilak Nagar AC 29",assignedConnections:51428,location:"51428",zroOffice:"Tilak Nagar AC 29",assemblyConstituency:"Paschim Vihar",activeDemand:470766,pppZones:6298,inactiveDemand:64564},{agency:"Agency 2",district:"Part of Uttam Nagar & Vikas puri",cluster:"Janak Puri",assignedConnections:163041,location:"163041",zroOffice:"Janakpuri",assemblyConstituency:"Janakpuri AC 30",activeDemand:369772,pppZones:25729,inactiveDemand:60534},{agency:"Agency 2",district:"South District",cluster:"South District",assignedConnections:52803,location:"52803",zroOffice:"R K Puram",assemblyConstituency:"Malviya Nagar AC 43",activeDemand:243086,pppZones:9678,inactiveDemand:39204},{agency:"Agency 2",district:"South District",cluster:"Vasant Kunz",assignedConnections:58997,location:"58997",zroOffice:"Vasant Kunj",assemblyConstituency:"Vasant Kunj",activeDemand:243086,pppZones:6691,inactiveDemand:39204}]},{id:3,name:"Agency 3",assignedConnections:947501,completedEkyc:328451,selfEkyc:541772,pending:77278,rejected:71063,inactiveDemand:1016841,successRate:86,progress:78,supervisors:19,activeSurveyors:58,jurisdictions:["East District","North East District","South East District","MNWS"],dailyPerformance:[{day:"Mon",completed:44120,pending:130002,rejected:5711},{day:"Tue",completed:58221,pending:121998,rejected:7104},{day:"Wed",completed:70218,pending:113201,rejected:8842},{day:"Thu",completed:85124,pending:104006,rejected:9911},{day:"Fri",completed:102315,pending:94441,rejected:11214},{day:"Sat",completed:121009,pending:85218,rejected:12902},{day:"Sun",completed:142118,pending:77278,rejected:14101}],zones:[{agency:"Agency 3",district:"East District",cluster:"Mayur Vihar",assignedConnections:72326,location:"72326",zroOffice:"Mayur Vihar",assemblyConstituency:"Trilokpuri AC 55",activeDemand:328564,pppZones:9691,inactiveDemand:52477},{agency:"Agency 3",district:"East District",cluster:"Yojna Vihar",assignedConnections:40651,location:"40651",zroOffice:"Yojna Vihar",assemblyConstituency:"Vishwas Nagar AC 59",activeDemand:328564,pppZones:10097,inactiveDemand:52477},{agency:"Agency 3",district:"North East District",cluster:"GTB Enclave",assignedConnections:80453,location:"80453",zroOffice:"GTB Enclave",assemblyConstituency:"Seemapuri AC 63",activeDemand:323753,pppZones:10671,inactiveDemand:50575},{agency:"Agency 3",district:"North East District",cluster:"Yamuna Vihar",assignedConnections:90599,location:"90599",zroOffice:"Yamuna Vihar",assemblyConstituency:"Mustafabad AC 69",activeDemand:323753,pppZones:18185,inactiveDemand:50575},{agency:"Agency 3",district:"South East District",cluster:"Kalkaji AC 51",assignedConnections:29188,location:"29188",zroOffice:"Kalkaji AC 51",assemblyConstituency:"Saket",activeDemand:136102,pppZones:3675,inactiveDemand:23977},{agency:"Agency 3",district:"South East District",cluster:"Okhla",assignedConnections:18473,location:"18473",zroOffice:"Sarita Vihar/Okhla",assemblyConstituency:"Okhla AC 54",activeDemand:136102,pppZones:3703,inactiveDemand:23977}]}]},y=e=>{let{data:t=[]}=e;const n=t.map(e=>({...e,agencyKyc:e.completed||0,selfKyc:Math.round(.42*(e.completed||0)),totalKyc:(e.completed||0)+Math.round(.42*(e.completed||0))}));return a.createElement("div",{className:"chart-card executive-line-chart"},a.createElement(c.ResponsiveContainer,{width:"100%",height:340},a.createElement(c.LineChart,{data:n,margin:{top:20,right:12,left:0,bottom:0}},a.createElement(c.CartesianGrid,{stroke:"#e2e8f0",strokeDasharray:"3 3",vertical:!1}),a.createElement(c.XAxis,{dataKey:"label",axisLine:!1,tickLine:!1,tick:{fill:"#64748b",fontSize:12,fontWeight:600}}),a.createElement(c.YAxis,{axisLine:!1,tickLine:!1,tick:{fill:"#64748b",fontSize:12}}),a.createElement(c.Tooltip,{cursor:{stroke:"#cbd5e1",strokeWidth:1},contentStyle:{background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:18,boxShadow:"0 10px 30px rgba(15,23,42,0.08)"},labelStyle:{color:"#0f172a",fontWeight:700,marginBottom:10}}),a.createElement(c.Legend,{verticalAlign:"top",align:"right",iconType:"circle",wrapperStyle:{paddingBottom:18,color:"#475569",fontWeight:600}}),a.createElement(c.Line,{type:"monotone",dataKey:"totalKyc",name:"Total eKYC",stroke:"#0f172a",strokeWidth:4,dot:!1,activeDot:{r:6}}),a.createElement(c.Line,{type:"monotone",dataKey:"agencyKyc",name:"Agency eKYC",stroke:"#3b82f6",strokeWidth:3,dot:{r:3},activeDot:{r:6}}),a.createElement(c.Line,{type:"monotone",dataKey:"selfKyc",name:"Self eKYC",stroke:"#10b981",strokeWidth:3,dot:{r:3},activeDot:{r:6}}))))},g=e=>{let{data:t=[],categories:n=[],xKey:l="label"}=e;return a.createElement("div",{className:"chart-card",style:{minHeight:320}},a.createElement(c.ResponsiveContainer,{width:"100%",height:320},a.createElement(c.BarChart,{data:t,margin:{top:12,right:16,left:0,bottom:0}},a.createElement(c.CartesianGrid,{stroke:"rgba(148, 163, 184, 0.12)",strokeDasharray:"4 4"}),a.createElement(c.XAxis,{dataKey:l,axisLine:!1,tickLine:!1,tick:{fill:"#cbd5e1"}}),a.createElement(c.YAxis,{axisLine:!1,tickLine:!1,tick:{fill:"#cbd5e1"}}),a.createElement(c.Tooltip,{contentStyle:{background:"#0f172a",border:"none",borderRadius:14},itemStyle:{color:"#f8fafc"}}),a.createElement(c.Legend,{verticalAlign:"top",align:"right",iconType:"circle",wrapperStyle:{color:"#cbd5e1"}}),n.map((e,t)=>a.createElement(c.Bar,{key:e.key,dataKey:e.key,name:e.name,fill:0===t?"#34d399":"#60a5fa",radius:[12,12,0,0],barSize:24})))))},N=["#22c55e","#38bdf8","#f97316","#facc15","#f43f5e"],b=e=>{let{data:t=[],dataKey:n="value",labelKey:l="label"}=e;return a.createElement("div",{className:"chart-card",style:{minHeight:320}},a.createElement(c.ResponsiveContainer,{width:"100%",height:320},a.createElement(c.PieChart,null,a.createElement(c.Pie,{data:t,dataKey:n,nameKey:l,cx:"50%",cy:"50%",outerRadius:110,innerRadius:60,paddingAngle:3,label:{fill:"#f8fafc",fontSize:12}},t.map((e,t)=>a.createElement(c.Cell,{key:"cell-"+t,fill:N[t%N.length]}))),a.createElement(c.Tooltip,{contentStyle:{background:"#0f172a",border:"none",borderRadius:14,color:"#f8fafc"}}),a.createElement(c.Legend,{verticalAlign:"bottom",align:"center",iconType:"circle",wrapperStyle:{color:"#cbd5e1",marginTop:10}}))))},C=()=>{var e;const n=l.useHistory(),o=l.useLocation(),[r,i]=t.useState(""),[c,d]=t.useState("All"),m=o.pathname.replace(/\/ceo-dashboard$/,""),u=t.useMemo(()=>v.vendors||[],[]),p=t.useMemo(()=>v.topKpis||{},[]),E=t.useMemo(()=>v.dailyTrend||[],[]),N=t.useMemo(()=>v.selfVsAgency||[],[]),C=t.useMemo(()=>v.pendingVsCompleted||[],[]),h=t.useMemo(()=>u.filter(e=>"High Priority"===c?e.successRate<70:"Watchlist"===c?e.pending>35e3:"Stable"!==c||e.successRate>=70).filter(e=>{if(!r)return!0;const t=r.toLowerCase();return e.name.toLowerCase().includes(t)||e.jurisdictions.some(e=>e.toLowerCase().includes(t))||e.zones.some(e=>{var a;return null===(a=e.location)||void 0===a?void 0:a.toLowerCase().includes(t)})}),[u,r,c]),f=t.useMemo(()=>u.flatMap(e=>e.zones.map(t=>({...t,agency:e.name}))).filter(e=>e.location).sort((e,t)=>(t.activeDemand||0)-(e.activeDemand||0)),[u]);return a.createElement("div",{className:"ekyc-dashboard-wrapper"},a.createElement("div",{className:"dashboard-shell"},a.createElement("section",{className:"kpi-grid"},[{title:"Total Water Connections",value:p.totalWaterConnections,icon:a.createElement(s.FaUsers,null),variant:"primary"},{title:"Total eKYC Completed",value:p.totalEkycCompleted,icon:a.createElement(s.FaCheckCircle,null),variant:"success"},{title:"Total Pending",value:p.totalPending,icon:a.createElement(s.FaClock,null),variant:"warning"},{title:"Total Rejected",value:p.totalRejected,icon:a.createElement(s.FaExclamationTriangle,null),variant:"danger"},{title:"Agency eKYC Completed",value:p.agencyEkycCompleted,icon:a.createElement(s.FaUserTie,null),variant:"info"},{title:"Citizen Self eKYC Completed",value:p.citizenSelfEkycCompleted,icon:a.createElement(s.FaUsers,null),variant:"secondary"},{title:"Today's eKYC",value:p.todaysEkyc,icon:a.createElement(s.FaChartLine,null),variant:"muted"},{title:"Success Rate",value:p.successRate+"%",icon:a.createElement(s.FaCheckCircle,null),variant:"success"},{title:"Rejection Percentage",value:p.rejectionPercentage+"%",icon:a.createElement(s.FaExclamationTriangle,null),variant:"danger"}].map(e=>{var t,n;return a.createElement("article",{key:e.title,className:"kpi-card card-"+e.variant},a.createElement("div",{className:"kpi-icon"},e.icon),a.createElement("div",null,a.createElement("p",{className:"kpi-title"},e.title),a.createElement("h2",null,(null===(t=e.value)||void 0===t||null===(n=t.toLocaleString)||void 0===n?void 0:n.call(t))??e.value)))})),a.createElement("section",{className:"vendor-section"},a.createElement("div",{className:"section-top"},a.createElement("div",null,a.createElement("h2",null,"Agency Performance Snapshot"),a.createElement("p",null,"Search, filter, and navigate into detailed analytics for every assigned vendor.")),a.createElement("div",{className:"vendor-filters"},a.createElement("div",{className:"search-box"},a.createElement(s.FaSearch,null),a.createElement("input",{type:"text",placeholder:"Search agency, jurisdiction, location",value:r,onChange:e=>i(e.target.value)})),a.createElement("div",{className:"status-pill-group"},["All","High Priority","Stable","Watchlist"].map(e=>a.createElement("button",{key:e,className:"status-pill "+(c===e?"active":""),onClick:()=>d(e)},e))))),a.createElement("div",{className:"vendor-grid"},h.map(e=>a.createElement("div",{key:e.id,className:"vendor-card glass-card",onClick:()=>{n.push(`${m}/vendors/${e.id}`)}},a.createElement("div",{className:"vendor-card-top"},a.createElement("div",null,a.createElement("p",{className:"vendor-chip"},e.name),a.createElement("h3",null,e.assignedConnections.toLocaleString()),a.createElement("p",{className:"vendor-subtitle"},"Assigned connections across ",e.jurisdictions.length," jurisdiction(s)")),a.createElement("div",{className:"vendor-progress-value"},e.progress,"%")),a.createElement("div",{className:"progress-bar"},a.createElement("div",{className:"progress-fill",style:{width:e.progress+"%"}})),a.createElement("div",{className:"vendor-stats-grid"},a.createElement("div",null,a.createElement("strong",null,e.completedEkyc.toLocaleString()),a.createElement("span",null,"Agency eKYC")),a.createElement("div",null,a.createElement("strong",null,e.selfEkyc.toLocaleString()),a.createElement("span",null,"Self eKYC")),a.createElement("div",null,a.createElement("strong",null,e.pending.toLocaleString()),a.createElement("span",null,"Pending")),a.createElement("div",null,a.createElement("strong",null,e.rejected.toLocaleString()),a.createElement("span",null,"Rejected"))),a.createElement("div",{className:"vendor-card-footer"},a.createElement("span",null,e.activeSurveyors," Surveyors"),a.createElement("span",null,e.supervisors," Supervisors"),a.createElement("span",null,e.jurisdictions.join(", "))),a.createElement("div",{className:"vendor-card-action"},a.createElement("span",null,"Explore analytics"),a.createElement(s.FaArrowRight,null)))))),a.createElement("section",{className:"analytics-grid"},a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Daily eKYC Trend"),a.createElement("span",{className:"badge success"},"Live index")),a.createElement(y,{data:E,dataKey:"completed",name:"Completed"})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Self vs Agency eKYC"),a.createElement("span",{className:"badge info"},"Adoption")),a.createElement(g,{data:N,categories:[{key:"agency",name:"Agency"},{key:"citizen",name:"Citizen"}]})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Pending vs Completed"),a.createElement("span",{className:"badge warning"},"Operational pulse")),a.createElement(b,{data:C,dataKey:"completed",labelKey:"label"}))),a.createElement("section",{className:"zone-section"},a.createElement("div",{className:"section-header"},a.createElement("div",null,a.createElement("h2",null,a.createElement(s.FaMapMarkedAlt,null)," Jurisdiction Performance"),a.createElement("p",null,"Top zones evaluated from the full agency dataset.")),a.createElement("button",{className:"secondary-button"},"Export Zone Data")),a.createElement("div",{className:"table-wrapper glass-card"},a.createElement("table",null,a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Agency"),a.createElement("th",null,"Location"),a.createElement("th",null,"District"),a.createElement("th",null,"Assigned"),a.createElement("th",null,"Agency eKYC"),a.createElement("th",null,"Pending"),a.createElement("th",null,"Progress"))),a.createElement("tbody",null,f.slice(0,10).map((e,t)=>{var n,l,o;return a.createElement("tr",{key:`${e.agency}-${e.location}-${t}`},a.createElement("td",null,e.agency),a.createElement("td",null,e.location),a.createElement("td",null,e.district||e.cluster),a.createElement("td",null,(null===(n=e.activeDemand)||void 0===n?void 0:n.toLocaleString())??"—"),a.createElement("td",null,(null===(l=e.pppZones)||void 0===l?void 0:l.toLocaleString())??"—"),a.createElement("td",null,(null===(o=e.inactiveDemand)||void 0===o?void 0:o.toLocaleString())??"—"),a.createElement("td",null,a.createElement("span",{className:"status-badge success"},Math.min(100,Math.round((e.pppZones||0)/Math.max(e.activeDemand||1,1)*100)),"%")))}))))),a.createElement("section",{className:"bottom-grid"},a.createElement("div",{className:"alerts-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,a.createElement(s.FaExclamationTriangle,null)," Critical Alerts")),a.createElement("div",{className:"alerts-list"},["North East District has 22% more pending accounts than last week","Agency 2 has a 12% improvement opportunity in Self eKYC adoption","Urgent: 18 supervisor escalations raised for NWS Bhera Enclave","Risk alert: Rejection trends are rising in Outer North clusters"].map(e=>a.createElement("div",{key:e,className:"alert-card"},a.createElement(s.FaExclamationTriangle,null),a.createElement("p",null,e))))),a.createElement("div",{className:"efficiency-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,a.createElement(s.FaUserTie,null)," Workforce & Efficiency")),a.createElement("div",{className:"efficiency-grid"},a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,"48"),a.createElement("p",null,"Supervisors Online")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,"168"),a.createElement("p",null,"Surveyors Active")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,null===(e=p.todayEkyc)||void 0===e?void 0:e.toLocaleString()),a.createElement("p",null,"eKYC Completed Today")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,p.successRate,"%"),a.createElement("p",null,"Operational Efficiency")))))))},h=()=>{var e,n;const o=l.useHistory(),{vendorId:r=1}=l.useParams(),i=t.useMemo(()=>v.vendors.find(e=>e.id===Number(r)),[r]),c=Digit.ULBService.getCurrentTenantId();if(Digit.Hooks.ekyc.useEkycSurveyorDashboard({},{tenantId:c,offset:0,limit:10},{enabled:!!c}),!i)return a.createElement("div",{className:"ekyc-dashboard-wrapper"},a.createElement("div",{className:"dashboard-shell"},a.createElement("div",{className:"detail-header"},a.createElement("button",{className:"back-button",onClick:()=>o.goBack()},a.createElement(s.FaArrowLeft,null)," Back")),a.createElement("div",{className:"empty-state"},a.createElement("h2",null,"Vendor analytics not found"),a.createElement("p",null,"The selected vendor does not exist in the current report. Please return to the dashboard."))));const d=i.zones.slice(0,8),m=i.dailyPerformance.map(e=>({day:e.day,completed:e.completed,pending:e.pending,rejected:e.rejected}));return a.createElement("div",{className:"ekyc-dashboard-wrapper"},a.createElement("div",{className:"dashboard-shell detail-shell"},a.createElement("section",{className:"kpi-grid detail-kpi-grid"},[{label:"Assigned Connections",value:i.assignedConnections,icon:a.createElement(s.FaUsers,null),variant:"primary"},{label:"Agency eKYC",value:i.completedEkyc,icon:a.createElement(s.FaCheckCircle,null),variant:"success"},{label:"Self eKYC",value:i.selfEkyc,icon:a.createElement(s.FaUsers,null),variant:"info"},{label:"Pending",value:i.pending,icon:a.createElement(s.FaClock,null),variant:"warning"},{label:"Rejected",value:i.rejected,icon:a.createElement(s.FaExclamationTriangle,null),variant:"danger"},{label:"Success Rate",value:i.successRate+"%",icon:a.createElement(s.FaCheckCircle,null),variant:"success"}].map(e=>{var t,n;return a.createElement("article",{key:e.label,className:"kpi-card card-"+e.variant},a.createElement("div",{className:"kpi-icon"},e.icon),a.createElement("div",null,a.createElement("p",{className:"kpi-title"},e.label),a.createElement("h2",null,(null===(t=e.value)||void 0===t||null===(n=t.toLocaleString)||void 0===n?void 0:n.call(t))??e.value)))})),a.createElement("section",{className:"analytics-grid detail-analytics-grid"},a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Daily Completion Trend"),a.createElement("span",{className:"badge success"},"Performance")),a.createElement(y,{data:m,dataKey:"completed",name:"Completed"})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Pending vs Completed"),a.createElement("span",{className:"badge warning"},"Workload")),a.createElement(g,{data:m,categories:[{key:"completed",name:"Completed"},{key:"pending",name:"Pending"}],xKey:"day"})),a.createElement("div",{className:"analytics-panel glass-card"},a.createElement("div",{className:"section-header"},a.createElement("h2",null,"Self vs Agency Split"),a.createElement("span",{className:"badge info"},"Adoption")),a.createElement(b,{data:[{label:"Agency eKYC",value:i.completedEkyc},{label:"Citizen Self eKYC",value:i.selfEkyc}],dataKey:"value",labelKey:"label"}))),a.createElement("section",{className:"zone-section detail-zone-section"},a.createElement("div",{className:"section-header"},a.createElement("div",null,a.createElement("h2",null,a.createElement(s.FaMapMarkedAlt,null)," Zone-wise Jurisdiction Analytics"),a.createElement("p",null,"Drill into the current operational load and heatmap intensity for this vendor."))),a.createElement("div",{className:"table-wrapper glass-card"},a.createElement("table",null,a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Zone"),a.createElement("th",null,"Cluster"),a.createElement("th",null,"Assigned"),a.createElement("th",null,"Agency eKYC"),a.createElement("th",null,"Pending"),a.createElement("th",null,"Activity Score"))),a.createElement("tbody",null,d.map((e,t)=>{var n,l,o;return a.createElement("tr",{key:`${e.location}-${t}`},a.createElement("td",null,e.location),a.createElement("td",null,e.cluster||e.district),a.createElement("td",null,(null===(n=e.activeDemand)||void 0===n?void 0:n.toLocaleString())??"—"),a.createElement("td",null,(null===(l=e.pppZones)||void 0===l?void 0:l.toLocaleString())??"—"),a.createElement("td",null,(null===(o=e.inactiveDemand)||void 0===o?void 0:o.toLocaleString())??"—"),a.createElement("td",null,a.createElement("span",{className:"status-badge "+(e.intensityScore>65?"danger":e.intensityScore>45?"warning":"success")},e.intensityScore,"%")))}))))),a.createElement("section",{className:"bottom-grid detail-bottom-grid"},a.createElement("div",{className:"cards-summary glass-card"},a.createElement("h2",null,"Operational Efficiency"),a.createElement("div",{className:"efficiency-grid"},a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,i.activeSurveyors),a.createElement("p",null,"Active Surveyors")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,i.supervisors),a.createElement("p",null,"Supervisors")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,i.progress,"%"),a.createElement("p",null,"Execution Rate")),a.createElement("div",{className:"efficiency-box"},a.createElement("h3",null,null===(e=i.dailyPerformance.slice(-1)[0])||void 0===e||null===(n=e.completed)||void 0===n?void 0:n.toLocaleString()),a.createElement("p",null,"Latest Day Completed")))),a.createElement("div",{className:"cards-summary glass-card"},a.createElement("h2",null,"Supervisor Pulse"),a.createElement("div",{className:"pulse-list"},i.jurisdictions.map(e=>a.createElement("div",{key:e,className:"pulse-row"},a.createElement("span",null,e),a.createElement("span",null,Math.max(12,Math.round(38*Math.random()))," active"))))))))},f=e=>{var o,r,i,s,c,d;let{onPageSizeChange:m,formState:u,totalCount:p,table:E,dispatch:v,checkPathName:y,onSortingByData:g,tenantId:N,inboxStyles:b={},tableStyle:C={}}=e;const{t:h}=n.useTranslation(),f=l.useHistory(),[S,k]=t.useState(""),{data:T,getReview:D}=Digit.Hooks.ekyc.useEkycAPI("review",N),A=e=>{k(e),D({kno:e})},_=(null==u||null===(o=u.tableForm)||void 0===o?void 0:o.limit)||10,I=(null==u||null===(r=u.tableForm)||void 0===r?void 0:r.offset)||0,R=(null===(i=Digit.SessionStorage.get("User"))||void 0===i||null===(s=i.info)||void 0===s||null===(c=s.type)||void 0===c?void 0:c.toLowerCase())||"citizen";a.useEffect(()=>{T&&f.push(`/digit-ui/${R}/ekyc/review/${S}`,{aadhaarData:null==T?void 0:T.aadhaarData,reviewData:T})},[T]);const O=[{Header:h("EKYC_APPLICATION_NO"),accessor:"applicationNumber",disableSortBy:!0,Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",onClick:()=>A(o)},o)}},{Header:h("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:n}=e;return a.createElement("span",null,(null===(t=n.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:h("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:n}=e;const l=(null===(t=n.original)||void 0===t?void 0:t.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+l},h(""+l))}},{Header:h("EKYC_EKYC_STATUS"),accessor:"ekycStatus",Cell:e=>{var t,n;let{row:l}=e;const o=((null===(t=l.original)||void 0===t?void 0:t.ekycStatus)||(null===(n=l.original)||void 0===n?void 0:n.ekycstatus)||"NA").toUpperCase();return a.createElement("span",{className:"ekyc-status-tag "+o},h(""+o))}},{Header:h("EKYC_REVIEW"),accessor:"review",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>A(o)},h("EKYC_REVIEW"))}}];return{disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:m,currentPage:I,onNextPage:()=>{var e;return v({action:"mutateTableForm",data:{...u.tableForm,offset:parseInt(null===(e=u.tableForm)||void 0===e?void 0:e.offset)+10},checkPathName:y})},onPrevPage:()=>{var e;return v({action:"mutateTableForm",data:{...u.tableForm,offset:parseInt(null===(e=u.tableForm)||void 0===e?void 0:e.offset)-10},checkPathName:y})},pageSizeLimit:_,onSort:g,totalRecords:p,onSearch:null==u||null===(d=u.searchForm)||void 0===d?void 0:d.message,onLastPage:()=>v({action:"mutateTableForm",data:{...u.tableForm,offset:Math.max(0,Math.ceil(p/_)-10)},checkPathName:y}),onFirstPage:()=>v({action:"mutateTableForm",data:{...u.tableForm,offset:0},checkPathName:y}),data:E,columns:O,inboxStyles:{...b},tableStyle:{...C}}};function S(e,t){try{var a=e()}catch(e){return t(e)}return a&&a.then?a.then(void 0,t):a}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var k=e=>null==e;const T=e=>"object"==typeof e;var D=e=>!k(e)&&!Array.isArray(e)&&T(e)&&!(e instanceof Date),A=e=>e.filter(Boolean),_=e=>void 0===e,I=function(e,t,a){void 0===e&&(e={});const n=A(t.split(/[,[\].]+?/)).reduce((e,t)=>k(e)?e:e[t],e);return _(n)||n===e?_(e[t])?a:e[t]:n},R=e=>"function"==typeof e;const O=t.createContext(null);O.displayName="RHFContext";const M=e=>{const{as:a,render:n}=e,l=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(a[n[l]]=e[n[l]])}return a}(e,["rules","as","render","defaultValue","control","onFocus"]),{field:o,meta:r}=function(e){let{name:a,rules:n,defaultValue:l,control:o,onFocus:r}=e;const i=t.useContext(O);if("production"!==process.env.NODE_ENV&&!o&&!i)throw new Error("📋 Controller is missing `control` prop. https://react-hook-form.com/api#Controller");const{defaultValuesRef:s,setValue:c,register:d,unregister:m,trigger:u,mode:p,reValidateMode:{isReValidateOnBlur:E,isReValidateOnChange:v},formState:y,formStateRef:{current:{isSubmitted:g,touched:N,errors:b}},updateFormState:C,readFormStateRef:h,fieldsRef:f,fieldArrayNamesRef:S,shallowFieldsStateRef:M}=o||i.control,P=!((e,t)=>[...e].some(e=>((e,t)=>RegExp(`^${t}([|.)\\d+`.replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(e))(t,e)))(S.current,a),L=()=>!_(I(M.current,a))&&P?I(M.current,a):_(l)?I(s.current,a):l,[w,K]=t.useState(L()),F=t.useRef(w),Y=t.useRef({focus:()=>null}),x=t.useRef(r||(()=>{R(Y.current.focus)&&Y.current.focus(),"production"!==process.env.NODE_ENV&&(R(Y.current.focus)||console.warn("📋 'ref' from Controller render prop must be attached to a React component or a DOM Element whose ref provides a 'focus()' method"))})),B=t.useCallback(e=>!(e=>{let{isOnBlur:t,isOnChange:a,isOnTouch:n,isTouched:l,isReValidateOnBlur:o,isReValidateOnChange:r,isBlurEvent:i,isSubmitted:s,isOnAll:c}=e;return!c&&(!s&&n?!(l||i):(s?o:t)?!i:!(s?r:a)||i)})(Object.assign({isBlurEvent:e,isReValidateOnBlur:E,isReValidateOnChange:v,isSubmitted:g,isTouched:!!I(N,a)},p)),[E,v,g,N,a,p]),U=t.useCallback(e=>{let[t]=e;const a=(e=>{return k(t=e)||!T(t)||!D(e.target)||D(e.target)&&!e.type?e:_(e.target.value)?e.target.checked:e.target.value;var t})(t);return K(a),F.current=a,a},[]),V=t.useCallback(e=>{if("production"!==process.env.NODE_ENV&&!a)return console.warn("📋 Field is missing `name` prop. https://react-hook-form.com/api#Controller");f.current[a]?f.current[a]=Object.assign({ref:f.current[a].ref},n):(d(Object.defineProperties({name:a,focus:x.current},{value:{set(e){K(e),F.current=e},get:()=>F.current}}),n),e=_(I(s.current,a))),e&&P&&K(L())},[n,a,d]);t.useEffect(()=>()=>m(a),[a]),t.useEffect(()=>{"production"!==process.env.NODE_ENV&&(_(w)&&console.warn(`📋 ${a} is missing in the 'defaultValue' prop of either its Controller (https://react-hook-form.com/api#Controller) or useForm (https://react-hook-form.com/api#useForm)`),!P&&_(l)&&console.warn("📋 Controller is missing `defaultValue` prop when using `useFieldArray`. https://react-hook-form.com/api#Controller")),V()},[V]),t.useEffect(()=>{!f.current[a]&&V(!0)});const H=t.useCallback(()=>{h.current.touched&&!I(N,a)&&(function(e,t,a){let n=-1;const l=(e=>/^\w*$/.test(e))(t)?[t]:A(t.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split(".")),o=l.length,r=o-1;for(;++n<o;){const t=l[n];let a=!0;if(n!==r){const o=e[t];a=D(o)||Array.isArray(o)?o:isNaN(+l[n+1])?{}:[]}e[t]=a,e=e[t]}}(N,a),C({touched:N})),B(!0)&&u(a)},[a,C,B,u,h]);return{field:{onChange:t.useCallback(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c(a,U(t),{shouldValidate:B(),shouldDirty:!0})},[c,a,B]),onBlur:H,name:a,value:w,ref:Y},meta:Object.defineProperties({invalid:!!I(b,a)},{isDirty:{get:()=>!!I(y.dirtyFields,a)},isTouched:{get:()=>!!I(y.touched,a)}})}}(e),i=Object.assign(Object.assign({},l),o);return a?t.isValidElement(a)?t.cloneElement(a,i):t.createElement(a,i):n?n(o,r):null},P=e=>{let{searchFormState:t,controlSearchForm:l,searchType:r}=e;const{t:i}=n.useTranslation(),{errors:s}=t;return a.createElement(a.Fragment,null,"mobile"===r?a.createElement("span",{className:"mobile-input"},a.createElement(o.Label,{className:"flex-roww flex-gap-2"},i("ES_COMMON_MOBILE_NUM")||"Mobile Number",a.createElement(o.CustomTooltip,{message:i("EKYC_MOBILE_NUMBER_MESSAGE")})),a.createElement(M,{name:"mobileNumber",control:l,defaultValue:"",rules:{pattern:{value:/^[6-9]\d{9}$/,message:i("ERR_INVALID_MOBILE_NUMBER")}},render:e=>{let{onChange:t,value:n}=e;return a.createElement(o.TextInput,{value:n||"",onChange:e=>t(e.target.value)})}}),(null==s?void 0:s.mobileNumber)&&a.createElement(o.CardLabelError,null,s.mobileNumber.message)):a.createElement("span",{className:"mobile-input"},a.createElement(o.Label,{className:"flex-roww flex-gap-2"},i("EKYC_K.NUMBER")||"K Number",a.createElement(o.CustomTooltip,{message:i("EKYC_K.NUMBER_MESSAGE")})),a.createElement(M,{name:"kNumber",control:l,defaultValue:"",rules:{pattern:{value:/^[0-9]{10}$/,message:i("ERR_INVALID_KNO")}},render:e=>{let{onChange:t,value:n}=e;return a.createElement(o.TextInput,{value:n||"",onChange:e=>t(e.target.value)})}}),(null==s?void 0:s.kNumber)&&a.createElement(o.CardLabelError,null,s.kNumber.message)))},L=e=>{var n,r,i,s;let{parentRoute:c,businessService:d="EKYC",initialStates:m={}}=e;const u=Digit.ULBService.getCurrentTenantId(),p=l.useLocation(),[v,y]=t.useReducer(function(e,t){const a=t.checkPathName?"EKYC.INBOX":"EKYC.SW.INBOX";switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set(a,{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set(a,{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set(a,{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}},{filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}}),g=t.useMemo(()=>{const e=(null==v?void 0:v.searchForm)||{};return{...e,...e.kNumber&&{kno:e.kNumber}}},[null==v?void 0:v.searchForm]),N=t.useMemo(()=>{var e,t;return{tenantId:u,offset:(null==v||null===(e=v.tableForm)||void 0===e?void 0:e.offset)||0,limit:(null==v||null===(t=v.tableForm)||void 0===t?void 0:t.limit)||10}},[u,null==v||null===(n=v.tableForm)||void 0===n?void 0:n.offset,null==v||null===(r=v.tableForm)||void 0===r?void 0:r.limit]),{isLoading:b,data:C={}}=Digit.Hooks.ekyc.useEkycApplicationList(g,N,{enabled:!!u,keepPreviousData:!0}),h=t.useMemo(()=>{var e,t;return{kno:(null==v||null===(e=v.searchForm)||void 0===e?void 0:e.kNumber)||"",name:(null==v||null===(t=v.searchForm)||void 0===t?void 0:t.kName)||""}},[null==v||null===(i=v.searchForm)||void 0===i?void 0:i.kNumber,null==v||null===(s=v.searchForm)||void 0===s?void 0:s.kName]),S=!(!h.kno&&!h.name),{isLoading:k,data:T}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:h},{enabled:!!u&&!!h.kno,keepPreviousData:!0}),D=t.useMemo(()=>S?T?[T]:[]:(null==C?void 0:C.consumerList)||[],[S,T,C]),A=t.useMemo(()=>(D||[]).map(e=>{var t,a,n,l,o,r,i,s;if(e.connectionDetails)return{applicationNo:(null===(t=e.propertyInfo)||void 0===t?void 0:t.kno)||"",connectionNo:(null===(a=e.propertyInfo)||void 0===a?void 0:a.kno)||"",owner:(null===(n=e.connectionDetails)||void 0===n?void 0:n.consumerName)||"",applicationNumber:(null===(l=e.propertyInfo)||void 0===l?void 0:l.kno)||"",citizenName:(null===(o=e.connectionDetails)||void 0===o?void 0:o.consumerName)||"",status:(null===(r=e.connectionDetails)||void 0===r?void 0:r.statusflag)||"",ekycStatus:((null===(i=e.connectionDetails)||void 0===i?void 0:i.ekycStatus)||(null===(s=e.connectionDetails)||void 0===s?void 0:s.ekycstatus)||e.ekycStatus||e.ekycstatus||"NA").toUpperCase(),sla:0};const c=[e.firstName,e.middleName,e.lastName].filter(Boolean).join(" ");return{...e,applicationNo:e.kno||e.applicationNumber||"",connectionNo:e.kno||"",owner:c||e.consumerName||e.citizenName||"",applicationNumber:e.kno||e.applicationNumber||"",citizenName:c||e.consumerName||e.citizenName||"",status:e.status||"",ekycStatus:(e.ekycStatus||e.ekycstatus||"NA").toUpperCase(),sla:e.sla??0}}),[D]),_=(null==C?void 0:C.totalCount)||0,I=p.pathname.includes("ekyc/inbox"),R=t.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(P,{registerRef:t,searchFormState:n,controlSearchForm:l,searchType:"kno",className:"search"})},[]),O={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},M={kNumber:"",applicationNumber:"",consumerNo:""},L={SearchFormFields:R,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),y({action:"mutateTableForm",data:{...O},checkPathName:I}),y({action:"mutateSearchForm",data:e,checkPathName:I})},searchFormDefaultValues:null==v?void 0:v.searchForm,resetSearchFormDefaultValues:M,onSearchFormReset:e=>{e("kNumber",null),e("applicationNumber",null),e("consumerNo",null),y({action:"mutateSearchForm",data:M})},className:"search-form-wns-inbox"};t.useCallback(e=>a.createElement(a.Fragment,null),[]);const w=f({parentRoute:c,onPageSizeChange:e=>{const t=Number(e.target.value);y({action:"mutateTableForm",data:{...v.tableForm,limit:t,offset:0},checkPathName:I})},formState:v,totalCount:_,table:A,dispatch:y,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,n=a?"DESC":"ASC";v.tableForm.sortBy===t&&v.tableForm.sortOrder===n||y({action:"mutateTableForm",data:{...v.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"},checkPathName:I})}},tenantId:u,checkPathName:I,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(o.InboxComposer,E({isInboxLoading:b||k},L,{propsForInboxTable:w,formState:v,countData:C})))},w=[{name:"Amit Kumar",id:"SVR001",role:"Surveyor"},{name:"Sanjay Singh",id:"SVR002",role:"Surveyor"},{name:"Rahul Sharma",id:"SVR003",role:"Surveyor"},{name:"Priya Verma",id:"SVR004",role:"Surveyor"}],K=[{name:"MRD - 01 (Central Zone)",code:"MRD01",zone:"Central"},{name:"MRD - 02 (North Zone)",code:"MRD02",zone:"North"},{name:"MRD - 03 (South Zone)",code:"MRD03",zone:"South"},{name:"MRD - 04 (West Zone)",code:"MRD04",zone:"West"},{name:"MRD - 05 (East Zone)",code:"MRD05",zone:"East"},{name:"MRD - 06 (Rohini)",code:"MRD06",zone:"Rohini"},{name:"MRD - 07 (Dwarka)",code:"MRD07",zone:"Dwarka"}],F=()=>{const{t:e}=n.useTranslation(),[l,r]=t.useState(null),[i,s]=t.useState(null),[c,d]=t.useState([]),[m,u]=t.useState(null),[p,E]=t.useState(null),[v,y]=t.useState(null),[g,N]=t.useState(null),[b,C]=t.useState(null),h=()=>{u(null),E(null),y(null)},f=t.useMemo(()=>[{Header:e("EKYC_SURVEYOR_NAME")||"Surveyor",accessor:"surveyorName",Cell:t=>{let{row:n}=t;return m===n.original.id?a.createElement(o.Dropdown,{selected:p,select:E,option:w,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_SURVEYOR_PLACEHOLDER")||"Choose surveyor..."}):a.createElement("div",null,a.createElement("span",{className:"link"},n.original.surveyorName),a.createElement("div",{style:{fontSize:"12px",color:"#666"}},n.original.surveyorId))}},{Header:e("EKYC_MRD_ASSIGNED")||"MRD Assigned",accessor:"mrdName",Cell:t=>{let{row:n}=t;return m===n.original.id?a.createElement(o.Dropdown,{selected:v,select:y,option:K,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_MRD_PLACEHOLDER")||"Choose MRD..."}):a.createElement("div",null,a.createElement("span",null,n.original.mrdName),a.createElement("div",{style:{fontSize:"12px",color:"#666"}},n.original.zone))}},{Header:e("ES_COMMON_ACTION")||"Actions",Cell:t=>{let{row:n}=t;return m===n.original.id?a.createElement("div",{style:{display:"flex",gap:"10px"}},a.createElement("span",{style:{cursor:"pointer",color:"#f47738",fontWeight:"bold"},onClick:()=>{return t=n.original.id,void(p&&v?c.some(e=>e.id!==t&&e.surveyorId===p.id&&e.mrdCode===v.code)?C({type:"warning",message:e("EKYC_MAPPING_EXISTS")||"This mapping already exists"}):(d(e=>e.map(e=>e.id!==t?e:{...e,surveyorName:p.name,surveyorId:p.id,mrdName:v.name,mrdCode:v.code,zone:v.zone})),u(null),C({type:"success",message:e("EKYC_MAPPING_UPDATED")||"Mapping updated successfully"})):C({type:"error",message:e("EKYC_SELECT_BOTH_ERROR")||"Please select both Surveyor and MRD to save"}));var t}},e("ES_COMMON_SAVE")),a.createElement("span",{style:{cursor:"pointer",color:"#505A5F",fontWeight:"bold"},onClick:h},e("ES_COMMON_CANCEL"))):a.createElement("div",{style:{display:"flex",gap:"16px"}},a.createElement("span",{onClick:()=>(e=>{u(e.id),E(w.find(t=>t.id===e.surveyorId)||null),y(K.find(t=>t.code===e.mrdCode)||null)})(n.original),style:{cursor:"pointer"}},a.createElement(o.EditIcon,{className:"icon",fill:"#f47738"})),a.createElement("span",{onClick:()=>N(n.original),style:{cursor:"pointer"}},a.createElement(o.DeleteIcon,{className:"icon",fill:"#f47738"})))}}],[m,p,v,c,e]);return a.createElement(a.Fragment,null,a.createElement("div",{className:"side-panel-item"},a.createElement(o.Card,{className:"employeeCard filter inboxLinks",style:{marginTop:"16px"}},a.createElement("div",{className:"complaint-links-container"},a.createElement("div",{className:"header",style:{marginBottom:"0px"}},a.createElement("span",{className:"logo"},a.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a.createElement("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{d:"M6.5 2H20V22H6.5A2.5 2.5 0 0 1 4 19.5V4.5A2.5 2.5 0 0 1 6.5 2Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),a.createElement("span",{className:"text"},e("EKYC_SURVEYOR_MAPPING")||"Surveyor Mapping"))))),a.createElement(o.Card,null,a.createElement(o.CardHeader,null,e("EKYC_NEW_MAPPING")||"New Mapping"),a.createElement(o.CardText,null,e("EKYC_MAPPING_SUBHEADER")||"Assign Meter Reading Dairies to surveyors to manage their data access."),a.createElement(o.LabelFieldPair,null,a.createElement(o.CardLabel,null,e("EKYC_SELECT_SURVEYOR")||"Select Surveyor"," *"),a.createElement("div",{className:""},a.createElement(o.Dropdown,{selected:l,select:r,option:w,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_SURVEYOR_PLACEHOLDER")||"Choose a surveyor..."}))),a.createElement(o.LabelFieldPair,null,a.createElement(o.CardLabel,null,e("EKYC_SELECT_MRD")||"Select MRD"," *"),a.createElement("div",{className:"field"},a.createElement(o.Dropdown,{selected:i,select:s,option:K,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_MRD_PLACEHOLDER")||"Choose an MRD..."}))),a.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"24px"}},a.createElement(o.SubmitBar,{label:e("EKYC_ADD_TO_LIST")||"Add to Mapping List",onSubmit:()=>{l&&i?c.some(e=>e.surveyorId===l.id&&e.mrdCode===i.code)?C({type:"warning",message:e("EKYC_MAPPING_EXISTS")||"This mapping already exists"}):(d(e=>[...e,{id:Date.now(),surveyorName:l.name,surveyorId:l.id,mrdName:i.name,mrdCode:i.code,zone:i.zone}]),s(null),r(null),C({type:"success",message:e("EKYC_MAPPING_ADDED")||"Mapping added successfully"})):C({type:"error",message:e("EKYC_SELECT_BOTH_ERROR")||"Please select both Surveyor and MRD"})},disabled:!l||!i}))),c.length>0&&a.createElement(o.Card,null,a.createElement(o.CardHeader,null,e("EKYC_MAPPING_SUMMARY")||"Mapping Summary"," (",c.length,")"),a.createElement(o.Table,{t:e,data:c,columns:f,getCellProps:e=>({style:{padding:"10px",fontSize:"16px"}}),tableClassName:"table digit-table"})),c.length>0&&a.createElement(o.ActionBar,null,a.createElement(o.SubmitBar,{label:e("EKYC_SAVE_MAPPINGS")||"Save Mappings",onSubmit:()=>{C(0!==c.length?{type:"success",message:e("EKYC_MAPPINGS_SAVED_SUCCESS")||"Surveyor mappings saved successfully!"}:{type:"error",message:e("EKYC_NO_MAPPINGS_TO_SAVE")||"No mappings to save"})}})),g&&a.createElement(o.Modal,{headerBarMain:e("EKYC_REMOVE_MAPPING")||"Remove Mapping",headerBarEnd:a.createElement("span",{onClick:()=>N(null),style:{cursor:"pointer",padding:"8px"}},"X"),actionSaveLabel:e("ES_COMMON_REMOVE"),actionSaveOnSubmit:()=>{d(e=>e.filter(e=>e.id!==g.id)),N(null),C({type:"success",message:e("EKYC_MAPPING_REMOVED")||"Mapping removed"})},actionCancelLabel:e("ES_COMMON_CANCEL"),actionCancelOnSubmit:()=>N(null),style:{borderRadius:"12px"}},a.createElement(o.CardText,{style:{marginTop:"16px",marginBottom:"16px"}},e("EKYC_REMOVE_MAPPING_CONFIRM_MSG")||"Are you sure you want to remove the mapping between ",a.createElement("strong",null,null==g?void 0:g.surveyorName)," and ",a.createElement("strong",null,null==g?void 0:g.mrdName),"?")),b&&a.createElement(o.Toast,{label:b.message,error:"error"===b.type,warning:"warning"===b.type,info:"info"===b.type,isDsc:!0,onClose:()=>C(null)}))},Y=e=>{let{kNumber:r,kName:i,connectionDetails:s,isLoading:c}=e;const{t:d}=n.useTranslation(),m=l.useHistory(),{path:u}=l.useRouteMatch(),[p,E]=t.useState(!1),[v,y]=t.useState({code:"SELF",name:"EKYC_SELF"});if(c)return a.createElement(o.Loader,null);if(!s)return null;const g=(null==s?void 0:s.connectionDetails)||{},N=g.statusflag||"",b="active"===(null==N?void 0:N.toLowerCase())||"A"===N;return a.createElement(a.Fragment,null,a.createElement("div",{className:"ekyc-employee-container"},a.createElement("div",{className:"connection-details-card"},a.createElement("div",{className:"details-card-header"},a.createElement("div",{className:"header-title-wrapper"},a.createElement("div",{className:"header-icon-bg"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),a.createElement("circle",{cx:"12",cy:"7",r:"4"}))),a.createElement("span",{className:"header-title-text"},d("EKYC_K_NUMBER_DETAILS")||"Consumer Identity Details")),a.createElement("span",{className:"status-badge "+(b?"active":"inactive")},b?d("EKYC_ACTIVE_CONNECTION")||"Active Connection":N||d("CS_NA"))),a.createElement("div",{className:"details-card-body"},a.createElement("div",{className:"body-content-row"},a.createElement("div",{className:"detail-section"},a.createElement("div",{className:"section-title"},d("EKYC_VERIFICATION_PARAMETERS")||"Verification Parameters"),a.createElement("div",{className:"data-grid"},a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_CONSUMER_NAME")||"Consumer Name"),a.createElement("div",{className:"data-value"},g.consumerName||i||d("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_K_NUMBER")||"K Number"),a.createElement("div",{className:"data-value blue"},r||d("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_METER_NO")||"Meter Serial No."),a.createElement("div",{className:"data-value"},g.meterNumber||d("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},d("EKYC_CONNECTION_TYPE")||"Connection Type"),a.createElement("div",{className:"data-value"},g.connectionType||d("CS_NA"))))),a.createElement("div",{className:"vertical-divider"}),a.createElement("div",{className:"detail-section"},a.createElement("div",{className:"section-title"},d("EKYC_ADDRESS_AND_CONTACT")||"Address & Contact"),a.createElement("div",{className:"address-block"},a.createElement("div",{className:"icon-wrapper-small"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M21 10c0 7-9 13-9 13S3 17 3 10a9 9 0 0 1 18 0z"}),a.createElement("circle",{cx:"12",cy:"10",r:"3"}))),a.createElement("div",null,a.createElement("div",{className:"data-label"},d("EKYC_ADDRESS")||"Service Address"),a.createElement("div",{className:"address-text"},g.address||d("CS_NA")))),a.createElement("div",{className:"contact-row"},a.createElement("div",{className:"contact-item"},a.createElement("div",{className:"icon-wrapper-small"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2",ry:"2"}),a.createElement("line",{x1:"12",y1:"18",x2:"12.01",y2:"18"}))),a.createElement("div",null,a.createElement("div",{className:"data-label"},d("EKYC_PHONE_NO")||"Contact"),a.createElement("div",{className:"address-text"},g.phoneNumber||d("CS_NA")))),a.createElement("div",{className:"contact-item"},a.createElement("div",{className:"icon-wrapper-small"},a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("circle",{cx:"12",cy:"12",r:"4"}),a.createElement("path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"}))),a.createElement("div",null,a.createElement("div",{className:"data-label"},d("EKYC_EMAIL")||"Email Address"),a.createElement("div",{className:"address-text"},g.email||d("CS_NA")))))))),a.createElement("div",{className:"details-card-footer"},a.createElement("div",{className:"footer-meta-text"},null!=s&&s.lastVerified?`${d("EKYC_LAST_VERIFIED")||"Last verified:"} ${s.lastVerified}`:""),a.createElement("div",{className:"action-btns-container",style:{fontSize:"12px"}},a.createElement("button",{onClick:()=>E(!0),className:"primary-action-btn",style:{fontSize:"12px"}},d("EKYC_START_REVIEW")||"Start Review",a.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),a.createElement("polyline",{points:"12 5 19 12 12 19"}))))))),p&&a.createElement(o.Modal,{headerBarMain:d("EKYC_SELECT_VERIFICATION_TYPE"),headerBarEnd:a.createElement("span",{onClick:()=>E(!1),style:{cursor:"pointer",padding:"8px"}},"X"),actionSaveLabel:d("ES_COMMON_CONFIRM"),actionSaveOnSubmit:()=>{const e=u.includes("/create-kyc")?u.replace("/create-kyc",""):u.replace("/k-details","");m.push(e+"/consumer-details",{kNumber:r,selectedOption:v,connectionDetails:s}),E(!1)},actionCancelLabel:d("ES_COMMON_CANCEL"),actionCancelOnSubmit:()=>E(!1),style:{borderRadius:"12px"}},a.createElement("div",{style:{padding:"24px"}},a.createElement(o.RadioButtons,{name:"verificationType",options:[{code:"SELF",name:"EKYC_SELF"},{code:"OTHER",name:"EKYC_OTHER"}],optionsKey:"name",selectedOption:v,onSelect:y,style:{display:"flex",flexDirection:"column",gap:"12px",buttonStyle:{borderRadius:"5px"}},t:d}))))},x=()=>{const{t:e}=n.useTranslation(),[l,r]=t.useState(()=>{const e=sessionStorage.getItem("EKYC_CREATE_SEARCH_PARAMS");return e?JSON.parse(e):{kNumber:"",kName:""}}),[i,s]=t.useState(()=>"true"===sessionStorage.getItem("EKYC_CREATE_SEARCH_PERFORMED")),[c,d]=t.useState(null),[m,p,E]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{}),v=Digit.ULBService.getCurrentTenantId(),{isLoading:y,data:g}=Digit.Hooks.ekyc.useSearchConnection({tenantId:v,details:{kno:l.kNumber,name:l.kName}},{enabled:i&&!!l.kNumber&&!!l.kName,onError:t=>{var a,n,l,o;d({error:!0,label:(null==t||null===(a=t.response)||void 0===a||null===(n=a.data)||void 0===n||null===(l=n.Errors)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.message)||e("EKYC_SEARCH_ERROR_PLEASE_ENTER_THE_CORRECT_CREDENTIALS")}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED")}});return a.createElement(u,{onSearch:t=>{if(!t.kNumber&&!t.kName)return r({kNumber:"",kName:""}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS"),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED"),void E();t.kNumber&&t.kName?(r(t),s(!0),sessionStorage.getItem("EKYC_K_NUMBER")!==t.kNumber&&(E(),Object.keys(sessionStorage).forEach(e=>{e.startsWith("EKYC_")&&"EKYC_CREATE"!==e&&sessionStorage.removeItem(e)})),sessionStorage.setItem("EKYC_CREATE_SEARCH_PARAMS",JSON.stringify(t)),sessionStorage.setItem("EKYC_CREATE_SEARCH_PERFORMED","true"),sessionStorage.setItem("EKYC_K_NUMBER",t.kNumber)):d({error:!0,label:e("EKYC_FILL_ALL_FIELDS")})},searchParams:l},i&&a.createElement(Y,{kNumber:l.kNumber,kName:l.kName,connectionDetails:g,isLoading:y}),!i&&!y&&a.createElement(o.Card,{style:{textAlign:"center",padding:"40px"}},a.createElement("div",{style:{color:"#667085"}},e("EKYC_SEARCH_TO_VIEW_DETAILS"))),c&&a.createElement(o.Toast,{error:c.error,label:c.label,onClose:()=>{d(null)},isDsc:!0}))},B=e=>{let{jumpTo:t,state:n}=e;const r=l.useHistory();return a.createElement(o.LinkButton,{label:a.createElement(o.EditIcon,{style:{width:"20px",height:"20px",fill:"#F47738"}}),style:{margin:0,padding:0},onClick:function(){r.push(t,{...n,isEditing:!0})}})},U=e=>null!=e&&""!==e?e:"N/A",V=(e,t)=>!0===e||"true"===e||"yes"===String(e).toLowerCase()?t("CORE_COMMON_YES"):!1===e||"false"===e||"no"===String(e).toLowerCase()?t("CORE_COMMON_NO"):"true"===e?t("CORE_COMMON_YES"):"false"===e?t("CORE_COMMON_NO"):void 0,H=e=>{let{title:t,fields:n,newData:l,oldData:r,t:i,jumpTo:s,state:c}=e;return a.createElement("div",{className:"review-section-wrapper",style:{marginBottom:"48px",background:"#fff",borderRadius:"12px",border:"1px solid #EAECF0",overflow:"hidden"}},a.createElement("div",{style:{padding:"20px 24px",background:"#F9FAFB",borderBottom:"1px solid #EAECF0",display:"flex",justifyContent:"space-between",alignItems:"center"}},a.createElement(o.CardSubHeader,{style:{margin:0,fontSize:"18px",color:"#101828",fontWeight:"700"}},t),s&&a.createElement(B,{jumpTo:s,state:c})),a.createElement("div",{style:{padding:"0 24px"}},a.createElement("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed"}},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"30%"}},i("EKYC_FIELD_NAME")),a.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"35%"}},i("EKYC_EXISTING_INFORMATION")),a.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"35%"}},i("EKYC_PROPOSED_UPDATES")))),a.createElement("tbody",null,n.map((e,t)=>{const n=null==l?void 0:l[e.key],o=null==r?void 0:r[e.key],s=r&&String(n)!==String(o)&&null!=o;return a.createElement("tr",{key:t,style:{borderTop:"1px solid #F2F4F7"}},a.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:"#344054",fontWeight:"500"}},i(e.label)),a.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:"#667085"}},e.isBool?V(o,i):U(o)),a.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:s?"#1B8B32":"#101828",fontWeight:s?"700":"400"}},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.isBool?V(n,i):U(n),s&&a.createElement("span",{style:{background:"#ECFDF3",color:"#067647",padding:"2px 8px",borderRadius:"12px",fontSize:"10px",fontWeight:"600"}},i("EKYC_CHANGED")))))})))))},j=()=>{var e,r,i,s,c,d,m,u,p,E,v,y,g,N,b,C,h,f,k,T,D,A,_,I,R,O,M,P,L,w,K,F,Y,x,B,U,V,j,z,W,G;const{t:$}=n.useTranslation(),Z=l.useHistory(),q=l.useLocation();let{kno:X}=l.useParams();const[J,Q]=t.useState(!1),[ee,te]=t.useState(!1),[ae,ne]=t.useState(!1),[le,oe]=t.useState(""),[re,ie]=t.useState(!1),[se,ce]=t.useState(!1),[de,me]=t.useState({error:!1,label:""}),ue=[{action:$("APPROVE")},{action:$("REJECT")}],pe=q.state||{},{edits:Ee={}}=pe,ve=X,{aadhaarData:ye={},addressDetails:ge={},propertyDetails:Ne={},meterDetails:be={}}=Ee,Ce=Digit.ULBService.getCurrentTenantId(),he=Digit.Hooks.ekyc.useEkycWorkflow(Ce),{data:fe,isLoading:Se}=(Digit.Hooks.ekyc.useEkycUpdate(Ce),Digit.Hooks.ekyc.useEkycSearchReview({kno:ve,fetchType:"REVIEW"},Ce,{enabled:!!ve})),{newData:ke,oldData:Te}=((e,t)=>{const a=e&&Object.keys(e).length>0?e:(null==t?void 0:t.reviewData)||{},n=(null==a?void 0:a.applicationReviewInfo)||(null==a?void 0:a.applicationReview)||a,l=(Array.isArray(n)?n[0]:n)||{};return{newData:(null==l?void 0:l.newData)||l,oldData:(null==l?void 0:l.oldData)||null}})(fe,pe),De=e=>{if(!e)return null;const t=(null==e?void 0:e.connectionDetails)||e||{},a=(null==e?void 0:e.addressDetails)||e||{},n=(null==e?void 0:e.propertyInfo)||e||{},l=(null==e?void 0:e.meterDetails)||e||{};return{connection:{consumerName:(null==t?void 0:t.consumerName)||(null!=t&&t.firstName?[t.firstName,t.middleName,t.lastName].filter(Boolean).join(" "):null),address:(null==t?void 0:t.address)||(null==t?void 0:t.addressRaw),connectionType:(null==t?void 0:t.connectionType)||(null==t?void 0:t.connectionCategory),meterNumber:(null==t?void 0:t.meterNumber)||(null==t?void 0:t.meterNo),phoneNumber:(null==t?void 0:t.phoneNumber)||(null==t?void 0:t.mobileNo)||(null==t?void 0:t.mobileNumber),email:null==t?void 0:t.email,statusflag:(null==t?void 0:t.statusflag)||(null==t?void 0:t.statusFlag),ekycStatus:null==t?void 0:t.ekycStatus,knumber:(null==t?void 0:t.knumber)||(null==t?void 0:t.kno)},address:{fullAddress:(null==a?void 0:a.fullAddress)||(null==a?void 0:a.addressRaw),flatHouseNumber:(null==a?void 0:a.flatHouseNumber)||(null==a?void 0:a.flatNo),buildingTower:(null==a?void 0:a.buildingTower)||(null==a?void 0:a.building),landmark:null==a?void 0:a.landmark,pinCode:(null==a?void 0:a.pinCode)||(null==a?void 0:a.pincode),ward:(null==a?void 0:a.ward)||(null==a?void 0:a.locality),assembly:null==a?void 0:a.assembly,gpsValid:null==a?void 0:a.gpsValid,latitude:null==a?void 0:a.latitude,longitude:null==a?void 0:a.longitude,mobileNo:(null==a?void 0:a.mobileNo)||(null==a?void 0:a.mobileNumber),whatsappNo:null==a?void 0:a.whatsappNo,email:null==a?void 0:a.email,noOfPerson:(null==a?void 0:a.noOfPerson)||(null==a?void 0:a.noOfPersons),knumber:(null==a?void 0:a.knumber)||(null==a?void 0:a.kno),doorPhotoFilestoreId:null==a?void 0:a.doorPhotoFilestoreId},property:{kno:null==n?void 0:n.kno,pidNumber:null==n?void 0:n.pidNumber,typeOfConnection:null==n?void 0:n.typeOfConnection,connectionCategory:null==n?void 0:n.connectionCategory,userType:null==n?void 0:n.userType,numberOfFloors:(null==n?void 0:n.numberOfFloors)||(null==n?void 0:n.noOfFloor),tenantName:null==n?void 0:n.tenantName,tenantMobile:null==n?void 0:n.tenantMobile,ekycStatus:null==n?void 0:n.ekycStatus,propertyDocumentFileStoreId:null==n?void 0:n.propertyDocumentFileStoreId,buildingImageFileStoreId:null==n?void 0:n.buildingImageFileStoreId},meter:{kno:null==l?void 0:l.kno,metered:"METERED"===(null==l?void 0:l.meterStatus)||(null==l?void 0:l.metered),meterNumber:(null==l?void 0:l.meterNumber)||(null==l?void 0:l.meterNo),meterMake:null==l?void 0:l.meterMake,meterLocationAddress:null==l?void 0:l.meterLocationAddress,meterLatitude:null==l?void 0:l.meterLatitude,meterLongitude:null==l?void 0:l.meterLongitude,workingStatus:null==l?void 0:l.workingStatus,lastBillRaised:null==l?void 0:l.lastBillRaised,systemMeterId:null==l?void 0:l.systemMeterId,meterPhotoFileStoreId:null==l?void 0:l.meterPhotoFileStoreId}}},Ae=De(ke),_e=De(Te),Ie={...null==Ae?void 0:Ae.connection,consumerName:(null==ye?void 0:ye.name)||(null==Ae||null===(e=Ae.connection)||void 0===e?void 0:e.consumerName),phoneNumber:(null==ye?void 0:ye.mobileNumber)||(null==Ae||null===(r=Ae.connection)||void 0===r?void 0:r.phoneNumber),knumber:(null==Ae||null===(i=Ae.connection)||void 0===i?void 0:i.knumber)||ve},Re={...null==Ae?void 0:Ae.address,fullAddress:(null==ge?void 0:ge.fullAddress)||(null==Ae||null===(s=Ae.address)||void 0===s?void 0:s.fullAddress),flatHouseNumber:(null==ge?void 0:ge.flatHouseNumber)||(null==ge?void 0:ge.flatNo)||(null==Ae||null===(c=Ae.address)||void 0===c?void 0:c.flatHouseNumber),buildingTower:(null==ge?void 0:ge.buildingTower)||(null==ge?void 0:ge.building)||(null==Ae||null===(d=Ae.address)||void 0===d?void 0:d.buildingTower),landmark:(null==ge?void 0:ge.landmark)||(null==Ae||null===(m=Ae.address)||void 0===m?void 0:m.landmark),pinCode:(null==ge?void 0:ge.pinCode)||(null==ge?void 0:ge.pincode)||(null==Ae||null===(u=Ae.address)||void 0===u?void 0:u.pinCode),ward:(null==ge?void 0:ge.ward)||(null==Ae||null===(p=Ae.address)||void 0===p?void 0:p.ward),assembly:(null==ge?void 0:ge.assembly)||(null==Ae||null===(E=Ae.address)||void 0===E?void 0:E.assembly),gpsValid:void 0!==(null==ge?void 0:ge.gpsValid)?ge.gpsValid:null==Ae||null===(v=Ae.address)||void 0===v?void 0:v.gpsValid,latitude:(null==ge?void 0:ge.latitude)||(null==Ae||null===(y=Ae.address)||void 0===y?void 0:y.latitude),longitude:(null==ge?void 0:ge.longitude)||(null==Ae||null===(g=Ae.address)||void 0===g?void 0:g.longitude),mobileNo:(null==ge?void 0:ge.mobileNo)||(null==ye?void 0:ye.mobileNumber)||(null==Ae||null===(N=Ae.address)||void 0===N?void 0:N.mobileNo),whatsappNo:(null==ge?void 0:ge.whatsappNo)||(null==ye?void 0:ye.whatsappNumber)||(null==Ae||null===(b=Ae.address)||void 0===b?void 0:b.whatsappNo),email:(null==ge?void 0:ge.email)||(null==Ae||null===(C=Ae.address)||void 0===C?void 0:C.email),noOfPerson:(null==ge?void 0:ge.noOfPerson)||(null==ye?void 0:ye.noOfPersons)||(null==Ae||null===(h=Ae.address)||void 0===h?void 0:h.noOfPerson),knumber:(null==ge?void 0:ge.knumber)||(null==Ae||null===(f=Ae.address)||void 0===f?void 0:f.knumber)||ve,doorPhotoFilestoreId:(null==ge?void 0:ge.doorPhotoFileStoreId)||(null==Ae||null===(k=Ae.address)||void 0===k?void 0:k.doorPhotoFilestoreId)},Oe={...null==Ae?void 0:Ae.property,kno:(null==Ae||null===(T=Ae.property)||void 0===T?void 0:T.kno)||ve,pidNumber:(null==Ne?void 0:Ne.pidNumber)||(null==Ae||null===(D=Ae.property)||void 0===D?void 0:D.pidNumber),typeOfConnection:(null==Ne||null===(A=Ne.connectionTypeData)||void 0===A?void 0:A.label)||(null==Ae||null===(_=Ae.property)||void 0===_?void 0:_.typeOfConnection),connectionCategory:(null==Ne||null===(I=Ne.connectionCategoryData)||void 0===I?void 0:I.label)||(null==Ae||null===(R=Ae.property)||void 0===R?void 0:R.connectionCategory),userType:(null==Ne||null===(O=Ne.userTypeData)||void 0===O?void 0:O.label)||(null==Ae||null===(M=Ae.property)||void 0===M?void 0:M.userType),numberOfFloors:(null==Ne||null===(P=Ne.noOfFloorsData)||void 0===P?void 0:P.label)||(null==Ae||null===(L=Ae.property)||void 0===L?void 0:L.numberOfFloors),propertyDocumentFileStoreId:(null==Ne?void 0:Ne.propertyDocumentFileStoreId)||(null==Ae||null===(w=Ae.property)||void 0===w?void 0:w.propertyDocumentFileStoreId)},Me={...null==Ae?void 0:Ae.meter,kno:(null==be?void 0:be.kno)||(null==Ae||null===(K=Ae.meter)||void 0===K?void 0:K.kno)||ve,metered:"Metered"===(null==be||null===(F=be.meterStatusData)||void 0===F?void 0:F.value)||(null==Ae||null===(Y=Ae.meter)||void 0===Y?void 0:Y.metered),meterNumber:null==Ae||null===(x=Ae.meter)||void 0===x?void 0:x.meterNumber,meterMake:(null==be?void 0:be.meterMake)||(null==Ae||null===(B=Ae.meter)||void 0===B?void 0:B.meterMake),meterLocationAddress:(null==be?void 0:be.meterLocation)||(null==Ae||null===(U=Ae.meter)||void 0===U?void 0:U.meterLocationAddress),workingStatus:"Working"===(null==be||null===(V=be.workingStatusData)||void 0===V?void 0:V.value)||(null==Ae||null===(j=Ae.meter)||void 0===j?void 0:j.workingStatus),lastBillRaised:"Yes"===(null==be||null===(z=be.lastBillRaisedData)||void 0===z?void 0:z.value)||(null==Ae||null===(W=Ae.meter)||void 0===W?void 0:W.lastBillRaised),meterPhotoFileStoreId:(null==be?void 0:be.meterPhotoFileStoreId)||(null==Ae||null===(G=Ae.meter)||void 0===G?void 0:G.meterPhotoFileStoreId)},Pe=e=>{e&&(oe("https://dev-djberp.nitcon.in/filestore/v1/files/id?tenantId=dl.djb&fileStoreId="+e),ne(!0))};if(Se||ee)return a.createElement(o.Loader,null);const Le="/digit-ui/employee/ekyc";return a.createElement(t.Fragment,null,a.createElement(o.Card,{className:"overflow-y-scroll"},a.createElement(H,{title:$("EKYC_CONNECTION_DETAILS"),fields:[{label:"EKYC_K_NUMBER",key:"knumber"},{label:"EKYC_CONSUMER_NAME",key:"consumerName"},{label:"EKYC_ADDRESS",key:"address"},{label:"EKYC_CONNECTION_TYPE",key:"connectionType"},{label:"EKYC_METER_NO",key:"meterNumber"},{label:"EKYC_MOBILE_NO",key:"phoneNumber"},{label:"EKYC_EMAIL",key:"email"},{label:"EKYC_STATUS_FLAG",key:"statusflag"},{label:"EKYC_STATUS",key:"ekycStatus"}],newData:Ie,oldData:null==_e?void 0:_e.connection,t:$,jumpTo:`${Le}/consumer-details?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement(H,{title:$("EKYC_ADDRESS_DETAILS"),fields:[{label:"EKYC_FULL_ADDRESS",key:"fullAddress"},{label:"EKYC_FLAT_HOUSE_NO",key:"flatHouseNumber"},{label:"EKYC_BUILDING_TOWER",key:"buildingTower"},{label:"EKYC_LANDMARK",key:"landmark"},{label:"EKYC_PINCODE",key:"pinCode"},{label:"EKYC_LOCALITY",key:"ward"},{label:"EKYC_ASSEMBLY",key:"assembly"},{label:"EKYC_GPS_VALID",key:"gpsValid",isBool:!0},{label:"EKYC_LATITUDE",key:"latitude"},{label:"EKYC_LONGITUDE",key:"longitude"},{label:"EKYC_MOBILE_NO",key:"mobileNo"},{label:"EKYC_WHATSAPP_NO",key:"whatsappNo"},{label:"EKYC_EMAIL",key:"email"},{label:"EKYC_NO_OF_PERSONS",key:"noOfPerson"},{label:"EKYC_K_NUMBER",key:"knumber"}],newData:Re,oldData:null==_e?void 0:_e.address,t:$,jumpTo:`${Le}/address-details?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement(H,{title:$("EKYC_PROPERTY_INFO"),fields:[{label:"EKYC_CONNECTION_CATEGORY",key:"connectionCategory"},{label:"EKYC_PID_NUMBER",key:"pidNumber"},{label:"EKYC_TYPE_OF_CONNECTION",key:"typeOfConnection"},{label:"EKYC_USER_TYPE",key:"userType"},{label:"EKYC_FLOOR_COUNT",key:"numberOfFloors"},{label:"EKYC_TENANT_NAME",key:"tenantName"},{label:"EKYC_TENANT_MOBILE",key:"tenantMobile"},{label:"EKYC_STATUS",key:"ekycStatus"}],newData:Oe,oldData:null==_e?void 0:_e.property,t:$,jumpTo:`${Le}/property-info?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement(H,{title:$("EKYC_METER_DETAILS"),fields:[{label:"EKYC_METERED",key:"metered",isBool:!0},{label:"EKYC_METER_NO",key:"meterNumber"},{label:"EKYC_METER_MAKE",key:"meterMake"},{label:"EKYC_METER_LOCATION_ADDRESS",key:"meterLocationAddress"},{label:"EKYC_METER_LATITUDE",key:"meterLatitude"},{label:"EKYC_METER_LONGITUDE",key:"meterLongitude"},{label:"EKYC_WORKING_STATUS",key:"workingStatus",isBool:!0},{label:"EKYC_LAST_BILL_RAISED",key:"lastBillRaised",isBool:!0},{label:"EKYC_SYSTEM_METER_ID",key:"systemMeterId"}],newData:Me,oldData:null==_e?void 0:_e.meter,t:$,jumpTo:`${Le}/meter-details?kno=${X}`,state:{...pe,kNumber:X,kno:X,reviewData:fe,edits:Ee}}),a.createElement("div",{style:{marginTop:"40px"}},a.createElement(o.CardSubHeader,{style:{marginBottom:"20px"}},$("EKYC_DOCUMENTS")),a.createElement(o.StatusTable,{style:{maxWidth:"600px"}},a.createElement(o.Row,{label:$("EKYC_DOOR_PHOTO"),text:$(Re.doorPhotoFilestoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Re.doorPhotoFilestoreId&&a.createElement("div",{onClick:()=>Pe(Re.doorPhotoFilestoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),a.createElement(o.Row,{label:$("EKYC_METER_PHOTO"),text:$(Me.meterPhotoFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Me.meterPhotoFileStoreId&&a.createElement("div",{onClick:()=>Pe(Me.meterPhotoFileStoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),a.createElement(o.Row,{label:$("EKYC_BUILDING_IMAGE"),text:$(Oe.buildingImageFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Oe.buildingImageFileStoreId&&a.createElement("div",{onClick:()=>Pe(Oe.buildingImageFileStoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),a.createElement(o.Row,{label:$("EKYC_PROPERTY_DOCUMENTS"),text:$(Oe.propertyDocumentFileStoreId?"EKYC_DOCS_AVAILABLE":"CS_NA"),actionButton:Oe.propertyDocumentFileStoreId&&a.createElement("div",{onClick:()=>Pe(Oe.propertyDocumentFileStoreId)},a.createElement(o.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}))),a.createElement("div",{style:{marginTop:"40px",paddingTop:"30px",borderTop:"1px solid #EAECF0"}},a.createElement(o.CheckBox,{id:"agreeDeclaration",name:"agreeDeclaration",label:a.createElement("span",{style:{fontSize:"16px",color:"#344054"}},$("EKYC_FINAL_DECLARATION")),onChange:()=>Q(!J),checked:J})),a.createElement(o.ActionBar,null,a.createElement(o.SubmitBar,{label:$("TAKE_ACTION_FOR_APPROVE_REJECT"),onSubmit:()=>ie(e=>!e),disabled:!J}),re&&a.createElement(o.Menu,{options:ue,optionKey:"action",t:$,onSelect:e=>{ie(!1),e.action===$("Approve")?function(){try{var e,t,a;const n={RequestInfo:{apiId:"Rainmaker",ver:"1.0",msgId:"message-id",tenantId:Ce,authToken:null===(e=Digit.UserService.getUser())||void 0===e?void 0:e.access_token},kno:ve,action:"APPROVED",remarks:"All documents verified",reviewedBy:null===(t=Digit.UserService.getUser())||void 0===t||null===(a=t.info)||void 0===a?void 0:a.userName,role:"ZRO"},l=S(function(){return Promise.resolve(he.mutateAsync(n)).then(function(e){e&&(me({error:!1,label:$("EKYC_APPLICATION_APPROVE_SUCCESSFUL")||"Application Approved Successfully"}),ce(!0),setTimeout(()=>{Z.push("/digit-ui/employee/ekyc/inbox")},2e3))})},function(e){var t,a;console.error("Approve Error:",e),me({error:!0,label:(null==e?void 0:e.message)||(null==e||null===(t=e.response)||void 0===t||null===(a=t.data)||void 0===a?void 0:a.message)||"Approve Error"}),ce(!0)});Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}():e.action===$("Reject")&&function(){try{var e,t,a;const n={RequestInfo:{apiId:"Rainmaker",ver:"1.0",msgId:"message-id",tenantId:Ce,authToken:null===(e=Digit.UserService.getUser())||void 0===e?void 0:e.access_token},kno:ve,action:"REJECTED",remarks:"Application rejected by reviewer",reviewedBy:null===(t=Digit.UserService.getUser())||void 0===t||null===(a=t.info)||void 0===a?void 0:a.userName,role:"ZRO"},l=S(function(){return Promise.resolve(he.mutateAsync(n)).then(function(e){e&&Z.push("/digit-ui/employee/ekyc/response",{success:!0,result:e})})},function(e){console.error("Reject Error:",e)});Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},style:{color:"#FFFFFF",fontSize:"18px"}}))),ae&&a.createElement("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.7)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e4}},a.createElement("div",{style:{position:"relative",backgroundColor:"#fff",padding:"30px",borderRadius:"12px",maxWidth:"600px",width:"100%",maxHeight:"70vh",overflow:"auto",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"}},a.createElement("div",{onClick:()=>ne(!1),style:{position:"absolute",top:"10px",right:"10px",cursor:"pointer",fontWeight:"bold",fontSize:"20px",color:"#333",background:"#eee",width:"30px",height:"30px",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%"}},"×"),a.createElement("img",{src:le,alt:"Document Preview",style:{maxWidth:"100%",height:"auto",display:"block"},onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="block"}}),a.createElement("div",{style:{display:"none",padding:"40px",textAlign:"center"}},a.createElement("p",null,$("EKYC_DOCUMENT_PREVIEW_NOT_AVAILABLE")),a.createElement(o.LinkButton,{label:$("EKYC_OPEN_IN_NEW_TAB"),onClick:()=>window.open(le,"_blank")})))),se&&a.createElement(o.Toast,{error:de.error,label:de.label,onClose:()=>ce(!1)}))},z=e=>{let{config:r,onSelect:i,formData:s}=e;const{t:c}=n.useTranslation(),d=l.useLocation(),m=d.state||{},u=Digit.ULBService.getCurrentTenantId(),p=new URLSearchParams(d.search).get("kno")||(null==m?void 0:m.kNumber)||(null==m?void 0:m.kno)||(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||sessionStorage.getItem("EKYC_K_NUMBER")||"",{isLoading:E,data:v}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:{kno:p,fetchType:"CONNECTION"}},{enabled:!!p,cacheTime:0}),y=Digit.Hooks.ekyc.useEkycUpdate(u),g=(null==s?void 0:s.aadhaarVerification)||{},[N,b]=t.useState(g.documentId||null),[C,h]=t.useState(g.documentProof||null),[f,k]=t.useState(null),[T,D]=t.useState(!1),[A,_]=t.useState(!1),[I,R]=t.useState(()=>({kno:g.kno||p||"",consumerType:g.consumerType?{name:g.consumerType}:null,occupantType:g.occupantType?{name:g.occupantType}:null,categoryType:g.categoryType?{name:g.categoryType}:null,firstName:g.firstName||"",middleName:g.middleName||"",lastName:g.lastName||"",gender:g.gender?{name:g.gender}:null,parentSpouseName:g.parentSpouseName||"",mobile:g.mobile||"",whatsapp:g.whatsapp||"",email:g.email||"",residents:g.residents||"",identityType:g.identityType?{name:g.identityType}:null,documentNumber:g.documentNumber||"",informantIsConsumer:g.informantIsConsumer??!0,informantName:g.informantName||"",informantRelation:g.informantRelation||"",documentId:g.documentId||null,documentProof:g.documentProof||null,idFile:g.idFile||null,ownerMobile:g.ownerMobile||"",tenantVerification:g.tenantVerification||"",designation:g.designation||"",department:g.department||"",employeeId:g.employeeId||"",entityName:g.entityName||"",contactPerson:g.contactPerson||"",consent:g.consent||!1})),[O,M]=t.useState(I);if(t.useEffect(()=>{const e=(e=>{if(!e)return null;const t=(null==e?void 0:e.applicationReviewInfo)||(null==e?void 0:e.applicationReview)||e,a=(Array.isArray(t)?t[0]:t)||{};return(null==a?void 0:a.newData)||a})(v)||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.connectionDetails)||e||{},a=(null==e?void 0:e.addressDetails)||{};if(t&&Object.keys(t).length>0&&!T){let e="",n="",l="";if(t.firstName)e=t.firstName,n=t.middleName||"",l=t.lastName||"";else if(t.consumerName){const a=t.consumerName.trim().split(/\s+/);e=a[0]||"",2===a.length&&(l=a[1]),a.length>2&&(n=a.slice(1,-1).join(" "),l=a[a.length-1])}const o={kno:g.kno||p||"",consumerType:g.consumerType?{name:g.consumerType}:t.consumerType?{name:t.consumerType}:null,occupantType:g.occupantType?{name:g.occupantType}:t.occupantType?{name:t.occupantType}:null,categoryType:g.categoryType?{name:g.categoryType}:null,firstName:g.firstName||e,middleName:g.middleName||n,lastName:g.lastName||l,gender:g.gender?{name:g.gender}:t.gender?{name:t.gender}:null,parentSpouseName:g.parentSpouseName||t.parentSpouse||"",mobile:g.mobile||t.phoneNumber||a.mobileNo||"",whatsapp:g.whatsapp||a.whatsappNo||"",email:g.email||t.email||a.email||"",residents:g.residents||(a.noOfPerson?String(a.noOfPerson):""),identityType:g.identityType?{name:g.identityType}:null,documentNumber:g.documentNumber||"",informantIsConsumer:g.informantIsConsumer??!0,informantName:g.informantName||t.informantName||"",informantRelation:g.informantRelation||t.informantRelation||"",documentId:g.documentId||t.documentNumber||null,documentProof:g.documentProof||null,idFile:g.idFile||null,ownerMobile:g.ownerMobile||"",tenantVerification:g.tenantVerification||"",designation:g.designation||"",department:g.department||"",employeeId:g.employeeId||"",entityName:g.entityName||"",contactPerson:g.contactPerson||"",consent:g.consent||!1};R(o),M(o),o.documentId&&b(o.documentId),o.documentProof&&h(o.documentProof),D(!0)}},[v,null==s?void 0:s.connectionDetails,T]),E)return a.createElement(o.Loader,null);const P=function(e,t,n,l,r){var i,s,c,d,m,u,p;void 0===t&&(t={});const E=(null===(i=t)||void 0===i||null===(s=i.consumerType)||void 0===s?void 0:s.name)||(null===(c=t)||void 0===c?void 0:c.consumerType),v=(null===(d=t)||void 0===d||null===(m=d.occupantType)||void 0===m?void 0:m.name)||(null===(u=t)||void 0===u?void 0:u.occupantType),y=(null===(p=t)||void 0===p?void 0:p.informantIsConsumer)??!0,g=[{label:e("Consumer Type"),isMandatory:!0,type:"custom",key:"consumerType",populators:{name:"consumerType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Individual"},{name:"Govt"},{name:"Company_Society_Org"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Occupant Type"),isMandatory:!0,type:"custom",key:"occupantType",populators:{name:"occupantType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Self"},{name:"Tenanted"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Category Type"),isMandatory:!0,type:"custom",key:"categoryType",populators:{name:"categoryType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Bulk"},{name:"Non-Bulk"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("First Name"),isMandatory:!0,type:"text",populators:{name:"firstName",validation:{required:!0}}},{label:e("Middle Name"),isMandatory:!1,type:"text",populators:{name:"middleName"}},{label:e("Last Name"),isMandatory:!1,type:"text",populators:{name:"lastName"}},{label:e("Gender"),isMandatory:!1,type:"custom",key:"gender",populators:{name:"gender",component:e=>a.createElement(o.Dropdown,{option:[{name:"Male"},{name:"Female"},{name:"Others"},{name:"Not prefer to say"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Parent/Spouse Name"),isMandatory:!1,type:"text",populators:{name:"parentSpouseName"}},{label:e("Mobile"),isMandatory:!0,type:"text",populators:{name:"mobile",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("Invalid mobile number")}},{label:e("WhatsApp"),isMandatory:!1,type:"text",populators:{name:"whatsapp"}},{label:e("Email"),isMandatory:!1,type:"text",populators:{name:"email",validation:{pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("Invalid email address")}},{label:e("No. of Residents"),isMandatory:!0,type:"text",populators:{name:"residents",validation:{required:!0,min:1}}},{label:e("Type of Identity"),isMandatory:!0,type:"custom",key:"identityType",populators:{name:"identityType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Aadhaar Card"},{name:"Driving License"},{name:"Passport"},{name:"Voter ID"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Proof of Identity"),isMandatory:!1,type:"custom",key:"idFile",populators:{name:"idFile",component:t=>a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),l(null)},message:e(t.value?"Uploaded":"No file selected")})}},{label:e("Document Number"),isMandatory:!1,type:"text",populators:{name:"documentNumber"}},{label:e("Informant Is Consumer"),isMandatory:!1,type:"custom",key:"informantIsConsumer",populators:{name:"informantIsConsumer",component:t=>a.createElement(o.CheckBox,{label:e("Yes, the informant is the consumer"),checked:t.value??!0,onChange:e=>t.onChange(e.target.checked)})}}];return y||g.push({label:e("Informant Name"),isMandatory:!1,type:"text",populators:{name:"informantName"}},{label:e("Informant Relation"),isMandatory:!1,type:"text",populators:{name:"informantRelation"}}),"Tenanted"===v&&(g.push({label:e("Document Proof"),isMandatory:!1,type:"custom",key:"documentProof",populators:{name:"documentProof",component:t=>a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),l(null)},message:e(t.value?"Uploaded":"No file selected")})}}),r||g.push({label:e("Owner Mobile"),isMandatory:!0,type:"text",populators:{name:"ownerMobile",validation:{required:!0,pattern:/^[6-9]\d{9}$/}}},{label:e("Tenant Verification"),isMandatory:!1,type:"text",populators:{name:"tenantVerification"}})),"Govt"===E&&g.push({label:e("Designation"),isMandatory:!1,type:"text",populators:{name:"designation"}},{label:e("Department"),isMandatory:!1,type:"text",populators:{name:"department"}},{label:e("Employee ID"),isMandatory:!1,type:"text",populators:{name:"employeeId"}}),"Company_Society_Org"===E&&g.push({label:e("Entity Name"),isMandatory:!1,type:"text",populators:{name:"entityName"}},{label:e("Contact Person"),isMandatory:!1,type:"text",populators:{name:"contactPerson"}}),g.push({label:e("Consent"),isMandatory:!0,type:"custom",key:"consent",populators:{name:"consent",validation:{required:!0},component:t=>a.createElement(o.CheckBox,{label:e("I hereby consent to verify my Aadhaar details."),checked:t.value??!1,onChange:e=>t.onChange(e.target.checked)})}}),[{head:e("EKYC_CONSUMER_CONNECTION"),body:g}]}(c,O,function(e,t){try{const a=e.target.files[0];if(!a)return Promise.resolve();if(a.size>2e6)return k({type:"error",message:c("Max size 2MB exceeded")}),Promise.resolve();const n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a,u)).then(function(e){var n,l,o;const r=null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.fileStoreId;r&&(t(a.name),h(a.name),b(r),k({type:"success",message:c("Upload successful")}))})},function(){k({type:"error",message:c("Upload failed")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},b,N);return a.createElement(t.Fragment,null,a.createElement(o.FormComposer,{key:T?"loaded":"loading",isDisabled:!A,label:c("ES_COMMON_CONTINUE"),config:P.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),onSubmit:function(e){try{var t,a,n,l,o;const s={kno:e.kno||p,consumerType:(null===(t=e.consumerType)||void 0===t?void 0:t.name)||e.consumerType,occupantType:(null===(a=e.occupantType)||void 0===a?void 0:a.name)||e.occupantType,categoryType:(null===(n=e.categoryType)||void 0===n?void 0:n.name)||e.categoryType,consumerName:e.consumerName||`${e.firstName||""} ${e.middleName||""} ${e.lastName||""}`.trim(),firstName:e.firstName,middleName:e.middleName,lastName:e.lastName,gender:(null===(l=e.gender)||void 0===l?void 0:l.name)||e.gender,parentSpouseName:e.parentSpouseName,relation:e.relation||g.relation||"",mobile:e.mobile,whatsapp:e.whatsapp,email:e.email,residents:e.residents,documentId:N,documentProof:C,ownerMobile:e.ownerMobile,tenantVerification:e.tenantVerification,designation:e.designation,department:e.department,employeeId:e.employeeId,landline:e.landline||g.landline||"",entityRelation:e.entityRelation||g.entityRelation||"",contactPerson:e.contactPerson,entityName:e.entityName,idProof:(null===(o=e.identityType)||void 0===o?void 0:o.name)||e.identityType,idNumber:e.documentNumber,consent:e.consent,informantIsConsumer:e.informantIsConsumer??!0,informantName:e.informantName,informantRelation:e.informantRelation},d=S(function(){return Promise.resolve(y.mutateAsync({RequestInfo:{},updateType:"CONSUMER",...s})).then(function(){k({type:"success",message:c("Data updated successfully!")}),i(r.key,s)})},function(){k({type:"error",message:c("Failed to update consumer details")})});return Promise.resolve(d&&d.then?d.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:I,onFormValueChange:(e,t)=>{var a,n,l,o;const r=((null==t||null===(a=t.consumerType)||void 0===a?void 0:a.name)||(null==t?void 0:t.consumerType))!==((null==O||null===(n=O.consumerType)||void 0===n?void 0:n.name)||(null==O?void 0:O.consumerType)),i=((null==t||null===(l=t.occupantType)||void 0===l?void 0:l.name)||(null==t?void 0:t.occupantType))!==((null==O||null===(o=O.occupantType)||void 0===o?void 0:o.name)||(null==O?void 0:O.occupantType));(r||i||(null==t?void 0:t.informantIsConsumer)!==(null==O?void 0:O.informantIsConsumer))&&M(e=>({...e,...t}));const s=null==t?void 0:t.occupantType,c=null==t?void 0:t.mobile,d=null==t?void 0:t.residents,m=null==t?void 0:t.consent,u=(null==t?void 0:t.documentId)||N,E=null==t?void 0:t.ownerMobile;let v=!0;(null==t?void 0:t.kno)||p||(v=!1),(null==t?void 0:t.consumerType)||(v=!1),s||(v=!1),(null==t?void 0:t.categoryType)||(v=!1),(null==t?void 0:t.firstName)||(v=!1),c&&/^[6-9]\d{9}$/.test(c)||(v=!1),(!d||Number(d)<=0)&&(v=!1),"Tenanted"!==(null==s?void 0:s.name)||u||E||(v=!1),m||(v=!1),v!==A&&_(v)},noCard:!1,submitInForm:!0}),f&&a.createElement(o.Toast,{error:"error"===f.type,label:f.message,onClose:()=>k(null)}))},W=[{body:[{route:"consumer-details",component:z,key:"aadhaarVerification",texts:{header:"EKYC_CONSUMER_CONNECTION",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:1,actions:"EKYC_CONSUMER_CONNECTION"}]},{route:"address-details",component:"AddressDetails",key:"addressDetails",doorImage:!0,showMapActualLocation:!1,texts:{header:"EKYC_ADDRESS_DETAILS",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:2,actions:"EKYC_ADDRESS_DETAILS"}]},{route:"property-info",component:"PropertyInfo",key:"propertyDetails",texts:{header:"EKYC_PROPERTY_INFO",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:3,actions:"EKYC_PROPERTY_INFO"}]},{route:"meter-details",component:"MeterDetails",key:"meterDetails",texts:{header:"EKYC_METER_DETAILS",submitBarLabel:"COMMON_SAVE_NEXT"},timeLine:[{currentStep:4,actions:"EKYC_METER_DETAILS"}]}]}],G=e=>{let{path:r}=e;const i=l.useRouteMatch(),{t:s}=n.useTranslation(),c=l.useLocation(),{pathname:d}=c,m=l.useHistory();let u=[];const[p,E]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{});function v(e,t,a,n,l,o){void 0===l&&(l=!1),void 0===o&&(o=!1),E(a=>({...a,[e]:{...p[e],...t}})),o||((e,t,a,n)=>{let l=d.split("/").pop(),o=u.find(e=>n?e.key===n:e.route===l);o||(o=u.find(e=>e.route===l));let s=null;const c=u.findIndex(e=>e.route===o.route);c>-1&&c<u.length-1&&(s=u[c+1].route);let E=m.push;e&&(E=m.replace);const v=r||i.path.split("/").slice(0,-1).join("/");if(null===s)return E(v+"/review",{...p,edits:p});E(`${v}/${s}`,{...p})})(a,0,0,e)}t.useEffect(()=>{if(c.state&&Object.keys(c.state).length>0){const{edits:e,...t}=c.state;E({...p,...t,...e})}},[c.state]),W.forEach(e=>{u=u.concat(e.body)}),u.indexRoute="consumer-details";const y=u.map(e=>e.route),g=y.some(e=>d.includes(e)),N=t.useRef({});return t.useEffect(()=>{if(g){const e=d.split("/").pop();N.current[e]&&N.current[e].scrollIntoView({behavior:"smooth",block:"start"})}},[d,g]),a.createElement(a.Fragment,null,a.createElement("div",{className:"employee-form-section-wrapper"},a.createElement(o.VerticalTimeline,{config:u,showFinalStep:!0}),a.createElement("div",{className:"employee-form-section"},a.createElement(l.Switch,null,a.createElement(l.Route,{path:y.map(e=>`${r||i.path.split("/").slice(0,-1).join("/")}/${e}`)},a.createElement("div",{className:"single-page-form-container"},u.map((e,t)=>{const{component:n}=e,l="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return a.createElement("div",{key:t,ref:t=>N.current[e.route]=t,className:"form-section-unit"},a.createElement(l,{config:{...e,isCollapsible:!0,defaultOpen:!0},onSelect:v,t:s,formData:p}))}))),a.createElement(l.Route,null,a.createElement(l.Redirect,{to:`${r||i.path.split("/").slice(0,-1).join("/")}/${u.indexRoute}`}))))))},$=e=>{let{surveyor:l,closeModal:r,refetchDashboard:i}=e;n.useTranslation();const[s,c]=t.useState([]),[d,m]=t.useState(!1),[u,p]=t.useState(0),[E,v]=t.useState(10),[y,g]=t.useState(!1),[N,b]=t.useState({error:!1,label:""}),[C,h]=t.useState({kno:"",pincode:"",zoneCode:"",zoneName:"",ward:"",assembly:"",mrkey:"",ekycStatus:""}),[f,S]=t.useState(C),{data:k,isLoading:T}=Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),D=t.useMemo(()=>(k||[]).map(e=>({code:e.code,name:e.name})),[k]),{data:A}=Digit.Hooks.useCommonMDMS("dl.djb","egov-location",["TenantBoundary"]),_=t.useMemo(()=>{var e;const t=((null==A||null===(e=A["egov-location"])||void 0===e?void 0:e.TenantBoundary)||[]).find(e=>{var t;return"REVENUE"===(null==e||null===(t=e.hierarchyType)||void 0===t?void 0:t.code)}),a=(null==t?void 0:t.boundary)||[];return Array.isArray(a)?a:[a]},[A]),{assemblyOptions:I,wardOptions:R}=t.useMemo(()=>{const e=new Map,t=new Map,a=Array.isArray(_)?_:_?[_]:[],n=a=>{if(a){if("Ward"===a.label||"WARD"===a.label||"Block"===a.label||"BLOCK"===a.label){const e=a.code||a.localname||a.name,n=a.name||a.localname||e;e&&t.set(e,{code:e,name:n})}if("Assembly Constituency"===a.label||"ASSEMBLY_CONSTITUENCY"===a.label){const t=a.code||a.localname||a.name,n=a.name||a.localname||t;t&&e.set(t,{code:t,name:n})}a.children&&a.children.length>0&&a.children.forEach(n)}};return a.forEach(n),{assemblyOptions:Array.from(e.values()).sort((e,t)=>e.name.localeCompare(t.name)),wardOptions:Array.from(t.values()).sort((e,t)=>e.name.localeCompare(t.name))}},[_]),O=t.useMemo(()=>{let e=[];const t=Array.isArray(_)?_:_?[_]:[],a=t=>{t&&("Locality"!==t.label&&"LOCALITY"!==t.label||e.push({...t,name:t.localname||t.name||t.code}),t.children&&t.children.length>0&&t.children.forEach(e=>a(e)))};return t.forEach(e=>a(e)),e},[_]),M=t.useMemo(()=>{const e=new Set;return O.forEach(t=>{t.pincode&&(Array.isArray(t.pincode)?t.pincode:[t.pincode]).forEach(t=>{if(t){const a=t.toString().split(".")[0];e.add(a)}})}),Array.from(e).sort()},[O]);t.useEffect(()=>{const e=setTimeout(()=>{S(C)},500);return()=>clearTimeout(e)},[C]),t.useEffect(()=>{p(0)},[f,C.kno]);const{data:P,isFetching:L}=Digit.Hooks.ekyc.useEkycApplicationList({...C.kno&&{kno:C.kno},...f.ekycStatus&&{ekycStatus:f.ekycStatus},...f.zoneName&&{zoneName:f.zoneName},...f.assembly&&{assembly:f.assembly},...f.ward&&{ward:f.ward},...f.mrkey&&{mrkey:f.mrkey},...f.pincode&&{pincode:f.pincode}},{tenantId:"dl.djb",offset:u*E,limit:E},{keepPreviousData:!0}),w=Digit.Hooks.ekyc.useEkycAssignmentCreate({onSuccess:e=>{var t;if(null!=e&&e.error)return b({error:!0,label:(null==e||null===(t=e.data)||void 0===t?void 0:t.message)||"Something went wrong"}),void g(!0);b({error:!1,label:"Assignment successful"}),g(!0),setTimeout(function(){try{return Promise.resolve(i()).then(function(){r()})}catch(e){return Promise.reject(e)}},1e3)},onError:e=>{var t,a,n;b({error:!0,label:(null==e||null===(t=e.data)||void 0===t?void 0:t.message)||(null==e||null===(a=e.response)||void 0===a||null===(n=a.data)||void 0===n?void 0:n.message)||"Something went wrong"}),g(!0)}}),K=(null==P?void 0:P.consumerList)||[],F=()=>{m(!0);const e=K.map(e=>e.kno),t=e.length>0&&e.every(e=>s.includes(e));c(a=>t?a.filter(t=>!e.includes(t)):[...new Set([...a,...e])])},Y=(e,t)=>{h(a=>({...a,[e]:t}))},x=t.useMemo(()=>[{Header:()=>a.createElement("input",{type:"checkbox",checked:K.length>0&&K.every(e=>s.includes(e.kno)),onChange:F}),id:"selection",Cell:e=>{let{row:t}=e;const n=t.original.kno;return a.createElement("input",{type:"checkbox",checked:s.includes(n),onChange:()=>B(n)})}},{Header:"KNO",accessor:"kno"},{Header:"Consumer Name",accessor:e=>`${e.firstName||""} ${e.middleName||""} ${e.lastName||""}`.trim(),id:"consumerName"},{Header:"Zone",accessor:"zoneName"},{Header:"Pincode",accessor:"pincode"},{Header:"Status",accessor:"status",Cell:e=>{let{value:t}=e;return a.createElement("span",{className:"status-badge "+("ACTIVE"===t?"verified":"PENDING"===t?"pending":"assigned")},t)}},{Header:"eKYC Status",accessor:"ekycStatus",Cell:e=>{let{value:t}=e;return t||"-"}}],[s,K]),B=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return a.createElement(o.Modal,{headerBarMain:"Assign KNOs to "+(null==l?void 0:l.name),headerBarEnd:a.createElement(o.Close,{onClick:r}),actionCancelLabel:"Cancel",actionCancelOnSubmit:r,actionSaveLabel:`Assign ${s.length} KNOs`,actionSaveOnSubmit:()=>{var e;const{assignmentType:t,assignmentValue:a}=(()=>{if(d){const e=[{key:"ekycStatus",type:"EKYCSTATUS"},{key:"zoneName",type:"ZONENAME"},{key:"assembly",type:"ASSEMBLY"},{key:"ward",type:"WARD"},{key:"mrkey",type:"MRKEY"},{key:"pincode",type:"PINCODE"}].find(e=>{let{key:t}=e;return f[t]});if(e)return{assignmentType:e.type,assignmentValue:f[e.key]}}return{assignmentType:"KNO",assignmentValue:s}})();w.mutate({tenantId:"dl.djb",surveyorId:null==l||null===(e=l.owner)||void 0===e?void 0:e.uuid,assignmentType:t,assignmentValue:a})}},a.createElement("div",{className:"assign-knos-modal"},a.createElement("div",{className:"filters-grid"},a.createElement("input",{className:"form-control",placeholder:"KNO",value:C.kno,onChange:e=>Y("kno",e.target.value)}),a.createElement("select",{className:"form-control",value:C.pincode,onChange:e=>Y("pincode",e.target.value)},a.createElement("option",{value:""},"Select Pincode"),M.map(e=>a.createElement("option",{key:e,value:e},e))),a.createElement("select",{className:"form-control",value:C.zoneName,onChange:e=>{const t=e.target.value;h(e=>({...e,zoneCode:t,zoneName:t}))},disabled:T},a.createElement("option",{value:""},T?"Loading ZRO Locations...":"Select ZRO Location"),D.map(e=>a.createElement("option",{key:e.code,value:e.name},e.name)),"http://localhost:3000/digit-ui/employee/ekyc/assign"),a.createElement("select",{className:"form-control",value:C.ward,onChange:e=>Y("ward",e.target.value)},a.createElement("option",{value:""},"Select Ward"),R.map(e=>a.createElement("option",{key:e.code,value:e.name},e.name))),a.createElement("select",{className:"form-control",value:C.assembly,onChange:e=>Y("assembly",e.target.value)},a.createElement("option",{value:""},"Select Assembly"),I.map(e=>a.createElement("option",{key:e.code,value:e.name},e.name))),a.createElement("input",{className:"form-control",placeholder:"MR Key",value:C.mrkey,onChange:e=>Y("mrkey",e.target.value)}),a.createElement("select",{className:"form-control",value:C.ekycStatus,onChange:e=>Y("ekycStatus",e.target.value)},a.createElement("option",{value:""},"All eKYC Status"),a.createElement("option",{value:"PENDING"},"Pending"),a.createElement("option",{value:"APPROVED"},"Approved"),a.createElement("option",{value:"REJECTED"},"Rejected"))),a.createElement(o.Table,{tableTitle:"eKYC Applications",tableClass:"ekycTable",data:K,columns:x,isLoading:L,totalRecords:(null==P?void 0:P.totalCount)||0,currentPage:u,pageSizeLimit:E,manualPagination:!0,isPaginationRequired:!0,onNextPage:()=>{u<((null==P?void 0:P.totalPages)||1)-1&&p(e=>e+1)},onPrevPage:()=>{u>0&&p(e=>e-1)},onFirstPage:()=>{p(0)},onLastPage:()=>{p(Math.max(((null==P?void 0:P.totalPages)||1)-1,0))},onPageSizeChange:e=>{v(Number(e.target.value)),p(0)}})),y&&a.createElement(o.Toast,{error:N.error,label:N.label,onClose:()=>g(!1)}))},Z=function(e){let{rows:t,surveyorName:a,employeeId:n,mobileNumber:l,vendorName:o,supervisorName:r,dashboardInfo:i,t:s}=e;try{const e=Digit.ULBService.getCurrentTenantId(),c=Digit.SessionStorage.get("initData"),d=(((null==c?void 0:c.tenants)||[]).find(t=>t.code===e),"Delhi Jal Board"),m="contact@delhijalboard.nic.in",u="+91-11-23538416",p=new Date,E=`${p.toLocaleDateString("en-IN",{day:"2-digit",month:"2-digit",year:"numeric"})} ${p.toLocaleTimeString("en-IN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}`,v=[{title:s("SURVEYOR_DETAILS"),asSectionHeader:!0,values:[{title:s("SURVEYOR_NAME"),value:a},{title:s("MOBILE_NUMBER"),value:l},{title:s("VENDOR_NAME"),value:o},{title:s("SUPERVISOR_NAME"),value:r}].filter(e=>e.value)},{title:s("SUMMARY_STATISTICS"),asSectionHeader:!0,values:[{title:s("TOTAL_ASSIGNED"),value:(null==i?void 0:i.total)||0},{title:s("COMPLETED"),value:(null==i?void 0:i.completed)||0},{title:s("PENDING"),value:(null==i?void 0:i.pending)||0},{title:s("SUBMITTED"),value:(null==i?void 0:i.submittedCount)||0}].filter(e=>e.value)}];return window.Digit&&window.Digit.Utils&&window.Digit.Utils.pdf&&window.Digit.Utils.pdf.generateSurveyorReport?window.Digit.Utils.pdf.generateSurveyorReport({tenantId:e,logo:null,name:d,email:m,phoneNumber:u,heading:s("EKYC_SURVEYOR_REPORT"),details:v,applicationNumber:n,rows:t,t:s,hideApplicationNumber:!0,downloadTime:E}):console.error("Digit.Utils.pdf.generateSurveyorReport is not available"),Promise.resolve()}catch(e){return Promise.reject(e)}},q=()=>{var e,r,i,s,c,d,m,u,p,E,v,y,g,N,b,C,h,f,S;const k=Digit.ULBService.getCurrentTenantId(),[T,D]=t.useState(!1),[A,_]=t.useState(!1),{id:I}=l.useParams(),R=null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(r=e.info)||void 0===r?void 0:r.uuid,{t:O}=n.useTranslation(),M=I?{ids:I}:{ownerIds:R},{data:P,isLoading:L}=Digit.Hooks.fsm.useSurveyorSearch(k,M,{staleTime:Infinity}),w=null===(i=Digit.SessionStorage.get("User"))||void 0===i||null===(s=i.info)||void 0===s?void 0:s.roles.map(e=>e.code),K=t.useMemo(()=>{var e;return(null==P||null===(e=P.surveyors)||void 0===e?void 0:e[0])||null},[P]),{data:F}=Digit.Hooks.fsm.useDsoSearch(k,{status:"ACTIVE"},{enabled:!!k}),{data:Y}=Digit.Hooks.fsm.useSupervisorSearch(k,{status:"ACTIVE"},{enabled:!!k}),x=t.useMemo(()=>{var e;if(!F||null==K||!K.vendorId)return"N/A";const t=F.find(e=>{var t,a;return(null===(t=e.dsoDetails)||void 0===t?void 0:t.id)===K.vendorId||(null===(a=e.dsoDetails)||void 0===a?void 0:a.vendorId)===K.vendorId});return(null==t||null===(e=t.dsoDetails)||void 0===e?void 0:e.name)||K.vendorId||"N/A"},[F,null==K?void 0:K.vendorId]),B=t.useMemo(()=>{var e;if(null==Y||!Y.supervisors||null==K||!K.supervisorId)return"N/A";const t=Y.supervisors.find(e=>{var t;return e.id===K.supervisorId||(null===(t=e.owner)||void 0===t?void 0:t.uuid)===K.supervisorId});return(null==t?void 0:t.name)||(null==t||null===(e=t.owner)||void 0===e?void 0:e.name)||K.supervisorId||"N/A"},[Y,null==K?void 0:K.supervisorId]),U=(null==K||null===(c=K.owner)||void 0===c?void 0:c.name)||(null==K?void 0:K.name)||"N/A",V=(null==K?void 0:K.employeeId)||(null==K||null===(d=K.owner)||void 0===d?void 0:d.uuid)||(null==K?void 0:K.id),H=(null==K||null===(m=K.owner)||void 0===m?void 0:m.mobileNumber)||(null==K?void 0:K.mobileNo)||"N/A",[j,z]=t.useState(0),[W,G]=t.useState(20),q={tenantId:"dl.djb",offset:j*W,limit:W,surveyorId:null==K||null===(u=K.owner)||void 0===u?void 0:u.uuid},{isFetching:X,data:J={},refetch:Q}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},q,{enabled:!!q.tenantId&&!!q.surveyorId,keepPreviousData:!0}),ee=t.useMemo(()=>[{Header:"KNO",accessor:"kno"},{Header:"Consumer Name",accessor:e=>`${e.firstName||""} ${e.middleName||""} ${e.lastName||""}`.trim(),id:"consumerName"},{Header:"Zone",accessor:"zoneName"},{Header:"Pincode",accessor:"pincode"},{Header:"Status",accessor:"status",Cell:e=>{let{value:t}=e;return a.createElement("span",{className:"status-badge "+("ACTIVE"===t?"verified":"PENDING"===t?"pending":"assigned")},t)}},{Header:"eKYC Status",accessor:"ekycStatus",Cell:e=>{let{value:t}=e;return t||"-"}}],[]),[te,ae]=t.useState(!1),[ne,le]=t.useState({from:"",to:""}),[oe,re]=t.useState(!1),ie=t.useRef(null);if(t.useEffect(()=>{const e=e=>{ie.current&&!ie.current.contains(e.target)&&(ae(!1),re(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),L)return a.createElement(o.Loader,null);if(!K)return a.createElement(o.Card,null,a.createElement("div",{style:{padding:"24px"}},O("NO_SURVEYOR_FOUND")));const se=e=>{let{title:t,value:n,type:l,isLoading:o}=e;return a.createElement("div",{className:"stat-card "+l},o?a.createElement(a.Fragment,null,a.createElement("div",{className:"stat-title skeleton skeleton-text"}),a.createElement("div",{className:"stat-value skeleton skeleton-number"})):a.createElement(a.Fragment,null,a.createElement("div",{className:"stat-title"},t),a.createElement("div",{className:"stat-value"},n)))};return a.createElement(o.Card,{className:"surveyor-dashboard"},a.createElement("div",{className:"ekyc-dashboard-section"},a.createElement("div",{className:"ekyc-dashboard-header"},a.createElement("div",{className:"avatar"},null==U||null===(p=U.charAt(0))||void 0===p?void 0:p.toUpperCase()),a.createElement("div",{className:"header-content"},a.createElement("h2",{className:"name"},U),a.createElement("div",{className:"designation"},(null==K?void 0:K.description)||O("FIELD_SURVEYOR")))),a.createElement("div",{className:"report-download",ref:ie},a.createElement("button",{className:"download-btn",onClick:()=>{ae(e=>!e),re(!1)}},O("DOWNLOAD_REPORT")||"Download Report"),te&&a.createElement("div",{className:"report-menu"},[{label:O("TODAY")||"Today",key:"today"},{label:O("THIS_WEEK")||"This Week",key:"week"},{label:O("THIS_MONTH")||"This Month",key:"month"}].map(e=>{let{label:t,key:n}=e;return a.createElement("div",{key:n,className:"menu-item",onClick:()=>(e=>{var t;const a=(null==J||null===(t=J.dashboardInfo)||void 0===t?void 0:t.consumerList)||[],n=(e=>{const t=new Date,a=new Date(t);return"today"===e?(a.setHours(0,0,0,0),{from:a,to:t}):"week"===e?(a.setDate(t.getDate()-t.getDay()),a.setHours(0,0,0,0),{from:a,to:t}):"month"===e?(a.setDate(1),a.setHours(0,0,0,0),{from:a,to:t}):null})(e);if(!n)return;const l=a.filter(e=>{const t=e.submittedAt||e.createdTime||e.lastModifiedTime||0;return t>=n.from.getTime()&&t<=n.to.getTime()});Z({rows:l.length?l:a,surveyorName:U,vendorName:x,supervisorName:B,employeeId:V,mobileNumber:H,dashboardInfo:null==J?void 0:J.dashboardInfo,t:O}),ae(!1),re(!1)})(n)},t)}),a.createElement("div",{className:"custom-date-trigger",onClick:()=>re(e=>!e)},O("CUSTOM_DATE")||"Custom Date"),oe&&a.createElement("div",{className:"custom-picker"},a.createElement("div",{className:"date-field"},a.createElement("label",{className:"date-label"},O("FROM_DATE")||"From"),a.createElement("input",{type:"date",className:"date-input",value:ne.from,onChange:e=>le(t=>({...t,from:e.target.value}))})),a.createElement("div",{className:"date-field"},a.createElement("label",{className:"date-label"},O("TO_DATE")||"To"),a.createElement("input",{type:"date",className:"date-input",value:ne.to,onChange:e=>le(t=>({...t,to:e.target.value}))})),a.createElement("button",{className:"download-action-btn",onClick:()=>{var e;if(!ne.from||!ne.to)return void alert(O("SELECT_DATE_RANGE")||"Please select both From and To dates.");const t=new Date(ne.from),a=new Date(ne.to);a.setHours(23,59,59,999);const n=(null==J||null===(e=J.dashboardInfo)||void 0===e?void 0:e.consumerList)||[],l=n.filter(e=>{const n=e.createdTime||e.lastModifiedTime||0;return n>=t.getTime()&&n<=a.getTime()});Z({rows:l.length?l:n,surveyorName:U,vendorName:x,supervisorName:B,employeeId:V,mobileNumber:H,dashboardInfo:null==J?void 0:J.dashboardInfo,t:O}),ae(!1),re(!1)}},O("DOWNLOAD")||"Download"))))),a.createElement("div",{className:"stats-wrapper"},a.createElement(se,{title:O("TOTAL_ASSIGNED"),value:(null==J||null===(E=J.dashboardInfo)||void 0===E?void 0:E.total)||0,type:"today",isLoading:X}),a.createElement(se,{title:O("COMPLETED"),value:(null==J||null===(v=J.dashboardInfo)||void 0===v?void 0:v.completed)||0,type:"week",isLoading:X}),a.createElement(se,{title:O("PENDING"),value:(null==J||null===(y=J.dashboardInfo)||void 0===y?void 0:y.pending)||0,type:"pending",isLoading:X}),a.createElement(se,{title:O("SUBMITTED"),value:(null==J||null===(g=J.dashboardInfo)||void 0===g?void 0:g.submittedCount)||0,type:"month",isLoading:X})),a.createElement("div",{className:"charts-wrapper"}),a.createElement("div",{className:"ekyc-dashboard-section"},a.createElement("div",{className:"details-grid"},a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},O("MOBILE"),":"),a.createElement("span",{className:"value"},(null==K||null===(N=K.owner)||void 0===N?void 0:N.mobileNumber)||(null==K?void 0:K.mobileNo)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},O("EMAIL"),":"),a.createElement("span",{className:"value"},(null==K||null===(b=K.owner)||void 0===b?void 0:b.emailId)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},O("GENDER"),":"),a.createElement("span",{className:"value"},(null==K||null===(C=K.owner)||void 0===C?void 0:C.gender)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},O("STATUS"),":"),a.createElement("span",{className:"value"},(null==K?void 0:K.status)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},O("SERVICE_TYPE"),":"),a.createElement("span",{className:"value"},(null==K||null===(h=K.additionalDetails)||void 0===h?void 0:h.serviceType)||"N/A")),a.createElement("div",{className:"detail-item"},a.createElement("span",{className:"label"},O("VENDOR_NAME")||"Vendor Name",":"),a.createElement("span",{className:"value"},x)))),a.createElement(o.Card,{className:"dashboard-card"},a.createElement(o.Table,{t:O,tableTitle:O("ASSIGNED_KNOS"),tableClass:"ekycTable",data:(null==J||null===(f=J.dashboardInfo)||void 0===f?void 0:f.consumerList)||[],columns:ee,isLoading:X,totalRecords:null==J||null===(S=J.dashboardInfo)||void 0===S?void 0:S.total,currentPage:j,pageSizeLimit:W,isPaginationRequired:!0,onNextPage:()=>{var e;j<((null==J||null===(e=J.dashboardInfo)||void 0===e?void 0:e.totalPages)||1)-1&&z(e=>e+1)},onPrevPage:()=>{j>0&&z(e=>e-1)},onFirstPage:()=>{z(0)},onLastPage:()=>{var e;z(Math.max(((null==J||null===(e=J.dashboardInfo)||void 0===e?void 0:e.totalPages)||1)-1,0))},onPageSizeChange:e=>{G(Number(e.target.value)),z(0)}})),(!w.includes("EKYC_SURVEYOR")||w.includes("EMPLOYEE"))&&a.createElement(o.ActionBar,null,a.createElement(o.SubmitBar,{label:O("EKYC_ASSIGN_KNOS"),onSubmit:()=>_(e=>!e)}),A&&a.createElement(o.Menu,{options:[{action:"Assign"}],optionKey:"action",t:O,onSelect:e=>{_(!1),D(!0)},style:{color:"#FFFFFF",fontSize:"18px"}})),T&&a.createElement($,{surveyor:K,closeModal:function(){try{return D(!1),Promise.resolve()}catch(e){return Promise.reject(e)}},refetchDashboard:Q}))};function X(e,t){switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set("EKYC.SW.INBOX",{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set("EKYC.SW.INBOX",{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set("EKYC.SW.INBOX",{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}}const J={filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}},Q=(e,t)=>[{Header:e("SURVEYOR_NAME"),accessor:"surveyorName",Cell:e=>{var n,l,o;let{row:r}=e;const i=null===(n=r.original)||void 0===n?void 0:n.id;return a.createElement("span",{className:"ekyc-application-link",style:{color:"#318ED0",cursor:"pointer",fontSize:"16px"},onClick:()=>t(i)},(null===(l=r.original)||void 0===l?void 0:l.surveyorName)||(null===(o=r.original)||void 0===o?void 0:o.name)||"NA")}},{Header:e("MOBILE_NUMBER"),accessor:"mobileNo",Cell:e=>{var t,n,l;let{row:o}=e;return a.createElement("span",null,(null===(t=o.original)||void 0===t?void 0:t.mobileNo)||(null===(n=o.original)||void 0===n||null===(l=n.owner)||void 0===l?void 0:l.mobileNumber)||"NA")}},{Header:e("STATUS"),accessor:"status",Cell:t=>{var n;let{row:l}=t;const o=(null===(n=l.original)||void 0===n?void 0:n.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+o},e(o))}},{Header:e("SERVICE_TYPE"),accessor:"serviceType",Cell:e=>{var t;let{row:n}=e;return a.createElement("span",null,(null===(t=n.original)||void 0===t?void 0:t.serviceType)||"NA")}}],ee=()=>{var e,r,i,s,c,d;let m=Digit.ULBService.getCurrentTenantId();m&&"dl"!==m||(m="dl.djb");const[u,p]=t.useReducer(X,J);let v={limit:(null==u||null===(e=u.tableForm)||void 0===e?void 0:e.limit)||10,offset:(null==u||null===(r=u.tableForm)||void 0===r?void 0:r.offset)||0,sortBy:(null==u||null===(i=u.tableForm)||void 0===i?void 0:i.sortBy)||"createdTime",sortOrder:(null==u||null===(s=u.tableForm)||void 0===s?void 0:s.sortOrder)||"DESC"};const y=(null==u||null===(c=u.searchForm)||void 0===c?void 0:c.mobileNumber)||"",g={...v,status:"ACTIVE,DISABLED"};y&&(g.mobileNumber=y);const{data:N,isLoading:b}=Digit.Hooks.fsm.useSurveyorSearch(m,g,{enabled:!!m,keepPreviousData:!0}),{isLoading:C,data:h}=Digit.Hooks.ekyc.useEkycAssignmentProgress({enabled:!!m,keepPreviousData:!0}),f=t.useMemo(()=>(null==N?void 0:N.surveyors)||[],[N]),S=t.useMemo(()=>(f||[]).map(e=>{var t,a,n,l,o;const r=(null==e?void 0:e.owner)||{},i=(null==r||null===(t=r.roles)||void 0===t||null===(a=t.map(e=>e.code))||void 0===a?void 0:a.join(", "))||"";return{...e,id:(null==e?void 0:e.id)||"",surveyorName:(null==e?void 0:e.name)||(null==r?void 0:r.name)||"",mobileNo:(null==e?void 0:e.mobileNo)||(null==r?void 0:r.mobileNumber)||"",email:(null==r?void 0:r.emailId)||"",vendorId:(null==e?void 0:e.vendorId)||"",tenantId:(null==e?void 0:e.tenantId)||"",supervisorId:(null==e?void 0:e.supervisorId)||"",status:(null==e?void 0:e.status)||"",roleCodes:i,userName:(null==r?void 0:r.userName)||"",gender:(null==r?void 0:r.gender)||"",serviceType:(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.serviceType)||"",createdTime:(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime)||0,lastModifiedTime:(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.lastModifiedTime)||0}}),[f]),k=(null==N||null===(d=N.dashboardInfo)||void 0===d?void 0:d.totalRecords)||(null==N?void 0:N.totalCount)||0,T=t.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(P,{registerRef:t,searchFormState:n,controlSearchForm:l,searchType:"mobile",className:"search"})},[]),D={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},A={mobileNumber:"",applicationNumber:"",consumerNo:""},_={SearchFormFields:T,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),p({action:"mutateTableForm",data:{...D}}),p({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==u?void 0:u.searchForm,resetSearchFormDefaultValues:A,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),p({action:"mutateSearchForm",data:A})},className:"search-form-wns-inbox"},I=(e=>{var t,a,o,r,i;let{onPageSizeChange:s,formState:c,totalCount:d,table:m,dispatch:u,onSortingByData:p,inboxStyles:E={},tableStyle:v={}}=e;const{t:y}=n.useTranslation(),g=l.useHistory(),N=(null===(t=Digit.SessionStorage.get("User"))||void 0===t||null===(a=t.info)||void 0===a||null===(o=a.type)||void 0===o?void 0:o.toLowerCase())||"citizen",b=(null==c||null===(r=c.tableForm)||void 0===r?void 0:r.limit)||10,C=(null==c||null===(i=c.tableForm)||void 0===i?void 0:i.offset)||0;return{disableSort:!1,autoSort:!1,manualPagination:!0,currentPage:Math.floor(C/b),onPageSizeChange:s,onNextPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:Number(C)+Number(b)}}),onPrevPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:Number(C)-Number(b)}}),onLastPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:Math.ceil(d/b)*b-Number(b)}}),onFirstPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:0}}),totalRecords:d,onSort:p,data:m,columns:Q(y,e=>{g.push(`/digit-ui/${N}/ekyc/assign/surveyor-details/${e}`)}),inboxStyles:{...E},tableStyle:{...v}}})({onPageSizeChange:e=>{const t=Number(e.target.value);p({action:"mutateTableForm",data:{...u.tableForm,limit:t,offset:0}})},formState:u,totalCount:k,table:S,dispatch:p,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,n=a?"DESC":"ASC";u.tableForm.sortBy===t&&u.tableForm.sortOrder===n||p({action:"mutateTableForm",data:{...u.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"}})}},tenantId:m,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(o.InboxComposer,E({isInboxLoading:b},_,{propsForInboxTable:I,formState:u,countData:null==N?void 0:N.dashboardInfo,cards:[{label:"TOTAL_EKYC_APPLICATIONS",count:(null==h?void 0:h.totalKnos)||0,color:"#0B2559",filter:null,active:!0},{label:"TOTAL_ASSIGNMENTS",count:(null==h?void 0:h.totalAssignments)||0,color:"#3B82F6",filter:["ASSIGNED"]},{label:"EKYC_COMPLETED",count:(null==h?void 0:h.completedKnos)||0,color:"#10B981",filter:["COMPLETED"]},{label:"PENDING_APPLICATIONS",count:((null==h?void 0:h.totalKnos)||0)-((null==h?void 0:h.completedKnos)||0),color:"#F59E0B",filter:["PENDING"]},{label:"OVERALL_PROGRESS",count:((null==h?void 0:h.overallProgressPercent)||0)+"%",color:"#A855F7",filter:["IN_PROGRESS"]}],isCardLoading:C})))},te=e=>{let{path:t}=e;const{t:r}=n.useTranslation(),i=l.useLocation();return sessionStorage.removeItem("revalidateddone"),a.createElement(o.AppContainer,null,a.createElement("div",{className:"ground-container employee-app-container form-container"},a.createElement(o.ModuleHeader,{leftContent:a.createElement(a.Fragment,null,a.createElement(o.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=i.pathname,t=[{icon:o.HomeIcon,path:"/digit-ui/employee"},{label:r("ACTION_TEST_EKYC"),path:"/digit-ui/employee/module/details"}];return e.includes("/create-kyc")?t.push({label:r("EKYC_CREATE_KYC")}):e.includes("/consumer-details")?t.push({label:r("EKYC_CONSUMER_DETAILS")}):e.includes("/address-details")?t.push({label:r("EKYC_ADDRESS_DETAILS")}):e.includes("/property-info")?t.push({label:r("EKYC_PROPERTY_INFO")}):e.includes("/meter-details")?t.push({label:r("EKYC_METER_DETAILS")}):e.includes("/review")?(t.push({label:r("EKYC_INBOX"),path:"/digit-ui/employee/ekyc/inbox"}),t.push({label:r("EKYC_REVIEW")})):e.includes("/assign/surveyor-details")?(t.push({label:r("EKYC_ASSIGN"),path:"/digit-ui/employee/ekyc/assign"}),t.push({label:r("EKYC_SURVEYOR_DETAILS")})):e.includes("/assign")?t.push({label:r("EKYC_ASSIGN")}):e.includes("/ceo-dashboard")?t.push({label:r("CEO_M.F_DOR_FINANCE_VIEW")}):e.includes("/vendors/")?t.push({label:r("EKYC_VENDOR_DETAILS")}):e.includes("/mapping")?t.push({label:r("EKYC_MAPPING")}):e.includes("/dashboard")?t.push({label:r("EKYC_DASHBOARD")}):e.includes("/inbox")&&t.push({label:r("EKYC_INBOX")}),t})()}),a.createElement("div",{className:"employee-form"},a.createElement(l.Switch,null,a.createElement(o.PrivateRoute,{path:t+"/dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(m,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0}))}),a.createElement(o.PrivateRoute,{path:t+"/inbox",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(L,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0}))}),a.createElement(o.PrivateRoute,{path:t+"/create-kyc",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(x,null))}),a.createElement(o.PrivateRoute,{path:t+"/mapping",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(F,null))}),a.createElement(o.PrivateRoute,{path:t+"/assign",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ee,null))}),a.createElement(o.PrivateRoute,{path:t+"/assign/surveyor-details/:id",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"action"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:["consumer-details","address-details","property-info","meter-details"].map(e=>`${t}/${e}`),component:e=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(G,E({},e,{path:t})))}),a.createElement(o.PrivateRoute,{path:t+"/review/:kno",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"action"},a.createElement(j,null))}),a.createElement(o.PrivateRoute,{path:t+"/ceo-dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(C,null))}),a.createElement(o.PrivateRoute,{path:t+"/vendors/:vendorId",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(h,null))})))))},ae=e=>{let{config:r,onSelect:i,formData:s}=e;const{t:c}=n.useTranslation(),d=l.useLocation(),m=d.state||{},u=Digit.ULBService.getCurrentTenantId(),p=new URLSearchParams(d.search).get("kno")||(null==m?void 0:m.kNumber)||(null==m?void 0:m.kno)||(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||sessionStorage.getItem("EKYC_K_NUMBER"),{isLoading:E,data:v}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:{kno:p,fetchType:"PROPERTY"}},{enabled:!!p,cacheTime:0}),y=Digit.Hooks.ekyc.useEkycUpdate(u),g=(null==s?void 0:s.propertyDetails)||{},[N,b]=t.useState(null),[C,h]=t.useState(g.buildingImageId||null),[f,k]=t.useState(null),[T,D]=t.useState(!1),[A,_]=t.useState(!1),[I,R]=t.useState(()=>({pidNumber:g.pidNumber||"",propertyType:g.propertyType?{name:g.propertyType}:null,subPropertyCategory:g.subPropertyCategory?{name:g.subPropertyCategory}:null,noOfFloors:g.noOfFloors||"",floorNo:g.floorNo||"",noOfRooms:g.noOfRooms||"",noOfBeds:g.noOfBeds||"",dwellingUnits:g.dwellingUnits||"",buildingImage:g.buildingImageId?"Uploaded":null})),[O,M]=t.useState(I);if(t.useEffect(()=>{const e=(e=>{if(!e)return null;const t=(null==e?void 0:e.applicationReviewInfo)||(null==e?void 0:e.applicationReview)||e,a=(Array.isArray(t)?t[0]:t)||{};return(null==a?void 0:a.newData)||a})(v)||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.propertyInfo)||(null==e?void 0:e.propertyDetails)||e||{};if(t&&Object.keys(t).length>0&&!T){let e=null,a=null;t.subPropertyCategory&&(e=[{name:"Residential"},{name:"Commercial"},{name:"Hotel"},{name:"Hospital"},{name:"Nursing Home"}].find(e=>e.name.toLowerCase()===t.subPropertyCategory.toLowerCase())||{name:t.subPropertyCategory},a={name:t.subPropertyCategory}),t.propertyType&&(a={name:t.propertyType},t.subPropertyCategory||(e={name:t.propertyType}));const n={pidNumber:g.pidNumber||t.pidNumber||"",propertyType:g.propertyType?{name:g.propertyType}:e,subPropertyCategory:g.subPropertyCategory?{name:g.subPropertyCategory}:a,noOfFloors:g.noOfFloors||(t.numberOfFloors||t.noOfFloor?String(t.numberOfFloors||t.noOfFloor):""),floorNo:g.floorNo||t.floorNo||"",noOfRooms:g.noOfRooms||(null!=t.numberOfRooms?String(t.numberOfRooms):""),noOfBeds:g.noOfBeds||(null!=t.numberOfBeds?String(t.numberOfBeds):""),dwellingUnits:g.dwellingUnits||(null!=t.numberOfDwellingUnits?String(t.numberOfDwellingUnits):""),buildingImage:g.buildingImageId||t.buildingImageFileStoreId||null};R(n),M(n),n.buildingImage&&h(n.buildingImage),D(!0)}},[v,null==s?void 0:s.connectionDetails,T]),E)return a.createElement(o.Loader,null);const P=function(e,t,n,l,r,i,s){var c,d,m;void 0===t&&(t={});const u=(null===(c=t)||void 0===c||null===(d=c.propertyType)||void 0===d?void 0:d.name)||(null===(m=t)||void 0===m?void 0:m.propertyType),p="Hotel"===u,E="Hospital"===u||"Nursing Home"===u,v=[{label:e("PID Number"),isMandatory:!1,type:"text",populators:{name:"pidNumber"}},{label:e("Property Type"),isMandatory:!1,type:"custom",key:"propertyType",populators:{name:"propertyType",component:e=>a.createElement(o.Dropdown,{option:[{name:"Residential"},{name:"Commercial"},{name:"Hotel"},{name:"Hospital"},{name:"Nursing Home"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Sub Property Category"),isMandatory:!1,type:"custom",key:"subPropertyCategory",populators:{name:"subPropertyCategory",component:e=>a.createElement(o.Dropdown,{option:[],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("No. of Floors"),isMandatory:!0,type:"number",populators:{name:"noOfFloors",validation:{required:!0,min:1}}},{label:e("Floor No. of this KNO"),isMandatory:!1,type:"text",populators:{name:"floorNo"}},{label:e("No of Beds"),isMandatory:E,type:"number",populators:{name:"noOfBeds",validation:E?{required:!0,min:1}:{}}},{label:e("No. of Rooms"),isMandatory:p,type:"number",populators:{name:"noOfRooms",validation:p?{required:!0,min:1}:{}}},{label:e("Number of Dwelling Units"),isMandatory:!1,type:"number",populators:{name:"dwellingUnits"}},{label:e("Building Image"),isMandatory:!0,type:"custom",key:"buildingImage",populators:{name:"buildingImage",component:t=>a.createElement("div",null,a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),i(null),s(null)},message:e(r?"Uploaded":"No file selected")}),l&&a.createElement("div",{style:{marginTop:"10px"}},a.createElement("img",{src:l,alt:"preview",style:{maxWidth:"100%",maxHeight:"200px",objectFit:"contain"}})))}}];return[{head:e("EKYC_PROPERTY_DETAILS"),body:v}]}(c,O,function(e,t){try{const a=e.target.files[0];if(!a)return Promise.resolve();if(a.size>2e6)return k({type:"error",message:c("Max size 2MB exceeded")}),Promise.resolve();const n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a,u)).then(function(e){var n,l,o;const r=null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.fileStoreId;if(r){t(a.name),h(r);const e=new FileReader;e.onloadend=()=>b(e.result),e.readAsDataURL(a),k({type:"success",message:c("Upload successful")})}})},function(){k({type:"error",message:c("Upload failed")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},N,C,b,h);return a.createElement(t.Fragment,null,a.createElement(o.FormComposer,{key:T?"loaded":"loading",isDisabled:!A,label:c("ES_COMMON_CONTINUE"),config:P.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),onSubmit:function(e){try{var t,a;const n={pidNumber:e.pidNumber,propertyType:(null===(t=e.propertyType)||void 0===t?void 0:t.name)||e.propertyType,subPropertyCategory:(null===(a=e.subPropertyCategory)||void 0===a?void 0:a.name)||e.subPropertyCategory,noOfFloors:e.noOfFloors,floorNo:e.floorNo,noOfRooms:e.noOfRooms,noOfBeds:e.noOfBeds,dwellingUnits:e.dwellingUnits,buildingImageId:C},l=S(function(){return Promise.resolve(y.mutateAsync({RequestInfo:{},updateType:"PROPERTY",kno:p,...n})).then(function(){k({type:"success",message:c("Property details updated successfully!")}),i(r.key,n)})},function(){k({type:"error",message:c("Failed to update property details")})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:I,onFormValueChange:(e,t)=>{var a,n;((null==t||null===(a=t.propertyType)||void 0===a?void 0:a.name)||(null==t?void 0:t.propertyType))!==((null==O||null===(n=O.propertyType)||void 0===n?void 0:n.name)||(null==O?void 0:O.propertyType))&&M(e=>({...e,...t}));const l=null==t?void 0:t.propertyType,o=null==t?void 0:t.noOfFloors,r=C||(null==t?void 0:t.buildingImage),i=null==t?void 0:t.noOfRooms,s=null==t?void 0:t.noOfBeds;let c=!0;l||(c=!1),(null==t?void 0:t.subPropertyCategory)||(c=!1),(!o||Number(o)<1)&&(c=!1),r||(c=!1),"Hotel"!==(null==l?void 0:l.name)||i||(c=!1),"Hospital"!==(null==l?void 0:l.name)&&"Nursing Home"!==(null==l?void 0:l.name)||s||(c=!1),c!==A&&_(c)},noCard:!1,submitInForm:!0}),f&&a.createElement(o.Toast,{error:"error"===f.type,label:f.message,onClose:()=>k(null)}))},ne=e=>{let{config:r,onSelect:i,formData:s}=e;const{t:c}=n.useTranslation(),d=l.useLocation(),m=d.state||{},u=Digit.ULBService.getCurrentTenantId(),p=new URLSearchParams(d.search).get("kno")||(null==m?void 0:m.kNumber)||(null==m?void 0:m.kno)||(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||sessionStorage.getItem("EKYC_K_NUMBER"),{isLoading:E,data:v}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:{kno:p,fetchType:"METER"}},{enabled:!!p,cacheTime:0}),y=Digit.Hooks.ekyc.useEkycUpdate(u),g=(null==s?void 0:s.meterDetails)||{},[N,b]=t.useState(null),[C,h]=t.useState(g.meterPhotoId||null),[f,k]=t.useState(null),[T,D]=t.useState(!1),[A,_]=t.useState(!1),[I,R]=t.useState(()=>({connectionCategory:g.connectionCategory||"",saType:g.saType||"",status:g.status||"",mrCode:g.mrCode||"",areaCode:g.areaCode||"",mrKey:g.mrKey||"",meterNumber:g.meterNumber||"",meterMaker:g.meterMaker||"",meterStatus:g.meterStatus?{name:g.meterStatus}:null,meterCondition:g.meterCondition?{name:g.meterCondition}:null,meterLocation:g.meterLocation?{name:g.meterLocation}:null,lastBillReceived:g.lastBillReceived?{name:g.lastBillReceived}:null,billMonthYear:g.billMonthYear?{name:g.billMonthYear}:null,reason:g.reason||"",accessToMeter:g.accessToMeter?{name:g.accessToMeter}:null,sewerConnection:g.sewerConnection?{name:g.sewerConnection}:null,septicTank:g.septicTank?{name:g.septicTank}:null,meterPhoto:g.meterPhotoId?"Uploaded":null})),[O,M]=t.useState(I);if(t.useEffect(()=>{const e=(e=>{if(!e)return null;const t=(null==e?void 0:e.applicationReviewInfo)||(null==e?void 0:e.applicationReview)||e,a=(Array.isArray(t)?t[0]:t)||{};return(null==a?void 0:a.newData)||a})(v)||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.meterDetails)||e||{};if(t&&Object.keys(t).length>0&&!T){let e=null,a=null,n=null,l=null,o=null,r=null,i=null,s=null;if(t.meterStatus?e=[{name:"Metered"},{name:"Unmetered"},{name:"Can not be identified"}].find(e=>e.name.toLowerCase()===t.meterStatus.toLowerCase())||{name:t.meterStatus}:void 0!==t.metered&&(e={name:t.metered?"Metered":"Unmetered"}),t.meterCondition&&(a=[{name:"Damaged"},{name:"Not-Damaged"}].find(e=>e.name.toLowerCase()===t.meterCondition.toLowerCase())||{name:t.meterCondition}),t.meterLocation&&(n=[{name:"Inside"},{name:"Outside"}].find(e=>e.name.toLowerCase()===t.meterLocation.toLowerCase()||t.meterLocation.toLowerCase().includes(e.name.toLowerCase()))||{name:t.meterLocation}),null!=t.lastBillRaised){const e=String(t.lastBillRaised).toLowerCase();l="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}if(t.lastBillReceivedDate){const e=t.lastBillReceivedDate.replace("-","/").split("/");o=2===e.length?{name:`${parseInt(e[0],10)}/${parseInt(e[1],10)}`}:{name:t.lastBillReceivedDate}}if(null!=t.accessToMeter){const e=String(t.accessToMeter).toLowerCase();r="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}if(null!=t.sewerConnection){const e=String(t.sewerConnection).toLowerCase();i="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}if(null!=t.septicTank){const e=String(t.septicTank).toLowerCase();s="true"===e||"yes"===e?{name:"Yes"}:{name:"No"}}const c={connectionCategory:g.connectionCategory||t.connectionCategory||"",saType:g.saType||t.saType||"",status:g.status||t.statusFlag||"",mrCode:g.mrCode||(t.mrcode?String(t.mrcode):""),areaCode:g.areaCode||(t.areacode?String(t.areacode):""),mrKey:g.mrKey||(t.mrkey?String(t.mrkey):""),meterNumber:g.meterNumber||t.meterNumber||"",meterMaker:g.meterMaker||t.meterMake||"",meterStatus:g.meterStatus?{name:g.meterStatus}:e,meterCondition:g.meterCondition?{name:g.meterCondition}:a,meterLocation:g.meterLocation?{name:g.meterLocation}:n,lastBillReceived:g.lastBillReceived?{name:g.lastBillReceived}:l,billMonthYear:g.billMonthYear?{name:g.billMonthYear}:o,reason:g.reason||t.lastBillNotRaisedReason||"",accessToMeter:g.accessToMeter?{name:g.accessToMeter}:r,sewerConnection:g.sewerConnection?{name:g.sewerConnection}:i,septicTank:g.septicTank?{name:g.septicTank}:s,meterPhoto:g.meterPhotoId||t.meterPhotoFileStoreId||null};R(c),M(c),c.meterPhoto&&h(c.meterPhoto),D(!0)}},[v,null==s?void 0:s.connectionDetails,T]),E)return a.createElement(o.Loader,null);const P=function(e,t,n,l,r,i,s){var c,d,m,u,p,E,v,y,g;void 0===t&&(t={});const N=(null===(c=t)||void 0===c||null===(d=c.meterStatus)||void 0===d?void 0:d.name)||(null===(m=t)||void 0===m?void 0:m.meterStatus),b=(null===(u=t)||void 0===u||null===(p=u.lastBillReceived)||void 0===p?void 0:p.name)||(null===(E=t)||void 0===E?void 0:E.lastBillReceived),C=(null===(v=t)||void 0===v||null===(y=v.sewerConnection)||void 0===y?void 0:y.name)||(null===(g=t)||void 0===g?void 0:g.sewerConnection),h="Can not be identified"===N,f=[];for(let e=1998;e<=2026;e++)for(let t=1;t<=12;t++)f.push({name:`${t}/${e}`});const S=[{name:"Yes"},{name:"No"}],k=[{label:e("Connection Category"),isMandatory:!0,type:"text",populators:{name:"connectionCategory",validation:{required:!0}}},{label:e("SA Type"),isMandatory:!1,type:"text",populators:{name:"saType"}},{label:e("Status"),isMandatory:!1,type:"text",populators:{name:"status"}},{label:e("MR Code"),isMandatory:!1,type:"text",populators:{name:"mrCode"}},{label:e("Area Code"),isMandatory:!1,type:"text",populators:{name:"areaCode"}},{label:e("MR Key"),isMandatory:!1,type:"text",populators:{name:"mrKey"}}];return h||(k.push({label:e("Meter Number"),isMandatory:!1,type:"text",populators:{name:"meterNumber"}},{label:e("Meter Maker"),isMandatory:!1,type:"text",populators:{name:"meterMaker"}},{label:e("Meter Condition"),isMandatory:!1,type:"custom",key:"meterCondition",populators:{name:"meterCondition",component:e=>a.createElement(o.Dropdown,{option:[{name:"Damaged"},{name:"Not-Damaged"}],optionKey:"name",selected:e.value,select:e.onChange})}}),"Metered"===N&&k.push({label:e("Meter Photo"),isMandatory:!0,type:"custom",key:"meterPhoto",populators:{name:"meterPhoto",component:t=>a.createElement("div",null,a.createElement(o.UploadFile,{onUpload:e=>n(e,t.onChange),onDelete:()=>{t.onChange(null),i(null),s(null)},message:e(r?"Uploaded":"No file selected")}),l&&a.createElement("div",{style:{marginTop:"10px"}},a.createElement("img",{src:l,alt:"preview",style:{maxWidth:"100%",maxHeight:"200px",objectFit:"contain"}})))}})),k.push({label:e("Meter Status"),isMandatory:!0,type:"custom",key:"meterStatus",populators:{name:"meterStatus",component:e=>a.createElement(o.Dropdown,{option:[{name:"Metered"},{name:"Unmetered"},{name:"Can not be identified"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Meter Location"),isMandatory:!0,type:"custom",key:"meterLocation",populators:{name:"meterLocation",component:e=>a.createElement(o.Dropdown,{option:[{name:"Inside"},{name:"Outside"}],optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Last Bill Received"),isMandatory:!0,type:"custom",key:"lastBillReceived",populators:{name:"lastBillReceived",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}}),"Yes"===b?k.push({label:e("When was the last bill received"),isMandatory:!0,type:"custom",key:"billMonthYear",populators:{name:"billMonthYear",component:e=>a.createElement(o.Dropdown,{option:f,optionKey:"name",selected:e.value,select:e.onChange})}}):"No"===b&&k.push({label:e("Reason *"),isMandatory:!0,type:"text",populators:{name:"reason",validation:{required:!0}}}),k.push({label:e("Access to Meter"),isMandatory:!1,type:"custom",key:"accessToMeter",populators:{name:"accessToMeter",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}},{label:e("Sewer Connection"),isMandatory:!0,type:"custom",key:"sewerConnection",populators:{name:"sewerConnection",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}}),"No"===C&&k.push({label:e("Septic Tank"),isMandatory:!0,type:"custom",key:"septicTank",populators:{name:"septicTank",component:e=>a.createElement(o.Dropdown,{option:S,optionKey:"name",selected:e.value,select:e.onChange})}}),[{head:e("EKYC_METER_DETAILS"),body:k}]}(c,O,function(e,t){try{const a=e.target.files[0];if(!a)return Promise.resolve();if(a.size>2e6)return k({type:"error",message:c("Max size 2MB exceeded")}),Promise.resolve();const n=S(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a,u)).then(function(e){var n,l,o;const r=null==e||null===(n=e.data)||void 0===n||null===(l=n.files)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.fileStoreId;if(r){t(a.name),h(r);const e=new FileReader;e.onloadend=()=>b(e.result),e.readAsDataURL(a),k({type:"success",message:c("Upload successful")})}})},function(){k({type:"error",message:c("Upload failed")})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},N,C,b,h);return a.createElement(t.Fragment,null,a.createElement(o.FormComposer,{key:T?"loaded":"loading",isDisabled:!A,label:c("ES_COMMON_CONTINUE"),config:P.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),onSubmit:function(e){try{var t,a,n,l,o,s,d,m;const u={connectionCategory:e.connectionCategory,saType:e.saType,status:e.status,mrCode:e.mrCode,areaCode:e.areaCode,mrKey:e.mrKey,meterNumber:e.meterNumber,meterMaker:e.meterMaker,meterStatus:(null===(t=e.meterStatus)||void 0===t?void 0:t.name)||e.meterStatus,meterCondition:(null===(a=e.meterCondition)||void 0===a?void 0:a.name)||e.meterCondition,meterLocation:(null===(n=e.meterLocation)||void 0===n?void 0:n.name)||e.meterLocation,lastBillReceived:(null===(l=e.lastBillReceived)||void 0===l?void 0:l.name)||e.lastBillReceived,billMonthYear:(null===(o=e.billMonthYear)||void 0===o?void 0:o.name)||e.billMonthYear,reason:e.reason,accessToMeter:(null===(s=e.accessToMeter)||void 0===s?void 0:s.name)||e.accessToMeter,sewerConnection:(null===(d=e.sewerConnection)||void 0===d?void 0:d.name)||e.sewerConnection,septicTank:(null===(m=e.septicTank)||void 0===m?void 0:m.name)||e.septicTank,meterPhotoId:C},E=S(function(){return Promise.resolve(y.mutateAsync({RequestInfo:{},updateType:"METER",kno:p,...u})).then(function(){k({type:"success",message:c("Meter details updated successfully!")}),i(r.key,u)})},function(){k({type:"error",message:c("Failed to update meter details")})});return Promise.resolve(E&&E.then?E.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:I,onFormValueChange:(e,t)=>{var a,n,l,o,r,i;const s=((null==t||null===(a=t.meterStatus)||void 0===a?void 0:a.name)||(null==t?void 0:t.meterStatus))!==((null==O||null===(n=O.meterStatus)||void 0===n?void 0:n.name)||(null==O?void 0:O.meterStatus)),c=((null==t||null===(l=t.lastBillReceived)||void 0===l?void 0:l.name)||(null==t?void 0:t.lastBillReceived))!==((null==O||null===(o=O.lastBillReceived)||void 0===o?void 0:o.name)||(null==O?void 0:O.lastBillReceived)),d=((null==t||null===(r=t.sewerConnection)||void 0===r?void 0:r.name)||(null==t?void 0:t.sewerConnection))!==((null==O||null===(i=O.sewerConnection)||void 0===i?void 0:i.name)||(null==O?void 0:O.sewerConnection));(s||c||d)&&M(e=>({...e,...t}));const m=null==t?void 0:t.meterStatus,u=null==t?void 0:t.lastBillReceived,p=null==t?void 0:t.sewerConnection;let E=!0;(null==t?void 0:t.connectionCategory)||(E=!1),m||(E=!1),(null==t?void 0:t.meterLocation)||(E=!1),u||(E=!1),p||(E=!1),"Metered"!==(null==m?void 0:m.name)||C||(null==t?void 0:t.meterPhoto)||(E=!1),"No"!==(null==u?void 0:u.name)||(null==t?void 0:t.reason)||(E=!1),"Yes"!==(null==u?void 0:u.name)||(null==t?void 0:t.billMonthYear)||(E=!1),"No"!==(null==p?void 0:p.name)||(null==t?void 0:t.septicTank)||(E=!1),E!==A&&_(E)},noCard:!1,submitInForm:!0}),f&&a.createElement(o.Toast,{error:"error"===f.type,label:f.message,onClose:()=>k(null)}))},le=()=>{var e,t;const{t:l}=n.useTranslation(),r={moduleName:l("ACTION_TEST_EKYC"),kpis:[{count:"-",label:l("TOTAL_EKYC"),link:"/digit-ui/citizen/ekyc/dashboard"}],links:[]},i=null===(e=Digit.SessionStorage.get("User"))||void 0===e||null===(t=e.info)||void 0===t?void 0:t.roles,s=Array.isArray(i)?i.map(e=>e.code):[];return s.includes("EKYC_SURVEYOR")&&r.links.push({label:l("SURVEYOR_DASHBOARD"),link:"/digit-ui/citizen/ekyc/surveyor-dashboard"}),(s.includes("EKYC_SUPERVISOR")||s.includes("EKYC_VENDOR"))&&r.links.push({label:l("EKYC_DASHBOARD"),link:"/digit-ui/citizen/ekyc/dashboard"},{label:l("EKYC_INBOX"),link:"/digit-ui/citizen/ekyc/inbox"},{label:l("EKYC_ASSIGN"),link:"/digit-ui/citizen/ekyc/assign"}),1===s.length&&s.includes("CITIZEN")&&r.links.push({label:l("EKYC_STATUS"),link:"/digit-ui/citizen/ekyc/:id"}),a.createElement(o.ModuleLinksView,{links:r.links})},oe=e=>{var n,r,i,s,c;let{parentRoute:d}=e;const m=Digit.ULBService.getCurrentTenantId(),u=l.useLocation(),[p,v]=t.useReducer(function(e,t){const a=t.checkPathName?"EKYC.INBOX":"EKYC.SW.INBOX";switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set(a,{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set(a,{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set(a,{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}},{filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}}),y=t.useMemo(()=>{var e,t;return{tenantId:m,offset:(null==p||null===(e=p.tableForm)||void 0===e?void 0:e.offset)||0,limit:(null==p||null===(t=p.tableForm)||void 0===t?void 0:t.limit)||10,search:(null==p?void 0:p.searchForm)||{}}},[m,null==p||null===(n=p.tableForm)||void 0===n?void 0:n.offset,null==p||null===(r=p.tableForm)||void 0===r?void 0:r.limit,null==p?void 0:p.searchForm]),g=t.useMemo(()=>{const e=(null==p?void 0:p.searchForm)||{};return{...e,...e.kNumber&&{kno:e.kNumber}}},[null==p?void 0:p.searchForm]),{isLoading:N,data:b={}}=Digit.Hooks.ekyc.useEkycApplicationList(g,y,{enabled:!!m,keepPreviousData:!0}),C=t.useMemo(()=>{var e,t;return{kno:(null==p||null===(e=p.searchForm)||void 0===e?void 0:e.kNumber)||"",name:(null==p||null===(t=p.searchForm)||void 0===t?void 0:t.kName)||""}},[null==p||null===(i=p.searchForm)||void 0===i?void 0:i.kNumber,null==p||null===(s=p.searchForm)||void 0===s?void 0:s.kName]),h=!(!C.kno&&!C.name),{isLoading:S,data:k}=Digit.Hooks.ekyc.useSearchConnection({tenantId:m,details:C},{enabled:!!m&&!!C.kno,keepPreviousData:!0}),T=t.useMemo(()=>h?k?[k]:[]:(null==b?void 0:b.consumerList)||[],[h,k,b]),D=t.useMemo(()=>(T||[]).map(e=>{var t,a,n,l,o,r,i,s;return e.connectionDetails?{applicationNo:(null===(t=e.propertyInfo)||void 0===t?void 0:t.kno)||"",connectionNo:(null===(a=e.propertyInfo)||void 0===a?void 0:a.kno)||"",owner:(null===(n=e.connectionDetails)||void 0===n?void 0:n.consumerName)||"",applicationNumber:(null===(l=e.propertyInfo)||void 0===l?void 0:l.kno)||"",citizenName:(null===(o=e.connectionDetails)||void 0===o?void 0:o.consumerName)||"",status:(null===(r=e.connectionDetails)||void 0===r?void 0:r.statusflag)||"",ekycStatus:((null===(i=e.connectionDetails)||void 0===i?void 0:i.ekycStatus)||(null===(s=e.connectionDetails)||void 0===s?void 0:s.ekycstatus)||e.ekycStatus||e.ekycstatus||"NA").toUpperCase(),sla:0}:{...e,applicationNo:e.kno||e.applicationNumber||"",connectionNo:e.connectionNo||"",owner:e.consumerName||e.citizenName||"",applicationNumber:e.kno||e.applicationNumber||"",citizenName:e.consumerName||e.citizenName||"",status:e.status||"",ekycStatus:(e.ekycStatus||e.ekycstatus||"NA").toUpperCase(),sla:e.sla??0}}),[T]),A=(null==b||null===(c=b.dashboardInfo)||void 0===c?void 0:c.totalRecords)||(null==b?void 0:b.totalCount)||0,_=u.pathname.includes("ekyc/inbox"),I=t.useCallback(e=>{let{registerRef:t,searchFormState:n,controlSearchForm:l}=e;return a.createElement(P,{registerRef:t,searchFormState:n,controlSearchForm:l,searchType:"kno",className:"search"})},[]),R={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},O={kNumber:"",applicationNumber:"",consumerNo:""},M={SearchFormFields:I,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),v({action:"mutateTableForm",data:{...R},checkPathName:_}),v({action:"mutateSearchForm",data:e,checkPathName:_})},searchFormDefaultValues:null==p?void 0:p.searchForm,resetSearchFormDefaultValues:O,onSearchFormReset:e=>{e("kNumber",null),e("applicationNumber",null),e("consumerNo",null),v({action:"mutateSearchForm",data:O})},className:"search-form-wns-inbox"},L=f({parentRoute:d,onPageSizeChange:e=>{const t=Number(e.target.value);v({action:"mutateTableForm",data:{...p.tableForm,limit:t,offset:0},checkPathName:_})},formState:p,totalCount:A,table:D,dispatch:v,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,n=a?"DESC":"ASC";p.tableForm.sortBy===t&&p.tableForm.sortOrder===n||v({action:"mutateTableForm",data:{...p.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"},checkPathName:_})}},tenantId:m,checkPathName:_,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(o.InboxComposer,E({isInboxLoading:N||S},M,{propsForInboxTable:L,formState:p})))},re=()=>{const{t:e}=n.useTranslation(),t=l.useLocation(),{path:r}=l.useRouteMatch();return sessionStorage.removeItem("revalidateddone"),a.createElement(a.Fragment,null,a.createElement("div",{className:"ground-container form-container"},a.createElement(o.ModuleHeader,{leftContent:a.createElement(a.Fragment,null,a.createElement(o.ArrowLeft,{className:"icon"}),e("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const a=t.pathname,n=[{icon:o.HomeIcon,path:"/digit-ui/citizen"},{label:e("EKYC_MODULE_NAME"),path:"/digit-ui/citizen/ekyc"}];return a.includes("/create-kyc")?n.push({label:e("EKYC_CREATE_KYC")}):a.includes("/aadhaar-verification")?n.push({label:e("EKYC_AADHAAR_VERIFICATION")}):a.includes("/address-details")?n.push({label:e("EKYC_ADDRESS_DETAILS")}):a.includes("/property-info")?n.push({label:e("EKYC_PROPERTY_INFO")}):a.includes("/meter-details")?n.push({label:e("EKYC_METER_DETAILS")}):a.includes("/review")?(n.push({label:e("EKYC_INBOX"),path:"/digit-ui/citizen/ekyc/inbox"}),n.push({label:e("EKYC_REVIEW")})):a.includes("/assign/surveyor-details")?(n.push({label:e("EKYC_ASSIGN"),path:"/digit-ui/citizen/ekyc/assign"}),n.push({label:e("EKYC_SURVEYOR_DETAILS")})):a.includes("/assign")?n.push({label:e("EKYC_ASSIGN")}):a.includes("/surveyor-dashboard")?n.push({label:e("EKYC_SURVEYOR_DASHBOARD")}):a.includes("/dashboard")?n.push({label:e("EKYC_DASHBOARD")}):a.includes("/inbox")?n.push({label:e("EKYC_INBOX")}):a.includes("/status/")&&n.push({label:e("EKYC_STATUS")}),n})()}),a.createElement(l.Switch,null,a.createElement(o.PrivateRoute,{exact:!0,path:""+r,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(le,null))}),a.createElement(o.PrivateRoute,{path:r+"/dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(h,null))}),a.createElement(o.PrivateRoute,{path:r+"/inbox",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(oe,null))}),a.createElement(o.PrivateRoute,{path:r+"/aadhaar-verification",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(z,null))}),a.createElement(o.PrivateRoute,{path:r+"/property-info",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ae,null))}),a.createElement(o.PrivateRoute,{path:r+"/meter-details",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ne,null))}),a.createElement(o.PrivateRoute,{path:r+"/review",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(j,null))}),a.createElement(o.PrivateRoute,{path:r+"/assign",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(ee,null))}),a.createElement(o.PrivateRoute,{path:r+"/assign/surveyor-details/:id",exact:!0,component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"action"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:r+"/surveyor-dashboard/:id",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:r+"/surveyor-dashboard",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(q,null))}),a.createElement(o.PrivateRoute,{path:r+"/status/:applicationId",component:()=>a.createElement(o.LayoutWrapper,{layoutClass:"normal"},a.createElement(j,null))}))))},ie=e=>{let{stateCode:n,userType:r,tenants:i}=e;const{path:s,url:c}=l.useRouteMatch(),d=Digit.StoreData.getCurrentLanguage(),{isLoading:m}=Digit.Services.useStore({stateCode:n,moduleCode:"EKYC",language:d});return Digit.SessionStorage.set("EKYC_TENANTS",i),t.useEffect(()=>Digit.LocalizationService.getLocale({modules:["rainmaker-ekyc","rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),m?a.createElement(o.Loader,{page:!0}):"employee"===r?a.createElement(te,{path:s,url:c,userType:r,tenants:i}):a.createElement(re,null)},se=e=>{let{matchPath:t}=e;const{t:l}=n.useTranslation(),r=[{link:t+"/create-kyc",i18nKey:l("EKYC_CREATE_KYC")},{link:t+"/update-kyc",i18nKey:l("EKYC_UPDATE_KYC")}];return a.createElement(o.CitizenHomeCard,{header:l("EKYC_MODULE_NAME"),links:r,Icon:()=>a.createElement(o.DocumentIcon,{className:"fill-path-primary-main"})})},ce={EKYCModule:ie,EKYCCard:()=>{const{t:e}=n.useTranslation(),t={Icon:a.createElement(o.PersonIcon,null),moduleName:e("ACTION_TEST_EKYC"),kpis:[{count:"-",label:e("TOTAL_EKYC"),link:"/digit-ui/employee/ekyc/dashboard"}],links:[{label:e("CEO_M.F_DOR_FINANCE_VIEW"),link:"/digit-ui/employee/ekyc/ceo-dashboard"},{label:e("EKYC_INBOX"),link:"/digit-ui/employee/ekyc/inbox"},{label:e("EKYC_ASSIGN"),link:"/digit-ui/employee/ekyc/assign"}]};return a.createElement(o.EmployeeModuleCard,t)},EKYCInbox:m,EKYCDesktopInbox:e=>{var r;let{filterComponent:i,...s}=e;const{data:c,isLoading:m,onSort:u,onNextPage:p,onPrevPage:E,currentPage:v,pageSizeLimit:y,onPageSizeChange:g,parentRoute:N,searchParams:b,sortParams:C,totalRecords:h,countData:f}=s,{t:S}=n.useTranslation(),k=l.useHistory(),T=Digit.ULBService.getCurrentTenantId(),D=null===(r=Digit.ComponentRegistryService)||void 0===r?void 0:r.getComponent(i),[A,_]=t.useState(""),{data:I,getReview:R}=Digit.Hooks.ekyc.useEkycAPI("review",T),O=e=>{_(e),R({kno:e})};a.useEffect(()=>{I&&k.push("/digit-ui/employee/ekyc/review",{kNumber:A,aadhaarData:null==I?void 0:I.aadhaarData,reviewData:I})},[I]);const M=t.useMemo(()=>[{Header:S("EKYC_APPLICATION_NO"),accessor:"applicationNumber",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>O(o)},o)}},{Header:S("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:n}=e;return a.createElement("span",null,(null===(t=n.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:S("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:n}=e;const l=(null===(t=n.original)||void 0===t?void 0:t.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+l},S(""+l))}},{Header:S("EKYC_EKYC_STATUS"),accessor:"ekycStatus",Cell:e=>{var t,n;let{row:l}=e;const o=((null===(t=l.original)||void 0===t?void 0:t.ekycStatus)||(null===(n=l.original)||void 0===n?void 0:n.ekycstatus)||"NA").toUpperCase();return a.createElement("span",{className:"ekyc-status-tag "+o},S(""+o))}},{Header:S("EKYC_ACTION"),accessor:"status",Cell:e=>{var t,n;let{row:l}=e;const o=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(n=l.original)||void 0===n?void 0:n.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>O(o)},S("EKYC_REVIEW"))}}],[S,N]),P=t.useMemo(()=>(null==c?void 0:c.items)||(Array.isArray(c)?c:[]),[c]);return a.createElement("div",{className:"app-container"},a.createElement("div",{className:"inbox-container"},m&&a.createElement(o.Loader,null),a.createElement("div",{className:"side-panel-item"},a.createElement(o.InboxLinks,{headerText:s.moduleCode}),D&&a.createElement(D,{defaultSearchParams:s.defaultSearchParams,onFilterChange:s.onSearch,searchParams:b,type:"desktop",moduleCode:"EKYC"})),a.createElement("div",{className:"employee-form-content",style:{flex:1}},a.createElement(o.Card,{className:"ekyc-metrics-card"},a.createElement(d,{countData:f})),a.createElement("div",{className:"result",style:{flex:1}},a.createElement(o.Card,{className:"ekyc-table-card",style:{padding:0}},a.createElement(o.Table,{t:S,data:P,columns:M,isLoading:m,onSort:u,sortParams:C,totalRecords:h,onNextPage:p,onPrevPage:E,currentPage:v,pageSizeLimit:y,onPageSizeChange:g,getCellProps:e=>({className:"ekyc-table-cell"})}))))))},EKYCMobileInbox:e=>{var t;let{data:r,isLoading:i,onSearch:s,searchParams:c,parentRoute:m,countData:p}=e;const{t:E}=n.useTranslation(),v=(null==r||null===(t=r.items)||void 0===t?void 0:t.map(e=>({[E("EKYC_APPLICATION_NO")]:e.applicationNumber,[E("EKYC_CITIZEN_NAME")]:e.citizenName,[E("EKYC_MOBILE_NO")]:e.mobileNumber,[E("EKYC_STATUS")]:a.createElement("span",{className:"ekyc-status-tag "+e.status},E("EKYC_STATUS_"+e.status))})))||[];return a.createElement("div",{className:"inbox-wrapper"},a.createElement("div",{className:"ekyc-header-container module-header"},a.createElement(o.Header,{className:"title"},E("EKYC_INBOX_HEADER")),a.createElement(l.Link,{to:m+"/create-kyc"},a.createElement(o.SubmitBar,{label:E("EKYC_CREATE_KYC")}))),a.createElement("div",{className:"ekyc-metrics-section"},a.createElement(d,{countData:p})),a.createElement(u,{onSearch:s,searchParams:c}),a.createElement("div",{className:"mobile-data-container"},i?a.createElement(o.Loader,null):(null==v?void 0:v.length)>0?a.createElement(o.DetailsCard,{data:v,t:E,serviceRequestIdKey:E("EKYC_APPLICATION_NO"),linkPrefix:m+"/application-details/"}):a.createElement(o.Card,null,E("ES_COMMON_NO_DATA").split("\\n").map((e,t)=>a.createElement("p",{key:t,style:{textAlign:"center"}},e)))))},EKYC_INBOX_FILTER:e=>a.createElement(p,e),EkycLinks:se,AadhaarVerification:z,PropertyInfo:ae,MeterDetails:ne};exports.EkycLinks=se,exports.EkycModule=ie,exports.default=ie,exports.initEkycComponents=()=>{Object.entries(ce).forEach(e=>{let[t,a]=e;Digit.ComponentRegistryService.setComponent(t,a)})};