@djb25/digit-ui-module-vendor 1.0.29 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +32 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-i18next"),i=require("react-router-dom"),l=require("@djb25/digit-ui-react-components"),o=require("react-hook-form"),a=require("react-query");function u(){return(u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}const s=e=>{var r,i;let{isLoading:a,t:u,onSubmit:s,data:d,count:c,setShowToast:v,vendorData:E}=e;const m=window.Digit.Utils.browser.isMobile(),f=new Date,p=f.toISOString().split("T")[0],_=new Date(f);_.setDate(f.getDate()-7);const S=_.toISOString().split("T")[0],{register:g,control:y,handleSubmit:h,setValue:D,getValues:R,reset:N,formState:I}=o.useForm({defaultValues:{offset:0,limit:!m&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:S,toDate:p}});t.useEffect(()=>{g("offset",0),g("limit",10),g("sortBy","commencementDate"),g("sortOrder","DESC"),D("fromDate",S),D("toDate",p)},[g,h,D,p,S]),t.useEffect(()=>{var e;if(console.log("Fetched Vendor Data:"),null!=E&&null!==(e=E.vendor)&&void 0!==e&&e.length){const e=E.vendor.map(e=>e.name);console.log("Vendor Names:",e)}},[E]);const T=t.useMemo(()=>[{Header:u("VENDOR_REGISTRATION_NO"),accessor:"requestId",disableSortBy:!0,Cell:e=>{var t;let{row:r}=e;const i=null===(t=r.original.vendorAdditionalDetails)||void 0===t?void 0:t.registrationNo;return n.createElement("div",null,i||"N/A")}},{Header:u("CONTACT_PERSON_NAME"),disableSortBy:!0,Cell:e=>{var t;let{row:r}=e;const i=null===(t=r.original.vendorAdditionalDetails)||void 0===t?void 0:t.contactPerson;return n.createElement("div",null,i||"N/A")}},{Header:u("VENDOR_MOBILE_NUMBER"),disableSortBy:!0,Cell:e=>{var t;let{row:r}=e;const i=null===(t=r.original.vendorAdditionalDetails)||void 0===t?void 0:t.vendorMobileNumber;return n.createElement("div",null,i||"N/A")}},{Header:u("VENDOR_BANK_NAME"),disableSortBy:!0,Cell:e=>{var t;let{row:r}=e;const i=null===(t=r.original.vendorAdditionalDetails)||void 0===t?void 0:t.bank;return n.createElement("div",null,i||"N/A")}},{Header:u("VENDOR_STATUS"),disableSortBy:!0,Cell:e=>{var t;let{row:r}=e;const i=null===(t=r.original.vendorAdditionalDetails)||void 0===t?void 0:t.status;return n.createElement("div",null,i||"N/A")}}],[]),C=t.useCallback(e=>{0!==e.length&&(D("sortBy",e.id),D("sortOrder",e.desc?"DESC":"ASC"))},[]);function A(){D("offset",R("offset")-R("limit")),h(s)()}return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(l.Header,null,u("VENDOR_COMMON_SEARCH_ADDITIONAL_DETAILS")),n.createElement(l.SearchForm,{onSubmit:s,handleSubmit:h},n.createElement(l.SearchField,null,n.createElement("label",null,u("VENDOR_NAME")),n.createElement(o.Controller,{control:y,name:"vendorName",render:e=>{var t;return n.createElement(l.Dropdown,{selected:e.value||"",select:e.onChange,onBlur:e.onBlur,option:(null==E||null===(t=E.vendor)||void 0===t?void 0:t.map(e=>({name:e.name,i18nKey:e.name})))||[],optionKey:"i18nKey",t:u,disable:!1})}})),n.createElement(l.SearchField,null,n.createElement("label",null,u("VENDOR_MOBILE_NO")),n.createElement(l.MobileNumber,{name:"mobileNumber",inputRef:g({minLength:{value:10,message:u("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:u("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:u("CORE_COMMON_MOBILE_ERROR")}}),type:"number",componentInFront:n.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91")}),n.createElement(l.CardLabelError,null,null==I||null===(r=I.errors)||void 0===r||null===(i=r.mobileNumber)||void 0===i?void 0:i.message)),n.createElement(l.SearchField,null,n.createElement("label",null,u("VENDOR_FROM_DATE")),n.createElement(o.Controller,{render:e=>n.createElement(l.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange}),name:"fromDate",control:y})),n.createElement(l.SearchField,null,n.createElement("label",null,u("VENDOR_TO_DATE")),n.createElement(o.Controller,{render:e=>n.createElement(l.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange}),name:"toDate",control:y})),n.createElement(l.SearchField,{className:"submit"},n.createElement(l.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),n.createElement("p",{style:{marginTop:"10px"},onClick:()=>{N({fromDate:S,toDate:"",mobileNumber:"",vendorName:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),v(null),A()}},u("ES_COMMON_CLEAR_ALL")))),!a&&null!=d&&d.display?n.createElement(l.Card,{style:{marginTop:20}},u(d.display).split("\\n").map((e,t)=>n.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===d?""!==d||a&&n.createElement(l.Loader,null):n.createElement(l.Table,{t:u,data:d,totalRecords:c,columns:T,getCellProps:e=>({style:{minWidth:e.column.Header===u("EW_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){D("limit",Number(e.target.value)),h(s)()},currentPage:R("offset")/R("limit"),onNextPage:function(){D("offset",R("offset")+R("limit")),h(s)()},onPrevPage:A,pageSizeLimit:R("limit"),onSort:C,disableSort:!1,sortParams:[{id:R("sortBy"),desc:"DESC"===R("sortOrder")}]})))},d=e=>{i.useParams();const{t:o}=r.useTranslation(),a=Digit.ULBService.getCurrentTenantId(),[u,d]=t.useState({}),[c,v]=t.useState(null),E={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:m,isSuccess:f,data:{EwasteApplication:p,Count:_}={}}=Digit.Hooks.ew.useEWSearch({tenantId:a,filters:u},E);return n.createElement(n.Fragment,null,n.createElement(s,{t:o,isLoading:m,tenantId:a,setShowToast:v,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);let r=Object.keys(data).filter(e=>data[e]).reduce((e,t)=>({...e,[t]:"object"==typeof data[t]?data[t].code:data[t]}),{});!(Object.entries(r).length>0)||r.requestId||r.creationReason||r.fromDate||r.mobileNumber||r.requestId||r.status||r.toDate?!(Object.entries(r).length>0&&(r.creationReason||r.status))||r.requestId||r.fromDate||r.mobileNumber||r.requestId||r.toDate?Object.entries(r).length>0&&r.fromDate&&!r.toDate||!r.fromDate&&r.toDate?v({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(r):v({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):v({warning:!0,label:"ERR_VENDOR_FILL_VALID_FIELDS"})},data:f&&!m?p.length>0?p:{display:"ES_COMMON_NO_DATA"}:"",count:_}),c&&n.createElement(l.Toast,{error:c.error,warning:c.warning,label:o(c.label),isDleteBtn:!0,onClose:()=>{v(null)}}))},c=e=>{let{path:t}=e;const{t:o}=r.useTranslation(),a=i.useLocation();sessionStorage.removeItem("revalidateddone");const s=Digit.ComponentRegistryService.getComponent("AddVendor"),c=Digit.ComponentRegistryService.getComponent("SearchVendor"),v=Digit.ComponentRegistryService.getComponent("AddDriver"),E=Digit.ComponentRegistryService.getComponent("EditVendorDetails"),m=Digit.ComponentRegistryService.getComponent("AddVehicle"),f=Digit.ComponentRegistryService.getComponent("VENDORCreate"),p=Digit.ComponentRegistryService.getComponent("DriverDetails"),_=Digit.ComponentRegistryService.getComponent("VehicleDetails"),S=Digit.ComponentRegistryService.getComponent("AddSupervisor"),g=Digit.ComponentRegistryService.getComponent("SupervisorDetails"),y=Digit.ComponentRegistryService.getComponent("AddSurveyor"),h=Digit.ComponentRegistryService.getComponent("SurveyorDetails");return n.createElement(i.Switch,null,n.createElement(l.AppContainer,null,n.createElement(n.Fragment,null,n.createElement("div",{className:"ground-container employee-app-container form-container"},n.createElement(l.ModuleHeader,{leftContent:n.createElement(n.Fragment,null,n.createElement(l.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=a.pathname;let t=[{icon:l.HomeIcon,path:"/digit-ui/employee"},{label:o("TITLE_VENDOR_MANAGEMENT"),path:"/digit-ui/employee/vendor/search-vendor"}];return e.includes("/registry/new-vendor")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")}):e.includes("/search-vendor")?t.push({label:o("SEARCH_VENDOR")}):e.includes("/registry/new-driver")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")}):e.includes("/registry/vendor-details")||e.includes("/registry/modify-vendor/")?t.push({label:o("VENDOR_VENDOR_DETAILS")}):e.includes("/registry/vehicle-details")||e.includes("/registry/modify-vehicle/")?t.push({label:o("VENDOR_VEHICLE_DETAILS")}):e.includes("/registry/new-vehicle")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")}):e.includes("/registry/driver-details")||e.includes("/registry/modify-driver/")?t.push({label:o("VENDOR_DRIVER_DETAILS")}):e.includes("/registry/additionaldetails")?t.push({label:o("VENDOR_ADDITIONAL_DETAILS")}):e.includes("/registry/new-supervisor")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR")}):e.includes("/registry/supervisor-details")||e.includes("/registry/modify-supervisor/")?t.push({label:o("VENDOR_SUPERVISOR_DETAILS")}):e.includes("/registry/new-surveyor")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR")}):(e.includes("/registry/surveyor-details")||e.includes("/registry/modify-surveyor/"))&&t.push({label:o("VENDOR_SURVEYOR_DETAILS")}),t})()}),n.createElement(l.PrivateRoute,{path:t+"/search-vendor",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"normal"},n.createElement(c,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/new-driver",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(v,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/new-vehicle",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(m,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/additionaldetails",component:e=>{const r=e.location.pathname.includes("/info");return n.createElement(l.LayoutWrapper,{layoutClass:r?"action":"normal"},n.createElement(f,u({},e,{parentRoute:t})))}}),n.createElement(l.PrivateRoute,{path:t+"/registry/driver-details/:id",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(p,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/common-search/:id",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"normal"},n.createElement(d,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/new-vendor",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(s,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/vendor-details/:id",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(E,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/vehicle-details/:id",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(_,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/new-supervisor",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(S,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/supervisor-details/:id",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(g,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/new-surveyor",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(y,u({},e,{parentRoute:t})))}),n.createElement(l.PrivateRoute,{path:t+"/registry/surveyor-details/:id",component:e=>n.createElement(l.LayoutWrapper,{layoutClass:"action"},n.createElement(h,u({},e,{parentRoute:t})))})))))},v=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},E=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e};function m(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}require("@djb25/digit-ui-react-components"),"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f,p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e,t){(function(){var n="Expected a function",r="__lodash_placeholder__",i=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],l="[object Arguments]",o="[object Array]",a="[object Boolean]",u="[object Date]",s="[object Error]",d="[object Function]",c="[object GeneratorFunction]",v="[object Map]",E="[object Number]",m="[object Object]",f="[object RegExp]",_="[object Set]",S="[object String]",g="[object Symbol]",y="[object WeakMap]",h="[object ArrayBuffer]",D="[object DataView]",R="[object Float32Array]",N="[object Float64Array]",I="[object Int8Array]",T="[object Int16Array]",C="[object Int32Array]",A="[object Uint8Array]",b="[object Uint16Array]",O="[object Uint32Array]",V=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,M=/(__e\(.*?\)|\b__t\)) \+\n'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,x=/[&<>"']/g,k=RegExp(w.source),P=RegExp(x.source),F=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,G=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,W=/[\\^$.*+?()[\]{}|]/g,j=RegExp(W.source),z=/^\s+/,K=/\s/,$=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,q=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,re=/^0b[01]+$/i,ie=/^\[object .+?Constructor\]$/,le=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,ae=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,se=/['\n\r\u2028\u2029\\]/g,de="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ve="["+ce+"]",Ee="["+de+"]",me="\\d+",fe="[a-z\\xdf-\\xf6\\xf8-\\xff]",pe="[^\\ud800-\\udfff"+ce+me+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",_e="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",ge="(?:\\ud83c[\\udde6-\\uddff]){2}",ye="[\\ud800-\\udbff][\\udc00-\\udfff]",he="[A-Z\\xc0-\\xd6\\xd8-\\xde]",De="(?:"+fe+"|"+pe+")",Re="(?:"+he+"|"+pe+")",Ne="(?:"+Ee+"|"+_e+")?",Ie="[\\ufe0e\\ufe0f]?"+Ne+"(?:\\u200d(?:"+[Se,ge,ye].join("|")+")[\\ufe0e\\ufe0f]?"+Ne+")*",Te="(?:"+["[\\u2700-\\u27bf]",ge,ye].join("|")+")"+Ie,Ce="(?:"+[Se+Ee+"?",Ee,ge,ye,"[\\ud800-\\udfff]"].join("|")+")",Ae=RegExp("['’]","g"),be=RegExp(Ee,"g"),Oe=RegExp(_e+"(?="+_e+")|"+Ce+Ie,"g"),Ve=RegExp([he+"?"+fe+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ve,he,"$"].join("|")+")",Re+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ve,he+De,"$"].join("|")+")",he+"?"+De+"+(?:['’](?:d|ll|m|re|s|t|ve))?",he+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",me,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Me=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,we=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],xe=-1,ke={};ke[R]=ke[N]=ke[I]=ke[T]=ke[C]=ke[A]=ke["[object Uint8ClampedArray]"]=ke[b]=ke[O]=!0,ke[l]=ke[o]=ke[h]=ke[a]=ke[D]=ke[u]=ke[s]=ke[d]=ke[v]=ke[E]=ke[m]=ke[f]=ke[_]=ke[S]=ke[y]=!1;var Pe={};Pe[l]=Pe[o]=Pe[h]=Pe[D]=Pe[a]=Pe[u]=Pe[R]=Pe[N]=Pe[I]=Pe[T]=Pe[C]=Pe[v]=Pe[E]=Pe[m]=Pe[f]=Pe[_]=Pe[S]=Pe[g]=Pe[A]=Pe["[object Uint8ClampedArray]"]=Pe[b]=Pe[O]=!0,Pe[s]=Pe[d]=Pe[y]=!1;var Fe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,He=parseInt,Ue="object"==typeof p&&p&&p.Object===Object&&p,Ye="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ue||Ye||Function("return this")(),We=t&&!t.nodeType&&t,je=We&&e&&!e.nodeType&&e,ze=je&&je.exports===We,Ke=ze&&Ue.process,$e=function(){try{return je&&je.require&&je.require("util").types||Ke&&Ke.binding&&Ke.binding("util")}catch(e){}}(),qe=$e&&$e.isArrayBuffer,Xe=$e&&$e.isDate,Ze=$e&&$e.isMap,Qe=$e&&$e.isRegExp,Je=$e&&$e.isSet,et=$e&&$e.isTypedArray;function tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function nt(e,t,n,r){for(var i=-1,l=null==e?0:e.length;++i<l;){var o=e[i];t(r,o,n(o),e)}return r}function rt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,r=null==e?0:e.length,i=0,l=[];++n<r;){var o=e[n];t(o,n,e)&&(l[i++]=o)}return l}function at(e,t){return!(null==e||!e.length)&&_t(e,t,0)>-1}function ut(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function st(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function dt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function ct(e,t,n,r){var i=-1,l=null==e?0:e.length;for(r&&l&&(n=e[++i]);++i<l;)n=t(n,e[i],i,e);return n}function vt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var mt=ht("length");function ft(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function pt(e,t,n,r){for(var i=e.length,l=n+(r?1:-1);r?l--:++l<i;)if(t(e[l],l,e))return l;return-1}function _t(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):pt(e,gt,n)}function St(e,t,n,r){for(var i=n-1,l=e.length;++i<l;)if(r(e[i],t))return i;return-1}function gt(e){return e!=e}function yt(e,t){var n=null==e?0:e.length;return n?Nt(e,t)/n:NaN}function ht(e){return function(t){return null==t?void 0:t[e]}}function Dt(e){return function(t){return null==e?void 0:e[t]}}function Rt(e,t,n,r,i){return i(e,function(e,i,l){n=r?(r=!1,e):t(n,e,i,l)}),n}function Nt(e,t){for(var n,r=-1,i=e.length;++r<i;){var l=t(e[r]);void 0!==l&&(n=void 0===n?l:n+l)}return n}function It(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Tt(e){return e?e.slice(0,Wt(e)+1).replace(z,""):e}function Ct(e){return function(t){return e(t)}}function At(e,t){return st(t,function(t){return e[t]})}function bt(e,t){return e.has(t)}function Ot(e,t){for(var n=-1,r=e.length;++n<r&&_t(t,e[n],0)>-1;);return n}function Vt(e,t){for(var n=e.length;n--&&_t(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Mt=Dt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),wt=Dt({"&":"&","<":"<",">":">",'"':""","'":"'"});function xt(e){return"\\"+Fe[e]}function kt(e){return Le.test(e)}function Pt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function Ft(e,t){return function(n){return e(t(n))}}function Bt(e,t){for(var n=-1,i=e.length,l=0,o=[];++n<i;){var a=e[n];a!==t&&a!==r||(e[n]=r,o[l++]=n)}return o}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function Ut(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Yt(e){return kt(e)?function(e){for(var t=Oe.lastIndex=0;Oe.test(e);)++t;return t}(e):mt(e)}function Gt(e){return kt(e)?function(e){return e.match(Oe)||[]}(e):function(e){return e.split("")}(e)}function Wt(e){for(var t=e.length;t--&&K.test(e.charAt(t)););return t}var jt=Dt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),zt=function e(t){var p,K=(t=null==t?Ge:zt.defaults(Ge.Object(),t,zt.pick(Ge,we))).Array,de=t.Date,ce=t.Error,ve=t.Function,Ee=t.Math,me=t.Object,fe=t.RegExp,pe=t.String,_e=t.TypeError,Se=K.prototype,ge=me.prototype,ye=t["__core-js_shared__"],he=ve.prototype.toString,De=ge.hasOwnProperty,Re=0,Ne=(p=/[^.]+$/.exec(ye&&ye.keys&&ye.keys.IE_PROTO||""))?"Symbol(src)_1."+p:"",Ie=ge.toString,Te=he.call(me),Ce=Ge._,Oe=fe("^"+he.call(De).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=ze?t.Buffer:void 0,Fe=t.Symbol,Ue=t.Uint8Array,Ye=Le?Le.allocUnsafe:void 0,We=Ft(me.getPrototypeOf,me),je=me.create,Ke=ge.propertyIsEnumerable,$e=Se.splice,mt=Fe?Fe.isConcatSpreadable:void 0,Dt=Fe?Fe.iterator:void 0,Kt=Fe?Fe.toStringTag:void 0,$t=function(){try{var e=Qi(me,"defineProperty");return e({},"",{}),e}catch(e){}}(),qt=t.clearTimeout!==Ge.clearTimeout&&t.clearTimeout,Xt=de&&de.now!==Ge.Date.now&&de.now,Zt=t.setTimeout!==Ge.setTimeout&&t.setTimeout,Qt=Ee.ceil,Jt=Ee.floor,en=me.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,rn=Se.join,ln=Ft(me.keys,me),on=Ee.max,an=Ee.min,un=de.now,sn=t.parseInt,dn=Ee.random,cn=Se.reverse,vn=Qi(t,"DataView"),En=Qi(t,"Map"),mn=Qi(t,"Promise"),fn=Qi(t,"Set"),pn=Qi(t,"WeakMap"),_n=Qi(me,"create"),Sn=pn&&new pn,gn={},yn=Cl(vn),hn=Cl(En),Dn=Cl(mn),Rn=Cl(fn),Nn=Cl(pn),In=Fe?Fe.prototype:void 0,Tn=In?In.valueOf:void 0,Cn=In?In.toString:void 0;function An(e){if(jo(e)&&!wo(e)&&!(e instanceof Ln)){if(e instanceof Vn)return e;if(De.call(e,"__wrapped__"))return Al(e)}return new Vn(e)}var bn=function(){function e(){}return function(t){if(!Wo(t))return{};if(je)return je(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function On(){}function Vn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Ln(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function xn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function kn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new xn;++t<n;)this.add(e[t])}function Pn(e){var t=this.__data__=new wn(e);this.size=t.size}function Fn(e,t){var n=wo(e),r=!n&&Mo(e),i=!n&&!r&&Fo(e),l=!n&&!r&&!i&&Jo(e),o=n||r||i||l,a=o?It(e.length,pe):[],u=a.length;for(var s in e)!t&&!De.call(e,s)||o&&("length"==s||i&&("offset"==s||"parent"==s)||l&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ll(s,u))||a.push(s);return a}function Bn(e){var t=e.length;return t?e[xr(0,t-1)]:void 0}function Hn(e,t){return Dl(pi(e),qn(t,0,e.length))}function Un(e){return Dl(pi(e))}function Yn(e,t,n){(void 0!==n&&!Oo(e[t],n)||void 0===n&&!(t in e))&&Kn(e,t,n)}function Gn(e,t,n){var r=e[t];De.call(e,t)&&Oo(r,n)&&(void 0!==n||t in e)||Kn(e,t,n)}function Wn(e,t){for(var n=e.length;n--;)if(Oo(e[n][0],t))return n;return-1}function jn(e,t,n,r){return er(e,function(e,i,l){t(r,e,n(e),l)}),r}function zn(e,t){return e&&_i(t,ha(t),e)}function Kn(e,t,n){"__proto__"==t&&$t?$t(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function $n(e,t){for(var n=-1,r=t.length,i=K(r),l=null==e;++n<r;)i[n]=l?void 0:pa(e,t[n]);return i}function qn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Xn(e,t,n,r,i,o){var s,p=1&t,y=2&t,V=4&t;if(n&&(s=i?n(e,r,i,o):n(e)),void 0!==s)return s;if(!Wo(e))return e;var L=wo(e);if(L){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&De.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!p)return pi(e,s)}else{var M=tl(e),w=M==d||M==c;if(Fo(e))return di(e,p);if(M==m||M==l||w&&!i){if(s=y||w?{}:rl(e),!p)return y?function(e,t){return _i(e,el(e),t)}(e,function(e,t){return e&&_i(t,Da(t),e)}(s,e)):function(e,t){return _i(e,Ji(e),t)}(e,zn(s,e))}else{if(!Pe[M])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case h:return ci(e);case a:case u:return new r(+e);case D:return function(e,t){var n=t?ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case R:case N:case I:case T:case C:case A:case"[object Uint8ClampedArray]":case b:case O:return vi(e,n);case v:return new r;case E:case S:return new r(e);case f:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case _:return new r;case g:return Tn?me(Tn.call(e)):{}}}(e,M,p)}}o||(o=new Pn);var x=o.get(e);if(x)return x;o.set(e,s),Xo(e)?e.forEach(function(r){s.add(Xn(r,t,n,r,e,o))}):zo(e)&&e.forEach(function(r,i){s.set(i,Xn(r,t,n,i,e,o))});var k=L?void 0:(V?y?ji:Wi:y?Da:ha)(e);return rt(k||e,function(r,i){k&&(r=e[i=r]),Gn(s,i,Xn(r,t,n,i,e,o))}),s}function Zn(e,t,n){var r=n.length;if(null==e)return!r;for(e=me(e);r--;){var i=n[r],l=e[i];if(void 0===l&&!(i in e)||!(0,t[i])(l))return!1}return!0}function Qn(e,t,r){if("function"!=typeof e)throw new _e(n);return Sl(function(){e.apply(void 0,r)},t)}function Jn(e,t,n,r){var i=-1,l=at,o=!0,a=e.length,u=[],s=t.length;if(!a)return u;n&&(t=st(t,Ct(n))),r?(l=ut,o=!1):t.length>=200&&(l=bt,o=!1,t=new kn(t));e:for(;++i<a;){var d=e[i],c=null==n?d:n(d);if(d=r||0!==d?d:0,o&&c==c){for(var v=s;v--;)if(t[v]===c)continue e;u.push(d)}else l(t,c,r)||u.push(d)}return u}An.templateSettings={escape:F,evaluate:B,interpolate:H,variable:"",imports:{_:An}},(An.prototype=On.prototype).constructor=An,(Vn.prototype=bn(On.prototype)).constructor=Vn,(Ln.prototype=bn(On.prototype)).constructor=Ln,Mn.prototype.clear=function(){this.__data__=_n?_n(null):{},this.size=0},Mn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Mn.prototype.get=function(e){var t=this.__data__;if(_n){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return De.call(t,e)?t[e]:void 0},Mn.prototype.has=function(e){var t=this.__data__;return _n?void 0!==t[e]:De.call(t,e)},Mn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=_n&&void 0===t?"__lodash_hash_undefined__":t,this},wn.prototype.clear=function(){this.__data__=[],this.size=0},wn.prototype.delete=function(e){var t=this.__data__,n=Wn(t,e);return!(n<0||(n==t.length-1?t.pop():$e.call(t,n,1),--this.size,0))},wn.prototype.get=function(e){var t=this.__data__,n=Wn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return Wn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,r=Wn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},xn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(En||wn),string:new Mn}},xn.prototype.delete=function(e){var t=Xi(this,e).delete(e);return this.size-=t?1:0,t},xn.prototype.get=function(e){return Xi(this,e).get(e)},xn.prototype.has=function(e){return Xi(this,e).has(e)},xn.prototype.set=function(e,t){var n=Xi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},kn.prototype.add=kn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},kn.prototype.has=function(e){return this.__data__.has(e)},Pn.prototype.clear=function(){this.__data__=new wn,this.size=0},Pn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Pn.prototype.get=function(e){return this.__data__.get(e)},Pn.prototype.has=function(e){return this.__data__.has(e)},Pn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wn){var r=n.__data__;if(!En||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new xn(r)}return n.set(e,t),this.size=n.size,this};var er=yi(ur),tr=yi(sr,!0);function nr(e,t){var n=!0;return er(e,function(e,r,i){return n=!!t(e,r,i)}),n}function rr(e,t,n){for(var r=-1,i=e.length;++r<i;){var l=e[r],o=t(l);if(null!=o&&(void 0===a?o==o&&!Qo(o):n(o,a)))var a=o,u=l}return u}function ir(e,t){var n=[];return er(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function lr(e,t,n,r,i){var l=-1,o=e.length;for(n||(n=il),i||(i=[]);++l<o;){var a=e[l];t>0&&n(a)?t>1?lr(a,t-1,n,r,i):dt(i,a):r||(i[i.length]=a)}return i}var or=hi(),ar=hi(!0);function ur(e,t){return e&&or(e,t,ha)}function sr(e,t){return e&&ar(e,t,ha)}function dr(e,t){return ot(t,function(t){return Uo(e[t])})}function cr(e,t){for(var n=0,r=(t=oi(t,e)).length;null!=e&&n<r;)e=e[Tl(t[n++])];return n&&n==r?e:void 0}function vr(e,t,n){var r=t(e);return wo(e)?r:dt(r,n(e))}function Er(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Kt&&Kt in me(e)?function(e){var t=De.call(e,Kt),n=e[Kt];try{e[Kt]=void 0;var r=!0}catch(e){}var i=Ie.call(e);return r&&(t?e[Kt]=n:delete e[Kt]),i}(e):function(e){return Ie.call(e)}(e)}function mr(e,t){return e>t}function fr(e,t){return null!=e&&De.call(e,t)}function pr(e,t){return null!=e&&t in me(e)}function _r(e,t,n){for(var r=n?ut:at,i=e[0].length,l=e.length,o=l,a=K(l),u=Infinity,s=[];o--;){var d=e[o];o&&t&&(d=st(d,Ct(t))),u=an(d.length,u),a[o]=!n&&(t||i>=120&&d.length>=120)?new kn(o&&d):void 0}d=e[0];var c=-1,v=a[0];e:for(;++c<i&&s.length<u;){var E=d[c],m=t?t(E):E;if(E=n||0!==E?E:0,!(v?bt(v,m):r(s,m,n))){for(o=l;--o;){var f=a[o];if(!(f?bt(f,m):r(e[o],m,n)))continue e}v&&v.push(m),s.push(E)}}return s}function Sr(e,t,n){var r=null==(e=ml(e,t=oi(t,e)))?e:e[Tl(Bl(t))];return null==r?void 0:tt(r,e,n)}function gr(e){return jo(e)&&Er(e)==l}function yr(e,t,n,r,i){return e===t||(null==e||null==t||!jo(e)&&!jo(t)?e!=e&&t!=t:function(e,t,n,r,i,d){var c=wo(e),p=wo(t),y=c?o:tl(e),R=p?o:tl(t),N=(y=y==l?m:y)==m,I=(R=R==l?m:R)==m,T=y==R;if(T&&Fo(e)){if(!Fo(t))return!1;c=!0,N=!1}if(T&&!N)return d||(d=new Pn),c||Jo(e)?Yi(e,t,n,r,i,d):function(e,t,n,r,i,l,o){switch(n){case D:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case h:return!(e.byteLength!=t.byteLength||!l(new Ue(e),new Ue(t)));case a:case u:case E:return Oo(+e,+t);case s:return e.name==t.name&&e.message==t.message;case f:case S:return e==t+"";case v:var d=Pt;case _:if(d||(d=Ht),e.size!=t.size&&!(1&r))return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var m=Yi(d(e),d(t),r,i,l,o);return o.delete(e),m;case g:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,y,n,r,i,d);if(!(1&n)){var C=N&&De.call(e,"__wrapped__"),A=I&&De.call(t,"__wrapped__");if(C||A){var b=C?e.value():e,O=A?t.value():t;return d||(d=new Pn),i(b,O,n,r,d)}}return!!T&&(d||(d=new Pn),function(e,t,n,r,i,l){var o=1&n,a=Wi(e),u=a.length;if(u!=Wi(t).length&&!o)return!1;for(var s=u;s--;){var d=a[s];if(!(o?d in t:De.call(t,d)))return!1}var c=l.get(e),v=l.get(t);if(c&&v)return c==t&&v==e;var E=!0;l.set(e,t),l.set(t,e);for(var m=o;++s<u;){var f=e[d=a[s]],p=t[d];if(r)var _=o?r(p,f,d,t,e,l):r(f,p,d,e,t,l);if(!(void 0===_?f===p||i(f,p,n,r,l):_)){E=!1;break}m||(m="constructor"==d)}if(E&&!m){var S=e.constructor,g=t.constructor;S==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof g&&g instanceof g||(E=!1)}return l.delete(e),l.delete(t),E}(e,t,n,r,i,d))}(e,t,n,r,yr,i))}function hr(e,t,n,r){var i=n.length,l=i,o=!r;if(null==e)return!l;for(e=me(e);i--;){var a=n[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<l;){var u=(a=n[i])[0],s=e[u],d=a[1];if(o&&a[2]){if(void 0===s&&!(u in e))return!1}else{var c=new Pn;if(r)var v=r(s,d,u,e,t,c);if(!(void 0===v?yr(d,s,3,r,c):v))return!1}}return!0}function Dr(e){return!(!Wo(e)||(t=e,Ne&&Ne in t))&&(Uo(e)?Oe:ie).test(Cl(e));var t}function Rr(e){return"function"==typeof e?e:null==e?Ka:"object"==typeof e?wo(e)?Ar(e[0],e[1]):Cr(e):nu(e)}function Nr(e){if(!dl(e))return ln(e);var t=[];for(var n in me(e))De.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Ir(e,t){return e<t}function Tr(e,t){var n=-1,r=ko(e)?K(e.length):[];return er(e,function(e,i,l){r[++n]=t(e,i,l)}),r}function Cr(e){var t=Zi(e);return 1==t.length&&t[0][2]?vl(t[0][0],t[0][1]):function(n){return n===e||hr(n,e,t)}}function Ar(e,t){return al(e)&&cl(t)?vl(Tl(e),t):function(n){var r=pa(n,e);return void 0===r&&r===t?_a(n,e):yr(t,r,3)}}function br(e,t,n,r,i){e!==t&&or(t,function(l,o){if(i||(i=new Pn),Wo(l))!function(e,t,n,r,i,l,o){var a=pl(e,n),u=pl(t,n),s=o.get(u);if(s)Yn(e,n,s);else{var d=l?l(a,u,n+"",e,t,o):void 0,c=void 0===d;if(c){var v=wo(u),E=!v&&Fo(u),m=!v&&!E&&Jo(u);d=u,v||E||m?wo(a)?d=a:Po(a)?d=pi(a):E?(c=!1,d=di(u,!0)):m?(c=!1,d=vi(u,!0)):d=[]:$o(u)||Mo(u)?(d=a,Mo(a)?d=aa(a):Wo(a)&&!Uo(a)||(d=rl(u))):c=!1}c&&(o.set(u,d),i(d,u,r,l,o),o.delete(u)),Yn(e,n,d)}}(e,t,o,n,br,r,i);else{var a=r?r(pl(e,o),l,o+"",e,t,i):void 0;void 0===a&&(a=l),Yn(e,o,a)}},Da)}function Or(e,t){var n=e.length;if(n)return ll(t+=t<0?n:0,n)?e[t]:void 0}function Vr(e,t,n){t=t.length?st(t,function(e){return wo(e)?function(t){return cr(t,1===e.length?e[0]:e)}:e}):[Ka];var r=-1;return t=st(t,Ct(qi())),function(e,t){var r=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,l=t.criteria,o=i.length,a=n.length;++r<o;){var u=Ei(i[r],l[r]);if(u)return r>=a?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)});r--;)e[r]=e[r].value;return e}(Tr(e,function(e,n,i){return{criteria:st(t,function(t){return t(e)}),index:++r,value:e}}))}function Lr(e,t,n){for(var r=-1,i=t.length,l={};++r<i;){var o=t[r],a=cr(e,o);n(a,o)&&Hr(l,oi(o,e),a)}return l}function Mr(e,t,n,r){var i=r?St:_t,l=-1,o=t.length,a=e;for(e===t&&(t=pi(t)),n&&(a=st(e,Ct(n)));++l<o;)for(var u=0,s=t[l],d=n?n(s):s;(u=i(a,d,u,r))>-1;)a!==e&&$e.call(a,u,1),$e.call(e,u,1);return e}function wr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==l){var l=i;ll(i)?$e.call(e,i,1):Qr(e,i)}}return e}function xr(e,t){return e+Jt(dn()*(t-e+1))}function kr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Jt(t/2))&&(e+=e)}while(t);return n}function Pr(e,t){return gl(El(e,t,Ka),e+"")}function Fr(e){return Bn(Oa(e))}function Br(e,t){var n=Oa(e);return Dl(n,qn(t,0,n.length))}function Hr(e,t,n,r){if(!Wo(e))return e;for(var i=-1,l=(t=oi(t,e)).length,o=l-1,a=e;null!=a&&++i<l;){var u=Tl(t[i]),s=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(i!=o){var d=a[u];void 0===(s=r?r(d,u,a):void 0)&&(s=Wo(d)?d:ll(t[i+1])?[]:{})}Gn(a,u,s),a=a[u]}return e}var Ur=Sn?function(e,t){return Sn.set(e,t),e}:Ka,Yr=$t?function(e,t){return $t(e,"toString",{configurable:!0,enumerable:!1,value:Wa(t),writable:!0})}:Ka;function Gr(e){return Dl(Oa(e))}function Wr(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var l=K(i);++r<i;)l[r]=e[r+t];return l}function jr(e,t){var n;return er(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function zr(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var l=r+i>>>1,o=e[l];null!==o&&!Qo(o)&&(n?o<=t:o<t)?r=l+1:i=l}return i}return Kr(e,t,Ka,n)}function Kr(e,t,n,r){var i=0,l=null==e?0:e.length;if(0===l)return 0;for(var o=(t=n(t))!=t,a=null===t,u=Qo(t),s=void 0===t;i<l;){var d=Jt((i+l)/2),c=n(e[d]),v=void 0!==c,E=null===c,m=c==c,f=Qo(c);if(o)var p=r||m;else p=s?m&&(r||v):a?m&&v&&(r||!E):u?m&&v&&!E&&(r||!f):!E&&!f&&(r?c<=t:c<t);p?i=d+1:l=d}return an(l,4294967294)}function $r(e,t){for(var n=-1,r=e.length,i=0,l=[];++n<r;){var o=e[n],a=t?t(o):o;if(!n||!Oo(a,u)){var u=a;l[i++]=0===o?0:o}}return l}function qr(e){return"number"==typeof e?e:Qo(e)?NaN:+e}function Xr(e){if("string"==typeof e)return e;if(wo(e))return st(e,Xr)+"";if(Qo(e))return Cn?Cn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Zr(e,t,n){var r=-1,i=at,l=e.length,o=!0,a=[],u=a;if(n)o=!1,i=ut;else if(l>=200){var s=t?null:ki(e);if(s)return Ht(s);o=!1,i=bt,u=new kn}else u=t?[]:a;e:for(;++r<l;){var d=e[r],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var v=u.length;v--;)if(u[v]===c)continue e;t&&u.push(c),a.push(d)}else i(u,c,n)||(u!==a&&u.push(c),a.push(d))}return a}function Qr(e,t){return null==(e=ml(e,t=oi(t,e)))||delete e[Tl(Bl(t))]}function Jr(e,t,n,r){return Hr(e,t,n(cr(e,t)),r)}function ei(e,t,n,r){for(var i=e.length,l=r?i:-1;(r?l--:++l<i)&&t(e[l],l,e););return n?Wr(e,r?0:l,r?l+1:i):Wr(e,r?l+1:0,r?i:l)}function ti(e,t){var n=e;return n instanceof Ln&&(n=n.value()),ct(t,function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))},n)}function ni(e,t,n){var r=e.length;if(r<2)return r?Zr(e[0]):[];for(var i=-1,l=K(r);++i<r;)for(var o=e[i],a=-1;++a<r;)a!=i&&(l[i]=Jn(l[i]||o,e[a],t,n));return Zr(lr(l,1),t,n)}function ri(e,t,n){for(var r=-1,i=e.length,l=t.length,o={};++r<i;)n(o,e[r],r<l?t[r]:void 0);return o}function ii(e){return Po(e)?e:[]}function li(e){return"function"==typeof e?e:Ka}function oi(e,t){return wo(e)?e:al(e,t)?[e]:Il(ua(e))}var ai=Pr;function ui(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Wr(e,t,n)}var si=qt||function(e){return Ge.clearTimeout(e)};function di(e,t){if(t)return e.slice();var n=e.length,r=Ye?Ye(n):new e.constructor(n);return e.copy(r),r}function ci(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function vi(e,t){var n=t?ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ei(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,l=Qo(e),o=void 0!==t,a=null===t,u=t==t,s=Qo(t);if(!a&&!s&&!l&&e>t||l&&o&&u&&!a&&!s||r&&o&&u||!n&&u||!i)return 1;if(!r&&!l&&!s&&e<t||s&&n&&i&&!r&&!l||a&&n&&i||!o&&i||!u)return-1}return 0}function mi(e,t,n,r){for(var i=-1,l=e.length,o=n.length,a=-1,u=t.length,s=on(l-o,0),d=K(u+s),c=!r;++a<u;)d[a]=t[a];for(;++i<o;)(c||i<l)&&(d[n[i]]=e[i]);for(;s--;)d[a++]=e[i++];return d}function fi(e,t,n,r){for(var i=-1,l=e.length,o=-1,a=n.length,u=-1,s=t.length,d=on(l-a,0),c=K(d+s),v=!r;++i<d;)c[i]=e[i];for(var E=i;++u<s;)c[E+u]=t[u];for(;++o<a;)(v||i<l)&&(c[E+n[o]]=e[i++]);return c}function pi(e,t){var n=-1,r=e.length;for(t||(t=K(r));++n<r;)t[n]=e[n];return t}function _i(e,t,n,r){var i=!n;n||(n={});for(var l=-1,o=t.length;++l<o;){var a=t[l],u=r?r(n[a],e[a],a,n,e):void 0;void 0===u&&(u=e[a]),i?Kn(n,a,u):Gn(n,a,u)}return n}function Si(e,t){return function(n,r){var i=wo(n)?nt:jn,l=t?t():{};return i(n,e,qi(r,2),l)}}function gi(e){return Pr(function(t,n){var r=-1,i=n.length,l=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(l=e.length>3&&"function"==typeof l?(i--,l):void 0,o&&ol(n[0],n[1],o)&&(l=i<3?void 0:l,i=1),t=me(t);++r<i;){var a=n[r];a&&e(t,a,r,l)}return t})}function yi(e,t){return function(n,r){if(null==n)return n;if(!ko(n))return e(n,r);for(var i=n.length,l=t?i:-1,o=me(n);(t?l--:++l<i)&&!1!==r(o[l],l,o););return n}}function hi(e){return function(t,n,r){for(var i=-1,l=me(t),o=r(t),a=o.length;a--;){var u=o[e?a:++i];if(!1===n(l[u],u,l))break}return t}}function Di(e){return function(t){var n=kt(t=ua(t))?Gt(t):void 0,r=n?n[0]:t.charAt(0),i=n?ui(n,1).join(""):t.slice(1);return r[e]()+i}}function Ri(e){return function(t){return ct(Ua(Ma(t).replace(Ae,"")),e,"")}}function Ni(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=bn(e.prototype),r=e.apply(n,t);return Wo(r)?r:n}}function Ii(e){return function(t,n,r){var i=me(t);if(!ko(t)){var l=qi(n,3);t=ha(t),n=function(e){return l(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[l?t[o]:o]:void 0}}function Ti(e){return Gi(function(t){var r=t.length,i=r,l=Vn.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new _e(n);if(l&&!a&&"wrapper"==Ki(o))var a=new Vn([],!0)}for(i=a?i:r;++i<r;){var u=Ki(o=t[i]),s="wrapper"==u?zi(o):void 0;a=s&&ul(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?a[Ki(s[0])].apply(a,s[3]):1==o.length&&ul(o)?a[u]():a.thru(o)}return function(){var e=arguments,n=e[0];if(a&&1==e.length&&wo(n))return a.plant(n).value();for(var i=0,l=r?t[i].apply(this,e):n;++i<r;)l=t[i].call(this,l);return l}})}function Ci(e,t,n,r,i,l,o,a,u,s){var d=128&t,c=1&t,v=2&t,E=24&t,m=512&t,f=v?void 0:Ni(e);return function p(){for(var _=arguments.length,S=K(_),g=_;g--;)S[g]=arguments[g];if(E)var y=$i(p),h=Lt(S,y);if(r&&(S=mi(S,r,i,E)),l&&(S=fi(S,l,o,E)),_-=h,E&&_<s){var D=Bt(S,y);return wi(e,t,Ci,p.placeholder,n,S,D,a,u,s-_)}var R=c?n:this,N=v?R[e]:e;return _=S.length,a?S=fl(S,a):m&&_>1&&S.reverse(),d&&u<_&&(S.length=u),this&&this!==Ge&&this instanceof p&&(N=f||Ni(N)),N.apply(R,S)}}function Ai(e,t){return function(n,r){return function(e,t,n,r){return ur(e,function(e,i,l){t(r,n(e),i,l)}),r}(n,e,t(r),{})}}function bi(e,t){return function(n,r){var i;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Xr(n),r=Xr(r)):(n=qr(n),r=qr(r)),i=e(n,r)}return i}}function Oi(e){return Gi(function(t){return t=st(t,Ct(qi())),Pr(function(n){var r=this;return e(t,function(e){return tt(e,r,n)})})})}function Vi(e,t){var n=(t=void 0===t?" ":Xr(t)).length;if(n<2)return n?kr(t,e):t;var r=kr(t,Qt(e/Yt(t)));return kt(t)?ui(Gt(r),0,e).join(""):r.slice(0,e)}function Li(e){return function(t,n,r){return r&&"number"!=typeof r&&ol(t,n,r)&&(n=r=void 0),t=ra(t),void 0===n?(n=t,t=0):n=ra(n),function(e,t,n,r){for(var i=-1,l=on(Qt((t-e)/(n||1)),0),o=K(l);l--;)o[r?l:++i]=e,e+=n;return o}(t,n,r=void 0===r?t<n?1:-1:ra(r),e)}}function Mi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=oa(t),n=oa(n)),e(t,n)}}function wi(e,t,n,r,i,l,o,a,u,s){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,i,d?l:void 0,d?o:void 0,d?void 0:l,d?void 0:o,a,u,s],v=n.apply(void 0,c);return ul(e)&&_l(v,c),v.placeholder=r,yl(v,e,t)}function xi(e){var t=Ee[e];return function(e,n){if(e=oa(e),(n=null==n?0:an(ia(n),292))&&nn(e)){var r=(ua(e)+"e").split("e");return+((r=(ua(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var ki=fn&&1/Ht(new fn([,-0]))[1]==1/0?function(e){return new fn(e)}:Qa;function Pi(e){return function(t){var n=tl(t);return n==v?Pt(t):n==_?Ut(t):function(e,t){return st(t,function(t){return[t,e[t]]})}(t,e(t))}}function Fi(e,t,i,l,o,a,u,s){var d=2&t;if(!d&&"function"!=typeof e)throw new _e(n);var c=l?l.length:0;if(c||(t&=-97,l=o=void 0),u=void 0===u?u:on(ia(u),0),s=void 0===s?s:ia(s),c-=o?o.length:0,64&t){var v=l,E=o;l=o=void 0}var m=d?void 0:zi(e),f=[e,t,i,l,o,v,E,a,u,s];if(m&&function(e,t){var n=e[1],i=t[1],l=n|i;if(!(l<131||128==i&&8==n||128==i&&256==n&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==n))return e;1&i&&(e[2]=t[2],l|=1&n?0:4);var o=t[3];if(o){var a=e[3];e[3]=a?mi(a,o,t[4]):o,e[4]=a?Bt(e[3],r):t[4]}(o=t[5])&&(e[5]=(a=e[5])?fi(a,o,t[6]):o,e[6]=a?Bt(e[5],r):t[6]),(o=t[7])&&(e[7]=o),128&i&&(e[8]=null==e[8]?t[8]:an(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=l}(f,m),e=f[0],t=f[1],i=f[2],l=f[3],o=f[4],!(s=f[9]=void 0===f[9]?d?0:e.length:on(f[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)p=8==t||16==t?function(e,t,n){var r=Ni(e);return function i(){for(var l=arguments.length,o=K(l),a=l,u=$i(i);a--;)o[a]=arguments[a];var s=l<3&&o[0]!==u&&o[l-1]!==u?[]:Bt(o,u);if((l-=s.length)<n)return wi(e,t,Ci,i.placeholder,void 0,o,s,void 0,void 0,n-l);var d=this&&this!==Ge&&this instanceof i?r:e;return tt(d,this,o)}}(e,t,s):32!=t&&33!=t||o.length?Ci.apply(void 0,f):function(e,t,n,r){var i=1&t,l=Ni(e);return function t(){for(var o=-1,a=arguments.length,u=-1,s=r.length,d=K(s+a),c=this&&this!==Ge&&this instanceof t?l:e;++u<s;)d[u]=r[u];for(;a--;)d[u++]=arguments[++o];return tt(c,i?n:this,d)}}(e,t,i,l);else var p=function(e,t,n){var r=1&t,i=Ni(e);return function t(){var l=this&&this!==Ge&&this instanceof t?i:e;return l.apply(r?n:this,arguments)}}(e,t,i);return yl((m?Ur:_l)(p,f),e,t)}function Bi(e,t,n,r){return void 0===e||Oo(e,ge[n])&&!De.call(r,n)?t:e}function Hi(e,t,n,r,i,l){return Wo(e)&&Wo(t)&&(l.set(t,e),br(e,t,void 0,Hi,l),l.delete(t)),e}function Ui(e){return $o(e)?void 0:e}function Yi(e,t,n,r,i,l){var o=1&n,a=e.length,u=t.length;if(a!=u&&!(o&&u>a))return!1;var s=l.get(e),d=l.get(t);if(s&&d)return s==t&&d==e;var c=-1,v=!0,E=2&n?new kn:void 0;for(l.set(e,t),l.set(t,e);++c<a;){var m=e[c],f=t[c];if(r)var p=o?r(f,m,c,t,e,l):r(m,f,c,e,t,l);if(void 0!==p){if(p)continue;v=!1;break}if(E){if(!Et(t,function(e,t){if(!bt(E,t)&&(m===e||i(m,e,n,r,l)))return E.push(t)})){v=!1;break}}else if(m!==f&&!i(m,f,n,r,l)){v=!1;break}}return l.delete(e),l.delete(t),v}function Gi(e){return gl(El(e,void 0,wl),e+"")}function Wi(e){return vr(e,ha,Ji)}function ji(e){return vr(e,Da,el)}var zi=Sn?function(e){return Sn.get(e)}:Qa;function Ki(e){for(var t=e.name+"",n=gn[t],r=De.call(gn,t)?n.length:0;r--;){var i=n[r],l=i.func;if(null==l||l==e)return i.name}return t}function $i(e){return(De.call(An,"placeholder")?An:e).placeholder}function qi(){var e=An.iteratee||$a;return e=e===$a?Rr:e,arguments.length?e(arguments[0],arguments[1]):e}function Xi(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Zi(e){for(var t=ha(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,cl(i)]}return t}function Qi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Dr(n)?n:void 0}var Ji=en?function(e){return null==e?[]:(e=me(e),ot(en(e),function(t){return Ke.call(e,t)}))}:lu,el=en?function(e){for(var t=[];e;)dt(t,Ji(e)),e=We(e);return t}:lu,tl=Er;function nl(e,t,n){for(var r=-1,i=(t=oi(t,e)).length,l=!1;++r<i;){var o=Tl(t[r]);if(!(l=null!=e&&n(e,o)))break;e=e[o]}return l||++r!=i?l:!!(i=null==e?0:e.length)&&Go(i)&&ll(o,i)&&(wo(e)||Mo(e))}function rl(e){return"function"!=typeof e.constructor||dl(e)?{}:bn(We(e))}function il(e){return wo(e)||Mo(e)||!!(mt&&e&&e[mt])}function ll(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&oe.test(e))&&e>-1&&e%1==0&&e<t}function ol(e,t,n){if(!Wo(n))return!1;var r=typeof t;return!!("number"==r?ko(n)&&ll(t,n.length):"string"==r&&t in n)&&Oo(n[t],e)}function al(e,t){if(wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Qo(e))||Y.test(e)||!U.test(e)||null!=t&&e in me(t)}function ul(e){var t=Ki(e),n=An[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var r=zi(n);return!!r&&e===r[0]}(vn&&tl(new vn(new ArrayBuffer(1)))!=D||En&&tl(new En)!=v||mn&&"[object Promise]"!=tl(mn.resolve())||fn&&tl(new fn)!=_||pn&&tl(new pn)!=y)&&(tl=function(e){var t=Er(e),n=t==m?e.constructor:void 0,r=n?Cl(n):"";if(r)switch(r){case yn:return D;case hn:return v;case Dn:return"[object Promise]";case Rn:return _;case Nn:return y}return t});var sl=ye?Uo:ou;function dl(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ge)}function cl(e){return e==e&&!Wo(e)}function vl(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in me(n))}}function El(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,l=on(r.length-t,0),o=K(l);++i<l;)o[i]=r[t+i];i=-1;for(var a=K(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),tt(e,this,a)}}function ml(e,t){return t.length<2?e:cr(e,Wr(t,0,-1))}function fl(e,t){for(var n=e.length,r=an(t.length,n),i=pi(e);r--;){var l=t[r];e[r]=ll(l,n)?i[l]:void 0}return e}function pl(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var _l=hl(Ur),Sl=Zt||function(e,t){return Ge.setTimeout(e,t)},gl=hl(Yr);function yl(e,t,n){var r=t+"";return gl(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace($,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return rt(i,function(n){var r="_."+n[0];t&n[1]&&!at(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(q);return t?t[1].split(X):[]}(r),n)))}function hl(e){var t=0,n=0;return function(){var r=un(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Dl(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var l=xr(n,i),o=e[l];e[l]=e[n],e[n]=o}return e.length=t,e}var Rl,Nl,Il=(Rl=No(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(G,function(e,n,r,i){t.push(r?i.replace(J,"$1"):n||e)}),t},function(e){return 500===Nl.size&&Nl.clear(),e}),Nl=Rl.cache,Rl);function Tl(e){if("string"==typeof e||Qo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Cl(e){if(null!=e){try{return he.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Al(e){if(e instanceof Ln)return e.clone();var t=new Vn(e.__wrapped__,e.__chain__);return t.__actions__=pi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var bl=Pr(function(e,t){return Po(e)?Jn(e,lr(t,1,Po,!0)):[]}),Ol=Pr(function(e,t){var n=Bl(t);return Po(n)&&(n=void 0),Po(e)?Jn(e,lr(t,1,Po,!0),qi(n,2)):[]}),Vl=Pr(function(e,t){var n=Bl(t);return Po(n)&&(n=void 0),Po(e)?Jn(e,lr(t,1,Po,!0),void 0,n):[]});function Ll(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=on(r+i,0)),pt(e,qi(t,3),i)}function Ml(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=ia(n),i=n<0?on(r+i,0):an(i,r-1)),pt(e,qi(t,3),i,!0)}function wl(e){return null!=e&&e.length?lr(e,1):[]}function xl(e){return e&&e.length?e[0]:void 0}var kl=Pr(function(e){var t=st(e,ii);return t.length&&t[0]===e[0]?_r(t):[]}),Pl=Pr(function(e){var t=Bl(e),n=st(e,ii);return t===Bl(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?_r(n,qi(t,2)):[]}),Fl=Pr(function(e){var t=Bl(e),n=st(e,ii);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?_r(n,void 0,t):[]});function Bl(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hl=Pr(Ul);function Ul(e,t){return e&&e.length&&t&&t.length?Mr(e,t):e}var Yl=Gi(function(e,t){var n=null==e?0:e.length,r=$n(e,t);return wr(e,st(t,function(e){return ll(e,n)?+e:e}).sort(Ei)),r});function Gl(e){return null==e?e:cn.call(e)}var Wl=Pr(function(e){return Zr(lr(e,1,Po,!0))}),jl=Pr(function(e){var t=Bl(e);return Po(t)&&(t=void 0),Zr(lr(e,1,Po,!0),qi(t,2))}),zl=Pr(function(e){var t=Bl(e);return t="function"==typeof t?t:void 0,Zr(lr(e,1,Po,!0),void 0,t)});function Kl(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Po(e))return t=on(e.length,t),!0}),It(t,function(t){return st(e,ht(t))})}function $l(e,t){if(!e||!e.length)return[];var n=Kl(e);return null==t?n:st(n,function(e){return tt(t,void 0,e)})}var ql=Pr(function(e,t){return Po(e)?Jn(e,t):[]}),Xl=Pr(function(e){return ni(ot(e,Po))}),Zl=Pr(function(e){var t=Bl(e);return Po(t)&&(t=void 0),ni(ot(e,Po),qi(t,2))}),Ql=Pr(function(e){var t=Bl(e);return t="function"==typeof t?t:void 0,ni(ot(e,Po),void 0,t)}),Jl=Pr(Kl),eo=Pr(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,$l(e,n)});function to(e){var t=An(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var ro=Gi(function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return $n(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Ln&&ll(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[i],thisArg:void 0}),new Vn(r,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(i)}),io=Si(function(e,t,n){De.call(e,n)?++e[n]:Kn(e,n,1)}),lo=Ii(Ll),oo=Ii(Ml);function ao(e,t){return(wo(e)?rt:er)(e,qi(t,3))}function uo(e,t){return(wo(e)?it:tr)(e,qi(t,3))}var so=Si(function(e,t,n){De.call(e,n)?e[n].push(t):Kn(e,n,[t])}),co=Pr(function(e,t,n){var r=-1,i="function"==typeof t,l=ko(e)?K(e.length):[];return er(e,function(e){l[++r]=i?tt(t,e,n):Sr(e,t,n)}),l}),vo=Si(function(e,t,n){Kn(e,n,t)});function Eo(e,t){return(wo(e)?st:Tr)(e,qi(t,3))}var mo=Si(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),fo=Pr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&ol(e,t[0],t[1])?t=[]:n>2&&ol(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,lr(t,1),[])}),po=Xt||function(){return Ge.Date.now()};function _o(e,t,n){return t=n?void 0:t,Fi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function So(e,t){var r;if("function"!=typeof t)throw new _e(n);return e=ia(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}var go=Pr(function(e,t,n){var r=1;if(n.length){var i=Bt(n,$i(go));r|=32}return Fi(e,r,t,n,i)}),yo=Pr(function(e,t,n){var r=3;if(n.length){var i=Bt(n,$i(yo));r|=32}return Fi(t,r,e,n,i)});function ho(e,t,r){var i,l,o,a,u,s,d=0,c=!1,v=!1,E=!0;if("function"!=typeof e)throw new _e(n);function m(t){var n=i,r=l;return i=l=void 0,d=t,a=e.apply(r,n)}function f(e){return d=e,u=Sl(_,t),c?m(e):a}function p(e){var n=e-s;return void 0===s||n>=t||n<0||v&&e-d>=o}function _(){var e=po();if(p(e))return S(e);u=Sl(_,function(e){var n=t-(e-s);return v?an(n,o-(e-d)):n}(e))}function S(e){return u=void 0,E&&i?m(e):(i=l=void 0,a)}function g(){var e=po(),n=p(e);if(i=arguments,l=this,s=e,n){if(void 0===u)return f(s);if(v)return si(u),u=Sl(_,t),m(s)}return void 0===u&&(u=Sl(_,t)),a}return t=oa(t)||0,Wo(r)&&(c=!!r.leading,o=(v="maxWait"in r)?on(oa(r.maxWait)||0,t):o,E="trailing"in r?!!r.trailing:E),g.cancel=function(){void 0!==u&&si(u),d=0,i=s=l=u=void 0},g.flush=function(){return void 0===u?a:S(po())},g}var Do=Pr(function(e,t){return Qn(e,1,t)}),Ro=Pr(function(e,t,n){return Qn(e,oa(t)||0,n)});function No(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new _e(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],l=r.cache;if(l.has(i))return l.get(i);var o=e.apply(this,n);return r.cache=l.set(i,o)||l,o};return r.cache=new(No.Cache||xn),r}function Io(e){if("function"!=typeof e)throw new _e(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}No.Cache=xn;var To=ai(function(e,t){var n=(t=1==t.length&&wo(t[0])?st(t[0],Ct(qi())):st(lr(t,1),Ct(qi()))).length;return Pr(function(r){for(var i=-1,l=an(r.length,n);++i<l;)r[i]=t[i].call(this,r[i]);return tt(e,this,r)})}),Co=Pr(function(e,t){return Fi(e,32,void 0,t,Bt(t,$i(Co)))}),Ao=Pr(function(e,t){return Fi(e,64,void 0,t,Bt(t,$i(Ao)))}),bo=Gi(function(e,t){return Fi(e,256,void 0,void 0,void 0,t)});function Oo(e,t){return e===t||e!=e&&t!=t}var Vo=Mi(mr),Lo=Mi(function(e,t){return e>=t}),Mo=gr(function(){return arguments}())?gr:function(e){return jo(e)&&De.call(e,"callee")&&!Ke.call(e,"callee")},wo=K.isArray,xo=qe?Ct(qe):function(e){return jo(e)&&Er(e)==h};function ko(e){return null!=e&&Go(e.length)&&!Uo(e)}function Po(e){return jo(e)&&ko(e)}var Fo=tn||ou,Bo=Xe?Ct(Xe):function(e){return jo(e)&&Er(e)==u};function Ho(e){if(!jo(e))return!1;var t=Er(e);return t==s||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!$o(e)}function Uo(e){if(!Wo(e))return!1;var t=Er(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Yo(e){return"number"==typeof e&&e==ia(e)}function Go(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Wo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function jo(e){return null!=e&&"object"==typeof e}var zo=Ze?Ct(Ze):function(e){return jo(e)&&tl(e)==v};function Ko(e){return"number"==typeof e||jo(e)&&Er(e)==E}function $o(e){if(!jo(e)||Er(e)!=m)return!1;var t=We(e);if(null===t)return!0;var n=De.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&he.call(n)==Te}var qo=Qe?Ct(Qe):function(e){return jo(e)&&Er(e)==f},Xo=Je?Ct(Je):function(e){return jo(e)&&tl(e)==_};function Zo(e){return"string"==typeof e||!wo(e)&&jo(e)&&Er(e)==S}function Qo(e){return"symbol"==typeof e||jo(e)&&Er(e)==g}var Jo=et?Ct(et):function(e){return jo(e)&&Go(e.length)&&!!ke[Er(e)]},ea=Mi(Ir),ta=Mi(function(e,t){return e<=t});function na(e){if(!e)return[];if(ko(e))return Zo(e)?Gt(e):pi(e);if(Dt&&e[Dt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Dt]());var t=tl(e);return(t==v?Pt:t==_?Ht:Oa)(e)}function ra(e){return e?(e=oa(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ia(e){var t=ra(e),n=t%1;return t==t?n?t-n:t:0}function la(e){return e?qn(ia(e),0,4294967295):0}function oa(e){if("number"==typeof e)return e;if(Qo(e))return NaN;if(Wo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Wo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=re.test(e);return n||le.test(e)?He(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function aa(e){return _i(e,Da(e))}function ua(e){return null==e?"":Xr(e)}var sa=gi(function(e,t){if(dl(t)||ko(t))_i(t,ha(t),e);else for(var n in t)De.call(t,n)&&Gn(e,n,t[n])}),da=gi(function(e,t){_i(t,Da(t),e)}),ca=gi(function(e,t,n,r){_i(t,Da(t),e,r)}),va=gi(function(e,t,n,r){_i(t,ha(t),e,r)}),Ea=Gi($n),ma=Pr(function(e,t){e=me(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&ol(t[0],t[1],i)&&(r=1);++n<r;)for(var l=t[n],o=Da(l),a=-1,u=o.length;++a<u;){var s=o[a],d=e[s];(void 0===d||Oo(d,ge[s])&&!De.call(e,s))&&(e[s]=l[s])}return e}),fa=Pr(function(e){return e.push(void 0,Hi),tt(Na,void 0,e)});function pa(e,t,n){var r=null==e?void 0:cr(e,t);return void 0===r?n:r}function _a(e,t){return null!=e&&nl(e,t,pr)}var Sa=Ai(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ie.call(t)),e[t]=n},Wa(Ka)),ga=Ai(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ie.call(t)),De.call(e,t)?e[t].push(n):e[t]=[n]},qi),ya=Pr(Sr);function ha(e){return ko(e)?Fn(e):Nr(e)}function Da(e){return ko(e)?Fn(e,!0):function(e){if(!Wo(e))return function(e){var t=[];if(null!=e)for(var n in me(e))t.push(n);return t}(e);var t=dl(e),n=[];for(var r in e)("constructor"!=r||!t&&De.call(e,r))&&n.push(r);return n}(e)}var Ra=gi(function(e,t,n){br(e,t,n)}),Na=gi(function(e,t,n,r){br(e,t,n,r)}),Ia=Gi(function(e,t){var n={};if(null==e)return n;var r=!1;t=st(t,function(t){return t=oi(t,e),r||(r=t.length>1),t}),_i(e,ji(e),n),r&&(n=Xn(n,7,Ui));for(var i=t.length;i--;)Qr(n,t[i]);return n}),Ta=Gi(function(e,t){return null==e?{}:function(e,t){return Lr(e,t,function(t,n){return _a(e,n)})}(e,t)});function Ca(e,t){if(null==e)return{};var n=st(ji(e),function(e){return[e]});return t=qi(t),Lr(e,n,function(e,n){return t(e,n[0])})}var Aa=Pi(ha),ba=Pi(Da);function Oa(e){return null==e?[]:At(e,ha(e))}var Va=Ri(function(e,t,n){return t=t.toLowerCase(),e+(n?La(t):t)});function La(e){return Ha(ua(e).toLowerCase())}function Ma(e){return(e=ua(e))&&e.replace(ae,Mt).replace(be,"")}var wa=Ri(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),xa=Ri(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),ka=Di("toLowerCase"),Pa=Ri(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Fa=Ri(function(e,t,n){return e+(n?" ":"")+Ha(t)}),Ba=Ri(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ha=Di("toUpperCase");function Ua(e,t,n){return e=ua(e),void 0===(t=n?void 0:t)?function(e){return Me.test(e)}(e)?function(e){return e.match(Ve)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var Ya=Pr(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ho(e)?e:new ce(e)}}),Ga=Gi(function(e,t){return rt(t,function(t){t=Tl(t),Kn(e,t,go(e[t],e))}),e});function Wa(e){return function(){return e}}var ja=Ti(),za=Ti(!0);function Ka(e){return e}function $a(e){return Rr("function"==typeof e?e:Xn(e,1))}var qa=Pr(function(e,t){return function(n){return Sr(n,e,t)}}),Xa=Pr(function(e,t){return function(n){return Sr(e,n,t)}});function Za(e,t,n){var r=ha(t),i=dr(t,r);null!=n||Wo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=dr(t,ha(t)));var l=!(Wo(n)&&"chain"in n&&!n.chain),o=Uo(e);return rt(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(l||t){var n=e(this.__wrapped__),i=n.__actions__=pi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,dt([this.value()],arguments))})}),e}function Qa(){}var Ja=Oi(st),eu=Oi(lt),tu=Oi(Et);function nu(e){return al(e)?ht(Tl(e)):function(e){return function(t){return cr(t,e)}}(e)}var ru=Li(),iu=Li(!0);function lu(){return[]}function ou(){return!1}var au,uu=bi(function(e,t){return e+t},0),su=xi("ceil"),du=bi(function(e,t){return e/t},1),cu=xi("floor"),vu=bi(function(e,t){return e*t},1),Eu=xi("round"),mu=bi(function(e,t){return e-t},0);return An.after=function(e,t){if("function"!=typeof t)throw new _e(n);return e=ia(e),function(){if(--e<1)return t.apply(this,arguments)}},An.ary=_o,An.assign=sa,An.assignIn=da,An.assignInWith=ca,An.assignWith=va,An.at=Ea,An.before=So,An.bind=go,An.bindAll=Ga,An.bindKey=yo,An.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return wo(e)?e:[e]},An.chain=to,An.chunk=function(e,t,n){t=(n?ol(e,t,n):void 0===t)?1:on(ia(t),0);var r=null==e?0:e.length;if(!r||t<1)return[];for(var i=0,l=0,o=K(Qt(r/t));i<r;)o[l++]=Wr(e,i,i+=t);return o},An.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var l=e[t];l&&(i[r++]=l)}return i},An.concat=function(){var e=arguments.length;if(!e)return[];for(var t=K(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return dt(wo(n)?pi(n):[n],lr(t,1))},An.cond=function(e){var t=null==e?0:e.length,r=qi();return e=t?st(e,function(e){if("function"!=typeof e[1])throw new _e(n);return[r(e[0]),e[1]]}):[],Pr(function(n){for(var r=-1;++r<t;){var i=e[r];if(tt(i[0],this,n))return tt(i[1],this,n)}})},An.conforms=function(e){return function(e){var t=ha(e);return function(n){return Zn(n,e,t)}}(Xn(e,1))},An.constant=Wa,An.countBy=io,An.create=function(e,t){var n=bn(e);return null==t?n:zn(n,t)},An.curry=function e(t,n,r){var i=Fi(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},An.curryRight=function e(t,n,r){var i=Fi(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},An.debounce=ho,An.defaults=ma,An.defaultsDeep=fa,An.defer=Do,An.delay=Ro,An.difference=bl,An.differenceBy=Ol,An.differenceWith=Vl,An.drop=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=n||void 0===t?1:ia(t))<0?0:t,r):[]},An.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,0,(t=r-(t=n||void 0===t?1:ia(t)))<0?0:t):[]},An.dropRightWhile=function(e,t){return e&&e.length?ei(e,qi(t,3),!0,!0):[]},An.dropWhile=function(e,t){return e&&e.length?ei(e,qi(t,3),!0):[]},An.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&ol(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=ia(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:ia(r))<0&&(r+=i),r=n>r?0:la(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},An.filter=function(e,t){return(wo(e)?ot:ir)(e,qi(t,3))},An.flatMap=function(e,t){return lr(Eo(e,t),1)},An.flatMapDeep=function(e,t){return lr(Eo(e,t),1/0)},An.flatMapDepth=function(e,t,n){return n=void 0===n?1:ia(n),lr(Eo(e,t),n)},An.flatten=wl,An.flattenDeep=function(e){return null!=e&&e.length?lr(e,1/0):[]},An.flattenDepth=function(e,t){return null!=e&&e.length?lr(e,t=void 0===t?1:ia(t)):[]},An.flip=function(e){return Fi(e,512)},An.flow=ja,An.flowRight=za,An.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},An.functions=function(e){return null==e?[]:dr(e,ha(e))},An.functionsIn=function(e){return null==e?[]:dr(e,Da(e))},An.groupBy=so,An.initial=function(e){return null!=e&&e.length?Wr(e,0,-1):[]},An.intersection=kl,An.intersectionBy=Pl,An.intersectionWith=Fl,An.invert=Sa,An.invertBy=ga,An.invokeMap=co,An.iteratee=$a,An.keyBy=vo,An.keys=ha,An.keysIn=Da,An.map=Eo,An.mapKeys=function(e,t){var n={};return t=qi(t,3),ur(e,function(e,r,i){Kn(n,t(e,r,i),e)}),n},An.mapValues=function(e,t){var n={};return t=qi(t,3),ur(e,function(e,r,i){Kn(n,r,t(e,r,i))}),n},An.matches=function(e){return Cr(Xn(e,1))},An.matchesProperty=function(e,t){return Ar(e,Xn(t,1))},An.memoize=No,An.merge=Ra,An.mergeWith=Na,An.method=qa,An.methodOf=Xa,An.mixin=Za,An.negate=Io,An.nthArg=function(e){return e=ia(e),Pr(function(t){return Or(t,e)})},An.omit=Ia,An.omitBy=function(e,t){return Ca(e,Io(qi(t)))},An.once=function(e){return So(2,e)},An.orderBy=function(e,t,n,r){return null==e?[]:(wo(t)||(t=null==t?[]:[t]),wo(n=r?void 0:n)||(n=null==n?[]:[n]),Vr(e,t,n))},An.over=Ja,An.overArgs=To,An.overEvery=eu,An.overSome=tu,An.partial=Co,An.partialRight=Ao,An.partition=mo,An.pick=Ta,An.pickBy=Ca,An.property=nu,An.propertyOf=function(e){return function(t){return null==e?void 0:cr(e,t)}},An.pull=Hl,An.pullAll=Ul,An.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Mr(e,t,qi(n,2)):e},An.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Mr(e,t,void 0,n):e},An.pullAt=Yl,An.range=ru,An.rangeRight=iu,An.rearg=bo,An.reject=function(e,t){return(wo(e)?ot:ir)(e,Io(qi(t,3)))},An.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],l=e.length;for(t=qi(t,3);++r<l;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return wr(e,i),n},An.rest=function(e,t){if("function"!=typeof e)throw new _e(n);return Pr(e,t=void 0===t?t:ia(t))},An.reverse=Gl,An.sampleSize=function(e,t,n){return t=(n?ol(e,t,n):void 0===t)?1:ia(t),(wo(e)?Hn:Br)(e,t)},An.set=function(e,t,n){return null==e?e:Hr(e,t,n)},An.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:Hr(e,t,n,r)},An.shuffle=function(e){return(wo(e)?Un:Gr)(e)},An.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&ol(e,t,n)?(t=0,n=r):(t=null==t?0:ia(t),n=void 0===n?r:ia(n)),Wr(e,t,n)):[]},An.sortBy=fo,An.sortedUniq=function(e){return e&&e.length?$r(e):[]},An.sortedUniqBy=function(e,t){return e&&e.length?$r(e,qi(t,2)):[]},An.split=function(e,t,n){return n&&"number"!=typeof n&&ol(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ua(e))&&("string"==typeof t||null!=t&&!qo(t))&&!(t=Xr(t))&&kt(e)?ui(Gt(e),0,n):e.split(t,n):[]},An.spread=function(e,t){if("function"!=typeof e)throw new _e(n);return t=null==t?0:on(ia(t),0),Pr(function(n){var r=n[t],i=ui(n,0,t);return r&&dt(i,r),tt(e,this,i)})},An.tail=function(e){var t=null==e?0:e.length;return t?Wr(e,1,t):[]},An.take=function(e,t,n){return e&&e.length?Wr(e,0,(t=n||void 0===t?1:ia(t))<0?0:t):[]},An.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=r-(t=n||void 0===t?1:ia(t)))<0?0:t,r):[]},An.takeRightWhile=function(e,t){return e&&e.length?ei(e,qi(t,3),!1,!0):[]},An.takeWhile=function(e,t){return e&&e.length?ei(e,qi(t,3)):[]},An.tap=function(e,t){return t(e),e},An.throttle=function(e,t,r){var i=!0,l=!0;if("function"!=typeof e)throw new _e(n);return Wo(r)&&(i="leading"in r?!!r.leading:i,l="trailing"in r?!!r.trailing:l),ho(e,t,{leading:i,maxWait:t,trailing:l})},An.thru=no,An.toArray=na,An.toPairs=Aa,An.toPairsIn=ba,An.toPath=function(e){return wo(e)?st(e,Tl):Qo(e)?[e]:pi(Il(ua(e)))},An.toPlainObject=aa,An.transform=function(e,t,n){var r=wo(e),i=r||Fo(e)||Jo(e);if(t=qi(t,4),null==n){var l=e&&e.constructor;n=i?r?new l:[]:Wo(e)&&Uo(l)?bn(We(e)):{}}return(i?rt:ur)(e,function(e,r,i){return t(n,e,r,i)}),n},An.unary=function(e){return _o(e,1)},An.union=Wl,An.unionBy=jl,An.unionWith=zl,An.uniq=function(e){return e&&e.length?Zr(e):[]},An.uniqBy=function(e,t){return e&&e.length?Zr(e,qi(t,2)):[]},An.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Zr(e,void 0,t):[]},An.unset=function(e,t){return null==e||Qr(e,t)},An.unzip=Kl,An.unzipWith=$l,An.update=function(e,t,n){return null==e?e:Jr(e,t,li(n))},An.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:Jr(e,t,li(n),r)},An.values=Oa,An.valuesIn=function(e){return null==e?[]:At(e,Da(e))},An.without=ql,An.words=Ua,An.wrap=function(e,t){return Co(li(t),e)},An.xor=Xl,An.xorBy=Zl,An.xorWith=Ql,An.zip=Jl,An.zipObject=function(e,t){return ri(e||[],t||[],Gn)},An.zipObjectDeep=function(e,t){return ri(e||[],t||[],Hr)},An.zipWith=eo,An.entries=Aa,An.entriesIn=ba,An.extend=da,An.extendWith=ca,Za(An,An),An.add=uu,An.attempt=Ya,An.camelCase=Va,An.capitalize=La,An.ceil=su,An.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=oa(n))==n?n:0),void 0!==t&&(t=(t=oa(t))==t?t:0),qn(oa(e),t,n)},An.clone=function(e){return Xn(e,4)},An.cloneDeep=function(e){return Xn(e,5)},An.cloneDeepWith=function(e,t){return Xn(e,5,t="function"==typeof t?t:void 0)},An.cloneWith=function(e,t){return Xn(e,4,t="function"==typeof t?t:void 0)},An.conformsTo=function(e,t){return null==t||Zn(e,t,ha(t))},An.deburr=Ma,An.defaultTo=function(e,t){return null==e||e!=e?t:e},An.divide=du,An.endsWith=function(e,t,n){e=ua(e),t=Xr(t);var r=e.length,i=n=void 0===n?r:qn(ia(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},An.eq=Oo,An.escape=function(e){return(e=ua(e))&&P.test(e)?e.replace(x,wt):e},An.escapeRegExp=function(e){return(e=ua(e))&&j.test(e)?e.replace(W,"\\$&"):e},An.every=function(e,t,n){var r=wo(e)?lt:nr;return n&&ol(e,t,n)&&(t=void 0),r(e,qi(t,3))},An.find=lo,An.findIndex=Ll,An.findKey=function(e,t){return ft(e,qi(t,3),ur)},An.findLast=oo,An.findLastIndex=Ml,An.findLastKey=function(e,t){return ft(e,qi(t,3),sr)},An.floor=cu,An.forEach=ao,An.forEachRight=uo,An.forIn=function(e,t){return null==e?e:or(e,qi(t,3),Da)},An.forInRight=function(e,t){return null==e?e:ar(e,qi(t,3),Da)},An.forOwn=function(e,t){return e&&ur(e,qi(t,3))},An.forOwnRight=function(e,t){return e&&sr(e,qi(t,3))},An.get=pa,An.gt=Vo,An.gte=Lo,An.has=function(e,t){return null!=e&&nl(e,t,fr)},An.hasIn=_a,An.head=xl,An.identity=Ka,An.includes=function(e,t,n,r){e=ko(e)?e:Oa(e),n=n&&!r?ia(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Zo(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&_t(e,t,n)>-1},An.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ia(n);return i<0&&(i=on(r+i,0)),_t(e,t,i)},An.inRange=function(e,t,n){return t=ra(t),void 0===n?(n=t,t=0):n=ra(n),function(e,t,n){return e>=an(t,n)&&e<on(t,n)}(e=oa(e),t,n)},An.invoke=ya,An.isArguments=Mo,An.isArray=wo,An.isArrayBuffer=xo,An.isArrayLike=ko,An.isArrayLikeObject=Po,An.isBoolean=function(e){return!0===e||!1===e||jo(e)&&Er(e)==a},An.isBuffer=Fo,An.isDate=Bo,An.isElement=function(e){return jo(e)&&1===e.nodeType&&!$o(e)},An.isEmpty=function(e){if(null==e)return!0;if(ko(e)&&(wo(e)||"string"==typeof e||"function"==typeof e.splice||Fo(e)||Jo(e)||Mo(e)))return!e.length;var t=tl(e);if(t==v||t==_)return!e.size;if(dl(e))return!Nr(e).length;for(var n in e)if(De.call(e,n))return!1;return!0},An.isEqual=function(e,t){return yr(e,t)},An.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?yr(e,t,void 0,n):!!r},An.isError=Ho,An.isFinite=function(e){return"number"==typeof e&&nn(e)},An.isFunction=Uo,An.isInteger=Yo,An.isLength=Go,An.isMap=zo,An.isMatch=function(e,t){return e===t||hr(e,t,Zi(t))},An.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,hr(e,t,Zi(t),n)},An.isNaN=function(e){return Ko(e)&&e!=+e},An.isNative=function(e){if(sl(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dr(e)},An.isNil=function(e){return null==e},An.isNull=function(e){return null===e},An.isNumber=Ko,An.isObject=Wo,An.isObjectLike=jo,An.isPlainObject=$o,An.isRegExp=qo,An.isSafeInteger=function(e){return Yo(e)&&e>=-9007199254740991&&e<=9007199254740991},An.isSet=Xo,An.isString=Zo,An.isSymbol=Qo,An.isTypedArray=Jo,An.isUndefined=function(e){return void 0===e},An.isWeakMap=function(e){return jo(e)&&tl(e)==y},An.isWeakSet=function(e){return jo(e)&&"[object WeakSet]"==Er(e)},An.join=function(e,t){return null==e?"":rn.call(e,t)},An.kebabCase=wa,An.last=Bl,An.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=ia(n))<0?on(r+i,0):an(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):pt(e,gt,i,!0)},An.lowerCase=xa,An.lowerFirst=ka,An.lt=ea,An.lte=ta,An.max=function(e){return e&&e.length?rr(e,Ka,mr):void 0},An.maxBy=function(e,t){return e&&e.length?rr(e,qi(t,2),mr):void 0},An.mean=function(e){return yt(e,Ka)},An.meanBy=function(e,t){return yt(e,qi(t,2))},An.min=function(e){return e&&e.length?rr(e,Ka,Ir):void 0},An.minBy=function(e,t){return e&&e.length?rr(e,qi(t,2),Ir):void 0},An.stubArray=lu,An.stubFalse=ou,An.stubObject=function(){return{}},An.stubString=function(){return""},An.stubTrue=function(){return!0},An.multiply=vu,An.nth=function(e,t){return e&&e.length?Or(e,ia(t)):void 0},An.noConflict=function(){return Ge._===this&&(Ge._=Ce),this},An.noop=Qa,An.now=po,An.pad=function(e,t,n){e=ua(e);var r=(t=ia(t))?Yt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Vi(Jt(i),n)+e+Vi(Qt(i),n)},An.padEnd=function(e,t,n){e=ua(e);var r=(t=ia(t))?Yt(e):0;return t&&r<t?e+Vi(t-r,n):e},An.padStart=function(e,t,n){e=ua(e);var r=(t=ia(t))?Yt(e):0;return t&&r<t?Vi(t-r,n)+e:e},An.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),sn(ua(e).replace(z,""),t||0)},An.random=function(e,t,n){if(n&&"boolean"!=typeof n&&ol(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ra(e),void 0===t?(t=e,e=0):t=ra(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=dn();return an(e+i*(t-e+Be("1e-"+((i+"").length-1))),t)}return xr(e,t)},An.reduce=function(e,t,n){var r=wo(e)?ct:Rt,i=arguments.length<3;return r(e,qi(t,4),n,i,er)},An.reduceRight=function(e,t,n){var r=wo(e)?vt:Rt,i=arguments.length<3;return r(e,qi(t,4),n,i,tr)},An.repeat=function(e,t,n){return t=(n?ol(e,t,n):void 0===t)?1:ia(t),kr(ua(e),t)},An.replace=function(){var e=arguments,t=ua(e[0]);return e.length<3?t:t.replace(e[1],e[2])},An.result=function(e,t,n){var r=-1,i=(t=oi(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var l=null==e?void 0:e[Tl(t[r])];void 0===l&&(r=i,l=n),e=Uo(l)?l.call(e):l}return e},An.round=Eu,An.runInContext=e,An.sample=function(e){return(wo(e)?Bn:Fr)(e)},An.size=function(e){if(null==e)return 0;if(ko(e))return Zo(e)?Yt(e):e.length;var t=tl(e);return t==v||t==_?e.size:Nr(e).length},An.snakeCase=Pa,An.some=function(e,t,n){var r=wo(e)?Et:jr;return n&&ol(e,t,n)&&(t=void 0),r(e,qi(t,3))},An.sortedIndex=function(e,t){return zr(e,t)},An.sortedIndexBy=function(e,t,n){return Kr(e,t,qi(n,2))},An.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=zr(e,t);if(r<n&&Oo(e[r],t))return r}return-1},An.sortedLastIndex=function(e,t){return zr(e,t,!0)},An.sortedLastIndexBy=function(e,t,n){return Kr(e,t,qi(n,2),!0)},An.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=zr(e,t,!0)-1;if(Oo(e[n],t))return n}return-1},An.startCase=Fa,An.startsWith=function(e,t,n){return e=ua(e),n=null==n?0:qn(ia(n),0,e.length),t=Xr(t),e.slice(n,n+t.length)==t},An.subtract=mu,An.sum=function(e){return e&&e.length?Nt(e,Ka):0},An.sumBy=function(e,t){return e&&e.length?Nt(e,qi(t,2)):0},An.template=function(e,t,n){var r=An.templateSettings;n&&ol(e,t,n)&&(t=void 0),e=ua(e),t=ca({},t,r,Bi);var i,l,o=ca({},t.imports,r.imports,Bi),a=ha(o),u=At(o,a),s=0,d=t.interpolate||ue,c="__p += '",v=fe((t.escape||ue).source+"|"+d.source+"|"+(d===H?ee:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),E="//# sourceURL="+(De.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++xe+"]")+"\n";e.replace(v,function(t,n,r,o,a,u){return r||(r=o),c+=e.slice(s,u).replace(se,xt),n&&(i=!0,c+="' +\n__e("+n+") +\n'"),a&&(l=!0,c+="';\n"+a+";\n__p += '"),r&&(c+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),s=u+t.length,t}),c+="';\n";var m=De.call(t,"variable")&&t.variable;if(m){if(Q.test(m))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(l?c.replace(V,""):c).replace(L,"$1").replace(M,"$1;"),c="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var f=Ya(function(){return ve(a,E+"return "+c).apply(void 0,u)});if(f.source=c,Ho(f))throw f;return f},An.times=function(e,t){if((e=ia(e))<1||e>9007199254740991)return[];var n=4294967295,r=an(e,4294967295);e-=4294967295;for(var i=It(r,t=qi(t));++n<e;)t(n);return i},An.toFinite=ra,An.toInteger=ia,An.toLength=la,An.toLower=function(e){return ua(e).toLowerCase()},An.toNumber=oa,An.toSafeInteger=function(e){return e?qn(ia(e),-9007199254740991,9007199254740991):0===e?e:0},An.toString=ua,An.toUpper=function(e){return ua(e).toUpperCase()},An.trim=function(e,t,n){if((e=ua(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=Xr(t)))return e;var r=Gt(e),i=Gt(t);return ui(r,Ot(r,i),Vt(r,i)+1).join("")},An.trimEnd=function(e,t,n){if((e=ua(e))&&(n||void 0===t))return e.slice(0,Wt(e)+1);if(!e||!(t=Xr(t)))return e;var r=Gt(e);return ui(r,0,Vt(r,Gt(t))+1).join("")},An.trimStart=function(e,t,n){if((e=ua(e))&&(n||void 0===t))return e.replace(z,"");if(!e||!(t=Xr(t)))return e;var r=Gt(e);return ui(r,Ot(r,Gt(t))).join("")},An.truncate=function(e,t){var n=30,r="...";if(Wo(t)){var i="separator"in t?t.separator:i;n="length"in t?ia(t.length):n,r="omission"in t?Xr(t.omission):r}var l=(e=ua(e)).length;if(kt(e)){var o=Gt(e);l=o.length}if(n>=l)return e;var a=n-Yt(r);if(a<1)return r;var u=o?ui(o,0,a).join(""):e.slice(0,a);if(void 0===i)return u+r;if(o&&(a+=u.length-a),qo(i)){if(e.slice(a).search(i)){var s,d=u;for(i.global||(i=fe(i.source,ua(te.exec(i))+"g")),i.lastIndex=0;s=i.exec(d);)var c=s.index;u=u.slice(0,void 0===c?a:c)}}else if(e.indexOf(Xr(i),a)!=a){var v=u.lastIndexOf(i);v>-1&&(u=u.slice(0,v))}return u+r},An.unescape=function(e){return(e=ua(e))&&k.test(e)?e.replace(w,jt):e},An.uniqueId=function(e){var t=++Re;return ua(e)+t},An.upperCase=Ba,An.upperFirst=Ha,An.each=ao,An.eachRight=uo,An.first=xl,Za(An,(au={},ur(An,function(e,t){De.call(An.prototype,t)||(au[t]=e)}),au),{chain:!1}),An.VERSION="4.17.21",rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){An[e].placeholder=An}),rt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(ia(n),0);var r=this.__filtered__&&!t?new Ln(this):this.clone();return r.__filtered__?r.__takeCount__=an(n,r.__takeCount__):r.__views__.push({size:an(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),rt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:qi(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),rt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),rt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Ln.prototype[e]=function(){return this.__filtered__?new Ln(this):this[n](1)}}),Ln.prototype.compact=function(){return this.filter(Ka)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Pr(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return Sr(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(Io(qi(e)))},Ln.prototype.slice=function(e,t){e=ia(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Ln(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ia(t))<0?n.dropRight(-t):n.take(t-e)),n)},Ln.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295)},ur(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=An[r?"take"+("last"==t?"Right":""):t],l=r||/^find/.test(t);i&&(An.prototype[t]=function(){var t=this.__wrapped__,o=r?[1]:arguments,a=t instanceof Ln,u=o[0],s=a||wo(t),d=function(e){var t=i.apply(An,dt([e],o));return r&&c?t[0]:t};s&&n&&"function"==typeof u&&1!=u.length&&(a=s=!1);var c=this.__chain__,v=!!this.__actions__.length,E=l&&!c,m=a&&!v;if(!l&&s){t=m?t:new Ln(this);var f=e.apply(t,o);return f.__actions__.push({func:no,args:[d],thisArg:void 0}),new Vn(f,c)}return E&&m?e.apply(this,o):(f=this.thru(d),E?r?f.value()[0]:f.value():f)})}),rt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Se[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);An.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(wo(i)?i:[],e)}return this[n](function(n){return t.apply(wo(n)?n:[],e)})}}),ur(Ln.prototype,function(e,t){var n=An[t];if(n){var r=n.name+"";De.call(gn,r)||(gn[r]=[]),gn[r].push({name:t,func:n})}}),gn[Ci(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=pi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=pi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=pi(this.__views__),e},Ln.prototype.reverse=function(){if(this.__filtered__){var e=new Ln(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ln.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=wo(e),r=t<0,i=n?e.length:0,l=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var l=n[r],o=l.size;switch(l.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=an(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=l.start,a=l.end,u=a-o,s=r?a:o-1,d=this.__iteratees__,c=d.length,v=0,E=an(u,this.__takeCount__);if(!n||!r&&i==u&&E==u)return ti(e,this.__actions__);var m=[];e:for(;u--&&v<E;){for(var f=-1,p=e[s+=t];++f<c;){var _=d[f],S=_.type,g=(0,_.iteratee)(p);if(2==S)p=g;else if(!g){if(1==S)continue e;break e}}m[v++]=p}return m},An.prototype.at=ro,An.prototype.chain=function(){return to(this)},An.prototype.commit=function(){return new Vn(this.value(),this.__chain__)},An.prototype.next=function(){void 0===this.__values__&&(this.__values__=na(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},An.prototype.plant=function(e){for(var t,n=this;n instanceof On;){var r=Al(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},An.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ln){var t=e;return this.__actions__.length&&(t=new Ln(this)),(t=t.reverse()).__actions__.push({func:no,args:[Gl],thisArg:void 0}),new Vn(t,this.__chain__)}return this.thru(Gl)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return ti(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,Dt&&(An.prototype[Dt]=function(){return this}),An}();je?((je.exports=zt)._=zt,We._=zt):Ge._=zt}).call(p)}(f={exports:{}},f.exports);const _=e=>{let{parentRoute:o}=e;const{t:a}=r.useTranslation(),u=[{text:a("ES_TITLE_NEW_DESULDGING_APPLICATION"),link:"/digit-ui/employee/fsm/new-application",roles:["FSM_CREATOR_EMP"]},{text:a("ES_TITILE_SEARCH_APPLICATION"),link:o+"/search"},{text:a("ES_TITLE_REPORTS"),link:"/employee/report/fsm/FSMDailyDesludingReport",roles:["FSM_ADMIN"],hyperlink:!0}],[s,d]=t.useState([]),{roles:c}=Digit.UserService.getUser().info;return t.useEffect(()=>{let e=u.filter(e=>{let{roles:t}=e;return(null==t?void 0:t.some(e=>null==c?void 0:c.map(e=>{let{code:t}=e;return t}).includes(e)))||!(null!=t&&t.length)});d(e)},[]),n.createElement(l.Card,{className:"employeeCard inboxLinksFSM"},n.createElement("div",{className:"complaint-links-container"},n.createElement("div",{className:"header"},n.createElement("span",{className:"logo"},n.createElement(l.ShippingTruck,null))," ",n.createElement("span",{className:"text"},a("ES_TITLE_FAECAL_SLUDGE_MGMT"))),n.createElement("div",{className:"body"},s.map((e,t)=>{let{link:r,text:l,hyperlink:o=!1,accessTo:u=[]}=e;return n.createElement("span",{className:"link",key:t},o?n.createElement("a",{href:r},a(l)):n.createElement(i.Link,{to:r},a(l)))}))))},S=e=>{let{className:t="table",t:r,currentPage:i,columns:o,data:a,getCellProps:s,disableSort:d,onSort:c,onNextPage:v,onPrevPage:E,onPageSizeChange:m,pageSizeLimit:f,sortParams:p,totalRecords:_,isPaginationRequired:S,showCSVExport:g,csvExportFileName:y,csvExportData:h,getCSVExportData:D,csvExportColumns:R,csvExportButtonLabel:N,...I}=e;return n.createElement(l.Table,u({className:t,t:r,data:a,currentPage:i,columns:o,getCellProps:s,onNextPage:v,onPrevPage:E,pageSizeLimit:f,disableSort:d,onPageSizeChange:m,onSort:c,sortParams:p,totalRecords:_,isPaginationRequired:S,showCSVExport:g,csvExportFileName:y,csvExportData:h,getCSVExportData:D,csvExportColumns:R,csvExportButtonLabel:N},I))},g=e=>{var t;let{status:i,searchParams:o,onAssignmentChange:a,statusMap:u}=e;return r.useTranslation(),n.createElement(l.CheckBox,{styles:{height:"unset"},onChange:e=>a({...e,state:i.state},i),checked:null==o?void 0:o.applicationStatus.some(e=>e.uuid===i.uuid),label:`${i.name} (${(null==u||null===(t=u.find(e=>e.statusid===i.uuid))||void 0===t?void 0:t.count)||"-"})`})},y=e=>{var i,o,a,u,s;let{onAssignmentChange:d,searchParams:c,businessServices:v,statusMap:E}=e;const{t:m}=r.useTranslation(),[f,p]=t.useState(!1),{data:_,isLoading:S}=Digit.Hooks.useApplicationStatusGeneral({businessServices:v},{}),{userRoleStates:y}=_||{},h=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return S?n.createElement(l.Loader,null):null!=y&&y.filter(e=>!e.isTerminateState).length?n.createElement("div",{className:"status-container"},n.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},m("ES_INBOX_STATUS")),null==y||null===(i=y.filter(e=>!e.isTerminateState))||void 0===i||null===(o=i.slice(0,4))||void 0===o?void 0:o.map((e,t)=>n.createElement(g,{businessServices:v,key:t,onAssignmentChange:d,status:{name:h(e,m),code:e.applicationStatus,...e},searchParams:c,statusMap:E})),(null==y||null===(a=y.filter(e=>!e.isTerminateState))||void 0===a?void 0:a.slice(4).length)>0?n.createElement(n.Fragment,null,f&&(null==y||null===(u=y.filter(e=>!e.isTerminateState))||void 0===u||null===(s=u.slice(4))||void 0===s?void 0:s.map((e,t)=>n.createElement(g,{businessServices:v,key:e.uuid,onAssignmentChange:d,status:{name:h(e,m),code:e.applicationStatus,...e},searchParams:c,statusMap:E}))),n.createElement("div",{className:"filter-button",onClick:()=>p(!f)}," ",m(f?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null},h=e=>{let{onFilterChange:t,searchParams:r,paginationParms:i,tenantId:o,t:a}=e;const{data:u}=Digit.Hooks.fsm.useInbox(o,{...r,...i,fromDate:null!=r&&r.fromDate?new Date(null==r?void 0:r.fromDate).getTime():void 0,toDate:null!=r&&r.toDate?new Date(null==r?void 0:r.toDate).getTime():void 0,total:!0,uuid:{code:"ASSIGNED_TO_ALL",name:a("ES_INBOX_ASSIGNED_TO_ALL")}}),s=[{code:"ASSIGNED_TO_ME",name:a("ES_INBOX_ASSIGNED_TO_ME")+" (0)"},{code:"ASSIGNED_TO_ALL",name:`${a("ES_INBOX_ASSIGNED_TO_ALL")} (${(null==u?void 0:u.totalCount)||0})`}];return n.createElement(n.Fragment,null,n.createElement(l.RadioButtons,{onSelect:e=>t({uuid:{code:e.code}}),selectedOption:s.filter(e=>{var t;return e.code===(null==r||null===(t=r.uuid)||void 0===t?void 0:t.code)})[0],optionsKey:"name",options:s}))},D=e=>{var t,o,a,u;let{searchParams:s,paginationParms:d,onFilterChange:c,onSearch:v,...E}=e;const{t:m}=r.useTranslation(),f=i.useLocation(),p=Digit.UserService.hasAccess(["FSM_DSO"])||!1,_=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,S=Digit.UserService.hasAccess("FSM_EMP_FSTPO")&&f.pathname.includes("fstp-fsm-request")||!1,g=Digit.ULBService.getCurrentTenantId(),D=Digit.ULBService.getStateId(),{data:R,isFetched:N}=Digit.Hooks.fsm.useMDMS(D,"DIGIT-UI","RoleStatusMapping"),I=Digit.UserService.getUser().info.roles.map(e=>e.code),T=null==R?void 0:R.filter(e=>I.filter(t=>t===e.userRole)[0]),C=null==T?void 0:T.reduce((e,t)=>({fixed:(null==t?void 0:t.fixed)&&(null==e?void 0:e.fixed),statuses:[...null==e?void 0:e.statuses,...null==t?void 0:t.statuses].filter((e,t,n)=>n.indexOf(e)==t),zeroCheck:(null==t?void 0:t.zeroCheck)||(null==e?void 0:e.zeroCheck)}),{statuses:[]}),A=()=>{if(_)return c()};return n.createElement(n.Fragment,null,(!p&&!_&&s||(null==C||null===(t=C.statuses)||void 0===t?void 0:t.length)>0||S)&&n.createElement("div",{className:"filter",style:{marginTop:_?"-0px":"revert"}},n.createElement("div",{className:"filter-card"},n.createElement("div",{className:"heading"},n.createElement("div",{className:"filter-label"},m("ES_COMMON_FILTER_BY"),":"),n.createElement("div",{className:"clearAll",onClick:A},m("ES_COMMON_CLEAR_ALL")),"desktop"===E.type&&n.createElement("span",{className:"clear-search",onClick:A},m("ES_COMMON_CLEAR_ALL")),"mobile"===E.type&&n.createElement("span",{onClick:E.onClose},n.createElement(l.CloseSvg,null))),n.createElement("div",null,!p&&!_&&s&&n.createElement(h,{onFilterChange:c,searchParams:s,paginationParms:d,tenantId:g,t:m}),n.createElement("div",null)),(null==C||null===(o=C.statuses)||void 0===o?void 0:o.length)>0||S?n.createElement("div",null,n.createElement("div",{className:"filter-label"},m("ES_INBOX_LOCALITY")),n.createElement(l.Localities,{selectLocality:e=>{c(_?{locality:[e]}:{locality:[...null==s?void 0:s.locality,e]})},tenantId:g,boundaryType:"revenue"}),n.createElement("div",{className:"tag-container"},null==s?void 0:s.locality.map((e,t)=>n.createElement(l.RemoveableTag,{key:t,text:e.i18nkey,onClick:()=>{c({locality:null==s?void 0:s.locality.filter(t=>t.code!==e.code)})}})))):null,n.createElement("div",null,N&&C&&null!=E&&null!==(a=E.applications)&&void 0!==a&&a.statuses?n.createElement(y,{onAssignmentChange:(e,t)=>{c(e.target.checked?{applicationStatus:[...null==s?void 0:s.applicationStatus,t]}:{applicationStatus:null==s?void 0:s.applicationStatus.filter(e=>t.name!==e.name)})},fsmfilters:s,mergedRoleDetails:C,statusMap:null==E||null===(u=E.applications)||void 0===u?void 0:u.statuses}):f.pathname.includes("fstp-fsm-request")?"":n.createElement(l.Loader,null)))),"mobile"===E.type&&E.onClose&&n.createElement(l.ActionBar,null,n.createElement(l.ApplyFilterBar,{submit:!1,labelLink:m("ES_COMMON_CLEAR_ALL"),buttonLink:m("ES_COMMON_FILTER"),onClear:A,onSubmit:()=>{"mobile"===E.type?v({delete:["applicationNos"]}):v()},style:{flex:1}})))},R=e=>{let{onAssignmentChange:t,value:r,applicationStatuses:i,areApplicationStatus:o}=e;return o?n.createElement(l.Dropdown,{option:i,optionKey:"name",selected:r,select:t}):n.createElement(l.Loader,null)},N=e=>{let{onSearch:a,type:s,onClose:d,onTabChange:c,searchFields:v,searchParams:E,isInboxPage:m,selectedTab:f}=e;const p=m?Digit.SessionStorage.get("vendor/inbox/searchParams"):Digit.SessionStorage.get("vendor/search/searchParams"),{t:_}=r.useTranslation(),S=i.useHistory(),{register:g,handleSubmit:y,reset:h,watch:D,control:N}=o.useForm({defaultValues:p||E}),[I,T]=t.useState(!1),[C,A]=t.useState(!1),b=innerWidth<=640,O=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1;function V(){const e=v.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});h(e),m?Digit.SessionStorage.del("fsm/inbox/searchParams"):Digit.SessionStorage.del("fsm/search/searchParams"),a({})}D(["applicationNos","mobileNumber"]);const L=e=>null;return n.createElement(n.Fragment,null,n.createElement("div",{className:"search-container",style:{width:"auto"}},n.createElement("div",{className:"search-complaint-container"},("mobile"===s||b)&&n.createElement("div",{className:"complaint-header"},n.createElement("h2",null,_("ES_COMMON_SEARCH_BY")),n.createElement("span",{style:{position:"absolute",top:"2%",right:"8px"},onClick:d},n.createElement(l.CloseSvg,null))),n.createElement("div",{className:"search-tabs-container"},n.createElement("div",null,n.createElement("button",{className:"VENDOR"===f?"search-tab-head-selected":"search-tab-head",onClick:()=>{V(),c("VENDOR")}},_("ES_FSM_REGISTRY_INBOX_TAB_VENDOR")),n.createElement("button",{className:"VEHICLE"===f?"search-tab-head-selected":"search-tab-head",onClick:()=>{V(),c("VEHICLE")}},_("ES_FSM_REGISTRY_INBOX_TAB_VEHICLE")),n.createElement("button",{className:"DRIVER"===f?"search-tab-head-selected":"search-tab-head",onClick:()=>{V(),c("DRIVER")}},_("ES_FSM_REGISTRY_INBOX_TAB_DRIVER")),n.createElement("button",{className:"SUPERVISOR"===f?"search-tab-head-selected":"search-tab-head",onClick:()=>{V(),c("SUPERVISOR")}},_("ES_FSM_REGISTRY_INBOX_TAB_SUPERVISOR")),n.createElement("button",{className:"SURVEYOR"===f?"search-tab-head-selected":"search-tab-head",onClick:()=>{V(),c("SURVEYOR")}},_("ES_FSM_REGISTRY_INBOX_TAB_SURVEYOR"))),n.createElement("div",{className:"action-bar-wrap-registry"},n.createElement("div",{className:"search-add",onClick:()=>{A(!C)}},_("ES_VENDOR_REGISTRY_INBOX_HEADER_ADD"),n.createElement("div",{className:"search-add-icon"},n.createElement(l.AddIcon,{className:""}))),C&&n.createElement(l.Menu,{localeKeyPrefix:"ES_FSM_ACTION_CREATE",options:["VENDOR","DRIVER","VEHICLE","SUPERVISOR","SURVEYOR"],t:_,onSelect:function(e){switch(e){case"VENDOR":return S.push("/digit-ui/employee/vendor/registry/new-vendor");case"VEHICLE":return S.push("/digit-ui/employee/vendor/registry/new-vehicle");case"DRIVER":return S.push("/digit-ui/employee/vendor/registry/new-driver");case"SUPERVISOR":return S.push("/digit-ui/employee/vendor/registry/new-supervisor");case"SURVEYOR":return S.push("/digit-ui/employee/vendor/registry/new-surveyor")}}}))),n.createElement("form",{onSubmit:y(e=>{e.mobileNumber||delete e.mobileNumber,a(e),"mobile"===s&&d()})},n.createElement("div",{className:O?"for-pt for-search flex-box":"flex-box",style:{gap:"16px"}},null==v?void 0:v.map((e,t)=>n.createElement("span",{key:t,className:0===t?"finance-mainlayout-col1 complaint-input":"finance-mainlayout-col1 mobile-input"},(e=>{switch(e.type){case"date":return n.createElement(o.Controller,{render:e=>n.createElement(l.DatePicker,{date:e.value,onChange:e.onChange}),name:e.name,control:N,defaultValue:null});case"status":return n.createElement(o.Controller,{render:e=>n.createElement(R,{onAssignmentChange:e.onChange,value:e.value,applicationStatuses:applicationStatuses,areApplicationStatus:areApplicationStatus}),name:e.name,control:N,defaultValue:null});case"dropdown":return n.createElement(o.Controller,{render:t=>n.createElement(l.Dropdown,{option:e.options,optionKey:e.optionsKey,value:t.value,selected:t.value,select:t.onChange,t:_,placeholder:e.label}),name:e.name,control:N,defaultValue:null});default:return n.createElement(l.TextInput,u({},e,{inputRef:g},g(e.name,{validate:L}),{watch:D,shouldUpdate:!0,placeholder:e.label}))}})(e))),n.createElement("div",{style:{display:"flex",justifyContent:"end",gap:"16px",alignItems:"center"}},"desktop"===s&&!b&&n.createElement("span",{className:"clear-search generic-button"},n.createElement(l.LinkLabel,{style:{},onClick:V},_("ES_COMMON_CLEAR_SEARCH"))),"desktop"===s&&!b&&n.createElement(l.SubmitBar,{className:"submit-bar-search",label:_("ES_COMMON_SEARCH"),submit:!0}))),I?n.createElement(l.CardLabelError,{className:"search-error-label"},_("ES_SEARCH_APPLICATION_ERROR")):null))))},I=e=>{if(!e)return{};if("object"==typeof e)return e;if("string"!=typeof e)return{};try{return JSON.parse(e)}catch(e){return{}}},T=e=>{var t;return e?"string"==typeof e||"number"==typeof e?[String(e)]:[null==e?void 0:e.id,null==e?void 0:e.fillingStationId,null==e?void 0:e.bookingId,null==e?void 0:e.fillingPointId,null==e?void 0:e.uuid,null==e||null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId].filter(e=>null!=e&&""!==e).map(String):[]},C=function(e,t){void 0===t&&(t=[]);const n=function(e){var t,n,r,i,l,o,a,u,s,d,c,v,E;void 0===e&&(e={});const m=e=>Array.isArray(e)?e.flatMap(T):T(e);return Array.from(new Set([...[null===(t=e)||void 0===t?void 0:t.fillingPointId,null===(n=e)||void 0===n||null===(r=n.dsoDetails)||void 0===r?void 0:r.fillingPointId,null===(i=e)||void 0===i||null===(l=i.fillingpointmetadata)||void 0===l?void 0:l.fillingPointId,null===(o=e)||void 0===o?void 0:o.fillingPtName,null===(a=e)||void 0===a?void 0:a.filling_pt_name,null===(u=e)||void 0===u||null===(s=u.fillingPoint)||void 0===s?void 0:s.fillingPointId].filter(e=>null!=e&&""!==e).map(String),...m(null===(d=e)||void 0===d?void 0:d.fillingPoint),...m(null===(c=e)||void 0===c||null===(v=c.dsoDetails)||void 0===v?void 0:v.fillingPoint),...m(null===(E=e)||void 0===E?void 0:E.fillingPointDetail)]))}(e);return n.length&&t.find(e=>T(e).some(e=>n.includes(e)))||null},A=function(e){var t,n,r,i,l,o,a,u,s,d,c,v,E,m,f,p,_,S,g,y,h,D;if(void 0===e&&(e={}),Array.isArray(null===(t=e)||void 0===t?void 0:t.fillingPoint)){const t=e.fillingPoint.map(e=>(null==e?void 0:e.fillingPointName)||(null==e?void 0:e.fillingPointId)).filter(Boolean);if(t.length>0)return t.join(", ")}return(null===(n=e)||void 0===n||null===(r=n.fillingPoint)||void 0===r?void 0:r.fillingPointName)||(null===(i=e)||void 0===i||null===(l=i.dsoDetails)||void 0===l||null===(o=l.fillingPoint)||void 0===o?void 0:o.fillingPointName)||(null===(a=e)||void 0===a?void 0:a.fillingPointName)||(null===(u=e)||void 0===u||null===(s=u.dsoDetails)||void 0===s?void 0:s.fillingPointName)||(null===(d=e)||void 0===d?void 0:d.fillingPointId)||(null===(c=e)||void 0===c||null===(v=c.dsoDetails)||void 0===v?void 0:v.fillingPointId)||("string"==typeof(null===(E=e)||void 0===E?void 0:E.fillingPoint)?null===(m=e)||void 0===m?void 0:m.fillingPoint:null)||("string"==typeof(null===(f=e)||void 0===f||null===(p=f.dsoDetails)||void 0===p?void 0:p.fillingPoint)?null===(_=e)||void 0===_||null===(S=_.dsoDetails)||void 0===S?void 0:S.fillingPoint:null)||(null===(g=e)||void 0===g||null===(y=g.fillingpointmetadata)||void 0===y?void 0:y.fillingPointId)||(null===(h=e)||void 0===h?void 0:h.filling_pt_name)||(null===(D=e)||void 0===D?void 0:D.fillingPtName)||"NA"},b=function(e,t){var n,r,i,l,o,a,u;void 0===e&&(e={}),void 0===t&&(t=[]);const s=(null===(n=e)||void 0===n||null===(r=n.vendor)||void 0===r?void 0:r.id)||(null===(i=e)||void 0===i||null===(l=i.vendorData)||void 0===l?void 0:l.id)||(null===(o=e)||void 0===o?void 0:o.vendorId);return s&&(t.find(e=>(null==e?void 0:e.id)===s)||(null===(a=e)||void 0===a?void 0:a.vendor)||(null===(u=e)||void 0===u?void 0:u.vendorData))||null},O=function(e){var t,n,r,i;void 0===e&&(e={});const l=[...Array.isArray(null===(t=e)||void 0===t?void 0:t.fillingPoint)?e.fillingPoint:[null===(n=e)||void 0===n?void 0:n.fillingPoint],...Array.isArray(null===(r=e)||void 0===r?void 0:r.fillingPoints)?e.fillingPoints:[null===(i=e)||void 0===i?void 0:i.fillingPoints]].filter(Boolean),o=new Map;return l.forEach(e=>{const t=T(e)[0]||(null==e?void 0:e.fillingPointName)||(null==e?void 0:e.id);t&&!o.has(t)&&o.set(t,e)}),Array.from(o.values())},V=(e,t)=>{const n=Array.isArray(null==e?void 0:e.drivers)?e.drivers.filter(Boolean).map(e=>{var t;return{...e,displayName:`${e.name} (${(null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}):[];if(!t)return[];const r=T(t);return r.length?n.filter(e=>{const t=function(e){var t,n,r,i,l,o,a,u,s,d,c;return void 0===e&&(e={}),Array.from(new Set([null===(t=e)||void 0===t?void 0:t.fillingPointId,null===(n=e)||void 0===n?void 0:n.fillingStationId,null===(r=e)||void 0===r||null===(i=r.additionalDetails)||void 0===i?void 0:i.fillingPointId,null===(l=e)||void 0===l||null===(o=l.additionalDetails)||void 0===o?void 0:o.fillingStationId,null===(a=e)||void 0===a||null===(u=a.fillingpointmetadata)||void 0===u?void 0:u.fillingPointId].filter(e=>null!=e&&""!==e).map(String).concat(T(null===(s=e)||void 0===s?void 0:s.fillingPoint),T(null===(d=e)||void 0===d?void 0:d.fillingPointDetail),T(null===(c=e)||void 0===c?void 0:c.fillingPointDetails))))}(e);return!t.length||t.some(e=>r.includes(e))}):n},L=function(e,t){var n,r,i,l;void 0===e&&(e={}),void 0===t&&(t=[]);const o=(null===(n=e)||void 0===n||null===(r=n.driverData)||void 0===r?void 0:r.id)||(null===(i=e)||void 0===i||null===(l=i.driver)||void 0===l?void 0:l.id);return o&&t.find(e=>(null==e?void 0:e.id)===o)||null},M=e=>{if(!e||"object"!=typeof e)return e;const{id:t,...n}=e;return{...n,fillingStationId:(null==e?void 0:e.fillingStationId)||t||(null==e?void 0:e.bookingId)||(null==e?void 0:e.uuid)||(null==e?void 0:e.fillingPointId)}},w=e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=r.useTranslation(),c=i.useHistory(),v=e=>n.createElement("span",{className:"cell-text"},e),E=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,[f,p]=t.useState([]),[g,y]=t.useState(null),[h,R]=t.useState([]),[T,w]=t.useState([]),[x,k]=t.useState(!1),[P,F]=t.useState(null),B=()=>{F(null),k(!1)},H=n.useMemo(()=>[{Header:d("WT_NAME"),accessor:"name",Cell:e=>{let{row:t}=e;return v(t.original.name)}},{Header:d("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{let{row:t}=e;return v(t.original.mobileNumber)}},{Header:d("WT_EMAIL_ID"),accessor:"emailId",Cell:e=>{let{row:t}=e;return v(t.original.emailId)}},{Header:d("WT_VALID_FROM"),accessor:"validFrom",Cell:e=>{let{row:t}=e;return t.original.validFrom?Digit.DateUtils.ConvertEpochToDate(t.original.validFrom):d("CS_NA")}},{Header:d("WT_VALID_TO"),accessor:"validTo",Cell:e=>{let{row:t}=e;return t.original.validTo?Digit.DateUtils.ConvertEpochToDate(t.original.validTo):d("CS_NA")}},{Header:d("WT_DOCUMENT"),accessor:"fileStoreId",Cell:e=>{let{row:t}=e;return t.original.fileStoreId?n.createElement("div",{style:{color:"#f47738",cursor:"pointer",textDecoration:"underline"},onClick:()=>function(e){try{if(!e)return Promise.resolve();const t=m(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],"dl")).then(function(t){var n;if(null!=t&&null!==(n=t.data)&&void 0!==n&&n[e]){const n=t.data[e].split(",")[0];window.open(n,"_blank")}})},function(e){console.error(e),y({key:"error",action:"Failed to fetch document."}),setTimeout(q,5e3)});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(t.original.fileStoreId)},n.createElement(l.ViewsIcon,null)):d("CS_NA")}}],[d]),U=a.useQueryClient(),{data:Y,refetch:G}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{enabled:!1}),{data:W,refetch:j}=Digit.Hooks.fsm.useDriverSearch({tenantId:s,filters:{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"}}),{mutate:z}=Digit.Hooks.fsm.useVendorUpdate(s),{mutate:K}=Digit.Hooks.fsm.useUpdateVehicle(s),{mutate:$}=Digit.Hooks.fsm.useDriverUpdate(s);t.useEffect(()=>{var t;p((null==e||null===(t=e.data)||void 0===t?void 0:t.table)||[])},[e]),t.useEffect(()=>{"DRIVER"!==e.selectedTab&&"VEHICLE"!==e.selectedTab||(G(),j())},[e.selectedTab]),t.useEffect(()=>{if(Y){let e=Y.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}});R(e)}},[Y]),t.useEffect(()=>{W&&w((W.driver||[]).map(e=>{var t;return{...e,displayName:`${e.name} (${(null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}))},[W]);const q=()=>{y(null)},X=(e,t)=>{p(n=>n.map(n=>(null==n?void 0:n.id)===e?{...n,...t}:n))},Z=function(e,t){var n;void 0===t&&(t={});const r={...e,...t,driverData:(null===(n=t)||void 0===n?void 0:n.driverData)||(null==e?void 0:e.driverData)||(null==e?void 0:e.driver),fillingPoint:M(Object.prototype.hasOwnProperty.call(t,"fillingPoint")?t.fillingPoint:null==e?void 0:e.fillingPoint)};return delete r.vendor,delete r.popup,delete r.driver,{vehicle:r}},Q=(e,t)=>{var n;return{vendor:{...e,owner:{...null==e?void 0:e.owner,gender:(null==e||null===(n=e.owner)||void 0===n?void 0:n.gender)||"OTHERS"},vehicles:t}}},J=()=>{switch(e.selectedTab){case"VENDOR":return c.push("/digit-ui/employee/vendor/registry/new-vendor");case"VEHICLE":return c.push("/digit-ui/employee/fsm/registry/new-vehicle");case"DRIVER":return c.push("/digit-ui/employee/fsm/registry/new-driver");case"SUPERVISOR":return c.push("/digit-ui/employee/vendor/registry/new-supervisor");case"SURVEYOR":return c.push("/digit-ui/employee/vendor/registry/new-surveyor")}},ee=n.useMemo(()=>"VENDOR"===e.selectedTab?(null==f?void 0:f.map(e=>e.id))||[]:(null==Y?void 0:Y.map(e=>{var t;return null===(t=e.dsoDetails)||void 0===t?void 0:t.id}))||[],[e.selectedTab,f,Y]),{data:te}=Digit.Hooks.vendor.useEmpvendorCommonSearch({tenantId:s,filters:{vendorIds:null==ee?void 0:ee.join(","),vendorId:null==ee?void 0:ee.join(",")}},{enabled:(null==ee?void 0:ee.length)>0}),{data:ne,isLoading:re}=Digit.Hooks.wt.useFillPointSearch({tenantId:s,filters:{limit:1e3}},{enabled:!0}),ie=n.useMemo(()=>{switch(e.selectedTab){case"VENDOR":return[{Header:d("ES_VENDOR_INBOX_VENDOR_NAME"),accessor:"name",Cell:e=>{let{row:t}=e;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(i.Link,{to:"/digit-ui/employee/vendor/registry/vendor-details/"+t.original.id},n.createElement("div",null,t.original.name))))}},{Header:d("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{let{row:t}=e;return n.createElement("div",null,t.original.mobileNumber)}},{Header:d("ES_VENDOR_INBOX_DATE_VENDOR_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,r,i;let{row:l}=e;return v(null!==(t=l.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(r=l.original)||void 0===r||null===(i=r.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:d("ES_VENDOR_INBOX_SERVICE_TYPE"),id:"serviceType",accessor:e=>{var t,n;let r=null===(t=e.dsoDetails)||void 0===t?void 0:t.additionalDetails;if("string"==typeof r)try{r=JSON.parse(r)}catch(e){r={}}return(null===(n=r)||void 0===n?void 0:n.serviceType)||"N/A"},Cell:e=>{var t,r;let{row:i}=e,l=null===(t=i.original.dsoDetails)||void 0===t?void 0:t.additionalDetails;if("string"==typeof l)try{l=JSON.parse(l)}catch(e){console.error("Error parsing additionalDetails:",e),l={}}const o=(null===(r=l)||void 0===r?void 0:r.serviceType)||"N/A";return n.createElement("div",null,o)}},{Header:d("ES_VENDOR_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>{var t;return(null===(t=e.dsoDetails)||void 0===t?void 0:t.status)||""},Cell:t=>{var r,i;let{row:o}=t;return n.createElement(l.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(r=o.original)||void 0===r||null===(i=r.dsoDetails)||void 0===i?void 0:i.status),onChange:()=>(t=>{var n,r,i,l;let o=t.original.dsoDetails;const a={vendor:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(n=o.owner)||void 0===n?void 0:n.gender)||"OTHER",dob:(null==o||null===(r=o.owner)||void 0===r?void 0:r.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(i=o.owner)||void 0===i?void 0:i.emailId)||"abc@egov.com",relationship:(null==o||null===(l=o.owner)||void 0===l?void 0:l.relationship)||"OTHER"}}};z(a,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:(t,n)=>{y({key:"success",action:"VENDOR"}),U.invalidateQueries("DSO_SEARCH"),e.refetchData(),setTimeout(q,3e3)}})})(o),name:"switch-"+o.id})}},{Header:d("ES_VENDOR_ADDITIONAL_DETAILS"),disableSortBy:!0,Cell:e=>{var t,r;let{row:l}=e;const o=null===(t=l.original)||void 0===t?void 0:t.id;if(!te)return n.createElement("span",null,"Loading...");const a=null!==(null===(r=l.original)||void 0===r?void 0:r.vendorAdditionalDetails);return n.createElement(i.Link,{to:a?"/digit-ui/employee/vendor/registry/additionaldetails/info?vendorId="+o:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details?vendorId="+o},n.createElement("button",{className:"submit-bar",style:{backgroundColor:a?"#417505":"#3A8DCC",color:"white"}},a?"View Details":"Add Details"))}},{Header:d("VIEW_WORKORDER_DETAILS"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return n.createElement("button",{className:"submit-bar",style:{backgroundColor:"#417505",color:"white"},onClick:()=>(F(t.original),void k(!0))},d("VIEW_WORKORDER_DETAILS"))}}];case"VEHICLE":return[{Header:d("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),accessor:"registrationNumber",Cell:e=>{let{row:t}=e;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(i.Link,{to:"/digit-ui/employee/vendor/registry/vehicle-details/"+t.original.registrationNumber},n.createElement("div",null,t.original.registrationNumber))))}},{Header:d("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{var t,r;let{row:i}=e;return n.createElement("div",null,(null===(t=i.original)||void 0===t||null===(r=t.owner)||void 0===r?void 0:r.mobileNumber)||"N/A")}},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,r,i;let{row:l}=e;return v(null!==(t=l.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(r=l.original)||void 0===r||null===(i=r.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:"Map Vendor",id:"mapVendor",accessor:e=>{var t,n;return(null===(t=e.vendor)||void 0===t?void 0:t.name)||(null===(n=e.vendorData)||void 0===n?void 0:n.name)||"NA"},Cell:t=>{let{row:r}=t;return n.createElement(l.Dropdown,{className:"fsm-registry-dropdown",selected:b(r.original,h),option:h,select:t=>((t,n)=>{const r=t.original,i=null==r?void 0:r.vendor;if(null==n||!n.id||(null==i?void 0:i.id)===(null==n?void 0:n.id))return;const l={...r,vendorVehicleStatus:"ACTIVE",fillingPoint:null,driverData:null,driver:null};delete l.vendor,delete l.popup,delete l.driver;const o=()=>{const t=Array.isArray(null==n?void 0:n.vehicles)?[...n.vehicles]:[],i=t.findIndex(e=>(null==e?void 0:e.id)===(null==r?void 0:r.id));i>-1?t[i]={...t[i],...l,vendorVehicleStatus:"ACTIVE"}:t.push(l);const o={...n,vehicles:t};z(Q(n,t),{onError:e=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:()=>{X(null==r?void 0:r.id,{vendor:o,fillingPoint:null,driverData:null,driver:null}),y({key:"success",action:"VEHICLE"}),U.invalidateQueries("DSO_SEARCH"),U.invalidateQueries("FSM_VEICLES_SEARCH"),e.refetchData(),e.refetchVendor&&e.refetchVendor(),setTimeout(q,3e3)}})};if(null!=i&&i.id){const e=Array.isArray(null==i?void 0:i.vehicles)?i.vehicles.map(e=>(null==e?void 0:e.id)===(null==r?void 0:r.id)?{...e,vendorVehicleStatus:"INACTIVE"}:e):[];z(Q(i,e),{onError:e=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:o})}else o()})(r,t),style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"displayName",t:d})}},{Header:d("ES_VENDOR_INBOX_SERVICE_TYPE"),id:"serviceType",accessor:e=>{var t;let n=e.additionalDetails;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){n={}}return(null===(t=n)||void 0===t?void 0:t.serviceType)||"N/A"},Cell:e=>{var t;let{row:r}=e,i=r.original.additionalDetails;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){console.error("Error parsing additionalDetails:",e),i={}}const l=(null===(t=i)||void 0===t?void 0:t.serviceType)||"N/A";return n.createElement("div",null,l)}},{Header:d("WT_FILLING_POINT"),accessor:e=>A(e),id:"fillingPoint",minWidth:250,Cell:t=>{let{row:r}=t;const i=b(r.original,h),o=O(i);return n.createElement(l.Dropdown,{className:"fsm-registry-dropdown",selected:C(r.original,o),option:o,select:t=>((t,n)=>{const r=Z(t.original,{fillingPoint:n});K(r,{onError:e=>{var t,n,r,i;y({key:"error",label:(null==e?void 0:e.message)||(null==e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(r=n.Errors)||void 0===r||null===(i=r[0])||void 0===i?void 0:i.message)||"Failed to map filling point"}),setTimeout(q,5e3)},onSuccess:()=>{var r;const i=b(t.original,h),l=V(i,n),o=L(t.original,l);X(null===(r=t.original)||void 0===r?void 0:r.id,{fillingPoint:{...n,fillingStationId:(null==n?void 0:n.fillingStationId)||(null==n?void 0:n.id)||(null==n?void 0:n.bookingId)||(null==n?void 0:n.uuid)||(null==n?void 0:n.fillingPointId)},...o?{}:{driverData:null,driver:null}}),y({key:"success",label:"Filling point mapped successfully"}),U.invalidateQueries("FSM_VEICLES_SEARCH"),U.invalidateQueries("DSO_SEARCH"),e.refetchData(),e.refetchVendor&&e.refetchVendor(),setTimeout(q,3e3)}})})(r,t),style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"fillingPointName",t:d,disable:!i||!o.length})}},{Header:d("ES_FSM_REGISTRY_SELECT_DRIVER"),id:"driver",accessor:e=>{var t,n;return(null===(t=e.driverData)||void 0===t?void 0:t.name)||(null===(n=e.driver)||void 0===n?void 0:n.name)||"NA"},minWidth:250,Cell:t=>{let{row:r}=t;const i=b(r.original,h),o=C(r.original,O(i)),a=V(i,o);return n.createElement(l.Dropdown,{className:"fsm-registry-dropdown",selected:L(r.original,a),option:a,select:t=>((t,n)=>{const r=Z(t.original,{driverData:n});K(r,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:(r,i)=>{var l;X(null===(l=t.original)||void 0===l?void 0:l.id,{driverData:n}),y({key:"success",action:"VEHICLE"}),U.invalidateQueries("FSM_VEICLES_SEARCH"),U.invalidateQueries("DSO_SEARCH"),e.refetchData(),e.refetchVendor(),setTimeout(q,3e3)}})})(r,t),optionKey:"displayName",t:d,style:{textAlign:"left",width:"100%",minWidth:"250px"},disable:!o||!a.length})}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>e.status||"",Cell:t=>{var r;let{row:i}=t;return n.createElement(l.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(r=i.original)||void 0===r?void 0:r.status),onChange:()=>(t=>{var n;const r=Z(t.original,{status:"ACTIVE"===(null===(n=t.original)||void 0===n?void 0:n.status)?"DISABLED":"ACTIVE"});K(r,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:(t,n)=>{y({key:"success",action:"VEHICLE"}),U.invalidateQueries("FSM_VEICLES_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(q,3e3)}})})(i),name:"switch-"+i.id})}}];case"DRIVER":return[{Header:d("ES_FSM_REGISTRY_INBOX_USERNAME"),id:"userName",accessor:e=>{var t;return(null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"},Cell:e=>{var t;let{row:r}=e;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(i.Link,{to:"/digit-ui/employee/vendor/registry/driver-details/"+r.original.id},n.createElement("div",null,(null===(t=r.original.owner)||void 0===t?void 0:t.userName)||"NA"))))}},{Header:d("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),accessor:"name",Cell:e=>{let{row:t}=e;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(i.Link,{to:"/digit-ui/employee/vendor/registry/driver-details/"+t.original.id},n.createElement("div",null,""+(t.original.name||"N/A")))))}},{Header:d("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{var t,r;let{row:i}=e;return n.createElement("div",null,(null===(t=i.original)||void 0===t||null===(r=t.owner)||void 0===r?void 0:r.mobileNumber)||"N/A")}},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,r,i;let{row:l}=e;return v(null!==(t=l.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(r=l.original)||void 0===r||null===(i=r.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:d("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),id:"vendorName",accessor:e=>{var t,n;return(null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null===(n=e.vendor)||void 0===n?void 0:n.name)||"NA"},minWidth:250,Cell:t=>{let{row:r}=t;return n.createElement(l.Dropdown,{className:"fsm-registry-dropdown",selected:(null==h?void 0:h.find(e=>{var t,n;return((null===(t=r.original.vendorData)||void 0===t?void 0:t.id)||(null===(n=r.original.vendor)||void 0===n?void 0:n.id))===e.id}))||r.original.vendorData||r.original.vendor,option:h,select:t=>((t,n)=>{let r=t.original,i=null==r?void 0:r.vendor,l=n;if(delete r.vendor,r.vendorDriverStatus="ACTIVE",i){const e=null==i?void 0:i.drivers;e.splice(e.findIndex(e=>e.id===r.id),1)}const o={vendor:{...l,drivers:l.drivers?[...l.drivers,r]:[r]}};z(o,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:(t,n)=>{y({key:"success",action:"VENDOR"}),U.invalidateQueries("DSO_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(q,3e3)}})})(r,t),style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"displayName",t:d})}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>e.status||"",Cell:t=>{var r;let{row:i}=t;return n.createElement(l.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(r=i.original)||void 0===r?void 0:r.status),onChange:()=>(t=>{var n,r,i,l;let o=t.original;const a={driver:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(n=o.owner)||void 0===n?void 0:n.gender)||"OTHER",dob:(null==o||null===(r=o.owner)||void 0===r?void 0:r.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(i=o.owner)||void 0===i?void 0:i.emailId)||"abc@egov.com",relationship:(null==o||null===(l=o.owner)||void 0===l?void 0:l.relationship)||"OTHER"}}};$(a,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(q,5e3)},onSuccess:(t,n)=>{y({key:"success",action:"DRIVER"}),U.invalidateQueries("FSM_DRIVER_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(q,3e3)}})})(i),name:"switch-"+i.id})}}];case"SUPERVISOR":case"SURVEYOR":return[{Header:d("SUPERVISOR"===e.selectedTab?"Supervisor's Mobile No.":"Surveyor's Mobile No."),id:"userName",accessor:e=>{var t;return(null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"},Cell:t=>{var r;let{row:l}=t;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(i.Link,{to:`/digit-ui/employee/vendor/registry/${"SUPERVISOR"===e.selectedTab?"supervisor-details":"surveyor-details"}/`+l.original.id},n.createElement("div",null,(null===(r=l.original.owner)||void 0===r?void 0:r.userName)||"NA"))))}},{Header:d("SUPERVISOR"===e.selectedTab?"ES_FSM_REGISTRY_INBOX_SUPERVISOR_NAME":"ES_FSM_REGISTRY_INBOX_SURVEYOR_NAME"),accessor:"name",Cell:t=>{let{row:r}=t;return n.createElement("div",null,n.createElement("span",{className:"link"},n.createElement(i.Link,{to:`/digit-ui/employee/vendor/registry/${"SUPERVISOR"===e.selectedTab?"supervisor-details":"surveyor-details"}/`+r.original.id},n.createElement("div",null,""+(r.original.name||"N/A")))))}},{Header:d("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{var t,r;let{row:i}=e;return n.createElement("div",null,(null===(t=i.original)||void 0===t||null===(r=t.owner)||void 0===r?void 0:r.mobileNumber)||"N/A")}},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_CREATION"),accessor:"createdTime",Cell:e=>{var t,n,r,i;let{row:l}=e;return v(null!==(t=l.original)&&void 0!==t&&null!==(n=t.auditDetails)&&void 0!==n&&n.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(r=l.original)||void 0===r||null===(i=r.auditDetails)||void 0===i?void 0:i.createdTime):"")}},{Header:d("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),id:"vendorName",accessor:e=>{var t,n;return(null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null===(n=e.vendor)||void 0===n?void 0:n.name)||"NA"},minWidth:250,Cell:t=>{let{row:r}=t;return n.createElement(l.Dropdown,{className:"fsm-registry-dropdown",selected:(null==h?void 0:h.find(e=>{var t,n;return((null===(t=r.original.vendorData)||void 0===t?void 0:t.id)||(null===(n=r.original.vendor)||void 0===n?void 0:n.id))===e.id}))||r.original.vendorData||r.original.vendor,option:h,select:t=>{console.log("Updating vendor for",e.selectedTab,t)},style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"displayName",t:d})}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>e.status||"",Cell:t=>{var r;let{row:i}=t;return n.createElement(l.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(r=i.original)||void 0===r?void 0:r.status),onChange:()=>{console.log("Updating status for",e.selectedTab,i.original.id)},name:"switch-"+i.id})}}];default:return[]}},[e.selectedTab,h,T,f,te,(null==ne?void 0:ne.fillingPoints)||[],d]),le=n.useMemo(()=>{switch(e.selectedTab){case"VENDOR":return[{Header:d("ES_VENDOR_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,n,r,i,l;return`${(null==e?void 0:e.name)||(null==e||null===(t=e.dsoDetails)||void 0===t?void 0:t.name)||"NA"} (${(null==e?void 0:e.mobileNumber)||(null==e||null===(n=e.owner)||void 0===n?void 0:n.mobileNumber)||(null==e||null===(r=e.dsoDetails)||void 0===r?void 0:r.mobileNumber)||(null==e||null===(i=e.dsoDetails)||void 0===i||null===(l=i.owner)||void 0===l?void 0:l.mobileNumber)||"NA"})`}},{Header:d("ES_VENDOR_INBOX_DATE_VENDOR_CREATION"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime):""}},{Header:d("WT_FILLING_POINT"),exportAccessor:e=>A(e)},{Header:d("ES_VENDOR_INBOX_SERVICE_TYPE"),exportAccessor:e=>{var t,n;return(null===(t=I(null==e||null===(n=e.dsoDetails)||void 0===n?void 0:n.additionalDetails))||void 0===t?void 0:t.serviceType)||"N/A"}},{Header:d("ES_VENDOR_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>{var t;return(null==e||null===(t=e.dsoDetails)||void 0===t?void 0:t.status)||"NA"}}];case"VEHICLE":return[{Header:d("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),exportAccessor:e=>(null==e?void 0:e.registrationNumber)||"NA"},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime):""}},{Header:"Map Vendor",exportAccessor:e=>{var t,n,r,i,l,o,a,u;return`${(null==e||null===(t=e.vendor)||void 0===t?void 0:t.name)||(null==e||null===(n=e.vendorData)||void 0===n?void 0:n.name)||"NA"} (${(null==e||null===(r=e.vendor)||void 0===r?void 0:r.mobileNumber)||(null==e||null===(i=e.vendor)||void 0===i||null===(l=i.owner)||void 0===l?void 0:l.mobileNumber)||(null==e||null===(o=e.vendorData)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(a=e.vendorData)||void 0===a||null===(u=a.owner)||void 0===u?void 0:u.mobileNumber)||"NA"})`}},{Header:d("ES_VENDOR_INBOX_SERVICE_TYPE"),exportAccessor:e=>{var t;return(null===(t=I(null==e?void 0:e.additionalDetails))||void 0===t?void 0:t.serviceType)||"N/A"}},{Header:d("WT_FILLING_POINT"),exportAccessor:e=>A(e)},{Header:d("ES_FSM_REGISTRY_SELECT_DRIVER"),exportAccessor:e=>{var t,n,r,i,l,o;return`${(null==e||null===(t=e.driverData)||void 0===t?void 0:t.name)||(null==e||null===(n=e.driver)||void 0===n?void 0:n.name)||"NA"} (${(null==e||null===(r=e.driverData)||void 0===r||null===(i=r.owner)||void 0===i?void 0:i.mobileNumber)||(null==e||null===(l=e.driver)||void 0===l||null===(o=l.owner)||void 0===o?void 0:o.mobileNumber)||"NA"})`}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];case"DRIVER":return[{Header:d("ES_FSM_REGISTRY_INBOX_USERNAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"}},{Header:d("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),exportAccessor:e=>{var t;return`${(null==e?void 0:e.name)||"NA"} (${(null==e||null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"NA"})`}},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime):""}},{Header:d("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,n,r,i,l,o,a,u;return`${(null==e||null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null==e||null===(n=e.vendor)||void 0===n?void 0:n.name)||"NA"} (${(null==e||null===(r=e.vendorData)||void 0===r?void 0:r.mobileNumber)||(null==e||null===(i=e.vendorData)||void 0===i||null===(l=i.owner)||void 0===l?void 0:l.mobileNumber)||(null==e||null===(o=e.vendor)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(a=e.vendor)||void 0===a||null===(u=a.owner)||void 0===u?void 0:u.mobileNumber)||"NA"})`}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];case"SURVEYOR":return[{Header:d("ES_FSM_REGISTRY_INBOX_USERNAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"}},{Header:d("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),exportAccessor:e=>{var t;return`${(null==e?void 0:e.name)||"NA"} (${(null==e||null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"NA"})`}},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime):""}},{Header:d("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,n,r,i,l,o,a,u;return`${(null==e||null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null==e||null===(n=e.vendor)||void 0===n?void 0:n.name)||"NA"} ${(null==e||null===(r=e.vendorData)||void 0===r?void 0:r.mobileNumber)||(null==e||null===(i=e.vendorData)||void 0===i||null===(l=i.owner)||void 0===l?void 0:l.mobileNumber)||(null==e||null===(o=e.vendor)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(a=e.vendor)||void 0===a||null===(u=a.owner)||void 0===u?void 0:u.mobileNumber)||"NA"}`}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];case"SUPERVISOR":return[{Header:d("ES_FSM_REGISTRY_INBOX_USERNAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"}},{Header:d("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),exportAccessor:e=>{var t;return`${(null==e?void 0:e.name)||"NA"} (${(null==e||null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"NA"})`}},{Header:d("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),exportAccessor:e=>{var t,n;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(n=e.auditDetails)||void 0===n?void 0:n.createdTime):""}},{Header:d("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,n,r,i,l,o,a,u;return`${(null==e||null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null==e||null===(n=e.vendor)||void 0===n?void 0:n.name)||"NA"} ${(null==e||null===(r=e.vendorData)||void 0===r?void 0:r.mobileNumber)||(null==e||null===(i=e.vendorData)||void 0===i||null===(l=i.owner)||void 0===l?void 0:l.mobileNumber)||(null==e||null===(o=e.vendor)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(a=e.vendor)||void 0===a||null===(u=a.owner)||void 0===u?void 0:u.mobileNumber)||"NA"}`}},{Header:d("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];default:return[]}},[e.selectedTab,d]),oe=n.useCallback(function(){return Promise.resolve(f)},[f]);let ae;if(e.isLoading||re)ae=n.createElement("div",{style:{zIndex:10,position:"relative",padding:"10px",backgroundColor:"#fff",width:"75px",height:"75px",borderRadius:"12px",display:"flex",justifyContent:"center",alignItems:"center",margin:"auto"}},n.createElement(l.Loader,null));else if(0===f.length){let t="",r="";"VENDOR"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_VENDOR",r="ES_FSM_REGISTRY_EMPTY_BUTTON_VENDOR"):"VEHICLE"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_VEHICLE",r="ES_FSM_REGISTRY_EMPTY_BUTTON_VEHICLE"):"SUPERVISOR"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_SUPERVISOR",r="ES_FSM_REGISTRY_EMPTY_BUTTON_SUPERVISOR"):"SURVEYOR"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_SURVEYOR",r="ES_FSM_REGISTRY_EMPTY_BUTTON_SURVEYOR"):(t="ES_FSM_REGISTRY_EMPTY_CARD_DRIVER",r="ES_FSM_REGISTRY_EMPTY_BUTTON_DRIVER"),ae=n.createElement(l.Card,{style:{display:"flex",justifyContent:"center",minHeight:"250px"}},n.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},n.createElement("div",{style:{marginTop:"50px",marginBottom:"25px"}},d(t)),n.createElement(l.SubmitBar,{className:"",label:d(r),onSubmit:J})))}else f.length>0&&(ae=n.createElement(S,{className:"table registryTable",t:d,data:f,columns:ie,getCellProps:e=>({style:{padding:"8px 12px",fontSize:"13.5px"}}),onPageSizeChange:e.onPageSizeChange,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onSort:e.onSort,disableSort:e.disableSort,sortParams:e.sortParams,totalRecords:e.totalRecords,showCSVExport:!0,getCSVExportData:oe,csvExportColumns:le,csvExportFileName:`vendor-${String(e.selectedTab||"registry").toLowerCase()}-inbox`}));return n.createElement("div",{className:"inbox-container"},"FSM_EMP_FSTPO"!==e.userRole&&"FSM_ADMIN"!==e.userRole&&!e.isSearch&&n.createElement("div",{className:"filters-container"},n.createElement(_,{parentRoute:e.parentRoute}),n.createElement("div",{style:{marginTop:"24px"}},n.createElement(D,{searchParams:e.searchParams,paginationParms:e.paginationParms,applications:e.data,onFilterChange:e.onFilterChange,type:"desktop"}))),n.createElement("div",{style:{flex:1,width:"100%",marginLeft:"FSM_ADMIN"===e.userRole?"":"24px"}},n.createElement(N,{onSearch:e.onSearch,type:"desktop",searchFields:e.searchFields,isInboxPage:!(null!=e&&e.isSearch),searchParams:e.searchParams,onTabChange:e.onTabChange,selectedTab:e.selectedTab}),n.createElement("div",{className:"result",style:{marginLeft:E||"FSM_ADMIN"===e.userRole||null!=e&&e.isSearch?"":"24px",flex:1}},ae)),g&&n.createElement(l.Toast,{error:"error"===g.key,label:d(g.label?g.label:"success"===g.key?`ES_FSM_REGISTRY_${g.action}_DISABLE_SUCCESS`:g.action),onClose:q}),x&&n.createElement(l.Modal,{headerBarMain:n.createElement("h1",{className:"heading-m",style:{margin:0}},d("ES_VENDOR_WORKORDER_DETAILS_MODAL")),headerBarEnd:n.createElement("div",{className:"icon-bg-secondary",onClick:B,style:{cursor:"pointer"}},n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF",width:"24",height:"24"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))),actionCancelLabel:d("CS_COMMON_CLOSE"),actionCancelOnSubmit:B,hideSubmit:!0,formId:"modal-action"},n.createElement("div",{style:{padding:"16px"}},(null==P||null===(o=P.dsoDetails)||void 0===o||null===(u=o.vendorWorkOrder)||void 0===u?void 0:u.length)>0?n.createElement(l.Table,{t:d,data:P.dsoDetails.vendorWorkOrder,columns:H,getCellProps:e=>({style:{minWidth:"150px",padding:"8px 12px",fontSize:"13.5px"}})}):n.createElement("p",{style:{textAlign:"center",marginTop:"20px"}},d("ES_VENDOR_NO_WORKORDERS")))))},{DatePicker:x}=require("@djb25/digit-ui-react-components"),k=e=>{let{t:t,title:r}=e;return n.createElement("div",{className:"confirmation_box"},n.createElement("span",null,t(""+r)," "))},P=e=>n.createElement("h1",{className:"heading-m"},e.label),F=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),B=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(F,null)),{DatePicker:H}=require("@djb25/digit-ui-react-components"),U=[{head:"VENDOR_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"vendor-details",key:"Documents"},{route:"vendor-details",component:"VendorDetails",withoutLabel:!0,key:"vendordet",type:"component",nextStep:"documents",hideInEmployee:!0,isMandatory:!0,texts:{header:"VENDOR_ADDITIONAL_DETAILS",submitBarLabel:"VENDOR_COMMON_NEXT"}}]},{head:"VENDOR_DOCUMENT_DETAILS",body:[{route:"documents",component:"VendorDocuments",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"VENDOR_DOCUMENTS_DETAILS",submitBarLabel:"VENDOR_COMMON_NEXT"}}]}],Y=e=>{let{jumpTo:t}=e;const{t:o}=r.useTranslation(),a=i.useHistory();return n.createElement(l.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){a.push(t)}})},G=e=>{const{t:t}=r.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_VENDOR_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_VENDOR_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_VENDOR_APPLICATION_FAILED")},W={padding:"4px 0px",justifyContent:"space-between"},j=e=>{var t,r;return n.createElement(l.Banner,{message:G(e),applicationNumber:null===(t=e.data)||void 0===t||null===(r=t.VendorAdditionalDetails)||void 0===r?void 0:r[0].registrationNo,info:e.isSuccess?e.t("ES_VENDOR_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},z=e=>n.createElement("h1",{className:"heading-m"},e.label),K=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),$=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(K,null)),q=e=>n.createElement("h1",{className:"heading-m"},e.label),X=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),Z=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(X,null)),{Dropdown:Q}=require("@djb25/digit-ui-react-components"),J=e=>n.createElement("h1",{className:"heading-m"},e.label),ee=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),te=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(ee,null)),{Dropdown:ne}=require("@djb25/digit-ui-react-components"),re=e=>n.createElement("h1",{className:"heading-m"},e.label),ie=()=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},n.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),le=e=>n.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},n.createElement(ie,null)),oe={VendorDetails:e=>{let{t:r,config:i,onSelect:a,userType:s,formData:d}=e,c={};const[v,E]=t.useState(""),[m,f]=t.useState(""),[p,_]=t.useState(""),[S,g]=t.useState(""),[y,h]=t.useState(),[D,R]=t.useState(""),[N,I]=t.useState(""),[T,C]=t.useState(""),[A,b]=t.useState(),[O,V]=t.useState(""),[L,M]=t.useState(""),[w,x]=t.useState(""),[k,P]=t.useState(""),[F,B]=t.useState(""),[H,U]=t.useState(""),[Y,G]=t.useState(""),[W,j]=t.useState(""),[z,K]=t.useState(""),[$,q]=t.useState(""),[X,Z]=t.useState(""),[Q,J]=t.useState(""),[ee,te]=t.useState(""),[ne,re]=t.useState(""),[ie,le]=t.useState(null);t.useEffect(()=>{11!==O.length||T||A||X?11===O.length&&T&&A?(C(T),b(A),Z(X)):(C(""),b(""),Z("")):fetch("https://ifsc.razorpay.com/"+O).then(e=>e.json()).then(e=>{e&&e.BANK&&e.BRANCH&&e.MICR?(C(e.BANK),b(e.BRANCH),Z(e.MICR),le({error:!1,label:r("VALID_IFSC_CODE")})):le({error:!0,label:r("INVALID_IFSC_CODE")})}).catch(()=>{le({error:!0,label:r("INVALID_IFSC_CODE")})})},[O]);const oe=Digit.ULBService.getCurrentTenantId(),{control:ae}=o.useForm(),{data:ue}=Digit.Hooks.fsm.useDsoSearch(oe,{staleTime:Infinity});t.useEffect(()=>{if(ue){const e=ue.find(e=>e.id);e&&(I(e.name),R(e.id))}},[ue]);const se=()=>{let e,t=d.ownerKey&&d.ownerKey[0];"citizen"===s?(e={...t,applicantName:applicantName,mobileNumber:mobileNumber,altMobileNumber:altMobileNumber,emailId:emailId},a(i.key,{...d[i.key],...e},!1,0)):(e={...t,VendorCompany:v,VendorPhone:m,VendorAddress:p,VendorCategory:S,VendorEmail:y,name:N,VendorId:D,Bank:T,BankbranchName:A,IFSC:O,AccountNo:L,PanNo:w,GstNo:k,GstState:F,RegistrationNo:H,EpfNo:Y,EsiNo:W,VendorType:z,Status:$,micrNo:X,PhoneNo:Q,ContactPerson:ee,Company:ne},a(i.key,e,!1,0))};return t.useEffect(()=>{"citizen"===s&&se()},[v,m,p,S,y,D,N,T,A,O,L,w,k,F,H,Y,W,z,$,X,Q,ee,ne,se,s]),n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{timeLine:[{actions:r("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:r("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:r("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:0,showFinalStep:!1}),n.createElement("div",{style:{flex:"1",overflowY:"auto"}},n.createElement(l.FormStep,{config:i,onSelect:se,t:r,className:"formcomposer-grid-container-form"},n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,{className:"card-label-smaller"},n.createElement(l.Tooltip,{label:""+r("IFSC_CODE"),isMandatory:!1,message:r("INVALID_IFSC_CODE_ERROR_MESSAGE")})),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"IFSC",value:O,placeholder:"Enter IFSC Code",onChange:function(e){const t=e.target.value.replace(/[^a-zA-Z0-9]/g,"");t.length<=11&&V(t)},style:{width:"100%"},maxLength:11,ValidationRequired:!0},c={isRequired:!0,pattern:"^[A-Z]{4}0[A-Z0-9]{6}$",type:"text",title:r("INVALID_IFSC_CODE_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("VENDOR_BANK_NAME")," ",n.createElement("span",{className:"check-page-link-button"},"*")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bankName",placeholder:"Bank Name Auto Select",style:{width:"100%"},value:T,onChange:function(e){C(e.target.value)},disabled:!0})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("VENDOR_BANK_BRANCH_NAME")," ",n.createElement("span",{className:"check-page-link-button"},"*")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BankbranchName",value:A,style:{width:"100%"},placeholder:"Bank Branch Name Auto Select",onChange:function(e){b(e.target.value)},disabled:!1})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("VENDOR_MICR_NO")," ",n.createElement("span",{className:"check-page-link-button"},"*")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"MicrNo",value:X,style:{width:"100%"},placeholder:"MICR No",onChange:Z,disabled:!1})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("ACCOUNT_NO")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AccountNo",value:L,onChange:function(e){M(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"[0-9]{9,18}",type:"text",title:r("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("PHONE_NO")),n.createElement(l.MobileNumber,{value:Q,name:"PhoneNo",onChange:J,style:{width:"100%"}})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("CONTACT_PERSON")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"ContactPerson",value:ee,onChange:function(e){te(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:r("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("PAN_NO")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"PanNo",value:w,onChange:function(e){x(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"[A-Z]{5}[0-9]{4}[A-Z]{1}",type:"text",title:r("INVALID_PAN_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("GST_NO")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstNo",value:k,onChange:function(e){P(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",type:"text",title:r("INVALID_GST_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("GST_REGISTERED_STATE/UT")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstState",value:F,onChange:function(e){B(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:r("PT_NAME_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("REGISTRATION_NO")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"RegistrationNo",value:H,onChange:function(e){U(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:r("INVALID_REGISTRATION_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("EPF_NO")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EpfNo",value:Y,onChange:function(e){G(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,15}$",type:"text",title:r("INVALID_EPF_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,""+r("ESI_NO")),n.createElement(l.TextInput,u({t:r,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EsiNo",value:W,onChange:function(e){j(e.target.value)},style:{width:"100%"},ValidationRequired:!0},c={isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:r("INVALID_ESI_NO_ERROR_MESSAGE")}))),n.createElement(l.LabelFieldPair,null,n.createElement("div",null,r("VENDOR_TYPE"),n.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},n.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+r("AST_CLASSIFICATION_ASSET")))),n.createElement(o.Controller,{control:ae,name:"VendorType",defaultValue:z,rules:{required:r("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>n.createElement(l.Dropdown,{selected:z,select:K,option:[{i18nKey:"Supplier",code:"SUPPLIER"},{i18nKey:"Contractor",code:"CONTRACTOR"}],optionKey:"i18nKey",placeholder:"Select",t:r})})),n.createElement(l.LabelFieldPair,null,n.createElement("div",null,r("VENOR_CATEGORY"),n.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},n.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}}))),n.createElement(o.Controller,{control:ae,name:"VendorCategory",defaultValue:S,rules:{required:r("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>n.createElement(l.Dropdown,{selected:S,select:g,option:[{i18nKey:"Firm",code:"FIRM"},{i18nKey:"Individual",code:"Individual"}],optionKey:"i18nKey",placeholder:"Select",t:r})})),n.createElement(l.LabelFieldPair,null,n.createElement("div",null,r("STATUS"),n.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},n.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+r("AST_CLASSIFICATION_ASSET")))),n.createElement(o.Controller,{control:ae,name:"Status",defaultValue:$,rules:{required:r("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>n.createElement(l.Dropdown,{selected:$,select:q,option:[{i18nKey:"Active",code:"ACTIVE"},{i18nKey:"Inactive",code:"INACTIVE"}],optionKey:"i18nKey",placeholder:"Select",t:r})})))))},VendorDocuments:e=>{var r;let{t:i,config:o,onSelect:a,formData:u}=e;const[s,d]=t.useState([null]),[c,v]=t.useState([null]),[E,f]=t.useState(null),[p,_]=t.useState(1),[S,g]=(Digit.ULBService.getStateId(),Digit.ULBService.getStateId(),t.useState((null==u||null===(r=u.documents)||void 0===r?void 0:r.documents)||[]));return t.useEffect(()=>{var e;null!=u&&null!==(e=u.documents)&&void 0!==e&&e.documents&&(v(u.documents.documents),_(u.documents.documents.length),d(new Array(u.documents.documents.length).fill(null)))},[u]),n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{timeLine:[{actions:i("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:i("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:i("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:1,showFinalStep:!1}),n.createElement(l.FormStep,{t:i,config:o,onSelect:()=>{let e;e={...u.documents,documents:c.filter(e=>null!==e)},a(o.key,e)},onSkip:()=>a(),isDisabled:c.some(e=>null===e)&&s.some(e=>null===e)},s.map((e,t)=>n.createElement(l.LabelFieldPair,{key:t},n.createElement(l.CardLabel,{className:"card-label-smaller"},i("VENDOR_ID")+(0!==t?t:"")),n.createElement("div",{className:"field",style:{display:"flex",alignItems:"center",paddingBottom:"10px"}},n.createElement(l.UploadFile,{onUpload:e=>((e,t)=>{const n=e.target.files[0];d(e=>{const r=[...e];return r[t]=n,r}),function(e,t){try{const n=function(){if(e.size>=5242880)f(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=m(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EWASTE",e,Digit.ULBService.getStateId())).then(function(e){var n,r;if((null==e||null===(n=e.data)||void 0===n||null===(r=n.files)||void 0===r?void 0:r.length)>0){const n=e.data.files[0].fileStoreId;v(e=>{const r=[...e];return r[t]={filestoreId:n,documentuuid:n,documentType:"Photo"+(t+1)},r})}else f(i("CS_FILE_UPLOAD_ERROR"))})},function(){f(i("CS_FILE_UPLOAD_ERROR"))});if(n&&n.then)return n.then(function(){})}}();Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(n,t)})(e,t),onDelete:()=>v(e=>{const n=[...e];return n[t]=null,n}),id:"file-upload-"+t,message:c[t]?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!c[t]})))),E&&n.createElement(l.Toast,{label:E,onClose:()=>f(null),error:!0})))},ServiceDoc:e=>{var t;let{t:r,config:i,onSelect:o}=e;const a=Digit.ULBService.getStateId(),u=null!=i&&i.isMutation?["MutationDocuments"]:"Documents",{isLoading:s,data:d={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(a,"ASSET",u);let c=null==d||null===(t=d.ASSET)||void 0===t?void 0:t.Documents;return n.createElement("div",{className:"employee-form-content"},s&&n.createElement(l.Loader,null),Array.isArray(c)&&c.map((e,t)=>{let{code:i,dropdownData:o}=e;return n.createElement(l.Card,{key:t},n.createElement("div",null,n.createElement("h3",{style:{margin:0}},t+1,". ",r(E(i,".","_")))),o.map((e,t)=>n.createElement("div",{key:t,style:{paddingLeft:"10px",marginBottom:"6px",fontSize:"14px"}},t+1,". ",r(E(null==e?void 0:e.code,".","_")))))}),n.createElement(l.ActionBar,null,n.createElement(l.SubmitBar,{label:r("COMMON_NEXT"),onSubmit:o})))},AddVendor:e=>{const o=Digit.ULBService.getCurrentTenantId(),a=Digit.ULBService.getStateId(),{t:u}=r.useTranslation(),s=i.useHistory(),[d,c]=t.useState(1),[v,E]=t.useState(null),[m,f]=t.useState(!1),[p,_,S]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[g,y,h]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[D,R,N]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:I}=Digit.Hooks.fsm.useVendorCreate(o);t.useEffect(()=>{_(!1),N(),h()},[]);const T=function(e,t){return void 0===t&&(t=!1),[{head:"ES_VRNDOR_NEW_VENDOR_DETAILS",body:[{label:"ES_FSM_REGISTRY_NEW_VENDOR_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"vendorName",validation:{required:!0,pattern:/^[A-Za-z\s.,/]+$/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VENDOR_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},labelStyle:{border:"1px solid black",borderRight:"none"},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",key:"serviceType",component:"SelectServiceType",disable:t,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{header:"CS_COMMON_CHOOSE_SERVICE_TYPE",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS",body:[{label:"HOUSE_NO",isMandatory:!1,type:"text",key:"doorNo",populators:{name:"doorNo",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_PLOT",isMandatory:!1,type:"text",key:"plotNo",populators:{name:"plotNo",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_BUILDING_NAME",isMandatory:!1,type:"text",key:"buildingName",populators:{name:"buildingName",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_STREET",isMandatory:!1,type:"text",key:"street",populators:{name:"street",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_PINCODE",isMandatory:!1,type:"text",key:"pincode",populators:{name:"pincode",validation:{required:!1,pattern:/^[1-9][0-9]{5}$/},error:e("FSM_REGISTRY_INVALID_PINCODE"),defaultValue:"",className:"payment-form-text-input-correction"}},{route:"address",component:"VendorSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",isMandatory:!0,type:"component"},{label:"ES_FSM_REGISTRY_NEW_LANDMARK",isMandatory:!1,type:"text",key:"landmark",populators:{name:"landmark",defaultValue:"",className:"payment-form-text-input-correction"}}]}]}(u),C=()=>{E(null)};return n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:"New Vendor Details",currentStep:1}]},{route:"address-details",timeLine:[{actions:"Address Details",currentStep:2}]}],currentActiveIndex:d-1,showFinalStep:!1}),n.createElement("div",{style:{flex:"1",overflowY:"auto"}},n.createElement(l.FormComposer,{label:u("ES_COMMON_APPLICATION_SUBMIT"),config:T.filter(e=>!e.hideInEmployee).map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0,body:e.body.filter(e=>!e.hideInEmployee)})),onSubmit:e=>{var t,n,r,i,l,u,d,c,v,m,f,p,_,S,g,y,h,D,R,N,T,A;const b=e,O=null==b?void 0:b.vendorName,V=null==b?void 0:b.pincode,L=null==b||null===(t=b.street)||void 0===t?void 0:t.trim(),M=null==b||null===(n=b.doorNo)||void 0===n?void 0:n.trim(),w=null==b||null===(r=b.plotNo)||void 0===r?void 0:r.trim(),x=null==b||null===(i=b.landmark)||void 0===i?void 0:i.trim(),k=null==b||null===(l=b.address)||void 0===l||null===(u=l.city)||void 0===u?void 0:u.name,P=null==b||null===(d=b.address)||void 0===d||null===(c=d.city)||void 0===c?void 0:c.state,F=null==b||null===(v=b.address)||void 0===v||null===(m=v.city)||void 0===m?void 0:m.name,B=null==b||null===(f=b.address)||void 0===f||null===(p=f.city)||void 0===p?void 0:p.name,H=null==b||null===(_=b.buildingName)||void 0===_?void 0:_.trim(),U=null==b||null===(S=b.address)||void 0===S||null===(g=S.locality)||void 0===g?void 0:g.code,Y=null==b||null===(y=b.address)||void 0===y||null===(h=y.locality)||void 0===h?void 0:h.name,G=null==b||null===(D=b.address)||void 0===D||null===(R=D.locality)||void 0===R?void 0:R.area,W=null==b?void 0:b.emailId,j=null==b?void 0:b.phone,z=(new Date(""+b.dob).getTime()||new Date("1/1/1970").getTime(),null==b||null===(N=b.serviceType)||void 0===N?void 0:N.code),K={vendor:{tenantId:o,name:O,agencyType:"ULB",paymentPreference:"post-service",address:{tenantId:o,landmark:x,doorNo:M,plotNo:w,street:L,city:k,district:F,region:B,state:P,country:"in",pincode:V,buildingName:H,locality:{code:U||"",name:Y||"",label:"Locality",area:G||""},geoLocation:{latitude:(null==b||null===(T=b.address)||void 0===T?void 0:T.latitude)||0,longitude:(null==b||null===(A=b.address)||void 0===A?void 0:A.longitude)||0}},owner:{tenantId:a,name:O,fatherOrHusbandName:O,relationship:"OTHER",gender:"MALE",dob:"915148800",emailId:W||"abc@egov.com",mobileNumber:j},additionalDetails:{serviceType:z},vehicle:[],drivers:[],source:"WhatsApp"}};I(K,{onError:e=>{E({key:"error",action:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{E({key:"success",action:"ADD_VENDOR"}),setTimeout(()=>{C(),s.push("/digit-ui/employee/vendor/search-vendor")},2e3)}})},defaultValues:{serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var n,r,i;const l=(null==t?void 0:t.vendorName)&&(null==t?void 0:t.phone)&&(null==t||null===(n=t.serviceType)||void 0===n?void 0:n.code),o=(null==t||null===(r=t.address)||void 0===r?void 0:r.city)&&(null==t||null===(i=t.address)||void 0===i?void 0:i.locality);f(!(!l||!o)),l?1===d&&(c(2),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(u("ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100)):2===d&&(c(1),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(u("ES_VRNDOR_NEW_VENDOR_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100))},noBreakLine:!0,noCard:!0,isDisabled:!m}),v&&n.createElement(l.Toast,{error:"error"===v.key,label:u("success"===v.key?`ES_FSM_REGISTRY_${v.action}_SUCCESS`:v.action),onClose:C})))},VendorSelectAddress:e=>{var r,i,o;let{t:a,config:u,onSelect:s,userType:d,formData:c}=e;const v=Digit.Hooks.vendor.useTenants();let E=Digit.ULBService.getCurrentTenantId();const{pincode:m}=(null==c?void 0:c.address)||"",f="employee"===d?v.filter(e=>e.code===E):m?v.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==m)}):v;let p=null===(r=sessionStorage)||void 0===r?void 0:r.getItem("Digit_FSM_PT");var _;"undefined"!==p&&(p=JSON.parse(null===(_=sessionStorage)||void 0===_?void 0:_.getItem("Digit_FSM_PT")));let S={};p&&(S=f.filter(e=>{var t,n,r;return e.code==(null===(t=p)||void 0===t||null===(n=t.propertyDetails)||void 0===n||null===(r=n.address)||void 0===r?void 0:r.tenantId)}));const[g,y]=t.useState(()=>{var e,t;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||(null===(t=S)||void 0===t?void 0:t[0])||null}),{data:h}=Digit.Hooks.useBoundaryLocalities(null==g?void 0:g.code,"revenue",{enabled:!!g},a),[D,R]=t.useState(),[N,I]=t.useState(()=>{var e,t,n,r,i,l,o;return(null===(e=p)||void 0===e||null===(t=e.propertyDetails)||void 0===t||null===(n=t.address)||void 0===n?void 0:n.locality)||(null==c||null===(r=c.cpt)||void 0===r||null===(i=r.details)||void 0===i||null===(l=i.address)||void 0===l?void 0:l.locality)||(null==c||null===(o=c.address)||void 0===o?void 0:o.locality)});function T(e){I(null),R(null),Digit.SessionStorage.set("fsm.file.address.city",e),y(e)}function C(e){I(e),"employee"===d&&s(u.key,{...c[u.key],locality:e})}return t.useEffect(()=>{f&&1===f.length&&y(f[0])},[f]),t.useEffect(()=>{if(g&&h){var e,t,n,r,i,l,o,a;let _=h,S=[];if(null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality)I(c.address.locality);else if(null!=c&&null!==(t=c.cpt)&&void 0!==t&&null!==(n=t.details)&&void 0!==n&&null!==(r=n.address)&&void 0!==r&&r.locality)I(c.cpt.details.address.locality);else if(null!==(i=p)&&void 0!==i&&null!==(l=i.propertyDetails)&&void 0!==l&&null!==(o=l.address)&&void 0!==o&&o.locality){var v,E,m;I(null===(v=p)||void 0===v||null===(E=v.propertyDetails)||void 0===E||null===(m=E.address)||void 0===m?void 0:m.locality)}var f;null!=c&&null!==(a=c.address)&&void 0!==a&&a.pincode&&(S=_.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==c.address.pincode)}),null!=c&&null!==(f=c.address)&&void 0!==f&&f.locality||I()),"employee"===d&&s(u.key,{...c[u.key],city:g}),R(()=>S.length>0?S:_),1===S.length&&(I(S[0]),"employee"===d&&s(u.key,{...c[u.key],locality:S[0]}))}},[g,null==c||null===(i=c.cpt)||void 0===i||null===(o=i.details)||void 0===o?void 0:o.address,h]),"employee"===d?n.createElement(n.Fragment,null,n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,a("MYCITY_CODE_LABEL"),u.isMandatory?" * ":null),n.createElement(l.Dropdown,{className:"",isMandatory:!0,selected:1===(null==f?void 0:f.length)?f[0]:g,disable:1===(null==f?void 0:f.length),option:f,select:T,optionKey:"code",t:a})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,a("ES_NEW_APPLICATION_LOCATION_MOHALLA"),u.isMandatory?" * ":null),n.createElement(l.Dropdown,{className:"",isMandatory:!0,selected:N,option:D,select:C,optionKey:"name",t:a}))):n.createElement(n.Fragment,null,n.createElement(l.FormStep,{config:u,onSelect:function(){s(u.key,{city:g,locality:N})},t:a,isDisabled:!N},n.createElement(l.CardLabel,null,a("MYCITY_CODE_LABEL")+" *"),n.createElement(l.RadioOrSelect,{options:f,selectedOption:g,optionKey:"i18nKey",onSelect:T,t:a}),g&&D&&n.createElement(l.CardLabel,null,a("CS_CREATECOMPLAINT_MOHALLA")+" *"),g&&D&&n.createElement(l.RadioOrSelect,{isMandatory:u.isMandatory,options:D,selectedOption:N,optionKey:"name",onSelect:C,t:a})))},SearchApp:d,SearchVendor:()=>{var e,i,l,o,a,u;const{t:s}=r.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),{selectedTabs:c}=Digit.Hooks.useQueryParams(),[v,E]=t.useState({}),[m,f]=t.useState([{id:"createdTime",desc:!0}]),[p,_]=t.useState(0),[S,g]=t.useState(10),[y,h]=t.useState(c||"VENDOR"),[D,R]=t.useState(""),[N,I]=t.useState(""),[T,C]=t.useState([]),{data:A}=Digit.Hooks.fsm.useDsoSearch(d,{status:"ACTIVE"},{staleTime:Infinity}),{data:b}=Digit.Hooks.wt.useFillPointSearch({tenantId:d,filters:{limit:1e3}},{staleTime:Infinity});let O={limit:S,offset:p,sortBy:null==m||null===(e=m[0])||void 0===e?void 0:e.id,sortOrder:null!=m&&null!==(i=m[0])&&void 0!==i&&i.desc?"DESC":"ASC"};const{data:V,isLoading:L,refetch:M}="VEHICLE"===y?Digit.Hooks.fsm.useVehiclesSearch({tenantId:d,filters:{...O,registrationNumber:null==v?void 0:v.registrationNumber,status:"ACTIVE,DISABLED",vendorId:null==v||null===(l=v.vendor)||void 0===l?void 0:l.id,fillingPointId:null==v||null===(o=v.fillingPoint)||void 0===o?void 0:o.id},config:{enabled:!1}}):"DRIVER"===y?Digit.Hooks.fsm.useDriverSearch({tenantId:d,filters:{...O,name:null==v?void 0:v.name,status:"ACTIVE,DISABLED",vendorId:null==v||null===(a=v.vendor)||void 0===a?void 0:a.id},config:{enabled:!1}}):"SUPERVISOR"===y?Digit.Hooks.fsm.useSupervisorDetails(d,{...O,status:"ACTIVE,DISABLED"},{enabled:!1}):"SURVEYOR"===y?Digit.Hooks.fsm.useSurveyorDetails(d,{...O,status:"ACTIVE,DISABLED"},{enabled:!1}):Digit.Hooks.fsm.useVendorSearch({tenantId:d,filters:{...O,name:null==v?void 0:v.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}});Digit.Hooks.fsm.useVendorSearch({tenantId:d,filters:{...O,name:null==v?void 0:v.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}});const{data:x,isLoading:k,refetch:P}=Digit.Hooks.fsm.useDsoSearch(d,{vehicleIds:D,driverIds:N,status:"ACTIVE"},{enabled:!1}),F=(null==V?void 0:V.totalCount)||50;t.useEffect(()=>{M(),P()},[]),t.useEffect(()=>{M()},[v,m,p,S]),t.useEffect(()=>{if(null!=V&&V.vehicle&&"VEHICLE"===y){const e=V.vehicle.map(e=>e.id).filter(Boolean).join(",");R(e),C(V.vehicle)}if(null!=V&&V.driver&&"DRIVER"===y){const e=V.driver.map(e=>e.id).filter(Boolean).join(",");I(e),C(null==V?void 0:V.driver)}if(null!=V&&V.vendor&&"VENDOR"===y){const e=V.vendor.map(e=>{var t,n,r,i;return{mobileNumber:null===(t=e.owner)||void 0===t?void 0:t.mobileNumber,name:e.name,id:e.id,auditDetails:e.auditDetails,drivers:e.drivers,activeDrivers:null===(n=e.drivers)||void 0===n?void 0:n.filter(e=>"ACTIVE"===e.status),allVehicles:e.vehicles,dsoDetails:e,vendorAdditionalDetails:e.vendorAdditionalDetails,fillingPoint:e.fillingPoint,vehicles:null===(r=e.vehicles)||void 0===r||null===(i=r.filter(e=>"ACTIVE"===e.status))||void 0===i?void 0:i.map(e=>({id:e.id,registrationNumber:null==e?void 0:e.registrationNumber,type:e.type,i18nKey:"FSM_VEHICLE_TYPE_"+e.type,capacity:e.tankCapacity,suctionType:e.suctionType,model:e.model}))}});C(e)}if("SUPERVISOR"===y){const e=[{id:"SUP1",name:"Amit Kumar",employeeId:"EMP001",status:"ACTIVE",owner:{mobileNumber:"9876543210",userName:"9876543210"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Clean City Agency"}},{id:"SUP2",name:"Rajesh Singh",employeeId:"EMP002",status:"ACTIVE",owner:{mobileNumber:"9876543211",userName:"9876543211"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Green Environment"}}];C((null==V?void 0:V.supervisor)||e)}if("SURVEYOR"===y){const e=[{id:"SUR1",name:"Suresh Raina",employeeId:"EMP101",status:"ACTIVE",owner:{mobileNumber:"9123456780",userName:"9123456780"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Clean City Agency"}},{id:"SUR2",name:"Mahesh Babu",employeeId:"EMP102",status:"ACTIVE",owner:{mobileNumber:"9123456781",userName:"9123456781"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Green Environment"}}];C((null==V?void 0:V.surveyor)||e)}},[V,y]),t.useEffect(()=>{""===D&&""===N||P()},[D,N]),t.useEffect(()=>{if(x){if("VEHICLE"===y){const e=null==V?void 0:V.vehicle.map(e=>{let t=x.find(t=>{var n,r;return null===(n=t.dsoDetails)||void 0===n||null===(r=n.vehicles)||void 0===r?void 0:r.find(t=>t.id===e.id)});if(t){var n,r;let i={...e,vendor:t.dsoDetails};const l=null===(n=t.dsoDetails)||void 0===n||null===(r=n.vehicles)||void 0===r?void 0:r.find(t=>t.id===e.id);return l&&(i.driverData=l.driverData||l.driver||i.driverData),i}return e});C(e),R("")}if("DRIVER"===y){const e=null==V?void 0:V.driver.map(e=>{let t=x.find(t=>{var n,r;return null===(n=t.dsoDetails)||void 0===n||null===(r=n.drivers)||void 0===r?void 0:r.find(t=>t.id===e.id)});return t?{...e,vendor:t.dsoDetails}:e});C(e),I("")}}},[x,V]);const B="VEHICLE"===y?[{label:s("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"vendor",type:"dropdown",options:null==A?void 0:A.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}),optionsKey:"displayName"},{label:s("ES_FSM_REGISTRY_SEARCH_FILLING_POINT"),name:"fillingPoint",type:"dropdown",options:null==b||null===(u=b.fillingPoints)||void 0===u?void 0:u.map(e=>({...e,name:(null==e?void 0:e.name)||(null==e?void 0:e.fillingPointName)||(null==e?void 0:e.fillingStationId)})),optionsKey:"name"},{label:s("ES_VEHICLE_SEARCH_VEHICLE_NUMBER"),name:"registrationNumber",pattern:"[A-Z]{2}[- ]?[0-9]{2}[- ]?[A-Z]{1,2}[- ]?[0-9]{4}",title:s("ES_FSM_VEHICLE_FORMAT_TIP")}]:"DRIVER"===y?[{label:s("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"vendor",type:"dropdown",options:null==A?void 0:A.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}),optionsKey:"displayName"},{label:s("ES_DRIVER_SEARCH_DRIVER_NAME"),name:"name"}]:"SUPERVISOR"===y||"SURVEYOR"===y?[{label:s("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"vendor",type:"dropdown",options:null==A?void 0:A.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}),optionsKey:"displayName"},{label:s("SUPERVISOR"===y?"ES_SUPERVISOR_SEARCH_NAME":"ES_SURVEYOR_SEARCH_NAME"),name:"name"}]:[{label:s("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"name"}],H=t.useCallback(e=>{0!==(null==e?void 0:e.length)&&f(e)},[]);return n.createElement(n.Fragment,null,n.createElement("div",{className:"employee-form-content"},n.createElement(w,{data:{table:T},isLoading:L||k,onSort:H,disableSort:!1,sortParams:m,userRole:"FSM_ADMIN",onFilterChange:()=>{},searchFields:B,onSearch:function(e){void 0===e&&(e={}),E({...e})},onNextPage:()=>{_(e=>e+S)},onPrevPage:()=>{_(e=>e-S)},currentPage:Math.floor(p/S),pageSizeLimit:S,onPageSizeChange:e=>{g(Number(e.target.value))},totalRecords:F||0,onTabChange:e=>{h(e)},selectedTab:y,refetchData:()=>{M()},refetchVendor:()=>{P()}})))},SelectServiceType:e=>{let{config:r,onSelect:i,t:o,userType:a,formData:u}=e;const s=Digit.ULBService.getCurrentTenantId(),[d,c]=(Digit.ULBService.getStateId(),t.useState(null==u?void 0:u.serviceType)),[v,E]=t.useState([]),{data:m,isLoading:f}=Digit.Hooks.useCustomMDMS(s,"tenant",[{name:"citymodule"}],{select:e=>{var t;return null==e||null===(t=e.tenant)||void 0===t?void 0:t.citymodule}});return t.useEffect(()=>{if(m){const e=m.map(e=>({i18nKey:""+e.code,code:""+e.code,value:""+e.name}));if(E(e),!d||"WT"===d.code){const t=e.find(e=>"WT"===e.code);t&&(c(t),"employee"===a&&i(r.key,t))}}},[m]),f?n.createElement(l.Loader,null):"employee"===a?n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,o(r.label)),n.createElement(l.Dropdown,{className:"payment-form-text-input-correction",isMandatory:r.isMandatory,selected:d,option:v,select:e=>{c(e),"employee"===a&&i(r.key,e)},optionKey:"i18nKey",disable:r.disable,t:o})):void 0},SelectVehicleType:e=>{var r;let{t:i,config:o,onSelect:a,formData:u}=e;const s=Digit.ULBService.getStateId(),d=Digit.ULBService.getCurrentTenantId(),{data:c,isLoading:v}=Digit.Hooks.wt.useWTMDMS(s,"Vehicle","VehicleMakeModel"),{data:E,isLoading:m}=Digit.Hooks.useCustomMDMS(d,"tenant",[{name:"citymodule"}],{select:e=>{var t;return null==e||null===(t=e.tenant)||void 0===t?void 0:t.citymodule}}),[f,p]=t.useState({}),[_,S]=t.useState([]),[g,y]=t.useState({}),[h,D]=t.useState([]),[R,N]=t.useState({}),[I,T]=t.useState(""),C=(null==u||null===(r=u.serviceType)||void 0===r?void 0:r.code)||(null==u?void 0:u.serviceType),A=t.useMemo(()=>{if(!E||!c)return{};const e={};return E.forEach(t=>{"WT"===t.code?e[t.code]=c.filter(e=>["MAHINDRA","TATA","TRACTOR","TAFE","SONALIKA"].includes(e.code)).map(e=>e.code):"CND"===t.code&&(e[t.code]=c.filter(e=>["MAHINDRA","TATA"].includes(e.code)).map(e=>e.code))}),e},[E,c]);return t.useEffect(()=>{p(A)},[A]),t.useEffect(()=>{if(!c)return;const e=f[C],t=e?c.filter(t=>e.includes(t.code)):c;S(t),y({}),D([]),N({}),T("")},[c,C,f]),t.useEffect(()=>{if(!c||null==g||!g.code)return;const e=c.filter(e=>e.make===g.code);D(e),N({}),T("")},[g,c]),t.useEffect(()=>{null!=R&&R.capacity&&T(R.capacity)},[R]),v||m?n.createElement(l.Loader,null):c&&E?n.createElement(n.Fragment,null,n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,i("ES_FSM_REGISTRY_VEHICLE_MODEL")),n.createElement(l.Dropdown,{className:"form-field",selected:g,option:_,select:e=>{y(e),a(o.key,{...(null==u?void 0:u[o.key])||{},modal:e,type:""})},optionKey:"name",t:i})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,i("ES_FSM_REGISTRY_VEHICLE_TYPE")),n.createElement(l.Dropdown,{className:"form-field",selected:R,option:h,select:e=>{N(e),T(e.capacity),a(o.key,{...u[o.key],type:e})},optionKey:"name",t:i})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,i("ES_FSM_REGISTRY_VEHICLE_CAPACITY")),n.createElement(l.TextInput,{className:"",textInputStyle:{width:"100%"},value:I,disable:!0}))):n.createElement("div",null,i("ERROR_FETCHING_DATA"))},BankDetailsComponent:e=>{let{t:r,config:i,onSelect:o,formData:a,...u}=e;const[s,d]=t.useState((null==a?void 0:a.ifscCode)||""),[c,v]=t.useState((null==a?void 0:a.bankName)||""),[E,m]=t.useState((null==a?void 0:a.branchName)||""),[f,p]=t.useState((null==a?void 0:a.accountNumber)||""),[_,S]=t.useState(null);return t.useEffect(()=>{11===s.length&&fetch("https://ifsc.razorpay.com/"+s).then(e=>e.json()).then(e=>{e&&e.BANK&&e.BRANCH?(v(e.BANK),m(e.BRANCH),"function"==typeof o&&o(i.key,{bankName:e.BANK,branchName:e.BRANCH,ifscCode:s,accountNumber:f}),S({error:!1,label:r("VALID_IFSC_CODE")})):S({error:!0,label:r("INVALID_IFSC_CODE")})}).catch(()=>{S({error:!0,label:r("INVALID_IFSC_CODE")})})},[s]),t.useEffect(()=>{"function"==typeof o&&o(i.key,{bankName:c,branchName:E,ifscCode:s,accountNumber:f})},[f,c,E,s]),n.createElement(n.Fragment,null,n.createElement(l.CardLabel,null,r("ES_FSM_REGISTRY_IFSC_CODE")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,name:"ifscCode",value:s,onChange:e=>{const t=e.target.value.replace(/[^a-zA-Z0-9]/g,"");t.length<=11&&d(t)},style:{width:"100%"},maxLength:11}),n.createElement(l.CardLabel,null,r("ES_FSM_REGISTRY_ACCOUNT_NUMBER")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,name:"accountNumber",value:f,onChange:e=>p(e.target.value),style:{width:"100%"}}),n.createElement(l.CardLabel,null,r("ES_FSM_REGISTRY_BANK_NAME")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,name:"bankName",value:c,onChange:e=>v(e.target.value),disabled:11===s.length&&c,style:{width:"100%"}}),n.createElement(l.CardLabel,null,r("ES_FSM_REGISTRY_BRANCH_NAME")),n.createElement(l.TextInput,{t:r,type:"text",isMandatory:!1,name:"branchName",value:E,onChange:e=>m(e.target.value),disabled:11===s.length&&E,style:{width:"100%"}}))},AddDriver:e=>{const i=Digit.ULBService.getCurrentTenantId(),{t:o}=r.useTranslation(),s=Digit.ULBService.getStateId(),[d,c]=t.useState(null),[v,E]=t.useState(1),m=a.useQueryClient(),[f,p,_]=(o("ES_FSM_REGISTRY_TITLE_NEW_DRIVER"),Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1)),[S,g,y]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[h,D,R]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:N}=Digit.Hooks.fsm.useDriverCreate(i);t.useEffect(()=>{p(!1),R(),y()},[]);const I=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_DRIVER_DETAILS",body:[{label:"ES_FSM_REGISTRY_DRIVER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"driverName",validation:{required:!0,pattern:{value:/^[A-Za-z\s]+$/,message:e("FSM_REGISTRY_INVALID_NAME")}},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_DRIVER_LICENSE",isMandatory:!0,type:"text",key:"license",populators:{name:"license",validation:{required:!0,pattern:{value:/^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/,message:e("ES_FSM_REGISTRY_INVALID_LICENSE")}},error:e("ES_FSM_REGISTRY_INVALID_LICENSE"),required:!1,defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",route:"select-service",hideInEmployee:!1,key:"serviceType",component:"SelectServiceType",disable:t,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}}]},{head:"ES_FSM_REGISTRY_PERSONAL_DETAILS",body:[{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!0,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>n.createElement(x,u({onChange:e.onChange,date:e.value},t,{max:(()=>{const e=new Date;return e.setFullYear(e.getFullYear()-18),e.toISOString().split("T")[0]})()}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_DRIVER_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction",labelStyle:{border:"1px solid black",borderRight:"none"}}}]}]}(o),[T,C]=t.useState(!1),A=()=>{c(null)},b="WT_VENDOR"===Digit.UserService.getType();return console.log(b,"iscitizen"),n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:o("ES_FSM_REGISTRY_TITLE_NEW_DRIVER"),currentStep:1}]}],currentActiveIndex:v-1,showFinalStep:!1}),n.createElement("div",{style:{flex:"1",overflowY:"auto"}},n.createElement(l.FormComposer,{isDisabled:!T,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:I.filter(e=>!e.hideInEmployee).map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n;const r=null==e?void 0:e.driverName,l=null==e?void 0:e.license,o=null==e||null===(t=e.selectGender)||void 0===t?void 0:t.code,a=null==e?void 0:e.emailId,u=null==e?void 0:e.phone,d=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime(),v=null==e||null===(n=e.serviceType)||void 0===n?void 0:n.code;N({driver:{tenantId:b?i:"dl.djb",name:r,licenseNumber:l,status:"ACTIVE",owner:{tenantId:s,name:r,fatherOrHusbandName:r,relationship:"OTHER",gender:o,dob:d,emailId:a||"abc@egov.com",mobileNumber:u},additionalDetails:{serviceType:v},vendorDriverStatus:"ACTIVE"}},{onError:(e,t)=>{c({key:"error",action:e}),setTimeout(A,5e3)},onSuccess:(e,t)=>{c({key:"success",action:"ADD_DRIVER"}),setTimeout(A,5e3),m.invalidateQueries("FSM_DRIVER_SEARCH")}})},defaultValues:{serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{if(null!=t&&t.license){const n=t.license.replace(/[^A-Za-z0-9]/g,"").toUpperCase();let r=n;n.length>2&&(r=n.slice(0,2)+"-"+n.slice(2)),n.length>4&&(r=r.slice(0,5)+"-"+r.slice(5)),n.length>8&&(r=r.slice(0,10)+"-"+r.slice(10));const i=r.slice(0,18);t.license!==i&&e("license",i)}null!=t&&t.driverName&&/^[A-Za-z\s]+$/.test(null==t?void 0:t.driverName)&&null!=t&&t.license&&/^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/.test(null==t?void 0:t.license)&&null!=t&&t.selectGender&&null!=t&&t.dob&&new Date(null==t?void 0:t.dob).getTime()<=(new Date).setFullYear((new Date).getFullYear()-18)?C(!0):C(!1)},noBreakLine:!0,mode:"onChange",noCard:!0}),d&&n.createElement(l.Toast,{error:"error"===d.key,label:o("success"===d.key?`ES_FSM_${d.action}_SUCCESS`:d.action),onClose:A})))},EditVendorDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=(Digit.ULBService.getStateId(),r.useTranslation()),c=i.useHistory(),v=a.useQueryClient();let{id:E}=i.useParams();const[m,f]=t.useState(!1),[p,_]=t.useState(null),[S,g]=t.useState(!1),[y,h]=t.useState(null),[D,R]=t.useState([]),[N,I]=t.useState([]),[T,C]=t.useState({}),{data:A,isLoading:b,refetch:O}=Digit.Hooks.fsm.useDsoSearch(s,{ids:E},{staleTime:Infinity}),{data:V,refetch:L}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:s,filters:{status:"ACTIVE",sortBy:"registrationNumber",sortOrder:"ASC",vehicleWithNoVendor:!0}}),{data:M,refetch:w}=Digit.Hooks.fsm.useDriverSearch({tenantId:s,filters:{sortBy:"name",sortOrder:"ASC",status:"ACTIVE",driverWithNoVendor:!0}}),{data:x,isLoading:F}=Digit.Hooks.vendor.useEmpvendorCommonSearch({tenantId:s,filters:{vendorId:E}},{enabled:!!E}),{mutate:H}=Digit.Hooks.fsm.useVendorUpdate(s);function U(e){f(!1),_(e)}t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VEHICLE":case"ADD_DRIVER":return g(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-vendor/"+E);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=VENDOR")}},[p]),t.useEffect(()=>{V&&R((null==V?void 0:V.vehicle)||[])},[V]),t.useEffect(()=>{M&&I((null==M?void 0:M.driver)||[])},[M]);const Y=()=>{h(null)},G=()=>{_(null),C({}),g(!1)},W=window.Digit.Utils.browser.isMobile();if(b)return n.createElement(l.Loader,null);const j=["vendorAdditionalDetailsId","vendorId","tenantId","code","lastModifiedTime","createdTime","lastModifiedBy","createdBy","active","status","vendorType","vendorGroup","narration","documents"];return n.createElement("div",{className:"employee-form-content"},b?n.createElement(l.Loader,null):n.createElement(n.Fragment,null,n.createElement(l.Card,null,null==A||null===(o=A[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,t)=>{var r,i;return n.createElement(n.Fragment,{key:t},t>0&&n.createElement(l.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),n.createElement("div",null,null==e||null===(r=e.values)||void 0===r?void 0:r.map((t,r)=>{var i;if("ES_FSM_REGISTRY_DETAILS_ADDITIONAL_DETAILS"===t.title){var o,a;const e=null==x||null===(o=x.VendorDetails)||void 0===o||null===(a=o[0])||void 0===a?void 0:a.vendorAdditionalDetails,r=Object.entries(e||{}).filter(e=>{let[t]=e;return!j.includes(t)});return n.createElement(n.Fragment,{key:t.title},n.createElement(l.Row,{label:d(t.title),text:"",className:"border-none flex-box"}),F?n.createElement(l.Loader,null):e?n.createElement(l.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},n.createElement("div",{className:"additional-grid"},r.map(e=>{let[t,r]=e;if("object"==typeof r&&null!==r)return null;const i=String(t);let l=null!=r&&""!==r?String(r):"N/A";var o,a;return"name"!==t||r&&""!==r||(l=(null==A||null===(o=A[0])||void 0===o||null===(a=o.dsoDetails)||void 0===a?void 0:a.name)||"N/A"),n.createElement(n.Fragment,{key:i},n.createElement("div",{className:"additional-label"},d((e=>{const t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)})(i))),n.createElement("div",{className:"additional-value"},l))})),n.createElement("div",{className:"add-details-link hover-button",onClick:()=>c.push("/digit-ui/employee/vendor/registry/additionaldetails/info?vendorId="+E)},d("Edit Details"))):n.createElement("div",{onClick:()=>c.push("/digit-ui/employee/vendor/registry/additionaldetails/vendor-details?vendorId="+E),className:"add-details-link hover-button"},d("Add Additional Details")))}return n.createElement(l.Row,{key:d(String(t.title)),label:d(String(t.title)),text:t.value?d(String(t.value)):"N/A",last:r===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:t.caption,className:"border-none flex-box "+(W?"":"vendor-details-row")})}),null==e||null===(i=e.child)||void 0===i?void 0:i.map((t,r)=>{var i;return n.createElement(l.Card,{className:"card-with-background",key:t.id||r},n.createElement("div",{className:"card-head"},n.createElement("h2",null,d(e.type)," ",r+1),n.createElement("div",{style:{display:"flex"}},n.createElement("span",{onClick:()=>((e,t,n)=>{if("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===t)c.push("/digit-ui/employee/fsm/registry/modify-driver/"+n);else{var r,i;let t=null==e||null===(r=e.values)||void 0===r||null===(i=r.find(e=>"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.title))||void 0===i?void 0:i.value;c.push("/digit-ui/employee/fsm/registry/modify-vehicle/"+t)}})(t,e.type,t.id)},n.createElement(l.EditIcon,{style:{cursor:"pointer",marginRight:"20px"},className:"edit",fill:"#a82227"})),n.createElement("span",{onClick:()=>((e,t,n)=>{let r={};if("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===t){var i,l;let e=null==A||null===(i=A[0])||void 0===i?void 0:i.dsoDetails,t=null==e?void 0:e.drivers;t=t.map(e=>(e.id===n&&(e.vendorDriverStatus="INACTIVE"),e)),r={vendor:{...e,owner:{...e.owner,gender:(null===(l=e.owner)||void 0===l?void 0:l.gender)||"OTHERS"},drivers:t}}}else{var o,a,u,s;let t=null==A||null===(o=A[0])||void 0===o?void 0:o.dsoDetails,n=null==t?void 0:t.vehicles,i=null==e||null===(a=e.values)||void 0===a||null===(u=a.find(e=>"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.title))||void 0===u?void 0:u.value;n=n.map(e=>(e.registrationNumber===i&&(e.vendorVehicleStatus="INACTIVE"),e)),r={vendor:{...t,owner:{...t.owner,gender:(null===(s=t.owner)||void 0===s?void 0:s.gender)||"OTHERS"},vehicles:n}}}H(r,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(Y,5e3)},onSuccess:(e,n)=>{h({key:"success",action:"ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===t?"DELETE_DRIVER":"DELETE_VEHICLE"}),v.invalidateQueries("DSO_SEARCH"),O(),L(),w(),setTimeout(()=>{Y()},5e3)}})})(t,e.type,t.id)},n.createElement(l.DeleteIcon,{style:{cursor:"pointer"},className:"delete",fill:"#a82227"})))),n.createElement("div",{className:"additional-grid",style:{padding:"8px 16px"}},null==t||null===(i=t.values)||void 0===i?void 0:i.map((e,t)=>n.createElement(n.Fragment,{key:t},n.createElement("div",{className:"additional-label"},d(String(e.title))),n.createElement("div",{className:"additional-value",style:"ACTIVE"===e.value?{color:"green"}:{}},e.value?d(String(e.value)):"N/A")))))}),e.type&&n.createElement("div",{className:"add-details-link hover-button",onClick:()=>U("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===e.type?"ADD_DRIVER":"ADD_VEHICLE")},d(e.type+"_ADD"))))})),S&&n.createElement(l.Modal,{headerBarMain:n.createElement(P,{label:d("DELETE"===p?"ES_FSM_REGISTRY_DELETE_POPUP_HEADER":"ADD_VEHICLE"===p?"ES_FSM_REGISTRY_ADD_VEHICLE_POPUP_HEADER":"ES_FSM_REGISTRY_ADD_DRIVER_POPUP_HEADER")}),headerBarEnd:n.createElement(B,{onClick:G}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:G,actionSaveLabel:d("DELETE"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{var e;let t=null==A||null===(e=A[0])||void 0===e?void 0:e.dsoDetails,n={};if("DELETE"===p&&(n={vendor:{...t,status:"INACTIVE"}}),"ADD_VEHICLE"===p){var r;let e=T;e.vendorVehicleStatus="ACTIVE",n={vendor:{...t,owner:{...t.owner,gender:(null===(r=t.owner)||void 0===r?void 0:r.gender)||"OTHERS"},vehicles:t.vehicles?[...t.vehicles,e]:[e]}}}if("ADD_DRIVER"===p){var i;let e=T;e.vendorDriverStatus="ACTIVE",n={vendor:{...t,owner:{...t.owner,gender:(null===(i=t.owner)||void 0===i?void 0:i.gender)||"OTHERS"},drivers:t.drivers?[...t.drivers,e]:[e]}}}H(n,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(Y,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"DELETE"===p?"DELETE_VENDOR":p}),v.invalidateQueries("DSO_SEARCH"),O(),L(),w(),setTimeout(()=>{Y(),"DELETE"===p&&c.push("/digit-ui/employee/fsm/registry")},5e3)}}),g(!1),_(null)}},n.createElement(l.Card,{style:{boxShadow:"none"}},"DELETE"===p?n.createElement(k,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VEHICLE"===p?n.createElement(n.Fragment,null,n.createElement(l.CardText,null,d("ES_FSM_REGISTRY_SELECT_VEHICLE")),n.createElement(l.Dropdown,{t:d,option:D,value:T,selected:T,select:C,optionKey:"registrationNumber"})):"ADD_DRIVER"===p?n.createElement(n.Fragment,null,n.createElement(l.CardText,null,d("ES_FSM_REGISTRY_SELECT_DRIVER")),n.createElement(l.Dropdown,{t:d,option:N,value:T,selected:T,select:C,optionKey:"name"})):void 0)),y&&n.createElement(l.Toast,{error:"error"===y.key,label:d("success"===y.key?`ES_FSM_REGISTRY_${y.action}_SUCCESS`:y.action),onClose:Y}),n.createElement(l.ActionBar,{style:{zIndex:"19"}},m?n.createElement(l.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE","HOME"],t:d,onSelect:U}):null,n.createElement(l.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>f(!m)}))))},AddVehicle:e=>{const o=Digit.ULBService.getCurrentTenantId(),s=Digit.ULBService.getStateId(),[d,c]=t.useState(null),v=i.useHistory(),{t:E}=r.useTranslation(),m=a.useQueryClient(),[f,p]=t.useState(1),[_,S,g]=(E("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1)),[y,h,D]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[R,N,I]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:T}=Digit.Hooks.fsm.useVehicleCreate(o);t.useEffect(()=>{S(!1),I(),D()},[]);const C=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_VEHICLE_DETAILS",body:[{label:"ES_FSM_REGISTRY_VEHICLE_NUMBER",isMandatory:!0,type:"text",disable:t,populators:{name:"registrationNumber",ValidationRequired:!0,validation:{pattern:"^[A-Z]{2}-[0-9]{1,2}[A-Z]{0,2}-(?:[A-Z]{1,2}-)?[0-9]{1,4}$",title:e("ES_FSM_VEHICLE_FORMAT_TIP")},error:e("FSM_REGISTRY_INVALID_REGISTRATION_NUMBER"),defaultValue:""}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",key:"serviceType",component:"SelectServiceType",disable:t,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{header:"CS_COMMON_CHOOSE_SERVICE_TYPE",submitBarLabel:"CS_COMMON_NEXT"}},{route:"vehicle",component:"SelectVehicleType",withoutLabel:!0,key:"vehicle",isMandatory:!0,type:"component"},{label:"ES_FSM_REGISTRY_VEHICLE_POLLUTION_CERT",isMandatory:!1,type:"custom",key:"pollutionCert",populators:{name:"pollutionCert",validation:{required:!0},component:(e,t)=>n.createElement(H,u({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_INSURANCE",isMandatory:!1,type:"custom",key:"insurance",populators:{name:"insurance",validation:{required:!0},component:(e,t)=>n.createElement(H,u({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_ROAD_TAX",isMandatory:!1,type:"custom",key:"roadTax",populators:{name:"roadTax",validation:{required:!0},component:(e,t)=>n.createElement(H,u({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_FITNESS",isMandatory:!1,type:"custom",key:"fitnessValidity",populators:{name:"fitnessValidity",validation:{required:!0},component:(e,t)=>n.createElement(H,u({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"ownerName",validation:{required:!0,pattern:{value:/^[A-Za-z\s.,/]+$/,message:e("FSM_REGISTRY_INVALID_NAME")}},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:""}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:""}},{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender"},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!0,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>n.createElement(H,u({onChange:e.onChange,date:e.value},t,{max:(()=>{const e=new Date;return e.setFullYear(e.getFullYear()-18),e.toISOString().split("T")[0]})()}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:""}}]}]}(E);C[0].body.forEach(e=>{"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.label&&(e.labelChildren=n.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},n.createElement(l.InfoIcon,null),n.createElement("span",{className:"tooltiptext",style:{width:"320px",left:"230%",fontSize:"14px"}},e.populators.validation.title)))});const[A,b]=t.useState(!1),O=()=>{c(null)};return n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:E("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),currentStep:1}]}],currentActiveIndex:f-1,showFinalStep:!1}),n.createElement("div",{style:{flex:"1",overflowY:"auto"}},n.createElement(l.FormComposer,{isDisabled:!A,label:E("ES_COMMON_APPLICATION_SUBMIT"),config:C.filter(e=>!e.hideInEmployee).map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,r,i,l,a,u,d;const E=null==e?void 0:e.registrationNumber,f=null==e||null===(t=e.vehicle)||void 0===t||null===(n=t.type)||void 0===n?void 0:n.code,p=null==e||null===(r=e.vehicle)||void 0===r||null===(i=r.modal)||void 0===i?void 0:i.code,_=null==e||null===(l=e.vehicle)||void 0===l||null===(a=l.type)||void 0===a?void 0:a.capacity,S=new Date(""+(null==e?void 0:e.pollutionCert)).getTime(),g=new Date(""+(null==e?void 0:e.insurance)).getTime(),y=new Date(""+(null==e?void 0:e.roadTax)).getTime(),h=new Date(""+(null==e?void 0:e.fitnessValidity)).getTime(),D=null==e?void 0:e.ownerName,R=null==e?void 0:e.phone,N=null==e||null===(u=e.serviceType)||void 0===u?void 0:u.code,I=null==e||null===(d=e.selectGender)||void 0===d?void 0:d.code,C=null==e?void 0:e.emailId,A=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime(),b="WT_VENDOR"===Digit.UserService.getType();T({vehicle:{tenantId:b?o:"dl.djb",registrationNumber:E,model:p,type:f,tankCapacity:_,suctionType:"SEWER_SUCTION_MACHINE",pollutionCertiValidTill:S,InsuranceCertValidTill:g,fitnessValidTill:h,roadTaxPaidTill:y,gpsEnabled:!0,source:"Municipal records",owner:{tenantId:s,name:D,fatherOrHusbandName:D,relationship:"OTHER",gender:"OTHERS",dob:A,emailId:"abc@egov.com",correspondenceAddress:"",mobileNumber:R,gender:I,dob:A,emailId:C||"abc@egov.com"},additionalDetails:{serviceType:N}}},{onError:(e,t)=>{c({key:"error",action:e}),setTimeout(O,5e3)},onSuccess:(e,t)=>{c({key:"success",action:"ADD_VEHICLE"}),m.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{O(),v.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=VEHICLE")},3e3)}})},defaultValues:{serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var n,r;if(null!=t&&t.registrationNumber){let n=(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"");if(t.length<=2)return t;const n=t.slice(0,2),r=t.slice(2);if(!r)return n;const i=r.match(/^(\d{1,2})/);if(!i)return n+"-"+r;const l=i[1],o=r.slice(l.length),a=o.match(/^([A-Z]*)/),u=a?a[1]:"",s=o.slice(u.length);if(!s)return n+"-"+l+u;if(u.length>=3){const e=u.length<=3?1:2;return n+"-"+l+u.slice(0,e)+"-"+u.slice(e)+"-"+s.slice(0,4)}return n+"-"+l+u+"-"+s.slice(0,4)})(t.registrationNumber);n.length>15&&(n=n.slice(0,15)),n!==t.registrationNumber&&e("registrationNumber",n)}null!=t&&t.registrationNumber&&null!=t&&t.ownerName&&null!=t&&t.phone&&null!=t&&null!==(n=t.vehicle)&&void 0!==n&&n.modal&&null!=t&&null!==(r=t.vehicle)&&void 0!==r&&r.type&&null!=t&&t.selectGender&&null!=t&&t.dob&&new Date(null==t?void 0:t.dob).getTime()<=(new Date).setFullYear((new Date).getFullYear()-18)?b(!0):b(!1)},noBreakLine:!0,mode:"onChange",noCard:!0}),d&&n.createElement(l.Toast,{error:"error"===d.key,label:E("success"===d.key?`ES_FSM_REGISTRY_${d.action}_SUCCESS`:d.action),onClose:O})))},VENDORCreate:e=>{var t,l,o,u;const s=a.useQueryClient(),d=i.useRouteMatch(),{t:c}=r.useTranslation(),{pathname:v}=i.useLocation(),E=i.useHistory();Digit.ULBService.getStateId();let m=[];const[f,p,_]=Digit.Hooks.useSessionStorage("VENDOR_Test",{});function S(e,t,n,r,i){if(void 0===i&&(i=!1),"owners"===e){let n=f.owners||[];n[r]=t,p({...f,[e]:[...n]})}else if("units"===e){let e=f.units||[];e=t,p({...f,units:e})}else p({...f,[e]:{...f[e],...t}});((e,t,n,r)=>{let i,l=v.split("/").pop(),o=l.charAt(l.length-1),a=!1;Number(parseInt(l))||"0"==l||"-1"==l?"-1"==l||"-2"==l?(l=v.slice(0,-3),l=l.split("/").pop(),a=!0):(l=v.slice(0,-2),l=l.split("/").pop(),a=!0):a=!1,isNaN(o)||(a=!0);let{nextStep:u={}}=m.find(e=>e.route===(l||"0")),s=E.push;if(e&&(s=E.replace),n&&(u=r),null===u)return console.log("matchhhhh pathhhh",d.path),s(d.path+"/check");i=isNaN(u.split("/").pop())&&a&&"map"!==u?`${d.path}/${u}/${t}`:`${d.path}/${u}`,s(i)})(n,r,i,e)}f&&Object.keys(f).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(_(),s.invalidateQueries("VENDOR_CREATE"));const g=()=>{},y=()=>{};U.forEach(e=>{m=m.concat(e.body.filter(e=>!e.hideInCitizen))}),m.indexRoute="info";const h=null===(t=Digit)||void 0===t||null===(l=t.ComponentRegistryService)||void 0===l?void 0:l.getComponent("VENDORCheckPage"),D=null===(o=Digit)||void 0===o||null===(u=o.ComponentRegistryService)||void 0===u?void 0:u.getComponent("NewResponse");return n.createElement(n.Fragment,null,n.createElement(i.Switch,null,m.map((e,t)=>{const{component:r,texts:l,inputs:o,key:a}=e,u="string"==typeof r?Digit.ComponentRegistryService.getComponent(r):r;return n.createElement(i.Route,{path:`${d.path}/${e.route}`,key:t},n.createElement(u,{config:{texts:l,inputs:o,key:a},onSelect:S,onSkip:g,t:c,formData:f,onAdd:y}))}),n.createElement(i.Route,{path:d.path+"/check"},n.createElement(h,{onSubmit:function(){try{return E.push(d.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:f})),n.createElement(i.Route,{path:d.path+"/acknowledgement"},n.createElement(D,{data:f,onSuccess:()=>{_(),s.invalidateQueries("VENDOR_CREATE")}})),n.createElement(i.Route,null,n.createElement(i.Redirect,{to:`${d.path}/${m.indexRoute}`}))))},VENDORCheckPage:e=>{var o,a,u,s;let{onSubmit:d,value:c={}}=e;const{t:E}=r.useTranslation(),[m,f]=(i.useHistory(),t.useState()),{vendordet:p,documents:_}=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId(),c);console.log("vendordetailssppsss",p),console.log("documents",_);const[S,g]=t.useState(!1);return n.createElement(n.Fragment,null,window.location.href.includes("/employee")?n.createElement(l.VerticalTimeline,{config:[{timeLine:[{actions:E("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:E("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:E("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:2,showFinalStep:!1}):null,n.createElement("div",{style:{flex:"1",overflowY:"auto",marginBottom:"20px"}},n.createElement(l.Card,null,n.createElement(l.CardHeader,null,E("VENDOR_CHECK_DETAILS")),n.createElement("div",null,n.createElement("br",null),n.createElement(l.CardSubHeader,null,E("VENDOR_ADDITIONAL_DETAILS")),n.createElement(l.StatusTable,null,n.createElement(n.Fragment,null,n.createElement(l.Row,{label:E("VENDOR_ID"),text:""+E(v(null==p?void 0:p.VendorId)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_BANK_IFSC_CODE"),text:""+E(v(null==p?void 0:p.IFSC)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_BANK_NAME"),text:""+E(v(null==p?void 0:p.Bank)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_BANK_BRANCH"),text:""+E(v(null==p?void 0:p.BankbranchName)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_MICR_NO"),text:""+E(v(null==p?void 0:p.micrNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("BANK_ACCONT_NO"),text:""+E(v(null==p?void 0:p.AccountNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("PAN_NO"),text:""+E(v(null==p?void 0:p.PanNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("GST_NO"),text:""+E(v(null==p?void 0:p.GstNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("GST_REGISTERED_STATE/UT"),text:""+E(v(null==p?void 0:p.GstState)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-detailss"})}),n.createElement(l.Row,{label:E("REGISTRATION_NO"),text:""+E(v(null==p?void 0:p.RegistrationNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("EPF_NO"),text:""+E(v(null==p?void 0:p.EpfNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("ESI_NO"),text:""+E(v(null==p?void 0:p.EsiNo)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_TYPE"),text:""+E(v(null==p||null===(o=p.VendorType)||void 0===o?void 0:o.code)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_CATEGORY"),text:""+E(v(null==p||null===(a=p.VendorCategory)||void 0===a?void 0:a.code)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),n.createElement(l.Row,{label:E("VENDOR_STATUS"),text:""+E(v(null==p||null===(u=p.Status)||void 0===u?void 0:u.code)),actionButton:n.createElement(Y,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}))),n.createElement("br",null),n.createElement(l.CardSubHeader,null,E("VENDOR_DOCUMENTS_DETAILS")),n.createElement(l.StatusTable,null,n.createElement(l.StatusTable,null,n.createElement(l.Row,{label:E("VENDOR_DOCUMENTS"),text:(null==_||null===(s=_.documents)||void 0===s?void 0:s.length)>0?_.documents.map((e,t)=>n.createElement("div",{key:t},n.createElement("span",{style:{color:"#5a6ee1",cursor:"pointer",textDecoration:"underline"},onClick:()=>{var t;(t=null==e?void 0:e.filestoreId)?Digit.UploadServices.Filefetch([t],Digit.ULBService.getStateId()).then(e=>{var t,n,r;const i=null==e||null===(t=e.data)||void 0===t||null===(n=t.fileStoreIds)||void 0===n||null===(r=n[0])||void 0===r?void 0:r.url;if(i){const e=i.split(",")[0];if(e){const t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noopener noreferrer",document.body.appendChild(t),t.click(),document.body.removeChild(t)}}else console.error("URL missing in response. Full res:",e)}):console.error("fileId is null or undefined!")}},E(e.documentType)))):E("CS_NA")}))),n.createElement("br",null),n.createElement(l.CheckBox,{label:E("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{g(!S)},styles:{height:"auto"},checked:S})),n.createElement("br",null),n.createElement("div",{className:"formcomposer-section-button"},n.createElement(l.SubmitBar,{label:E("COMMON_BUTTON_SUBMIT"),onSubmit:d,disabled:!S})))))},NewResponse:e=>{let{data:o,onSuccess:a}=e;const{t:u}=r.useTranslation(),s=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.vendor.useVendorAdditionaldetailsAPI(Digit.ULBService.getCurrentTenantId()));return Digit.Hooks.useStore.getInitData(),i.useRouteMatch(),t.useEffect(()=>{try{var e,t;o.tenantId=null===(e=o.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let n=(e=>{var t,n,r,i,l,o,a,u,s,d,c,v,E,m,f,p,_,S,g,y,h,D,R,N,I;return{VendorAdditionalDetails:{tenantId:Digit.ULBService.getCurrentTenantId(),code:"VENDOR12345454",name:(null==e||null===(t=e.vendordet)||void 0===t?void 0:t.userName)||"N/A",vendorCompany:null==e||null===(n=e.vendordet)||void 0===n?void 0:n.Company,vendorPhone:null==e||null===(r=e.vendordet)||void 0===r?void 0:r.PhoneNo,vendorEmail:"vendor@example.com",contactPerson:null==e||null===(i=e.vendordet)||void 0===i?void 0:i.ContactPerson,vendorMobileNumber:"9876543210",bankAccountNumber:null==e||null===(l=e.vendordet)||void 0===l?void 0:l.AccountNo,bank:null==e||null===(o=e.vendordet)||void 0===o?void 0:o.Bank,bankBranchName:null==e||null===(a=e.vendordet)||void 0===a?void 0:a.BankbranchName,micrNo:null==e||null===(u=e.vendordet)||void 0===u?void 0:u.micrNo,epfNo:null==e||null===(s=e.vendordet)||void 0===s?void 0:s.EpfNo,esiNo:null==e||null===(d=e.vendordet)||void 0===d?void 0:d.EsiNo,gstRegisteredState:null==e||null===(c=e.vendordet)||void 0===c?void 0:c.GstState,ifscCode:null==e||null===(v=e.vendordet)||void 0===v?void 0:v.IFSC,panNo:null==e||null===(E=e.vendordet)||void 0===E?void 0:E.PanNo,registrationNo:null==e||null===(m=e.vendordet)||void 0===m?void 0:m.RegistrationNo,status:null==e||null===(f=e.vendordet)||void 0===f||null===(p=f.Status)||void 0===p?void 0:p.code,vendorCategory:null==e||null===(_=e.vendordet)||void 0===_||null===(S=_.VendorCategory)||void 0===S?void 0:S.code,vendorId:null==e||null===(g=e.vendordet)||void 0===g?void 0:g.VendorId,gstTinNo:null==e||null===(y=e.vendordet)||void 0===y?void 0:y.GstNo,serviceType:null==e||null===(h=e.vendordet)||void 0===h||null===(D=h.VendorType)||void 0===D?void 0:D.code,documents:null==e||null===(R=e.documents)||void 0===R?void 0:R.documents,active:null,vendorAdditionalDetailsId:null,vendorGroup:(null==e||null===(N=e.vendordet)||void 0===N?void 0:N.vendorGroup)||"N/A",vendorType:(null==e||null===(I=e.vendordet)||void 0===I?void 0:I.vendorType)||"N/A"}}})(o);console.log("formdata in acknowejkfdlgi ::: ",n),s.mutate(n,{onSuccess:a}),console.log("mutation in acknowejkfdlgi ::: ",s)}catch(e){}},[]),s.isLoading||s.isIdle?n.createElement(l.Loader,null):n.createElement(l.Card,{className:"vehicle-details-card"},n.createElement(j,{t:u,data:s.data,isSuccess:s.isSuccess,isLoading:s.isIdle||s.isLoading}),n.createElement(l.StatusTable,null,s.isSuccess&&n.createElement(l.Row,{rowContainerStyle:W,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),n.createElement(i.Link,{to:"/digit-ui/employee"},n.createElement(l.LinkButton,{label:u("CORE_COMMON_GO_TO_HOME")})))},DriverDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=r.useTranslation(),c=i.useHistory(),v=a.useQueryClient(),{id:E}=i.useParams(),[m,f]=t.useState(!1),[p,_]=t.useState(null),[S,g]=t.useState(!1),[y,h]=t.useState(null),[D,R]=t.useState([]),[N,I]=t.useState({}),{data:T,isLoading:C,refetch:A}=Digit.Hooks.fsm.useDriverDetails(s,{ids:E},{staleTime:Infinity}),{data:b}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:O}=Digit.Hooks.fsm.useDriverUpdate(s),{mutate:V}=Digit.Hooks.fsm.useVendorUpdate(s);function L(e){_(e),f(!1)}t.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);R(e)}},[b]),t.useEffect(()=>{A()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return g(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-driver/"+E);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER")}},[p]);const M=()=>{h(null)},w=()=>{_(null),I({}),g(!1)},x=()=>"DELETE"===p||"DELETE_VENDOR"===p?n.createElement(k,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?n.createElement(n.Fragment,null,n.createElement(l.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),n.createElement(l.Dropdown,{t:d,option:D,value:N,selected:N,select:I,optionKey:"name"})):void 0;return C||C?n.createElement(l.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"employee-form-content"},n.createElement(l.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==T||null===(o=T[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,t)=>{var r;return n.createElement(n.Fragment,{key:t},t>0&&n.createElement(l.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),n.createElement(l.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},n.createElement("div",{className:"additional-grid"},null==e||null===(r=e.values)||void 0===r?void 0:r.map((e,t)=>n.createElement(n.Fragment,{key:t},n.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?n.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&n.createElement("span",{className:"add-details-link hover-button",onClick:()=>L("ADD_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.AddIcon,{className:"",fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&n.createElement("div",{className:"add-details-link hover-button",onClick:()=>L("EDIT_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.EditIcon,null)),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&n.createElement("div",{className:"add-details-link hover-button",onClick:()=>L("DELETE_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.DeleteIcon,{className:"delete",fill:"#a82227"}))):n.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),S&&n.createElement(l.Modal,{headerBarMain:n.createElement(z,{label:d((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:n.createElement($,{onClick:w}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:w,actionSaveLabel:d("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={driver:{...null==T||null===(e=T[0])||void 0===e?void 0:e.driverData,status:"INACTIVE"}};O(t,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"DELETE_DRIVER"}),v.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{M(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),g(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n,r;let i={},l=null==T||null===(e=T[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],o=null==l?void 0:l.drivers;o=o.map(e=>(e.id===E&&(e.vendorDriverStatus="INACTIVE"),e)),i={vendor:{...l,owner:{...l.owner,gender:(null===(r=l.owner)||void 0===r?void 0:r.gender)||"OTHERS"},drivers:o}},V(i,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"DELETE_VENDOR"}),v.invalidateQueries("FSM_VENDOR_SEARCH"),A(),setTimeout(M,5e3)}}),g(!1)})();case"ADD_VENDOR":return(()=>{var e,t;let n=N,r=null==T||null===(e=T[0])||void 0===e?void 0:e.driverData;r.vendorDriverStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:n.drivers?[...n.drivers,r]:[r]}};V(i,{onError:(e,t)=>{h({key:"error",action:e}),A(),setTimeout(M,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"ADD_VENDOR"}),v.invalidateQueries("DSO_SEARCH"),A(),setTimeout(M,5e3)}}),g(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e,t;let n=N,r=null==T||null===(e=T[0])||void 0===e?void 0:e.driverData;r.vendorDriverStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:n.drivers?[...n.drivers,r]:[r]}};V(i,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"EDIT_VENDOR"}),A(),v.invalidateQueries("DSO_SEARCH"),setTimeout(M,5e3)}}),g(!1),_(null)})()}},formId:"modal-action"},"DELETE"===p||"DELETE_VENDOR"===p?x():n.createElement(l.Card,{style:{boxShadow:"none"}},x())),y&&n.createElement(l.Toast,{error:"error"===y.key,label:d("success"===y.key?`ES_FSM_REGISTRY_${y.action}_SUCCESS`:y.action),onClose:M}),n.createElement(l.ActionBar,{style:{zIndex:"19"}},m?n.createElement(l.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:L}):null,n.createElement(l.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>f(!m)})))},VehicleDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=r.useTranslation(),c=i.useHistory(),v=a.useQueryClient();let{id:E}=i.useParams();const[m,f]=t.useState(!1),[p,_]=t.useState(null),[S,g]=t.useState(!1),[y,h]=t.useState(null),[D,R]=t.useState([]),[N,I]=t.useState({}),[T,C]=t.useState(null),{data:A,isLoading:b,refetch:O}=Digit.Hooks.fsm.useVehicleDetails(s,{registrationNumber:E},{staleTime:Infinity});t.useEffect(()=>{var e,t;!b&&A&&C(null==A||null===(e=A[0])||void 0===e||null===(t=e.vehicleData)||void 0===t?void 0:t.id)},[A,b]);const{data:V}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{});t.useEffect(()=>{if(V){let e=V.map(e=>e.dsoDetails);R(e)}},[V]);const{mutate:L}=Digit.Hooks.fsm.useUpdateVehicle(s),{mutate:M}=Digit.Hooks.fsm.useVendorUpdate(s);function w(e){f(!1),_(e)}t.useEffect(()=>{O()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return g(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-vehicle/"+E);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE")}},[p]);const x=()=>{h(null)},P=()=>{_(null),I({}),g(!1)},F=()=>"DELETE"===p||"DELETE_VENDOR"===p?n.createElement(k,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?n.createElement(n.Fragment,null,n.createElement(l.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),n.createElement(l.Dropdown,{t:d,option:D,value:N,selected:N,select:I,optionKey:"name"})):void 0;return b?n.createElement(l.Loader,null):n.createElement(n.Fragment,null,b?n.createElement(l.Loader,null):n.createElement("div",{className:"employee-form-content"},n.createElement(l.Card,{className:"vehicle-details-card",style:{position:"relative"}},null==A||null===(o=A[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,t)=>{var r;return n.createElement(n.Fragment,{key:t},t>0&&n.createElement(l.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),n.createElement(l.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},n.createElement("div",{className:"additional-grid"},null==e||null===(r=e.values)||void 0===r?void 0:r.map((e,t)=>n.createElement(n.Fragment,{key:t},n.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?n.createElement("div",{className:"additional-value",style:{display:"flex",alignItems:"center",gap:"8px"}},"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&n.createElement("div",{onClick:()=>w("ADD_VENDOR"),style:{color:"#a82227",display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"}},n.createElement(l.AddIcon,{className:"",fill:"#a82227"})," ",d(e.value)||"N/A"),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&n.createElement(n.Fragment,null,n.createElement("span",null,e.value),n.createElement("div",{className:"add-details-link hover-button",onClick:()=>w("EDIT_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.EditIcon,{fill:"#a82227"})),n.createElement("div",{className:"add-details-link hover-button",onClick:()=>w("DELETE_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.DeleteIcon,{className:"delete",fill:"#a82227"})))):n.createElement("div",{className:"additional-value",style:"ACTIVE"===e.value?{color:"green"}:{}},d(e.value)||"N/A"))))))})),S&&n.createElement(l.Modal,{headerBarMain:n.createElement(q,{label:d((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:n.createElement(Z,{onClick:P}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:P,actionSaveLabel:d("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={vehicle:{...null==A||null===(e=A[0])||void 0===e?void 0:e.vehicleData,status:"INACTIVE"}};L(t,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"DELETE_VEHICLE"}),v.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{x(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),g(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n,r;let i={},l=null==A||null===(e=A[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],o=null==l?void 0:l.vehicles;o=o.map(e=>(e.id===T&&(e.vendorVehicleStatus="INACTIVE"),e)),i={vendor:{...l,owner:{...l.owner,gender:(null===(r=l.owner)||void 0===r?void 0:r.gender)||"OTHERS"},vehicles:o}},M(i,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"DELETE_VENDOR"}),v.invalidateQueries("FSM_VENDOR_SEARCH"),O(),setTimeout(x,5e3)}}),g(!1)})();case"ADD_VENDOR":return(()=>{var e,t;let n=N,r=null==A||null===(e=A[0])||void 0===e?void 0:e.vehicleData;r.vendorVehicleStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},vehicles:n.vehicles?[...n.vehicles,r]:[r]}};M(i,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"EDIT_VENDOR"}),O(),v.invalidateQueries("DSO_SEARCH"),setTimeout(x,5e3)}}),g(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e,t;let n=N,r=null==A||null===(e=A[0])||void 0===e?void 0:e.vehicleData;r.vendorVehicleStatus="ACTIVE";const i={vendor:{...n,owner:{...n.owner,gender:(null===(t=n.owner)||void 0===t?void 0:t.gender)||"OTHERS"},vehicles:n.vehicles?[...n.vehicles,r]:[r]}};M(i,{onError:(e,t)=>{h({key:"error",action:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{h({key:"success",action:"EDIT_VENDOR"}),O(),v.invalidateQueries("DSO_SEARCH"),setTimeout(x,5e3)}}),g(!1),_(null)})()}}},"DELETE"===p||"DELETE_VENDOR"===p?F():n.createElement(l.Card,{style:{boxShadow:"none"}},F())),y&&n.createElement(l.Toast,{error:"error"===y.key,label:d("success"===y.key?`ES_FSM_REGISTRY_${y.action}_SUCCESS`:y.action),onClose:x}),n.createElement(l.ActionBar,{style:{zIndex:"19"}},m?n.createElement(l.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:w}):null,n.createElement(l.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>f(!m)}))))},AddSupervisor:e=>{var i;const o=Digit.ULBService.getCurrentTenantId(),{t:u}=r.useTranslation(),[s,d]=t.useState(null),[c,v]=t.useState(1),E=a.useQueryClient(),[m,f]=t.useState(!1),{mutate:p}=Digit.Hooks.fsm.useSupervisorCreate(o),{data:_}=Digit.Hooks.fsm.useVendorSearch(o,{status:"ACTIVE"}),S=function(e,t,r,i){return void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===i&&(i=!1),[{head:"ES_VENDOR_SUPERVISOR_BASIC_DETAILS",body:[{label:"ES_VENDOR_SUPERVISOR_FULL_NAME",isMandatory:!0,type:"text",disable:i,populators:{name:"fullName",validation:{required:!0,pattern:{value:/^[A-Za-z\s]+$/,message:e("ES_VENDOR_INVALID_NAME")}},error:e("ES_VENDOR_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_MOBILE_NUMBER",isMandatory:!0,type:"mobileNumber",disable:i,populators:{name:"mobileNumber",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("ES_VENDOR_INVALID_MOBILE"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_EMAIL_ID",isMandatory:!0,type:"text",populators:{name:"emailId",validation:{required:!0,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("ES_VENDOR_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_EMPLOYEE_ID",isMandatory:!0,type:"text",populators:{name:"employeeId",validation:{required:!0},defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_GENDER",isMandatory:!1,type:"component",key:"gender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}}]},{head:"ES_VENDOR_SUPERVISOR_ROLE_ACCESS",body:[{label:"ES_VENDOR_SUPERVISOR_ROLE",isMandatory:!0,type:"custom",populators:{name:"role",component:(t,r)=>n.createElement(Q,{option:[{code:"SUPERVISOR",name:"Supervisor"}],optionKey:"name",select:t.onChange,selected:t.value,t:e,disable:!0}),defaultValue:{code:"SUPERVISOR",name:"Supervisor"}}},{label:"ES_VENDOR_SUPERVISOR_AGENCY_NAME",isMandatory:!0,type:"custom",populators:{name:"agencyName",component:(r,i)=>n.createElement(Q,{option:t,optionKey:"name",select:r.onChange,selected:r.value,t:e})}},{label:"ES_VENDOR_SUPERVISOR_REPORTING_MANAGER",isMandatory:!1,type:"custom",populators:{name:"reportingManager",component:(t,i)=>n.createElement(Q,{option:r,optionKey:"name",select:t.onChange,selected:t.value,t:e})}}]},{head:"ES_VENDOR_SUPERVISOR_AREA_ASSIGNMENT",body:[{type:"component",component:"SupervisorAreaAssignment",key:"areaAssignment",withoutLabel:!0}]}]}(u,(null==_||null===(i=_.vendor)||void 0===i?void 0:i.map(e=>({code:e.id,name:e.name,...e})))||[],[{code:"MGR1",name:"John Doe (Agency Admin)"},{code:"MGR2",name:"Jane Smith (Agency Admin)"}]),g=()=>{d(null)};return n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{route:"supervisor-details",timeLine:[{actions:u("ES_VENDOR_SUPERVISOR_DETAILS"),currentStep:1}]}],currentActiveIndex:c-1,showFinalStep:!1}),n.createElement("div",{style:{flex:"1",overflowY:"auto"}},n.createElement(l.FormComposer,{isDisabled:!m,label:u("ES_COMMON_APPLICATION_SUBMIT"),config:S.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,r;const i={supervisor:{tenantId:o,name:null==e?void 0:e.fullName,employeeId:null==e?void 0:e.employeeId,status:"ACTIVE",owner:{tenantId:o,name:null==e?void 0:e.fullName,gender:(null==e||null===(t=e.gender)||void 0===t?void 0:t.code)||"OTHERS",emailId:null==e?void 0:e.emailId,mobileNumber:null==e?void 0:e.mobileNumber},vendorSupervisorStatus:"ACTIVE",additionalDetails:{agencyId:null==e||null===(n=e.agencyName)||void 0===n?void 0:n.code,reportingManager:null==e||null===(r=e.reportingManager)||void 0===r?void 0:r.code,areaAssignment:null==e?void 0:e.areaAssignment}}};p(i,{onError:e=>{d({key:"error",action:e}),setTimeout(g,5e3)},onSuccess:()=>{d({key:"success",action:"ADD_SUPERVISOR"}),E.invalidateQueries("SUPERVISOR_SEARCH"),setTimeout(g,5e3)}})},defaultValues:{role:{code:"SUPERVISOR",name:"Supervisor"}},onFormValueChange:(e,t)=>{var n,r,i,l,o;const a=(null==t||null===(n=t.areaAssignment)||void 0===n?void 0:n.zone)&&(null==t||null===(r=t.areaAssignment)||void 0===r?void 0:r.cluster)&&(null==t||null===(i=t.areaAssignment)||void 0===i?void 0:i.ward)&&(null==t||null===(l=t.areaAssignment)||void 0===l||null===(o=l.areas)||void 0===o?void 0:o.length)>0;f(!!((null==t?void 0:t.fullName)&&(null==t?void 0:t.mobileNumber)&&(null==t?void 0:t.emailId)&&(null==t?void 0:t.employeeId)&&(null==t?void 0:t.agencyName)&&a))},noBreakLine:!0,mode:"onChange",noCard:!0}),s&&n.createElement(l.Toast,{error:"error"===s.key,label:u("success"===s.key?`ES_VENDOR_${s.action}_SUCCESS`:s.action),onClose:g})))},SupervisorDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=r.useTranslation(),c=i.useHistory(),v=a.useQueryClient(),{id:E}=i.useParams(),[m,f]=t.useState(!1),[p,_]=t.useState(null),[S,g]=t.useState(!1),[y,h]=t.useState(null),[D,R]=t.useState([]),[N,I]=t.useState({}),{data:T,isLoading:C,refetch:A}=Digit.Hooks.fsm.useSupervisorDetails(s,{ids:E},{staleTime:Infinity}),{data:b}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:O}=Digit.Hooks.fsm.useSupervisorUpdate(s),{mutate:V}=Digit.Hooks.fsm.useVendorUpdate(s);t.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);R(e)}},[b]),t.useEffect(()=>{A()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return g(!0);case"EDIT":return c.push("/digit-ui/employee/vendor/modify-supervisor/"+E);case"HOME":return c.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SUPERVISOR")}},[p]);const L=()=>{h(null)},M=()=>{_(null),I({}),g(!1)};return C?n.createElement(l.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"employee-form-content"},n.createElement(l.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==T||null===(o=T[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,t)=>{var r,i;return n.createElement(n.Fragment,{key:t},t>0&&n.createElement(l.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),n.createElement(l.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},n.createElement("div",{className:"additional-grid"},null==e||null===(r=e.values)||void 0===r?void 0:r.map((e,t)=>n.createElement(n.Fragment,{key:t},n.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?n.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&n.createElement("span",{className:"add-details-link hover-button",onClick:()=>_("ADD_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.AddIcon,{fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&n.createElement(n.Fragment,null,n.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("EDIT_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.EditIcon,null)),n.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("DELETE_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.DeleteIcon,{fill:"#a82227"})))):n.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))),null==e||null===(i=e.child)||void 0===i?void 0:i.map((t,r)=>{var i;return n.createElement(l.Card,{className:"card-with-background",key:t.id||r,style:{margin:"10px 16px",padding:"20px"}},n.createElement("div",{className:"card-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px"}},n.createElement("h2",{style:{fontSize:"18px",fontWeight:"bold"}},d(e.type)," ",r+1),n.createElement("div",{style:{display:"flex",gap:"15px"}},n.createElement("span",{onClick:()=>c.push("/digit-ui/employee/vendor/registry/modify-surveyor/"+t.id)},n.createElement(l.EditIcon,{fill:"#a82227",style:{cursor:"pointer"}})))),n.createElement("div",{className:"additional-grid"},null==t||null===(i=t.values)||void 0===i?void 0:i.map((e,t)=>n.createElement(n.Fragment,{key:t},n.createElement("div",{className:"additional-label"},d(e.title)),n.createElement("div",{className:"additional-value"},d(e.value)||"N/A")))))}),e.type&&n.createElement("div",{className:"add-details-link hover-button",style:{margin:"10px 16px",color:"#a82227",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",fontWeight:"bold"},onClick:()=>c.push("/digit-ui/employee/vendor/registry/new-surveyor?supervisorId="+E)},n.createElement(l.AddIcon,{fill:"#a82227"}),d(e.type+"_ADD")))}))),S&&n.createElement(l.Modal,{headerBarMain:n.createElement(J,{label:d((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_VENDOR_SUPERVISOR_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_VENDOR_SUPERVISOR_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:n.createElement(te,{onClick:M}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:M,actionSaveLabel:d("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={supervisor:{...null==T||null===(e=T[0])||void 0===e?void 0:e.supervisorData,status:"INACTIVE"}};O(t,{onError:e=>{h({key:"error",action:e}),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"DELETE_SUPERVISOR"}),v.invalidateQueries("SUPERVISOR_SEARCH"),setTimeout(()=>{L(),c.push("/digit-ui/employee/vendor/search-vendor")},5e3)}}),g(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n;let r=null==T||null===(e=T[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],i=(null==r?void 0:r.supervisors)||[];i=i.map(e=>(e.id===E&&(e.vendorSupervisorStatus="INACTIVE"),e));const l={vendor:{...r,supervisors:i}};V(l,{onError:e=>{h({key:"error",action:e}),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"DELETE_VENDOR"}),v.invalidateQueries("FSM_VENDOR_SEARCH"),A(),setTimeout(L,5e3)}}),g(!1)})();case"ADD_VENDOR":return(()=>{var e;let t=N,n=null==T||null===(e=T[0])||void 0===e?void 0:e.supervisorData;n.vendorSupervisorStatus="ACTIVE";const r={vendor:{...t,supervisors:t.supervisors?[...t.supervisors,n]:[n]}};V(r,{onError:e=>{h({key:"error",action:e}),A(),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"ADD_VENDOR"}),v.invalidateQueries("SUPERVISOR_SEARCH"),A(),setTimeout(L,5e3)}}),g(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e;let t=N,n=null==T||null===(e=T[0])||void 0===e?void 0:e.supervisorData;n.vendorSupervisorStatus="ACTIVE";const r={vendor:{...t,supervisors:t.supervisors?[...t.supervisors,n]:[n]}};V(r,{onError:e=>{h({key:"error",action:e}),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"EDIT_VENDOR"}),A(),v.invalidateQueries("SUPERVISOR_SEARCH"),setTimeout(L,5e3)}}),g(!1),_(null)})()}}},n.createElement(l.Card,{style:{boxShadow:"none"}},"DELETE"===p||"DELETE_VENDOR"===p?n.createElement(k,{t:d,title:"ES_VENDOR_SUPERVISOR_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?n.createElement(n.Fragment,null,n.createElement(l.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),n.createElement(l.Dropdown,{t:d,option:D,value:N,selected:N,select:I,optionKey:"name"})):void 0)),y&&n.createElement(l.Toast,{error:"error"===y.key,label:d("success"===y.key?`ES_VENDOR_${y.action}_SUCCESS`:y.action),onClose:L}),n.createElement(l.ActionBar,{style:{zIndex:"19"}},m?n.createElement(l.Menu,{localeKeyPrefix:"ES_VENDOR_SUPERVISOR_ACTION",options:["EDIT","DELETE"],t:d,onSelect:e=>{f(!1),_(e)}}):null,n.createElement(l.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>f(!m)})))},SupervisorAreaAssignment:e=>{var r,i,o,a;let{config:u,onSelect:s,t:d,formData:c}=e;const v=Digit.ULBService.getCurrentTenantId(),[E,m]=t.useState((null==c||null===(r=c.areaAssignment)||void 0===r?void 0:r.zone)||null),[f,p]=t.useState((null==c||null===(i=c.areaAssignment)||void 0===i?void 0:i.cluster)||null),[_,S]=t.useState((null==c||null===(o=c.areaAssignment)||void 0===o?void 0:o.ward)||null),[g,y]=t.useState((null==c||null===(a=c.areaAssignment)||void 0===a?void 0:a.areas)||[]),[h,D]=t.useState([]),[R,N]=t.useState([]),[I,T]=t.useState([]),[C,A]=t.useState([]),{data:b,isLoading:O}=Digit.Hooks.useCommonMDMS(v,"egov-location",["TenantBoundary"]);t.useEffect(()=>{if(b){var e,t,n,r;const i=null==b||null===(e=b.MdmsRes)||void 0===e||null===(t=e["egov-location"])||void 0===t||null===(n=t.TenantBoundary)||void 0===n||null===(r=n[0])||void 0===r?void 0:r.boundary;i&&i.children&&D(i.children)}},[b]),t.useEffect(()=>{var e,t;E?(N(E.children||[]),E.code!==(null==c||null===(e=c.areaAssignment)||void 0===e||null===(t=e.zone)||void 0===t?void 0:t.code)&&(p(null),S(null),y([]))):N([])},[E]),t.useEffect(()=>{var e,t;f?(T(f.children||[]),f.code!==(null==c||null===(e=c.areaAssignment)||void 0===e||null===(t=e.cluster)||void 0===t?void 0:t.code)&&(S(null),y([]))):T([])},[f]),t.useEffect(()=>{var e,t;_?(A(_.children||[]),_.code!==(null==c||null===(e=c.areaAssignment)||void 0===e||null===(t=e.ward)||void 0===t?void 0:t.code)&&y([])):A([])},[_]);const V=(e,t)=>{const n={...null==c?void 0:c.areaAssignment,[e]:t};"zone"===e?(n.cluster=null,n.ward=null,n.areas=[]):"cluster"===e?(n.ward=null,n.areas=[]):"ward"===e&&(n.areas=[]),s(u.key,n)};return O?n.createElement(l.Loader,null):n.createElement(n.Fragment,null,n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,d("ES_VENDOR_SUPERVISOR_ZONE")+" *"),n.createElement(l.Dropdown,{selected:E,option:h,select:e=>{m(e),V("zone",e)},optionKey:"name",t:d})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,d("ES_VENDOR_SUPERVISOR_CLUSTER")+" *"),n.createElement(l.Dropdown,{selected:f,option:R,select:e=>{p(e),V("cluster",e)},optionKey:"name",t:d,disable:!E})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,d("ES_VENDOR_SUPERVISOR_WARD")+" *"),n.createElement(l.Dropdown,{selected:_,option:I,select:e=>{S(e),V("ward",e)},optionKey:"name",t:d,disable:!f})),n.createElement(l.LabelFieldPair,null,n.createElement(l.CardLabel,null,d("ES_VENDOR_SUPERVISOR_AREA")+" *"),n.createElement(l.MultiSelectDropdown,{options:C,selected:g,onSelect:e=>{y(e),V("areas",e)},optionsKey:"name",t:d,disable:!_})))},AddSurveyor:e=>{var i;const o=Digit.ULBService.getCurrentTenantId(),{t:u}=r.useTranslation(),[s,d]=t.useState(null),[c,v]=t.useState(1),E=a.useQueryClient(),[m,f]=t.useState(!1),{mutate:p}=Digit.Hooks.fsm.useSurveyorCreate(o),{data:_}=Digit.Hooks.fsm.useVendorSearch(o,{status:"ACTIVE"}),S=[{code:"MGR1",name:"John Doe (Agency Admin)"},{code:"SUP1",name:"Jane Smith (Supervisor)"}],g=function(e,t,r,i){return void 0===t&&(t=[]),void 0===r&&(r=[]),[{head:"ES_VENDOR_SURVEYOR_BASIC_DETAILS",body:[{label:"ES_VENDOR_SURVEYOR_FULL_NAME",isMandatory:!0,type:"text",populators:{name:"fullName",validation:{required:!0,pattern:/^[A-Za-z\s]+$/},error:e("ES_VENDOR_INVALID_NAME")}},{label:"ES_VENDOR_SURVEYOR_MOBILE_NUMBER",isMandatory:!0,type:"mobileNumber",populators:{name:"mobileNumber",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("ES_VENDOR_INVALID_MOBILE")}},{label:"ES_VENDOR_SURVEYOR_EMAIL_ID",isMandatory:!0,type:"text",populators:{name:"emailId",validation:{required:!0,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("ES_VENDOR_INVALID_EMAIL")}},{label:"ES_VENDOR_SURVEYOR_STAFF_CODE",isMandatory:!0,type:"text",populators:{name:"employeeId",validation:{required:!0}}},{label:"ES_VENDOR_SURVEYOR_GENDER",isMandatory:!1,type:"component",key:"selectGender",component:"SelectGender",texts:{header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"ES_VENDOR_SURVEYOR_ROLE_ACCESS",body:[{label:"ES_VENDOR_SURVEYOR_ROLE",isMandatory:!0,type:"custom",populators:{name:"role",component:(t,r)=>n.createElement(ne,{option:[{code:"SURVEYOR",name:"Surveyor"}],optionKey:"name",select:t.onChange,selected:t.value,t:e,disable:!0}),defaultValue:{code:"SURVEYOR",name:"Surveyor"}}},{label:"ES_VENDOR_SURVEYOR_AGENCY_NAME",isMandatory:!0,type:"custom",populators:{name:"agencyName",component:(r,i)=>n.createElement(ne,{option:t,optionKey:"name",select:r.onChange,selected:r.value,t:e})}},{label:"ES_VENDOR_SURVEYOR_REPORTING_MANAGER",isMandatory:!1,type:"custom",populators:{name:"reportingManager",component:(t,i)=>n.createElement(ne,{option:r,optionKey:"name",select:t.onChange,selected:t.value,t:e})}}]},{head:"ES_VENDOR_SURVEYOR_AREA_ASSIGNMENT",body:[{isMandatory:!0,type:"component",key:"areaAssignment",component:"SupervisorAreaAssignment",withoutLabel:!0}]}]}(u,(null==_||null===(i=_.vendor)||void 0===i?void 0:i.map(e=>({code:e.id,name:e.name,...e})))||[],S),{supervisorId:y}=Digit.Hooks.useQueryParams(),h={role:{code:"SURVEYOR",name:"Surveyor"},reportingManager:S.find(e=>e.code===y)||null},D=()=>{d(null)};return n.createElement(n.Fragment,null,n.createElement(l.VerticalTimeline,{config:[{route:"surveyor-details",timeLine:[{actions:u("ES_VENDOR_SURVEYOR_DETAILS"),currentStep:1}]}],currentActiveIndex:c-1,showFinalStep:!1}),n.createElement("div",{style:{flex:"1",overflowY:"auto"}},n.createElement(l.FormComposer,{isDisabled:!m,label:u("ES_COMMON_APPLICATION_SUBMIT"),config:g.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,n,r;const i={surveyor:{tenantId:o,name:null==e?void 0:e.fullName,employeeId:null==e?void 0:e.employeeId,status:"ACTIVE",owner:{tenantId:o,name:null==e?void 0:e.fullName,gender:(null==e||null===(t=e.gender)||void 0===t?void 0:t.code)||"OTHERS",emailId:null==e?void 0:e.emailId,mobileNumber:null==e?void 0:e.mobileNumber},vendorSurveyorStatus:"ACTIVE",additionalDetails:{agencyId:null==e||null===(n=e.agencyName)||void 0===n?void 0:n.code,reportingManager:null==e||null===(r=e.reportingManager)||void 0===r?void 0:r.code,areaAssignment:null==e?void 0:e.areaAssignment}}};p(i,{onError:e=>{d({key:"error",action:e}),setTimeout(D,5e3)},onSuccess:()=>{d({key:"success",action:"ADD_SURVEYOR"}),E.invalidateQueries("SURVEYOR_SEARCH"),setTimeout(D,5e3)}})},defaultValues:h,onFormValueChange:(e,t)=>{var n,r,i,l;const o=(null==t||null===(n=t.areaAssignment)||void 0===n?void 0:n.zone)&&(null==t||null===(r=t.areaAssignment)||void 0===r?void 0:r.ward)&&(null==t||null===(i=t.areaAssignment)||void 0===i||null===(l=i.areas)||void 0===l?void 0:l.length)>0;f(!!((null==t?void 0:t.fullName)&&(null==t?void 0:t.mobileNumber)&&(null==t?void 0:t.emailId)&&(null==t?void 0:t.employeeId)&&(null==t?void 0:t.agencyName)&&o))},noBreakLine:!0,mode:"onChange",noCard:!0}),s&&n.createElement(l.Toast,{error:"error"===s.key,label:u("success"===s.key?`ES_VENDOR_${s.action}_SUCCESS`:s.action),onClose:D})))},SurveyorDetails:e=>{var o,u;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=r.useTranslation(),c=i.useHistory(),v=a.useQueryClient(),{id:E}=i.useParams(),[m,f]=t.useState(!1),[p,_]=t.useState(null),[S,g]=t.useState(!1),[y,h]=t.useState(null),[D,R]=t.useState([]),[N,I]=t.useState({}),{data:T,isLoading:C,refetch:A}=Digit.Hooks.fsm.useSurveyorDetails(s,{ids:E},{staleTime:Infinity}),{data:b}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:O}=Digit.Hooks.fsm.useSurveyorUpdate(s),{mutate:V}=Digit.Hooks.fsm.useVendorUpdate(s);t.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);R(e)}},[b]),t.useEffect(()=>{A()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return g(!0);case"EDIT":return c.push("/digit-ui/employee/vendor/modify-surveyor/"+E);case"HOME":return c.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SURVEYOR")}},[p]);const L=()=>{h(null)},M=()=>{_(null),I({}),g(!1)};return C?n.createElement(l.Loader,null):n.createElement(n.Fragment,null,n.createElement("div",{className:"employee-form-content"},n.createElement(l.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==T||null===(o=T[0])||void 0===o||null===(u=o.employeeResponse)||void 0===u?void 0:u.map((e,t)=>{var r;return n.createElement(n.Fragment,{key:t},t>0&&n.createElement(l.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),n.createElement(l.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},n.createElement("div",{className:"additional-grid"},null==e||null===(r=e.values)||void 0===r?void 0:r.map((e,t)=>n.createElement(n.Fragment,{key:t},n.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?n.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&n.createElement("span",{className:"add-details-link hover-button",onClick:()=>_("ADD_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.AddIcon,{fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&n.createElement(n.Fragment,null,n.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("EDIT_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.EditIcon,null)),n.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("DELETE_VENDOR"),style:{cursor:"pointer"}},n.createElement(l.DeleteIcon,{fill:"#a82227"})))):n.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),S&&n.createElement(l.Modal,{headerBarMain:n.createElement(re,{label:d((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_VENDOR_SURVEYOR_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_VENDOR_SURVEYOR_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:n.createElement(le,{onClick:M}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:M,actionSaveLabel:d("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={surveyor:{...null==T||null===(e=T[0])||void 0===e?void 0:e.surveyorData,status:"INACTIVE"}};O(t,{onError:e=>{h({key:"error",action:e}),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"DELETE_SURVEYOR"}),v.invalidateQueries("SURVEYOR_SEARCH"),setTimeout(()=>{L(),c.push("/digit-ui/employee/vendor/search-vendor")},5e3)}}),g(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,n;let r=null==T||null===(e=T[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(n=t.vendor)||void 0===n?void 0:n[0],i=(null==r?void 0:r.surveyors)||[];i=i.map(e=>(e.id===E&&(e.vendorSurveyorStatus="INACTIVE"),e));const l={vendor:{...r,surveyors:i}};V(l,{onError:e=>{h({key:"error",action:e}),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"DELETE_VENDOR"}),v.invalidateQueries("FSM_VENDOR_SEARCH"),A(),setTimeout(L,5e3)}}),g(!1)})();case"ADD_VENDOR":return(()=>{var e;let t=N,n=null==T||null===(e=T[0])||void 0===e?void 0:e.surveyorData;n.vendorSurveyorStatus="ACTIVE";const r={vendor:{...t,surveyors:t.surveyors?[...t.surveyors,n]:[n]}};V(r,{onError:e=>{h({key:"error",action:e}),A(),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"ADD_VENDOR"}),v.invalidateQueries("SURVEYOR_SEARCH"),A(),setTimeout(L,5e3)}}),g(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e;let t=N,n=null==T||null===(e=T[0])||void 0===e?void 0:e.surveyorData;n.vendorSurveyorStatus="ACTIVE";const r={vendor:{...t,surveyors:t.surveyors?[...t.surveyors,n]:[n]}};V(r,{onError:e=>{h({key:"error",action:e}),setTimeout(L,5e3)},onSuccess:()=>{h({key:"success",action:"EDIT_VENDOR"}),A(),v.invalidateQueries("SURVEYOR_SEARCH"),setTimeout(L,5e3)}}),g(!1),_(null)})()}}},n.createElement(l.Card,{style:{boxShadow:"none"}},"DELETE"===p||"DELETE_VENDOR"===p?n.createElement(k,{t:d,title:"ES_VENDOR_SURVEYOR_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?n.createElement(n.Fragment,null,n.createElement(l.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),n.createElement(l.Dropdown,{t:d,option:D,value:N,selected:N,select:I,optionKey:"name"})):void 0)),y&&n.createElement(l.Toast,{error:"error"===y.key,label:d("success"===y.key?`ES_VENDOR_${y.action}_SUCCESS`:y.action),onClose:L}),n.createElement(l.ActionBar,{style:{zIndex:"19"}},m?n.createElement(l.Menu,{localeKeyPrefix:"ES_VENDOR_SURVEYOR_ACTION",options:["EDIT","DELETE"],t:d,onSelect:e=>{f(!1),_(e)}}):null,n.createElement(l.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>f(!m)})))}},ae=e=>{let{stateCode:r,userType:l,tenants:o}=e;const{path:a,url:u}=i.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:r,moduleCode:"VENDOR",language:s}),Object.entries(oe).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)}),Digit.SessionStorage.set("VENDOR_TENANTS",o),t.useEffect(()=>"employee"===l&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),n.createElement(c,{path:a,url:u,userType:l})},ue=e=>{r.useTranslation();const[n,i,l]=Digit.Hooks.useSessionStorage("VENDOR",{});return t.useEffect(()=>{l()},[]),null};exports.VENDORComponents={VENDORCard:()=>{const{t:e}=r.useTranslation(),o=i.useHistory(),[a,u]=t.useState("-"),s=window.location.pathname.toLowerCase().includes("citizen");if(!Digit.Utils.vendorAccess()&&!Digit.UserService.hasAccess(["WT_VENDOR","MT_VENDOR"]))return null;const d=[{label:e("VENDOR_NEW_REGISTERATION"),link:s?"/digit-ui/citizen/vendor/registry/new-vendor":"/digit-ui/employee/vendor/registry/new-vendor"},{label:e("SEARCH_VENDOR"),link:s?"/digit-ui/citizen/vendor/search-vendor":"/digit-ui/employee/vendor/search-vendor"}],c=Digit.UserService.hasAccess(["WT_VENDOR"]),v={Icon:n.createElement(l.PropertyHouse,null),moduleName:e("TITLE_VENDOR_MANAGEMENT"),kpis:[{count:null==a?void 0:a.totalCount,label:e("Inbox"),link:s?"/digit-ui/citizen/vendor/search-vendor":"/digit-ui/employee/vendor/search-vendor"}],links:d.filter(e=>!(null!=e&&e.role)||c),...s?{onDetailsClick:()=>o.push("/digit-ui/citizen/vendor/search-vendor")}:{}};return s?n.createElement("div",{className:"wt-citizen-card-premium"},n.createElement(l.EmployeeModuleCard,v)):n.createElement(l.EmployeeModuleCard,v)},VENDORModule:ae,VENDORLinks:ue},exports.VENDORLinks=ue,exports.VENDORModule=ae;
|
|
1
|
+
var e,t=require("react"),l=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-router-dom"),a=require("@djb25/digit-ui-react-components"),i=require("react-i18next"),o=require("react-hook-form"),r=require("react-query");function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var n in l)({}).hasOwnProperty.call(l,n)&&(e[n]=l[n])}return e}).apply(null,arguments)}const d=e=>{let{path:t}=e;const{t:o}=i.useTranslation(),r=n.useLocation();sessionStorage.removeItem("revalidateddone");const d=Digit.ComponentRegistryService.getComponent("AddVendor"),u=Digit.ComponentRegistryService.getComponent("SearchVendor"),c=Digit.ComponentRegistryService.getComponent("SearchApp"),E=Digit.ComponentRegistryService.getComponent("AddDriver"),m=Digit.ComponentRegistryService.getComponent("EditVendorDetails"),v=Digit.ComponentRegistryService.getComponent("AddVehicle"),S=Digit.ComponentRegistryService.getComponent("VENDORCreate"),p=Digit.ComponentRegistryService.getComponent("DriverDetails"),_=Digit.ComponentRegistryService.getComponent("VehicleDetails"),D=Digit.ComponentRegistryService.getComponent("AddSupervisor"),R=Digit.ComponentRegistryService.getComponent("SupervisorDetails"),N=Digit.ComponentRegistryService.getComponent("AddSurveyor"),g=Digit.ComponentRegistryService.getComponent("SurveyorDetails");return l.createElement(n.Switch,null,l.createElement(a.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(a.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(a.ArrowLeft,{className:"icon"}),"Back"),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const e=r.pathname;let t=[{icon:a.HomeIcon,path:"/digit-ui/employee"},{label:o("TITLE_VENDOR_MANAGEMENT"),path:"/digit-ui/employee/vendor/search-vendor"}];return e.includes("/registry/new-vendor")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_VENDOR")}):e.includes("/search-vendor")?t.push({label:o("SEARCH_VENDOR")}):e.includes("/registry/new-driver")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_DRIVER")}):e.includes("/registry/vendor-details")||e.includes("/registry/modify-vendor/")?t.push({label:o("VENDOR_VENDOR_DETAILS")}):e.includes("/registry/vehicle-details")||e.includes("/registry/modify-vehicle/")?t.push({label:o("VENDOR_VEHICLE_DETAILS")}):e.includes("/registry/new-vehicle")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE")}):e.includes("/registry/driver-details")||e.includes("/registry/modify-driver/")?t.push({label:o("VENDOR_DRIVER_DETAILS")}):e.includes("/registry/additionaldetails")?t.push({label:o("VENDOR_ADDITIONAL_DETAILS")}):e.includes("/registry/new-supervisor")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR")}):e.includes("/registry/supervisor-details")||e.includes("/registry/modify-supervisor/")?t.push({label:o("VENDOR_SUPERVISOR_DETAILS")}):e.includes("/registry/new-surveyor")?t.push({label:o("ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR")}):(e.includes("/registry/surveyor-details")||e.includes("/registry/modify-surveyor/"))&&t.push({label:o("VENDOR_SURVEYOR_DETAILS")}),t})()}),l.createElement(a.PrivateRoute,{path:t+"/search-vendor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"normal"},l.createElement(u,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/new-driver",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(E,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/new-vehicle",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(v,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/additionaldetails",component:e=>{const n=e.location.pathname.includes("/info");return l.createElement(a.LayoutWrapper,{layoutClass:n?"action":"normal"},l.createElement(S,s({},e,{parentRoute:t})))}}),l.createElement(a.PrivateRoute,{path:t+"/registry/driver-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(p,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/common-search/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"normal"},l.createElement(c,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/new-vendor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(d,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/vendor-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(m,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/vehicle-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(_,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/new-supervisor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(D,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/supervisor-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(R,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/new-surveyor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(N,s({},e,{parentRoute:t})))}),l.createElement(a.PrivateRoute,{path:t+"/registry/surveyor-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(g,s({},e,{parentRoute:t})))})))))};function u(e,t){try{var l=e()}catch(e){return t(e)}return l&&l.then?l.then(void 0,t):l}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const c=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||void 0===e||""===e)}(e)?e:"NA"},E=function(e,t,l){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===l&&(l=""),""===t)return e;for(;e.includes(t);)e=e.replace(t,l);return e},m=e=>{var n,i;let{isLoading:r,t:s,onSubmit:d,data:u,count:c,setShowToast:E,vendorData:m}=e;const v=window.Digit.Utils.browser.isMobile(),S=new Date,p=S.toISOString().split("T")[0],_=new Date(S);_.setDate(S.getDate()-7);const D=_.toISOString().split("T")[0],{register:R,control:N,handleSubmit:g,setValue:y,getValues:T,reset:I,formState:C}=o.useForm({defaultValues:{offset:0,limit:!v&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:p}});t.useEffect(()=>{R("offset",0),R("limit",10),R("sortBy","commencementDate"),R("sortOrder","DESC"),y("fromDate",D),y("toDate",p)},[R,g,y,p,D]),t.useEffect(()=>{var e;if(console.log("Fetched Vendor Data:"),null!=m&&null!==(e=m.vendor)&&void 0!==e&&e.length){const e=m.vendor.map(e=>e.name);console.log("Vendor Names:",e)}},[m]);const O=t.useMemo(()=>[{Header:s("VENDOR_REGISTRATION_NO"),accessor:"requestId",disableSortBy:!0,Cell:e=>{var t;let{row:n}=e;const a=null===(t=n.original.vendorAdditionalDetails)||void 0===t?void 0:t.registrationNo;return l.createElement("div",null,a||"N/A")}},{Header:s("CONTACT_PERSON_NAME"),disableSortBy:!0,Cell:e=>{var t;let{row:n}=e;const a=null===(t=n.original.vendorAdditionalDetails)||void 0===t?void 0:t.contactPerson;return l.createElement("div",null,a||"N/A")}},{Header:s("VENDOR_MOBILE_NUMBER"),disableSortBy:!0,Cell:e=>{var t;let{row:n}=e;const a=null===(t=n.original.vendorAdditionalDetails)||void 0===t?void 0:t.vendorMobileNumber;return l.createElement("div",null,a||"N/A")}},{Header:s("VENDOR_BANK_NAME"),disableSortBy:!0,Cell:e=>{var t;let{row:n}=e;const a=null===(t=n.original.vendorAdditionalDetails)||void 0===t?void 0:t.bank;return l.createElement("div",null,a||"N/A")}},{Header:s("VENDOR_STATUS"),disableSortBy:!0,Cell:e=>{var t;let{row:n}=e;const a=null===(t=n.original.vendorAdditionalDetails)||void 0===t?void 0:t.status;return l.createElement("div",null,a||"N/A")}}],[]),A=t.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function f(){y("offset",T("offset")-T("limit")),g(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(a.Header,null,s("VENDOR_COMMON_SEARCH_ADDITIONAL_DETAILS")),l.createElement(a.SearchForm,{onSubmit:d,handleSubmit:g},l.createElement(a.SearchField,null,l.createElement("label",null,s("VENDOR_NAME")),l.createElement(o.Controller,{control:N,name:"vendorName",render:e=>{var t;return l.createElement(a.Dropdown,{selected:e.value||"",select:e.onChange,onBlur:e.onBlur,option:(null==m||null===(t=m.vendor)||void 0===t?void 0:t.map(e=>({name:e.name,i18nKey:e.name})))||[],optionKey:"i18nKey",t:s,disable:!1})}})),l.createElement(a.SearchField,null,l.createElement("label",null,s("VENDOR_MOBILE_NO")),l.createElement(a.MobileNumber,{name:"mobileNumber",inputRef:R({minLength:{value:10,message:s("CORE_COMMON_MOBILE_ERROR")},maxLength:{value:10,message:s("CORE_COMMON_MOBILE_ERROR")},pattern:{value:/[6789][0-9]{9}/,message:s("CORE_COMMON_MOBILE_ERROR")}}),type:"number",componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91")}),l.createElement(a.CardLabelError,null,null==C||null===(n=C.errors)||void 0===n||null===(i=n.mobileNumber)||void 0===i?void 0:i.message)),l.createElement(a.SearchField,null,l.createElement("label",null,s("VENDOR_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(a.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange}),name:"fromDate",control:N})),l.createElement(a.SearchField,null,l.createElement("label",null,s("VENDOR_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(a.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange}),name:"toDate",control:N})),l.createElement(a.SearchField,{className:"submit"},l.createElement(a.SubmitBar,{label:s("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{I({fromDate:D,toDate:"",mobileNumber:"",vendorName:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),E(null),f()}},s("ES_COMMON_CLEAR_ALL")))),!r&&null!=u&&u.display?l.createElement(a.Card,{style:{marginTop:20}},s(u.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):r||""===u?""!==u||r&&l.createElement(a.Loader,null):l.createElement(a.Table,{t:s,data:u,totalRecords:c,columns:O,getCellProps:e=>({style:{minWidth:e.column.Header===s("EW_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){y("limit",Number(e.target.value)),g(d)()},currentPage:T("offset")/T("limit"),onNextPage:function(){y("offset",T("offset")+T("limit")),g(d)()},onPrevPage:f,pageSizeLimit:T("limit"),onSort:A,disableSort:!1,sortParams:[{id:T("sortBy"),desc:"DESC"===T("sortOrder")}]})))},v=e=>{let{parentRoute:o}=e;const{t:r}=i.useTranslation(),s=[{text:r("ES_TITLE_NEW_DESULDGING_APPLICATION"),link:"/digit-ui/employee/fsm/new-application",roles:["FSM_CREATOR_EMP"]},{text:r("ES_TITILE_SEARCH_APPLICATION"),link:o+"/search"},{text:r("ES_TITLE_REPORTS"),link:"/employee/report/fsm/FSMDailyDesludingReport",roles:["FSM_ADMIN"],hyperlink:!0}],[d,u]=t.useState([]),{roles:c}=Digit.UserService.getUser().info;return t.useEffect(()=>{let e=s.filter(e=>{let{roles:t}=e;return(null==t?void 0:t.some(e=>null==c?void 0:c.map(e=>{let{code:t}=e;return t}).includes(e)))||!(null!=t&&t.length)});u(e)},[]),l.createElement(a.Card,{className:"employeeCard inboxLinksFSM"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(a.ShippingTruck,null))," ",l.createElement("span",{className:"text"},r("ES_TITLE_FAECAL_SLUDGE_MGMT"))),l.createElement("div",{className:"body"},d.map((e,t)=>{let{link:a,text:i,hyperlink:o=!1,accessTo:s=[]}=e;return l.createElement("span",{className:"link",key:t},o?l.createElement("a",{href:a},r(i)):l.createElement(n.Link,{to:a},r(i)))}))))},S=e=>{let{className:t="table",t:n,currentPage:i,columns:o,data:r,getCellProps:d,disableSort:u,onSort:c,onNextPage:E,onPrevPage:m,onPageSizeChange:v,pageSizeLimit:S,sortParams:p,totalRecords:_,isPaginationRequired:D,showCSVExport:R,csvExportFileName:N,csvExportData:g,getCSVExportData:y,csvExportColumns:T,csvExportButtonLabel:I,...C}=e;return l.createElement(a.Table,s({className:t,t:n,data:r,currentPage:i,columns:o,getCellProps:d,onNextPage:E,onPrevPage:m,pageSizeLimit:S,disableSort:u,onPageSizeChange:v,onSort:c,sortParams:p,totalRecords:_,isPaginationRequired:D,showCSVExport:R,csvExportFileName:N,csvExportData:g,getCSVExportData:y,csvExportColumns:T,csvExportButtonLabel:I},C))},p=e=>{var t;let{status:n,searchParams:o,onAssignmentChange:r,statusMap:s}=e;return i.useTranslation(),l.createElement(a.CheckBox,{styles:{height:"unset"},onChange:e=>r({...e,state:n.state},n),checked:null==o?void 0:o.applicationStatus.some(e=>e.uuid===n.uuid),label:`${n.name} (${(null==s||null===(t=s.find(e=>e.statusid===n.uuid))||void 0===t?void 0:t.count)||"-"})`})},_=e=>{var n,o,r,s,d;let{onAssignmentChange:u,searchParams:c,businessServices:E,statusMap:m}=e;const{t:v}=i.useTranslation(),[S,_]=t.useState(!1),{data:D,isLoading:R}=Digit.Hooks.useApplicationStatusGeneral({businessServices:E},{}),{userRoleStates:N}=D||{},g=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return R?l.createElement(a.Loader,null):null!=N&&N.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},v("ES_INBOX_STATUS")),null==N||null===(n=N.filter(e=>!e.isTerminateState))||void 0===n||null===(o=n.slice(0,4))||void 0===o?void 0:o.map((e,t)=>l.createElement(p,{businessServices:E,key:t,onAssignmentChange:u,status:{name:g(e,v),code:e.applicationStatus,...e},searchParams:c,statusMap:m})),(null==N||null===(r=N.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,S&&(null==N||null===(s=N.filter(e=>!e.isTerminateState))||void 0===s||null===(d=s.slice(4))||void 0===d?void 0:d.map((e,t)=>l.createElement(p,{businessServices:E,key:e.uuid,onAssignmentChange:u,status:{name:g(e,v),code:e.applicationStatus,...e},searchParams:c,statusMap:m}))),l.createElement("div",{className:"filter-button",onClick:()=>_(!S)}," ",v(S?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null},D=e=>{let{onFilterChange:t,searchParams:n,paginationParms:i,tenantId:o,t:r}=e;const{data:s}=Digit.Hooks.fsm.useInbox(o,{...n,...i,fromDate:null!=n&&n.fromDate?new Date(null==n?void 0:n.fromDate).getTime():void 0,toDate:null!=n&&n.toDate?new Date(null==n?void 0:n.toDate).getTime():void 0,total:!0,uuid:{code:"ASSIGNED_TO_ALL",name:r("ES_INBOX_ASSIGNED_TO_ALL")}}),d=[{code:"ASSIGNED_TO_ME",name:r("ES_INBOX_ASSIGNED_TO_ME")+" (0)"},{code:"ASSIGNED_TO_ALL",name:`${r("ES_INBOX_ASSIGNED_TO_ALL")} (${(null==s?void 0:s.totalCount)||0})`}];return l.createElement(l.Fragment,null,l.createElement(a.RadioButtons,{onSelect:e=>t({uuid:{code:e.code}}),selectedOption:d.filter(e=>{var t;return e.code===(null==n||null===(t=n.uuid)||void 0===t?void 0:t.code)})[0],optionsKey:"name",options:d}))},R=e=>{var t,o,r,s;let{searchParams:d,paginationParms:u,onFilterChange:c,onSearch:E,...m}=e;const{t:v}=i.useTranslation(),S=n.useLocation(),p=Digit.UserService.hasAccess(["FSM_DSO"])||!1,R=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,N=Digit.UserService.hasAccess("FSM_EMP_FSTPO")&&S.pathname.includes("fstp-fsm-request")||!1,g=Digit.ULBService.getCurrentTenantId(),y=Digit.ULBService.getStateId(),{data:T,isFetched:I}=Digit.Hooks.fsm.useMDMS(y,"DIGIT-UI","RoleStatusMapping"),C=Digit.UserService.getUser().info.roles.map(e=>e.code),O=null==T?void 0:T.filter(e=>C.filter(t=>t===e.userRole)[0]),A=null==O?void 0:O.reduce((e,t)=>({fixed:(null==t?void 0:t.fixed)&&(null==e?void 0:e.fixed),statuses:[...null==e?void 0:e.statuses,...null==t?void 0:t.statuses].filter((e,t,l)=>l.indexOf(e)==t),zeroCheck:(null==t?void 0:t.zeroCheck)||(null==e?void 0:e.zeroCheck)}),{statuses:[]}),f=()=>{if(R)return c()};return l.createElement(l.Fragment,null,(!p&&!R&&d||(null==A||null===(t=A.statuses)||void 0===t?void 0:t.length)>0||N)&&l.createElement("div",{className:"filter",style:{marginTop:R?"-0px":"revert"}},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},v("ES_COMMON_FILTER_BY"),":"),l.createElement("div",{className:"clearAll",onClick:f},v("ES_COMMON_CLEAR_ALL")),"desktop"===m.type&&l.createElement("span",{className:"clear-search",onClick:f},v("ES_COMMON_CLEAR_ALL")),"mobile"===m.type&&l.createElement("span",{onClick:m.onClose},l.createElement(a.CloseSvg,null))),l.createElement("div",null,!p&&!R&&d&&l.createElement(D,{onFilterChange:c,searchParams:d,paginationParms:u,tenantId:g,t:v}),l.createElement("div",null)),(null==A||null===(o=A.statuses)||void 0===o?void 0:o.length)>0||N?l.createElement("div",null,l.createElement("div",{className:"filter-label"},v("ES_INBOX_LOCALITY")),l.createElement(a.Localities,{selectLocality:e=>{c(R?{locality:[e]}:{locality:[...null==d?void 0:d.locality,e]})},tenantId:g,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==d?void 0:d.locality.map((e,t)=>l.createElement(a.RemoveableTag,{key:t,text:e.i18nkey,onClick:()=>{c({locality:null==d?void 0:d.locality.filter(t=>t.code!==e.code)})}})))):null,l.createElement("div",null,I&&A&&null!=m&&null!==(r=m.applications)&&void 0!==r&&r.statuses?l.createElement(_,{onAssignmentChange:(e,t)=>{c(e.target.checked?{applicationStatus:[...null==d?void 0:d.applicationStatus,t]}:{applicationStatus:null==d?void 0:d.applicationStatus.filter(e=>t.name!==e.name)})},fsmfilters:d,mergedRoleDetails:A,statusMap:null==m||null===(s=m.applications)||void 0===s?void 0:s.statuses}):S.pathname.includes("fstp-fsm-request")?"":l.createElement(a.Loader,null)))),"mobile"===m.type&&m.onClose&&l.createElement(a.ActionBar,null,l.createElement(a.ApplyFilterBar,{submit:!1,labelLink:v("ES_COMMON_CLEAR_ALL"),buttonLink:v("ES_COMMON_FILTER"),onClear:f,onSubmit:()=>{"mobile"===m.type?E({delete:["applicationNos"]}):E()},style:{flex:1}})))},N=e=>{let{onAssignmentChange:t,value:n,applicationStatuses:i,areApplicationStatus:o}=e;return o?l.createElement(a.Dropdown,{option:i,optionKey:"name",selected:n,select:t}):l.createElement(a.Loader,null)},g=e=>{var r,d,u,c,E,m,v,S,p,_,D;let{onSearch:R,type:g,onClose:y,onTabChange:T,searchFields:I,searchParams:C,isInboxPage:O,selectedTab:A,matchedRoles:f}=e;const b=O?Digit.SessionStorage.get("vendor/inbox/searchParams"):Digit.SessionStorage.get("vendor/search/searchParams"),{t:h}=i.useTranslation(),V=n.useHistory(),{register:M,handleSubmit:L,reset:w,watch:k,control:P}=o.useForm({defaultValues:b||C}),[F,x]=t.useState(!1),H=window.Digit.Utils.browser.isMobile(),B=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1;function U(){const e=I.reduce((e,t)=>({...e,[null==t?void 0:t.name]:""}),{});w(e),O?Digit.SessionStorage.del("fsm/inbox/searchParams"):Digit.SessionStorage.del("fsm/search/searchParams"),R({})}const Y=e=>null,G=[..."EMPLOYEE"===Digit.SessionStorage.get("User").info.type&&null!=f&&null!==(r=f.wt)&&void 0!==r&&r.includes("WT_VENDOR")?["VENDOR"]:[],...null!=f&&null!==(d=f.wt)&&void 0!==d&&d.includes("WT_VENDOR")?["DRIVER","VEHICLE"]:[],...null!=f&&null!==(u=f.ekyc)&&void 0!==u&&u.includes("EKYC-VENDOR")?["SUPERVISOR"]:[],...null!=f&&null!==(c=f.ekyc)&&void 0!==c&&c.includes("EKYC_SUPERVISOR")||null!=f&&null!==(E=f.ekyc)&&void 0!==E&&E.includes("EKYC-VENDOR")?["SURVEYOR"]:[]];return l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===g||H)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,h("ES_COMMON_SEARCH_BY")),l.createElement("span",{style:{position:"absolute",top:"2%",right:"8px"},onClick:y},l.createElement(a.CloseSvg,null))),l.createElement("div",{className:"search-tabs-container"},l.createElement("div",null,(null==f||null===(m=f.wt)||void 0===m?void 0:m.includes("WT_VENDOR"))&&l.createElement("button",{className:"VENDOR"===A?"search-tab-head-selected":"search-tab-head",onClick:()=>{U(),T("VENDOR")}},h("ES_FSM_REGISTRY_INBOX_TAB_VENDOR")),(null==f||null===(v=f.wt)||void 0===v?void 0:v.includes("WT_VENDOR"))&&l.createElement("button",{className:"VEHICLE"===A?"search-tab-head-selected":"search-tab-head",onClick:()=>{U(),T("VEHICLE")}},h("ES_FSM_REGISTRY_INBOX_TAB_VEHICLE")),(null==f||null===(S=f.wt)||void 0===S?void 0:S.includes("WT_VENDOR"))&&l.createElement("button",{className:"DRIVER"===A?"search-tab-head-selected":"search-tab-head",onClick:()=>{U(),T("DRIVER")}},h("ES_FSM_REGISTRY_INBOX_TAB_DRIVER")),(null==f||null===(p=f.ekyc)||void 0===p?void 0:p.includes("EKYC-VENDOR"))&&l.createElement("button",{className:"SUPERVISOR"===A?"search-tab-head-selected":"search-tab-head",onClick:()=>{U(),T("SUPERVISOR")}},h("ES_FSM_REGISTRY_INBOX_TAB_SUPERVISOR")),((null==f||null===(_=f.ekyc)||void 0===_?void 0:_.includes("EKYC_SUPERVISOR"))||(null==f||null===(D=f.ekyc)||void 0===D?void 0:D.includes("EKYC-VENDOR")))&&l.createElement("button",{className:"SURVEYOR"===A?"search-tab-head-selected":"search-tab-head",onClick:()=>{U(),T("SURVEYOR")}},h("ES_FSM_REGISTRY_INBOX_TAB_SURVEYOR"))),l.createElement("div",{className:"action-bar-wrap-registry"},l.createElement("div",{className:"search-add",onClick:()=>{x(!F)}},h("ES_VENDOR_REGISTRY_INBOX_HEADER_ADD"),l.createElement("div",{className:"search-add-icon"},l.createElement(a.AddIcon,{className:""}))),F&&l.createElement(a.Menu,{localeKeyPrefix:"ES_FSM_ACTION_CREATE",options:G,t:h,onSelect:function(e){switch(e){case"VENDOR":return V.push("/digit-ui/employee/vendor/registry/new-vendor");case"VEHICLE":return V.push("/digit-ui/employee/vendor/registry/new-vehicle");case"DRIVER":return V.push("/digit-ui/employee/vendor/registry/new-driver");case"SUPERVISOR":return V.push("/digit-ui/employee/vendor/registry/new-supervisor");case"SURVEYOR":return V.push("/digit-ui/employee/vendor/registry/new-surveyor")}}}))),l.createElement("form",{onSubmit:L(e=>{e.mobileNumber||delete e.mobileNumber,R(e),"mobile"===g&&y()})},l.createElement("div",{className:B?"for-pt for-search flex-box":"flex-box",style:{gap:"16px"}},null==I?void 0:I.map((e,t)=>l.createElement("span",{key:t,className:0===t?"finance-mainlayout-col1 complaint-input":"finance-mainlayout-col1 mobile-input"},(e=>{switch(e.type){case"date":return l.createElement(o.Controller,{render:e=>l.createElement(a.DatePicker,{date:e.value,onChange:e.onChange}),name:e.name,control:P,defaultValue:null});case"status":return l.createElement(o.Controller,{render:e=>l.createElement(N,{onAssignmentChange:e.onChange,value:e.value}),name:e.name,control:P,defaultValue:null});case"dropdown":return l.createElement(o.Controller,{render:t=>l.createElement(a.Dropdown,{option:e.options,optionKey:e.optionsKey,value:t.value,selected:t.value,select:t.onChange,t:h,placeholder:e.label}),name:e.name,control:P,defaultValue:null});default:return l.createElement(a.TextInput,s({},e,{inputRef:M},M(e.name,{validate:Y}),{watch:k,shouldUpdate:!0,placeholder:e.label}))}})(e))),l.createElement("div",{style:{display:"flex",justifyContent:"end",gap:"16px",alignItems:"center"}},"desktop"===g&&!H&&l.createElement("span",{className:"clear-search generic-button"},l.createElement(a.LinkLabel,{style:{},onClick:U},h("ES_COMMON_CLEAR_SEARCH"))),"desktop"===g&&!H&&l.createElement(a.SubmitBar,{className:"submit-bar-search",label:h("ES_COMMON_SEARCH"),submit:!0})))))))},y=e=>{if(!e)return{};if("object"==typeof e)return e;if("string"!=typeof e)return{};try{return JSON.parse(e)}catch(e){return{}}},T=e=>{var t;return e?"string"==typeof e||"number"==typeof e?[String(e)]:[null==e?void 0:e.id,null==e?void 0:e.fillingStationId,null==e?void 0:e.bookingId,null==e?void 0:e.fillingPointId,null==e?void 0:e.uuid,null==e||null===(t=e.fillingpointmetadata)||void 0===t?void 0:t.fillingPointId].filter(e=>null!=e&&""!==e).map(String):[]},I=function(e,t){void 0===t&&(t=[]);const l=function(e){var t,l,n,a,i,o,r,s,d,u,c,E,m;void 0===e&&(e={});const v=e=>Array.isArray(e)?e.flatMap(T):T(e);return Array.from(new Set([...[null===(t=e)||void 0===t?void 0:t.fillingPointId,null===(l=e)||void 0===l||null===(n=l.dsoDetails)||void 0===n?void 0:n.fillingPointId,null===(a=e)||void 0===a||null===(i=a.fillingpointmetadata)||void 0===i?void 0:i.fillingPointId,null===(o=e)||void 0===o?void 0:o.fillingPtName,null===(r=e)||void 0===r?void 0:r.filling_pt_name,null===(s=e)||void 0===s||null===(d=s.fillingPoint)||void 0===d?void 0:d.fillingPointId].filter(e=>null!=e&&""!==e).map(String),...v(null===(u=e)||void 0===u?void 0:u.fillingPoint),...v(null===(c=e)||void 0===c||null===(E=c.dsoDetails)||void 0===E?void 0:E.fillingPoint),...v(null===(m=e)||void 0===m?void 0:m.fillingPointDetail)]))}(e);return l.length&&t.find(e=>T(e).some(e=>l.includes(e)))||null},C=function(e){var t,l,n,a,i,o,r,s,d,u,c,E,m,v,S,p,_,D,R,N,g,y;if(void 0===e&&(e={}),Array.isArray(null===(t=e)||void 0===t?void 0:t.fillingPoint)){const t=e.fillingPoint.map(e=>(null==e?void 0:e.fillingPointName)||(null==e?void 0:e.fillingPointId)).filter(Boolean);if(t.length>0)return t.join(", ")}return(null===(l=e)||void 0===l||null===(n=l.fillingPoint)||void 0===n?void 0:n.fillingPointName)||(null===(a=e)||void 0===a||null===(i=a.dsoDetails)||void 0===i||null===(o=i.fillingPoint)||void 0===o?void 0:o.fillingPointName)||(null===(r=e)||void 0===r?void 0:r.fillingPointName)||(null===(s=e)||void 0===s||null===(d=s.dsoDetails)||void 0===d?void 0:d.fillingPointName)||(null===(u=e)||void 0===u?void 0:u.fillingPointId)||(null===(c=e)||void 0===c||null===(E=c.dsoDetails)||void 0===E?void 0:E.fillingPointId)||("string"==typeof(null===(m=e)||void 0===m?void 0:m.fillingPoint)?null===(v=e)||void 0===v?void 0:v.fillingPoint:null)||("string"==typeof(null===(S=e)||void 0===S||null===(p=S.dsoDetails)||void 0===p?void 0:p.fillingPoint)?null===(_=e)||void 0===_||null===(D=_.dsoDetails)||void 0===D?void 0:D.fillingPoint:null)||(null===(R=e)||void 0===R||null===(N=R.fillingpointmetadata)||void 0===N?void 0:N.fillingPointId)||(null===(g=e)||void 0===g?void 0:g.filling_pt_name)||(null===(y=e)||void 0===y?void 0:y.fillingPtName)||"NA"},O=function(e,t){var l,n,a,i,o,r,s;void 0===e&&(e={}),void 0===t&&(t=[]);const d=(null===(l=e)||void 0===l||null===(n=l.vendor)||void 0===n?void 0:n.id)||(null===(a=e)||void 0===a||null===(i=a.vendorData)||void 0===i?void 0:i.id)||(null===(o=e)||void 0===o?void 0:o.vendorId);return d&&(t.find(e=>(null==e?void 0:e.id)===d)||(null===(r=e)||void 0===r?void 0:r.vendor)||(null===(s=e)||void 0===s?void 0:s.vendorData))||null},A=function(e){var t,l,n,a;void 0===e&&(e={});const i=[...Array.isArray(null===(t=e)||void 0===t?void 0:t.fillingPoint)?e.fillingPoint:[null===(l=e)||void 0===l?void 0:l.fillingPoint],...Array.isArray(null===(n=e)||void 0===n?void 0:n.fillingPoints)?e.fillingPoints:[null===(a=e)||void 0===a?void 0:a.fillingPoints]].filter(Boolean),o=new Map;return i.forEach(e=>{const t=T(e)[0]||(null==e?void 0:e.fillingPointName)||(null==e?void 0:e.id);t&&!o.has(t)&&o.set(t,e)}),Array.from(o.values())},f=(e,t)=>{const l=Array.isArray(null==e?void 0:e.drivers)?e.drivers.filter(Boolean).map(e=>{var t;return{...e,displayName:`${e.name} (${(null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}):[];if(!t)return[];const n=T(t);return n.length?l.filter(e=>{const t=function(e){var t,l,n,a,i,o,r,s,d,u,c;return void 0===e&&(e={}),Array.from(new Set([null===(t=e)||void 0===t?void 0:t.fillingPointId,null===(l=e)||void 0===l?void 0:l.fillingStationId,null===(n=e)||void 0===n||null===(a=n.additionalDetails)||void 0===a?void 0:a.fillingPointId,null===(i=e)||void 0===i||null===(o=i.additionalDetails)||void 0===o?void 0:o.fillingStationId,null===(r=e)||void 0===r||null===(s=r.fillingpointmetadata)||void 0===s?void 0:s.fillingPointId].filter(e=>null!=e&&""!==e).map(String).concat(T(null===(d=e)||void 0===d?void 0:d.fillingPoint),T(null===(u=e)||void 0===u?void 0:u.fillingPointDetail),T(null===(c=e)||void 0===c?void 0:c.fillingPointDetails))))}(e);return!t.length||t.some(e=>n.includes(e))}):l},b=function(e,t){var l,n,a,i;void 0===e&&(e={}),void 0===t&&(t=[]);const o=(null===(l=e)||void 0===l||null===(n=l.driverData)||void 0===n?void 0:n.id)||(null===(a=e)||void 0===a||null===(i=a.driver)||void 0===i?void 0:i.id);return o&&t.find(e=>(null==e?void 0:e.id)===o)||null},h=e=>{if(!e||"object"!=typeof e)return e;const{id:t,...l}=e;return{...l,fillingStationId:(null==e?void 0:e.fillingStationId)||t||(null==e?void 0:e.bookingId)||(null==e?void 0:e.uuid)||(null==e?void 0:e.fillingPointId)}},V=e=>{var o,s,d;const c=Digit.ULBService.getCurrentTenantId(),{t:E}=i.useTranslation(),m=n.useHistory(),p=e=>l.createElement("span",{className:"cell-text"},e),_=Digit.UserService.hasAccess("FSM_EMP_FSTPO")||!1,[D,N]=t.useState([]),[T,V]=t.useState(null),[M,L]=t.useState([]),[w,k]=t.useState([]),[P,F]=t.useState(!1),[x,H]=t.useState(null),B=Digit.SessionStorage.get("User"),U=B.info.roles,Y=null===(o=B.info.type)||void 0===o?void 0:o.toLowerCase(),G=()=>{H(null),F(!1)},K=l.useMemo(()=>[{Header:E("WT_NAME"),accessor:"name",Cell:e=>{let{row:t}=e;return p(t.original.name)}},{Header:E("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{let{row:t}=e;return p(t.original.mobileNumber)}},{Header:E("WT_EMAIL_ID"),accessor:"emailId",Cell:e=>{let{row:t}=e;return p(t.original.emailId)}},{Header:E("WT_VALID_FROM"),accessor:"validFrom",Cell:e=>{let{row:t}=e;return t.original.validFrom?Digit.DateUtils.ConvertEpochToDate(t.original.validFrom):E("CS_NA")}},{Header:E("WT_VALID_TO"),accessor:"validTo",Cell:e=>{let{row:t}=e;return t.original.validTo?Digit.DateUtils.ConvertEpochToDate(t.original.validTo):E("CS_NA")}},{Header:E("WT_DOCUMENT"),accessor:"fileStoreId",Cell:e=>{let{row:t}=e;return t.original.fileStoreId?l.createElement("div",{style:{color:"#f47738",cursor:"pointer",textDecoration:"underline"},onClick:()=>function(e){try{if(!e)return Promise.resolve();const t=u(function(){return Promise.resolve(Digit.UploadServices.Filefetch([e],"dl")).then(function(t){var l;if(null!=t&&null!==(l=t.data)&&void 0!==l&&l[e]){const l=t.data[e].split(",")[0];window.open(l,"_blank")}})},function(e){console.error(e),V({key:"error",action:"Failed to fetch document."}),setTimeout(J,5e3)});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(t.original.fileStoreId)},l.createElement(a.ViewsIcon,null)):E("CS_NA")}}],[E]),W=r.useQueryClient(),{data:$,refetch:z}=Digit.Hooks.fsm.useDsoSearch(c,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{enabled:!1}),{data:X,refetch:q}=Digit.Hooks.fsm.useDriverSearch({tenantId:c,filters:{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"}}),{mutate:j}=Digit.Hooks.fsm.useVendorUpdate(c),{mutate:Q}=Digit.Hooks.fsm.useUpdateVehicle(c),{mutate:Z}=Digit.Hooks.fsm.useDriverUpdate(c);t.useEffect(()=>{var t;N((null==e||null===(t=e.data)||void 0===t?void 0:t.table)||[])},[e]),t.useEffect(()=>{"DRIVER"!==e.selectedTab&&"VEHICLE"!==e.selectedTab||(z(),q())},[e.selectedTab]),t.useEffect(()=>{if($){let e=$.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}});L(e)}},[$]),t.useEffect(()=>{X&&k((X.driver||[]).map(e=>{var t;return{...e,displayName:`${e.name} (${(null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}))},[X]);const J=()=>{V(null)},ee=(e,t)=>{N(l=>l.map(l=>(null==l?void 0:l.id)===e?{...l,...t}:l))},te=function(e,t){var l;void 0===t&&(t={});const n={...e,...t,driverData:(null===(l=t)||void 0===l?void 0:l.driverData)||(null==e?void 0:e.driverData)||(null==e?void 0:e.driver),fillingPoint:h(Object.prototype.hasOwnProperty.call(t,"fillingPoint")?t.fillingPoint:null==e?void 0:e.fillingPoint)};return delete n.vendor,delete n.popup,delete n.driver,{vehicle:n}},le=(e,t)=>{var l;return{vendor:{...e,owner:{...null==e?void 0:e.owner,gender:(null==e||null===(l=e.owner)||void 0===l?void 0:l.gender)||"OTHERS"},vehicles:t}}},ne=()=>{switch(e.selectedTab){case"VENDOR":return m.push(`/digit-ui/${Y}/vendor/registry/new-vendor`);case"VEHICLE":return m.push(`/digit-ui/${Y}/fsm/registry/new-vehicle`);case"DRIVER":return m.push(`/digit-ui/${Y}/fsm/registry/new-driver`);case"SUPERVISOR":return m.push(`/digit-ui/${Y}/vendor/registry/new-supervisor`);case"SURVEYOR":return m.push(`/digit-ui/${Y}/vendor/registry/new-surveyor`)}},ae=l.useMemo(()=>"VENDOR"===e.selectedTab?(null==D?void 0:D.map(e=>e.id))||[]:(null==$?void 0:$.map(e=>{var t;return null===(t=e.dsoDetails)||void 0===t?void 0:t.id}))||[],[e.selectedTab,D,$]),{data:ie}=Digit.Hooks.vendor.useEmpvendorCommonSearch({tenantId:c,filters:{vendorIds:null==ae?void 0:ae.join(","),vendorId:null==ae?void 0:ae.join(",")}},{enabled:(null==ae?void 0:ae.length)>0}),{data:oe,isLoading:re}=Digit.Hooks.wt.useFillPointSearch({tenantId:c,filters:{limit:1e3}},{enabled:!0}),se=l.useMemo(()=>{switch(e.selectedTab){case"VENDOR":return[{Header:E("ES_VENDOR_INBOX_VENDOR_NAME"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(n.Link,{to:`/digit-ui/${Y}/vendor/registry/vendor-details/`+t.original.id},l.createElement("div",null,t.original.name))))}},{Header:E("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{let{row:t}=e;return l.createElement("div",null,t.original.mobileNumber)}},{Header:E("ES_VENDOR_INBOX_DATE_VENDOR_CREATION"),accessor:"createdTime",Cell:e=>{var t,l,n,a;let{row:i}=e;return p(null!==(t=i.original)&&void 0!==t&&null!==(l=t.auditDetails)&&void 0!==l&&l.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(n=i.original)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.createdTime):"")}},{Header:E("ES_VENDOR_INBOX_SERVICE_TYPE"),id:"serviceType",accessor:e=>{var t,l;let n=null===(t=e.dsoDetails)||void 0===t?void 0:t.additionalDetails;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){n={}}return(null===(l=n)||void 0===l?void 0:l.serviceType)||"N/A"},Cell:e=>{var t,n;let{row:a}=e,i=null===(t=a.original.dsoDetails)||void 0===t?void 0:t.additionalDetails;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){console.error("Error parsing additionalDetails:",e),i={}}const o=(null===(n=i)||void 0===n?void 0:n.serviceType)||"N/A";return l.createElement("div",null,o)}},{Header:E("ES_VENDOR_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>{var t;return(null===(t=e.dsoDetails)||void 0===t?void 0:t.status)||""},Cell:t=>{var n,i;let{row:o}=t;return l.createElement(a.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(n=o.original)||void 0===n||null===(i=n.dsoDetails)||void 0===i?void 0:i.status),onChange:()=>(t=>{var l,n,a,i;let o=t.original.dsoDetails;const r={vendor:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(l=o.owner)||void 0===l?void 0:l.gender)||"OTHER",dob:(null==o||null===(n=o.owner)||void 0===n?void 0:n.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(a=o.owner)||void 0===a?void 0:a.emailId)||"abc@egov.com",relationship:(null==o||null===(i=o.owner)||void 0===i?void 0:i.relationship)||"OTHER"}}};j(r,{onError:(e,t)=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:(t,l)=>{V({key:"success",action:"VENDOR"}),W.invalidateQueries("DSO_SEARCH"),e.refetchData(),setTimeout(J,3e3)}})})(o),name:"switch-"+o.id})}},{Header:E("ES_VENDOR_ADDITIONAL_DETAILS"),disableSortBy:!0,Cell:e=>{var t,a;let{row:i}=e;const o=null===(t=i.original)||void 0===t?void 0:t.id;if(!ie)return l.createElement("span",null,"Loading...");const r=null!==(null===(a=i.original)||void 0===a?void 0:a.vendorAdditionalDetails);return l.createElement(n.Link,{to:r?`/digit-ui/${Y}/vendor/registry/additionaldetails/info?vendorId=`+o:`/digit-ui/${Y}/vendor/registry/additionaldetails/vendor-details?vendorId=`+o},l.createElement("button",{className:"submit-bar",style:{backgroundColor:r?"#417505":"#3A8DCC",color:"white"}},r?"View Details":"Add Details"))}},{Header:E("VIEW_WORKORDER_DETAILS"),disableSortBy:!0,Cell:e=>{let{row:t}=e;return l.createElement("button",{className:"submit-bar",style:{backgroundColor:"#417505",color:"white"},onClick:()=>(H(t.original),void F(!0))},E("VIEW_WORKORDER_DETAILS"))}}];case"VEHICLE":return[{Header:E("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),accessor:"registrationNumber",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(n.Link,{to:`/digit-ui/${Y}/vendor/registry/vehicle-details/`+t.original.registrationNumber},l.createElement("div",null,t.original.registrationNumber))))}},{Header:E("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,(null===(t=a.original)||void 0===t||null===(n=t.owner)||void 0===n?void 0:n.mobileNumber)||"N/A")}},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),accessor:"createdTime",Cell:e=>{var t,l,n,a;let{row:i}=e;return p(null!==(t=i.original)&&void 0!==t&&null!==(l=t.auditDetails)&&void 0!==l&&l.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(n=i.original)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.createdTime):"")}},{Header:"Map Vendor",id:"mapVendor",accessor:e=>{var t,l;return(null===(t=e.vendor)||void 0===t?void 0:t.name)||(null===(l=e.vendorData)||void 0===l?void 0:l.name)||"NA"},Cell:t=>{let{row:n}=t;return l.createElement(a.Dropdown,{className:"fsm-registry-dropdown",selected:O(n.original,M),option:M,select:t=>((t,l)=>{const n=t.original,a=null==n?void 0:n.vendor;if(null==l||!l.id||(null==a?void 0:a.id)===(null==l?void 0:l.id))return;const i={...n,vendorVehicleStatus:"ACTIVE",fillingPoint:null,driverData:null,driver:null};delete i.vendor,delete i.popup,delete i.driver;const o=()=>{const t=Array.isArray(null==l?void 0:l.vehicles)?[...l.vehicles]:[],a=t.findIndex(e=>(null==e?void 0:e.id)===(null==n?void 0:n.id));a>-1?t[a]={...t[a],...i,vendorVehicleStatus:"ACTIVE"}:t.push(i);const o={...l,vehicles:t};j(le(l,t),{onError:e=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:()=>{ee(null==n?void 0:n.id,{vendor:o,fillingPoint:null,driverData:null,driver:null}),V({key:"success",action:"VEHICLE"}),W.invalidateQueries("DSO_SEARCH"),W.invalidateQueries("FSM_VEICLES_SEARCH"),e.refetchData(),e.refetchVendor&&e.refetchVendor(),setTimeout(J,3e3)}})};if(null!=a&&a.id){const e=Array.isArray(null==a?void 0:a.vehicles)?a.vehicles.map(e=>(null==e?void 0:e.id)===(null==n?void 0:n.id)?{...e,vendorVehicleStatus:"INACTIVE"}:e):[];j(le(a,e),{onError:e=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:o})}else o()})(n,t),style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"displayName",t:E})}},{Header:E("ES_VENDOR_INBOX_SERVICE_TYPE"),id:"serviceType",accessor:e=>{var t;let l=e.additionalDetails;if("string"==typeof l)try{l=JSON.parse(l)}catch(e){l={}}return(null===(t=l)||void 0===t?void 0:t.serviceType)||"N/A"},Cell:e=>{var t;let{row:n}=e,a=n.original.additionalDetails;if("string"==typeof a)try{a=JSON.parse(a)}catch(e){console.error("Error parsing additionalDetails:",e),a={}}const i=(null===(t=a)||void 0===t?void 0:t.serviceType)||"N/A";return l.createElement("div",null,i)}},{Header:E("WT_FILLING_POINT"),accessor:e=>C(e),id:"fillingPoint",minWidth:250,Cell:t=>{let{row:n}=t;const i=O(n.original,M),o=A(i);return l.createElement(a.Dropdown,{className:"fsm-registry-dropdown",selected:I(n.original,o),option:o,select:t=>((t,l)=>{const n=te(t.original,{fillingPoint:l});Q(n,{onError:e=>{var t,l,n,a;V({key:"error",label:(null==e?void 0:e.message)||(null==e||null===(t=e.response)||void 0===t||null===(l=t.data)||void 0===l||null===(n=l.Errors)||void 0===n||null===(a=n[0])||void 0===a?void 0:a.message)||"Failed to map filling point"}),setTimeout(J,5e3)},onSuccess:()=>{var n;const a=O(t.original,M),i=f(a,l),o=b(t.original,i);ee(null===(n=t.original)||void 0===n?void 0:n.id,{fillingPoint:{...l,fillingStationId:(null==l?void 0:l.fillingStationId)||(null==l?void 0:l.id)||(null==l?void 0:l.bookingId)||(null==l?void 0:l.uuid)||(null==l?void 0:l.fillingPointId)},...o?{}:{driverData:null,driver:null}}),V({key:"success",label:"Filling point mapped successfully"}),W.invalidateQueries("FSM_VEICLES_SEARCH"),W.invalidateQueries("DSO_SEARCH"),e.refetchData(),e.refetchVendor&&e.refetchVendor(),setTimeout(J,3e3)}})})(n,t),style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"fillingPointName",t:E,disable:!i||!o.length})}},{Header:E("ES_FSM_REGISTRY_SELECT_DRIVER"),id:"driver",accessor:e=>{var t,l;return(null===(t=e.driverData)||void 0===t?void 0:t.name)||(null===(l=e.driver)||void 0===l?void 0:l.name)||"NA"},minWidth:250,Cell:t=>{let{row:n}=t;const i=O(n.original,M),o=I(n.original,A(i)),r=f(i,o);return l.createElement(a.Dropdown,{className:"fsm-registry-dropdown",selected:b(n.original,r),option:r,select:t=>((t,l)=>{const n=te(t.original,{driverData:l});Q(n,{onError:(e,t)=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:(n,a)=>{var i;ee(null===(i=t.original)||void 0===i?void 0:i.id,{driverData:l}),V({key:"success",action:"VEHICLE"}),W.invalidateQueries("FSM_VEICLES_SEARCH"),W.invalidateQueries("DSO_SEARCH"),e.refetchData(),e.refetchVendor(),setTimeout(J,3e3)}})})(n,t),optionKey:"displayName",t:E,style:{textAlign:"left",width:"100%",minWidth:"250px"},disable:!o||!r.length})}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>e.status||"",Cell:t=>{var n;let{row:i}=t;return l.createElement(a.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(n=i.original)||void 0===n?void 0:n.status),onChange:()=>(t=>{var l;const n=te(t.original,{status:"ACTIVE"===(null===(l=t.original)||void 0===l?void 0:l.status)?"DISABLED":"ACTIVE"});Q(n,{onError:(e,t)=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:(t,l)=>{V({key:"success",action:"VEHICLE"}),W.invalidateQueries("FSM_VEICLES_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(J,3e3)}})})(i),name:"switch-"+i.id})}}];case"DRIVER":return[{Header:E("ES_FSM_REGISTRY_INBOX_USERNAME"),id:"userName",accessor:e=>{var t;return(null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"},Cell:e=>{var t;let{row:a}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(n.Link,{to:`/digit-ui/${Y}/vendor/registry/driver-details/`+a.original.id},l.createElement("div",null,(null===(t=a.original.owner)||void 0===t?void 0:t.userName)||"NA"))))}},{Header:E("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),accessor:"name",Cell:e=>{let{row:t}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(n.Link,{to:`/digit-ui/${Y}/vendor/registry/driver-details/`+t.original.id},l.createElement("div",null,""+(t.original.name||"N/A")))))}},{Header:E("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,(null===(t=a.original)||void 0===t||null===(n=t.owner)||void 0===n?void 0:n.mobileNumber)||"N/A")}},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),accessor:"createdTime",Cell:e=>{var t,l,n,a;let{row:i}=e;return p(null!==(t=i.original)&&void 0!==t&&null!==(l=t.auditDetails)&&void 0!==l&&l.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(n=i.original)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.createdTime):"")}},{Header:E("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),id:"vendorName",accessor:e=>{var t,l;return(null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null===(l=e.vendor)||void 0===l?void 0:l.name)||"NA"},minWidth:250,Cell:t=>{let{row:n}=t;return l.createElement(a.Dropdown,{className:"fsm-registry-dropdown",selected:(null==M?void 0:M.find(e=>{var t,l;return((null===(t=n.original.vendorData)||void 0===t?void 0:t.id)||(null===(l=n.original.vendor)||void 0===l?void 0:l.id))===e.id}))||n.original.vendorData||n.original.vendor,option:M,select:t=>((t,l)=>{let n=t.original,a=null==n?void 0:n.vendor,i=l;if(delete n.vendor,n.vendorDriverStatus="ACTIVE",a){const e=null==a?void 0:a.drivers;e.splice(e.findIndex(e=>e.id===n.id),1)}const o={vendor:{...i,drivers:i.drivers?[...i.drivers,n]:[n]}};j(o,{onError:(e,t)=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:(t,l)=>{V({key:"success",action:"VENDOR"}),W.invalidateQueries("DSO_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(J,3e3)}})})(n,t),style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"displayName",t:E})}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>e.status||"",Cell:t=>{var n;let{row:i}=t;return l.createElement(a.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(n=i.original)||void 0===n?void 0:n.status),onChange:()=>(t=>{var l,n,a,i;let o=t.original;const r={driver:{...o,status:"ACTIVE"===(null==o?void 0:o.status)?"DISABLED":"ACTIVE",owner:{...o.owner,gender:(null==o||null===(l=o.owner)||void 0===l?void 0:l.gender)||"OTHER",dob:(null==o||null===(n=o.owner)||void 0===n?void 0:n.dob)||new Date("1/1/1970").getTime(),emailId:(null==o||null===(a=o.owner)||void 0===a?void 0:a.emailId)||"abc@egov.com",relationship:(null==o||null===(i=o.owner)||void 0===i?void 0:i.relationship)||"OTHER"}}};Z(r,{onError:(e,t)=>{V({key:"error",action:e}),setTimeout(J,5e3)},onSuccess:(t,l)=>{V({key:"success",action:"DRIVER"}),W.invalidateQueries("FSM_DRIVER_SEARCH"),e.refetchVendor(),e.refetchData(),setTimeout(J,3e3)}})})(i),name:"switch-"+i.id})}}];case"SUPERVISOR":case"SURVEYOR":return[{Header:E("SUPERVISOR"===e.selectedTab?"Supervisor's Mobile No.":"Surveyor's Mobile No."),id:"userName",accessor:e=>{var t;return(null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"},Cell:t=>{var a;let{row:i}=t;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(n.Link,{to:`/digit-ui/${Y}/vendor/registry/${"SUPERVISOR"===e.selectedTab?"supervisor-details":"surveyor-details"}/`+i.original.id},l.createElement("div",null,(null===(a=i.original.owner)||void 0===a?void 0:a.userName)||"NA"))))}},{Header:E("SUPERVISOR"===e.selectedTab?"ES_FSM_REGISTRY_INBOX_SUPERVISOR_NAME":"ES_FSM_REGISTRY_INBOX_SURVEYOR_NAME"),accessor:"name",Cell:t=>{let{row:a}=t;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(n.Link,{to:`/digit-ui/${Y}/vendor/registry/${"SUPERVISOR"===e.selectedTab?"supervisor-details":"surveyor-details"}/`+a.original.id},l.createElement("div",null,""+(a.original.name||"N/A")))))}},{Header:E("WT_MOBILE_NUMBER"),accessor:"mobileNumber",Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,(null===(t=a.original)||void 0===t||null===(n=t.owner)||void 0===n?void 0:n.mobileNumber)||"N/A")}},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_CREATION"),accessor:"createdTime",Cell:e=>{var t,l,n,a;let{row:i}=e;return p(null!==(t=i.original)&&void 0!==t&&null!==(l=t.auditDetails)&&void 0!==l&&l.createdTime?Digit.DateUtils.ConvertEpochToDate(null===(n=i.original)||void 0===n||null===(a=n.auditDetails)||void 0===a?void 0:a.createdTime):"")}},{Header:E("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),id:"vendorName",accessor:e=>{var t,l;return(null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null===(l=e.vendor)||void 0===l?void 0:l.name)||"NA"},minWidth:250,Cell:t=>{let{row:n}=t;return l.createElement(a.Dropdown,{className:"fsm-registry-dropdown",selected:(null==M?void 0:M.find(e=>{var t,l;return((null===(t=n.original.vendorData)||void 0===t?void 0:t.id)||(null===(l=n.original.vendor)||void 0===l?void 0:l.id))===e.id}))||n.original.vendorData||n.original.vendor,option:M,select:t=>{console.log("Updating vendor for",e.selectedTab,t)},style:{textAlign:"left",width:"100%",minWidth:"250px"},optionKey:"displayName",t:E})}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),id:"status",accessor:e=>e.status||"",Cell:t=>{var n;let{row:i}=t;return l.createElement(a.ToggleSwitch,{style:{display:"flex",justifyContent:"left"},value:"DISABLED"!==(null===(n=i.original)||void 0===n?void 0:n.status),onChange:()=>{console.log("Updating status for",e.selectedTab,i.original.id)},name:"switch-"+i.id})}}];default:return[]}},[e.selectedTab,M,w,D,ie,(null==oe?void 0:oe.fillingPoints)||[],E]),de=l.useMemo(()=>{switch(e.selectedTab){case"VENDOR":return[{Header:E("ES_VENDOR_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,l,n,a,i;return`${(null==e?void 0:e.name)||(null==e||null===(t=e.dsoDetails)||void 0===t?void 0:t.name)||"NA"} (${(null==e?void 0:e.mobileNumber)||(null==e||null===(l=e.owner)||void 0===l?void 0:l.mobileNumber)||(null==e||null===(n=e.dsoDetails)||void 0===n?void 0:n.mobileNumber)||(null==e||null===(a=e.dsoDetails)||void 0===a||null===(i=a.owner)||void 0===i?void 0:i.mobileNumber)||"NA"})`}},{Header:E("ES_VENDOR_INBOX_DATE_VENDOR_CREATION"),exportAccessor:e=>{var t,l;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime):""}},{Header:E("WT_FILLING_POINT"),exportAccessor:e=>C(e)},{Header:E("ES_VENDOR_INBOX_SERVICE_TYPE"),exportAccessor:e=>{var t,l;return(null===(t=y(null==e||null===(l=e.dsoDetails)||void 0===l?void 0:l.additionalDetails))||void 0===t?void 0:t.serviceType)||"N/A"}},{Header:E("ES_VENDOR_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>{var t;return(null==e||null===(t=e.dsoDetails)||void 0===t?void 0:t.status)||"NA"}}];case"VEHICLE":return[{Header:E("ES_FSM_REGISTRY_INBOX_VEHICLE_NAME"),exportAccessor:e=>(null==e?void 0:e.registrationNumber)||"NA"},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_VEHICLE_CREATION"),exportAccessor:e=>{var t,l;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime):""}},{Header:"Map Vendor",exportAccessor:e=>{var t,l,n,a,i,o,r,s;return`${(null==e||null===(t=e.vendor)||void 0===t?void 0:t.name)||(null==e||null===(l=e.vendorData)||void 0===l?void 0:l.name)||"NA"} (${(null==e||null===(n=e.vendor)||void 0===n?void 0:n.mobileNumber)||(null==e||null===(a=e.vendor)||void 0===a||null===(i=a.owner)||void 0===i?void 0:i.mobileNumber)||(null==e||null===(o=e.vendorData)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(r=e.vendorData)||void 0===r||null===(s=r.owner)||void 0===s?void 0:s.mobileNumber)||"NA"})`}},{Header:E("ES_VENDOR_INBOX_SERVICE_TYPE"),exportAccessor:e=>{var t;return(null===(t=y(null==e?void 0:e.additionalDetails))||void 0===t?void 0:t.serviceType)||"N/A"}},{Header:E("WT_FILLING_POINT"),exportAccessor:e=>C(e)},{Header:E("ES_FSM_REGISTRY_SELECT_DRIVER"),exportAccessor:e=>{var t,l,n,a,i,o;return`${(null==e||null===(t=e.driverData)||void 0===t?void 0:t.name)||(null==e||null===(l=e.driver)||void 0===l?void 0:l.name)||"NA"} (${(null==e||null===(n=e.driverData)||void 0===n||null===(a=n.owner)||void 0===a?void 0:a.mobileNumber)||(null==e||null===(i=e.driver)||void 0===i||null===(o=i.owner)||void 0===o?void 0:o.mobileNumber)||"NA"})`}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];case"DRIVER":return[{Header:E("ES_FSM_REGISTRY_INBOX_USERNAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"}},{Header:E("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),exportAccessor:e=>{var t;return`${(null==e?void 0:e.name)||"NA"} (${(null==e||null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"NA"})`}},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),exportAccessor:e=>{var t,l;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime):""}},{Header:E("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,l,n,a,i,o,r,s;return`${(null==e||null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null==e||null===(l=e.vendor)||void 0===l?void 0:l.name)||"NA"} (${(null==e||null===(n=e.vendorData)||void 0===n?void 0:n.mobileNumber)||(null==e||null===(a=e.vendorData)||void 0===a||null===(i=a.owner)||void 0===i?void 0:i.mobileNumber)||(null==e||null===(o=e.vendor)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(r=e.vendor)||void 0===r||null===(s=r.owner)||void 0===s?void 0:s.mobileNumber)||"NA"})`}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];case"SURVEYOR":return[{Header:E("ES_FSM_REGISTRY_INBOX_USERNAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"}},{Header:E("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),exportAccessor:e=>{var t;return`${(null==e?void 0:e.name)||"NA"} (${(null==e||null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"NA"})`}},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),exportAccessor:e=>{var t,l;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime):""}},{Header:E("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,l,n,a,i,o,r,s;return`${(null==e||null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null==e||null===(l=e.vendor)||void 0===l?void 0:l.name)||"NA"} ${(null==e||null===(n=e.vendorData)||void 0===n?void 0:n.mobileNumber)||(null==e||null===(a=e.vendorData)||void 0===a||null===(i=a.owner)||void 0===i?void 0:i.mobileNumber)||(null==e||null===(o=e.vendor)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(r=e.vendor)||void 0===r||null===(s=r.owner)||void 0===s?void 0:s.mobileNumber)||"NA"}`}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];case"SUPERVISOR":return[{Header:E("ES_FSM_REGISTRY_INBOX_USERNAME"),exportAccessor:e=>{var t;return(null==e||null===(t=e.owner)||void 0===t?void 0:t.userName)||"NA"}},{Header:E("ES_FSM_REGISTRY_INBOX_DRIVER_NAME"),exportAccessor:e=>{var t;return`${(null==e?void 0:e.name)||"NA"} (${(null==e||null===(t=e.owner)||void 0===t?void 0:t.mobileNumber)||"NA"})`}},{Header:E("ES_FSM_REGISTRY_INBOX_DATE_DRIVER_CREATION"),exportAccessor:e=>{var t,l;return null!=e&&null!==(t=e.auditDetails)&&void 0!==t&&t.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(l=e.auditDetails)||void 0===l?void 0:l.createdTime):""}},{Header:E("ES_FSM_REGISTRY_INBOX_VENDOR_NAME"),exportAccessor:e=>{var t,l,n,a,i,o,r,s;return`${(null==e||null===(t=e.vendorData)||void 0===t?void 0:t.name)||(null==e||null===(l=e.vendor)||void 0===l?void 0:l.name)||"NA"} ${(null==e||null===(n=e.vendorData)||void 0===n?void 0:n.mobileNumber)||(null==e||null===(a=e.vendorData)||void 0===a||null===(i=a.owner)||void 0===i?void 0:i.mobileNumber)||(null==e||null===(o=e.vendor)||void 0===o?void 0:o.mobileNumber)||(null==e||null===(r=e.vendor)||void 0===r||null===(s=r.owner)||void 0===s?void 0:s.mobileNumber)||"NA"}`}},{Header:E("ES_FSM_REGISTRY_INBOX_ENABLED"),exportAccessor:e=>(null==e?void 0:e.status)||"NA"}];default:return[]}},[e.selectedTab,E]),ue=l.useCallback(function(){return Promise.resolve(D)},[D]);let ce;if(e.isLoading||re)ce=l.createElement("div",{style:{zIndex:10,position:"relative",padding:"10px",backgroundColor:"#fff",width:"75px",height:"75px",borderRadius:"12px",display:"flex",justifyContent:"center",alignItems:"center",margin:"auto"}},l.createElement(a.Loader,null));else if(0===D.length){let t="",n="";"VENDOR"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_VENDOR",n="ES_FSM_REGISTRY_EMPTY_BUTTON_VENDOR"):"VEHICLE"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_VEHICLE",n="ES_FSM_REGISTRY_EMPTY_BUTTON_VEHICLE"):"SUPERVISOR"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_SUPERVISOR",n="ES_FSM_REGISTRY_EMPTY_BUTTON_SUPERVISOR"):"SURVEYOR"===e.selectedTab?(t="ES_FSM_REGISTRY_EMPTY_CARD_SURVEYOR",n="ES_FSM_REGISTRY_EMPTY_BUTTON_SURVEYOR"):(t="ES_FSM_REGISTRY_EMPTY_CARD_DRIVER",n="ES_FSM_REGISTRY_EMPTY_BUTTON_DRIVER"),ce=l.createElement(a.Card,{className:"flex-center flex-box"},l.createElement("div",{style:{marginTop:"50px",marginBottom:"25px"}},E(t)),l.createElement(a.SubmitBar,{className:"",label:E(n),onSubmit:ne}))}else D.length>0&&(ce=l.createElement(S,{className:"table registryTable",t:E,data:D,columns:se,getCellProps:()=>({style:{padding:"8px 12px",fontSize:"13.5px"}}),onPageSizeChange:e.onPageSizeChange,currentPage:e.currentPage,onNextPage:e.onNextPage,onPrevPage:e.onPrevPage,pageSizeLimit:e.pageSizeLimit,onSort:e.onSort,disableSort:e.disableSort,sortParams:e.sortParams,totalRecords:e.totalRecords,showCSVExport:!0,getCSVExportData:ue,csvExportColumns:de,csvExportFileName:`vendor-${String(e.selectedTab||"registry").toLowerCase()}-inbox`}));const Ee=U.map(e=>e.code),me={ekyc:Object.values({ekycVendor:"EKYC-VENDOR",supervisor:"EKYC_SUPERVISOR"}).filter(e=>Ee.includes(e)),wt:Object.values({wtVendor:"WT_VENDOR"}).filter(e=>Ee.includes(e))};return me.ekyc.push("EKYC-VENDOR"),l.createElement("div",{className:"inbox-container"},"FSM_EMP_FSTPO"!==e.userRole&&"FSM_ADMIN"!==e.userRole&&!e.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(v,{parentRoute:e.parentRoute}),l.createElement("div",{style:{marginTop:"24px"}},l.createElement(R,{searchParams:e.searchParams,paginationParms:e.paginationParms,applications:e.data,onFilterChange:e.onFilterChange,type:"desktop"}))),l.createElement("div",{style:{flex:1,width:"100%",marginLeft:"FSM_ADMIN"===e.userRole?"":"24px"}},l.createElement(g,{onSearch:e.onSearch,type:"desktop",searchFields:e.searchFields,isInboxPage:!(null!=e&&e.isSearch),searchParams:e.searchParams,onTabChange:e.onTabChange,selectedTab:e.selectedTab,matchedRoles:me}),l.createElement("div",{className:"result",style:{marginLeft:_||"FSM_ADMIN"===e.userRole||null!=e&&e.isSearch?"":"24px",flex:1}},ce)),T&&l.createElement(a.Toast,{error:"error"===T.key,label:E(T.label?T.label:"success"===T.key?`ES_FSM_REGISTRY_${T.action}_DISABLE_SUCCESS`:T.action),onClose:J}),P&&l.createElement(a.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m",style:{margin:0}},E("ES_VENDOR_WORKORDER_DETAILS_MODAL")),headerBarEnd:l.createElement("div",{className:"icon-bg-secondary",onClick:G,style:{cursor:"pointer"}},l.createElement(a.MdClose,null)),actionCancelLabel:E("CS_COMMON_CLOSE"),actionCancelOnSubmit:G,hideSubmit:!0,formId:"modal-action"},l.createElement("div",{style:{padding:"16px"}},(null==x||null===(s=x.dsoDetails)||void 0===s||null===(d=s.vendorWorkOrder)||void 0===d?void 0:d.length)>0?l.createElement(a.Table,{t:E,data:x.dsoDetails.vendorWorkOrder,columns:K,getCellProps:e=>({style:{minWidth:"150px",padding:"8px 12px",fontSize:"13.5px"}})}):l.createElement("p",{style:{textAlign:"center",marginTop:"20px"}},E("ES_VENDOR_NO_WORKORDERS")))))},M=()=>{const{t:e}=i.useTranslation(),t=n.useLocation(),{path:o}=n.useRouteMatch(),r=Digit.ComponentRegistryService.getComponent("SearchVendor"),d=Digit.ComponentRegistryService.getComponent("EditVendorDetails"),u=Digit.ComponentRegistryService.getComponent("AddSupervisor"),c=Digit.ComponentRegistryService.getComponent("SupervisorDetails"),E=Digit.ComponentRegistryService.getComponent("AddSurveyor"),m=Digit.ComponentRegistryService.getComponent("SurveyorDetails"),v=Digit.ComponentRegistryService.getComponent("VENDORCreate");return l.createElement(n.Switch,null,l.createElement(a.AppContainer,null,l.createElement("div",{className:"ground-container employee-app-container form-container"},l.createElement(a.ModuleHeader,{leftContent:l.createElement(l.Fragment,null,l.createElement(a.ArrowLeft,{className:"icon"}),e("CS_COMMON_BACK")),onLeftClick:()=>window.history.back(),breadcrumbs:(()=>{const l=t.pathname;let n=[{icon:a.HomeIcon,path:"/digit-ui/citizen"},{label:e("WT_MODULE_NAME"),path:o+"/wt-Vendor"}];if(l.includes("/inbox")){let t="ES_COMMON_INBOX";l.includes("/mt/inbox")&&(n=[{icon:a.HomeIcon,path:"/digit-ui/citizen"},{label:e("ACTION_TEST_MT"),path:o+"/mt-Vendor"}]),n.push({label:e(t)})}else if(l.includes("/my-bookings")){let t="WT_SEARCH_BOOKINGS";l.includes("/mt/my-bookings")&&(t="MT_SEARCH_BOOKINGS"),n.push({label:e(t)})}else l.includes("/status")?n.push({label:e("WT_MY_APPLICATIONS")}):(l.includes("/booking/")||l.includes("/booking-details")||l.includes("/bookingsearch/booking-details"))&&(n.push({label:e("ES_COMMON_INBOX"),path:l.includes("/mt/")?o+"/mt/inbox":o+"/inbox"}),n.push({label:e("WT_BOOKING_DETAILS")}));const i=[{match:"/registry/new-vendor",label:"ES_FSM_REGISTRY_TITLE_NEW_VENDOR"},{match:"/search-vendor",label:"SEARCH_VENDOR"},{match:"/registry/new-driver",label:"ES_FSM_REGISTRY_TITLE_NEW_DRIVER"},{match:["/registry/vendor-details","/registry/modify-vendor/"],label:"VENDOR_VENDOR_DETAILS"},{match:["/registry/vehicle-details","/registry/modify-vehicle/"],label:"VENDOR_VEHICLE_DETAILS"},{match:"/registry/new-vehicle",label:"ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"},{match:["/registry/driver-details","/registry/modify-driver/"],label:"VENDOR_DRIVER_DETAILS"},{match:"/registry/additionaldetails",label:"VENDOR_ADDITIONAL_DETAILS"},{match:"/registry/new-supervisor",label:"ES_FSM_REGISTRY_TITLE_NEW_SUPERVISOR"},{match:["/registry/supervisor-details","/registry/modify-supervisor/"],label:"VENDOR_SUPERVISOR_DETAILS"},{match:"/registry/new-surveyor",label:"ES_FSM_REGISTRY_TITLE_NEW_SURVEYOR"},{match:["/registry/surveyor-details","/registry/modify-surveyor/"],label:"VENDOR_SURVEYOR_DETAILS"}].find(e=>{let{match:t}=e;return Array.isArray(t)?t.some(e=>l.includes(e)):l.includes(t)});return i&&n.push({label:e(i.label)}),n})()}),l.createElement(a.PrivateRoute,{path:o+"/search-vendor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"normal"},l.createElement(r,s({},e,{parentRoute:o}))),exact:!0}),l.createElement(a.PrivateRoute,{path:o+"/registry/vendor-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(d,s({},e,{parentRoute:o})))}),l.createElement(a.PrivateRoute,{path:o+"/registry/new-supervisor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(u,s({},e,{parentRoute:o})))}),l.createElement(a.PrivateRoute,{path:o+"/registry/additionaldetails",component:e=>{const t=e.location.pathname.includes("/info");return l.createElement(a.LayoutWrapper,{layoutClass:t?"action":"normal"},l.createElement(v,s({},e,{parentRoute:o})))}}),l.createElement(a.PrivateRoute,{path:o+"/registry/supervisor-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(c,s({},e,{parentRoute:o})))}),l.createElement(a.PrivateRoute,{path:o+"/registry/new-surveyor",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(E,s({},e,{parentRoute:o})))}),l.createElement(a.PrivateRoute,{path:o+"/registry/surveyor-details/:id",component:e=>l.createElement(a.LayoutWrapper,{layoutClass:"action"},l.createElement(m,s({},e,{parentRoute:o})))}),l.createElement(a.PrivateRoute,{path:""+o,component:()=>Digit.UserService.hasAccess(["WT_VENDOR"])?l.createElement("div",{style:{display:"flex",gap:"24px",flexWrap:"wrap",width:"100%",padding:"8px 0"}},l.createElement(a.CitizenHomeCard,{header:e("TITLE_VENDOR_MANAGEMENT"),links:[{i18nKey:e("SEARCH_VENDOR"),link:"/digit-ui/citizen/vendor/search-vendor"}],Icon:()=>l.createElement(a.PropertyHouse,{className:"fill-path-primary-main"})})):l.createElement(n.Redirect,{to:{pathname:"/digit-ui/citizen/login",state:{from:o+"/wt-Vendor",role:"WT_VENDOR"}}}),exact:!0}))))},L=e=>{let{t:t,title:n}=e;return l.createElement("div",{className:"confirmation_box"},l.createElement("span",null,t(""+n)," "))},w=e=>l.createElement("h1",{className:"heading-m"},e.label),k=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(k,null)),{Dropdown:F}=(require("@djb25/digit-ui-react-components"),require("@djb25/digit-ui-react-components")),{Dropdown:x}=require("@djb25/digit-ui-react-components"),H=e=>l.createElement("h1",{className:"heading-m"},e.label),B=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),U=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(B,null)),Y=e=>l.createElement("h1",{className:"heading-m"},e.label),G=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),K=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(G,null)),W=e=>{let{jumpTo:t}=e;const{t:o}=i.useTranslation(),r=n.useHistory();return l.createElement(a.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(t)}})},$=e=>{const{t:t}=i.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_VENDOR_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_VENDOR_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_VENDOR_APPLICATION_FAILED")},z={padding:"4px 0px",justifyContent:"space-between"},X=e=>{var t,n;return l.createElement(a.Banner,{message:$(e),applicationNumber:null===(t=e.data)||void 0===t||null===(n=t.VendorAdditionalDetails)||void 0===n?void 0:n[0].registrationNo,info:e.isSuccess?e.t("ES_VENDOR_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},q=[{head:"VENDOR_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"vendor-details",key:"Documents"},{route:"vendor-details",component:"VendorDetails",withoutLabel:!0,key:"vendordet",type:"component",nextStep:"documents",hideInEmployee:!0,isMandatory:!0,texts:{header:"VENDOR_ADDITIONAL_DETAILS",submitBarLabel:"VENDOR_COMMON_NEXT"}}]},{head:"VENDOR_DOCUMENT_DETAILS",body:[{route:"documents",component:"VendorDocuments",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"VENDOR_DOCUMENTS_DETAILS",submitBarLabel:"VENDOR_COMMON_NEXT"}}]}],{DatePicker:j}=require("@djb25/digit-ui-react-components"),Q=e=>l.createElement("h1",{className:"heading-m"},e.label),Z=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),J=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Z,null)),{DatePicker:ee}=require("@djb25/digit-ui-react-components"),te=e=>l.createElement("h1",{className:"heading-m"},e.label),le=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),ne=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(le,null)),ae={VendorDetails:e=>{var n,i,r,s;let{t:d,config:u,onSelect:c,userType:E,formData:m}=e;const v=Digit.UserService.getUser().info,S=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].applicantName||(null==m||null===(n=m.ownerKey)||void 0===n?void 0:n.applicantName)||"",p=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].emailId||(null==m||null===(i=m.ownerKey)||void 0===i?void 0:i.emailId)||"",_=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].mobileNumber||(null==m||null===(r=m.ownerKey)||void 0===r?void 0:r.mobileNumber)||(null==v?void 0:v.mobileNumber),D=m.ownerKey&&m.ownerKey[0]&&m.ownerKey[0].altMobileNumber||(null==m||null===(s=m.ownerKey)||void 0===s?void 0:s.altmobileNumber)||"",[R,N]=t.useState(""),[g,y]=t.useState(""),[T,I]=t.useState(""),[C,O]=t.useState(""),[A,f]=t.useState(),[b,h]=t.useState(""),[V,M]=t.useState(""),[L,w]=t.useState(""),[k,P]=t.useState(""),[F,x]=t.useState(""),[H,B]=t.useState(""),[U,Y]=t.useState(""),[G,K]=t.useState(""),[W,$]=t.useState(""),[z,X]=t.useState(""),[q,j]=t.useState(""),[Q,Z]=t.useState(""),[J,ee]=t.useState("");t.useEffect(()=>{11!==b.length||C||A||q?11===b.length&&C&&A?(O(C),f(A),j(q)):(O(""),f(""),j("")):fetch("https://ifsc.razorpay.com/"+b).then(e=>e.json()).then(e=>{e&&e.BANK&&e.BRANCH&&e.MICR&&(O(e.BANK),f(e.BRANCH),j(e.MICR))}).catch(()=>{})},[b]);const te=Digit.ULBService.getCurrentTenantId(),{control:le}=o.useForm(),{data:ne}=Digit.Hooks.fsm.useDsoSearch(te,{staleTime:Infinity});t.useEffect(()=>{if(ne){const e=ne.find(e=>e.id);e&&(I(e.name),y(e.id))}},[ne]);const ae=()=>{let e,t=m.ownerKey&&m.ownerKey[0];"citizen"===E?(e={...t,applicantName:S,mobileNumber:_,altMobileNumber:D,emailId:p},c(u.key,{...m[u.key],...e},!1,0)):(e={...t,VendorCategory:R,name:T,VendorId:g,Bank:C,BankbranchName:A,IFSC:b,AccountNo:V,PanNo:L,GstNo:k,GstState:F,RegistrationNo:H,EpfNo:U,EsiNo:G,VendorType:W,Status:z,micrNo:q,PhoneNo:Q,ContactPerson:J},c(u.key,e,!1,0))};return t.useEffect(()=>{"citizen"===E&&ae()},[R,g,T,C,A,b,V,L,k,F,H,U,G,W,z,q,Q,J,E]),l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{timeLine:[{actions:d("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:d("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:d("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(a.FormStep,{config:u,onSelect:ae,t:d,className:"formcomposer-grid-container-form"},l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},l.createElement(a.CustomTooltip,{label:""+d("IFSC_CODE"),isMandatory:!1,message:d("INVALID_IFSC_CODE_ERROR_MESSAGE")})),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"IFSC",value:b,placeholder:"Enter IFSC Code",onChange:function(e){const t=e.target.value.replace(/[^a-zA-Z0-9]/g,"");t.length<=11&&h(t)},style:{width:"100%"},maxLength:11,ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[A-Z]{4}0[A-Z0-9]{6}$",type:"text",title:d("INVALID_IFSC_CODE_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("VENDOR_BANK_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bankName",placeholder:"Bank Name Auto Select",style:{width:"100%"},value:C,onChange:function(e){O(e.target.value)},disabled:!0})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("VENDOR_BANK_BRANCH_NAME")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BankbranchName",value:A,style:{width:"100%"},placeholder:"Bank Branch Name Auto Select",onChange:function(e){f(e.target.value)},disabled:!1})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("VENDOR_MICR_NO")," ",l.createElement("span",{className:"check-page-link-button"},"*")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"MicrNo",value:q,style:{width:"100%"},placeholder:"MICR No",onChange:j,disabled:!1})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("ACCOUNT_NO")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AccountNo",value:V,onChange:function(e){M(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"[0-9]{9,18}",type:"text",title:d("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("PHONE_NO")),l.createElement(a.MobileNumber,{value:Q,name:"PhoneNo",onChange:Z,style:{width:"100%"}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("CONTACT_PERSON")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"ContactPerson",value:J,onChange:function(e){ee(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:d("INVALID_ACCOUNT_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("PAN_NO")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"PanNo",value:L,onChange:function(e){w(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"[A-Z]{5}[0-9]{4}[A-Z]{1}",type:"text",title:d("INVALID_PAN_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("GST_NO")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstNo",value:k,onChange:function(e){P(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$",type:"text",title:d("INVALID_GST_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("GST_REGISTERED_STATE/UT")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"GstState",value:F,onChange:function(e){x(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("REGISTRATION_NO")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"RegistrationNo",value:H,onChange:function(e){B(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:d("INVALID_REGISTRATION_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("EPF_NO")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EpfNo",value:U,onChange:function(e){Y(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,15}$",type:"text",title:d("INVALID_EPF_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,""+d("ESI_NO")),l.createElement(a.TextInput,{t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"EsiNo",value:G,onChange:function(e){K(e.target.value)},style:{width:"100%"},ValidationRequired:!0,validation:{isRequired:!0,pattern:"^[a-zA-Z0-9/-]{1,20}$",type:"text",title:d("INVALID_ESI_NO_ERROR_MESSAGE")}})),l.createElement(a.LabelFieldPair,null,l.createElement("div",null,d("VENDOR_TYPE"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+d("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:le,name:"VendorType",defaultValue:W,rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(a.Dropdown,{selected:W,select:$,option:[{i18nKey:"Supplier",code:"SUPPLIER"},{i18nKey:"Contractor",code:"CONTRACTOR"}],optionKey:"i18nKey",placeholder:"Select",t:d})})),l.createElement(a.LabelFieldPair,null,l.createElement("div",null,d("VENOR_CATEGORY"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}}))),l.createElement(o.Controller,{control:le,name:"VendorCategory",defaultValue:R,rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(a.Dropdown,{selected:R,select:N,option:[{i18nKey:"Firm",code:"FIRM"},{i18nKey:"Individual",code:"Individual"}],optionKey:"i18nKey",placeholder:"Select",t:d})})),l.createElement(a.LabelFieldPair,null,l.createElement("div",null,d("STATUS"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+d("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:le,name:"Status",defaultValue:z,rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(a.Dropdown,{selected:z,select:X,option:[{i18nKey:"Active",code:"ACTIVE"},{i18nKey:"Inactive",code:"INACTIVE"}],optionKey:"i18nKey",placeholder:"Select",t:d})})))))},VendorDocuments:e=>{var n;let{t:i,config:o,onSelect:r,formData:s}=e;const[d,c]=t.useState([null]),[E,m]=t.useState([null]),[v,S]=t.useState(null),[p,_]=t.useState(1),[D,R]=(Digit.ULBService.getStateId(),Digit.ULBService.getStateId(),t.useState((null==s||null===(n=s.documents)||void 0===n?void 0:n.documents)||[]));return t.useEffect(()=>{var e;null!=s&&null!==(e=s.documents)&&void 0!==e&&e.documents&&(m(s.documents.documents),_(s.documents.documents.length),c(new Array(s.documents.documents.length).fill(null)))},[s]),l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{timeLine:[{actions:i("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:i("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:i("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:1,showFinalStep:!1}),l.createElement(a.FormStep,{t:i,config:o,onSelect:()=>{let e;e={...s.documents,documents:E.filter(e=>null!==e)},r(o.key,e)},onSkip:()=>r(),isDisabled:E.some(e=>null===e)&&d.some(e=>null===e)},d.map((e,t)=>l.createElement(a.LabelFieldPair,{key:t},l.createElement(a.CardLabel,{className:"card-label-smaller"},i("VENDOR_ID")+(0!==t?t:"")),l.createElement("div",{className:"field",style:{display:"flex",alignItems:"center",paddingBottom:"10px"}},l.createElement(a.UploadFile,{onUpload:e=>((e,t)=>{const l=e.target.files[0];c(e=>{const n=[...e];return n[t]=l,n}),function(e,t){try{const l=function(){if(e.size>=5242880)S(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const l=u(function(){return Promise.resolve(Digit.UploadServices.Filestorage("EWASTE",e,Digit.ULBService.getStateId())).then(function(e){var l,n;if((null==e||null===(l=e.data)||void 0===l||null===(n=l.files)||void 0===n?void 0:n.length)>0){const l=e.data.files[0].fileStoreId;m(e=>{const n=[...e];return n[t]={filestoreId:l,documentuuid:l,documentType:"Photo"+(t+1)},n})}else S(i("CS_FILE_UPLOAD_ERROR"))})},function(){S(i("CS_FILE_UPLOAD_ERROR"))});if(l&&l.then)return l.then(function(){})}}();Promise.resolve(l&&l.then?l.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(l,t)})(e,t),onDelete:()=>m(e=>{const l=[...e];return l[t]=null,l}),id:"file-upload-"+t,message:E[t]?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!E[t]})))),v&&l.createElement(a.Toast,{label:v,onClose:()=>S(null),error:!0})))},ServiceDoc:e=>{var t;let{t:n,config:i,onSelect:o}=e;const r=Digit.ULBService.getStateId(),s=null!=i&&i.isMutation?["MutationDocuments"]:"Documents",{isLoading:d,data:u={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let c=null==u||null===(t=u.ASSET)||void 0===t?void 0:t.Documents;return l.createElement("div",{className:"employee-form-content"},d&&l.createElement(a.Loader,null),Array.isArray(c)&&c.map((e,t)=>{let{code:i,dropdownData:o}=e;return l.createElement(a.Card,{key:t},l.createElement("div",null,l.createElement("h3",{style:{margin:0}},t+1,". ",n(E(i,".","_")))),o.map((e,t)=>l.createElement("div",{key:t,style:{paddingLeft:"10px",marginBottom:"6px",fontSize:"14px"}},t+1,". ",n(E(null==e?void 0:e.code,".","_")))))}),l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{label:n("COMMON_NEXT"),onSubmit:o})))},AddVendor:e=>{const o=Digit.ULBService.getCurrentTenantId(),r=Digit.ULBService.getStateId(),{t:s}=i.useTranslation(),d=n.useHistory(),[u,c]=t.useState(1),[E,m]=t.useState(null),[v,S]=t.useState(!1),[,p]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,_]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,D]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:R}=Digit.Hooks.fsm.useVendorCreate(o);t.useEffect(()=>{p(!1),D(),_()},[]);const N=function(e,t){return void 0===t&&(t=!1),[{head:"ES_VRNDOR_NEW_VENDOR_DETAILS",body:[{label:"ES_FSM_REGISTRY_NEW_VENDOR_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"vendorName",validation:{required:!0,pattern:/^[A-Za-z\s.,/]+$/},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_VENDOR_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},labelStyle:{border:"1px solid black",borderRight:"none"},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",key:"serviceType",component:"SelectServiceType",disable:t,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{header:"CS_COMMON_CHOOSE_SERVICE_TYPE",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS",body:[{label:"HOUSE_NO",isMandatory:!1,type:"text",key:"doorNo",populators:{name:"doorNo",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_PLOT",isMandatory:!1,type:"text",key:"plotNo",populators:{name:"plotNo",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_BUILDING_NAME",isMandatory:!1,type:"text",key:"buildingName",populators:{name:"buildingName",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_STREET",isMandatory:!1,type:"text",key:"street",populators:{name:"street",defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_NEW_PINCODE",isMandatory:!1,type:"text",key:"pincode",populators:{name:"pincode",validation:{required:!1,pattern:/^[1-9][0-9]{5}$/},error:e("FSM_REGISTRY_INVALID_PINCODE"),defaultValue:"",className:"payment-form-text-input-correction"}},{route:"address",component:"VendorSelectAddress",withoutLabel:!0,texts:{headerCaption:"CS_FILE_APPLICATION_PROPERTY_LOCATION_LABEL",header:"CS_FILE_APPLICATION_PROPERTY_LOCATION_ADDRESS_TEXT",cardText:"CS_FILE_APPLICATION_PROPERTY_LOCATION_CITY_MOHALLA_TEXT",submitBarLabel:"CS_COMMON_NEXT"},key:"address",isMandatory:!0,type:"component"},{label:"ES_FSM_REGISTRY_NEW_LANDMARK",isMandatory:!1,type:"text",key:"landmark",populators:{name:"landmark",defaultValue:"",className:"payment-form-text-input-correction"}}]}]}(s),g=()=>{m(null)};return l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:"New Vendor Details",currentStep:1}]},{route:"address-details",timeLine:[{actions:"Address Details",currentStep:2}]}],currentActiveIndex:u-1,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(a.FormComposer,{label:s("ES_COMMON_APPLICATION_SUBMIT"),config:N.filter(e=>!e.hideInEmployee).map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0,body:e.body.filter(e=>!e.hideInEmployee)})),onSubmit:e=>{var t,l,n,a,i,s,u,c,E,v,S,p,_,D,N,y,T,I,C,O,A,f;const b=e,h=null==b?void 0:b.vendorName,V=null==b?void 0:b.pincode,M=null==b||null===(t=b.street)||void 0===t?void 0:t.trim(),L=null==b||null===(l=b.doorNo)||void 0===l?void 0:l.trim(),w=null==b||null===(n=b.plotNo)||void 0===n?void 0:n.trim(),k=null==b||null===(a=b.landmark)||void 0===a?void 0:a.trim(),P=null==b||null===(i=b.address)||void 0===i||null===(s=i.city)||void 0===s?void 0:s.name,F=null==b||null===(u=b.address)||void 0===u||null===(c=u.city)||void 0===c?void 0:c.state,x=null==b||null===(E=b.address)||void 0===E||null===(v=E.city)||void 0===v?void 0:v.name,H=null==b||null===(S=b.address)||void 0===S||null===(p=S.city)||void 0===p?void 0:p.name,B=null==b||null===(_=b.buildingName)||void 0===_?void 0:_.trim(),U=null==b||null===(D=b.address)||void 0===D||null===(N=D.locality)||void 0===N?void 0:N.code,Y=null==b||null===(y=b.address)||void 0===y||null===(T=y.locality)||void 0===T?void 0:T.name,G=null==b||null===(I=b.address)||void 0===I||null===(C=I.locality)||void 0===C?void 0:C.area,K=null==b||null===(O=b.serviceType)||void 0===O?void 0:O.code,W={vendor:{tenantId:o,name:h,agencyType:"ULB",paymentPreference:"post-service",address:{tenantId:o,landmark:k,doorNo:L,plotNo:w,street:M,city:P,district:x,region:H,state:F,country:"in",pincode:V,buildingName:B,locality:{code:U||"",name:Y||"",label:"Locality",area:G||""},geoLocation:{latitude:(null==b||null===(A=b.address)||void 0===A?void 0:A.latitude)||0,longitude:(null==b||null===(f=b.address)||void 0===f?void 0:f.longitude)||0}},owner:{tenantId:r,name:h,fatherOrHusbandName:h,relationship:"OTHER",gender:"MALE",dob:"915148800",emailId:(null==b?void 0:b.emailId)||"abc@egov.com",mobileNumber:null==b?void 0:b.phone},additionalDetails:{serviceType:K},vehicle:[],drivers:[],source:"WhatsApp"}};R(W,{onError:e=>{m({key:"error",action:e}),setTimeout(g,5e3)},onSuccess:(e,t)=>{m({key:"success",action:"ADD_VENDOR"}),setTimeout(()=>{g(),d.push("/digit-ui/employee/vendor/search-vendor")},2e3)}})},defaultValues:{serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var l,n,a;const i=(null==t?void 0:t.vendorName)&&(null==t?void 0:t.phone)&&(null==t||null===(l=t.serviceType)||void 0===l?void 0:l.code),o=(null==t||null===(n=t.address)||void 0===n?void 0:n.city)&&(null==t||null===(a=t.address)||void 0===a?void 0:a.locality);S(!(!i||!o)),i?1===u&&(c(2),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(s("ES_FSM_REGISTRY_NEW_ADDRESS_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100)):2===u&&(c(1),setTimeout(()=>{const e=Array.from(document.querySelectorAll(".collapsible-card-title")).find(e=>e.textContent.includes(s("ES_VRNDOR_NEW_VENDOR_DETAILS")));e&&e.scrollIntoView({behavior:"smooth",block:"start"})},100))},noBreakLine:!0,noCard:!0,isDisabled:!v}),E&&l.createElement(a.Toast,{error:"error"===E.key,label:s("success"===E.key?`ES_FSM_REGISTRY_${E.action}_SUCCESS`:E.action),onClose:g})))},VendorSelectAddress:e=>{var n,i,o;let{t:r,config:s,onSelect:d,userType:u,formData:c}=e;const E=Digit.Hooks.vendor.useTenants();let m=Digit.ULBService.getCurrentTenantId();const{pincode:v}=(null==c?void 0:c.address)||"",S="employee"===u?E.filter(e=>e.code===m):v?E.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==v)}):E;let p=null===(n=sessionStorage)||void 0===n?void 0:n.getItem("Digit_FSM_PT");var _;"undefined"!==p&&(p=JSON.parse(null===(_=sessionStorage)||void 0===_?void 0:_.getItem("Digit_FSM_PT")));let D={};p&&(D=S.filter(e=>{var t,l,n;return e.code==(null===(t=p)||void 0===t||null===(l=t.propertyDetails)||void 0===l||null===(n=l.address)||void 0===n?void 0:n.tenantId)}));const[R,N]=t.useState(()=>{var e,t;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||(null===(t=D)||void 0===t?void 0:t[0])||null}),{data:g}=Digit.Hooks.useBoundaryLocalities(null==R?void 0:R.code,"revenue",{enabled:!!R},r),[y,T]=t.useState(),[I,C]=t.useState(()=>{var e,t,l,n,a,i,o;return(null===(e=p)||void 0===e||null===(t=e.propertyDetails)||void 0===t||null===(l=t.address)||void 0===l?void 0:l.locality)||(null==c||null===(n=c.cpt)||void 0===n||null===(a=n.details)||void 0===a||null===(i=a.address)||void 0===i?void 0:i.locality)||(null==c||null===(o=c.address)||void 0===o?void 0:o.locality)});function O(e){C(null),T(null),Digit.SessionStorage.set("fsm.file.address.city",e),N(e)}function A(e){C(e),"employee"===u&&d(s.key,{...c[s.key],locality:e})}return t.useEffect(()=>{S&&1===S.length&&N(S[0])},[S]),t.useEffect(()=>{if(R&&g){var e,t,l,n,a,i,o,r;let _=g,D=[];if(null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality)C(c.address.locality);else if(null!=c&&null!==(t=c.cpt)&&void 0!==t&&null!==(l=t.details)&&void 0!==l&&null!==(n=l.address)&&void 0!==n&&n.locality)C(c.cpt.details.address.locality);else if(null!==(a=p)&&void 0!==a&&null!==(i=a.propertyDetails)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.locality){var E,m,v;C(null===(E=p)||void 0===E||null===(m=E.propertyDetails)||void 0===m||null===(v=m.address)||void 0===v?void 0:v.locality)}var S;null!=c&&null!==(r=c.address)&&void 0!==r&&r.pincode&&(D=_.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==c.address.pincode)}),null!=c&&null!==(S=c.address)&&void 0!==S&&S.locality||C()),"employee"===u&&d(s.key,{...c[s.key],city:R}),T(()=>D.length>0?D:_),1===D.length&&(C(D[0]),"employee"===u&&d(s.key,{...c[s.key],locality:D[0]}))}},[R,null==c||null===(i=c.cpt)||void 0===i||null===(o=i.details)||void 0===o?void 0:o.address,g]),"employee"===u?l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,r("MYCITY_CODE_LABEL"),s.isMandatory?" * ":null),l.createElement(a.Dropdown,{className:"",isMandatory:!0,selected:1===(null==S?void 0:S.length)?S[0]:R,disable:1===(null==S?void 0:S.length),option:S,select:O,optionKey:"code",t:r})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,r("ES_NEW_APPLICATION_LOCATION_MOHALLA"),s.isMandatory?" * ":null),l.createElement(a.Dropdown,{className:"",isMandatory:!0,selected:I,option:y,select:A,optionKey:"name",t:r}))):l.createElement(l.Fragment,null,l.createElement(a.FormStep,{config:s,onSelect:function(){d(s.key,{city:R,locality:I})},t:r,isDisabled:!I},l.createElement(a.CardLabel,null,r("MYCITY_CODE_LABEL")+" *"),l.createElement(a.RadioOrSelect,{options:S,selectedOption:R,optionKey:"i18nKey",onSelect:O,t:r}),R&&y&&l.createElement(a.CardLabel,null,r("CS_CREATECOMPLAINT_MOHALLA")+" *"),R&&y&&l.createElement(a.RadioOrSelect,{isMandatory:s.isMandatory,options:y,selectedOption:I,optionKey:"name",onSelect:A,t:r})))},SearchApp:e=>{n.useParams();const{t:o}=i.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,d]=t.useState({}),[u,c]=t.useState(null),E={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:v,isSuccess:S,data:{EwasteApplication:p,Count:_}={}}=Digit.Hooks.ew.useEWSearch({tenantId:r,filters:s},E);return l.createElement(l.Fragment,null,l.createElement(m,{t:o,isLoading:v,tenantId:r,setShowToast:c,onSubmit:function(e){var t=new Date(null==e?void 0:e.fromDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())-19800);var l=new Date(null==e?void 0:e.toDate);null==l||l.setSeconds((null==l?void 0:l.getSeconds())+86399-19800);let n=Object.keys(data).filter(e=>data[e]).reduce((e,t)=>({...e,[t]:"object"==typeof data[t]?data[t].code:data[t]}),{});!(Object.entries(n).length>0)||n.requestId||n.creationReason||n.fromDate||n.mobileNumber||n.requestId||n.status||n.toDate?!(Object.entries(n).length>0&&(n.creationReason||n.status))||n.requestId||n.fromDate||n.mobileNumber||n.requestId||n.toDate?Object.entries(n).length>0&&n.fromDate&&!n.toDate||!n.fromDate&&n.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(n):c({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):c({warning:!0,label:"ERR_VENDOR_FILL_VALID_FIELDS"})},data:S&&!v?p.length>0?p:{display:"ES_COMMON_NO_DATA"}:"",count:_}),u&&l.createElement(a.Toast,{error:u.error,warning:u.warning,label:o(u.label),isDleteBtn:!0,onClose:()=>{c(null)}}))},SearchVendor:()=>{var e,n,a,o,r,s;const{t:d}=i.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),{selectedTabs:c}=Digit.Hooks.useQueryParams(),[E,m]=t.useState({}),[v,S]=t.useState([{id:"createdTime",desc:!0}]),[p,_]=t.useState(0),[D,R]=t.useState(10),[N,g]=t.useState(c||"VENDOR"),[y,T]=t.useState(""),[I,C]=t.useState(""),[O,A]=t.useState([]),{data:f}=Digit.Hooks.fsm.useDsoSearch(u,{status:"ACTIVE"},{staleTime:Infinity}),{data:b}=Digit.Hooks.wt.useFillPointSearch({tenantId:u,filters:{limit:1e3}},{staleTime:Infinity});let h={limit:D,offset:p,sortBy:null==v||null===(e=v[0])||void 0===e?void 0:e.id,sortOrder:null!=v&&null!==(n=v[0])&&void 0!==n&&n.desc?"DESC":"ASC"};const{data:M,isLoading:L,refetch:w}="VEHICLE"===N?Digit.Hooks.fsm.useVehiclesSearch({tenantId:u,filters:{...h,registrationNumber:null==E?void 0:E.registrationNumber,status:"ACTIVE,DISABLED",vendorId:null==E||null===(a=E.vendor)||void 0===a?void 0:a.id,fillingPointId:null==E||null===(o=E.fillingPoint)||void 0===o?void 0:o.id},config:{enabled:!1}}):"DRIVER"===N?Digit.Hooks.fsm.useDriverSearch({tenantId:u,filters:{...h,name:null==E?void 0:E.name,status:"ACTIVE,DISABLED",vendorId:null==E||null===(r=E.vendor)||void 0===r?void 0:r.id},config:{enabled:!1}}):"SUPERVISOR"===N?Digit.Hooks.fsm.useSupervisorDetails(u,{...h,status:"ACTIVE,DISABLED"},{enabled:!1}):"SURVEYOR"===N?Digit.Hooks.fsm.useSurveyorDetails(u,{...h,status:"ACTIVE,DISABLED"},{enabled:!1}):Digit.Hooks.fsm.useVendorSearch({tenantId:u,filters:{...h,name:null==E?void 0:E.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}});Digit.Hooks.fsm.useVendorSearch({tenantId:u,filters:{...h,name:null==E?void 0:E.name,status:"ACTIVE,DISABLED"},config:{enabled:!1}});const{data:k,isLoading:P,refetch:F}=Digit.Hooks.fsm.useDsoSearch(u,{vehicleIds:y,driverIds:I,status:"ACTIVE"},{enabled:!1}),x=(null==M?void 0:M.totalCount)||50;t.useEffect(()=>{w(),F()},[]),t.useEffect(()=>{w()},[E,v,p,D]),t.useEffect(()=>{if(null!=M&&M.vehicle&&"VEHICLE"===N){const e=M.vehicle.map(e=>e.id).filter(Boolean).join(",");T(e),A(M.vehicle)}if(null!=M&&M.driver&&"DRIVER"===N){const e=M.driver.map(e=>e.id).filter(Boolean).join(",");C(e),A(null==M?void 0:M.driver)}if(null!=M&&M.vendor&&"VENDOR"===N){const e=M.vendor.map(e=>{var t,l,n,a;return{mobileNumber:null===(t=e.owner)||void 0===t?void 0:t.mobileNumber,name:e.name,id:e.id,auditDetails:e.auditDetails,drivers:e.drivers,activeDrivers:null===(l=e.drivers)||void 0===l?void 0:l.filter(e=>"ACTIVE"===e.status),allVehicles:e.vehicles,dsoDetails:e,vendorAdditionalDetails:e.vendorAdditionalDetails,fillingPoint:e.fillingPoint,vehicles:null===(n=e.vehicles)||void 0===n||null===(a=n.filter(e=>"ACTIVE"===e.status))||void 0===a?void 0:a.map(e=>({id:e.id,registrationNumber:null==e?void 0:e.registrationNumber,type:e.type,i18nKey:"FSM_VEHICLE_TYPE_"+e.type,capacity:e.tankCapacity,suctionType:e.suctionType,model:e.model}))}});A(e)}if("SUPERVISOR"===N){const e=[{id:"SUP1",name:"Amit Kumar",employeeId:"EMP001",status:"ACTIVE",owner:{mobileNumber:"9876543210",userName:"9876543210"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Clean City Agency"}},{id:"SUP2",name:"Rajesh Singh",employeeId:"EMP002",status:"ACTIVE",owner:{mobileNumber:"9876543211",userName:"9876543211"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Green Environment"}}];A((null==M?void 0:M.supervisor)||e)}if("SURVEYOR"===N){const e=[{id:"SUR1",name:"Suresh Raina",employeeId:"EMP101",status:"ACTIVE",owner:{mobileNumber:"9123456780",userName:"9123456780"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Clean City Agency"}},{id:"SUR2",name:"Mahesh Babu",employeeId:"EMP102",status:"ACTIVE",owner:{mobileNumber:"9123456781",userName:"9123456781"},auditDetails:{createdTime:(new Date).getTime()},vendorData:{name:"Green Environment"}}];A((null==M?void 0:M.surveyor)||e)}},[M,N]),t.useEffect(()=>{""===y&&""===I||F()},[y,I]),t.useEffect(()=>{let e=!0;if(k&&e){if("VEHICLE"===N){const e=null==M?void 0:M.vehicle.map(e=>{let t=k.find(t=>{var l,n;return null===(l=t.dsoDetails)||void 0===l||null===(n=l.vehicles)||void 0===n?void 0:n.find(t=>t.id===e.id)});if(t){var l,n;let a={...e,vendor:t.dsoDetails};const i=null===(l=t.dsoDetails)||void 0===l||null===(n=l.vehicles)||void 0===n?void 0:n.find(t=>t.id===e.id);return i&&(a.driverData=i.driverData||i.driver||a.driverData),a}return e});A(e),T("")}if("DRIVER"===N){const e=null==M?void 0:M.driver.map(e=>{let t=k.find(t=>{var l,n;return null===(l=t.dsoDetails)||void 0===l||null===(n=l.drivers)||void 0===n?void 0:n.find(t=>t.id===e.id)});return t?{...e,vendor:t.dsoDetails}:e});A(e),C("")}}return()=>{e=!1}},[k,M]);const H="VEHICLE"===N?[{label:d("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"vendor",type:"dropdown",options:null==f?void 0:f.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}),optionsKey:"displayName"},{label:d("ES_FSM_REGISTRY_SEARCH_FILLING_POINT"),name:"fillingPoint",type:"dropdown",options:null==b||null===(s=b.fillingPoints)||void 0===s?void 0:s.map(e=>({...e,name:(null==e?void 0:e.name)||(null==e?void 0:e.fillingPointName)||(null==e?void 0:e.fillingStationId)})),optionsKey:"name"},{label:d("ES_VEHICLE_SEARCH_VEHICLE_NUMBER"),name:"registrationNumber",pattern:"[A-Z]{2}[- ]?[0-9]{2}[- ]?[A-Z]{1,2}[- ]?[0-9]{4}",title:d("ES_FSM_VEHICLE_FORMAT_TIP")}]:"DRIVER"===N?[{label:d("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"vendor",type:"dropdown",options:null==f?void 0:f.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}),optionsKey:"displayName"},{label:d("ES_DRIVER_SEARCH_DRIVER_NAME"),name:"name"}]:"SUPERVISOR"===N||"SURVEYOR"===N?[{label:d("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"vendor",type:"dropdown",options:null==f?void 0:f.map(e=>{var t;return{...e.dsoDetails,displayName:`${e.dsoDetails.name} (${e.dsoDetails.mobileNumber||(null===(t=e.dsoDetails.owner)||void 0===t?void 0:t.mobileNumber)||"N/A"})`}}),optionsKey:"displayName"},{label:d("SUPERVISOR"===N?"ES_SUPERVISOR_SEARCH_NAME":"ES_SURVEYOR_SEARCH_NAME"),name:"name"}]:[{label:d("ES_VENDOR_SEARCH_VENDOR_NAME"),name:"name"}],B=t.useCallback(e=>{0!==(null==e?void 0:e.length)&&S(e)},[]);return l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(V,{data:{table:O},isLoading:L||P,onSort:B,disableSort:!1,sortParams:v,userRole:"FSM_ADMIN",onFilterChange:()=>{},searchFields:H,onSearch:function(e){void 0===e&&(e={}),m({...e})},onNextPage:()=>{_(e=>e+D)},onPrevPage:()=>{_(e=>e-D)},currentPage:Math.floor(p/D),pageSizeLimit:D,onPageSizeChange:e=>{R(Number(e.target.value))},totalRecords:x||0,onTabChange:e=>{g(e)},selectedTab:N,refetchData:()=>{w()},refetchVendor:()=>{F()}})))},SelectServiceType:e=>{let{config:n,onSelect:i,t:o,userType:r,formData:s}=e;const d=Digit.ULBService.getCurrentTenantId(),[u,c]=(Digit.ULBService.getStateId(),t.useState(null==s?void 0:s.serviceType)),[E,m]=t.useState([]),{data:v,isLoading:S}=Digit.Hooks.useCustomMDMS(d,"tenant",[{name:"citymodule"}],{select:e=>{var t;return null==e||null===(t=e.tenant)||void 0===t?void 0:t.citymodule}});return t.useEffect(()=>{if(v){const e=v.map(e=>({i18nKey:""+e.code,code:""+e.code,value:""+e.name}));if(m(e),!u||"WT"===u.code){const t=e.find(e=>"WT"===e.code);t&&(c(t),"employee"===r&&i(n.key,t))}}},[v]),S?l.createElement(a.Loader,null):"employee"===r?l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,o(n.label)),l.createElement(a.Dropdown,{className:"payment-form-text-input-correction",isMandatory:n.isMandatory,selected:u,option:E,select:e=>{c(e),"employee"===r&&i(n.key,e)},optionKey:"i18nKey",disable:n.disable,t:o})):void 0},SelectVehicleType:e=>{var n;let{t:i,config:o,onSelect:r,formData:s}=e;const d=Digit.ULBService.getStateId(),u=Digit.ULBService.getCurrentTenantId(),{data:c,isLoading:E}=Digit.Hooks.wt.useWTMDMS(d,"Vehicle","VehicleMakeModel"),{data:m,isLoading:v}=Digit.Hooks.useCustomMDMS(u,"tenant",[{name:"citymodule"}],{select:e=>{var t;return null==e||null===(t=e.tenant)||void 0===t?void 0:t.citymodule}}),[S,p]=t.useState({}),[_,D]=t.useState([]),[R,N]=t.useState({}),[g,y]=t.useState([]),[T,I]=t.useState({}),[C,O]=t.useState(""),A=(null==s||null===(n=s.serviceType)||void 0===n?void 0:n.code)||(null==s?void 0:s.serviceType),f=t.useMemo(()=>{if(!m||!c)return{};const e={};return m.forEach(t=>{"WT"===t.code?e[t.code]=c.filter(e=>["MAHINDRA","TATA","TRACTOR","TAFE","SONALIKA"].includes(e.code)).map(e=>e.code):"CND"===t.code&&(e[t.code]=c.filter(e=>["MAHINDRA","TATA"].includes(e.code)).map(e=>e.code))}),e},[m,c]);return t.useEffect(()=>{p(f)},[f]),t.useEffect(()=>{if(!c)return;const e=S[A],t=e?c.filter(t=>e.includes(t.code)):c;D(t),N({}),y([]),I({}),O("")},[c,A,S]),t.useEffect(()=>{if(!c||null==R||!R.code)return;const e=c.filter(e=>e.make===R.code);y(e),I({}),O("")},[R,c]),t.useEffect(()=>{null!=T&&T.capacity&&O(T.capacity)},[T]),E||v?l.createElement(a.Loader,null):c&&m?l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,i("ES_FSM_REGISTRY_VEHICLE_MODEL")),l.createElement(a.Dropdown,{className:"form-field",selected:R,option:_,select:e=>{N(e),r(o.key,{...(null==s?void 0:s[o.key])||{},modal:e,type:""})},optionKey:"name",t:i})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,i("ES_FSM_REGISTRY_VEHICLE_TYPE")),l.createElement(a.Dropdown,{className:"form-field",selected:T,option:g,select:e=>{I(e),O(e.capacity),r(o.key,{...s[o.key],type:e})},optionKey:"name",t:i})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,i("ES_FSM_REGISTRY_VEHICLE_CAPACITY")),l.createElement(a.TextInput,{className:"",textInputStyle:{width:"100%"},value:C,disable:!0}))):l.createElement("div",null,i("ERROR_FETCHING_DATA"))},BankDetailsComponent:e=>{let{t:n,config:i,onSelect:o,formData:r,...s}=e;const[d,u]=t.useState((null==r?void 0:r.ifscCode)||""),[c,E]=t.useState((null==r?void 0:r.bankName)||""),[m,v]=t.useState((null==r?void 0:r.branchName)||""),[S,p]=t.useState((null==r?void 0:r.accountNumber)||""),[_,D]=t.useState(null);return t.useEffect(()=>{11===d.length&&fetch("https://ifsc.razorpay.com/"+d).then(e=>e.json()).then(e=>{e&&e.BANK&&e.BRANCH?(E(e.BANK),v(e.BRANCH),"function"==typeof o&&o(i.key,{bankName:e.BANK,branchName:e.BRANCH,ifscCode:d,accountNumber:S}),D({error:!1,label:n("VALID_IFSC_CODE")})):D({error:!0,label:n("INVALID_IFSC_CODE")})}).catch(()=>{D({error:!0,label:n("INVALID_IFSC_CODE")})})},[d]),t.useEffect(()=>{"function"==typeof o&&o(i.key,{bankName:c,branchName:m,ifscCode:d,accountNumber:S})},[S,c,m,d]),l.createElement(l.Fragment,null,l.createElement(a.CardLabel,null,n("ES_FSM_REGISTRY_IFSC_CODE")),l.createElement(a.TextInput,{t:n,type:"text",isMandatory:!1,name:"ifscCode",value:d,onChange:e=>{const t=e.target.value.replace(/[^a-zA-Z0-9]/g,"");t.length<=11&&u(t)},style:{width:"100%"},maxLength:11}),l.createElement(a.CardLabel,null,n("ES_FSM_REGISTRY_ACCOUNT_NUMBER")),l.createElement(a.TextInput,{t:n,type:"text",isMandatory:!1,name:"accountNumber",value:S,onChange:e=>p(e.target.value),style:{width:"100%"}}),l.createElement(a.CardLabel,null,n("ES_FSM_REGISTRY_BANK_NAME")),l.createElement(a.TextInput,{t:n,type:"text",isMandatory:!1,name:"bankName",value:c,onChange:e=>E(e.target.value),disabled:11===d.length&&c,style:{width:"100%"}}),l.createElement(a.CardLabel,null,n("ES_FSM_REGISTRY_BRANCH_NAME")),l.createElement(a.TextInput,{t:n,type:"text",isMandatory:!1,name:"branchName",value:m,onChange:e=>v(e.target.value),disabled:11===d.length&&m,style:{width:"100%"}}))},AddDriver:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:n}=i.useTranslation(),o=Digit.ULBService.getStateId(),[d,u]=t.useState(null),c=r.useQueryClient(),[,E]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,m]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,v]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:S}=Digit.Hooks.fsm.useDriverCreate(e);t.useEffect(()=>{E(!1),v(),m()},[]);const p=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_DRIVER_DETAILS",body:[{label:"ES_FSM_REGISTRY_DRIVER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"driverName",validation:{required:!0,pattern:{value:/^[A-Za-z\s]+$/,message:e("FSM_REGISTRY_INVALID_NAME")}},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_DRIVER_LICENSE",isMandatory:!0,type:"text",key:"license",populators:{name:"license",validation:{required:!0,pattern:{value:/^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/,message:e("ES_FSM_REGISTRY_INVALID_LICENSE")}},error:e("ES_FSM_REGISTRY_INVALID_LICENSE"),required:!1,defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",route:"select-service",hideInEmployee:!1,key:"serviceType",component:"SelectServiceType",disable:t,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}}]},{head:"ES_FSM_REGISTRY_PERSONAL_DETAILS",body:[{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!0,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>l.createElement(j,s({onChange:e.onChange,date:e.value},t,{max:(()=>{const e=new Date;return e.setFullYear(e.getFullYear()-18),e.toISOString().split("T")[0]})()}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_FSM_REGISTRY_DRIVER_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:"",className:"payment-form-text-input-correction",labelStyle:{border:"1px solid black",borderRight:"none"}}}]}]}(n),[_,D]=t.useState(!1),R=()=>{u(null)},N="WT_VENDOR"===Digit.UserService.getType();return console.log(N,"iscitizen"),l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:n("ES_FSM_REGISTRY_TITLE_NEW_DRIVER"),currentStep:1}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(a.FormComposer,{isDisabled:!_,label:n("ES_COMMON_APPLICATION_SUBMIT"),config:p.filter(e=>!e.hideInEmployee).map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:t=>{var l,n;const a=null==t?void 0:t.driverName,i=null==t?void 0:t.license,r=null==t||null===(l=t.selectGender)||void 0===l?void 0:l.code,s=null==t?void 0:t.emailId,d=null==t?void 0:t.phone,E=new Date(""+t.dob).getTime()||new Date("1/1/1970").getTime(),m=null==t||null===(n=t.serviceType)||void 0===n?void 0:n.code;S({driver:{tenantId:N?e:"dl.djb",name:a,licenseNumber:i,status:"ACTIVE",owner:{tenantId:o,name:a,fatherOrHusbandName:a,relationship:"OTHER",gender:r,dob:E,emailId:s||"abc@egov.com",mobileNumber:d},additionalDetails:{serviceType:m},vendorDriverStatus:"ACTIVE"}},{onError:(e,t)=>{u({key:"error",action:e}),setTimeout(R,5e3)},onSuccess:(e,t)=>{u({key:"success",action:"ADD_DRIVER"}),setTimeout(R,5e3),c.invalidateQueries("FSM_DRIVER_SEARCH")}})},defaultValues:{serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{if(null!=t&&t.license){const l=t.license.replace(/[^A-Za-z0-9]/g,"").toUpperCase();let n=l;l.length>2&&(n=l.slice(0,2)+"-"+l.slice(2)),l.length>4&&(n=n.slice(0,5)+"-"+n.slice(5)),l.length>8&&(n=n.slice(0,10)+"-"+n.slice(10));const a=n.slice(0,18);t.license!==a&&e("license",a)}null!=t&&t.driverName&&/^[A-Za-z\s]+$/.test(null==t?void 0:t.driverName)&&null!=t&&t.license&&/^[A-Z]{2}-[0-9]{2}-[0-9]{4}-[0-9]{7}$/.test(null==t?void 0:t.license)&&null!=t&&t.selectGender&&null!=t&&t.dob&&new Date(null==t?void 0:t.dob).getTime()<=(new Date).setFullYear((new Date).getFullYear()-18)?D(!0):D(!1)},noBreakLine:!0,mode:"onChange",noCard:!0}),d&&l.createElement(a.Toast,{error:"error"===d.key,label:n("success"===d.key?`ES_FSM_${d.action}_SUCCESS`:d.action),onClose:R})))},EditVendorDetails:e=>{var o,s,d;const u=Digit.ULBService.getCurrentTenantId(),{t:c}=i.useTranslation(),E=n.useHistory(),m=r.useQueryClient();let{id:v}=n.useParams();const[S,p]=t.useState(!1),[_,D]=t.useState(null),[R,N]=t.useState(!1),[g,y]=t.useState(null),[T,I]=t.useState([]),[C,O]=t.useState([]),[A,f]=t.useState({}),{data:b,isLoading:h,refetch:V}=Digit.Hooks.fsm.useDsoSearch(u,{ids:v},{staleTime:Infinity}),{data:M,refetch:k}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:u,filters:{status:"ACTIVE",sortBy:"registrationNumber",sortOrder:"ASC",vehicleWithNoVendor:!0}}),{data:F,refetch:x}=Digit.Hooks.fsm.useDriverSearch({tenantId:u,filters:{sortBy:"name",sortOrder:"ASC",status:"ACTIVE",driverWithNoVendor:!0}}),{data:H,isLoading:B}=Digit.Hooks.vendor.useEmpvendorCommonSearch({tenantId:u,filters:{vendorId:v}},{enabled:!!v}),{mutate:U}=Digit.Hooks.fsm.useVendorUpdate(u);function Y(e){p(!1),D(e)}const G=null===(o=Digit.SessionStorage.get("User").info.type)||void 0===o?void 0:o.toLowerCase();t.useEffect(()=>{switch(_){case"DELETE":case"ADD_VEHICLE":case"ADD_DRIVER":return N(!0);case"EDIT":return E.push(`/digit-ui/${G}/fsm/registry/modify-vendor/dsoId`);case"HOME":return E.push(`/digit-ui/${G}/fsm/registry?selectedTabs=VENDOR`)}},[_]),t.useEffect(()=>{M&&I((null==M?void 0:M.vehicle)||[])},[M]),t.useEffect(()=>{F&&O((null==F?void 0:F.driver)||[])},[F]);const K=()=>{y(null)},W=()=>{D(null),f({}),N(!1)},$=window.Digit.Utils.browser.isMobile();if(h)return l.createElement(a.Loader,null);const z=["vendorAdditionalDetailsId","vendorId","tenantId","code","lastModifiedTime","createdTime","lastModifiedBy","createdBy","active","status","vendorType","vendorGroup","narration","documents"];return l.createElement("div",{className:"employee-form-content"},h?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Card,null,null==b||null===(s=b[0])||void 0===s||null===(d=s.employeeResponse)||void 0===d?void 0:d.map((e,t)=>{var n,i;return l.createElement(l.Fragment,{key:t},t>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},c(e.title)),l.createElement("div",null,null==e||null===(n=e.values)||void 0===n?void 0:n.map((t,n)=>{var i;if("ES_FSM_REGISTRY_DETAILS_ADDITIONAL_DETAILS"===t.title){var o,r;const e=null==H||null===(o=H.VendorDetails)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.vendorAdditionalDetails,n=Object.entries(e||{}).filter(e=>{let[t]=e;return!z.includes(t)});return l.createElement(l.Fragment,{key:t.title},l.createElement(a.Row,{label:c(t.title),text:"",className:"border-none flex-box"}),B?l.createElement(a.Loader,null):e?l.createElement(a.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},n.map(e=>{let[t,n]=e;if("object"==typeof n&&null!==n)return null;const a=String(t);let i=null!=n&&""!==n?String(n):"N/A";var o,r;return"name"!==t||n&&""!==n||(i=(null==b||null===(o=b[0])||void 0===o||null===(r=o.dsoDetails)||void 0===r?void 0:r.name)||"N/A"),l.createElement(l.Fragment,{key:a},l.createElement("div",{className:"additional-label"},c((e=>{const t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)})(a))),l.createElement("div",{className:"additional-value"},i))})),l.createElement("div",{className:"add-details-link hover-button",onClick:()=>E.push(`/digit-ui/${G}/vendor/registry/additionaldetails/info?vendorId=${v}`)},c("Edit Details"))):l.createElement("div",{onClick:()=>E.push(`/digit-ui/${G}/vendor/registry/additionaldetails/vendor-details?vendorId=${v}`),className:"add-details-link hover-button"},c("Add Additional Details")))}return l.createElement(a.Row,{key:c(String(t.title)),label:c(String(t.title)),text:t.value?c(String(t.value)):"N/A",last:n===(null==e||null===(i=e.values)||void 0===i?void 0:i.length)-1,caption:t.caption,className:"border-none flex-box "+($?"":"vendor-details-row")})}),null==e||null===(i=e.child)||void 0===i?void 0:i.map((t,n)=>{var i;return l.createElement(a.Card,{className:"card-with-background",key:t.id||n},l.createElement("div",{className:"card-head"},l.createElement("h2",null,c(e.type)," ",n+1),l.createElement("div",{style:{display:"flex"}},l.createElement("span",{onClick:()=>((e,t,l)=>{if("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===t)E.push(`/digit-ui/${G}/fsm/registry/modify-driver/${l}`);else{var n,a;let t=null==e||null===(n=e.values)||void 0===n||null===(a=n.find(e=>"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.title))||void 0===a?void 0:a.value;E.push(`/digit-ui/${G}/fsm/registry/modify-vehicle/${t}`)}})(t,e.type,t.id)},l.createElement(a.EditIcon,{style:{cursor:"pointer",marginRight:"20px"},className:"edit",fill:"#a82227"})),l.createElement("span",{onClick:()=>((e,t,l)=>{let n={};if("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===t){var a,i;let e=null==b||null===(a=b[0])||void 0===a?void 0:a.dsoDetails,t=null==e?void 0:e.drivers;t=t.map(e=>(e.id===l&&(e.vendorDriverStatus="INACTIVE"),e)),n={vendor:{...e,owner:{...e.owner,gender:(null===(i=e.owner)||void 0===i?void 0:i.gender)||"OTHERS"},drivers:t}}}else{var o,r,s,d;let t=null==b||null===(o=b[0])||void 0===o?void 0:o.dsoDetails,l=null==t?void 0:t.vehicles,a=null==e||null===(r=e.values)||void 0===r||null===(s=r.find(e=>"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.title))||void 0===s?void 0:s.value;l=l.map(e=>(e.registrationNumber===a&&(e.vendorVehicleStatus="INACTIVE"),e)),n={vendor:{...t,owner:{...t.owner,gender:(null===(d=t.owner)||void 0===d?void 0:d.gender)||"OTHERS"},vehicles:l}}}U(n,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(K,5e3)},onSuccess:(e,l)=>{y({key:"success",action:"ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===t?"DELETE_DRIVER":"DELETE_VEHICLE"}),m.invalidateQueries("DSO_SEARCH"),V(),k(),x(),setTimeout(()=>{K()},5e3)}})})(t,e.type,t.id)},l.createElement(a.DeleteIcon,{style:{cursor:"pointer"},className:"delete",fill:"#a82227"})))),l.createElement("div",{className:"additional-grid",style:{padding:"8px 16px"}},null==t||null===(i=t.values)||void 0===i?void 0:i.map((e,t)=>l.createElement(l.Fragment,{key:t},l.createElement("div",{className:"additional-label"},c(String(e.title))),l.createElement("div",{className:"additional-value",style:"ACTIVE"===e.value?{color:"green"}:{}},e.value?c(String(e.value)):"N/A")))))}),e.type&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>Y("ES_FSM_REGISTRY_DETAILS_TYPE_DRIVER"===e.type?"ADD_DRIVER":"ADD_VEHICLE")},c(e.type+"_ADD"))))})),R&&l.createElement(a.Modal,{headerBarMain:l.createElement(w,{label:c("DELETE"===_?"ES_FSM_REGISTRY_DELETE_POPUP_HEADER":"ADD_VEHICLE"===_?"ES_FSM_REGISTRY_ADD_VEHICLE_POPUP_HEADER":"ES_FSM_REGISTRY_ADD_DRIVER_POPUP_HEADER")}),headerBarEnd:l.createElement(P,{onClick:W}),actionCancelLabel:c("CS_COMMON_CANCEL"),actionCancelOnSubmit:W,actionSaveLabel:c("DELETE"===_?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{var e;let t=null==b||null===(e=b[0])||void 0===e?void 0:e.dsoDetails,l={};if("DELETE"===_&&(l={vendor:{...t,status:"INACTIVE"}}),"ADD_VEHICLE"===_){var n;let e=A;e.vendorVehicleStatus="ACTIVE",l={vendor:{...t,owner:{...t.owner,gender:(null===(n=t.owner)||void 0===n?void 0:n.gender)||"OTHERS"},vehicles:t.vehicles?[...t.vehicles,e]:[e]}}}if("ADD_DRIVER"===_){var a;let e=A;e.vendorDriverStatus="ACTIVE",l={vendor:{...t,owner:{...t.owner,gender:(null===(a=t.owner)||void 0===a?void 0:a.gender)||"OTHERS"},drivers:t.drivers?[...t.drivers,e]:[e]}}}U(l,{onError:(e,t)=>{y({key:"error",action:e}),setTimeout(K,5e3)},onSuccess:(e,t)=>{y({key:"success",action:"DELETE"===_?"DELETE_VENDOR":_}),m.invalidateQueries("DSO_SEARCH"),V(),k(),x(),setTimeout(()=>{K(),"DELETE"===_&&E.push(`/digit-ui/${G}/fsm/registry`)},5e3)}}),N(!1),D(null)}},l.createElement(a.Card,{style:{boxShadow:"none"}},"DELETE"===_?l.createElement(L,{t:c,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VEHICLE"===_?l.createElement(l.Fragment,null,l.createElement(a.CardText,null,c("ES_FSM_REGISTRY_SELECT_VEHICLE")),l.createElement(a.Dropdown,{t:c,option:T,value:A,selected:A,select:f,optionKey:"registrationNumber"})):"ADD_DRIVER"===_?l.createElement(l.Fragment,null,l.createElement(a.CardText,null,c("ES_FSM_REGISTRY_SELECT_DRIVER")),l.createElement(a.Dropdown,{t:c,option:C,value:A,selected:A,select:f,optionKey:"name"})):void 0)),g&&l.createElement(a.Toast,{error:"error"===g.key,label:c("success"===g.key?`ES_FSM_REGISTRY_${g.action}_SUCCESS`:g.action),onClose:K}),l.createElement(a.ActionBar,{style:{zIndex:"19"}},S?l.createElement(a.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE","HOME"],t:c,onSelect:Y}):null,l.createElement(a.SubmitBar,{label:c("ES_COMMON_TAKE_ACTION"),onSubmit:()=>p(!S)}))))},AddVehicle:e=>{const o=Digit.ULBService.getCurrentTenantId(),d=Digit.ULBService.getStateId(),[u,c]=t.useState(null),E=n.useHistory(),{t:m}=i.useTranslation(),v=r.useQueryClient(),[,S]=Digit.Hooks.useSessionStorage("FSM_MUTATION_HAPPENED",!1),[,,p]=Digit.Hooks.useSessionStorage("FSM_ERROR_DATA",!1),[,,_]=Digit.Hooks.useSessionStorage("FSM_MUTATION_SUCCESS_DATA",!1),{mutate:D}=Digit.Hooks.fsm.useVehicleCreate(o);t.useEffect(()=>{S(!1),_(),p()},[]);const R=function(e,t){return void 0===t&&(t=!1),[{head:"ES_FSM_REGISTRY_VEHICLE_DETAILS",body:[{label:"ES_FSM_REGISTRY_VEHICLE_NUMBER",isMandatory:!0,type:"text",disable:t,populators:{name:"registrationNumber",ValidationRequired:!0,validation:{pattern:"^[A-Z]{2}-[0-9]{1,2}[A-Z]{0,2}-(?:[A-Z]{1,2}-)?[0-9]{1,4}$",title:e("ES_FSM_VEHICLE_FORMAT_TIP")},error:e("FSM_REGISTRY_INVALID_REGISTRATION_NUMBER"),defaultValue:""}},{label:"ES_VENDOR_REGISTRY_SERVICE_TYPE",isMandatory:!0,type:"component",key:"serviceType",component:"SelectServiceType",disable:t,populators:{name:"serviceType",defaultValue:{code:"WT",name:"WT",i18nKey:"WT"}},texts:{header:"CS_COMMON_CHOOSE_SERVICE_TYPE",submitBarLabel:"CS_COMMON_NEXT"}},{route:"vehicle",component:"SelectVehicleType",withoutLabel:!0,key:"vehicle",isMandatory:!0,type:"component"},{label:"ES_FSM_REGISTRY_VEHICLE_POLLUTION_CERT",isMandatory:!1,type:"custom",key:"pollutionCert",populators:{name:"pollutionCert",validation:{required:!0},component:(e,t)=>l.createElement(ee,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_INSURANCE",isMandatory:!1,type:"custom",key:"insurance",populators:{name:"insurance",validation:{required:!0},component:(e,t)=>l.createElement(ee,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_VEHICLE_ROAD_TAX",isMandatory:!1,type:"custom",key:"roadTax",populators:{name:"roadTax",validation:{required:!0},component:(e,t)=>l.createElement(ee,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_FITNESS",isMandatory:!1,type:"custom",key:"fitnessValidity",populators:{name:"fitnessValidity",validation:{required:!0},component:(e,t)=>l.createElement(ee,s({onChange:e.onChange,date:e.value},t))}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_NAME",isMandatory:!0,type:"text",disable:t,populators:{name:"ownerName",validation:{required:!0,pattern:{value:/^[A-Za-z\s.,/]+$/,message:e("FSM_REGISTRY_INVALID_NAME")}},error:e("FSM_REGISTRY_INVALID_NAME"),defaultValue:""}},{label:"ES_FSM_REGISTRY_NEW_VEHICLE_OWNER_PHONE",isMandatory:!0,type:"mobileNumber",key:"phone",disable:t,populators:{name:"phone",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("FSM_REGISTRY_INVALID_PHONE"),defaultValue:""}},{label:"ES_FSM_REGISTRY_NEW_GENDER",isMandatory:!0,type:"component",route:"select-gender",hideInEmployee:!1,key:"selectGender",component:"SelectGender"},{label:e("ES_FSM_REGISTRY_NEW_DOB"),isMandatory:!0,type:"custom",key:"dob",populators:{name:"dob",validation:{required:!0},component:(e,t)=>l.createElement(ee,s({onChange:e.onChange,date:e.value},t,{max:(()=>{const e=new Date;return e.setFullYear(e.getFullYear()-18),e.toISOString().split("T")[0]})()}))}},{label:"ES_FSM_REGISTRY_NEW_EMAIL",isMandatory:!1,type:"text",key:"emailId",populators:{name:"emailId",validation:{required:!1,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("FSM_REGISTRY_INVALID_EMAIL"),defaultValue:""}}]}]}(m);R[0].body.forEach(e=>{"ES_FSM_REGISTRY_VEHICLE_NUMBER"===e.label&&(e.labelChildren=l.createElement("div",{className:"tooltip",style:{paddingLeft:"10px",marginBottom:"-3px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{width:"320px",left:"230%",fontSize:"14px"}},e.populators.validation.title)))});const[N,g]=t.useState(!1),y=()=>{c(null)};return l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{route:"vendor-details",timeLine:[{actions:m("ES_FSM_REGISTRY_TITLE_NEW_VEHICLE"),currentStep:1}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(a.FormComposer,{isDisabled:!N,label:m("ES_COMMON_APPLICATION_SUBMIT"),config:R.filter(e=>!e.hideInEmployee).map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0,body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,l,n,a,i,r,s,u;const m=null==e?void 0:e.registrationNumber,S=null==e||null===(t=e.vehicle)||void 0===t||null===(l=t.type)||void 0===l?void 0:l.code,p=null==e||null===(n=e.vehicle)||void 0===n||null===(a=n.modal)||void 0===a?void 0:a.code,_=null==e||null===(i=e.vehicle)||void 0===i||null===(r=i.type)||void 0===r?void 0:r.capacity,R=new Date(""+(null==e?void 0:e.pollutionCert)).getTime(),N=new Date(""+(null==e?void 0:e.insurance)).getTime(),g=new Date(""+(null==e?void 0:e.roadTax)).getTime(),T=new Date(""+(null==e?void 0:e.fitnessValidity)).getTime(),I=null==e?void 0:e.ownerName,C=null==e?void 0:e.phone,O=null==e||null===(s=e.serviceType)||void 0===s?void 0:s.code,A=null==e||null===(u=e.selectGender)||void 0===u?void 0:u.code,f=null==e?void 0:e.emailId,b=new Date(""+e.dob).getTime()||new Date("1/1/1970").getTime(),h="WT_VENDOR"===Digit.UserService.getType();D({vehicle:{tenantId:h?o:"dl.djb",registrationNumber:m,model:p,type:S,tankCapacity:_,suctionType:"SEWER_SUCTION_MACHINE",pollutionCertiValidTill:R,InsuranceCertValidTill:N,fitnessValidTill:T,roadTaxPaidTill:g,gpsEnabled:!0,source:"Municipal records",owner:{tenantId:d,name:I,fatherOrHusbandName:I,relationship:"OTHER",correspondenceAddress:"",mobileNumber:C,gender:A,dob:b,emailId:f||"abc@egov.com"},additionalDetails:{serviceType:O}}},{onError:(e,t)=>{c({key:"error",action:e}),setTimeout(y,5e3)},onSuccess:(e,t)=>{c({key:"success",action:"ADD_VEHICLE"}),v.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{y(),E.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=VEHICLE")},3e3)}})},defaultValues:{serviceType:{code:"WT",name:"WT",i18nKey:"WT"},tripData:{noOfTrips:1,amountPerTrip:null,amount:null}},onFormValueChange:(e,t)=>{var l,n;if(null!=t&&t.registrationNumber){let l=(e=>{const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"");if(t.length<=2)return t;const l=t.slice(0,2),n=t.slice(2);if(!n)return l;const a=n.match(/^(\d{1,2})/);if(!a)return l+"-"+n;const i=a[1],o=n.slice(i.length),r=o.match(/^([A-Z]*)/),s=r?r[1]:"",d=o.slice(s.length);if(!d)return l+"-"+i+s;if(s.length>=3){const e=s.length<=3?1:2;return l+"-"+i+s.slice(0,e)+"-"+s.slice(e)+"-"+d.slice(0,4)}return l+"-"+i+s+"-"+d.slice(0,4)})(t.registrationNumber);l.length>15&&(l=l.slice(0,15)),l!==t.registrationNumber&&e("registrationNumber",l)}null!=t&&t.registrationNumber&&null!=t&&t.ownerName&&null!=t&&t.phone&&null!=t&&null!==(l=t.vehicle)&&void 0!==l&&l.modal&&null!=t&&null!==(n=t.vehicle)&&void 0!==n&&n.type&&null!=t&&t.selectGender&&null!=t&&t.dob&&new Date(null==t?void 0:t.dob).getTime()<=(new Date).setFullYear((new Date).getFullYear()-18)?g(!0):g(!1)},noBreakLine:!0,mode:"onChange",noCard:!0}),u&&l.createElement(a.Toast,{error:"error"===u.key,label:m("success"===u.key?`ES_FSM_REGISTRY_${u.action}_SUCCESS`:u.action),onClose:y})))},VENDORCreate:e=>{var t,a,o,s;const d=r.useQueryClient(),u=n.useRouteMatch(),{t:c}=i.useTranslation(),{pathname:E}=n.useLocation(),m=n.useHistory();let v=[];const[S,p,_]=Digit.Hooks.useSessionStorage("VENDOR_Test",{});function D(e,t,l,n,a){if(void 0===a&&(a=!1),"owners"===e){let l=S.owners||[];l[n]=t,p({...S,[e]:[...l]})}else if("units"===e){let e=S.units||[];e=t,p({...S,units:e})}else p({...S,[e]:{...S[e],...t}});((e,t,l,n)=>{let a,i=E.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"===i||"-1"===i?"-1"===i||"-2"===i?(i=E.slice(0,-3),i=i.split("/").pop(),r=!0):(i=E.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=v.find(e=>e.route===(i||"0")),d=m.push;if(e&&(d=m.replace),l&&(s=n),null===s)return console.log("matchhhhh pathhhh",u.path),d(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?`${u.path}/${s}/${t}`:`${u.path}/${s}`,d(a)})(l,n,a,e)}S&&Object.keys(S).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(_(),d.invalidateQueries("VENDOR_CREATE"));const R=()=>{},N=()=>{};q.forEach(e=>{v=v.concat(e.body.filter(e=>!e.hideInCitizen))}),v.indexRoute="info";const g=null===(t=Digit)||void 0===t||null===(a=t.ComponentRegistryService)||void 0===a?void 0:a.getComponent("VENDORCheckPage"),y=null===(o=Digit)||void 0===o||null===(s=o.ComponentRegistryService)||void 0===s?void 0:s.getComponent("NewResponse");return l.createElement(l.Fragment,null,l.createElement(n.Switch,null,v.map((e,t)=>{const{component:a,texts:i,inputs:o,key:r}=e,s="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;return l.createElement(n.Route,{path:`${u.path}/${e.route}`,key:t},l.createElement(s,{config:{texts:i,inputs:o,key:r},onSelect:D,onSkip:R,t:c,formData:S,onAdd:N}))}),l.createElement(n.Route,{path:u.path+"/check"},l.createElement(g,{onSubmit:function(){try{return m.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:S})),l.createElement(n.Route,{path:u.path+"/acknowledgement"},l.createElement(y,{data:S,onSuccess:()=>{_(),d.invalidateQueries("VENDOR_CREATE")}})),l.createElement(n.Route,null,l.createElement(n.Redirect,{to:`${u.path}/${v.indexRoute}`}))))},VENDORCheckPage:e=>{var n,o,r,s;let{onSubmit:d,value:u={}}=e;const{t:E}=i.useTranslation(),{vendordet:m,documents:v}=u;console.log("vendordetailssppsss",m),console.log("documents",v);const[S,p]=t.useState(!1);return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(a.VerticalTimeline,{config:[{timeLine:[{actions:E("VENDOR_ADDITIONAL_DETAILS"),currentStep:1}]},{timeLine:[{actions:E("VENDOR_DOCUMENT_DETAILS"),currentStep:2}]},{timeLine:[{actions:E("VENDOR_SUMMARY"),currentStep:3}]}],currentActiveIndex:2,showFinalStep:!1}):null,l.createElement("div",{style:{flex:"1",overflowY:"auto",marginBottom:"20px"}},l.createElement(a.Card,null,l.createElement(a.CardHeader,null,E("VENDOR_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(a.CardSubHeader,null,E("VENDOR_ADDITIONAL_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(a.Row,{label:E("VENDOR_ID"),text:""+E(c(null==m?void 0:m.VendorId)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_BANK_IFSC_CODE"),text:""+E(c(null==m?void 0:m.IFSC)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_BANK_NAME"),text:""+E(c(null==m?void 0:m.Bank)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_BANK_BRANCH"),text:""+E(c(null==m?void 0:m.BankbranchName)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_MICR_NO"),text:""+E(c(null==m?void 0:m.micrNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("BANK_ACCONT_NO"),text:""+E(c(null==m?void 0:m.AccountNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("PAN_NO"),text:""+E(c(null==m?void 0:m.PanNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("GST_NO"),text:""+E(c(null==m?void 0:m.GstNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("GST_REGISTERED_STATE/UT"),text:""+E(c(null==m?void 0:m.GstState)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-detailss"})}),l.createElement(a.Row,{label:E("REGISTRATION_NO"),text:""+E(c(null==m?void 0:m.RegistrationNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("EPF_NO"),text:""+E(c(null==m?void 0:m.EpfNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("ESI_NO"),text:""+E(c(null==m?void 0:m.EsiNo)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_TYPE"),text:""+E(c(null==m||null===(n=m.VendorType)||void 0===n?void 0:n.code)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_CATEGORY"),text:""+E(c(null==m||null===(o=m.VendorCategory)||void 0===o?void 0:o.code)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}),l.createElement(a.Row,{label:E("VENDOR_STATUS"),text:""+E(c(null==m||null===(r=m.Status)||void 0===r?void 0:r.code)),actionButton:l.createElement(W,{jumpTo:"/digit-ui/employee/vendor/registry/additionaldetails/vendor-details"})}))),l.createElement("br",null),l.createElement(a.CardSubHeader,null,E("VENDOR_DOCUMENTS_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{label:E("VENDOR_DOCUMENTS"),text:(null==v||null===(s=v.documents)||void 0===s?void 0:s.length)>0?v.documents.map((e,t)=>l.createElement("div",{key:t},l.createElement("span",{style:{color:"#5a6ee1",cursor:"pointer",textDecoration:"underline"},onClick:()=>{var t;(t=null==e?void 0:e.filestoreId)?Digit.UploadServices.Filefetch([t],Digit.ULBService.getStateId()).then(e=>{var t,l,n;const a=null==e||null===(t=e.data)||void 0===t||null===(l=t.fileStoreIds)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.url;if(a){const e=a.split(",")[0];if(e){const t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noopener noreferrer",document.body.appendChild(t),t.click(),document.body.removeChild(t)}}else console.error("URL missing in response. Full res:",e)}):console.error("fileId is null or undefined!")}},E(e.documentType)))):E("CS_NA")}))),l.createElement("br",null),l.createElement(a.CheckBox,{label:E("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{p(!S)},styles:{height:"auto"},checked:S})),l.createElement("br",null),l.createElement("div",{className:"formcomposer-section-button"},l.createElement(a.SubmitBar,{label:E("COMMON_BUTTON_SUBMIT"),onSubmit:d,disabled:!S})))))},NewResponse:e=>{let{data:o,onSuccess:r}=e;const{t:s}=i.useTranslation(),d=Digit.Hooks.vendor.useVendorAdditionaldetailsAPI(Digit.ULBService.getCurrentTenantId());return t.useEffect(()=>{try{var e,t;o.tenantId=null===(e=o.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let l=(e=>{var t,l,n,a,i,o,r,s,d,u,c,E,m,v,S,p,_,D,R,N,g,y,T,I,C;return{VendorAdditionalDetails:{tenantId:Digit.ULBService.getCurrentTenantId(),code:"VENDOR12345454",name:(null==e||null===(t=e.vendordet)||void 0===t?void 0:t.userName)||"N/A",vendorCompany:null==e||null===(l=e.vendordet)||void 0===l?void 0:l.Company,vendorPhone:null==e||null===(n=e.vendordet)||void 0===n?void 0:n.PhoneNo,vendorEmail:"vendor@example.com",contactPerson:null==e||null===(a=e.vendordet)||void 0===a?void 0:a.ContactPerson,vendorMobileNumber:"9876543210",bankAccountNumber:null==e||null===(i=e.vendordet)||void 0===i?void 0:i.AccountNo,bank:null==e||null===(o=e.vendordet)||void 0===o?void 0:o.Bank,bankBranchName:null==e||null===(r=e.vendordet)||void 0===r?void 0:r.BankbranchName,micrNo:null==e||null===(s=e.vendordet)||void 0===s?void 0:s.micrNo,epfNo:null==e||null===(d=e.vendordet)||void 0===d?void 0:d.EpfNo,esiNo:null==e||null===(u=e.vendordet)||void 0===u?void 0:u.EsiNo,gstRegisteredState:null==e||null===(c=e.vendordet)||void 0===c?void 0:c.GstState,ifscCode:null==e||null===(E=e.vendordet)||void 0===E?void 0:E.IFSC,panNo:null==e||null===(m=e.vendordet)||void 0===m?void 0:m.PanNo,registrationNo:null==e||null===(v=e.vendordet)||void 0===v?void 0:v.RegistrationNo,status:null==e||null===(S=e.vendordet)||void 0===S||null===(p=S.Status)||void 0===p?void 0:p.code,vendorCategory:null==e||null===(_=e.vendordet)||void 0===_||null===(D=_.VendorCategory)||void 0===D?void 0:D.code,vendorId:null==e||null===(R=e.vendordet)||void 0===R?void 0:R.VendorId,gstTinNo:null==e||null===(N=e.vendordet)||void 0===N?void 0:N.GstNo,serviceType:null==e||null===(g=e.vendordet)||void 0===g||null===(y=g.VendorType)||void 0===y?void 0:y.code,documents:null==e||null===(T=e.documents)||void 0===T?void 0:T.documents,active:null,vendorAdditionalDetailsId:null,vendorGroup:(null==e||null===(I=e.vendordet)||void 0===I?void 0:I.vendorGroup)||"N/A",vendorType:(null==e||null===(C=e.vendordet)||void 0===C?void 0:C.vendorType)||"N/A"}}})(o);console.log("formdata in acknowejkfdlgi ::: ",l),d.mutate(l,{onSuccess:r}),console.log("mutation in acknowejkfdlgi ::: ",d)}catch(e){}},[]),d.isLoading||d.isIdle?l.createElement(a.Loader,null):l.createElement(a.Card,{className:"vehicle-details-card"},l.createElement(X,{t:s,data:d.data,isSuccess:d.isSuccess,isLoading:d.isIdle||d.isLoading}),l.createElement(a.StatusTable,null,d.isSuccess&&l.createElement(a.Row,{rowContainerStyle:z,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(n.Link,{to:"/digit-ui/employee"},l.createElement(a.LinkButton,{label:s("CORE_COMMON_GO_TO_HOME")})))},DriverDetails:()=>{var e,o;const s=Digit.ULBService.getCurrentTenantId(),{t:d}=i.useTranslation(),u=n.useHistory(),c=r.useQueryClient(),{id:E}=n.useParams(),[m,v]=t.useState(!1),[S,p]=t.useState(null),[_,D]=t.useState(!1),[R,N]=t.useState(null),[g,y]=t.useState([]),[T,I]=t.useState({}),{data:C,isLoading:O,refetch:A}=Digit.Hooks.fsm.useDriverDetails(s,{ids:E},{staleTime:Infinity}),{data:f}=Digit.Hooks.fsm.useDsoSearch(s,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:b}=Digit.Hooks.fsm.useDriverUpdate(s),{mutate:h}=Digit.Hooks.fsm.useVendorUpdate(s);function V(e){p(e),v(!1)}t.useEffect(()=>{if(f){let e=f.map(e=>e.dsoDetails);y(e)}},[f]),t.useEffect(()=>{A()},[]),t.useEffect(()=>{switch(S){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return D(!0);case"EDIT":return u.push("/digit-ui/employee/fsm/registry/modify-driver/"+E);case"HOME":return u.push("/digit-ui/employee/fsm/registry?selectedTabs=DRIVER")}},[S]);const M=()=>{N(null)},w=()=>{p(null),I({}),D(!1)},k=()=>"DELETE"===S||"DELETE_VENDOR"===S?l.createElement(L,{t:d,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===S||"EDIT_VENDOR"===S?l.createElement(l.Fragment,null,l.createElement(a.CardText,null,d("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(a.Dropdown,{t:d,option:g,value:T,selected:T,select:I,optionKey:"name"})):void 0;return O||O?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(a.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==C||null===(e=C[0])||void 0===e||null===(o=e.employeeResponse)||void 0===o?void 0:o.map((e,t)=>{var n;return l.createElement(l.Fragment,{key:t},t>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},d(e.title)),l.createElement(a.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,t)=>l.createElement(l.Fragment,{key:t},l.createElement("div",{className:"additional-label"},d(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},d(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>V("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.AddIcon,{className:"",fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>V("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.EditIcon,null)),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement("div",{className:"add-details-link hover-button",onClick:()=>V("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.DeleteIcon,{className:"delete",fill:"#a82227"}))):l.createElement("div",{className:"additional-value"},d(e.value)||"N/A"))))))}))),_&&l.createElement(a.Modal,{headerBarMain:l.createElement(Q,{label:d((()=>{switch(S){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(J,{onClick:w}),actionCancelLabel:d("CS_COMMON_CANCEL"),actionCancelOnSubmit:w,actionSaveLabel:d("DELETE"===S||"DELETE_VENDOR"===S?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(S){case"DELETE":return(()=>{var e;const t={driver:{...null==C||null===(e=C[0])||void 0===e?void 0:e.driverData,status:"INACTIVE"}};b(t,{onError:(e,t)=>{N({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{N({key:"success",action:"DELETE_DRIVER"}),c.invalidateQueries("DSO_SEARCH"),setTimeout(()=>{M(),u.push("/digit-ui/employee/fsm/registry")},5e3)}}),D(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,l,n;let a={},i=null==C||null===(e=C[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(l=t.vendor)||void 0===l?void 0:l[0],o=null==i?void 0:i.drivers;o=o.map(e=>(e.id===E&&(e.vendorDriverStatus="INACTIVE"),e)),a={vendor:{...i,owner:{...i.owner,gender:(null===(n=i.owner)||void 0===n?void 0:n.gender)||"OTHERS"},drivers:o}},h(a,{onError:(e,t)=>{N({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{N({key:"success",action:"DELETE_VENDOR"}),c.invalidateQueries("FSM_VENDOR_SEARCH"),A(),setTimeout(M,5e3)}}),D(!1)})();case"ADD_VENDOR":return(()=>{var e,t;let l=T,n=null==C||null===(e=C[0])||void 0===e?void 0:e.driverData;n.vendorDriverStatus="ACTIVE";const a={vendor:{...l,owner:{...l.owner,gender:(null===(t=l.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:l.drivers?[...l.drivers,n]:[n]}};h(a,{onError:(e,t)=>{N({key:"error",action:e}),A(),setTimeout(M,5e3)},onSuccess:(e,t)=>{N({key:"success",action:"ADD_VENDOR"}),c.invalidateQueries("DSO_SEARCH"),A(),setTimeout(M,5e3)}}),D(!1),p(null)})();case"EDIT_VENDOR":return(()=>{var e,t;let l=T,n=null==C||null===(e=C[0])||void 0===e?void 0:e.driverData;n.vendorDriverStatus="ACTIVE";const a={vendor:{...l,owner:{...l.owner,gender:(null===(t=l.owner)||void 0===t?void 0:t.gender)||"OTHERS"},drivers:l.drivers?[...l.drivers,n]:[n]}};h(a,{onError:(e,t)=>{N({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:(e,t)=>{N({key:"success",action:"EDIT_VENDOR"}),A(),c.invalidateQueries("DSO_SEARCH"),setTimeout(M,5e3)}}),D(!1),p(null)})()}},formId:"modal-action"},"DELETE"===S||"DELETE_VENDOR"===S?k():l.createElement(a.Card,{style:{boxShadow:"none"}},k())),R&&l.createElement(a.Toast,{error:"error"===R.key,label:d("success"===R.key?`ES_FSM_REGISTRY_${R.action}_SUCCESS`:R.action),onClose:M}),l.createElement(a.ActionBar,{style:{zIndex:"19"}},m?l.createElement(a.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:d,onSelect:V}):null,l.createElement(a.SubmitBar,{label:d("ES_COMMON_TAKE_ACTION"),onSubmit:()=>v(!m)})))},VehicleDetails:e=>{var o,s;const d=Digit.ULBService.getCurrentTenantId(),{t:u}=i.useTranslation(),c=n.useHistory(),E=r.useQueryClient();let{id:m}=n.useParams();const[v,S]=t.useState(!1),[p,_]=t.useState(null),[D,R]=t.useState(!1),[N,g]=t.useState(null),[y,T]=t.useState([]),[I,C]=t.useState({}),[O,A]=t.useState(null),{data:f,isLoading:b,refetch:h}=Digit.Hooks.fsm.useVehicleDetails(d,{registrationNumber:m},{staleTime:Infinity});t.useEffect(()=>{var e,t;!b&&f&&A(null==f||null===(e=f[0])||void 0===e||null===(t=e.vehicleData)||void 0===t?void 0:t.id)},[f,b]);const{data:V}=Digit.Hooks.fsm.useDsoSearch(d,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{});t.useEffect(()=>{if(V){let e=V.map(e=>e.dsoDetails);T(e)}},[V]);const{mutate:M}=Digit.Hooks.fsm.useUpdateVehicle(d),{mutate:w}=Digit.Hooks.fsm.useVendorUpdate(d);function k(e){S(!1),_(e)}t.useEffect(()=>{h()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return R(!0);case"EDIT":return c.push("/digit-ui/employee/fsm/registry/modify-vehicle/"+m);case"HOME":return c.push("/digit-ui/employee/fsm/registry?selectedTabs=VEHICLE")}},[p]);const P=()=>{g(null)},F=()=>{_(null),C({}),R(!1)},x=()=>"DELETE"===p||"DELETE_VENDOR"===p?l.createElement(L,{t:u,title:"ES_FSM_REGISTRY_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?l.createElement(l.Fragment,null,l.createElement(a.CardText,null,u("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(a.Dropdown,{t:u,option:y,value:I,selected:I,select:C,optionKey:"name"})):void 0;return b?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,b?l.createElement(a.Loader,null):l.createElement("div",{className:"employee-form-content"},l.createElement(a.Card,{className:"vehicle-details-card",style:{position:"relative"}},null==f||null===(o=f[0])||void 0===o||null===(s=o.employeeResponse)||void 0===s?void 0:s.map((e,t)=>{var n;return l.createElement(l.Fragment,{key:t},t>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},u(e.title)),l.createElement(a.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,t)=>l.createElement(l.Fragment,{key:t},l.createElement("div",{className:"additional-label"},u(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{display:"flex",alignItems:"center",gap:"8px"}},"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("div",{onClick:()=>k("ADD_VENDOR"),style:{color:"#a82227",display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"}},l.createElement(a.AddIcon,{className:"",fill:"#a82227"})," ",u(e.value)||"N/A"),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement(l.Fragment,null,l.createElement("span",null,e.value),l.createElement("div",{className:"add-details-link hover-button",onClick:()=>k("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.EditIcon,{fill:"#a82227"})),l.createElement("div",{className:"add-details-link hover-button",onClick:()=>k("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.DeleteIcon,{className:"delete",fill:"#a82227"})))):l.createElement("div",{className:"additional-value",style:"ACTIVE"===e.value?{color:"green"}:{}},u(e.value)||"N/A"))))))})),D&&l.createElement(a.Modal,{headerBarMain:l.createElement(te,{label:u((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_FSM_REGISTRY_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_FSM_REGISTRY_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(ne,{onClick:F}),actionCancelLabel:u("CS_COMMON_CANCEL"),actionCancelOnSubmit:F,actionSaveLabel:u("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={vehicle:{...null==f||null===(e=f[0])||void 0===e?void 0:e.vehicleData,status:"INACTIVE"}};M(t,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(P,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VEHICLE"}),E.invalidateQueries("FSM_VEICLES_SEARCH"),setTimeout(()=>{P(),c.push("/digit-ui/employee/fsm/registry")},5e3)}}),R(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,l,n;let a={},i=null==f||null===(e=f[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(l=t.vendor)||void 0===l?void 0:l[0],o=null==i?void 0:i.vehicles;o=o.map(e=>(e.id===O&&(e.vendorVehicleStatus="INACTIVE"),e)),a={vendor:{...i,owner:{...i.owner,gender:(null===(n=i.owner)||void 0===n?void 0:n.gender)||"OTHERS"},vehicles:o}},w(a,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(P,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"DELETE_VENDOR"}),E.invalidateQueries("FSM_VENDOR_SEARCH"),h(),setTimeout(P,5e3)}}),R(!1)})();case"ADD_VENDOR":return(()=>{var e,t;let l=I,n=null==f||null===(e=f[0])||void 0===e?void 0:e.vehicleData;n.vendorVehicleStatus="ACTIVE";const a={vendor:{...l,owner:{...l.owner,gender:(null===(t=l.owner)||void 0===t?void 0:t.gender)||"OTHERS"},vehicles:l.vehicles?[...l.vehicles,n]:[n]}};w(a,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(P,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"EDIT_VENDOR"}),h(),E.invalidateQueries("DSO_SEARCH"),setTimeout(P,5e3)}}),R(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e,t;let l=I,n=null==f||null===(e=f[0])||void 0===e?void 0:e.vehicleData;n.vendorVehicleStatus="ACTIVE";const a={vendor:{...l,owner:{...l.owner,gender:(null===(t=l.owner)||void 0===t?void 0:t.gender)||"OTHERS"},vehicles:l.vehicles?[...l.vehicles,n]:[n]}};w(a,{onError:(e,t)=>{g({key:"error",action:e}),setTimeout(P,5e3)},onSuccess:(e,t)=>{g({key:"success",action:"EDIT_VENDOR"}),h(),E.invalidateQueries("DSO_SEARCH"),setTimeout(P,5e3)}}),R(!1),_(null)})()}}},"DELETE"===p||"DELETE_VENDOR"===p?x():l.createElement(a.Card,{style:{boxShadow:"none"}},x())),N&&l.createElement(a.Toast,{error:"error"===N.key,label:u("success"===N.key?`ES_FSM_REGISTRY_${N.action}_SUCCESS`:N.action),onClose:P}),l.createElement(a.ActionBar,{style:{zIndex:"19"}},v?l.createElement(a.Menu,{localeKeyPrefix:"ES_FSM_REGISTRY_ACTION",options:["EDIT","DELETE"],t:u,onSelect:k}):null,l.createElement(a.SubmitBar,{label:u("ES_COMMON_TAKE_ACTION"),onSubmit:()=>S(!v)}))))},AddSupervisor:e=>{var n;const o=Digit.ULBService.getCurrentTenantId(),{t:s}=i.useTranslation(),[d,u]=t.useState(null),c=r.useQueryClient(),[E,m]=t.useState(!1),{mutate:v}=Digit.Hooks.fsm.useSupervisorCreate(o),{data:S}=Digit.Hooks.fsm.useVendorSearch(o,{status:"ACTIVE"}),p=function(e,t,n,a){return void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===a&&(a=!1),[{head:"ES_VENDOR_SUPERVISOR_BASIC_DETAILS",body:[{label:"ES_VENDOR_SUPERVISOR_FULL_NAME",isMandatory:!0,type:"text",disable:a,populators:{name:"fullName",validation:{required:!0,pattern:{value:/^[A-Za-z\s]+$/,message:e("ES_VENDOR_INVALID_NAME")}},error:e("ES_VENDOR_INVALID_NAME"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_MOBILE_NUMBER",isMandatory:!0,type:"mobileNumber",disable:a,populators:{name:"mobileNumber",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("ES_VENDOR_INVALID_MOBILE"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_EMAIL_ID",isMandatory:!0,type:"text",populators:{name:"emailId",validation:{required:!0,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("ES_VENDOR_INVALID_EMAIL"),defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_EMPLOYEE_ID",isMandatory:!0,type:"text",populators:{name:"employeeId",validation:{required:!0},defaultValue:"",className:"payment-form-text-input-correction"}},{label:"ES_VENDOR_SUPERVISOR_GENDER",isMandatory:!1,type:"component",key:"gender",component:"SelectGender",texts:{headerCaption:"",header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"}}]},{head:"ES_VENDOR_SUPERVISOR_ROLE_ACCESS",body:[{label:"ES_VENDOR_SUPERVISOR_ROLE",isMandatory:!0,type:"custom",populators:{name:"role",component:(t,n)=>l.createElement(F,{option:[{code:"SUPERVISOR",name:"Supervisor"}],optionKey:"name",select:t.onChange,selected:t.value,t:e,disable:!0}),defaultValue:{code:"SUPERVISOR",name:"Supervisor"}}},{label:"ES_VENDOR_SUPERVISOR_AGENCY_NAME",isMandatory:!0,type:"custom",populators:{name:"agencyName",component:(n,a)=>l.createElement(F,{option:t,optionKey:"name",select:n.onChange,selected:n.value,t:e})}},{label:"ES_VENDOR_SUPERVISOR_REPORTING_MANAGER",isMandatory:!1,type:"custom",populators:{name:"reportingManager",component:(t,a)=>l.createElement(F,{option:n,optionKey:"name",select:t.onChange,selected:t.value,t:e})}}]},{head:"ES_VENDOR_SUPERVISOR_AREA_ASSIGNMENT",body:[{type:"component",component:"SupervisorAreaAssignment",key:"areaAssignment",withoutLabel:!0}]}]}(s,(null==S||null===(n=S.vendor)||void 0===n?void 0:n.map(e=>({code:e.id,name:e.name,...e})))||[],[{code:"MGR1",name:"John Doe (Agency Admin)"},{code:"MGR2",name:"Jane Smith (Agency Admin)"}]),_=()=>{u(null)};return l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{route:"supervisor-details",timeLine:[{actions:s("ES_VENDOR_SUPERVISOR_DETAILS"),currentStep:1}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(a.FormComposer,{isDisabled:!E,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:p.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,l,n;const a={supervisor:{tenantId:o,name:null==e?void 0:e.fullName,employeeId:null==e?void 0:e.employeeId,status:"ACTIVE",owner:{tenantId:o,name:null==e?void 0:e.fullName,gender:(null==e||null===(t=e.gender)||void 0===t?void 0:t.code)||"OTHERS",emailId:null==e?void 0:e.emailId,mobileNumber:null==e?void 0:e.mobileNumber},vendorSupervisorStatus:"ACTIVE",additionalDetails:{agencyId:null==e||null===(l=e.agencyName)||void 0===l?void 0:l.code,reportingManager:null==e||null===(n=e.reportingManager)||void 0===n?void 0:n.code,areaAssignment:null==e?void 0:e.areaAssignment}}};v(a,{onError:e=>{u({key:"error",action:e}),setTimeout(_,5e3)},onSuccess:()=>{u({key:"success",action:"ADD_SUPERVISOR"}),c.invalidateQueries("SUPERVISOR_SEARCH"),setTimeout(_,5e3)}})},defaultValues:{role:{code:"SUPERVISOR",name:"Supervisor"}},onFormValueChange:(e,t)=>{var l,n,a,i,o;const r=(null==t||null===(l=t.areaAssignment)||void 0===l?void 0:l.zone)&&(null==t||null===(n=t.areaAssignment)||void 0===n?void 0:n.cluster)&&(null==t||null===(a=t.areaAssignment)||void 0===a?void 0:a.ward)&&(null==t||null===(i=t.areaAssignment)||void 0===i||null===(o=i.areas)||void 0===o?void 0:o.length)>0;m(!!((null==t?void 0:t.fullName)&&(null==t?void 0:t.mobileNumber)&&(null==t?void 0:t.emailId)&&(null==t?void 0:t.employeeId)&&(null==t?void 0:t.agencyName)&&r))},noBreakLine:!0,mode:"onChange",noCard:!0}),d&&l.createElement(a.Toast,{error:"error"===d.key,label:s("success"===d.key?`ES_VENDOR_${d.action}_SUCCESS`:d.action),onClose:_})))},SupervisorDetails:e=>{var o,s;const d=Digit.ULBService.getCurrentTenantId(),{t:u}=i.useTranslation(),c=n.useHistory(),E=r.useQueryClient(),{id:m}=n.useParams(),[v,S]=t.useState(!1),[p,_]=t.useState(null),[D,R]=t.useState(!1),[N,g]=t.useState(null),[y,T]=t.useState([]),[I,C]=t.useState({}),{data:O,isLoading:A,refetch:f}=Digit.Hooks.fsm.useSupervisorDetails(d,{ids:m},{staleTime:Infinity}),{data:b}=Digit.Hooks.fsm.useDsoSearch(d,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:h}=Digit.Hooks.fsm.useSupervisorUpdate(d),{mutate:V}=Digit.Hooks.fsm.useVendorUpdate(d);t.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);T(e)}},[b]),t.useEffect(()=>{f()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return R(!0);case"EDIT":return c.push("/digit-ui/employee/vendor/modify-supervisor/"+m);case"HOME":return c.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SUPERVISOR")}},[p]);const M=()=>{g(null)},w=()=>{_(null),C({}),R(!1)};return A?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(a.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==O||null===(o=O[0])||void 0===o||null===(s=o.employeeResponse)||void 0===s?void 0:s.map((e,t)=>{var n,i;return l.createElement(l.Fragment,{key:t},t>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},u(e.title)),l.createElement(a.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,t)=>l.createElement(l.Fragment,{key:t},l.createElement("div",{className:"additional-label"},u(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},u(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>_("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.AddIcon,{fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement(l.Fragment,null,l.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.EditIcon,null)),l.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.DeleteIcon,{fill:"#a82227"})))):l.createElement("div",{className:"additional-value"},u(e.value)||"N/A"))))),null==e||null===(i=e.child)||void 0===i?void 0:i.map((t,n)=>{var i;return l.createElement(a.Card,{className:"card-with-background",key:t.id||n,style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"card-head",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px"}},l.createElement("h2",{style:{fontSize:"18px",fontWeight:"bold"}},u(e.type)," ",n+1),l.createElement("div",{style:{display:"flex",gap:"15px"}},l.createElement("span",{onClick:()=>c.push("/digit-ui/employee/vendor/registry/modify-surveyor/"+t.id)},l.createElement(a.EditIcon,{fill:"#a82227",style:{cursor:"pointer"}})))),l.createElement("div",{className:"additional-grid"},null==t||null===(i=t.values)||void 0===i?void 0:i.map((e,t)=>l.createElement(l.Fragment,{key:t},l.createElement("div",{className:"additional-label"},u(e.title)),l.createElement("div",{className:"additional-value"},u(e.value)||"N/A")))))}),e.type&&l.createElement("div",{className:"add-details-link hover-button",style:{margin:"10px 16px",color:"#a82227",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",fontWeight:"bold"},onClick:()=>c.push("/digit-ui/employee/vendor/registry/new-surveyor?supervisorId="+m)},l.createElement(a.AddIcon,{fill:"#a82227"}),u(e.type+"_ADD")))}))),D&&l.createElement(a.Modal,{headerBarMain:l.createElement(Y,{label:u((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_VENDOR_SUPERVISOR_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_VENDOR_SUPERVISOR_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(K,{onClick:w}),actionCancelLabel:u("CS_COMMON_CANCEL"),actionCancelOnSubmit:w,actionSaveLabel:u("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={supervisor:{...null==O||null===(e=O[0])||void 0===e?void 0:e.supervisorData,status:"INACTIVE"}};h(t,{onError:e=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"DELETE_SUPERVISOR"}),E.invalidateQueries("SUPERVISOR_SEARCH"),setTimeout(()=>{M(),c.push("/digit-ui/employee/vendor/search-vendor")},5e3)}}),R(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,l;let n=null==O||null===(e=O[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(l=t.vendor)||void 0===l?void 0:l[0],a=(null==n?void 0:n.supervisors)||[];a=a.map(e=>(e.id===m&&(e.vendorSupervisorStatus="INACTIVE"),e));const i={vendor:{...n,supervisors:a}};V(i,{onError:e=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"DELETE_VENDOR"}),E.invalidateQueries("FSM_VENDOR_SEARCH"),f(),setTimeout(M,5e3)}}),R(!1)})();case"ADD_VENDOR":return(()=>{var e;let t=I,l=null==O||null===(e=O[0])||void 0===e?void 0:e.supervisorData;l.vendorSupervisorStatus="ACTIVE";const n={vendor:{...t,supervisors:t.supervisors?[...t.supervisors,l]:[l]}};V(n,{onError:e=>{g({key:"error",action:e}),f(),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"ADD_VENDOR"}),E.invalidateQueries("SUPERVISOR_SEARCH"),f(),setTimeout(M,5e3)}}),R(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e;let t=I,l=null==O||null===(e=O[0])||void 0===e?void 0:e.supervisorData;l.vendorSupervisorStatus="ACTIVE";const n={vendor:{...t,supervisors:t.supervisors?[...t.supervisors,l]:[l]}};V(n,{onError:e=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"EDIT_VENDOR"}),f(),E.invalidateQueries("SUPERVISOR_SEARCH"),setTimeout(M,5e3)}}),R(!1),_(null)})()}}},l.createElement(a.Card,{style:{boxShadow:"none"}},"DELETE"===p||"DELETE_VENDOR"===p?l.createElement(L,{t:u,title:"ES_VENDOR_SUPERVISOR_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?l.createElement(l.Fragment,null,l.createElement(a.CardText,null,u("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(a.Dropdown,{t:u,option:y,value:I,selected:I,select:C,optionKey:"name"})):void 0)),N&&l.createElement(a.Toast,{error:"error"===N.key,label:u("success"===N.key?`ES_VENDOR_${N.action}_SUCCESS`:N.action),onClose:M}),l.createElement(a.ActionBar,{style:{zIndex:"19"}},v?l.createElement(a.Menu,{localeKeyPrefix:"ES_VENDOR_SUPERVISOR_ACTION",options:["EDIT","DELETE"],t:u,onSelect:e=>{S(!1),_(e)}}):null,l.createElement(a.SubmitBar,{label:u("ES_COMMON_TAKE_ACTION"),onSubmit:()=>S(!v)})))},SupervisorAreaAssignment:e=>{var n,i,o,r;let{config:s,onSelect:d,t:u,formData:c}=e;const E=Digit.ULBService.getCurrentTenantId(),[m,v]=t.useState((null==c||null===(n=c.areaAssignment)||void 0===n?void 0:n.zone)||null),[S,p]=t.useState((null==c||null===(i=c.areaAssignment)||void 0===i?void 0:i.cluster)||null),[_,D]=t.useState((null==c||null===(o=c.areaAssignment)||void 0===o?void 0:o.ward)||null),[R,N]=t.useState((null==c||null===(r=c.areaAssignment)||void 0===r?void 0:r.areas)||[]),[g,y]=t.useState([]),[T,I]=t.useState([]),[C,O]=t.useState([]),[A,f]=t.useState([]),{data:b,isLoading:h}=Digit.Hooks.useCommonMDMS(E,"egov-location",["TenantBoundary"]);t.useEffect(()=>{if(b){var e,t,l,n;const a=null==b||null===(e=b.MdmsRes)||void 0===e||null===(t=e["egov-location"])||void 0===t||null===(l=t.TenantBoundary)||void 0===l||null===(n=l[0])||void 0===n?void 0:n.boundary;a&&a.children&&y(a.children)}},[b]),t.useEffect(()=>{var e,t;m?(I(m.children||[]),m.code!==(null==c||null===(e=c.areaAssignment)||void 0===e||null===(t=e.zone)||void 0===t?void 0:t.code)&&(p(null),D(null),N([]))):I([])},[m]),t.useEffect(()=>{var e,t;S?(O(S.children||[]),S.code!==(null==c||null===(e=c.areaAssignment)||void 0===e||null===(t=e.cluster)||void 0===t?void 0:t.code)&&(D(null),N([]))):O([])},[S]),t.useEffect(()=>{var e,t;_?(f(_.children||[]),_.code!==(null==c||null===(e=c.areaAssignment)||void 0===e||null===(t=e.ward)||void 0===t?void 0:t.code)&&N([])):f([])},[_]);const V=(e,t)=>{const l={...null==c?void 0:c.areaAssignment,[e]:t};"zone"===e?(l.cluster=null,l.ward=null,l.areas=[]):"cluster"===e?(l.ward=null,l.areas=[]):"ward"===e&&(l.areas=[]),d(s.key,l)};return h?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,u("ES_VENDOR_SUPERVISOR_ZONE")+" *"),l.createElement(a.Dropdown,{selected:m,option:g,select:e=>{v(e),V("zone",e)},optionKey:"name",t:u})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,u("ES_VENDOR_SUPERVISOR_CLUSTER")+" *"),l.createElement(a.Dropdown,{selected:S,option:T,select:e=>{p(e),V("cluster",e)},optionKey:"name",t:u,disable:!m})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,u("ES_VENDOR_SUPERVISOR_WARD")+" *"),l.createElement(a.Dropdown,{selected:_,option:C,select:e=>{D(e),V("ward",e)},optionKey:"name",t:u,disable:!S})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,null,u("ES_VENDOR_SUPERVISOR_AREA")+" *"),l.createElement(a.MultiSelectDropdown,{options:A,selected:R,onSelect:e=>{N(e),V("areas",e)},optionsKey:"name",t:u,disable:!_})))},AddSurveyor:e=>{var n;const o=Digit.ULBService.getCurrentTenantId(),{t:s}=i.useTranslation(),[d,u]=t.useState(null),c=r.useQueryClient(),[E,m]=t.useState(!1),{mutate:v}=Digit.Hooks.fsm.useSurveyorCreate(o),{data:S}=Digit.Hooks.fsm.useVendorSearch(o,{status:"ACTIVE"}),p=[{code:"MGR1",name:"John Doe (Agency Admin)"},{code:"SUP1",name:"Jane Smith (Supervisor)"}],_=function(e,t,n,a){return void 0===t&&(t=[]),void 0===n&&(n=[]),[{head:"ES_VENDOR_SURVEYOR_BASIC_DETAILS",body:[{label:"ES_VENDOR_SURVEYOR_FULL_NAME",isMandatory:!0,type:"text",populators:{name:"fullName",validation:{required:!0,pattern:/^[A-Za-z\s]+$/},error:e("ES_VENDOR_INVALID_NAME")}},{label:"ES_VENDOR_SURVEYOR_MOBILE_NUMBER",isMandatory:!0,type:"mobileNumber",populators:{name:"mobileNumber",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:e("ES_VENDOR_INVALID_MOBILE")}},{label:"ES_VENDOR_SURVEYOR_EMAIL_ID",isMandatory:!0,type:"text",populators:{name:"emailId",validation:{required:!0,pattern:/^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/},error:e("ES_VENDOR_INVALID_EMAIL")}},{label:"ES_VENDOR_SURVEYOR_STAFF_CODE",isMandatory:!0,type:"text",populators:{name:"employeeId",validation:{required:!0}}},{label:"ES_VENDOR_SURVEYOR_GENDER",isMandatory:!1,type:"component",key:"selectGender",component:"SelectGender",texts:{header:"CS_COMMON_CHOOSE_GENDER",cardText:"CS_COMMON_SELECT_GENDER",submitBarLabel:"CS_COMMON_NEXT"}}]},{head:"ES_VENDOR_SURVEYOR_ROLE_ACCESS",body:[{label:"ES_VENDOR_SURVEYOR_ROLE",isMandatory:!0,type:"custom",populators:{name:"role",component:(t,n)=>l.createElement(x,{option:[{code:"SURVEYOR",name:"Surveyor"}],optionKey:"name",select:t.onChange,selected:t.value,t:e,disable:!0}),defaultValue:{code:"SURVEYOR",name:"Surveyor"}}},{label:"ES_VENDOR_SURVEYOR_AGENCY_NAME",isMandatory:!0,type:"custom",populators:{name:"agencyName",component:(n,a)=>l.createElement(x,{option:t,optionKey:"name",select:n.onChange,selected:n.value,t:e})}},{label:"ES_VENDOR_SURVEYOR_REPORTING_MANAGER",isMandatory:!1,type:"custom",populators:{name:"reportingManager",component:(t,a)=>l.createElement(x,{option:n,optionKey:"name",select:t.onChange,selected:t.value,t:e})}}]},{head:"ES_VENDOR_SURVEYOR_AREA_ASSIGNMENT",body:[{isMandatory:!0,type:"component",key:"areaAssignment",component:"SupervisorAreaAssignment",withoutLabel:!0}]}]}(s,(null==S||null===(n=S.vendor)||void 0===n?void 0:n.map(e=>({code:e.id,name:e.name,...e})))||[],p),{supervisorId:D}=Digit.Hooks.useQueryParams(),R={role:{code:"SURVEYOR",name:"Surveyor"},reportingManager:p.find(e=>e.code===D)||null},N=()=>{u(null)};return l.createElement(l.Fragment,null,l.createElement(a.VerticalTimeline,{config:[{route:"surveyor-details",timeLine:[{actions:s("ES_VENDOR_SURVEYOR_DETAILS"),currentStep:1}]}],currentActiveIndex:0,showFinalStep:!1}),l.createElement("div",{style:{flex:"1",overflowY:"auto"}},l.createElement(a.FormComposer,{isDisabled:!E,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:_.map(e=>({...e,isCollapsible:!0,isDefaultOpen:!0})),fieldStyle:{marginRight:0},onSubmit:e=>{var t,l,n;const a={surveyor:{tenantId:o,name:null==e?void 0:e.fullName,employeeId:null==e?void 0:e.employeeId,status:"ACTIVE",owner:{tenantId:o,name:null==e?void 0:e.fullName,gender:(null==e||null===(t=e.gender)||void 0===t?void 0:t.code)||"OTHERS",emailId:null==e?void 0:e.emailId,mobileNumber:null==e?void 0:e.mobileNumber},vendorSurveyorStatus:"ACTIVE",additionalDetails:{agencyId:null==e||null===(l=e.agencyName)||void 0===l?void 0:l.code,reportingManager:null==e||null===(n=e.reportingManager)||void 0===n?void 0:n.code,areaAssignment:null==e?void 0:e.areaAssignment}}};v(a,{onError:e=>{u({key:"error",action:e}),setTimeout(N,5e3)},onSuccess:()=>{u({key:"success",action:"ADD_SURVEYOR"}),c.invalidateQueries("SURVEYOR_SEARCH"),setTimeout(N,5e3)}})},defaultValues:R,onFormValueChange:(e,t)=>{var l,n,a,i;const o=(null==t||null===(l=t.areaAssignment)||void 0===l?void 0:l.zone)&&(null==t||null===(n=t.areaAssignment)||void 0===n?void 0:n.ward)&&(null==t||null===(a=t.areaAssignment)||void 0===a||null===(i=a.areas)||void 0===i?void 0:i.length)>0;m(!!((null==t?void 0:t.fullName)&&(null==t?void 0:t.mobileNumber)&&(null==t?void 0:t.emailId)&&(null==t?void 0:t.employeeId)&&(null==t?void 0:t.agencyName)&&o))},noBreakLine:!0,mode:"onChange",noCard:!0}),d&&l.createElement(a.Toast,{error:"error"===d.key,label:s("success"===d.key?`ES_VENDOR_${d.action}_SUCCESS`:d.action),onClose:N})))},SurveyorDetails:e=>{var o,s;const d=Digit.ULBService.getCurrentTenantId(),{t:u}=i.useTranslation(),c=n.useHistory(),E=r.useQueryClient(),{id:m}=n.useParams(),[v,S]=t.useState(!1),[p,_]=t.useState(null),[D,R]=t.useState(!1),[N,g]=t.useState(null),[y,T]=t.useState([]),[I,C]=t.useState({}),{data:O,isLoading:A,refetch:f}=Digit.Hooks.fsm.useSurveyorDetails(d,{ids:m},{staleTime:Infinity}),{data:b}=Digit.Hooks.fsm.useDsoSearch(d,{sortBy:"name",sortOrder:"ASC",status:"ACTIVE"},{}),{mutate:h}=Digit.Hooks.fsm.useSurveyorUpdate(d),{mutate:V}=Digit.Hooks.fsm.useVendorUpdate(d);t.useEffect(()=>{if(b){let e=b.map(e=>e.dsoDetails);T(e)}},[b]),t.useEffect(()=>{f()},[]),t.useEffect(()=>{switch(p){case"DELETE":case"ADD_VENDOR":case"EDIT_VENDOR":case"DELETE_VENDOR":return R(!0);case"EDIT":return c.push("/digit-ui/employee/vendor/modify-surveyor/"+m);case"HOME":return c.push("/digit-ui/employee/vendor/search-vendor?selectedTabs=SURVEYOR")}},[p]);const M=()=>{g(null)},w=()=>{_(null),C({}),R(!1)};return A?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"employee-form-content"},l.createElement(a.Card,{style:{position:"relative",backgroundColor:"#fff"}},null==O||null===(o=O[0])||void 0===o||null===(s=o.employeeResponse)||void 0===s?void 0:s.map((e,t)=>{var n;return l.createElement(l.Fragment,{key:t},t>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},u(e.title)),l.createElement(a.Card,{className:"card-with-background",style:{margin:"10px 16px",padding:"20px"}},l.createElement("div",{className:"additional-grid"},null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,t)=>l.createElement(l.Fragment,{key:t},l.createElement("div",{className:"additional-label"},u(e.title)),"custom"===(null==e?void 0:e.type)?l.createElement("div",{className:"additional-value",style:{color:"#a82227",display:"flex",gap:"20px",alignItems:"center"}},u(e.value)||"N/A","ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"===e.value&&l.createElement("span",{className:"add-details-link hover-button",onClick:()=>_("ADD_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.AddIcon,{fill:"#a82227"})),"ES_FSM_REGISTRY_DETAILS_ADD_VENDOR"!==e.value&&l.createElement(l.Fragment,null,l.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("EDIT_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.EditIcon,null)),l.createElement("div",{className:"add-details-link hover-button",onClick:()=>_("DELETE_VENDOR"),style:{cursor:"pointer"}},l.createElement(a.DeleteIcon,{fill:"#a82227"})))):l.createElement("div",{className:"additional-value"},u(e.value)||"N/A"))))))}))),D&&l.createElement(a.Modal,{headerBarMain:l.createElement(H,{label:u((()=>{switch(p){case"DELETE":case"DELETE_VENDOR":return"ES_VENDOR_SURVEYOR_DELETE_POPUP_HEADER";case"ADD_VENDOR":case"EDIT_VENDOR":return"ES_VENDOR_SURVEYOR_ADD_VENDOR_POPUP_HEADER"}})())}),headerBarEnd:l.createElement(U,{onClick:w}),actionCancelLabel:u("CS_COMMON_CANCEL"),actionCancelOnSubmit:w,actionSaveLabel:u("DELETE"===p||"DELETE_VENDOR"===p?"ES_EVENT_DELETE":"CS_COMMON_SUBMIT"),actionSaveOnSubmit:()=>{switch(p){case"DELETE":return(()=>{var e;const t={surveyor:{...null==O||null===(e=O[0])||void 0===e?void 0:e.surveyorData,status:"INACTIVE"}};h(t,{onError:e=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"DELETE_SURVEYOR"}),E.invalidateQueries("SURVEYOR_SEARCH"),setTimeout(()=>{M(),c.push("/digit-ui/employee/vendor/search-vendor")},5e3)}}),R(!1)})();case"DELETE_VENDOR":return(()=>{var e,t,l;let n=null==O||null===(e=O[0])||void 0===e||null===(t=e.vendorDetails)||void 0===t||null===(l=t.vendor)||void 0===l?void 0:l[0],a=(null==n?void 0:n.surveyors)||[];a=a.map(e=>(e.id===m&&(e.vendorSurveyorStatus="INACTIVE"),e));const i={vendor:{...n,surveyors:a}};V(i,{onError:e=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"DELETE_VENDOR"}),E.invalidateQueries("FSM_VENDOR_SEARCH"),f(),setTimeout(M,5e3)}}),R(!1)})();case"ADD_VENDOR":return(()=>{var e;let t=I,l=null==O||null===(e=O[0])||void 0===e?void 0:e.surveyorData;l.vendorSurveyorStatus="ACTIVE";const n={vendor:{...t,surveyors:t.surveyors?[...t.surveyors,l]:[l]}};V(n,{onError:e=>{g({key:"error",action:e}),f(),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"ADD_VENDOR"}),E.invalidateQueries("SURVEYOR_SEARCH"),f(),setTimeout(M,5e3)}}),R(!1),_(null)})();case"EDIT_VENDOR":return(()=>{var e;let t=I,l=null==O||null===(e=O[0])||void 0===e?void 0:e.surveyorData;l.vendorSurveyorStatus="ACTIVE";const n={vendor:{...t,surveyors:t.surveyors?[...t.surveyors,l]:[l]}};V(n,{onError:e=>{g({key:"error",action:e}),setTimeout(M,5e3)},onSuccess:()=>{g({key:"success",action:"EDIT_VENDOR"}),f(),E.invalidateQueries("SURVEYOR_SEARCH"),setTimeout(M,5e3)}}),R(!1),_(null)})()}}},l.createElement(a.Card,{style:{boxShadow:"none"}},"DELETE"===p||"DELETE_VENDOR"===p?l.createElement(L,{t:u,title:"ES_VENDOR_SURVEYOR_DELETE_TEXT"}):"ADD_VENDOR"===p||"EDIT_VENDOR"===p?l.createElement(l.Fragment,null,l.createElement(a.CardText,null,u("ES_FSM_REGISTRY_SELECT_VENODOR")),l.createElement(a.Dropdown,{t:u,option:y,value:I,selected:I,select:C,optionKey:"name"})):void 0)),N&&l.createElement(a.Toast,{error:"error"===N.key,label:u("success"===N.key?`ES_VENDOR_${N.action}_SUCCESS`:N.action),onClose:M}),l.createElement(a.ActionBar,{style:{zIndex:"19"}},v?l.createElement(a.Menu,{localeKeyPrefix:"ES_VENDOR_SURVEYOR_ACTION",options:["EDIT","DELETE"],t:u,onSelect:e=>{S(!1),_(e)}}):null,l.createElement(a.SubmitBar,{label:u("ES_COMMON_TAKE_ACTION"),onSubmit:()=>S(!v)})))}},ie=e=>{let{userType:a,tenants:i}=e;const{path:o,url:r}=n.useRouteMatch();return Object.entries(ae).forEach(e=>{let[t,l]=e;Digit.ComponentRegistryService.setComponent(t,l)}),Digit.SessionStorage.set("VENDOR_TENANTS",i),t.useEffect(()=>"employee"===a&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),l.createElement("employee"===a?d:M,{path:o,url:r,userType:a})},oe=e=>{const[,,l]=Digit.Hooks.useSessionStorage("VENDOR",{});return t.useEffect(()=>{l()},[]),null};exports.VENDORComponents={VENDORCard:()=>{const{t:e}=i.useTranslation(),t=n.useHistory(),o=window.location.pathname.toLowerCase().includes("citizen");if(!Digit.Utils.vendorAccess()&&!Digit.UserService.hasAccess(["WT_VENDOR","MT_VENDOR"]))return null;const r=[{label:e("VENDOR_NEW_REGISTERATION"),link:o?"/digit-ui/citizen/vendor/registry/new-vendor":"/digit-ui/employee/vendor/registry/new-vendor"},{label:e("SEARCH_VENDOR"),link:o?"/digit-ui/citizen/vendor/search-vendor":"/digit-ui/employee/vendor/search-vendor"}],s=Digit.UserService.hasAccess(["WT_VENDOR"]),d={Icon:l.createElement(a.PropertyHouse,null),moduleName:e("TITLE_VENDOR_MANAGEMENT"),kpis:[{count:0,label:e("Inbox"),link:o?"/digit-ui/citizen/vendor/search-vendor":"/digit-ui/employee/vendor/search-vendor"}],links:r.filter(e=>!(null!=e&&e.role)||s),...o?{onDetailsClick:()=>t.push("/digit-ui/citizen/vendor/search-vendor")}:{}};return o?l.createElement("div",{className:"wt-citizen-card-premium"},l.createElement(a.EmployeeModuleCard,d)):l.createElement(a.EmployeeModuleCard,d)},VENDORModule:ie,VENDORLinks:oe},exports.VENDORLinks=oe,exports.VENDORModule=ie;
|