@djb25/digit-ui-module-ekyc 1.0.11 → 1.0.12

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.
Files changed (39) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.modern.js +1338 -591
  4. package/dist/index.modern.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/Module.js +25 -7
  7. package/src/components/AadhaarVerification.js +415 -0
  8. package/src/components/AddressDetails.js +207 -0
  9. package/src/components/CeoDashboard.js +205 -0
  10. package/src/components/DesktopInbox.js +1 -1
  11. package/src/components/EKYCCard.js +4 -0
  12. package/src/components/MeterDetails.js +372 -0
  13. package/src/components/PropertyInfo.js +303 -0
  14. package/src/components/Review.js +572 -0
  15. package/src/components/analytics/charts/ClusterHeatmap.js +88 -0
  16. package/src/components/analytics/charts/TaskStatusChart.js +92 -0
  17. package/src/components/analytics/components/AnalyticsTable.js +106 -0
  18. package/src/components/analytics/components/DashboardLayout.js +72 -0
  19. package/src/components/analytics/components/EmptyState.js +27 -0
  20. package/src/components/analytics/components/ErrorBoundary.js +27 -0
  21. package/src/components/analytics/components/FilterBar.js +73 -0
  22. package/src/components/analytics/components/NotificationPanel.js +77 -0
  23. package/src/components/analytics/components/SLAWidget.js +56 -0
  24. package/src/components/analytics/components/SkeletonLoader.js +53 -0
  25. package/src/components/analytics/components/SummaryCard.js +74 -0
  26. package/src/components/analytics/components/WorkflowTimeline.js +55 -0
  27. package/src/components/analytics/styles/Dashboard.css +54 -0
  28. package/src/components/analytics/utils/exportUtils.js +64 -0
  29. package/src/components/analytics/utils/filterSerializer.js +50 -0
  30. package/src/config/config.js +1 -1
  31. package/src/pages/citizen/index.js +74 -18
  32. package/src/pages/employee/ConsumerDetails.js +10 -281
  33. package/src/pages/employee/Inbox.js +6 -4
  34. package/src/pages/employee/index.js +44 -8
  35. package/src/pages/employee/AadhaarVerification.js +0 -512
  36. package/src/pages/employee/AddressDetails.js +0 -548
  37. package/src/pages/employee/MeterDetails.js +0 -496
  38. package/src/pages/employee/PropertyInfo.js +0 -489
  39. package/src/pages/employee/Review.js +0 -314
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),l=require("react-i18next"),n=require("react-router-dom"),r=require("@djb25/digit-ui-react-components"),o=require("chart.js/auto"),i=e(o);require("react-dom");const s=e=>{let{countData:n}=e;const{t:r}=l.useTranslation(),s=t.useRef(null),c=t.useRef(null),m=(null==n?void 0:n.total)||0,d=(null==n?void 0:n.pending)||0,u=(null==n?void 0:n.completed)||0,E=(null==n?void 0:n.completed)||0,p=E,v=m>0?Math.round(E/m*100):0,g=m>0?Math.round(p/m*100):0,C=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(o.Chart||i||o)(e,{type:"doughnut",data:{labels:[r("EKYC_ACTIVE"),r("EKYC_PENDING"),r("EKYC_COMPLETED")],datasets:[{data:[u,d,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()}},[d,0,u,r]);const b=[{color:"#0c2a52",label:r("EKYC_ACTIVE"),value:u},{color:"#77B6EA",label:r("EKYC_PENDING"),value:d},{color:"#c8ddf5",label:r("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"}),r("EKYC_INSTITUTIONAL_OVERVIEW")||"Institutional Performance Overview"),a.createElement("h1",{className:"status-cards-h1"},r("EKYC_DASHBOARD_TITLE")||"eKYC Verification Dashboard"),a.createElement("p",{className:"status-cards-subtitle"},r("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"},r("EKYC_TOTAL_APPLICATIONS")||"Total Applications Processed"),a.createElement("div",{className:"total-number"},C(m)),a.createElement("div",{className:"total-badge"},"↗ +12.4% ",r("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"},r("EKYC_STATUS_BREAKDOWN")||"Status Breakdown"),a.createElement("div",{className:"panel-subtitle"},r("EKYC_VERIFICATION_LIFECYCLE")||"Verification lifecycle distribution"),a.createElement("div",{className:"breakdown-body"},a.createElement("div",{className:"status-legend"},b.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"},C(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"},r("EKYC_COMPLETE")||"Complete"))))),a.createElement("div",{className:"status-panel"},a.createElement("div",{className:"panel-title"},r("EKYC_SUBMISSION_HEALTH")||"Submission Health",a.createElement("span",{className:"optimal-badge"},r("EKYC_OPTIMAL")||"Optimal")),a.createElement("div",{className:"panel-subtitle"},r("EKYC_PLATFORM_EFFICIENCY")||"Platform operational efficiency"),a.createElement("div",{className:"health-metrics-row"},a.createElement("div",{className:"health-percentage"},g,"%"),a.createElement("div",{className:"health-trend"},"↗ +2.1%")),a.createElement("div",{className:"status-progress-bar"},a.createElement("div",{className:"progress-fill",style:{width:g+"%"}})),a.createElement("div",{className:"mini-metrics-grid"},a.createElement("div",{className:"metric-box"},a.createElement("div",{className:"metric-label"},r("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"},r("EKYC_ERROR_RATE")||"Error Rate"),a.createElement("div",{className:"metric-value"},"0.04%")))))))},c=()=>{const e=Digit.ULBService.getCurrentTenantId(),{isLoading:l,data:n}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},{tenantId:e,offset:0,limit:10},{enabled:!!e}),o=t.useMemo(()=>{const e=(null==n?void 0:n.dashboardInfo)||{};return{total:e.total||0,completed:e.completed||0,pending:e.pending||0,rejected:e.rejected||0,active:e.active||0}},[n]);return l?a.createElement(r.Loader,null):a.createElement(r.Card,{className:"min-width-full"},a.createElement(s,{countData:o}))},m=e=>{var n,o,i;let{onSearch:s,searchParams:c,children:m,...d}=e;const{t:u}=l.useTranslation(),[E,p]=t.useState(()=>({...c})),v=(e,t)=>{p(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(r.Card,{className:"sidebar-title-card"},a.createElement("div",{className:"icon-container"},a.createElement(r.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(E)}},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(r.TextInput,{value:null==E?void 0:E.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(r.TextInput,{value:null==E?void 0:E.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:""};p(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===(n=d.countData)||void 0===n?void 0:n.todaysAudits)||24),a.createElement("div",{className:"audits-change"},a.createElement("span",null,"↗"),(null===(o=d.countData)||void 0===o?void 0:o.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=d.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")))))),m)))},d=e=>{let{searchParams:n,onFilterChange:o,defaultSearchParams:i,...s}=e;const{t:c}=l.useTranslation(),[m,d]=t.useState(()=>({...n}));return a.createElement(r.FilterForm,{onSubmit:()=>{o(m)},handleSubmit:e=>t=>{t&&t.preventDefault(),e()},onResetFilterForm:()=>{d({...i}),o({...i})},id:"ekyc-filter-form",onMobileExclusiveFilterPopupFormClose:s.onClose},a.createElement(r.FilterFormField,null,a.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},c("EKYC_STATUS"),":"),a.createElement(r.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={...m,status:e};d(t),o(t)},selected:(null==m?void 0:m.status)||{label:c("EKYC_STATUS_ALL"),value:""}})))};function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)({}).hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e}).apply(null,arguments)}const E=e=>{var r,o,i;let{onPageSizeChange:s,formState:c,totalCount:m,table:d,dispatch:u,checkPathName:E,onSortingByData:p,tenantId:v,inboxStyles:g={},tableStyle:C={}}=e;const{t:b}=l.useTranslation(),S=n.useHistory(),[N,f]=t.useState(""),{data:h,getReview:y}=Digit.Hooks.ekyc.useEkycAPI("review",v),_=e=>{f(e),y({kno:e})},x=(null==c||null===(r=c.tableForm)||void 0===r?void 0:r.limit)||10,k=(null==c||null===(o=c.tableForm)||void 0===o?void 0:o.offset)||0;a.useEffect(()=>{h&&S.push("/digit-ui/employee/ekyc/review",{kNumber:N,aadhaarData:null==h?void 0:h.aadhaarData,reviewData:h})},[h]);const T=[{Header:b("EKYC_APPLICATION_NO"),accessor:"applicationNumber",disableSortBy:!0,Cell:e=>{var t,l;let{row:n}=e;const r=(null===(t=n.original)||void 0===t?void 0:t.kno)||(null===(l=n.original)||void 0===l?void 0:l.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>_(r)},r)}},{Header:b("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:l}=e;return a.createElement("span",null,(null===(t=l.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:b("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:l}=e;const n=(null===(t=l.original)||void 0===t?void 0:t.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+n},b(""+n))}},{Header:b("EKYC_ACTION"),accessor:"status",Cell:e=>{var t,l;let{row:n}=e;const r=(null===(t=n.original)||void 0===t?void 0:t.kno)||(null===(l=n.original)||void 0===l?void 0:l.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>_(r)},b("EKYC_REVIEW"))}}];return{getCellProps:e=>({style:{padding:"8px",fontSize:"12px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:s,currentPage:Math.floor(k/x),onNextPage:()=>{var e,t;return u({action:"mutateTableForm",data:{...c.tableForm,offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)},checkPathName:E})},onPrevPage:()=>{var e,t;return u({action:"mutateTableForm",data:{...c.tableForm,offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)},checkPathName:E})},pageSizeLimit:x,onSort:p,totalRecords:m,onSearch:null==c||null===(i=c.searchForm)||void 0===i?void 0:i.message,onLastPage:()=>{var e;return u({action:"mutateTableForm",data:{...c.tableForm,offset:10*Math.ceil(m/10)-parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.limit)},checkPathName:E})},onFirstPage:()=>u({action:"mutateTableForm",data:{...c.tableForm,offset:0},checkPathName:E}),data:d,columns:T,inboxStyles:{...g},tableStyle:{...C}}};function p(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 v=e=>null==e;const g=e=>"object"==typeof e;var C=e=>!v(e)&&!Array.isArray(e)&&g(e)&&!(e instanceof Date),b=e=>e.filter(Boolean),S=e=>void 0===e,N=function(e,t,a){void 0===e&&(e={});const l=b(t.split(/[,[\].]+?/)).reduce((e,t)=>v(e)?e:e[t],e);return S(l)||l===e?S(e[t])?a:e[t]:l},f=e=>"function"==typeof e;const h=t.createContext(null);h.displayName="RHFContext";const y=e=>{const{as:a,render:l}=e,n=function(e,t){var a={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&t.indexOf(l)<0&&(a[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(l=Object.getOwnPropertySymbols(e);n<l.length;n++)t.indexOf(l[n])<0&&Object.prototype.propertyIsEnumerable.call(e,l[n])&&(a[l[n]]=e[l[n]])}return a}(e,["rules","as","render","defaultValue","control","onFocus"]),{field:r,meta:o}=function(e){let{name:a,rules:l,defaultValue:n,control:r,onFocus:o}=e;const i=t.useContext(h);if("production"!==process.env.NODE_ENV&&!r&&!i)throw new Error("📋 Controller is missing `control` prop. https://react-hook-form.com/api#Controller");const{defaultValuesRef:s,setValue:c,register:m,unregister:d,trigger:u,mode:E,reValidateMode:{isReValidateOnBlur:p,isReValidateOnChange:y},formState:_,formStateRef:{current:{isSubmitted:x,touched:k,errors:T}},updateFormState:I,readFormStateRef:R,fieldsRef:D,fieldArrayNamesRef:A,shallowFieldsStateRef:L}=r||i.control,F=!((e,t)=>[...e].some(e=>((e,t)=>RegExp(`^${t}([|.)\\d+`.replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(e))(t,e)))(A.current,a),w=()=>!S(N(L.current,a))&&F?N(L.current,a):S(n)?N(s.current,a):n,[O,K]=t.useState(w()),M=t.useRef(O),Y=t.useRef({focus:()=>null}),P=t.useRef(o||(()=>{f(Y.current.focus)&&Y.current.focus(),"production"!==process.env.NODE_ENV&&(f(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:l,isTouched:n,isReValidateOnBlur:r,isReValidateOnChange:o,isBlurEvent:i,isSubmitted:s,isOnAll:c}=e;return!c&&(!s&&l?!(n||i):(s?r:t)?!i:!(s?o:a)||i)})(Object.assign({isBlurEvent:e,isReValidateOnBlur:p,isReValidateOnChange:y,isSubmitted:x,isTouched:!!N(k,a)},E)),[p,y,x,k,a,E]),z=t.useCallback(e=>{let[t]=e;const a=(e=>{return v(t=e)||!g(t)||!C(e.target)||C(e.target)&&!e.type?e:S(e.target.value)?e.target.checked:e.target.value;var t})(t);return K(a),M.current=a,a},[]),U=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");D.current[a]?D.current[a]=Object.assign({ref:D.current[a].ref},l):(m(Object.defineProperties({name:a,focus:P.current},{value:{set(e){K(e),M.current=e},get:()=>M.current}}),l),e=S(N(s.current,a))),e&&F&&K(w())},[l,a,m]);t.useEffect(()=>()=>d(a),[a]),t.useEffect(()=>{"production"!==process.env.NODE_ENV&&(S(O)&&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)`),!F&&S(n)&&console.warn("📋 Controller is missing `defaultValue` prop when using `useFieldArray`. https://react-hook-form.com/api#Controller")),U()},[U]),t.useEffect(()=>{!D.current[a]&&U(!0)});const H=t.useCallback(()=>{R.current.touched&&!N(k,a)&&(function(e,t,a){let l=-1;const n=(e=>/^\w*$/.test(e))(t)?[t]:b(t.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split(".")),r=n.length,o=r-1;for(;++l<r;){const t=n[l];let a=!0;if(l!==o){const r=e[t];a=C(r)||Array.isArray(r)?r:isNaN(+n[l+1])?{}:[]}e[t]=a,e=e[t]}}(k,a),I({touched:k})),B(!0)&&u(a)},[a,I,B,u,R]);return{field:{onChange:t.useCallback(function(){for(var e=arguments.length,t=new Array(e),l=0;l<e;l++)t[l]=arguments[l];return c(a,z(t),{shouldValidate:B(),shouldDirty:!0})},[c,a,B]),onBlur:H,name:a,value:O,ref:Y},meta:Object.defineProperties({invalid:!!N(T,a)},{isDirty:{get:()=>!!N(_.dirtyFields,a)},isTouched:{get:()=>!!N(_.touched,a)}})}}(e),i=Object.assign(Object.assign({},n),r);return a?t.isValidElement(a)?t.cloneElement(a,i):t.createElement(a,i):l?l(r,o):null},_=e=>{let{searchFormState:t,controlSearchForm:n}=e;const{t:o}=l.useTranslation(),{errors:i}=t;return a.createElement(a.Fragment,null,a.createElement("span",{className:"mobile-input"},a.createElement(r.Label,{className:"flex-roww flex-gap-2"},o("EKYC_K_NUMBER")||"K Number",a.createElement(r.CustomTooltip,{message:o("EKYC_K_NUMBER_MESSAGE")})),a.createElement(y,{name:"kNumber",control:n,defaultValue:"",rules:{pattern:{value:/^[a-zA-Z0-9-_/]*$/,message:o("ERR_INVALID_APPLICATION_NO")}},render:e=>{let{onChange:t,value:l}=e;return a.createElement(r.TextInput,{value:l||"",onChange:e=>t(e.target.value)})}}),(null==i?void 0:i.kNumber)&&a.createElement(r.CardLabelError,null,i.kNumber.message)))},x=e=>{var l,o,i,s,c;let{parentRoute:m,businessService:d="EKYC",initialStates:p={}}=e;const v=Digit.ULBService.getCurrentTenantId(),g=n.useLocation(),[C,b]=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"}}),S=t.useMemo(()=>{var e,t;return{tenantId:v,offset:(null==C||null===(e=C.tableForm)||void 0===e?void 0:e.offset)||0,limit:(null==C||null===(t=C.tableForm)||void 0===t?void 0:t.limit)||10,search:(null==C?void 0:C.searchForm)||{}}},[v,null==C||null===(l=C.tableForm)||void 0===l?void 0:l.offset,null==C||null===(o=C.tableForm)||void 0===o?void 0:o.limit,null==C?void 0:C.searchForm]),{isLoading:N,data:f={}}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},S,{enabled:!!v,keepPreviousData:!0}),h=t.useMemo(()=>{var e,t;return{kno:(null==C||null===(e=C.searchForm)||void 0===e?void 0:e.kNumber)||"",name:(null==C||null===(t=C.searchForm)||void 0===t?void 0:t.kName)||""}},[null==C||null===(i=C.searchForm)||void 0===i?void 0:i.kNumber,null==C||null===(s=C.searchForm)||void 0===s?void 0:s.kName]),y=!(!h.kno&&!h.name),{isLoading:x,data:k}=Digit.Hooks.ekyc.useSearchConnection({tenantId:v,details:h},{enabled:!!v&&!!h.kno,keepPreviousData:!0}),T=t.useMemo(()=>{var e;return y?k?[k]:[]:(null==f||null===(e=f.dashboardInfo)||void 0===e?void 0:e.consumerList)||[]},[y,k,f]),I=t.useMemo(()=>(T||[]).map(e=>{var t,a,l,n,r,o;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===(l=e.connectionDetails)||void 0===l?void 0:l.consumerName)||"",applicationNumber:(null===(n=e.propertyInfo)||void 0===n?void 0:n.kno)||"",citizenName:(null===(r=e.connectionDetails)||void 0===r?void 0:r.consumerName)||"",status:(null===(o=e.connectionDetails)||void 0===o?void 0:o.statusflag)||"",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||"",sla:e.sla??0}}),[T]),R=(null==f||null===(c=f.dashboardInfo)||void 0===c?void 0:c.totalRecords)||(null==f?void 0:f.totalCount)||0,D=g.pathname.includes("ekyc/inbox"),A={headerText:D?"MODULE_WATER":"MODULE_SW"},L=t.useCallback(e=>{let{registerRef:t,searchFormState:l,controlSearchForm:n}=e;return a.createElement(_,{registerRef:t,searchFormState:l,controlSearchForm:n,className:"search"})},[]),F={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},w={mobileNumber:"",applicationNumber:"",consumerNo:""},O={SearchFormFields:L,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),b({action:"mutateTableForm",data:{...F},checkPathName:D}),b({action:"mutateSearchForm",data:e,checkPathName:D})},searchFormDefaultValues:null==C?void 0:C.searchForm,resetSearchFormDefaultValues:w,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),b({action:"mutateSearchForm",data:w})},className:"search-form-wns-inbox"},K={FilterFormFields:t.useCallback(e=>a.createElement(a.Fragment,null),[]),onFilterFormSubmit:()=>{},filterFormDefaultValues:"",resetFilterFormDefaultValues:"",onFilterFormReset:()=>{}},M=E({parentRoute:m,onPageSizeChange:e=>{const t=Number(e.target.value);b({action:"mutateTableForm",data:{...C.tableForm,limit:t,offset:0},checkPathName:D})},formState:C,totalCount:R,table:I,dispatch:b,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,l=a?"DESC":"ASC";C.tableForm.sortBy===t&&C.tableForm.sortOrder===l||b({action:"mutateTableForm",data:{...C.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"},checkPathName:D})}},tenantId:v,checkPathName:D,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(r.InboxComposer,u({isInboxLoading:N||x,PropsForInboxLinks:A},O,K,{propsForInboxTable:M,formState:C})))},k=e=>{let{size:t=18,color:l="currentColor"}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:l,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"}))},T=e=>{let{size:t=18,color:l="currentColor"}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),a.createElement("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"}))},I=e=>{let{size:t=14}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("polyline",{points:"3 6 5 6 21 6"}),a.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}))},R=e=>{let{size:t=14}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.createElement("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"}))},D=e=>{let{size:t=12}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),a.createElement("circle",{cx:"12",cy:"10",r:"3"}))},A=e=>{let{size:t=16}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}))},L=e=>{let{size:t=16}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),a.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),a.createElement("polyline",{points:"7 3 7 8 15 8"}))},F=e=>{let{size:t=16}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("polyline",{points:"20 6 9 17 4 12"}))},w=e=>{let{size:t=16}=e;return a.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))},O=[{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"}],M=e=>{let{mapping:t,onConfirm:l,onCancel:n}=e;return a.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3}},a.createElement("div",{style:{background:"#fff",borderRadius:"12px",padding:"28px 28px 24px",width:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.15)"}},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"}},a.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"50%",background:"#FEF3F2",display:"flex",alignItems:"center",justifyContent:"center"}},a.createElement(I,{size:18})),a.createElement("div",null,a.createElement("div",{style:{fontWeight:"700",fontSize:"16px",color:"#0D1B2A"}},"Remove Mapping"),a.createElement("div",{style:{fontSize:"12px",color:"#6B7B8E"}},"This action cannot be undone"))),a.createElement("p",{style:{fontSize:"13px",color:"#344054",marginBottom:"24px",lineHeight:"1.6"}},"Are you sure you want to remove the mapping between"," ",a.createElement("strong",null,null==t?void 0:t.surveyorName)," and ",a.createElement("strong",null,null==t?void 0:t.mrdName),"?"),a.createElement("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"}},a.createElement("button",{onClick:n,style:{background:"none",border:"1px solid #D0D5DD",borderRadius:"8px",padding:"8px 20px",fontWeight:"600",fontSize:"13px",color:"#344054",cursor:"pointer"}},"Cancel"),a.createElement("button",{onClick:l,style:{background:"#B42318",border:"none",borderRadius:"8px",padding:"8px 20px",fontWeight:"600",fontSize:"13px",color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},a.createElement(I,{size:13})," Remove"))))},Y=()=>{const{t:e}=l.useTranslation(),[n,o]=t.useState(null),[i,s]=t.useState(null),[c,m]=t.useState([]),[d,u]=t.useState(null),[E,p]=t.useState(null),[v,g]=t.useState(null),[C,b]=t.useState(null),[S,N]=t.useState(null),f=()=>{u(null),p(null),g(null)},h=t.useMemo(()=>[{Header:e("EKYC_SURVEYOR_NAME")||"Surveyor",accessor:"surveyorName",Cell:t=>{let{row:l}=t;return d===l.original.id?a.createElement("div",{style:{minWidth:"180px"}},a.createElement(r.Dropdown,{selected:E,select:p,option:O,optionKey:"name",t:e,placeholder:"Choose surveyor..."})):a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},a.createElement(k,{size:15,color:"#3A7BD5"})),a.createElement("div",null,a.createElement("div",{style:{fontWeight:"600",fontSize:"13px",color:"#0D1B2A"}},l.original.surveyorName),a.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"ID: ",l.original.surveyorId)))}},{Header:e("EKYC_MRD_ASSIGNED")||"MRD Assigned",accessor:"mrdName",Cell:t=>{let{row:l}=t;return d===l.original.id?a.createElement("div",{style:{minWidth:"200px"}},a.createElement(r.Dropdown,{selected:v,select:g,option:K,optionKey:"name",t:e,placeholder:"Choose MRD..."})):a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},a.createElement(T,{size:15,color:"#3A7BD5"})),a.createElement("div",null,a.createElement("div",{style:{fontWeight:"600",fontSize:"13px",color:"#0D1B2A"}},l.original.mrdName),a.createElement("div",{style:{fontSize:"11px",color:"#3A7BD5",display:"flex",alignItems:"center",gap:"3px"}},a.createElement(D,{size:10})," ",l.original.zone)))}},{Header:e("ES_COMMON_ACTION")||"Actions",Cell:e=>{let{row:t}=e;return d===t.original.id?a.createElement("div",{style:{display:"flex",gap:"8px"}},a.createElement("button",{onClick:()=>{return e=t.original.id,void(E&&v?c.some(t=>t.id!==e&&t.surveyorId===E.id&&t.mrdCode===v.code)?N({type:"warning",message:"This mapping already exists"}):(m(t=>t.map(t=>t.id!==e?t:{...t,surveyorName:E.name,surveyorId:E.id,mrdName:v.name,mrdCode:v.code,zone:v.zone})),u(null),N({type:"success",message:"Mapping updated successfully"})):N({type:"error",message:"Please select both Surveyor and MRD to save"}));var e},style:{display:"flex",alignItems:"center",gap:"5px",background:"#3A7BD5",color:"#fff",border:"none",borderRadius:"6px",padding:"6px 12px",fontWeight:"600",fontSize:"12px",cursor:"pointer"}},a.createElement(F,{size:13})," Save"),a.createElement("button",{onClick:f,style:{display:"flex",alignItems:"center",gap:"5px",background:"none",border:"1px solid #D0D5DD",borderRadius:"6px",padding:"6px 12px",fontWeight:"600",fontSize:"12px",color:"#344054",cursor:"pointer"}},a.createElement(w,{size:13})," Cancel")):a.createElement("div",{style:{display:"flex",gap:"8px"}},a.createElement("button",{onClick:()=>(e=>{u(e.id),p(O.find(t=>t.id===e.surveyorId)||null),g(K.find(t=>t.code===e.mrdCode)||null)})(t.original),style:{display:"flex",alignItems:"center",gap:"5px",background:"none",border:"1px solid #D0D5DD",borderRadius:"6px",padding:"6px 12px",color:"#344054",fontSize:"12px",fontWeight:"600",cursor:"pointer"}},a.createElement(R,{size:13})," Edit"),a.createElement("button",{onClick:()=>b(t.original),style:{display:"flex",alignItems:"center",gap:"5px",background:"none",border:"1px solid #FECDCA",borderRadius:"6px",padding:"6px 12px",color:"#B42318",fontSize:"12px",fontWeight:"600",cursor:"pointer"}},a.createElement(I,{size:13})," Remove"))}}],[d,E,v,c,e]);return a.createElement("div",{style:{background:"#F5F7FA",minHeight:"100vh",padding:"0"}},a.createElement(r.Card,{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",marginBottom:"0",borderRadius:"4px"}},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},a.createElement("div",{style:{color:"#3A8DCC"}},a.createElement(T,{size:24})),a.createElement("div",{style:{fontWeight:"700",fontSize:"18px",color:"#0B0C0C"}},e("EKYC_SURVEYOR_MAPPING")||"Surveyor Mapping")),a.createElement("button",{onClick:()=>{N(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"})},disabled:0===c.length,style:{display:"flex",alignItems:"center",gap:"8px",background:0===c.length?"#D0D5DD":"#0F3460",color:"#fff",border:"none",borderRadius:"8px",padding:"10px 20px",fontWeight:"600",fontSize:"14px",cursor:0===c.length?"not-allowed":"pointer",transition:"background 0.2s"}},a.createElement(L,{size:15}),e("EKYC_SAVE_MAPPINGS")||"Save Mappings")),a.createElement("div",{style:{padding:"24px 32px"}},a.createElement("p",{style:{fontSize:"13px",color:"#6B7B8E",marginBottom:"24px",marginTop:"0"}},e("EKYC_MAPPING_SUBHEADER")||"Assign Meter Reading Dairies to surveyors to manage their data access."),a.createElement("div",{style:{display:"grid",gridTemplateColumns:"360px 1fr",gap:"20px",alignItems:"start"}},a.createElement("div",{style:{background:"#fff",borderRadius:"12px",border:"1px solid #E5E9EF",overflow:"hidden"}},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px 20px",borderBottom:"1px solid #F0F2F5",background:"#FAFBFC"}},a.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center"}},a.createElement(T,{size:16,color:"#3A7BD5"})),a.createElement("span",{style:{fontWeight:"700",fontSize:"15px",color:"#0D1B2A"}},e("EKYC_NEW_MAPPING")||"New Mapping")),a.createElement("div",{style:{padding:"20px"}},a.createElement("div",{style:{marginBottom:"16px"}},a.createElement("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"11px",fontWeight:"700",letterSpacing:"0.06em",color:"#3A7BD5",textTransform:"uppercase",marginBottom:"8px"}},a.createElement(k,{size:12,color:"#3A7BD5"}),e("EKYC_SELECT_SURVEYOR")||"Select Surveyor"),a.createElement(r.Dropdown,{selected:n,select:o,option:O,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_SURVEYOR_PLACEHOLDER")||"Choose a surveyor..."})),a.createElement("div",{style:{marginBottom:"16px"}},a.createElement("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"11px",fontWeight:"700",letterSpacing:"0.06em",color:"#3A7BD5",textTransform:"uppercase",marginBottom:"8px"}},a.createElement(T,{size:12,color:"#3A7BD5"}),e("EKYC_SELECT_MRD")||"Select MRD"),a.createElement(r.Dropdown,{selected:i,select:s,option:K,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_MRD_PLACEHOLDER")||"Choose an MRD..."})),i&&a.createElement("div",{style:{background:"#EEF4FB",borderLeft:"3px solid #3A7BD5",borderRadius:"6px",padding:"10px 14px",fontSize:"12px",color:"#0D1B2A",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"}},a.createElement(D,{size:13}),a.createElement("span",null,a.createElement("strong",null,i.name)," — ",i.zone," Zone")),n&&a.createElement("div",{style:{background:"#F5F7FA",borderLeft:"3px solid #6B7B8E",borderRadius:"6px",padding:"10px 14px",fontSize:"12px",color:"#0D1B2A",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"}},a.createElement(k,{size:13,color:"#6B7B8E"}),a.createElement("span",null,a.createElement("strong",null,n.name)," — ",n.id)),a.createElement("button",{onClick:()=>{n&&i?c.some(e=>e.surveyorId===n.id&&e.mrdCode===i.code)?N({type:"warning",message:e("EKYC_MAPPING_EXISTS")||"This mapping already exists"}):(m(e=>[...e,{id:Date.now(),surveyorName:n.name,surveyorId:n.id,mrdName:i.name,mrdCode:i.code,zone:i.zone}]),s(null),N({type:"success",message:e("EKYC_MAPPING_ADDED")||"Mapping added successfully"})):N({type:"error",message:e("EKYC_SELECT_BOTH_ERROR")||"Please select both Surveyor and MRD"})},disabled:!n||!i,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",background:n&&i?"#3A7BD5":"#D0D5DD",color:"#fff",border:"none",borderRadius:"8px",padding:"12px",fontWeight:"600",fontSize:"14px",cursor:n&&i?"pointer":"not-allowed",marginTop:"4px",transition:"background 0.2s"}},a.createElement(A,{size:16}),e("EKYC_ADD_TO_LIST")||"Add to Mapping List")),c.length>0&&a.createElement("div",{style:{padding:"12px 20px",borderTop:"1px solid #F0F2F5",background:"#FAFBFC",display:"flex",gap:"16px"}},a.createElement("div",{style:{textAlign:"center",flex:1}},a.createElement("div",{style:{fontSize:"20px",fontWeight:"700",color:"#0F3460"}},c.length),a.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"Total Mappings")),a.createElement("div",{style:{width:"1px",background:"#E5E9EF"}}),a.createElement("div",{style:{textAlign:"center",flex:1}},a.createElement("div",{style:{fontSize:"20px",fontWeight:"700",color:"#0F3460"}},[...new Set(c.map(e=>e.surveyorId))].length),a.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"Surveyors")),a.createElement("div",{style:{width:"1px",background:"#E5E9EF"}}),a.createElement("div",{style:{textAlign:"center",flex:1}},a.createElement("div",{style:{fontSize:"20px",fontWeight:"700",color:"#0F3460"}},[...new Set(c.map(e=>e.mrdCode))].length),a.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"MRDs")))),a.createElement("div",{style:{background:"#fff",borderRadius:"12px",border:"1px solid #E5E9EF",overflow:"hidden",minHeight:"420px"}},a.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #F0F2F5",background:"#FAFBFC"}},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center"}},a.createElement(k,{size:16,color:"#3A7BD5"})),a.createElement("span",{style:{fontWeight:"700",fontSize:"15px",color:"#0D1B2A"}},e("EKYC_MAPPING_SUMMARY")||"Mapping Summary")),a.createElement("span",{style:{background:c.length>0?"#0F3460":"#E5E9EF",color:c.length>0?"#fff":"#6B7B8E",fontSize:"12px",fontWeight:"700",padding:"3px 10px",borderRadius:"20px"}},c.length," ",e("EKYC_ITEMS")||"items")),a.createElement("div",{style:{padding:"20px"}},c.length>0?a.createElement("div",{style:{border:"1px solid #E5E9EF",borderRadius:"8px",overflow:"hidden"}},a.createElement(r.Table,{t:e,data:c,columns:h,getCellProps:()=>({}),tableClassName:"digit-table"})):a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"320px",textAlign:"center"}},a.createElement("div",{style:{marginBottom:"16px",opacity:.2}},a.createElement(T,{size:56,color:"#0F3460"})),a.createElement("div",{style:{fontSize:"15px",fontWeight:"700",color:"#0D1B2A",marginBottom:"6px"}},e("EKYC_NO_MAPPINGS")||"No Mappings Created Yet"),a.createElement("div",{style:{fontSize:"13px",color:"#6B7B8E"}},e("EKYC_NO_MAPPINGS_HINT")||"Select a surveyor and MRD on the left to get started.")))))),C&&a.createElement(M,{mapping:C,onConfirm:()=>{m(e=>e.filter(e=>e.id!==C.id)),b(null),N({type:"info",message:e("EKYC_MAPPING_REMOVED")||"Mapping removed"})},onCancel:()=>b(null)}),S&&a.createElement(r.Toast,{label:S.message,error:"error"===S.type,warning:"warning"===S.type,isDsc:!0,onClose:()=>N(null)}))},P=e=>{let{kNumber:o,kName:i,connectionDetails:s,isLoading:c}=e;const{t:m}=l.useTranslation(),d=n.useHistory(),{path:u}=n.useRouteMatch(),[E,p]=t.useState(!1),[v,g]=t.useState({code:"SELF",name:"EKYC_SELF"});if(c)return a.createElement(r.Loader,null);if(!s)return null;const C=(null==s?void 0:s.connectionDetails)||{},b=C.statusflag||"",S="active"===(null==b?void 0:b.toLowerCase())||"A"===b;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"},m("EKYC_K_NUMBER_DETAILS")||"Consumer Identity Details")),a.createElement("span",{className:"status-badge "+(S?"active":"inactive")},S?m("EKYC_ACTIVE_CONNECTION")||"Active Connection":b||m("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"},m("EKYC_VERIFICATION_PARAMETERS")||"Verification Parameters"),a.createElement("div",{className:"data-grid"},a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},m("EKYC_CONSUMER_NAME")||"Consumer Name"),a.createElement("div",{className:"data-value"},C.consumerName||i||m("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},m("EKYC_K_NUMBER")||"K Number"),a.createElement("div",{className:"data-value blue"},o||m("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},m("EKYC_METER_NO")||"Meter Serial No."),a.createElement("div",{className:"data-value"},C.meterNumber||m("CS_NA"))),a.createElement("div",{className:"data-item"},a.createElement("div",{className:"data-label"},m("EKYC_CONNECTION_TYPE")||"Connection Type"),a.createElement("div",{className:"data-value"},C.connectionType||m("CS_NA"))))),a.createElement("div",{className:"vertical-divider"}),a.createElement("div",{className:"detail-section"},a.createElement("div",{className:"section-title"},m("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"},m("EKYC_ADDRESS")||"Service Address"),a.createElement("div",{className:"address-text"},C.address||m("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"},m("EKYC_PHONE_NO")||"Contact"),a.createElement("div",{className:"address-text"},C.phoneNumber||m("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"},m("EKYC_EMAIL")||"Email Address"),a.createElement("div",{className:"address-text"},C.email||m("CS_NA")))))))),a.createElement("div",{className:"details-card-footer"},a.createElement("div",{className:"footer-meta-text"},null!=s&&s.lastVerified?`${m("EKYC_LAST_VERIFIED")||"Last verified:"} ${s.lastVerified}`:""),a.createElement("div",{className:"action-btns-container",style:{fontSize:"12px"}},a.createElement("button",{onClick:()=>p(!0),className:"primary-action-btn",style:{fontSize:"12px"}},m("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"}))))))),E&&a.createElement(r.Modal,{headerBarMain:m("EKYC_SELECT_VERIFICATION_TYPE"),headerBarEnd:a.createElement("span",{onClick:()=>p(!1),style:{cursor:"pointer",padding:"8px"}},"X"),actionSaveLabel:m("ES_COMMON_CONFIRM"),actionSaveOnSubmit:()=>{const e=u.includes("/create-kyc")?u.replace("/create-kyc",""):u.replace("/k-details","");d.push(e+"/consumer-details",{kNumber:o,selectedOption:v,connectionDetails:s}),p(!1)},actionCancelLabel:m("ES_COMMON_CANCEL"),actionCancelOnSubmit:()=>p(!1),style:{borderRadius:"12px"}},a.createElement("div",{style:{padding:"24px"}},a.createElement(r.RadioButtons,{name:"verificationType",options:[{code:"SELF",name:"EKYC_SELF"},{code:"OTHER",name:"EKYC_OTHER"}],optionsKey:"name",selectedOption:v,onSelect:g,style:{display:"flex",flexDirection:"column",gap:"12px",buttonStyle:{borderRadius:"5px"}},t:m}))))},B=()=>{const{t:e}=l.useTranslation(),[n,o]=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),[u,E,p]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{}),v=Digit.ULBService.getCurrentTenantId(),{isLoading:g,data:C}=Digit.Hooks.ekyc.useSearchConnection({tenantId:v,details:{kno:n.kNumber,name:n.kName}},{enabled:i&&!!n.kNumber&&!!n.kName,onError:t=>{var a,l,n,r;d({error:!0,label:(null==t||null===(a=t.response)||void 0===a||null===(l=a.data)||void 0===l||null===(n=l.Errors)||void 0===n||null===(r=n[0])||void 0===r?void 0:r.message)||e("EKYC_SEARCH_ERROR_PLEASE_ENTER_THE_CORRECT_CREDENTIALS")}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED")}});return a.createElement(m,{onSearch:t=>{if(!t.kNumber&&!t.kName)return o({kNumber:"",kName:""}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS"),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED"),void p();t.kNumber&&t.kName?(o(t),s(!0),sessionStorage.getItem("EKYC_K_NUMBER")!==t.kNumber&&(p(),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:n},i&&a.createElement(P,{kNumber:n.kNumber,kName:n.kName,connectionDetails:C,isLoading:g}),!i&&!g&&a.createElement(r.Card,{style:{textAlign:"center",padding:"40px"}},a.createElement("div",{style:{color:"#667085"}},e("EKYC_SEARCH_TO_VIEW_DETAILS"))),c&&a.createElement(r.Toast,{error:c.error,label:c.label,onClose:()=>{d(null)},isDsc:!0}))},z=e=>{let{jumpTo:t,state:o}=e;l.useTranslation();const i=n.useHistory();return a.createElement(r.LinkButton,{label:a.createElement(r.EditIcon,{style:{marginTop:"-30px",float:"right",position:"relative",bottom:"32px"}}),className:"check-page-link-button",onClick:function(){i.push(t,{...o,isEditing:!0})}})},U=e=>null!=e&&""!==e?e:"N/A",H=(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"):"N/A",V=()=>{var e,o,i,s,c,m,d;const{t:u}=l.useTranslation(),E=n.useHistory(),v=n.useLocation(),[g,C]=t.useState(!1),[b,S]=t.useState(!1),N=v.state||{},{kNumber:f,kno:h,edits:y={}}=N,_=f||h,{aadhaarData:x={},addressDetails:k={},propertyDetails:T={},meterDetails:I={}}=y,R=Digit.ULBService.getCurrentTenantId(),{data:D,isLoading:A}=Digit.Hooks.ekyc.useEkycSearchReview({kno:_,fetchType:"REVIEW"},R,{enabled:!!_}),L=((e,t)=>{const a=e&&Object.keys(e).length>0?e:(null==t?void 0:t.reviewData)||{},l=(null==a?void 0:a.applicationReview)||a,n=(Array.isArray(l)?l[0]:l)||{};return(null==n?void 0:n.newData)||n})(D,N),F=(null==L?void 0:L.connectionDetails)||L||{},w=(null==L?void 0:L.addressDetails)||L||{},O=(null==L?void 0:L.propertyInfo)||L||{},K=(null==L?void 0:L.meterDetails)||L||{},M={consumerName:(null==x?void 0:x.name)||(null==F?void 0:F.consumerName),address:(null==F?void 0:F.address)||(null==F?void 0:F.addressRaw),connectionType:(null==F?void 0:F.connectionType)||(null==F?void 0:F.connectionCategory),meterNumber:(null==F?void 0:F.meterNumber)||(null==F?void 0:F.meterNo),phoneNumber:(null==x?void 0:x.mobileNumber)||(null==F?void 0:F.phoneNumber)||(null==F?void 0:F.mobileNo),email:null==F?void 0:F.email,statusflag:(null==F?void 0:F.statusflag)||(null==F?void 0:F.statusFlag),ekycStatus:null==F?void 0:F.ekycStatus,knumber:(null==F?void 0:F.knumber)||(null==F?void 0:F.kno)||_},Y={fullAddress:(null==k?void 0:k.fullAddress)||(null==w?void 0:w.fullAddress)||(null==w?void 0:w.addressRaw),flatHouseNumber:(null==k?void 0:k.flatHouseNumber)||(null==k?void 0:k.flatNo)||(null==w?void 0:w.flatHouseNumber),buildingTower:(null==k?void 0:k.buildingTower)||(null==k?void 0:k.building)||(null==w?void 0:w.buildingTower),landmark:(null==k?void 0:k.landmark)||(null==w?void 0:w.landmark),pinCode:(null==k?void 0:k.pinCode)||(null==k?void 0:k.pincode)||(null==w?void 0:w.pinCode)||(null==w?void 0:w.pincode),ward:(null==k?void 0:k.ward)||(null==w?void 0:w.ward)||(null==w?void 0:w.locality),assembly:(null==k?void 0:k.assembly)||(null==w?void 0:w.assembly),gpsValid:void 0!==(null==k?void 0:k.gpsValid)?k.gpsValid:null==w?void 0:w.gpsValid,latitude:(null==k?void 0:k.latitude)||(null==w?void 0:w.latitude),longitude:(null==k?void 0:k.longitude)||(null==w?void 0:w.longitude),mobileNo:(null==k?void 0:k.mobileNo)||(null==x?void 0:x.mobileNumber)||(null==w?void 0:w.mobileNo),whatsappNo:(null==k?void 0:k.whatsappNo)||(null==x?void 0:x.whatsappNumber)||(null==w?void 0:w.whatsappNo),email:(null==k?void 0:k.email)||(null==w?void 0:w.email),noOfPerson:(null==k?void 0:k.noOfPerson)||(null==x?void 0:x.noOfPersons)||(null==w?void 0:w.noOfPerson),knumber:(null==k?void 0:k.knumber)||(null==w?void 0:w.knumber)||(null==w?void 0:w.kno)||_,doorPhotoFilestoreId:(null==k?void 0:k.doorPhotoFileStoreId)||(null==w?void 0:w.doorPhotoFilestoreId)},P={kno:(null==O?void 0:O.kno)||_,pidNumber:(null==T?void 0:T.pidNumber)||(null==O?void 0:O.pidNumber),typeOfConnection:(null==T||null===(e=T.connectionTypeData)||void 0===e?void 0:e.label)||(null==O?void 0:O.typeOfConnection),connectionCategory:(null==T||null===(o=T.connectionCategoryData)||void 0===o?void 0:o.label)||(null==O?void 0:O.connectionCategory),userType:(null==T||null===(i=T.userTypeData)||void 0===i?void 0:i.label)||(null==O?void 0:O.userType),numberOfFloors:(null==T||null===(s=T.noOfFloorsData)||void 0===s?void 0:s.label)||(null==O?void 0:O.numberOfFloors),tenantName:null==O?void 0:O.tenantName,tenantMobile:null==O?void 0:O.tenantMobile,ekycStatus:null==O?void 0:O.ekycStatus,propertyDocumentFileStoreId:(null==T?void 0:T.propertyDocumentFileStoreId)||(null==O?void 0:O.propertyDocumentFileStoreId),buildingImageFileStoreId:null==O?void 0:O.buildingImageFileStoreId},B={kno:(null==I?void 0:I.kno)||(null==K?void 0:K.kno)||_,metered:"Metered"===(null==I||null===(c=I.meterStatusData)||void 0===c?void 0:c.value)||(null==K?void 0:K.metered),meterNumber:(null==K?void 0:K.meterNumber)||(null==K?void 0:K.meterNo),meterMake:(null==I?void 0:I.meterMake)||(null==K?void 0:K.meterMake),meterLocationAddress:(null==I?void 0:I.meterLocation)||(null==K?void 0:K.meterLocationAddress),meterLatitude:null==K?void 0:K.meterLatitude,meterLongitude:null==K?void 0:K.meterLongitude,workingStatus:"Working"===(null==I||null===(m=I.workingStatusData)||void 0===m?void 0:m.value)||(null==K?void 0:K.workingStatus),lastBillRaised:"Yes"===(null==I||null===(d=I.lastBillRaisedData)||void 0===d?void 0:d.value)||(null==K?void 0:K.lastBillRaised),systemMeterId:null==K?void 0:K.systemMeterId,meterPhotoFileStoreId:(null==I?void 0:I.meterPhotoFileStoreId)||(null==K?void 0:K.meterPhotoFileStoreId)};if(A||b)return a.createElement(r.Loader,null);const V="/digit-ui/employee/ekyc";return a.createElement("div",{className:"review-container"},a.createElement(r.Card,null,a.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"}},a.createElement(r.CardHeader,{style:{margin:0}},u("EKYC_REVIEW_APPLICATION")),a.createElement("div",{style:{background:"#F9FAFB",border:"0.5px solid #EAECF0",borderRadius:"20px",padding:"4px 14px",fontSize:"12px",color:"#667085"}},u("EKYC_K_NUMBER"),": ",a.createElement("span",{style:{color:"#0B0C0C",fontWeight:"600"}},_))),a.createElement(r.CardSubHeader,null,u("EKYC_CONNECTION_DETAILS")),a.createElement(r.StatusTable,{style:{marginTop:"20px",marginBottom:"30px"}},a.createElement(r.Row,{label:u("EKYC_K_NUMBER"),text:U(M.knumber)}),a.createElement(r.Row,{label:u("EKYC_CONSUMER_NAME"),text:U(M.consumerName)}),a.createElement(r.Row,{label:u("EKYC_ADDRESS"),text:U(M.address)}),a.createElement(r.Row,{label:u("EKYC_CONNECTION_TYPE"),text:U(M.connectionType)}),a.createElement(r.Row,{label:u("EKYC_METER_NO"),text:U(M.meterNumber)}),a.createElement(r.Row,{label:u("EKYC_MOBILE_NO"),text:U(M.phoneNumber)}),a.createElement(r.Row,{label:u("EKYC_EMAIL"),text:U(M.email)}),a.createElement(r.Row,{label:u("EKYC_STATUS_FLAG"),text:U(M.statusflag)}),a.createElement(r.Row,{label:u("EKYC_STATUS"),text:U(M.ekycStatus)})),a.createElement(r.CardSubHeader,null,u("EKYC_ADDRESS_DETAILS")),a.createElement(r.StatusTable,{style:{marginTop:"20px",marginBottom:"30px"}},a.createElement(r.Row,{label:u("EKYC_FULL_ADDRESS"),text:U(Y.fullAddress),actionButton:a.createElement(z,{jumpTo:V+"/address-details",state:{...N,reviewData:D,edits:y}})}),a.createElement(r.Row,{label:u("EKYC_FLAT_HOUSE_NO"),text:U(Y.flatHouseNumber)}),a.createElement(r.Row,{label:u("EKYC_BUILDING_TOWER"),text:U(Y.buildingTower)}),a.createElement(r.Row,{label:u("EKYC_LANDMARK"),text:U(Y.landmark)}),a.createElement(r.Row,{label:u("EKYC_PINCODE"),text:U(Y.pinCode)}),a.createElement(r.Row,{label:u("EKYC_LOCALITY"),text:U(Y.ward)}),a.createElement(r.Row,{label:u("EKYC_ASSEMBLY"),text:U(Y.assembly)}),a.createElement(r.Row,{label:u("EKYC_GPS_VALID"),text:H(Y.gpsValid,u)}),a.createElement(r.Row,{label:u("EKYC_LATITUDE"),text:U(Y.latitude)}),a.createElement(r.Row,{label:u("EKYC_LONGITUDE"),text:U(Y.longitude)}),a.createElement(r.Row,{label:u("EKYC_MOBILE_NO"),text:U(Y.mobileNo)}),a.createElement(r.Row,{label:u("EKYC_WHATSAPP_NO"),text:U(Y.whatsappNo)}),a.createElement(r.Row,{label:u("EKYC_EMAIL"),text:U(Y.email)}),a.createElement(r.Row,{label:u("EKYC_NO_OF_PERSONS"),text:U(Y.noOfPerson)}),a.createElement(r.Row,{label:u("EKYC_K_NUMBER"),text:U(Y.knumber)})),a.createElement(r.CardSubHeader,null,u("EKYC_PROPERTY_INFO")),a.createElement(r.StatusTable,{style:{marginTop:"20px",marginBottom:"30px"}},a.createElement(r.Row,{label:u("EKYC_CONNECTION_CATEGORY"),text:U(P.connectionCategory),actionButton:a.createElement(z,{jumpTo:V+"/property-info",state:{...N,reviewData:D,edits:y}})}),a.createElement(r.Row,{label:u("EKYC_PID_NUMBER"),text:U(P.pidNumber)}),a.createElement(r.Row,{label:u("EKYC_TYPE_OF_CONNECTION"),text:U(P.typeOfConnection)}),a.createElement(r.Row,{label:u("EKYC_USER_TYPE"),text:U(P.userType)}),a.createElement(r.Row,{label:u("EKYC_FLOOR_COUNT"),text:U(P.numberOfFloors)}),a.createElement(r.Row,{label:u("EKYC_TENANT_NAME"),text:U(P.tenantName)}),a.createElement(r.Row,{label:u("EKYC_TENANT_MOBILE"),text:U(P.tenantMobile)}),a.createElement(r.Row,{label:u("EKYC_STATUS"),text:U(P.ekycStatus)})),a.createElement(r.CardSubHeader,null,u("EKYC_METER_DETAILS")),a.createElement(r.StatusTable,{style:{marginTop:"20px",marginBottom:"30px"}},a.createElement(r.Row,{label:u("EKYC_METERED"),text:H(B.metered,u),actionButton:a.createElement(z,{jumpTo:V+"/meter-details",state:{...N,reviewData:D,edits:y}})}),a.createElement(r.Row,{label:u("EKYC_METER_NO"),text:U(B.meterNumber)}),a.createElement(r.Row,{label:u("EKYC_METER_MAKE"),text:U(B.meterMake)}),a.createElement(r.Row,{label:u("EKYC_METER_LOCATION_ADDRESS"),text:U(B.meterLocationAddress)}),a.createElement(r.Row,{label:u("EKYC_METER_LATITUDE"),text:U(B.meterLatitude)}),a.createElement(r.Row,{label:u("EKYC_METER_LONGITUDE"),text:U(B.meterLongitude)}),a.createElement(r.Row,{label:u("EKYC_WORKING_STATUS"),text:H(B.workingStatus,u)}),a.createElement(r.Row,{label:u("EKYC_LAST_BILL_RAISED"),text:H(B.lastBillRaised,u)}),a.createElement(r.Row,{label:u("EKYC_SYSTEM_METER_ID"),text:U(B.systemMeterId)})),a.createElement(r.CardSubHeader,null,u("EKYC_DOCUMENTS")),a.createElement(r.StatusTable,{style:{marginTop:"20px",marginBottom:"30px"}},a.createElement(r.Row,{label:u("EKYC_DOOR_PHOTO"),text:u(Y.doorPhotoFilestoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Y.doorPhotoFilestoreId&&a.createElement(r.GenericFileIcon,{style:{cursor:"pointer"}})}),a.createElement(r.Row,{label:u("EKYC_METER_PHOTO"),text:u(B.meterPhotoFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:B.meterPhotoFileStoreId&&a.createElement(r.GenericFileIcon,{style:{cursor:"pointer"}})}),a.createElement(r.Row,{label:u("EKYC_BUILDING_IMAGE"),text:u(P.buildingImageFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:P.buildingImageFileStoreId&&a.createElement(r.GenericFileIcon,{style:{cursor:"pointer"}})}),a.createElement(r.Row,{label:u("EKYC_PROPERTY_DOCUMENTS"),text:u(P.propertyDocumentFileStoreId?"EKYC_DOCS_AVAILABLE":"CS_NA"),actionButton:P.propertyDocumentFileStoreId&&a.createElement(r.GenericFileIcon,{style:{cursor:"pointer"}})})),a.createElement(r.CheckBox,{id:"agreeDeclaration",name:"agreeDeclaration",label:u("EKYC_FINAL_DECLARATION"),onChange:()=>C(!g),checked:g,style:{marginTop:"20px"}})),a.createElement(r.ActionBar,{style:{position:"static",marginTop:"24px"}},a.createElement(r.SubmitBar,{label:u("EKYC_SUBMIT_APPLICATION"),onSubmit:function(){try{S(!0);const e=function(e,t){try{var a=p(function(){return Promise.resolve(Digit.EkycService.application_update({kno:_,tenantId:R,newData:{connectionDetails:M,addressDetails:Y,propertyInfo:P,meterDetails:B}},R)).then(function(e){e&&E.push("/digit-ui/employee/ekyc/response",{success:!0,result:e})})},function(e){console.error("Submit Error:",e)})}catch(e){return t(!0,e)}return a&&a.then?a.then(t.bind(null,!1),t.bind(null,!0)):t(!1,a)}(0,function(e,t){if(S(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disabled:!g})))};var W,j=(W=a.createContext(void 0),"undefined"!=typeof window&&(window.ReactQueryClientContext=W),W);const G=e=>{let{config:l,onSelect:n}=e;const[o,i]=t.useState(""),[s,c]=t.useState(null),[m,d]=t.useState(null),[u,E]=t.useState(null),[v,g]=t.useState(""),[C,b]=t.useState(""),[S,N]=t.useState(""),[f,h]=t.useState(""),[y,_]=t.useState(null),[x,k]=t.useState(""),[T,I]=t.useState(""),[R,D]=t.useState(""),[A,L]=t.useState(""),[F,w]=t.useState(""),[O,K]=t.useState(null),[M,Y]=t.useState(null),[P,B]=t.useState(""),[z,U]=t.useState(""),[H,V]=t.useState(""),[W,j]=t.useState(""),[G,X]=t.useState(""),[$,q]=t.useState(""),[Z,Q]=t.useState(""),[J,ee]=t.useState(""),[te,ae]=t.useState(""),[le,ne]=t.useState(null),[re,oe]=t.useState(""),[ie,se]=t.useState(null),[ce,me]=t.useState(!1),[de,ue]=t.useState(!0),[Ee,pe]=t.useState(""),[ve,ge]=t.useState(""),[Ce,be]=t.useState(null);return a.createElement(t.Fragment,null,a.createElement(r.FormStep,{onSelect:()=>{o&&s&&m&&u&&C&&T&&F&&!(Number(F)<=0)&&("Tenanted"!==(null==m?void 0:m.name)||M||P)&&ce?n(l.key,{kno:o,consumerType:null==s?void 0:s.name,occupantType:null==m?void 0:m.name,categoryType:null==u?void 0:u.name,consumerName:v,firstName:C,middleName:S,lastName:f,gender:null==y?void 0:y.name,relation:x,mobile:T,whatsapp:R,email:A,residents:F,documentId:M,ownerMobile:P,tenantVerification:z,designation:H,department:W,employeeId:G,landline:$,entityRelation:Z,contactPerson:J,entityName:te,idProof:null==le?void 0:le.name,idNumber:re,consent:ce,informantIsConsumer:de,informantName:Ee,informantRelation:ve}):be({type:"error",message:"Fill required fields"})},config:l},a.createElement("div",null,a.createElement(r.CardLabel,null,"K Number *"),a.createElement(r.TextInput,{value:o,onChange:e=>i(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Consumer Type *"),a.createElement(r.Dropdown,{option:[{name:"Individual"},{name:"Govt"},{name:"Company_Society_Org"}],selected:s,select:c})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Occupant Type *"),a.createElement(r.Dropdown,{option:[{name:"Self"},{name:"Tenanted"}],selected:m,select:d})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Category Type *"),a.createElement(r.Dropdown,{option:[],selected:u,select:E})),a.createElement("div",null,a.createElement(r.CardLabel,null,"First Name *"),a.createElement(r.TextInput,{value:C,onChange:e=>b(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Middle Name"),a.createElement(r.TextInput,{value:S,onChange:e=>N(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Last Name"),a.createElement(r.TextInput,{value:f,onChange:e=>h(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Gender"),a.createElement(r.Dropdown,{option:[{name:"Male"},{name:"Female"},{name:"Others"},{name:"Not prefer to say"}],selected:y,select:_})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Mobile *"),a.createElement(r.TextInput,{value:T,onChange:e=>I(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"WhatsApp"),a.createElement(r.TextInput,{value:R,onChange:e=>D(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Email"),a.createElement(r.TextInput,{value:A,onChange:e=>L(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"No. of Residents *"),a.createElement(r.TextInput,{value:F,onChange:e=>w(e.target.value)})),"Tenanted"===(null==m?void 0:m.name)&&a.createElement(t.Fragment,null,a.createElement("div",null,a.createElement(r.CardLabel,null,"Document Proof"),a.createElement(r.UploadFile,{onUpload:e=>function(e,t,a){try{const l=e.target.files[0];if(!l)return Promise.resolve();const n=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",l)).then(function(e){var n,r,o;const i=null==e||null===(n=e.data)||void 0===n||null===(r=n.files)||void 0===r||null===(o=r[0])||void 0===o?void 0:o.fileStoreId;i&&(t(l.name),a(i))})},function(){be({type:"error",message:"Upload failed"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(e,K,Y)})),!M&&a.createElement(t.Fragment,null,a.createElement("div",null,a.createElement(r.CardLabel,null,"Owner Mobile *"),a.createElement(r.TextInput,{value:P,onChange:e=>B(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Tenant Verification"),a.createElement(r.TextInput,{value:z,onChange:e=>U(e.target.value)})))),"Govt"===(null==s?void 0:s.name)&&a.createElement(t.Fragment,null,a.createElement("div",null,a.createElement(r.CardLabel,null,"Designation"),a.createElement(r.TextInput,{value:H,onChange:e=>V(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Department"),a.createElement(r.TextInput,{value:W,onChange:e=>j(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Employee ID"),a.createElement(r.TextInput,{value:G,onChange:e=>X(e.target.value)}))),"Company_Society_Org"===(null==s?void 0:s.name)&&a.createElement(t.Fragment,null,a.createElement("div",null,a.createElement(r.CardLabel,null,"Entity Name"),a.createElement(r.TextInput,{value:te,onChange:e=>ae(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Contact Person"),a.createElement(r.TextInput,{value:J,onChange:e=>ee(e.target.value)})))))},X=[{body:[{route:"consumer-details",component:G,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,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"}]}]}],$=e=>{let{path:o}=e;!function(){var e;if(!a.useContext("undefined"!=typeof window&&null!=(e=window.ReactQueryClientContext)?e:j))throw new Error("No QueryClient set, use QueryClientProvider to set one")}();const i=n.useRouteMatch(),{t:s}=l.useTranslation(),c=n.useLocation(),{pathname:m}=c,d=n.useHistory();let u=[];const[E,p,v]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{});function g(e,t,a,l,n){void 0===n&&(n=!1),p({...E,[e]:{...E[e],...t}}),((e,t,a,l)=>{let n=m.split("/").pop(),r=u.find(e=>l?e.key===l:e.route===n);r||(r=u.find(e=>e.route===n));let s=null;const c=u.findIndex(e=>e.route===r.route);c>-1&&c<u.length-1&&(s=u[c+1].route);let p=d.push;e&&(p=d.replace);const v=o||i.path.split("/").slice(0,-1).join("/");if(null===s)return p(v+"/review",{...E,edits:E});p(`${v}/${s}`,{...E})})(a,0,0,e)}Digit.UserService.getUser(),Digit.ULBService.getCurrentTenantId(),t.useEffect(()=>{if(c.state&&Object.keys(c.state).length>0){const{edits:e,...t}=c.state;p({...E,...t,...e})}},[c.state]),X.forEach(e=>{u=u.concat(e.body)}),u.indexRoute="consumer-details";const C=u.map(e=>e.route),b=C.some(e=>m.includes(e)),S=t.useRef({});return t.useEffect(()=>{if(b){const e=m.split("/").pop();S.current[e]&&S.current[e].scrollIntoView({behavior:"smooth",block:"start"})}},[m,b]),a.createElement(a.Fragment,null,a.createElement("div",{className:"employee-form-section-wrapper"},a.createElement(r.VerticalTimeline,{config:u,showFinalStep:!0}),a.createElement("div",{className:"employee-form-section"},a.createElement(n.Switch,null,a.createElement(n.Route,{path:C.map(e=>`${o||i.path.split("/").slice(0,-1).join("/")}/${e}`)},a.createElement("div",{className:"single-page-form-container"},u.map((e,t)=>{const{component:l}=e,n="string"==typeof l?Digit.ComponentRegistryService.getComponent(l):l;return a.createElement("div",{key:t,ref:t=>S.current[e.route]=t,className:"form-section-unit"},a.createElement(n,{config:{...e,isCollapsible:!0,defaultOpen:!0},onSelect:g,t:s,formData:E}))}))),a.createElement(n.Route,null,a.createElement(n.Redirect,{to:`${o||i.path.split("/").slice(0,-1).join("/")}/${u.indexRoute}`}))))))},q=e=>{let{path:t}=e;const{t:o}=l.useTranslation(),i=n.useLocation();sessionStorage.removeItem("revalidateddone");const s=[{icon:r.HomeIcon,path:"/digit-ui/employee"},{label:o((()=>{const e=i.pathname;return e.includes("/dashboard")?"ES_COMMON_INBOX":e.includes("/create-kyc")?"EKYC_CREATE_KYC":e.includes("/k-details")?"EKYC_K_DETAILS":e.includes("/consumer-details")?"EKYC_CONSUMER_DETAILS":e.includes("/address-details")?"EKYC_ADDRESS_DETAILS":e.includes("/property-info")?"EKYC_PROPERTY_INFO":e.includes("/meter-details")?"EKYC_METER_DETAILS":e.includes("/review")?"EKYC_REVIEW":"ES_COMMON_INBOX"})())}];return a.createElement(r.AppContainer,null,a.createElement("div",{className:"ground-container employee-app-container form-container"},a.createElement(r.ModuleHeader,{leftContent:a.createElement(a.Fragment,null,a.createElement(r.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:s}),a.createElement("div",{className:"employee-form"},a.createElement("div",{className:"employee-form-content"},a.createElement(n.Switch,null,a.createElement(r.PrivateRoute,{path:t+"/dashboard",component:()=>a.createElement(c,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0})}),a.createElement(r.PrivateRoute,{path:t+"/inbox",component:()=>a.createElement(x,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0})}),a.createElement(r.PrivateRoute,{path:t+"/create-kyc",component:()=>a.createElement(B,null)}),a.createElement(r.PrivateRoute,{path:t+"/mapping",component:()=>a.createElement(Y,null)}),a.createElement(r.PrivateRoute,{path:["consumer-details","address-details","property-info","meter-details"].map(e=>`${t}/${e}`),component:e=>a.createElement($,u({},e,{path:t}))}),a.createElement(r.PrivateRoute,{path:t+"/review",component:()=>a.createElement(V,null)}))))))},Z=e=>{var n,o,i,s,c;let{config:m,onSelect:d}=e;const{t:u}=l.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),[v,g]=t.useState(""),[C,b]=t.useState(""),[S,N]=t.useState(""),[f,h]=t.useState(""),[y,_]=t.useState(null),[x,k]=t.useState(""),[T,I]=t.useState(null),[R,D]=t.useState(null),[A,L]=t.useState(null),[F,w]=t.useState(""),[O,K]=t.useState(""),[M,Y]=t.useState(null),[P,B]=t.useState(null),[z,U]=t.useState(null),[H,V]=t.useState(null),{data:W,isLoading:j}=Digit.Hooks.useCommonMDMS(E,"egov-location",["TenantBoundary"]),G=(null==W||null===(n=W.MdmsRes)||void 0===n||null===(o=n["egov-location"])||void 0===o||null===(i=o.TenantBoundary)||void 0===i||null===(s=i[0])||void 0===s||null===(c=s.boundary)||void 0===c?void 0:c.children)||[];return t.useEffect(()=>{let e=!0;return navigator.geolocation&&navigator.geolocation.getCurrentPosition(t=>{e&&(w(t.coords.latitude),K(t.coords.longitude))},()=>{e&&V({type:"error",message:"GPS access denied"})}),()=>{e=!1}},[]),j?a.createElement(r.Loader,null):a.createElement(t.Fragment,null,a.createElement(r.FormStep,{t:u,onSelect:()=>{v&&C&&6===x.length&&T&&R&&A&&F&&O&&z?d(m.key,{houseNo:v,street:C,locality:S,landmark:f,subLocality:y,pinCode:x,assembly:null==T?void 0:T.name,ward:null==R?void 0:R.name,zone:null==A?void 0:A.name,latitude:F,longitude:O,addressType:null==M?void 0:M.name,doorPhotoFilestoreId:z}):V({type:"error",message:"Please fill all mandatory fields"})},config:m,label:u("ES_COMMON_CONTINUE")},a.createElement(r.CardLabel,null,"House No / Flat No *"),a.createElement(r.TextInput,{value:v,onChange:e=>g(e.target.value)}),a.createElement(r.CardLabel,null,"Street / Address Line *"),a.createElement(r.TextInput,{value:C,onChange:e=>b(e.target.value)}),a.createElement(r.CardLabel,null,"Locality"),a.createElement(r.TextInput,{value:S,onChange:e=>N(e.target.value)}),a.createElement(r.CardLabel,null,"Landmark"),a.createElement(r.TextInput,{value:f,onChange:e=>h(e.target.value)}),a.createElement(r.CardLabel,null,"Sub Locality"),a.createElement(r.Dropdown,{option:[],selected:y,select:_}),a.createElement(r.CardLabel,null,"PIN Code *"),a.createElement(r.TextInput,{value:x,onChange:e=>{const t=e.target.value;/^\d{0,6}$/.test(t)&&(k(t),6===t.length&&console.log("Fetching location for PIN:",t))},maxLength:6}),a.createElement(r.CardLabel,null,"Assembly *"),a.createElement(r.Dropdown,{option:G,selected:T,select:I}),a.createElement(r.CardLabel,null,"Ward *"),a.createElement(r.Dropdown,{option:(null==T?void 0:T.children)||[],selected:R,select:D}),a.createElement(r.CardLabel,null,"Zone *"),a.createElement(r.Dropdown,{option:(null==R?void 0:R.children)||[],selected:A,select:L}),a.createElement(r.CardLabel,null,"Latitude"),a.createElement(r.TextInput,{value:F,disabled:!0}),a.createElement(r.CardLabel,null,"Longitude"),a.createElement(r.TextInput,{value:O,disabled:!0}),a.createElement(r.CardLabel,null,"Address Type"),a.createElement(r.Dropdown,{option:[{name:"Permanent"},{name:"Correspondence"},{name:"Other"}],selected:M,select:Y}),a.createElement(r.CardLabel,null,"Door Image *"),a.createElement(r.UploadFile,{onUpload:function(e){try{let a=!1;function t(e){return a?e:()=>{l=!1}}let l=!0;const n=e.target.files[0];if(!n)return Promise.resolve();if(n.size>=2e6)return V({type:"error",message:"Max size 2MB exceeded"}),Promise.resolve();const r=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",n,E)).then(function(e){var t,r,o;if(!l)return void(a=!0);const i=null==e||null===(t=e.data)||void 0===t||null===(r=t.files)||void 0===r||null===(o=r[0])||void 0===o?void 0:o.fileStoreId;if(i){U(i);const e=new FileReader;e.onloadend=()=>{l&&B(e.result)},e.readAsDataURL(n),V({type:"success",message:"Upload successful"})}})},function(){l?V({type:"error",message:"Upload failed"}):a=!0});return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}},onDelete:()=>{B(null),U(null)},message:z?"Uploaded":"No file selected"}),P&&a.createElement("img",{src:P,alt:"preview",style:{width:"100%",marginTop:"10px"}}),H&&a.createElement(r.Toast,{label:H.message,error:"error"===H.type,onClose:()=>V(null)})))},Q=e=>{let{config:n,onSelect:o}=e;const{t:i}=l.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[c,m]=t.useState(""),[d,u]=t.useState(null),[E,v]=t.useState(null),[g,C]=t.useState(""),[b,S]=t.useState(""),[N,f]=t.useState(""),[h,y]=t.useState(""),[_,x]=t.useState(""),[k,T]=t.useState(null),[I,R]=t.useState(null),[D,A]=t.useState(null);return a.createElement(t.Fragment,null,a.createElement(r.FormStep,{t:i,onSelect:()=>{!g||Number(g)<1||!I||"Hotel"===(null==d?void 0:d.name)&&!N||!("Hospital"!==(null==d?void 0:d.name)&&"Nursing Home"!==(null==d?void 0:d.name)||h)?A({type:"error",message:"Fill all required fields"}):o(n.key,{pidNumber:c,propertyType:null==d?void 0:d.name,subPropertyCategory:null==E?void 0:E.name,noOfFloors:g,floorNo:b,noOfRooms:N,noOfBeds:h,dwellingUnits:_,buildingImageId:I})},config:n,label:i("ES_COMMON_CONTINUE")},a.createElement("div",null,a.createElement(r.CardLabel,null,"PID Number"),a.createElement(r.TextInput,{value:c,onChange:e=>m(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Property Type"),a.createElement(r.Dropdown,{option:[{name:"Residential"},{name:"Commercial"},{name:"Hotel"},{name:"Hospital"},{name:"Nursing Home"}],selected:d,select:u})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Sub Property Category"),a.createElement(r.Dropdown,{option:[],selected:E,select:v})),a.createElement("div",null,a.createElement(r.CardLabel,null,"No. of Floors *"),a.createElement(r.TextInput,{type:"number",value:g,onChange:e=>C(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Floor No. of this KNO"),a.createElement(r.TextInput,{value:b,onChange:e=>S(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"No of Beds"),a.createElement(r.TextInput,{type:"number",value:h,onChange:e=>y(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"No. of Rooms"),a.createElement(r.TextInput,{type:"number",value:N,onChange:e=>f(e.target.value)})),"Hotel"===(null==d?void 0:d.name)&&a.createElement("div",null,a.createElement(r.CardLabel,null,"No. of Rooms *"),a.createElement(r.TextInput,{type:"number",value:N,onChange:e=>f(e.target.value)})),("Hospital"===(null==d?void 0:d.name)||"Nursing Home"===(null==d?void 0:d.name))&&a.createElement("div",null,a.createElement(r.CardLabel,null,"No. of Beds *"),a.createElement(r.TextInput,{type:"number",value:h,onChange:e=>y(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Number of Dwelling Units"),a.createElement(r.TextInput,{type:"number",value:_,onChange:e=>x(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Building Image *"),a.createElement(r.UploadFile,{onUpload:function(e){try{const t=e.target.files[0];if(!t)return Promise.resolve();if(t.size>2e6)return A({type:"error",message:"Max size 2MB exceeded"}),Promise.resolve();const a=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",t,s)).then(function(e){var a,l,n;const r=null==e||null===(a=e.data)||void 0===a||null===(l=a.files)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.fileStoreId;if(r){R(r);const e=new FileReader;e.onloadend=()=>T(e.result),e.readAsDataURL(t),A({type:"success",message:"Upload successful"})}})},function(){A({type:"error",message:"Upload failed"})});return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},onDelete:()=>{T(null),R(null)},message:I?"Uploaded":"No file selected"})),k&&a.createElement("div",{style:{gridColumn:"span 2"}},a.createElement("img",{src:k,alt:"preview",style:{width:"100%",marginTop:"10px"}})),D&&a.createElement(r.Toast,{label:D.message,error:"error"===D.type,onClose:()=>A(null)})))},J=e=>{let{config:l,onSelect:n}=e;const o=Digit.ULBService.getCurrentTenantId(),[i,s]=t.useState(""),[c,m]=t.useState(""),[d,u]=t.useState(""),[E,v]=t.useState(""),[g,C]=t.useState(""),[b,S]=t.useState(""),[N,f]=t.useState(""),[h,y]=t.useState(""),[_,x]=t.useState(null),[k,T]=t.useState(null),[I,R]=t.useState(null),[D,A]=t.useState(null),[L,F]=t.useState(null),[w,O]=t.useState(""),[K,M]=t.useState(null),[Y,P]=t.useState(null),[B,z]=t.useState(null),[U,H]=t.useState(null),[V,W]=t.useState(null),[j,G]=t.useState(null),X=[{name:"Yes"},{name:"No"}],$=[];for(let e=1998;e<=2026;e++)for(let t=1;t<=12;t++)$.push({name:`${t}/${e}`});const q="Can not be identified"===(null==_?void 0:_.name);return a.createElement(t.Fragment,null,a.createElement(r.FormStep,{onSelect:()=>{i&&_&&I&&D&&Y&&("Metered"!==(null==_?void 0:_.name)||V)&&("No"!==(null==D?void 0:D.name)||w)&&("No"!==(null==Y?void 0:Y.name)||B)?n(l.key,{connectionCategory:i,saType:c,status:d,mrCode:E,areaCode:g,mrKey:b,meterNumber:N,meterMaker:h,meterStatus:null==_?void 0:_.name,meterCondition:null==k?void 0:k.name,meterLocation:null==I?void 0:I.name,lastBillReceived:null==D?void 0:D.name,billMonthYear:null==L?void 0:L.name,reason:w,accessToMeter:null==K?void 0:K.name,sewerConnection:null==Y?void 0:Y.name,septicTank:null==B?void 0:B.name,meterPhotoId:V}):G({type:"error",message:"Fill all mandatory fields"})},config:l},a.createElement("div",null,a.createElement(r.CardLabel,null,"Connection Category *"),a.createElement(r.TextInput,{value:i,onChange:e=>s(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"SA Type"),a.createElement(r.TextInput,{value:c,onChange:e=>m(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Status"),a.createElement(r.TextInput,{value:d,onChange:e=>u(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"MR Code"),a.createElement(r.TextInput,{value:E,onChange:e=>v(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Area Code"),a.createElement(r.TextInput,{value:g,onChange:e=>C(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"MR Key"),a.createElement(r.TextInput,{value:b,onChange:e=>S(e.target.value)})),!q&&a.createElement(t.Fragment,null,a.createElement("div",null,a.createElement(r.CardLabel,null,"Meter Number"),a.createElement(r.TextInput,{value:N,onChange:e=>f(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Meter Maker"),a.createElement(r.TextInput,{value:h,onChange:e=>y(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Meter Condition"),a.createElement(r.Dropdown,{option:[{name:"Damaged"},{name:"Not-Damaged"}],selected:k,select:T})),"Metered"===(null==_?void 0:_.name)&&a.createElement(t.Fragment,null,a.createElement("div",null,a.createElement(r.CardLabel,null,"Meter Photo *"),a.createElement(r.UploadFile,{onUpload:function(e){try{const t=e.target.files[0];if(!t)return Promise.resolve();const a=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",t,o)).then(function(e){var a,l,n;const r=null==e||null===(a=e.data)||void 0===a||null===(l=a.files)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.fileStoreId;if(r){W(r);const e=new FileReader;e.onloadend=()=>H(e.result),e.readAsDataURL(t)}})},function(){G({type:"error",message:"Upload failed"})});return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},message:V?"Uploaded":"No file"})),U&&a.createElement("div",{style:{gridColumn:"span 2"}},a.createElement("img",{src:U,style:{width:"100%"}})))),a.createElement("div",null,a.createElement(r.CardLabel,null,"Meter Status *"),a.createElement(r.Dropdown,{option:[{name:"Metered"},{name:"Unmetered"},{name:"Can not be identified"}],selected:_,select:x})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Meter Location *"),a.createElement(r.Dropdown,{option:[{name:"Inside"},{name:"Outside"}],selected:I,select:R})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Last Bill Received *"),a.createElement(r.Dropdown,{option:X,selected:D,select:A})),"Yes"===(null==D?void 0:D.name)&&a.createElement("div",null,a.createElement(r.CardLabel,null,"When was the last bill received *"),a.createElement(r.Dropdown,{option:$,selected:L,select:F})),"No"===(null==D?void 0:D.name)&&a.createElement("div",null,a.createElement(r.CardLabel,null,"Reason *"),a.createElement(r.TextInput,{value:w,onChange:e=>O(e.target.value)})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Access to Meter"),a.createElement(r.Dropdown,{option:X,selected:K,select:M})),a.createElement("div",null,a.createElement(r.CardLabel,null,"Sewer Connection *"),a.createElement(r.Dropdown,{option:X,selected:Y,select:P})),"No"===(null==Y?void 0:Y.name)&&a.createElement("div",null,a.createElement(r.CardLabel,null,"Septic Tank *"),a.createElement(r.Dropdown,{option:X,selected:B,select:z})),j&&a.createElement(r.Toast,{label:j.message,error:"error"===j.type,onClose:()=>G(null)})))},ee=()=>{const{t:e}=l.useTranslation(),t={moduleName:e("ACTION_TEST_EKYC"),kpis:[{count:"-",label:e("TOTAL_EKYC"),link:"/digit-ui/citizen/ekyc/dashboard"}],links:[{label:e("EKYC_DASHBOARD"),link:"/digit-ui/citizen/ekyc/dashboard"},{label:e("EKYC_INBOX"),link:"/digit-ui/citizen/ekyc/inbox"},{label:e("EKYC_MAPPING"),link:"/digit-ui/citizen/ekyc/mapping"}]};return a.createElement(r.ModuleLinksView,{links:t.links})},te=e=>{var l,o,i,s,c;let{parentRoute:m}=e;const d=Digit.ULBService.getCurrentTenantId(),p=n.useLocation(),[v,g]=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"}}),C=t.useMemo(()=>{var e,t;return{tenantId:d,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,search:(null==v?void 0:v.searchForm)||{}}},[d,null==v||null===(l=v.tableForm)||void 0===l?void 0:l.offset,null==v||null===(o=v.tableForm)||void 0===o?void 0:o.limit,null==v?void 0:v.searchForm]),{isLoading:b,data:S={}}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},C,{enabled:!!d,keepPreviousData:!0}),N=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]),f=!(!N.kno&&!N.name),{isLoading:h,data:y}=Digit.Hooks.ekyc.useSearchConnection({tenantId:d,details:N},{enabled:!!d&&!!N.kno,keepPreviousData:!0}),x=t.useMemo(()=>{var e;return f?y?[y]:[]:(null==S||null===(e=S.dashboardInfo)||void 0===e?void 0:e.consumerList)||[]},[f,y,S]),k=t.useMemo(()=>(x||[]).map(e=>{var t,a,l,n,r,o;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===(l=e.connectionDetails)||void 0===l?void 0:l.consumerName)||"",applicationNumber:(null===(n=e.propertyInfo)||void 0===n?void 0:n.kno)||"",citizenName:(null===(r=e.connectionDetails)||void 0===r?void 0:r.consumerName)||"",status:(null===(o=e.connectionDetails)||void 0===o?void 0:o.statusflag)||"",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||"",sla:e.sla??0}}),[x]),T=(null==S||null===(c=S.dashboardInfo)||void 0===c?void 0:c.totalRecords)||(null==S?void 0:S.totalCount)||0,I=p.pathname.includes("ekyc/inbox"),R={headerText:I?"MODULE_WATER":"MODULE_SW"},D=t.useCallback(e=>{let{registerRef:t,searchFormState:l,controlSearchForm:n}=e;return a.createElement(_,{registerRef:t,searchFormState:l,controlSearchForm:n,className:"search"})},[]),A={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},L={mobileNumber:"",applicationNumber:"",consumerNo:""},F={SearchFormFields:D,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),g({action:"mutateTableForm",data:{...A},checkPathName:I}),g({action:"mutateSearchForm",data:e,checkPathName:I})},searchFormDefaultValues:null==v?void 0:v.searchForm,resetSearchFormDefaultValues:L,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),g({action:"mutateSearchForm",data:L})},className:"search-form-wns-inbox"},w={FilterFormFields:t.useCallback(e=>a.createElement(a.Fragment,null),[]),onFilterFormSubmit:()=>{},filterFormDefaultValues:"",resetFilterFormDefaultValues:"",onFilterFormReset:()=>{}},O=E({parentRoute:m,onPageSizeChange:e=>{const t=Number(e.target.value);g({action:"mutateTableForm",data:{...v.tableForm,limit:t,offset:0},checkPathName:I})},formState:v,totalCount:T,table:k,dispatch:g,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:a}]=e,l=a?"DESC":"ASC";v.tableForm.sortBy===t&&v.tableForm.sortOrder===l||g({action:"mutateTableForm",data:{...v.tableForm,sortBy:t,sortOrder:a?"DESC":"ASC"},checkPathName:I})}},tenantId:d,checkPathName:I,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return a.createElement("div",{className:"app-container"},a.createElement(r.InboxComposer,u({isInboxLoading:b||h,PropsForInboxLinks:R},F,w,{propsForInboxTable:O,formState:v})))},ae=()=>{const{t:e}=l.useTranslation(),t=n.useLocation(),{path:o}=n.useRouteMatch();sessionStorage.removeItem("revalidateddone");const i=[{icon:r.HomeIcon,path:"/digit-ui/citizen"},{label:e((()=>{const e=t.pathname;return e.includes("/create-kyc")?"EKYC_CREATE_KYC":e.includes("/aadhaar-verification")?"EKYC_AADHAAR_VERIFICATION":e.includes("/address-details")?"EKYC_ADDRESS_DETAILS":e.includes("/property-info")?"EKYC_PROPERTY_INFO":e.includes("/meter-details")?"EKYC_METER_DETAILS":e.includes("/review")?"EKYC_REVIEW":"EKYC_HOME"})())}];return a.createElement(r.AppContainer,null,a.createElement("div",{className:"ground-container employee-app-container form-container"},a.createElement(r.ModuleHeader,{leftContent:a.createElement(a.Fragment,null,a.createElement(r.ArrowLeft,{className:"icon"}),e("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:i}),a.createElement(n.Switch,null,a.createElement(r.PrivateRoute,{exact:!0,path:""+o,component:()=>a.createElement(ee,null)}),a.createElement(r.PrivateRoute,{path:o+"/dashboard",component:()=>a.createElement(c,null)}),a.createElement(r.PrivateRoute,{path:o+"/inbox",component:()=>a.createElement(te,null)}),a.createElement(r.PrivateRoute,{path:o+"/aadhaar-verification",component:()=>a.createElement(G,null)}),a.createElement(r.PrivateRoute,{path:o+"/address-details",component:()=>a.createElement(Z,null)}),a.createElement(r.PrivateRoute,{path:o+"/property-info",component:()=>a.createElement(Q,null)}),a.createElement(r.PrivateRoute,{path:o+"/meter-details",component:()=>a.createElement(J,null)}),a.createElement(r.PrivateRoute,{path:o+"/review",component:()=>a.createElement(V,null)}))))},le=e=>{let{userType:t,tenants:l}=e;const{path:r,url:o}=n.useRouteMatch();return Digit.SessionStorage.set("EKYC_TENANTS",l),"employee"===t?a.createElement(q,{path:r,url:o,userType:t,tenants:l}):a.createElement(ae,null)},ne=e=>{let{matchPath:t}=e;const{t:n}=l.useTranslation(),o=[{link:t+"/create-kyc",i18nKey:n("EKYC_CREATE_KYC")},{link:t+"/update-kyc",i18nKey:n("EKYC_UPDATE_KYC")}];return a.createElement(r.CitizenHomeCard,{header:n("EKYC_MODULE_NAME"),links:o,Icon:()=>a.createElement(r.DocumentIcon,{className:"fill-path-primary-main"})})},re={EKYCModule:le,EKYCCard:()=>{const{t:e}=l.useTranslation(),t={Icon:a.createElement(r.PersonIcon,null),moduleName:e("ACTION_TEST_EKYC"),kpis:[{count:"-",label:e("TOTAL_EKYC"),link:"/digit-ui/employee/ekyc/dashboard"}],links:[{label:e("EKYC_DASHBOARD"),link:"/digit-ui/employee/ekyc/dashboard"},{label:e("EKYC_INBOX"),link:"/digit-ui/employee/ekyc/inbox"},{label:e("EKYC_MAPPING"),link:"/digit-ui/employee/ekyc/mapping"}]};return a.createElement(r.EmployeeModuleCard,t)},EKYCInbox:c,EKYCDesktopInbox:e=>{var o;let{filterComponent:i,...c}=e;const{data:m,isLoading:d,onSort:u,onNextPage:E,onPrevPage:p,currentPage:v,pageSizeLimit:g,onPageSizeChange:C,parentRoute:b,searchParams:S,sortParams:N,totalRecords:f,countData:h}=c,{t:y}=l.useTranslation(),_=n.useHistory(),x=Digit.ULBService.getCurrentTenantId(),k=null===(o=Digit.ComponentRegistryService)||void 0===o?void 0:o.getComponent(i),[T,I]=t.useState(""),{data:R,getReview:D}=Digit.Hooks.ekyc.useEkycAPI("review",x),A=e=>{I(e),D({kno:e})};a.useEffect(()=>{R&&_.push("/digit-ui/employee/ekyc/review",{kNumber:T,aadhaarData:null==R?void 0:R.aadhaarData,reviewData:R})},[R]);const L=t.useMemo(()=>[{Header:y("EKYC_APPLICATION_NO"),accessor:"applicationNumber",Cell:e=>{var t,l;let{row:n}=e;const r=(null===(t=n.original)||void 0===t?void 0:t.kno)||(null===(l=n.original)||void 0===l?void 0:l.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>A(r)},r)}},{Header:y("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:l}=e;return a.createElement("span",null,(null===(t=l.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:y("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:l}=e;const n=(null===(t=l.original)||void 0===t?void 0:t.status)||"DEFAULT";return a.createElement("span",{className:"ekyc-status-tag "+n},y(""+n))}},{Header:y("EKYC_ACTION"),accessor:"status",Cell:e=>{var t,l;let{row:n}=e;const r=(null===(t=n.original)||void 0===t?void 0:t.kno)||(null===(l=n.original)||void 0===l?void 0:l.applicationNumber)||"NA";return a.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>A(r)},y("EKYC_REVIEW"))}}],[y,b]),F=t.useMemo(()=>(null==m?void 0:m.items)||[],[m]);return a.createElement("div",{className:"app-container"},a.createElement("div",{className:"inbox-container"},d&&a.createElement(r.Loader,null),a.createElement("div",{className:"side-panel-item"},a.createElement(r.InboxLinks,{headerText:c.moduleCode}),k&&a.createElement(k,{defaultSearchParams:c.defaultSearchParams,onFilterChange:c.onSearch,searchParams:S,type:"desktop",moduleCode:"EKYC"})),a.createElement("div",{className:"employee-form-content",style:{flex:1}},a.createElement(r.Card,{className:"ekyc-metrics-card"},a.createElement(s,{countData:h})),a.createElement("div",{className:"result",style:{flex:1}},a.createElement(r.Card,{className:"ekyc-table-card",style:{padding:0}},a.createElement(r.Table,{t:y,data:F,columns:L,isLoading:d,onSort:u,sortParams:N,totalRecords:f,onNextPage:E,onPrevPage:p,currentPage:v,pageSizeLimit:g,onPageSizeChange:C,getCellProps:e=>({className:"ekyc-table-cell"})}))))))},EKYCMobileInbox:e=>{var t;let{data:o,isLoading:i,onSearch:c,searchParams:d,parentRoute:u,countData:E}=e;const{t:p}=l.useTranslation(),v=(null==o||null===(t=o.items)||void 0===t?void 0:t.map(e=>({[p("EKYC_APPLICATION_NO")]:e.applicationNumber,[p("EKYC_CITIZEN_NAME")]:e.citizenName,[p("EKYC_MOBILE_NO")]:e.mobileNumber,[p("EKYC_STATUS")]:a.createElement("span",{className:"ekyc-status-tag "+e.status},p("EKYC_STATUS_"+e.status))})))||[];return a.createElement("div",{className:"inbox-wrapper"},a.createElement("div",{className:"ekyc-header-container module-header"},a.createElement(r.Header,{className:"title"},p("EKYC_INBOX_HEADER")),a.createElement(n.Link,{to:u+"/create-kyc"},a.createElement(r.SubmitBar,{label:p("EKYC_CREATE_KYC")}))),a.createElement("div",{className:"ekyc-metrics-section"},a.createElement(s,{countData:E})),a.createElement(m,{onSearch:c,searchParams:d}),a.createElement("div",{className:"mobile-data-container"},i?a.createElement(r.Loader,null):(null==v?void 0:v.length)>0?a.createElement(r.DetailsCard,{data:v,t:p,serviceRequestIdKey:p("EKYC_APPLICATION_NO"),linkPrefix:u+"/application-details/"}):a.createElement(r.Card,null,p("ES_COMMON_NO_DATA").split("\\n").map((e,t)=>a.createElement("p",{key:t,style:{textAlign:"center"}},e)))))},EKYC_INBOX_FILTER:e=>a.createElement(d,e),EkycLinks:ne,AadhaarVerification:G,AddressDetails:Z,PropertyInfo:Q,MeterDetails:J};exports.EkycLinks=ne,exports.EkycModule=le,exports.default=le,exports.initEkycComponents=()=>{Object.entries(re).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"),n=e(t),a=require("react-i18next"),l=require("react-router-dom"),r=require("@djb25/digit-ui-react-components"),o=require("chart.js/auto"),i=e(o);require("react-dom");const s=e=>{let{countData:l}=e;const{t:r}=a.useTranslation(),s=t.useRef(null),c=t.useRef(null),d=(null==l?void 0:l.total)||0,u=(null==l?void 0:l.pending)||0,m=(null==l?void 0:l.completed)||0,E=(null==l?void 0:l.completed)||0,p=E,v=d>0?Math.round(E/d*100):0,g=d>0?Math.round(p/d*100):0,C=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(o.Chart||i||o)(e,{type:"doughnut",data:{labels:[r("EKYC_ACTIVE"),r("EKYC_PENDING"),r("EKYC_COMPLETED")],datasets:[{data:[m,u,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()}},[u,0,m,r]);const y=[{color:"#0c2a52",label:r("EKYC_ACTIVE"),value:m},{color:"#77B6EA",label:r("EKYC_PENDING"),value:u},{color:"#c8ddf5",label:r("EKYC_COMPLETED"),value:0}];return n.createElement("div",{className:"ekyc-employee-container"},n.createElement("div",{className:"status-cards-wrapper"},n.createElement("div",{className:"status-cards-header"},n.createElement("div",null,n.createElement("div",{className:"eyebrow"},n.createElement("span",{className:"eyebrow-dot"}),r("EKYC_INSTITUTIONAL_OVERVIEW")||"Institutional Performance Overview"),n.createElement("h1",{className:"status-cards-h1"},r("EKYC_DASHBOARD_TITLE")||"eKYC Verification Dashboard"),n.createElement("p",{className:"status-cards-subtitle"},r("EKYC_DASHBOARD_SUBTITLE")||"Real-time monitoring of consumer verification workflows across all administrative zones.")),n.createElement("div",{className:"total-applications-card"},n.createElement("div",{className:"total-label"},r("EKYC_TOTAL_APPLICATIONS")||"Total Applications Processed"),n.createElement("div",{className:"total-number"},C(d)),n.createElement("div",{className:"total-badge"},"↗ +12.4% ",r("EKYC_FROM_LAST_QUARTER")||"from last quarter"))),n.createElement("div",{className:"status-panels-grid"},n.createElement("div",{className:"status-panel"},n.createElement("div",{className:"panel-title"},r("EKYC_STATUS_BREAKDOWN")||"Status Breakdown"),n.createElement("div",{className:"panel-subtitle"},r("EKYC_VERIFICATION_LIFECYCLE")||"Verification lifecycle distribution"),n.createElement("div",{className:"breakdown-body"},n.createElement("div",{className:"status-legend"},y.map(e=>n.createElement("div",{key:e.label,className:"legend-row"},n.createElement("span",{className:"legend-label"},n.createElement("span",{className:"indicator-dot",style:{background:e.color}}),e.label),n.createElement("span",{className:"legend-value"},C(e.value))))),n.createElement("div",{className:"chart-wrapper"},n.createElement("canvas",{ref:s,style:{width:"100%",height:"100%"}}),n.createElement("div",{className:"chart-center"},n.createElement("div",{className:"chart-percentage"},v,"%"),n.createElement("div",{className:"chart-label"},r("EKYC_COMPLETE")||"Complete"))))),n.createElement("div",{className:"status-panel"},n.createElement("div",{className:"panel-title"},r("EKYC_SUBMISSION_HEALTH")||"Submission Health",n.createElement("span",{className:"optimal-badge"},r("EKYC_OPTIMAL")||"Optimal")),n.createElement("div",{className:"panel-subtitle"},r("EKYC_PLATFORM_EFFICIENCY")||"Platform operational efficiency"),n.createElement("div",{className:"health-metrics-row"},n.createElement("div",{className:"health-percentage"},g,"%"),n.createElement("div",{className:"health-trend"},"↗ +2.1%")),n.createElement("div",{className:"status-progress-bar"},n.createElement("div",{className:"progress-fill",style:{width:g+"%"}})),n.createElement("div",{className:"mini-metrics-grid"},n.createElement("div",{className:"metric-box"},n.createElement("div",{className:"metric-label"},r("EKYC_AVG_LATENCY")||"Avg Latency"),n.createElement("div",{className:"metric-value"},"1.2s")),n.createElement("div",{className:"metric-box"},n.createElement("div",{className:"metric-label"},r("EKYC_ERROR_RATE")||"Error Rate"),n.createElement("div",{className:"metric-value"},"0.04%")))))))},c=()=>{const e=Digit.ULBService.getCurrentTenantId(),{isLoading:a,data:l}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},{tenantId:e,offset:0,limit:10},{enabled:!!e}),o=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 a?n.createElement(r.Loader,null):n.createElement(r.Card,{className:"min-width-full"},n.createElement(s,{countData:o}))},d=e=>{var l,o,i;let{onSearch:s,searchParams:c,children:d,...u}=e;const{t:m}=a.useTranslation(),[E,p]=t.useState(()=>({...c})),v=(e,t)=>{p(n=>({...n,[e]:t}))};return n.createElement("div",{className:"ekyc-employee-container"},n.createElement("div",{className:"search-consumer-wrapper"},n.createElement("div",{className:"header-wrapper"},n.createElement(r.Card,{className:"sidebar-title-card"},n.createElement("div",{className:"icon-container"},n.createElement(r.HomeIcon,null)),n.createElement("div",{className:"title-text"},m("EKYC_SEARCH_CONSUMER_HEADER")))),n.createElement("div",{className:"main-content-wrapper"},n.createElement("div",{className:"search-stats-row"},n.createElement("div",{className:"identity-lookup-card"},n.createElement("div",{className:"lookup-card-title"},n.createElement("div",{className:"lookup-icon-bg"},n.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("circle",{cx:"11",cy:"11",r:"8"}),n.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))),n.createElement("span",{className:"lookup-title-text"},m("EKYC_IDENTITY_LOOKUP")||"Identity Lookup")),n.createElement("form",{onSubmit:e=>{e&&e.preventDefault&&e.preventDefault(),s(E)}},n.createElement("div",{className:"inputs-row"},n.createElement("div",{className:"input-group"},n.createElement("label",null,m("EKYC_K_NUMBER")||"K Number",n.createElement("span",{className:"info-badge"},"i")),n.createElement(r.TextInput,{value:null==E?void 0:E.kNumber,onChange:e=>v("kNumber",e.target.value),placeholder:m("EKYC_K_NUMBER_PLACEHOLDER")||"e.g. 8234910234"})),n.createElement("div",{className:"input-group"},n.createElement("label",null,m("EKYC_K_NAME")||"K Name",n.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),n.createElement("circle",{cx:"12",cy:"7",r:"4"}))),n.createElement(r.TextInput,{value:null==E?void 0:E.kName,onChange:e=>v("kName",e.target.value),placeholder:m("EKYC_K_NAME_PLACEHOLDER")||"Consumer name search"}))),n.createElement("div",{className:"actions-row"},n.createElement("button",{type:"button",onClick:()=>{const e={kNumber:"",kName:""};p(e),s(e)},className:"clear-btn"},m("ES_COMMON_CLEAR")||"Clear"),n.createElement("button",{type:"submit",className:"search-btn"},m("ES_COMMON_SEARCH")||"Execute Search")))),n.createElement("div",{className:"stats-column"},n.createElement("div",{className:"audits-card"},n.createElement("div",{className:"audits-label"},m("EKYC_TODAYS_AUDITS")||"Today's Audits"),n.createElement("div",{className:"audits-count"},(null===(l=u.countData)||void 0===l?void 0:l.todaysAudits)||24),n.createElement("div",{className:"audits-change"},n.createElement("span",null,"↗"),(null===(o=u.countData)||void 0===o?void 0:o.auditChange)||"12% increase from yesterday"),n.createElement("div",{className:"audits-watermark"},"M")),n.createElement("div",{className:"queue-card"},n.createElement("div",{className:"queue-label"},m("EKYC_QUEUE_STATUS")||"Queue Status"),n.createElement("div",{className:"queue-content"},n.createElement("div",{className:"queue-status-text"},(null===(i=u.countData)||void 0===i?void 0:i.pendingCount)||3," Pending"),n.createElement("div",{className:"avatar-group"},[0,1].map(e=>n.createElement("div",{key:e,className:"avatar-item"},String.fromCharCode(65+e))),n.createElement("div",{className:"avatar-more"},"+1")))))),d)))},u=e=>{let{searchParams:l,onFilterChange:o,defaultSearchParams:i,...s}=e;const{t:c}=a.useTranslation(),[d,u]=t.useState(()=>({...l}));return n.createElement(r.FilterForm,{onSubmit:()=>{o(d)},handleSubmit:e=>t=>{t&&t.preventDefault(),e()},onResetFilterForm:()=>{u({...i}),o({...i})},id:"ekyc-filter-form",onMobileExclusiveFilterPopupFormClose:s.onClose},n.createElement(r.FilterFormField,null,n.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},c("EKYC_STATUS"),":"),n.createElement(r.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};u(t),o(t)},selected:(null==d?void 0:d.status)||{label:c("EKYC_STATUS_ALL"),value:""}})))};function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}const E=e=>{var r,o,i;let{onPageSizeChange:s,formState:c,totalCount:d,table:u,dispatch:m,checkPathName:E,onSortingByData:p,tenantId:v,inboxStyles:g={},tableStyle:C={}}=e;const{t:y}=a.useTranslation(),f=l.useHistory(),[b,N]=t.useState(""),{data:h,getReview:S}=Digit.Hooks.ekyc.useEkycAPI("review",v),k=e=>{N(e),S({kno:e})},_=(null==c||null===(r=c.tableForm)||void 0===r?void 0:r.limit)||10,x=(null==c||null===(o=c.tableForm)||void 0===o?void 0:o.offset)||0;n.useEffect(()=>{h&&f.push("/digit-ui/employee/ekyc/review",{kNumber:b,aadhaarData:null==h?void 0:h.aadhaarData,reviewData:h})},[h]);const I=[{Header:y("EKYC_APPLICATION_NO"),accessor:"applicationNumber",disableSortBy:!0,Cell:e=>{var t,a;let{row:l}=e;const r=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(a=l.original)||void 0===a?void 0:a.applicationNumber)||"NA";return n.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>k(r)},r)}},{Header:y("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:a}=e;return n.createElement("span",null,(null===(t=a.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:y("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:a}=e;const l=(null===(t=a.original)||void 0===t?void 0:t.status)||"DEFAULT";return n.createElement("span",{className:"ekyc-status-tag "+l},y(""+l))}},{Header:y("EKYC_ACTION"),accessor:"status",Cell:e=>{var t,a;let{row:l}=e;const r=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(a=l.original)||void 0===a?void 0:a.applicationNumber)||"NA";return n.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>k(r)},y("EKYC_REVIEW"))}}];return{getCellProps:e=>({style:{padding:"8px",fontSize:"12px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:s,currentPage:Math.floor(x/_),onNextPage:()=>{var e,t;return m({action:"mutateTableForm",data:{...c.tableForm,offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)},checkPathName:E})},onPrevPage:()=>{var e,t;return m({action:"mutateTableForm",data:{...c.tableForm,offset:parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(t=c.tableForm)||void 0===t?void 0:t.limit)},checkPathName:E})},pageSizeLimit:_,onSort:p,totalRecords:d,onSearch:null==c||null===(i=c.searchForm)||void 0===i?void 0:i.message,onLastPage:()=>{var e;return m({action:"mutateTableForm",data:{...c.tableForm,offset:10*Math.ceil(d/10)-parseInt(null===(e=c.tableForm)||void 0===e?void 0:e.limit)},checkPathName:E})},onFirstPage:()=>m({action:"mutateTableForm",data:{...c.tableForm,offset:0},checkPathName:E}),data:u,columns:I,inboxStyles:{...g},tableStyle:{...C}}};function p(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var v=e=>null==e;const g=e=>"object"==typeof e;var C=e=>!v(e)&&!Array.isArray(e)&&g(e)&&!(e instanceof Date),y=e=>e.filter(Boolean),f=e=>void 0===e,b=function(e,t,n){void 0===e&&(e={});const a=y(t.split(/[,[\].]+?/)).reduce((e,t)=>v(e)?e:e[t],e);return f(a)||a===e?f(e[t])?n:e[t]:a},N=e=>"function"==typeof e;const h=t.createContext(null);h.displayName="RHFContext";const S=e=>{const{as:n,render:a}=e,l=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]])}return n}(e,["rules","as","render","defaultValue","control","onFocus"]),{field:r,meta:o}=function(e){let{name:n,rules:a,defaultValue:l,control:r,onFocus:o}=e;const i=t.useContext(h);if("production"!==process.env.NODE_ENV&&!r&&!i)throw new Error("📋 Controller is missing `control` prop. https://react-hook-form.com/api#Controller");const{defaultValuesRef:s,setValue:c,register:d,unregister:u,trigger:m,mode:E,reValidateMode:{isReValidateOnBlur:p,isReValidateOnChange:S},formState:k,formStateRef:{current:{isSubmitted:_,touched:x,errors:I}},updateFormState:T,readFormStateRef:D,fieldsRef:R,fieldArrayNamesRef:A,shallowFieldsStateRef:L}=r||i.control,F=!((e,t)=>[...e].some(e=>((e,t)=>RegExp(`^${t}([|.)\\d+`.replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(e))(t,e)))(A.current,n),O=()=>!f(b(L.current,n))&&F?b(L.current,n):f(l)?b(s.current,n):l,[w,P]=t.useState(O()),M=t.useRef(w),Y=t.useRef({focus:()=>null}),K=t.useRef(o||(()=>{N(Y.current.focus)&&Y.current.focus(),"production"!==process.env.NODE_ENV&&(N(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:n,isOnTouch:a,isTouched:l,isReValidateOnBlur:r,isReValidateOnChange:o,isBlurEvent:i,isSubmitted:s,isOnAll:c}=e;return!c&&(!s&&a?!(l||i):(s?r:t)?!i:!(s?o:n)||i)})(Object.assign({isBlurEvent:e,isReValidateOnBlur:p,isReValidateOnChange:S,isSubmitted:_,isTouched:!!b(x,n)},E)),[p,S,_,x,n,E]),U=t.useCallback(e=>{let[t]=e;const n=(e=>{return v(t=e)||!g(t)||!C(e.target)||C(e.target)&&!e.type?e:f(e.target.value)?e.target.checked:e.target.value;var t})(t);return P(n),M.current=n,n},[]),z=t.useCallback(e=>{if("production"!==process.env.NODE_ENV&&!n)return console.warn("📋 Field is missing `name` prop. https://react-hook-form.com/api#Controller");R.current[n]?R.current[n]=Object.assign({ref:R.current[n].ref},a):(d(Object.defineProperties({name:n,focus:K.current},{value:{set(e){P(e),M.current=e},get:()=>M.current}}),a),e=f(b(s.current,n))),e&&F&&P(O())},[a,n,d]);t.useEffect(()=>()=>u(n),[n]),t.useEffect(()=>{"production"!==process.env.NODE_ENV&&(f(w)&&console.warn(`📋 ${n} 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)`),!F&&f(l)&&console.warn("📋 Controller is missing `defaultValue` prop when using `useFieldArray`. https://react-hook-form.com/api#Controller")),z()},[z]),t.useEffect(()=>{!R.current[n]&&z(!0)});const H=t.useCallback(()=>{D.current.touched&&!b(x,n)&&(function(e,t,n){let a=-1;const l=(e=>/^\w*$/.test(e))(t)?[t]:y(t.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split(".")),r=l.length,o=r-1;for(;++a<r;){const t=l[a];let n=!0;if(a!==o){const r=e[t];n=C(r)||Array.isArray(r)?r:isNaN(+l[a+1])?{}:[]}e[t]=n,e=e[t]}}(x,n),T({touched:x})),B(!0)&&m(n)},[n,T,B,m,D]);return{field:{onChange:t.useCallback(function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return c(n,U(t),{shouldValidate:B(),shouldDirty:!0})},[c,n,B]),onBlur:H,name:n,value:w,ref:Y},meta:Object.defineProperties({invalid:!!b(I,n)},{isDirty:{get:()=>!!b(k.dirtyFields,n)},isTouched:{get:()=>!!b(k.touched,n)}})}}(e),i=Object.assign(Object.assign({},l),r);return n?t.isValidElement(n)?t.cloneElement(n,i):t.createElement(n,i):a?a(r,o):null},k=e=>{let{searchFormState:t,controlSearchForm:l}=e;const{t:o}=a.useTranslation(),{errors:i}=t;return n.createElement(n.Fragment,null,n.createElement("span",{className:"mobile-input"},n.createElement(r.Label,{className:"flex-roww flex-gap-2"},o("EKYC_K_NUMBER")||"K Number",n.createElement(r.CustomTooltip,{message:o("EKYC_K_NUMBER_MESSAGE")})),n.createElement(S,{name:"kNumber",control:l,defaultValue:"",rules:{pattern:{value:/^[a-zA-Z0-9-_/]*$/,message:o("ERR_INVALID_APPLICATION_NO")}},render:e=>{let{onChange:t,value:a}=e;return n.createElement(r.TextInput,{value:a||"",onChange:e=>t(e.target.value)})}}),(null==i?void 0:i.kNumber)&&n.createElement(r.CardLabelError,null,i.kNumber.message)))},_=e=>{var a,o,i,s,c;let{parentRoute:d,businessService:u="EKYC",initialStates:p={}}=e;const v=Digit.ULBService.getCurrentTenantId(),g=l.useLocation(),[C,y]=t.useReducer(function(e,t){const n=t.checkPathName?"EKYC.INBOX":"EKYC.SW.INBOX";switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set(n,{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set(n,{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set(n,{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}},{filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}}),f=t.useMemo(()=>{var e,t;return{tenantId:v,offset:(null==C||null===(e=C.tableForm)||void 0===e?void 0:e.offset)||0,limit:(null==C||null===(t=C.tableForm)||void 0===t?void 0:t.limit)||10,search:(null==C?void 0:C.searchForm)||{}}},[v,null==C||null===(a=C.tableForm)||void 0===a?void 0:a.offset,null==C||null===(o=C.tableForm)||void 0===o?void 0:o.limit,null==C?void 0:C.searchForm]),{isLoading:b,data:N={}}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},f,{enabled:!!v,keepPreviousData:!0}),h=t.useMemo(()=>{var e,t;return{kno:(null==C||null===(e=C.searchForm)||void 0===e?void 0:e.kNumber)||"",name:(null==C||null===(t=C.searchForm)||void 0===t?void 0:t.kName)||""}},[null==C||null===(i=C.searchForm)||void 0===i?void 0:i.kNumber,null==C||null===(s=C.searchForm)||void 0===s?void 0:s.kName]),S=!(!h.kno&&!h.name),{isLoading:_,data:x}=Digit.Hooks.ekyc.useSearchConnection({tenantId:v,details:h},{enabled:!!v&&!!h.kno,keepPreviousData:!0}),I=t.useMemo(()=>{var e;return S?x?[x]:[]:(null==N||null===(e=N.dashboardInfo)||void 0===e?void 0:e.consumerList)||[]},[S,x,N]),T=t.useMemo(()=>(I||[]).map(e=>{var t,n,a,l,r,o;if(e.connectionDetails)return{applicationNo:(null===(t=e.propertyInfo)||void 0===t?void 0:t.kno)||"",connectionNo:(null===(n=e.propertyInfo)||void 0===n?void 0:n.kno)||"",owner:(null===(a=e.connectionDetails)||void 0===a?void 0:a.consumerName)||"",applicationNumber:(null===(l=e.propertyInfo)||void 0===l?void 0:l.kno)||"",citizenName:(null===(r=e.connectionDetails)||void 0===r?void 0:r.consumerName)||"",status:(null===(o=e.connectionDetails)||void 0===o?void 0:o.statusflag)||"",sla:0};const i=[e.firstName,e.middleName,e.lastName].filter(Boolean).join(" ");return{...e,applicationNo:e.kno||e.applicationNumber||"",connectionNo:e.kno||"",owner:i||e.consumerName||e.citizenName||"",applicationNumber:e.kno||e.applicationNumber||"",citizenName:i||e.consumerName||e.citizenName||"",status:e.status||"",sla:e.sla??0}}),[I]),D=(null==N||null===(c=N.dashboardInfo)||void 0===c?void 0:c.totalRecords)||(null==N?void 0:N.totalCount)||0,R=g.pathname.includes("ekyc/inbox"),A={headerText:R?"EKYC_MODULE":"MODULE_SW"},L=t.useCallback(e=>{let{registerRef:t,searchFormState:a,controlSearchForm:l}=e;return n.createElement(k,{registerRef:t,searchFormState:a,controlSearchForm:l,className:"search"})},[]),F={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},O={mobileNumber:"",applicationNumber:"",consumerNo:""},w={SearchFormFields:L,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),y({action:"mutateTableForm",data:{...F},checkPathName:R}),y({action:"mutateSearchForm",data:e,checkPathName:R})},searchFormDefaultValues:null==C?void 0:C.searchForm,resetSearchFormDefaultValues:O,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),y({action:"mutateSearchForm",data:O})},className:"search-form-wns-inbox"},P={FilterFormFields:t.useCallback(e=>n.createElement(n.Fragment,null),[]),onFilterFormSubmit:()=>{},filterFormDefaultValues:"",resetFilterFormDefaultValues:"",onFilterFormReset:()=>{}},M=E({parentRoute:d,onPageSizeChange:e=>{const t=Number(e.target.value);y({action:"mutateTableForm",data:{...C.tableForm,limit:t,offset:0},checkPathName:R})},formState:C,totalCount:D,table:T,dispatch:y,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:n}]=e,a=n?"DESC":"ASC";C.tableForm.sortBy===t&&C.tableForm.sortOrder===a||y({action:"mutateTableForm",data:{...C.tableForm,sortBy:t,sortOrder:n?"DESC":"ASC"},checkPathName:R})}},tenantId:v,checkPathName:R,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return n.createElement("div",{className:"app-container"},n.createElement(r.InboxComposer,m({isInboxLoading:b||_,PropsForInboxLinks:A},w,P,{propsForInboxTable:M,formState:C,countData:null==N?void 0:N.dashboardInfo})))},x=e=>{let{size:t=18,color:a="currentColor"}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),n.createElement("circle",{cx:"12",cy:"7",r:"4"}))},I=e=>{let{size:t=18,color:a="currentColor"}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),n.createElement("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"}))},T=e=>{let{size:t=14}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("polyline",{points:"3 6 5 6 21 6"}),n.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}))},D=e=>{let{size:t=14}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.createElement("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"}))},R=e=>{let{size:t=12}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),n.createElement("circle",{cx:"12",cy:"10",r:"3"}))},A=e=>{let{size:t=16}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}))},L=e=>{let{size:t=16}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),n.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),n.createElement("polyline",{points:"7 3 7 8 15 8"}))},F=e=>{let{size:t=16}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("polyline",{points:"20 6 9 17 4 12"}))},O=e=>{let{size:t=16}=e;return n.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))},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"}],P=[{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"}],M=e=>{let{mapping:t,onConfirm:a,onCancel:l}=e;return n.createElement("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3}},n.createElement("div",{style:{background:"#fff",borderRadius:"12px",padding:"28px 28px 24px",width:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.15)"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px"}},n.createElement("div",{style:{width:"40px",height:"40px",borderRadius:"50%",background:"#FEF3F2",display:"flex",alignItems:"center",justifyContent:"center"}},n.createElement(T,{size:18})),n.createElement("div",null,n.createElement("div",{style:{fontWeight:"700",fontSize:"16px",color:"#0D1B2A"}},"Remove Mapping"),n.createElement("div",{style:{fontSize:"12px",color:"#6B7B8E"}},"This action cannot be undone"))),n.createElement("p",{style:{fontSize:"13px",color:"#344054",marginBottom:"24px",lineHeight:"1.6"}},"Are you sure you want to remove the mapping between"," ",n.createElement("strong",null,null==t?void 0:t.surveyorName)," and ",n.createElement("strong",null,null==t?void 0:t.mrdName),"?"),n.createElement("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"}},n.createElement("button",{onClick:l,style:{background:"none",border:"1px solid #D0D5DD",borderRadius:"8px",padding:"8px 20px",fontWeight:"600",fontSize:"13px",color:"#344054",cursor:"pointer"}},"Cancel"),n.createElement("button",{onClick:a,style:{background:"#B42318",border:"none",borderRadius:"8px",padding:"8px 20px",fontWeight:"600",fontSize:"13px",color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px"}},n.createElement(T,{size:13})," Remove"))))},Y=()=>{const{t:e}=a.useTranslation(),[l,o]=t.useState(null),[i,s]=t.useState(null),[c,d]=t.useState([]),[u,m]=t.useState(null),[E,p]=t.useState(null),[v,g]=t.useState(null),[C,y]=t.useState(null),[f,b]=t.useState(null),N=()=>{m(null),p(null),g(null)},h=t.useMemo(()=>[{Header:e("EKYC_SURVEYOR_NAME")||"Surveyor",accessor:"surveyorName",Cell:t=>{let{row:a}=t;return u===a.original.id?n.createElement("div",{style:{minWidth:"180px"}},n.createElement(r.Dropdown,{selected:E,select:p,option:w,optionKey:"name",t:e,placeholder:"Choose surveyor..."})):n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},n.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},n.createElement(x,{size:15,color:"#3A7BD5"})),n.createElement("div",null,n.createElement("div",{style:{fontWeight:"600",fontSize:"13px",color:"#0D1B2A"}},a.original.surveyorName),n.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"ID: ",a.original.surveyorId)))}},{Header:e("EKYC_MRD_ASSIGNED")||"MRD Assigned",accessor:"mrdName",Cell:t=>{let{row:a}=t;return u===a.original.id?n.createElement("div",{style:{minWidth:"200px"}},n.createElement(r.Dropdown,{selected:v,select:g,option:P,optionKey:"name",t:e,placeholder:"Choose MRD..."})):n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},n.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},n.createElement(I,{size:15,color:"#3A7BD5"})),n.createElement("div",null,n.createElement("div",{style:{fontWeight:"600",fontSize:"13px",color:"#0D1B2A"}},a.original.mrdName),n.createElement("div",{style:{fontSize:"11px",color:"#3A7BD5",display:"flex",alignItems:"center",gap:"3px"}},n.createElement(R,{size:10})," ",a.original.zone)))}},{Header:e("ES_COMMON_ACTION")||"Actions",Cell:e=>{let{row:t}=e;return u===t.original.id?n.createElement("div",{style:{display:"flex",gap:"8px"}},n.createElement("button",{onClick:()=>{return e=t.original.id,void(E&&v?c.some(t=>t.id!==e&&t.surveyorId===E.id&&t.mrdCode===v.code)?b({type:"warning",message:"This mapping already exists"}):(d(t=>t.map(t=>t.id!==e?t:{...t,surveyorName:E.name,surveyorId:E.id,mrdName:v.name,mrdCode:v.code,zone:v.zone})),m(null),b({type:"success",message:"Mapping updated successfully"})):b({type:"error",message:"Please select both Surveyor and MRD to save"}));var e},style:{display:"flex",alignItems:"center",gap:"5px",background:"#3A7BD5",color:"#fff",border:"none",borderRadius:"6px",padding:"6px 12px",fontWeight:"600",fontSize:"12px",cursor:"pointer"}},n.createElement(F,{size:13})," Save"),n.createElement("button",{onClick:N,style:{display:"flex",alignItems:"center",gap:"5px",background:"none",border:"1px solid #D0D5DD",borderRadius:"6px",padding:"6px 12px",fontWeight:"600",fontSize:"12px",color:"#344054",cursor:"pointer"}},n.createElement(O,{size:13})," Cancel")):n.createElement("div",{style:{display:"flex",gap:"8px"}},n.createElement("button",{onClick:()=>(e=>{m(e.id),p(w.find(t=>t.id===e.surveyorId)||null),g(P.find(t=>t.code===e.mrdCode)||null)})(t.original),style:{display:"flex",alignItems:"center",gap:"5px",background:"none",border:"1px solid #D0D5DD",borderRadius:"6px",padding:"6px 12px",color:"#344054",fontSize:"12px",fontWeight:"600",cursor:"pointer"}},n.createElement(D,{size:13})," Edit"),n.createElement("button",{onClick:()=>y(t.original),style:{display:"flex",alignItems:"center",gap:"5px",background:"none",border:"1px solid #FECDCA",borderRadius:"6px",padding:"6px 12px",color:"#B42318",fontSize:"12px",fontWeight:"600",cursor:"pointer"}},n.createElement(T,{size:13})," Remove"))}}],[u,E,v,c,e]);return n.createElement("div",{style:{background:"#F5F7FA",minHeight:"100vh",padding:"0"}},n.createElement(r.Card,{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",marginBottom:"0",borderRadius:"4px"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},n.createElement("div",{style:{color:"#3A8DCC"}},n.createElement(I,{size:24})),n.createElement("div",{style:{fontWeight:"700",fontSize:"18px",color:"#0B0C0C"}},e("EKYC_SURVEYOR_MAPPING")||"Surveyor Mapping")),n.createElement("button",{onClick:()=>{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"})},disabled:0===c.length,style:{display:"flex",alignItems:"center",gap:"8px",background:0===c.length?"#D0D5DD":"#0F3460",color:"#fff",border:"none",borderRadius:"8px",padding:"10px 20px",fontWeight:"600",fontSize:"14px",cursor:0===c.length?"not-allowed":"pointer",transition:"background 0.2s"}},n.createElement(L,{size:15}),e("EKYC_SAVE_MAPPINGS")||"Save Mappings")),n.createElement("div",{style:{padding:"24px 32px"}},n.createElement("p",{style:{fontSize:"13px",color:"#6B7B8E",marginBottom:"24px",marginTop:"0"}},e("EKYC_MAPPING_SUBHEADER")||"Assign Meter Reading Dairies to surveyors to manage their data access."),n.createElement("div",{style:{display:"grid",gridTemplateColumns:"360px 1fr",gap:"20px",alignItems:"start"}},n.createElement("div",{style:{background:"#fff",borderRadius:"12px",border:"1px solid #E5E9EF",overflow:"hidden"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"16px 20px",borderBottom:"1px solid #F0F2F5",background:"#FAFBFC"}},n.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center"}},n.createElement(I,{size:16,color:"#3A7BD5"})),n.createElement("span",{style:{fontWeight:"700",fontSize:"15px",color:"#0D1B2A"}},e("EKYC_NEW_MAPPING")||"New Mapping")),n.createElement("div",{style:{padding:"20px"}},n.createElement("div",{style:{marginBottom:"16px"}},n.createElement("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"11px",fontWeight:"700",letterSpacing:"0.06em",color:"#3A7BD5",textTransform:"uppercase",marginBottom:"8px"}},n.createElement(x,{size:12,color:"#3A7BD5"}),e("EKYC_SELECT_SURVEYOR")||"Select Surveyor"),n.createElement(r.Dropdown,{selected:l,select:o,option:w,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_SURVEYOR_PLACEHOLDER")||"Choose a surveyor..."})),n.createElement("div",{style:{marginBottom:"16px"}},n.createElement("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:"11px",fontWeight:"700",letterSpacing:"0.06em",color:"#3A7BD5",textTransform:"uppercase",marginBottom:"8px"}},n.createElement(I,{size:12,color:"#3A7BD5"}),e("EKYC_SELECT_MRD")||"Select MRD"),n.createElement(r.Dropdown,{selected:i,select:s,option:P,optionKey:"name",t:e,placeholder:e("EKYC_SELECT_MRD_PLACEHOLDER")||"Choose an MRD..."})),i&&n.createElement("div",{style:{background:"#EEF4FB",borderLeft:"3px solid #3A7BD5",borderRadius:"6px",padding:"10px 14px",fontSize:"12px",color:"#0D1B2A",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"}},n.createElement(R,{size:13}),n.createElement("span",null,n.createElement("strong",null,i.name)," — ",i.zone," Zone")),l&&n.createElement("div",{style:{background:"#F5F7FA",borderLeft:"3px solid #6B7B8E",borderRadius:"6px",padding:"10px 14px",fontSize:"12px",color:"#0D1B2A",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"}},n.createElement(x,{size:13,color:"#6B7B8E"}),n.createElement("span",null,n.createElement("strong",null,l.name)," — ",l.id)),n.createElement("button",{onClick:()=>{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),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,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",background:l&&i?"#3A7BD5":"#D0D5DD",color:"#fff",border:"none",borderRadius:"8px",padding:"12px",fontWeight:"600",fontSize:"14px",cursor:l&&i?"pointer":"not-allowed",marginTop:"4px",transition:"background 0.2s"}},n.createElement(A,{size:16}),e("EKYC_ADD_TO_LIST")||"Add to Mapping List")),c.length>0&&n.createElement("div",{style:{padding:"12px 20px",borderTop:"1px solid #F0F2F5",background:"#FAFBFC",display:"flex",gap:"16px"}},n.createElement("div",{style:{textAlign:"center",flex:1}},n.createElement("div",{style:{fontSize:"20px",fontWeight:"700",color:"#0F3460"}},c.length),n.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"Total Mappings")),n.createElement("div",{style:{width:"1px",background:"#E5E9EF"}}),n.createElement("div",{style:{textAlign:"center",flex:1}},n.createElement("div",{style:{fontSize:"20px",fontWeight:"700",color:"#0F3460"}},[...new Set(c.map(e=>e.surveyorId))].length),n.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"Surveyors")),n.createElement("div",{style:{width:"1px",background:"#E5E9EF"}}),n.createElement("div",{style:{textAlign:"center",flex:1}},n.createElement("div",{style:{fontSize:"20px",fontWeight:"700",color:"#0F3460"}},[...new Set(c.map(e=>e.mrdCode))].length),n.createElement("div",{style:{fontSize:"11px",color:"#6B7B8E"}},"MRDs")))),n.createElement("div",{style:{background:"#fff",borderRadius:"12px",border:"1px solid #E5E9EF",overflow:"hidden",minHeight:"420px"}},n.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #F0F2F5",background:"#FAFBFC"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},n.createElement("div",{style:{width:"32px",height:"32px",borderRadius:"8px",background:"#EEF4FB",display:"flex",alignItems:"center",justifyContent:"center"}},n.createElement(x,{size:16,color:"#3A7BD5"})),n.createElement("span",{style:{fontWeight:"700",fontSize:"15px",color:"#0D1B2A"}},e("EKYC_MAPPING_SUMMARY")||"Mapping Summary")),n.createElement("span",{style:{background:c.length>0?"#0F3460":"#E5E9EF",color:c.length>0?"#fff":"#6B7B8E",fontSize:"12px",fontWeight:"700",padding:"3px 10px",borderRadius:"20px"}},c.length," ",e("EKYC_ITEMS")||"items")),n.createElement("div",{style:{padding:"20px"}},c.length>0?n.createElement("div",{style:{border:"1px solid #E5E9EF",borderRadius:"8px",overflow:"hidden"}},n.createElement(r.Table,{t:e,data:c,columns:h,getCellProps:()=>({}),tableClassName:"digit-table"})):n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"320px",textAlign:"center"}},n.createElement("div",{style:{marginBottom:"16px",opacity:.2}},n.createElement(I,{size:56,color:"#0F3460"})),n.createElement("div",{style:{fontSize:"15px",fontWeight:"700",color:"#0D1B2A",marginBottom:"6px"}},e("EKYC_NO_MAPPINGS")||"No Mappings Created Yet"),n.createElement("div",{style:{fontSize:"13px",color:"#6B7B8E"}},e("EKYC_NO_MAPPINGS_HINT")||"Select a surveyor and MRD on the left to get started.")))))),C&&n.createElement(M,{mapping:C,onConfirm:()=>{d(e=>e.filter(e=>e.id!==C.id)),y(null),b({type:"info",message:e("EKYC_MAPPING_REMOVED")||"Mapping removed"})},onCancel:()=>y(null)}),f&&n.createElement(r.Toast,{label:f.message,error:"error"===f.type,warning:"warning"===f.type,isDsc:!0,onClose:()=>b(null)}))},K=e=>{let{kNumber:o,kName:i,connectionDetails:s,isLoading:c}=e;const{t:d}=a.useTranslation(),u=l.useHistory(),{path:m}=l.useRouteMatch(),[E,p]=t.useState(!1),[v,g]=t.useState({code:"SELF",name:"EKYC_SELF"});if(c)return n.createElement(r.Loader,null);if(!s)return null;const C=(null==s?void 0:s.connectionDetails)||{},y=C.statusflag||"",f="active"===(null==y?void 0:y.toLowerCase())||"A"===y;return n.createElement(n.Fragment,null,n.createElement("div",{className:"ekyc-employee-container"},n.createElement("div",{className:"connection-details-card"},n.createElement("div",{className:"details-card-header"},n.createElement("div",{className:"header-title-wrapper"},n.createElement("div",{className:"header-icon-bg"},n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#3A7BD5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),n.createElement("circle",{cx:"12",cy:"7",r:"4"}))),n.createElement("span",{className:"header-title-text"},d("EKYC_K_NUMBER_DETAILS")||"Consumer Identity Details")),n.createElement("span",{className:"status-badge "+(f?"active":"inactive")},f?d("EKYC_ACTIVE_CONNECTION")||"Active Connection":y||d("CS_NA"))),n.createElement("div",{className:"details-card-body"},n.createElement("div",{className:"body-content-row"},n.createElement("div",{className:"detail-section"},n.createElement("div",{className:"section-title"},d("EKYC_VERIFICATION_PARAMETERS")||"Verification Parameters"),n.createElement("div",{className:"data-grid"},n.createElement("div",{className:"data-item"},n.createElement("div",{className:"data-label"},d("EKYC_CONSUMER_NAME")||"Consumer Name"),n.createElement("div",{className:"data-value"},C.consumerName||i||d("CS_NA"))),n.createElement("div",{className:"data-item"},n.createElement("div",{className:"data-label"},d("EKYC_K_NUMBER")||"K Number"),n.createElement("div",{className:"data-value blue"},o||d("CS_NA"))),n.createElement("div",{className:"data-item"},n.createElement("div",{className:"data-label"},d("EKYC_METER_NO")||"Meter Serial No."),n.createElement("div",{className:"data-value"},C.meterNumber||d("CS_NA"))),n.createElement("div",{className:"data-item"},n.createElement("div",{className:"data-label"},d("EKYC_CONNECTION_TYPE")||"Connection Type"),n.createElement("div",{className:"data-value"},C.connectionType||d("CS_NA"))))),n.createElement("div",{className:"vertical-divider"}),n.createElement("div",{className:"detail-section"},n.createElement("div",{className:"section-title"},d("EKYC_ADDRESS_AND_CONTACT")||"Address & Contact"),n.createElement("div",{className:"address-block"},n.createElement("div",{className:"icon-wrapper-small"},n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("path",{d:"M21 10c0 7-9 13-9 13S3 17 3 10a9 9 0 0 1 18 0z"}),n.createElement("circle",{cx:"12",cy:"10",r:"3"}))),n.createElement("div",null,n.createElement("div",{className:"data-label"},d("EKYC_ADDRESS")||"Service Address"),n.createElement("div",{className:"address-text"},C.address||d("CS_NA")))),n.createElement("div",{className:"contact-row"},n.createElement("div",{className:"contact-item"},n.createElement("div",{className:"icon-wrapper-small"},n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2",ry:"2"}),n.createElement("line",{x1:"12",y1:"18",x2:"12.01",y2:"18"}))),n.createElement("div",null,n.createElement("div",{className:"data-label"},d("EKYC_PHONE_NO")||"Contact"),n.createElement("div",{className:"address-text"},C.phoneNumber||d("CS_NA")))),n.createElement("div",{className:"contact-item"},n.createElement("div",{className:"icon-wrapper-small"},n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#6B7B8E",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("circle",{cx:"12",cy:"12",r:"4"}),n.createElement("path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"}))),n.createElement("div",null,n.createElement("div",{className:"data-label"},d("EKYC_EMAIL")||"Email Address"),n.createElement("div",{className:"address-text"},C.email||d("CS_NA")))))))),n.createElement("div",{className:"details-card-footer"},n.createElement("div",{className:"footer-meta-text"},null!=s&&s.lastVerified?`${d("EKYC_LAST_VERIFIED")||"Last verified:"} ${s.lastVerified}`:""),n.createElement("div",{className:"action-btns-container",style:{fontSize:"12px"}},n.createElement("button",{onClick:()=>p(!0),className:"primary-action-btn",style:{fontSize:"12px"}},d("EKYC_START_REVIEW")||"Start Review",n.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},n.createElement("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),n.createElement("polyline",{points:"12 5 19 12 12 19"}))))))),E&&n.createElement(r.Modal,{headerBarMain:d("EKYC_SELECT_VERIFICATION_TYPE"),headerBarEnd:n.createElement("span",{onClick:()=>p(!1),style:{cursor:"pointer",padding:"8px"}},"X"),actionSaveLabel:d("ES_COMMON_CONFIRM"),actionSaveOnSubmit:()=>{const e=m.includes("/create-kyc")?m.replace("/create-kyc",""):m.replace("/k-details","");u.push(e+"/consumer-details",{kNumber:o,selectedOption:v,connectionDetails:s}),p(!1)},actionCancelLabel:d("ES_COMMON_CANCEL"),actionCancelOnSubmit:()=>p(!1),style:{borderRadius:"12px"}},n.createElement("div",{style:{padding:"24px"}},n.createElement(r.RadioButtons,{name:"verificationType",options:[{code:"SELF",name:"EKYC_SELF"},{code:"OTHER",name:"EKYC_OTHER"}],optionsKey:"name",selectedOption:v,onSelect:g,style:{display:"flex",flexDirection:"column",gap:"12px",buttonStyle:{borderRadius:"5px"}},t:d}))))},B=()=>{const{t:e}=a.useTranslation(),[l,o]=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,u]=t.useState(null),[m,E,p]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{}),v=Digit.ULBService.getCurrentTenantId(),{isLoading:g,data:C}=Digit.Hooks.ekyc.useSearchConnection({tenantId:v,details:{kno:l.kNumber,name:l.kName}},{enabled:i&&!!l.kNumber&&!!l.kName,onError:t=>{var n,a,l,r;u({error:!0,label:(null==t||null===(n=t.response)||void 0===n||null===(a=n.data)||void 0===a||null===(l=a.Errors)||void 0===l||null===(r=l[0])||void 0===r?void 0:r.message)||e("EKYC_SEARCH_ERROR_PLEASE_ENTER_THE_CORRECT_CREDENTIALS")}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED")}});return n.createElement(d,{onSearch:t=>{if(!t.kNumber&&!t.kName)return o({kNumber:"",kName:""}),s(!1),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS"),sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED"),void p();t.kNumber&&t.kName?(o(t),s(!0),sessionStorage.getItem("EKYC_K_NUMBER")!==t.kNumber&&(p(),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)):u({error:!0,label:e("EKYC_FILL_ALL_FIELDS")})},searchParams:l},i&&n.createElement(K,{kNumber:l.kNumber,kName:l.kName,connectionDetails:C,isLoading:g}),!i&&!g&&n.createElement(r.Card,{style:{textAlign:"center",padding:"40px"}},n.createElement("div",{style:{color:"#667085"}},e("EKYC_SEARCH_TO_VIEW_DETAILS"))),c&&n.createElement(r.Toast,{error:c.error,label:c.label,onClose:()=>{u(null)},isDsc:!0}))},U=e=>{let{jumpTo:t,state:a}=e;const o=l.useHistory();return n.createElement(r.LinkButton,{label:n.createElement(r.EditIcon,{style:{width:"20px",height:"20px",fill:"#F47738"}}),style:{margin:0,padding:0},onClick:function(){o.push(t,{...a,isEditing:!0})}})},z=e=>null!=e&&""!==e?e:"N/A",H=(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"):"N/A",V=e=>{let{title:t,fields:a,newData:l,oldData:o,t:i,jumpTo:s,state:c}=e;return n.createElement("div",{className:"review-section-wrapper",style:{marginBottom:"48px",background:"#fff",borderRadius:"12px",border:"1px solid #EAECF0",overflow:"hidden"}},n.createElement("div",{style:{padding:"20px 24px",background:"#F9FAFB",borderBottom:"1px solid #EAECF0",display:"flex",justifyContent:"space-between",alignItems:"center"}},n.createElement(r.CardSubHeader,{style:{margin:0,fontSize:"18px",color:"#101828",fontWeight:"700"}},t),s&&n.createElement(U,{jumpTo:s,state:c})),n.createElement("div",{style:{padding:"0 24px"}},n.createElement("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed"}},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"30%"}},i("EKYC_FIELD_NAME")),n.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"35%"}},i("EKYC_EXISTING_INFORMATION")),n.createElement("th",{style:{padding:"16px 0",textAlign:"left",color:"#667085",fontSize:"12px",fontWeight:"600",textTransform:"uppercase",width:"35%"}},i("EKYC_PROPOSED_UPDATES")))),n.createElement("tbody",null,a.map((e,t)=>{const a=null==l?void 0:l[e.key],r=null==o?void 0:o[e.key],s=o&&String(a)!==String(r)&&null!=r;return n.createElement("tr",{key:t,style:{borderTop:"1px solid #F2F4F7"}},n.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:"#344054",fontWeight:"500"}},i(e.label)),n.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:"#667085"}},e.isBool?H(r,i):z(r)),n.createElement("td",{style:{padding:"16px 0",fontSize:"14px",color:s?"#1B8B32":"#101828",fontWeight:s?"700":"400"}},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},e.isBool?H(a,i):z(a),s&&n.createElement("span",{style:{background:"#ECFDF3",color:"#067647",padding:"2px 8px",borderRadius:"12px",fontSize:"10px",fontWeight:"600"}},i("EKYC_CHANGED")))))})))))},W=()=>{var e,o,i,s,c,d,u,m,E,v,g,C,y,f,b,N,h,S,k,_,x,I,T,D,R,A,L,F,O,w,P,M,Y,K,B,U,z,H,W,j,G;const{t:X}=a.useTranslation(),$=l.useHistory(),q=l.useLocation(),[Z,Q]=t.useState(!1),[J,ee]=t.useState(!1),[te,ne]=t.useState(!1),[ae,le]=t.useState(""),re=q.state||{},{kNumber:oe,kno:ie,edits:se={}}=re,ce=oe||ie,{aadhaarData:de={},addressDetails:ue={},propertyDetails:me={},meterDetails:Ee={}}=se,pe=Digit.ULBService.getCurrentTenantId(),ve=Digit.Hooks.ekyc.useEkycWorkflow(pe),ge=Digit.Hooks.ekyc.useEkycUpdate(pe),{data:Ce,isLoading:ye}=Digit.Hooks.ekyc.useEkycSearchReview({kno:ce,fetchType:"REVIEW"},pe,{enabled:!!ce}),{newData:fe,oldData:be}=((e,t)=>{const n=e&&Object.keys(e).length>0?e:(null==t?void 0:t.reviewData)||{},a=(null==n?void 0:n.applicationReviewInfo)||(null==n?void 0:n.applicationReview)||n,l=(Array.isArray(a)?a[0]:a)||{};return{newData:(null==l?void 0:l.newData)||l,oldData:(null==l?void 0:l.oldData)||null}})(Ce,re),Ne=e=>{if(!e)return null;const t=(null==e?void 0:e.connectionDetails)||e||{},n=(null==e?void 0:e.addressDetails)||e||{},a=(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==n?void 0:n.fullAddress)||(null==n?void 0:n.addressRaw),flatHouseNumber:(null==n?void 0:n.flatHouseNumber)||(null==n?void 0:n.flatNo),buildingTower:(null==n?void 0:n.buildingTower)||(null==n?void 0:n.building),landmark:null==n?void 0:n.landmark,pinCode:(null==n?void 0:n.pinCode)||(null==n?void 0:n.pincode),ward:(null==n?void 0:n.ward)||(null==n?void 0:n.locality),assembly:null==n?void 0:n.assembly,gpsValid:null==n?void 0:n.gpsValid,latitude:null==n?void 0:n.latitude,longitude:null==n?void 0:n.longitude,mobileNo:(null==n?void 0:n.mobileNo)||(null==n?void 0:n.mobileNumber),whatsappNo:null==n?void 0:n.whatsappNo,email:null==n?void 0:n.email,noOfPerson:(null==n?void 0:n.noOfPerson)||(null==n?void 0:n.noOfPersons),knumber:(null==n?void 0:n.knumber)||(null==n?void 0:n.kno),doorPhotoFilestoreId:null==n?void 0:n.doorPhotoFilestoreId},property:{kno:null==a?void 0:a.kno,pidNumber:null==a?void 0:a.pidNumber,typeOfConnection:null==a?void 0:a.typeOfConnection,connectionCategory:null==a?void 0:a.connectionCategory,userType:null==a?void 0:a.userType,numberOfFloors:(null==a?void 0:a.numberOfFloors)||(null==a?void 0:a.noOfFloor),tenantName:null==a?void 0:a.tenantName,tenantMobile:null==a?void 0:a.tenantMobile,ekycStatus:null==a?void 0:a.ekycStatus,propertyDocumentFileStoreId:null==a?void 0:a.propertyDocumentFileStoreId,buildingImageFileStoreId:null==a?void 0:a.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}}},he=Ne(fe),Se=Ne(be),ke={...null==he?void 0:he.connection,consumerName:(null==de?void 0:de.name)||(null==he||null===(e=he.connection)||void 0===e?void 0:e.consumerName),phoneNumber:(null==de?void 0:de.mobileNumber)||(null==he||null===(o=he.connection)||void 0===o?void 0:o.phoneNumber),knumber:(null==he||null===(i=he.connection)||void 0===i?void 0:i.knumber)||ce},_e={...null==he?void 0:he.address,fullAddress:(null==ue?void 0:ue.fullAddress)||(null==he||null===(s=he.address)||void 0===s?void 0:s.fullAddress),flatHouseNumber:(null==ue?void 0:ue.flatHouseNumber)||(null==ue?void 0:ue.flatNo)||(null==he||null===(c=he.address)||void 0===c?void 0:c.flatHouseNumber),buildingTower:(null==ue?void 0:ue.buildingTower)||(null==ue?void 0:ue.building)||(null==he||null===(d=he.address)||void 0===d?void 0:d.buildingTower),landmark:(null==ue?void 0:ue.landmark)||(null==he||null===(u=he.address)||void 0===u?void 0:u.landmark),pinCode:(null==ue?void 0:ue.pinCode)||(null==ue?void 0:ue.pincode)||(null==he||null===(m=he.address)||void 0===m?void 0:m.pinCode),ward:(null==ue?void 0:ue.ward)||(null==he||null===(E=he.address)||void 0===E?void 0:E.ward),assembly:(null==ue?void 0:ue.assembly)||(null==he||null===(v=he.address)||void 0===v?void 0:v.assembly),gpsValid:void 0!==(null==ue?void 0:ue.gpsValid)?ue.gpsValid:null==he||null===(g=he.address)||void 0===g?void 0:g.gpsValid,latitude:(null==ue?void 0:ue.latitude)||(null==he||null===(C=he.address)||void 0===C?void 0:C.latitude),longitude:(null==ue?void 0:ue.longitude)||(null==he||null===(y=he.address)||void 0===y?void 0:y.longitude),mobileNo:(null==ue?void 0:ue.mobileNo)||(null==de?void 0:de.mobileNumber)||(null==he||null===(f=he.address)||void 0===f?void 0:f.mobileNo),whatsappNo:(null==ue?void 0:ue.whatsappNo)||(null==de?void 0:de.whatsappNumber)||(null==he||null===(b=he.address)||void 0===b?void 0:b.whatsappNo),email:(null==ue?void 0:ue.email)||(null==he||null===(N=he.address)||void 0===N?void 0:N.email),noOfPerson:(null==ue?void 0:ue.noOfPerson)||(null==de?void 0:de.noOfPersons)||(null==he||null===(h=he.address)||void 0===h?void 0:h.noOfPerson),knumber:(null==ue?void 0:ue.knumber)||(null==he||null===(S=he.address)||void 0===S?void 0:S.knumber)||ce,doorPhotoFilestoreId:(null==ue?void 0:ue.doorPhotoFileStoreId)||(null==he||null===(k=he.address)||void 0===k?void 0:k.doorPhotoFilestoreId)},xe={...null==he?void 0:he.property,kno:(null==he||null===(_=he.property)||void 0===_?void 0:_.kno)||ce,pidNumber:(null==me?void 0:me.pidNumber)||(null==he||null===(x=he.property)||void 0===x?void 0:x.pidNumber),typeOfConnection:(null==me||null===(I=me.connectionTypeData)||void 0===I?void 0:I.label)||(null==he||null===(T=he.property)||void 0===T?void 0:T.typeOfConnection),connectionCategory:(null==me||null===(D=me.connectionCategoryData)||void 0===D?void 0:D.label)||(null==he||null===(R=he.property)||void 0===R?void 0:R.connectionCategory),userType:(null==me||null===(A=me.userTypeData)||void 0===A?void 0:A.label)||(null==he||null===(L=he.property)||void 0===L?void 0:L.userType),numberOfFloors:(null==me||null===(F=me.noOfFloorsData)||void 0===F?void 0:F.label)||(null==he||null===(O=he.property)||void 0===O?void 0:O.numberOfFloors),propertyDocumentFileStoreId:(null==me?void 0:me.propertyDocumentFileStoreId)||(null==he||null===(w=he.property)||void 0===w?void 0:w.propertyDocumentFileStoreId)},Ie={...null==he?void 0:he.meter,kno:(null==Ee?void 0:Ee.kno)||(null==he||null===(P=he.meter)||void 0===P?void 0:P.kno)||ce,metered:"Metered"===(null==Ee||null===(M=Ee.meterStatusData)||void 0===M?void 0:M.value)||(null==he||null===(Y=he.meter)||void 0===Y?void 0:Y.metered),meterNumber:null==he||null===(K=he.meter)||void 0===K?void 0:K.meterNumber,meterMake:(null==Ee?void 0:Ee.meterMake)||(null==he||null===(B=he.meter)||void 0===B?void 0:B.meterMake),meterLocationAddress:(null==Ee?void 0:Ee.meterLocation)||(null==he||null===(U=he.meter)||void 0===U?void 0:U.meterLocationAddress),workingStatus:"Working"===(null==Ee||null===(z=Ee.workingStatusData)||void 0===z?void 0:z.value)||(null==he||null===(H=he.meter)||void 0===H?void 0:H.workingStatus),lastBillRaised:"Yes"===(null==Ee||null===(W=Ee.lastBillRaisedData)||void 0===W?void 0:W.value)||(null==he||null===(j=he.meter)||void 0===j?void 0:j.lastBillRaised),meterPhotoFileStoreId:(null==Ee?void 0:Ee.meterPhotoFileStoreId)||(null==he||null===(G=he.meter)||void 0===G?void 0:G.meterPhotoFileStoreId)},Te=e=>{e&&(le("https://dev-djb.nitcon.in/filestore/v1/files/id?tenantId=dl.djb&fileStoreId="+e),ne(!0))};if(ye||J)return n.createElement(r.Loader,null);const De="/digit-ui/employee/ekyc";return n.createElement("div",{className:"employeeCard overflow-y-scroll"},n.createElement(r.Card,{style:{padding:"32px"}},n.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"40px",borderBottom:"1px solid #EAECF0",paddingBottom:"20px"}},n.createElement(r.CardHeader,{style:{margin:0,fontSize:"28px"}},X("EKYC_REVIEW_APPLICATION")),n.createElement("div",{style:{background:"#F9FAFB",border:"1px solid #EAECF0",borderRadius:"24px",padding:"8px 20px",fontSize:"14px",color:"#475467",fontWeight:"500"}},X("EKYC_K_NUMBER"),": ",n.createElement("span",{style:{color:"#101828",fontWeight:"700"}},ce))),n.createElement(V,{title:X("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:ke,oldData:null==Se?void 0:Se.connection,t:X,jumpTo:De+"/consumer-details",state:{...re,reviewData:Ce,edits:se}}),n.createElement(V,{title:X("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:_e,oldData:null==Se?void 0:Se.address,t:X,jumpTo:De+"/address-details",state:{...re,reviewData:Ce,edits:se}}),n.createElement(V,{title:X("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:xe,oldData:null==Se?void 0:Se.property,t:X,jumpTo:De+"/property-info",state:{...re,reviewData:Ce,edits:se}}),n.createElement(V,{title:X("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:Ie,oldData:null==Se?void 0:Se.meter,t:X,jumpTo:De+"/meter-details",state:{...re,reviewData:Ce,edits:se}}),n.createElement("div",{style:{marginTop:"40px"}},n.createElement(r.CardSubHeader,{style:{marginBottom:"20px"}},X("EKYC_DOCUMENTS")),n.createElement(r.StatusTable,{style:{maxWidth:"600px"}},n.createElement(r.Row,{label:X("EKYC_DOOR_PHOTO"),text:X(_e.doorPhotoFilestoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:_e.doorPhotoFilestoreId&&n.createElement("div",{onClick:()=>Te(_e.doorPhotoFilestoreId)},n.createElement(r.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),n.createElement(r.Row,{label:X("EKYC_METER_PHOTO"),text:X(Ie.meterPhotoFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:Ie.meterPhotoFileStoreId&&n.createElement("div",{onClick:()=>Te(Ie.meterPhotoFileStoreId)},n.createElement(r.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),n.createElement(r.Row,{label:X("EKYC_BUILDING_IMAGE"),text:X(xe.buildingImageFileStoreId?"EKYC_PHOTO_AVAILABLE":"CS_NA"),actionButton:xe.buildingImageFileStoreId&&n.createElement("div",{onClick:()=>Te(xe.buildingImageFileStoreId)},n.createElement(r.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}),n.createElement(r.Row,{label:X("EKYC_PROPERTY_DOCUMENTS"),text:X(xe.propertyDocumentFileStoreId?"EKYC_DOCS_AVAILABLE":"CS_NA"),actionButton:xe.propertyDocumentFileStoreId&&n.createElement("div",{onClick:()=>Te(xe.propertyDocumentFileStoreId)},n.createElement(r.GenericFileIcon,{style:{cursor:"pointer",fill:"#F47738"}}))}))),n.createElement("div",{style:{marginTop:"40px",paddingTop:"30px",borderTop:"1px solid #EAECF0"}},n.createElement(r.CheckBox,{id:"agreeDeclaration",name:"agreeDeclaration",label:n.createElement("span",{style:{fontSize:"16px",color:"#344054"}},X("EKYC_FINAL_DECLARATION")),onChange:()=>Q(!Z),checked:Z}))),n.createElement(r.ActionBar,{style:{position:"static",marginTop:"32px",display:"flex",justifyContent:"flex-end"}},n.createElement(r.SubmitBar,{label:X("EKYC_REJECT"),onSubmit:function(){try{var e,t,n;const a={RequestInfo:{apiId:"Rainmaker",ver:"1.0",msgId:"message-id",authToken:null===(e=Digit.UserService.getUser())||void 0===e?void 0:e.access_token},kno:ce,action:"REJECTED",remarks:"Application rejected by reviewer",reviewedBy:null===(t=Digit.UserService.getUser())||void 0===t||null===(n=t.info)||void 0===n?void 0:n.userName,role:"ZRO"},l=p(function(){return Promise.resolve(ve.mutateAsync(a)).then(function(e){e&&$.push("/digit-ui/employee/ekyc/response",{success:!0,result:e})})},function(e){console.error("Reject Error:",e)});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disabled:!Z}),n.createElement(r.SubmitBar,{label:X("EKYC_APPROVE"),onSubmit:function(){try{var e,t,n;const a={RequestInfo:{apiId:"Rainmaker",ver:"1.0",msgId:"message-id",authToken:null===(e=Digit.UserService.getUser())||void 0===e?void 0:e.access_token},kno:ce,action:"APPROVED",remarks:"All documents verified",reviewedBy:null===(t=Digit.UserService.getUser())||void 0===t||null===(n=t.info)||void 0===n?void 0:n.userName,role:"ZRO"},l=p(function(){return Promise.resolve(ve.mutateAsync(a)).then(function(e){e&&$.push("/digit-ui/employee/ekyc/response",{success:!0,result:e})})},function(e){console.error("Approve Error:",e)});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disabled:!Z}),n.createElement(r.SubmitBar,{label:X("EKYC_SUBMIT_APPLICATION"),onSubmit:function(){try{ee(!0);const e=function(e,t){try{var n=p(function(){return Promise.resolve(ge.mutateAsync({kno:ce,tenantId:pe,newData:{connectionDetails:ke,addressDetails:_e,propertyInfo:xe,meterDetails:Ie}})).then(function(e){e&&$.push("/digit-ui/employee/ekyc/response",{success:!0,result:e})})},function(e){console.error("Submit Error:",e)})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(ee(!1),e)throw t;return t});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},disabled:!Z})),te&&n.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}},n.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)"}},n.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%"}},"×"),n.createElement("img",{src:ae,alt:"Document Preview",style:{maxWidth:"100%",height:"auto",display:"block"},onError:e=>{e.target.style.display="none",e.target.nextSibling.style.display="block"}}),n.createElement("div",{style:{display:"none",padding:"40px",textAlign:"center"}},n.createElement("p",null,X("EKYC_DOCUMENT_PREVIEW_NOT_AVAILABLE")),n.createElement(r.LinkButton,{label:X("EKYC_OPEN_IN_NEW_TAB"),onClick:()=>window.open(ae,"_blank")})))))};var j,G=(j=n.createContext(void 0),"undefined"!=typeof window&&(window.ReactQueryClientContext=j),j);const X=e=>{let{config:a,onSelect:o,formData:i}=e;const s=l.useLocation().state||{},c=Digit.ULBService.getCurrentTenantId(),d=(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||(null==i?void 0:i.kNumber)||(null==i?void 0:i.kno)||sessionStorage.getItem("EKYC_K_NUMBER"),{isLoading:u,data:m}=Digit.Hooks.ekyc.useSearchConnection({tenantId:c,details:{kno:d}},{enabled:!!d,cacheTime:0}),E=Digit.Hooks.ekyc.useEkycUpdate(c),v=(null==i?void 0:i.aadhaarVerification)||{},[g,C]=t.useState(v.kno||d||""),[y,f]=t.useState(v.consumerType?{name:v.consumerType}:null),[b,N]=t.useState(v.occupantType?{name:v.occupantType}:null),[h,S]=t.useState(v.categoryType?{name:v.categoryType}:null),[k,_]=t.useState(v.consumerName||""),[x,I]=t.useState(v.firstName||""),[T,D]=t.useState(v.middleName||""),[R,A]=t.useState(v.lastName||""),[L,F]=t.useState(v.gender?{name:v.gender}:null),[O,w]=t.useState(v.parentSpouseName||""),[P,M]=t.useState(v.relation||""),[Y,K]=t.useState(v.mobile||""),[B,U]=t.useState(v.whatsapp||""),[z,H]=t.useState(v.email||""),[V,W]=t.useState(v.residents||""),[j,G]=t.useState(v.documentProof||null),[X,$]=t.useState(v.documentId||null),[q,Z]=t.useState(v.ownerMobile||""),[Q,J]=t.useState(v.tenantVerification||""),[ee,te]=t.useState(v.designation||""),[ne,ae]=t.useState(v.department||""),[le,re]=t.useState(v.employeeId||""),[oe,ie]=t.useState(v.landline||""),[se,ce]=t.useState(v.entityRelation||""),[de,ue]=t.useState(v.contactPerson||""),[me,Ee]=t.useState(v.entityName||""),[pe,ve]=t.useState(v.idProof?{name:v.idProof}:null),[ge,Ce]=t.useState(v.idNumber||""),[ye,fe]=t.useState(v.documentNumber||""),[be,Ne]=t.useState(v.identityType?{name:v.identityType}:null),[he,Se]=t.useState(v.idFile||null),[ke,_e]=t.useState(v.consent||!1),[xe,Ie]=t.useState(v.informantIsConsumer??!0),[Te,De]=t.useState(v.informantName||""),[Re,Ae]=t.useState(v.informantRelation||""),[Le,Fe]=t.useState(null);t.useEffect(()=>{const e=m||(null==i?void 0:i.connectionDetails),t=(null==e?void 0:e.connectionDetails)||e||{},n=(null==e?void 0:e.addressDetails)||{};if(t&&Object.keys(t).length>0&&!v.firstName){if(!g&&d&&C(d),t.firstName)I(t.firstName),t.middleName&&D(t.middleName),t.lastName&&A(t.lastName);else if(t.consumerName){_(t.consumerName);const e=t.consumerName.trim().split(/\s+/);I(e[0]||""),2===e.length&&A(e[1]),e.length>2&&(D(e.slice(1,-1).join(" ")),A(e[e.length-1]))}(t.phoneNumber||n.mobileNo)&&K(t.phoneNumber||n.mobileNo),(t.email||n.email)&&H(t.email||n.email),n.whatsappNo&&U(n.whatsappNo),n.noOfPerson&&W(String(n.noOfPerson)),t.consumerType&&f({name:t.consumerType}),t.occupantType&&N({name:t.occupantType}),t.gender&&F({name:t.gender}),t.parentSpouse&&w(t.parentSpouse),t.documentNumber&&($(t.documentNumber),Ce(t.documentNumber)),t.informantName&&De(t.informantName),t.informantRelation&&Ae(t.informantRelation)}},[m,null==i?void 0:i.connectionDetails,d]);const Oe=function(e,t,n){try{const a=e.target.files[0];if(!a)return Promise.resolve();const l=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",a)).then(function(e){var l,r,o;const i=null==e||null===(l=e.data)||void 0===l||null===(r=l.files)||void 0===r||null===(o=r[0])||void 0===o?void 0:o.fileStoreId;i&&(t(a.name),n(i))})},function(){Fe({type:"error",message:"Upload failed"})});return Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};return u?n.createElement(r.Loader,null):n.createElement(t.Fragment,null,n.createElement(r.FormStep,{onSelect:function(){try{const e={kno:g,consumerType:null==y?void 0:y.name,occupantType:null==b?void 0:b.name,categoryType:null==h?void 0:h.name,consumerName:k,firstName:x,middleName:T,lastName:R,gender:null==L?void 0:L.name,parentSpouseName:O,relation:P,mobile:Y,whatsapp:B,email:z,residents:V,documentId:X,ownerMobile:q,tenantVerification:Q,designation:ee,department:ne,employeeId:le,landline:oe,entityRelation:se,contactPerson:de,entityName:me,idProof:null==pe?void 0:pe.name,idNumber:ge,consent:ke,informantIsConsumer:xe,informantName:Te,informantRelation:Re},t=p(function(){return Promise.resolve(E.mutateAsync({RequestInfo:{},updateType:"CONSUMER",...e})).then(function(){Fe({type:"success",message:"Data updated successfully!"}),o(a.key,e)})},function(){Fe({type:"error",message:"Failed to update consumer details"})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},config:a,isDisabled:!(g&&y&&b&&h&&x&&Y&&V&&!(Number(V)<=0)&&("Tenanted"!==(null==b?void 0:b.name)||X||q)&&ke)},n.createElement("div",null,n.createElement(r.CardLabel,null,"Consumer Type *"),n.createElement(r.Dropdown,{option:[{name:"Individual"},{name:"Govt"},{name:"Company_Society_Org"}],selected:y,select:f})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Occupant Type *"),n.createElement(r.Dropdown,{option:[{name:"Self"},{name:"Tenanted"}],selected:b,select:N})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Category Type *"),n.createElement(r.Dropdown,{option:[],selected:h,select:S})),n.createElement("div",null,n.createElement(r.CardLabel,null,"First Name *"),n.createElement(r.TextInput,{value:x,onChange:e=>I(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Middle Name"),n.createElement(r.TextInput,{value:T,onChange:e=>D(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Last Name"),n.createElement(r.TextInput,{value:R,onChange:e=>A(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Gender"),n.createElement(r.Dropdown,{option:[{name:"Male"},{name:"Female"},{name:"Others"},{name:"Not prefer to say"}],selected:L,select:F})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Parent/Spouse Name "),n.createElement(r.TextInput,{value:O,onChange:e=>w(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Mobile *"),n.createElement(r.TextInput,{value:Y,onChange:e=>K(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"WhatsApp"),n.createElement(r.TextInput,{value:B,onChange:e=>U(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Email"),n.createElement(r.TextInput,{value:z,onChange:e=>H(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"No. of Residents *"),n.createElement(r.TextInput,{value:V,onChange:e=>W(e.target.value)})),n.createElement("div",null,console.log("identityType",be),n.createElement(r.CardLabel,null,"Type of Identity *"),n.createElement(r.Dropdown,{option:[{name:"Aadhaar Card"},{name:"Driving License"},{name:"Passport"},{name:"Voter ID"}],selected:be,select:Ne})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Proof of Identity"),n.createElement(r.UploadFile,{onUpload:e=>Oe(e,G,$)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Document Number"),n.createElement(r.TextInput,{value:ye,onChange:e=>fe(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Informant Is Consumer"),n.createElement(r.CheckBox,{label:"Yes, the informant is the consumer",checked:xe,onChange:e=>Ie(e.target.checked)})),!xe&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Informant Name"),n.createElement(r.TextInput,{value:Te,onChange:e=>De(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Informant Relation"),n.createElement(r.TextInput,{value:Re,onChange:e=>Ae(e.target.value)}))),"Tenanted"===(null==b?void 0:b.name)&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Document Proof"),n.createElement(r.UploadFile,{onUpload:e=>Oe(e,G,$)})),!X&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Owner Mobile *"),n.createElement(r.TextInput,{value:q,onChange:e=>Z(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Tenant Verification"),n.createElement(r.TextInput,{value:Q,onChange:e=>J(e.target.value)})))),"Govt"===(null==y?void 0:y.name)&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Designation"),n.createElement(r.TextInput,{value:ee,onChange:e=>te(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Department"),n.createElement(r.TextInput,{value:ne,onChange:e=>ae(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Employee ID"),n.createElement(r.TextInput,{value:le,onChange:e=>re(e.target.value)}))),"Company_Society_Org"===(null==y?void 0:y.name)&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Entity Name"),n.createElement(r.TextInput,{value:me,onChange:e=>Ee(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Contact Person"),n.createElement(r.TextInput,{value:de,onChange:e=>ue(e.target.value)})))),Le&&n.createElement(r.Toast,{error:"error"===Le.type,label:Le.message,onClose:()=>Fe(null)}))},$=[{body:[{route:"consumer-details",component:X,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,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"}]}]}],q=e=>{let{path:o}=e;!function(){var e;if(!n.useContext("undefined"!=typeof window&&null!=(e=window.ReactQueryClientContext)?e:G))throw new Error("No QueryClient set, use QueryClientProvider to set one")}();const i=l.useRouteMatch(),{t:s}=a.useTranslation(),c=l.useLocation(),{pathname:d}=c,u=l.useHistory();let m=[];const[E,p,v]=Digit.Hooks.useSessionStorage("EKYC_CREATE",{});function g(e,t,n,a,l){void 0===l&&(l=!1),p({...E,[e]:{...E[e],...t}}),((e,t,n,a)=>{let l=d.split("/").pop(),r=m.find(e=>a?e.key===a:e.route===l);r||(r=m.find(e=>e.route===l));let s=null;const c=m.findIndex(e=>e.route===r.route);c>-1&&c<m.length-1&&(s=m[c+1].route);let p=u.push;e&&(p=u.replace);const v=o||i.path.split("/").slice(0,-1).join("/");if(null===s)return p(v+"/review",{...E,edits:E});p(`${v}/${s}`,{...E})})(n,0,0,e)}Digit.UserService.getUser(),Digit.ULBService.getCurrentTenantId(),t.useEffect(()=>{if(c.state&&Object.keys(c.state).length>0){const{edits:e,...t}=c.state;p({...E,...t,...e})}},[c.state]),$.forEach(e=>{m=m.concat(e.body)}),m.indexRoute="consumer-details";const C=m.map(e=>e.route),y=C.some(e=>d.includes(e)),f=t.useRef({});return t.useEffect(()=>{if(y){const e=d.split("/").pop();f.current[e]&&f.current[e].scrollIntoView({behavior:"smooth",block:"start"})}},[d,y]),n.createElement(n.Fragment,null,n.createElement("div",{className:"employee-form-section-wrapper"},n.createElement(r.VerticalTimeline,{config:m,showFinalStep:!0}),n.createElement("div",{className:"employee-form-section"},n.createElement(l.Switch,null,n.createElement(l.Route,{path:C.map(e=>`${o||i.path.split("/").slice(0,-1).join("/")}/${e}`)},n.createElement("div",{className:"single-page-form-container"},m.map((e,t)=>{const{component:a}=e,l="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;return n.createElement("div",{key:t,ref:t=>f.current[e.route]=t,className:"form-section-unit"},n.createElement(l,{config:{...e,isCollapsible:!0,defaultOpen:!0},onSelect:g,t:s,formData:E}))}))),n.createElement(l.Route,null,n.createElement(l.Redirect,{to:`${o||i.path.split("/").slice(0,-1).join("/")}/${m.indexRoute}`}))))))},Z=e=>{let{path:t}=e;const{t:o}=a.useTranslation(),i=l.useLocation();sessionStorage.removeItem("revalidateddone");const s=[{icon:r.HomeIcon,path:"/digit-ui/employee"},{label:o((()=>{const e=i.pathname;return e.includes("/dashboard")?"ES_COMMON_INBOX":e.includes("/create-kyc")?"EKYC_CREATE_KYC":e.includes("/k-details")?"EKYC_K_DETAILS":e.includes("/consumer-details")?"EKYC_CONSUMER_DETAILS":e.includes("/address-details")?"EKYC_ADDRESS_DETAILS":e.includes("/property-info")?"EKYC_PROPERTY_INFO":e.includes("/meter-details")?"EKYC_METER_DETAILS":e.includes("/review")?"EKYC_REVIEW":"ES_COMMON_INBOX"})())}];return n.createElement(r.AppContainer,null,n.createElement("div",{className:"ground-container employee-app-container form-container"},n.createElement(r.ModuleHeader,{leftContent:n.createElement(n.Fragment,null,n.createElement(r.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:s}),n.createElement("div",{className:"employee-form"},n.createElement("div",{className:"employee-form-content"},n.createElement(l.Switch,null,n.createElement(r.PrivateRoute,{path:t+"/dashboard",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(c,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0}))}),n.createElement(r.PrivateRoute,{path:t+"/inbox",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(_,{parentRoute:t,businessService:"EKYC",moduleCode:"EKYC",isInbox:!0}))}),n.createElement(r.PrivateRoute,{path:t+"/create-kyc",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(B,null))}),n.createElement(r.PrivateRoute,{path:t+"/mapping",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(Y,null))}),n.createElement(r.PrivateRoute,{path:["consumer-details","address-details","property-info","meter-details"].map(e=>`${t}/${e}`),component:e=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(q,m({},e,{path:t})))}),n.createElement(r.PrivateRoute,{path:t+"/review",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(W,null))}))))))},Q=e=>{let{config:o,onSelect:i,formData:s}=e;const{t:c}=a.useTranslation(),d=l.useLocation().state||{},u=Digit.ULBService.getCurrentTenantId(),m=(null==d?void 0:d.kNumber)||(null==d?void 0:d.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:m}},{enabled:!!m,cacheTime:0}),g=Digit.Hooks.ekyc.useEkycUpdate(u),C=(null==s?void 0:s.propertyDetails)||{},[y,f]=t.useState(C.pidNumber||""),[b,N]=t.useState(C.propertyType?{name:C.propertyType}:null),[h,S]=t.useState(C.subPropertyCategory?{name:C.subPropertyCategory}:null),[k,_]=t.useState(C.noOfFloors||""),[x,I]=t.useState(C.floorNo||""),[T,D]=t.useState(C.noOfRooms||""),[R,A]=t.useState(C.noOfBeds||""),[L,F]=t.useState(C.dwellingUnits||""),[O,w]=t.useState(null),[P,M]=t.useState(C.buildingImageId||null),[Y,K]=t.useState(null),B=[{name:"Residential"},{name:"Commercial"},{name:"Hotel"},{name:"Hospital"},{name:"Nursing Home"}];return t.useEffect(()=>{const e=v||(null==s?void 0:s.connectionDetails),t=(null==e?void 0:e.propertyInfo)||(null==e?void 0:e.propertyDetails)||{};if(t&&Object.keys(t).length>0&&!C.pidNumber){if(t.pidNumber&&f(t.pidNumber),(t.numberOfFloors||t.noOfFloor)&&_(String(t.numberOfFloors||t.noOfFloor)),t.buildingImageFileStoreId&&M(t.buildingImageFileStoreId),t.subPropertyCategory){const e=B.find(e=>e.name.toLowerCase()===t.subPropertyCategory.toLowerCase());N(e||{name:t.subPropertyCategory}),S({name:t.subPropertyCategory})}t.propertyType&&(S({name:t.propertyType}),t.subPropertyCategory||N({name:t.propertyType})),t.floorNo&&I(t.floorNo),null!=t.numberOfRooms&&D(String(t.numberOfRooms)),null!=t.numberOfBeds&&A(String(t.numberOfBeds)),null!=t.numberOfDwellingUnits&&F(String(t.numberOfDwellingUnits))}},[v,null==s?void 0:s.connectionDetails]),E?n.createElement(r.Loader,null):n.createElement(t.Fragment,null,n.createElement(r.FormStep,{t:c,onSelect:function(){try{const e={pidNumber:y,propertyType:null==b?void 0:b.name,subPropertyCategory:null==h?void 0:h.name,noOfFloors:k,floorNo:x,noOfRooms:T,noOfBeds:R,dwellingUnits:L,buildingImageId:P},t=p(function(){return Promise.resolve(g.mutateAsync({RequestInfo:{},updateType:"PROPERTY",kno:m,...e})).then(function(){K({type:"success",message:"Property details updated successfully!"}),i(o.key,e)})},function(){K({type:"error",message:"Failed to update property details"})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},config:o,label:c("ES_COMMON_CONTINUE"),isDisabled:!(b&&h&&k&&!(Number(k)<1)&&P&&("Hotel"!==(null==b?void 0:b.name)||T)&&("Hospital"!==(null==b?void 0:b.name)&&"Nursing Home"!==(null==b?void 0:b.name)||R))},n.createElement("div",null,n.createElement(r.CardLabel,null,"PID Number"),n.createElement(r.TextInput,{value:y,onChange:e=>f(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Property Type"),n.createElement(r.Dropdown,{option:B,selected:b,select:N})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Sub Property Category"),n.createElement(r.Dropdown,{option:[],selected:h,select:S})),n.createElement("div",null,n.createElement(r.CardLabel,null,"No. of Floors *"),n.createElement(r.TextInput,{type:"number",value:k,onChange:e=>_(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Floor No. of this KNO"),n.createElement(r.TextInput,{value:x,onChange:e=>I(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"No of Beds"),n.createElement(r.TextInput,{type:"number",value:R,onChange:e=>A(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"No. of Rooms"),n.createElement(r.TextInput,{type:"number",value:T,onChange:e=>D(e.target.value)})),"Hotel"===(null==b?void 0:b.name)&&n.createElement("div",null,n.createElement(r.CardLabel,null,"No. of Rooms *"),n.createElement(r.TextInput,{type:"number",value:T,onChange:e=>D(e.target.value)})),("Hospital"===(null==b?void 0:b.name)||"Nursing Home"===(null==b?void 0:b.name))&&n.createElement("div",null,n.createElement(r.CardLabel,null,"No. of Beds *"),n.createElement(r.TextInput,{type:"number",value:R,onChange:e=>A(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Number of Dwelling Units"),n.createElement(r.TextInput,{type:"number",value:L,onChange:e=>F(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Building Image *"),n.createElement(r.UploadFile,{onUpload:function(e){try{const t=e.target.files[0];if(!t)return Promise.resolve();if(t.size>2e6)return K({type:"error",message:"Max size 2MB exceeded"}),Promise.resolve();const n=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",t,u)).then(function(e){var n,a,l;const r=null==e||null===(n=e.data)||void 0===n||null===(a=n.files)||void 0===a||null===(l=a[0])||void 0===l?void 0:l.fileStoreId;if(r){M(r);const e=new FileReader;e.onloadend=()=>w(e.result),e.readAsDataURL(t),K({type:"success",message:"Upload successful"})}})},function(){K({type:"error",message:"Upload failed"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},onDelete:()=>{w(null),M(null)},message:P?"Uploaded":"No file selected"})),O&&n.createElement("div",{style:{gridColumn:"span 2"}},n.createElement("img",{src:O,alt:"preview",style:{width:"100%",marginTop:"10px"}})),Y&&n.createElement(r.Toast,{label:Y.message,error:"error"===Y.type,onClose:()=>K(null)})))},J=e=>{let{config:a,onSelect:o,formData:i}=e;const s=l.useLocation().state||{},c=Digit.ULBService.getCurrentTenantId(),d=(null==s?void 0:s.kNumber)||(null==s?void 0:s.kno)||(null==i?void 0:i.kNumber)||(null==i?void 0:i.kno)||sessionStorage.getItem("EKYC_K_NUMBER"),{isLoading:u,data:m}=Digit.Hooks.ekyc.useSearchConnection({tenantId:c,details:{kno:d}},{enabled:!!d,cacheTime:0}),E=Digit.Hooks.ekyc.useEkycUpdate(c),v=(null==i?void 0:i.meterDetails)||{},[g,C]=t.useState(v.connectionCategory||""),[y,f]=t.useState(v.saType||""),[b,N]=t.useState(v.status||""),[h,S]=t.useState(v.mrCode||""),[k,_]=t.useState(v.areaCode||""),[x,I]=t.useState(v.mrKey||""),[T,D]=t.useState(v.meterNumber||""),[R,A]=t.useState(v.meterMaker||""),[L,F]=t.useState(v.meterStatus?{name:v.meterStatus}:null),[O,w]=t.useState(v.meterCondition?{name:v.meterCondition}:null),[P,M]=t.useState(v.meterLocation?{name:v.meterLocation}:null),[Y,K]=t.useState(v.lastBillReceived?{name:v.lastBillReceived}:null),[B,U]=t.useState(v.billMonthYear?{name:v.billMonthYear}:null),[z,H]=t.useState(v.reason||""),[V,W]=t.useState(v.accessToMeter?{name:v.accessToMeter}:null),[j,G]=t.useState(v.sewerConnection?{name:v.sewerConnection}:null),[X,$]=t.useState(v.septicTank?{name:v.septicTank}:null),[q,Z]=t.useState(null),[Q,J]=t.useState(v.meterPhotoId||null),[ee,te]=t.useState(null),ne=[{name:"Yes"},{name:"No"}],ae=[{name:"Metered"},{name:"Unmetered"},{name:"Can not be identified"}],le=[{name:"Damaged"},{name:"Not-Damaged"}],re=[{name:"Inside"},{name:"Outside"}],oe=[];for(let e=1998;e<=2026;e++)for(let t=1;t<=12;t++)oe.push({name:`${t}/${e}`});t.useEffect(()=>{const e=m||(null==i?void 0:i.connectionDetails),t=(null==e?void 0:e.meterDetails)||e||{};if(t&&Object.keys(t).length>0&&!v.connectionCategory){if(t.connectionCategory&&C(t.connectionCategory),t.saType&&f(t.saType),t.statusFlag&&N(t.statusFlag),t.mrcode&&S(String(t.mrcode)),t.areacode&&_(String(t.areacode)),t.mrkey&&I(String(t.mrkey)),t.meterNumber&&D(t.meterNumber),t.meterMake&&A(t.meterMake),t.meterStatus){const e=ae.find(e=>e.name.toLowerCase()===t.meterStatus.toLowerCase());F(e||{name:t.meterStatus})}else void 0!==t.metered&&F({name:t.metered?"Metered":"Unmetered"});if(t.meterCondition){const e=le.find(e=>e.name.toLowerCase()===t.meterCondition.toLowerCase());w(e||{name:t.meterCondition})}if(t.meterLocation){const e=re.find(e=>e.name.toLowerCase()===t.meterLocation.toLowerCase()||t.meterLocation.toLowerCase().includes(e.name.toLowerCase()));M(e||{name:t.meterLocation})}if(null!=t.lastBillRaised){const e=String(t.lastBillRaised).toLowerCase();K("true"===e||"yes"===e?{name:"Yes"}:{name:"No"})}if(t.lastBillReceivedDate){const e=t.lastBillReceivedDate.replace("-","/").split("/");if(2===e.length){const t=parseInt(e[0],10),n=parseInt(e[1],10);U({name:`${t}/${n}`})}else U({name:t.lastBillReceivedDate})}if(t.lastBillNotRaisedReason&&H(t.lastBillNotRaisedReason),null!=t.accessToMeter){const e=String(t.accessToMeter).toLowerCase();W("true"===e||"yes"===e?{name:"Yes"}:{name:"No"})}if(null!=t.sewerConnection){const e=String(t.sewerConnection).toLowerCase();G("true"===e||"yes"===e?{name:"Yes"}:{name:"No"})}if(null!=t.septicTank){const e=String(t.septicTank).toLowerCase();$("true"===e||"yes"===e?{name:"Yes"}:{name:"No"})}t.meterPhotoFileStoreId&&J(t.meterPhotoFileStoreId)}},[m,null==i?void 0:i.connectionDetails]);const ie="Can not be identified"===(null==L?void 0:L.name);return u?n.createElement(r.Loader,null):n.createElement(t.Fragment,null,n.createElement(r.FormStep,{onSelect:function(){try{const e={connectionCategory:g,saType:y,status:b,mrCode:h,areaCode:k,mrKey:x,meterNumber:T,meterMaker:R,meterStatus:null==L?void 0:L.name,meterCondition:null==O?void 0:O.name,meterLocation:null==P?void 0:P.name,lastBillReceived:null==Y?void 0:Y.name,billMonthYear:null==B?void 0:B.name,reason:z,accessToMeter:null==V?void 0:V.name,sewerConnection:null==j?void 0:j.name,septicTank:null==X?void 0:X.name,meterPhotoId:Q},t=p(function(){return Promise.resolve(E.mutateAsync({RequestInfo:{},updateType:"METER",kno:d,...e})).then(function(){te({type:"success",message:"Meter details updated successfully!"}),o(a.key,e)})},function(){te({type:"error",message:"Failed to update meter details"})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},config:a,isDisabled:!(g&&L&&P&&Y&&j&&("Metered"!==(null==L?void 0:L.name)||Q)&&("No"!==(null==Y?void 0:Y.name)||z)&&("Yes"!==(null==Y?void 0:Y.name)||B)&&("No"!==(null==j?void 0:j.name)||X))},n.createElement("div",null,n.createElement(r.CardLabel,null,"Connection Category *"),n.createElement(r.TextInput,{value:g,onChange:e=>C(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"SA Type"),n.createElement(r.TextInput,{value:y,onChange:e=>f(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Status"),n.createElement(r.TextInput,{value:b,onChange:e=>N(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"MR Code"),n.createElement(r.TextInput,{value:h,onChange:e=>S(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Area Code"),n.createElement(r.TextInput,{value:k,onChange:e=>_(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"MR Key"),n.createElement(r.TextInput,{value:x,onChange:e=>I(e.target.value)})),!ie&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Meter Number"),n.createElement(r.TextInput,{value:T,onChange:e=>D(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Meter Maker"),n.createElement(r.TextInput,{value:R,onChange:e=>A(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Meter Condition"),n.createElement(r.Dropdown,{option:le,selected:O,select:w})),"Metered"===(null==L?void 0:L.name)&&n.createElement(t.Fragment,null,n.createElement("div",null,n.createElement(r.CardLabel,null,"Meter Photo *"),n.createElement(r.UploadFile,{onUpload:function(e){try{const t=e.target.files[0];if(!t)return Promise.resolve();const n=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",t,c)).then(function(e){var n,a,l;const r=null==e||null===(n=e.data)||void 0===n||null===(a=n.files)||void 0===a||null===(l=a[0])||void 0===l?void 0:l.fileStoreId;if(r){J(r);const e=new FileReader;e.onloadend=()=>Z(e.result),e.readAsDataURL(t)}})},function(){te({type:"error",message:"Upload failed"})});return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},message:Q?"Uploaded":"No file"})),q&&n.createElement("div",{style:{gridColumn:"span 2"}},n.createElement("img",{src:q,style:{width:"100%"}})))),n.createElement("div",null,n.createElement(r.CardLabel,null,"Meter Status *"),n.createElement(r.Dropdown,{option:ae,selected:L,select:F})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Meter Location *"),n.createElement(r.Dropdown,{option:re,selected:P,select:M})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Last Bill Received *"),n.createElement(r.Dropdown,{option:ne,selected:Y,select:K})),"Yes"===(null==Y?void 0:Y.name)&&n.createElement("div",null,n.createElement(r.CardLabel,null,"When was the last bill received *"),n.createElement(r.Dropdown,{option:oe,selected:B,select:U})),"No"===(null==Y?void 0:Y.name)&&n.createElement("div",null,n.createElement(r.CardLabel,null,"Reason *"),n.createElement(r.TextInput,{value:z,onChange:e=>H(e.target.value)})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Access to Meter"),n.createElement(r.Dropdown,{option:ne,selected:V,select:W})),n.createElement("div",null,n.createElement(r.CardLabel,null,"Sewer Connection *"),n.createElement(r.Dropdown,{option:ne,selected:j,select:G})),"No"===(null==j?void 0:j.name)&&n.createElement("div",null,n.createElement(r.CardLabel,null,"Septic Tank *"),n.createElement(r.Dropdown,{option:ne,selected:X,select:$})),ee&&n.createElement(r.Toast,{label:ee.message,error:"error"===ee.type,onClose:()=>te(null)})))},ee=()=>{const{t:e}=a.useTranslation(),t={moduleName:e("ACTION_TEST_EKYC"),kpis:[{count:"-",label:e("TOTAL_EKYC"),link:"/digit-ui/citizen/ekyc/dashboard"}],links:[{label:e("EKYC_DASHBOARD"),link:"/digit-ui/citizen/ekyc/dashboard"},{label:e("EKYC_INBOX"),link:"/digit-ui/citizen/ekyc/inbox"},{label:e("EKYC_MAPPING"),link:"/digit-ui/citizen/ekyc/mapping"}]};return n.createElement(r.ModuleLinksView,{links:t.links})},te=e=>{var a,o,i,s,c;let{parentRoute:d}=e;const u=Digit.ULBService.getCurrentTenantId(),p=l.useLocation(),[v,g]=t.useReducer(function(e,t){const n=t.checkPathName?"EKYC.INBOX":"EKYC.SW.INBOX";switch(t.action){case"mutateSearchForm":return Digit.SessionStorage.set(n,{...e,searchForm:t.data}),{...e,searchForm:t.data};case"mutateFilterForm":return Digit.SessionStorage.set(n,{...e,filterForm:t.data}),{...e,filterForm:t.data};case"mutateTableForm":return Digit.SessionStorage.set(n,{...e,tableForm:t.data}),{...e,tableForm:t.data};default:return e}},{filterForm:{},searchForm:{},tableForm:{limit:10,offset:0,sortBy:"createdTime",sortOrder:"DESC"}}),C=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,search:(null==v?void 0:v.searchForm)||{}}},[u,null==v||null===(a=v.tableForm)||void 0===a?void 0:a.offset,null==v||null===(o=v.tableForm)||void 0===o?void 0:o.limit,null==v?void 0:v.searchForm]),{isLoading:y,data:f={}}=Digit.Hooks.ekyc.useEkycSurveyorDashboard({},C,{enabled:!!u,keepPreviousData:!0}),b=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]),N=!(!b.kno&&!b.name),{isLoading:h,data:S}=Digit.Hooks.ekyc.useSearchConnection({tenantId:u,details:b},{enabled:!!u&&!!b.kno,keepPreviousData:!0}),_=t.useMemo(()=>{var e;return N?S?[S]:[]:(null==f||null===(e=f.dashboardInfo)||void 0===e?void 0:e.consumerList)||[]},[N,S,f]),x=t.useMemo(()=>(_||[]).map(e=>{var t,n,a,l,r,o;return e.connectionDetails?{applicationNo:(null===(t=e.propertyInfo)||void 0===t?void 0:t.kno)||"",connectionNo:(null===(n=e.propertyInfo)||void 0===n?void 0:n.kno)||"",owner:(null===(a=e.connectionDetails)||void 0===a?void 0:a.consumerName)||"",applicationNumber:(null===(l=e.propertyInfo)||void 0===l?void 0:l.kno)||"",citizenName:(null===(r=e.connectionDetails)||void 0===r?void 0:r.consumerName)||"",status:(null===(o=e.connectionDetails)||void 0===o?void 0:o.statusflag)||"",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||"",sla:e.sla??0}}),[_]),I=(null==f||null===(c=f.dashboardInfo)||void 0===c?void 0:c.totalRecords)||(null==f?void 0:f.totalCount)||0,T=p.pathname.includes("ekyc/inbox"),D={headerText:T?"MODULE_WATER":"MODULE_SW"},R=t.useCallback(e=>{let{registerRef:t,searchFormState:a,controlSearchForm:l}=e;return n.createElement(k,{registerRef:t,searchFormState:a,controlSearchForm:l,className:"search"})},[]),A={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"},L={mobileNumber:"",applicationNumber:"",consumerNo:""},F={SearchFormFields:R,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),g({action:"mutateTableForm",data:{...A},checkPathName:T}),g({action:"mutateSearchForm",data:e,checkPathName:T})},searchFormDefaultValues:null==v?void 0:v.searchForm,resetSearchFormDefaultValues:L,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),g({action:"mutateSearchForm",data:L})},className:"search-form-wns-inbox"},O={FilterFormFields:t.useCallback(e=>n.createElement(n.Fragment,null),[]),onFilterFormSubmit:()=>{},filterFormDefaultValues:"",resetFilterFormDefaultValues:"",onFilterFormReset:()=>{}},w=E({parentRoute:d,onPageSizeChange:e=>{const t=Number(e.target.value);g({action:"mutateTableForm",data:{...v.tableForm,limit:t,offset:0},checkPathName:T})},formState:v,totalCount:I,table:x,dispatch:g,onSortingByData:e=>{if(e.length>0){const[{id:t,desc:n}]=e,a=n?"DESC":"ASC";v.tableForm.sortBy===t&&v.tableForm.sortOrder===a||g({action:"mutateTableForm",data:{...v.tableForm,sortBy:t,sortOrder:n?"DESC":"ASC"},checkPathName:T})}},tenantId:u,checkPathName:T,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}});return n.createElement("div",{className:"app-container"},n.createElement(r.InboxComposer,m({isInboxLoading:y||h,PropsForInboxLinks:D},F,O,{propsForInboxTable:w,formState:v})))},ne=e=>{var l,o,i,s,c;let{config:d,onSelect:u}=e;const{t:m}=a.useTranslation(),E=Digit.ULBService.getCurrentTenantId(),[v,g]=t.useState(""),[C,y]=t.useState(""),[f,b]=t.useState(""),[N,h]=t.useState(""),[S,k]=t.useState(null),[_,x]=t.useState(""),[I,T]=t.useState(null),[D,R]=t.useState(null),[A,L]=t.useState(null),[F,O]=t.useState(""),[w,P]=t.useState(""),[M,Y]=t.useState(null),[K,B]=t.useState(null),[U,z]=t.useState(null),[H,V]=t.useState(null),{data:W,isLoading:j}=Digit.Hooks.useCommonMDMS(E,"egov-location",["TenantBoundary"]),G=(null==W||null===(l=W.MdmsRes)||void 0===l||null===(o=l["egov-location"])||void 0===o||null===(i=o.TenantBoundary)||void 0===i||null===(s=i[0])||void 0===s||null===(c=s.boundary)||void 0===c?void 0:c.children)||[];return t.useEffect(()=>{let e=!0;return navigator.geolocation&&navigator.geolocation.getCurrentPosition(t=>{e&&(O(t.coords.latitude),P(t.coords.longitude))},()=>{e&&V({type:"error",message:"GPS access denied"})}),()=>{e=!1}},[]),j?n.createElement(r.Loader,null):n.createElement(t.Fragment,null,n.createElement(r.FormStep,{t:m,onSelect:()=>{v&&C&&6===_.length&&I&&D&&A&&F&&w&&U?u(d.key,{houseNo:v,street:C,locality:f,landmark:N,subLocality:S,pinCode:_,assembly:null==I?void 0:I.name,ward:null==D?void 0:D.name,zone:null==A?void 0:A.name,latitude:F,longitude:w,addressType:null==M?void 0:M.name,doorPhotoFilestoreId:U}):V({type:"error",message:"Please fill all mandatory fields"})},config:d,label:m("ES_COMMON_CONTINUE")},n.createElement(r.CardLabel,null,"House No / Flat No *"),n.createElement(r.TextInput,{value:v,onChange:e=>g(e.target.value)}),n.createElement(r.CardLabel,null,"Street / Address Line *"),n.createElement(r.TextInput,{value:C,onChange:e=>y(e.target.value)}),n.createElement(r.CardLabel,null,"Locality"),n.createElement(r.TextInput,{value:f,onChange:e=>b(e.target.value)}),n.createElement(r.CardLabel,null,"Landmark"),n.createElement(r.TextInput,{value:N,onChange:e=>h(e.target.value)}),n.createElement(r.CardLabel,null,"Sub Locality"),n.createElement(r.Dropdown,{option:[],selected:S,select:k}),n.createElement(r.CardLabel,null,"PIN Code *"),n.createElement(r.TextInput,{value:_,onChange:e=>{const t=e.target.value;/^\d{0,6}$/.test(t)&&(x(t),6===t.length&&console.log("Fetching location for PIN:",t))},maxLength:6}),n.createElement(r.CardLabel,null,"Assembly *"),n.createElement(r.Dropdown,{option:G,selected:I,select:T}),n.createElement(r.CardLabel,null,"Ward *"),n.createElement(r.Dropdown,{option:(null==I?void 0:I.children)||[],selected:D,select:R}),n.createElement(r.CardLabel,null,"Zone *"),n.createElement(r.Dropdown,{option:(null==D?void 0:D.children)||[],selected:A,select:L}),n.createElement(r.CardLabel,null,"Latitude"),n.createElement(r.TextInput,{value:F,disabled:!0}),n.createElement(r.CardLabel,null,"Longitude"),n.createElement(r.TextInput,{value:w,disabled:!0}),n.createElement(r.CardLabel,null,"Address Type"),n.createElement(r.Dropdown,{option:[{name:"Permanent"},{name:"Correspondence"},{name:"Other"}],selected:M,select:Y}),n.createElement(r.CardLabel,null,"Door Image *"),n.createElement(r.UploadFile,{onUpload:function(e){try{let n=!1;function t(e){return n?e:()=>{a=!1}}let a=!0;const l=e.target.files[0];if(!l)return Promise.resolve();if(l.size>=2e6)return V({type:"error",message:"Max size 2MB exceeded"}),Promise.resolve();const r=p(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EKYC",l,E)).then(function(e){var t,r,o;if(!a)return void(n=!0);const i=null==e||null===(t=e.data)||void 0===t||null===(r=t.files)||void 0===r||null===(o=r[0])||void 0===o?void 0:o.fileStoreId;if(i){z(i);const e=new FileReader;e.onloadend=()=>{a&&B(e.result)},e.readAsDataURL(l),V({type:"success",message:"Upload successful"})}})},function(){a?V({type:"error",message:"Upload failed"}):n=!0});return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}},onDelete:()=>{B(null),z(null)},message:U?"Uploaded":"No file selected"}),K&&n.createElement("img",{src:K,alt:"preview",style:{width:"100%",marginTop:"10px"}}),H&&n.createElement(r.Toast,{label:H.message,error:"error"===H.type,onClose:()=>V(null)})))},ae=()=>{const{t:e}=a.useTranslation(),t=l.useLocation(),{path:o}=l.useRouteMatch();sessionStorage.removeItem("revalidateddone");const i=[{icon:r.HomeIcon,path:"/digit-ui/citizen"},{label:e((()=>{const e=t.pathname;return e.includes("/create-kyc")?"EKYC_CREATE_KYC":e.includes("/aadhaar-verification")?"EKYC_AADHAAR_VERIFICATION":e.includes("/address-details")?"EKYC_ADDRESS_DETAILS":e.includes("/property-info")?"EKYC_PROPERTY_INFO":e.includes("/meter-details")?"EKYC_METER_DETAILS":e.includes("/review")?"EKYC_REVIEW":"EKYC_HOME"})())}];return n.createElement(n.Fragment,null,n.createElement("div",{className:"ground-container form-container"},n.createElement(r.ModuleHeader,{leftContent:n.createElement(n.Fragment,null,n.createElement(r.ArrowLeft,{className:"icon"}),e("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:i}),n.createElement(l.Switch,null,n.createElement(r.PrivateRoute,{exact:!0,path:""+o,component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(ee,null))}),n.createElement(r.PrivateRoute,{path:o+"/dashboard",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(c,null))}),n.createElement(r.PrivateRoute,{path:o+"/inbox",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(te,null))}),n.createElement(r.PrivateRoute,{path:o+"/aadhaar-verification",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(X,null))}),n.createElement(r.PrivateRoute,{path:o+"/address-details",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(ne,null))}),n.createElement(r.PrivateRoute,{path:o+"/property-info",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(Q,null))}),n.createElement(r.PrivateRoute,{path:o+"/meter-details",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(J,null))}),n.createElement(r.PrivateRoute,{path:o+"/review",component:()=>n.createElement(r.LayoutWrapper,{layoutClass:"normal"},n.createElement(W,null))}))))},le=e=>{let{stateCode:a,userType:o,tenants:i}=e;const{path:s,url:c}=l.useRouteMatch(),d=Digit.StoreData.getCurrentLanguage(),{isLoading:u}=Digit.Services.useStore({stateCode:a,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()}),[]),u?n.createElement(r.Loader,{page:!0}):"employee"===o?n.createElement(Z,{path:s,url:c,userType:o,tenants:i}):n.createElement(ae,null)},re=e=>{let{matchPath:t}=e;const{t:l}=a.useTranslation(),o=[{link:t+"/create-kyc",i18nKey:l("EKYC_CREATE_KYC")},{link:t+"/update-kyc",i18nKey:l("EKYC_UPDATE_KYC")}];return n.createElement(r.CitizenHomeCard,{header:l("EKYC_MODULE_NAME"),links:o,Icon:()=>n.createElement(r.DocumentIcon,{className:"fill-path-primary-main"})})},oe={EKYCModule:le,EKYCCard:()=>{const{t:e}=a.useTranslation(),t={Icon:n.createElement(r.PersonIcon,null),moduleName:e("ACTION_TEST_EKYC"),kpis:[{count:"-",label:e("TOTAL_EKYC"),link:"/digit-ui/employee/ekyc/dashboard"}],links:[{label:e("EKYC_DASHBOARD"),link:"/digit-ui/employee/ekyc/dashboard"},{label:e("EKYC_INBOX"),link:"/digit-ui/employee/ekyc/inbox"},{label:e("CEO_M.F_DOR_FINANCE_VIEW"),link:"/digit-ui/employee/ekyc/ceo-dashboard"},{label:e("EKYC_MAPPING"),link:"/digit-ui/employee/ekyc/mapping"}]};return n.createElement(r.EmployeeModuleCard,t)},EKYCInbox:c,EKYCDesktopInbox:e=>{var o;let{filterComponent:i,...c}=e;const{data:d,isLoading:u,onSort:m,onNextPage:E,onPrevPage:p,currentPage:v,pageSizeLimit:g,onPageSizeChange:C,parentRoute:y,searchParams:f,sortParams:b,totalRecords:N,countData:h}=c,{t:S}=a.useTranslation(),k=l.useHistory(),_=Digit.ULBService.getCurrentTenantId(),x=null===(o=Digit.ComponentRegistryService)||void 0===o?void 0:o.getComponent(i),[I,T]=t.useState(""),{data:D,getReview:R}=Digit.Hooks.ekyc.useEkycAPI("review",_),A=e=>{T(e),R({kno:e})};n.useEffect(()=>{D&&k.push("/digit-ui/employee/ekyc/review",{kNumber:I,aadhaarData:null==D?void 0:D.aadhaarData,reviewData:D})},[D]);const L=t.useMemo(()=>[{Header:S("EKYC_APPLICATION_NO"),accessor:"applicationNumber",Cell:e=>{var t,a;let{row:l}=e;const r=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(a=l.original)||void 0===a?void 0:a.applicationNumber)||"NA";return n.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>A(r)},r)}},{Header:S("EKYC_CITIZEN_NAME"),accessor:"citizenName",Cell:e=>{var t;let{row:a}=e;return n.createElement("span",null,(null===(t=a.original)||void 0===t?void 0:t.citizenName)||"NA")}},{Header:S("EKYC_STATUS"),accessor:"actionStatus",Cell:e=>{var t;let{row:a}=e;const l=(null===(t=a.original)||void 0===t?void 0:t.status)||"DEFAULT";return n.createElement("span",{className:"ekyc-status-tag "+l},S(""+l))}},{Header:S("EKYC_ACTION"),accessor:"status",Cell:e=>{var t,a;let{row:l}=e;const r=(null===(t=l.original)||void 0===t?void 0:t.kno)||(null===(a=l.original)||void 0===a?void 0:a.applicationNumber)||"NA";return n.createElement("span",{className:"ekyc-application-link",style:{color:"#add8f7",cursor:"pointer",fontWeight:"bold"},onClick:()=>A(r)},S("EKYC_REVIEW"))}}],[S,y]),F=t.useMemo(()=>(null==d?void 0:d.items)||(Array.isArray(d)?d:[]),[d]);return n.createElement("div",{className:"app-container"},n.createElement("div",{className:"inbox-container"},u&&n.createElement(r.Loader,null),n.createElement("div",{className:"side-panel-item"},n.createElement(r.InboxLinks,{headerText:c.moduleCode}),x&&n.createElement(x,{defaultSearchParams:c.defaultSearchParams,onFilterChange:c.onSearch,searchParams:f,type:"desktop",moduleCode:"EKYC"})),n.createElement("div",{className:"employee-form-content",style:{flex:1}},n.createElement(r.Card,{className:"ekyc-metrics-card"},n.createElement(s,{countData:h})),n.createElement("div",{className:"result",style:{flex:1}},n.createElement(r.Card,{className:"ekyc-table-card",style:{padding:0}},n.createElement(r.Table,{t:S,data:F,columns:L,isLoading:u,onSort:m,sortParams:b,totalRecords:N,onNextPage:E,onPrevPage:p,currentPage:v,pageSizeLimit:g,onPageSizeChange:C,getCellProps:e=>({className:"ekyc-table-cell"})}))))))},EKYCMobileInbox:e=>{var t;let{data:o,isLoading:i,onSearch:c,searchParams:u,parentRoute:m,countData:E}=e;const{t:p}=a.useTranslation(),v=(null==o||null===(t=o.items)||void 0===t?void 0:t.map(e=>({[p("EKYC_APPLICATION_NO")]:e.applicationNumber,[p("EKYC_CITIZEN_NAME")]:e.citizenName,[p("EKYC_MOBILE_NO")]:e.mobileNumber,[p("EKYC_STATUS")]:n.createElement("span",{className:"ekyc-status-tag "+e.status},p("EKYC_STATUS_"+e.status))})))||[];return n.createElement("div",{className:"inbox-wrapper"},n.createElement("div",{className:"ekyc-header-container module-header"},n.createElement(r.Header,{className:"title"},p("EKYC_INBOX_HEADER")),n.createElement(l.Link,{to:m+"/create-kyc"},n.createElement(r.SubmitBar,{label:p("EKYC_CREATE_KYC")}))),n.createElement("div",{className:"ekyc-metrics-section"},n.createElement(s,{countData:E})),n.createElement(d,{onSearch:c,searchParams:u}),n.createElement("div",{className:"mobile-data-container"},i?n.createElement(r.Loader,null):(null==v?void 0:v.length)>0?n.createElement(r.DetailsCard,{data:v,t:p,serviceRequestIdKey:p("EKYC_APPLICATION_NO"),linkPrefix:m+"/application-details/"}):n.createElement(r.Card,null,p("ES_COMMON_NO_DATA").split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e)))))},EKYC_INBOX_FILTER:e=>n.createElement(u,e),EkycLinks:re,AadhaarVerification:X,AddressDetails:ne,PropertyInfo:Q,MeterDetails:J};exports.EkycLinks=re,exports.EkycModule=le,exports.default=le,exports.initEkycComponents=()=>{Object.entries(oe).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)})};