@mseva/upyog-ui-module-asset 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -0
  2. package/package.json +39 -0
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@mseva/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),i=require("react-router-dom"),o=require("react-hook-form"),r=e(require("jspdf")),s=e(require("qrcode")),u=require("xlsx");require("jspdf-autotable");var d=require("react-query"),c=require("@upyog/digit-ui-react-components"),m=e(require("exif-js"));function v(){return(v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function p(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}const E=function(){function e(){}return e.prototype.then=function(t,n){const l=new e,a=this.s;if(a){const e=1&a?t:n;if(e){try{f(l,1,e(this.v))}catch(e){f(l,2,e)}return l}return this}return this.o=function(e){try{const a=e.v;1&e.s?f(l,1,t?t(a):a):n?f(l,1,n(a)):f(l,2,a)}catch(e){f(l,2,e)}},l},e}();function f(e,t,n){if(!e.s){if(n instanceof E){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const l=e.o;l&&l(e)}}function g(e){return e instanceof E&&1&e.s}function S(e,t,n){for(var l;;){var a=e();if(g(a)&&(a=a.v),!a)return i;if(a.then){l=0;break}var i=n();if(i&&i.then){if(!g(i)){l=1;break}i=i.s}if(t){var o=t();if(o&&o.then&&!g(o)){l=2;break}}}var r=new E,s=f.bind(null,r,2);return(0===l?a.then(d):1===l?i.then(u):o.then(c)).then(void 0,s),r;function u(l){i=l;do{if(t&&(o=t())&&o.then&&!g(o))return void o.then(c).then(void 0,s);if(!(a=e())||g(a)&&!a.v)return void f(r,1,i);if(a.then)return void a.then(d).then(void 0,s);g(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,s)}function d(e){e?(i=n())&&i.then?i.then(u).then(void 0,s):u(i):f(r,1,i)}function c(){(a=e())?a.then?a.then(d).then(void 0,s):d(a):f(r,1,i)}}function h(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const y=e=>{let{isLoading:a,t:u,onSubmit:d,data:c,count:m,setShowToast:v,ActionBarStyle:p={},MenuStyle:E={},tenantId:f}=e;const g=window.Digit.Utils.browser.isMobile(),_=new Date,y=_.toISOString().split("T")[0],A=i.useHistory(),C=new Date(_);C.setDate(_.getDate()-7);const D=C.toISOString().split("T")[0],{register:b,control:T,handleSubmit:I,setValue:O,getValues:N,reset:R}=o.useForm({defaultValues:{offset:0,limit:!g&&10,sortBy:"commencementDate",sortOrder:"DESC",fromDate:D,toDate:y}});n.useEffect(()=>{b("offset",0),b("limit",10),b("sortBy","commencementDate"),b("sortOrder","DESC"),O("fromDate",D),O("toDate",y)},[b,O,y,D]);var x=window.location.origin;const{data:L}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"Action"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Action}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"ActionOption"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ActionOption;return null==n?void 0:n.filter(e=>!0===e.active)}}),M=e=>l.createElement("span",{className:"cell-text"},e),F=n.useMemo(()=>[{Header:u("ES_ASSET_RESPONSE_CREATE_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,n;let{row:a}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null===(t=a.original)||void 0===t?void 0:t.applicationNo)},null===(n=a.original)||void 0===n?void 0:n.applicationNo)))}},{Header:u("AST_BOOK_REF_SERIAL_NUM"),Cell:e=>{var t,n;return M(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetBookRefNo))},disableSortBy:!0},{Header:u("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:u("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:u("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return M(""+u("COMMON_MASTERS_DEPARTMENT_"+(null==n||null===(t=n.original)||void 0===t?void 0:t.department)))},disableSortBy:!0},{Header:u("AST_APPLICATION_STATUS"),Cell:e=>{var t;let{row:n}=e;return M(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.status))},disableSortBy:!0},{Header:u("AST_ACTIONS"),Cell:e=>{var a;let{row:o}=e;const[r,s]=n.useState(!1),d=n.useRef(),c=e=>{d.current&&!d.current.contains(e.target)&&s(!1)};l.useEffect(()=>(document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}),[]);const m=(e=>{const t=[];return w&&w.map(n=>{var l,a,i,o,r;if(null!=e&&null!==(l=e.original)&&void 0!==l&&null!==(a=l.assetAssignment)&&void 0!==a&&a.isAssigned&&"AST_RETURN"===n.code||(null==e||null===(i=e.original)||void 0===i||null===(o=i.assetAssignment)||void 0===o||!o.isAssigned)&&"AST_ASSIGN"===n.code)t.push({label:u(n.code),link:""+n.url+(null==e||null===(r=e.original)||void 0===r?void 0:r.applicationNo),code:n.code});else if("AST_RETURN"!==n.code&&"AST_ASSIGN"!==n.code){var s;t.push({label:u(n.code),link:""+n.url+(null==e||null===(s=e.original)||void 0===s?void 0:s.applicationNo),code:n.code})}}),t})(o);return l.createElement("div",{ref:d},"APPROVED"===(null==o||null===(a=o.original)||void 0===a?void 0:a.status)?l.createElement(l.Fragment,null,l.createElement(t.SubmitBar,{label:u("WF_TAKE_ACTION"),onSubmit:()=>{s(!r)}}),r&&l.createElement("div",{style:{position:"absolute",backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",padding:"8px",zIndex:1e3}},m.filter(e=>{var t;return"0"!==(null==o||null===(t=o.original)||void 0===t?void 0:t.assetStatus)||"AST_CERTIFICATE"===e.code}).map((e,t)=>"AST_CERTIFICATE"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e){try{return Promise.resolve(Digit.ASSETService.search({tenantId:f,filters:{applicationNo:e}})).then(function(e){var t;return Promise.resolve(Digit.PaymentService.generatePdf(f,{Assets:[null==e||null===(t=e.Assets)||void 0===t?void 0:t[0]]},"asset-report")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(f,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[null==e?void 0:e.filestoreIds[0]],"_blank")})})})}catch(e){return Promise.reject(e)}}(null===(e=o.original)||void 0===e?void 0:e.applicationNo)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):"AST_DEPRECIATION"===e.code?l.createElement("div",{key:t,onClick:()=>{var e;return function(e,t){try{const e=h(function(){return Promise.resolve(Digit.ASSETService.depriciationProcess({Asset:{tenantId:f,id:t,accountId:""}})).then(function(e){e&&A.replace("/digit-ui/employee/asset/assetservice/asset-process-depreciation-response",{ProcessDepreciation:e})})},function(){v({error:!0,label:u("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(0,null===(e=o.original)||void 0===e?void 0:e.id)},style:{display:"block",padding:"8px",textDecoration:"none",color:"black",cursor:"pointer"}},e.label):l.createElement(i.Link,{key:t,to:e.link,style:{display:"block",padding:"8px",textDecoration:"none",color:"black"}},e.label)))):u("AST_SHOULD_BE_APPROVED_FIRST"))},mobileCell:e=>{var t;return GetMobCell(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],[]),B=n.useCallback(e=>{0!==e.length&&(O("sortBy",e.id),O("sortOrder",e.desc?"DESC":"ASC"))},[O]);function k(){O("offset",N("offset")-N("limit")),I(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,u("ASSET_APPLICATIONS")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},u("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:I},l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_STATUS")),l.createElement(o.Controller,{control:T,name:"status",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:P,optionKey:"i18nKey",t:u,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_APPLICATION_ID")),l.createElement(t.TextInput,{name:"applicationNo",inputRef:b({})})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"fromDate",control:T})),l.createElement(t.SearchField,null,l.createElement("label",null,u("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:y}),name:"toDate",control:T})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:u("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{R({applicationNo:"",fromDate:D,toDate:y,status:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),v(null),k()}},u("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=S(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l);console.log("comming data:- ",e);const i=e.map(function(e,a){try{return Promise.resolve(n(x+"/digit-ui/citizen/assets/services?tenantId="+f+"&applicationNo="+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text("Track: "+e.location,70,70+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(i)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},u(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:u,data:c,totalRecords:m,columns:F,getCellProps:e=>({style:{minWidth:e.column.Header===u("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){O("limit",Number(e.target.value)),I(d)()},currentPage:N("offset")/N("limit"),onNextPage:function(){O("offset",N("offset")+N("limit")),I(d)()},onPrevPage:k,pageSizeLimit:N("limit"),onSort:B,disableSort:!1,sortParams:[{id:N("sortBy"),desc:"DESC"===N("sortOrder")}]})))},A=e=>{let{parentRoute:o}=e;i.useParams();const{t:r}=a.useTranslation(),s=Digit.ULBService.getCurrentTenantId(),[u,d]=n.useState({}),[c,m]=n.useState(null),p={enabled:!!(u&&Object.keys(u).length>0)},{isLoading:E,isSuccess:f,data:{Assets:g,Count:S}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:s,filters:u},p);return n.useEffect(()=>{if(c){const e=setTimeout(()=>{m(null)},1500);return()=>clearTimeout(e)}},[c]),l.createElement(l.Fragment,null,l.createElement(y,{t:r,isLoading:E,parentRoute:o,tenantId:s,setShowToast:m,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);const l=v({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>v({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.applicationNo||a.creationReason||a.fromDate||a.mobileNumber||a.applicationNo||a.status||a.toDate?!(Object.entries(a).length>0&&(a.creationReason||a.status))||a.applicationNo||a.fromDate||a.mobileNumber||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?m({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):d(a):m({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):m({warning:!0,label:"ERR_VALID_FIELDS"})},data:f&&!E?g.length>0?g:{display:"ES_COMMON_NO_DATA"}:"",count:S}),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:r(c.label),isDleteBtn:!0,onClose:()=>{m(null)}}))},C=e=>{let{isLoading:a,t:i,onSubmit:d,data:c,count:m,setShowToast:v}=e;const p=window.Digit.Utils.browser.isMobile(),E=(new Date).toISOString().split("T")[0],f=(Digit.UserService.getUser(),Digit.Hooks.asset.useTenants()),{register:g,control:_,handleSubmit:h,setValue:y,getValues:A,reset:C}=o.useForm({defaultValues:{offset:0,limit:!p&&10,sortBy:"commencementDate",sortOrder:"DESC"}});n.useEffect(()=>{g("offset",0),g("limit",10),g("sortBy","commencementDate"),g("sortOrder","DESC")},[g]);const D=Digit.ULBService.getStateId(),{data:b}=Digit.Hooks.asset.useAssetClassification(D,"ASSET","assetClassification");let T=[];b&&b.map(e=>{T.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:I}=Digit.Hooks.asset.useAssetType(D,"ASSET","assetParentCategory");let O=[];I&&I.map(e=>{O.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const N=e=>l.createElement("span",{className:"cell-text"},e),R=n.useMemo(()=>[{Header:i("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var t,n;return N(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.applicationNo))},disableSortBy:!0},{Header:i("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n;return N(""+(null==e||null===(t=e.row)||void 0===t||null===(n=t.original)||void 0===n?void 0:n.assetClassification))},disableSortBy:!0},{Header:i("AST_PARENT_CATEGORY_LABELaaa"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetParentCategory))},disableSortBy:!0},{Header:i("AST_NAME_LABEL"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetName))},disableSortBy:!0},{Header:i("AST_TYPE"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.assetSubCategory))},disableSortBy:!0},{Header:i("AST_DEPARTMENT_LABEL"),Cell:e=>{var t;let{row:n}=e;return N(""+(null==n||null===(t=n.original)||void 0===t?void 0:t.department))},disableSortBy:!0}],[]),x=n.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function L(){y("offset",A("offset")-A("limit")),h(d)()}return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(t.Header,null,i("AST_REPORTS_CHECK")),l.createElement(t.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},i("Provide at least one parameter to search for an application"))),l.createElement(t.SearchForm,{onSubmit:d,handleSubmit:h},l.createElement(t.SearchField,null,l.createElement("label",null,i("MYCITY_CODE_LABEL")),l.createElement(o.Controller,{control:_,name:"city",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:f,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_PARENT_CATEGORY_LABEL")),l.createElement(o.Controller,{control:_,name:"assetParentCategory",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:O,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_FROM_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"fromDate",control:_})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_TO_DATE")),l.createElement(o.Controller,{render:e=>l.createElement(t.DatePicker,{date:e.value,disabled:!1,onChange:e.onChange,max:E}),name:"toDate",control:_})),l.createElement(t.SearchField,null,l.createElement("label",null,i("AST_ASSET_CATEGORY_LABEL")),l.createElement(o.Controller,{control:_,name:"assetClassification",render:e=>l.createElement(t.Dropdown,{selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:i,disable:!1})})),l.createElement(t.SearchField,{className:"submit"},l.createElement(t.SubmitBar,{label:i("ES_COMMON_SEARCH"),submit:!0}),l.createElement("p",{style:{marginTop:"10px"},onClick:()=>{C({applicationNo:"",city:"",fromDate:"",toDate:"",assetClassification:"",assetParentCategory:"",pincode:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC"}),v(null),L()}},i("ES_COMMON_CLEAR_ALL")))),l.createElement("br",null),""!==c?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"10px"}},l.createElement("button",{onClick:()=>{const e=new r("landscape"),t=["S.No",...R.map(e=>i(e.Header))],n=c.map((e,t)=>[t+1,e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,e.assetSubCategory,e.department]);e.autoTable({head:[t],body:n}),e.save("Asset-Reports.pdf")},style:{color:"maroon",border:"2px solid #333",padding:"8px 16px",cursor:"pointer",marginRight:"10px"}},"Download PDF"),l.createElement("button",{onClick:()=>{const e=R.map(e=>i(e.Header)),t=c.map(e=>{var t;return[e.applicationNo,e.assetClassification,e.assetParentCategory,e.assetName,null===(t=e.addressDetails)||void 0===t?void 0:t.pincode,e.department]}),n=u.utils.aoa_to_sheet([e,...t]),l=u.utils.book_new();u.utils.book_append_sheet(l,n,"Asset Report"),u.writeFile(l,"Asset-Reports.xlsx")},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer"}},"Download XLS"),l.createElement("button",{onClick:function(){try{function e(){t.save("Asset-QR-Reports.pdf")}const t=new r,n=function(e){try{return Promise.resolve(s.toDataURL(e))}catch(e){return Promise.reject(e)}};t.setFontSize(16),t.text("Asset QR Code Report",70,10);const l=3;let a=0;const i=S(function(){return a<c.length},function(){return!!(a+=l)},function(){const e=c.slice(a,a+l).map(function(e,a){try{return Promise.resolve(n("https://niuatt.niua.in/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+e.applicationNo)).then(function(n){const i=a%l*90;t.addImage(n,"JPEG",10,20+i,50,50),t.setFontSize(12),t.text("Application No: "+e.applicationNo,70,30+i),t.text("Asset Classification: "+e.assetClassification,70,40+i),t.text("Asset Parent Category: "+e.assetParentCategory,70,50+i),t.text("Asset Name: "+e.assetName,70,60+i),t.text('Location: "https://www.google.com/maps/search/%7B%7BaddressDetailsLat%7D%7D,%7B%7BaddressDetailsLong/@28.588163,77.2308992,15z/data=!3m1!4b1?entry=ttu&g_ep=EgoyMDI0MTIxMS4wIKXMDSoASAFQAw%3D%3D"',70,60+i),t.line(10,80+i,200,80+i)})}catch(e){return Promise.reject(e)}});return Promise.resolve(Promise.all(e)).then(function(){a+l<c.length&&t.addPage()})});return Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}},style:{color:"maroon",border:"2px solid #333",padding:"10px 20px",cursor:"pointer",marginLeft:"15px"}},"Download QR Report")):"",l.createElement("br",null),!a&&null!=c&&c.display?l.createElement(t.Card,{style:{marginTop:20}},i(c.display).split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):a||""===c?""!==c||a&&l.createElement(t.Loader,null):l.createElement(t.Table,{t:i,data:c,totalRecords:m,columns:R,getCellProps:e=>({style:{minWidth:e.column.Header===i("ASSET_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){y("limit",Number(e.target.value)),h(d)()},currentPage:A("offset")/A("limit"),onNextPage:function(){y("offset",A("offset")+A("limit")),h(d)()},onPrevPage:L,pageSizeLimit:A("limit"),onSort:x,disableSort:!1,sortParams:[{id:A("sortBy"),desc:"DESC"===A("sortOrder")}]})))},D=e=>{i.useParams();const{t:o}=a.useTranslation(),r=Digit.ULBService.getCurrentTenantId(),[s,u]=n.useState({}),[d,c]=n.useState(null),m={enabled:!!(s&&Object.keys(s).length>0)},{isLoading:p,isSuccess:E,data:{Assets:f,Count:g}={}}=Digit.Hooks.asset.useASSETSearch({tenantId:r,filters:s},m);return l.createElement(l.Fragment,null,l.createElement(C,{t:o,isLoading:p,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 n=new Date(null==e?void 0:e.toDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())+86399-19800);const l=v({},e,e.toDate?{toDate:null==n?void 0:n.getTime()}:{},e.fromDate?{fromDate:null==t?void 0:t.getTime()}:{});let a=Object.keys(l).filter(e=>l[e]).reduce((e,t)=>v({},e,{[t]:"object"==typeof l[t]?l[t].code:l[t]}),{});!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.fromDate||a.applicationNo||a.toDate?!(Object.entries(a).length>0)||a.assetClassification||a.assetParentCategory||a.applicationNo||a.fromDate||a.applicationNo||a.toDate?Object.entries(a).length>0&&a.fromDate&&!a.toDate||!a.fromDate&&a.toDate?c({warning:!0,label:"ERR_PROVIDE_BOTH_FORM_TO_DATE"}):u(a):c({warning:!0,label:"ERR_PROVIDE_MORE_PARAM_WITH_TYPE_STATUS"}):c({warning:!0,label:"ERR_VALID_FIELDS"})},data:E&&!p?f.length>0?f:{display:"ES_COMMON_NO_DATA"}:"",count:g}),d&&l.createElement(t.Toast,{error:d.error,warning:d.warning,label:o(d.label),isDleteBtn:!0,onClose:()=>{c(null)}}))},b=e=>{let{t:n,currentPage:a,columns:i,data:o,getCellProps:r,disableSort:s,onSort:u,onNextPage:d,onPrevPage:c,onPageSizeChange:m,pageSizeLimit:v,sortParams:p,totalRecords:E}=e;return l.createElement(t.Table,{t:n,data:o,currentPage:a,columns:i,getCellProps:r,onNextPage:d,onPrevPage:c,pageSizeLimit:v,disableSort:s,onPageSizeChange:m,onSort:u,sortParams:p,totalRecords:E})},T=()=>{const{t:e}=a.useTranslation();return l.createElement(t.Card,{className:"employeeCard filter inboxLinks"},l.createElement("div",{className:"complaint-links-container"},l.createElement("div",{className:"header"},l.createElement("span",{className:"logo"},l.createElement(t.PropertyHouse,null))," ",l.createElement("span",{className:"text"},e("ASSET_SERVICE")))))},I={date:t.DatePicker,mobileNumber:t.MobileNumber},O=e=>{var n;let{onSearch:i,type:r,onClose:s,searchFields:u,searchParams:d,isInboxPage:c,clearSearch:m}=e;const{t:p}=a.useTranslation(),{handleSubmit:E,reset:f,watch:g,control:S,formState:_,setValue:h}=o.useForm({defaultValues:c?d:v({locality:null,city:null},d)}),y=g(),A=innerWidth<=640;function C(){const e=u.reduce((e,t)=>v({},e,{[null==t?void 0:t.name]:""}),{});if(f(e),c){const e=v({},d);e.delete=[],u.forEach(t=>{e.delete.push(null==t?void 0:t.name)}),i(v({},e))}else m()}const D=e=>l.createElement(t.LinkLabel,{style:v({display:"inline"},e?{margin:0}:{}),onClick:C},p("ES_COMMON_CLEAR_SEARCH"));return l.createElement("form",{onSubmit:E(e=>{e.mobileNumber||delete e.mobileNumber,e.delete=[],u.forEach(t=>{e[t.name]||e.delete.push(t.name)}),i(e),"mobile"===r&&s()})},l.createElement(l.Fragment,null,l.createElement("div",{className:"search-container",style:{width:"auto",marginLeft:c?"24px":"revert"}},l.createElement("div",{className:"search-complaint-container"},("mobile"===r||A)&&l.createElement("div",{className:"complaint-header"},l.createElement("h2",null,p("ES_COMMON_SEARCH_BY")),l.createElement("span",{onClick:s},l.createElement(t.CloseSvg,null))),l.createElement("div",{className:"complaint-input-container for-pt "+(c?"":"for-search"),style:{width:"100%",display:"grid"}},null==u||null===(n=u.filter(e=>!0))||void 0===n?void 0:n.map((e,n)=>{var a,i,r;return l.createElement("div",{key:e.name,className:"input-fields"},l.createElement("span",{className:"mobile-input"},l.createElement(t.Label,null,p(e.label)+" "+(e.isMendatory?"*":"")),l.createElement(o.Controller,e.type?{render:t=>l.createElement(null==I?void 0:I[e.type],{formValue:y,setValue:h,onChange:t.onChange,value:t.value}),name:e.name,control:S,defaultValue:""}:{render:e=>l.createElement(t.TextInput,{onChange:e.onChange,value:e.value}),name:e.name,control:S,defaultValue:""})),null!=_&&null!==(a=_.dirtyFields)&&void 0!==a&&a[e.name]?l.createElement("span",{style:{fontWeight:"700",color:"rgba(212, 53, 28)",paddingLeft:"8px",marginTop:"-20px",fontSize:"12px"},className:"inbox-search-form-error"},null==_||null===(i=_.errors)||void 0===i||null===(r=i[e.name])||void 0===r?void 0:r.message):null)}),c&&l.createElement("div",{style:{gridColumn:"2/3",textAlign:"right",paddingTop:"10px"},className:"input-fields"},l.createElement("div",null,D())),"desktop"===r&&!A&&l.createElement("div",{style:{maxWidth:"unset",marginLeft:"unset"},className:"search-submit-wrapper"},l.createElement(t.SubmitBar,{className:"submit-bar-search",label:p("ES_COMMON_SEARCH"),disabled:!!Object.keys(_.errors).length||(()=>{var e;let t=!0;return Object.keys(y).forEach(e=>{!["locality","city"].includes(e)&&y[e]&&(t=!1)}),null==u||!u.find(e=>"locality"===e.name)||null!=y&&null!==(e=y.locality)&&void 0!==e&&e.code||(t=!0),t})(),submit:!0}),!c&&l.createElement("div",null,D()))))),("mobile"===r||A)&&l.createElement(t.ActionBar,{className:"clear-search-container"},l.createElement("button",{className:"clear-search",style:{flex:1}},D(A)),l.createElement(t.SubmitBar,{disabled:!!Object.keys(_.errors).length,label:p("ES_COMMON_SEARCH"),style:{flex:1},submit:!0}))))},N=["tableConfig","filterComponent"],R=e=>{let{tableConfig:i,filterComponent:o}=e,r=p(e,N);const{data:s,useNewInboxAPI:u}=r,{t:d}=a.useTranslation(),[c,m]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(o)}),[v,E]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(r.EmptyResultInboxComp)}),[f,g]=n.useState(!1),S=l.useMemo(()=>r.isSearch?i.searchColumns(r):i.inboxColumns(r)||[],[]);let _;return r.isLoading?_=l.createElement(t.Loader,null):f?_=null:!s||0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?_=v&&l.createElement(v,{data:s})||(0===(null==s?void 0:s.length)||u&&null!=s&&s[0].dataEmpty?l.createElement(t.Card,{style:{marginTop:20}},d("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))):l.createElement(t.Loader,null)):(null==s?void 0:s.length)>0&&(_=l.createElement(b,{t:d,data:s,columns:S,getCellProps:e=>({style:{minWidth:e.column.Header===d("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:r.onPageSizeChange,currentPage:r.currentPage,onNextPage:r.onNextPage,onPrevPage:r.onPrevPage,pageSizeLimit:r.pageSizeLimit,onSort:r.onSort,disableSort:r.disableSort,sortParams:r.sortParams,totalRecords:r.totalRecords})),l.createElement("div",{className:"inbox-container"},!r.isSearch&&l.createElement("div",{className:"filters-container"},l.createElement(T,{parentRoute:r.parentRoute,businessService:r.moduleCode}),l.createElement("div",null,l.createElement(c,{defaultSearchParams:r.defaultSearchParams,onFilterChange:r.onFilterChange,searchParams:r.searchParams,type:"desktop",useNewInboxAPI:u,statusMap:u?null==s?void 0:s[0].statusMap:null,moduleCode:r.moduleCode}))),l.createElement("div",{style:{flex:1}},l.createElement(O,{defaultSearchParams:r.defaultSearchParams,onSearch:e=>{r.onSearch(e),g(!1)},type:"desktop",searchFields:r.searchFields,isInboxPage:!(null!=r&&r.isSearch),searchParams:r.searchParams,clearSearch:()=>g(!0)}),l.createElement("div",{className:"result",style:{marginLeft:null!=r&&r.isSearch?"":"24px",flex:1}},_)))},x=e=>{const{t:i}=a.useTranslation(),[o,r]=n.useState(()=>{var t,n;return null!==(t=e.sortParams)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.desc?{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")}:{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}});function s(){}return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading"},l.createElement("div",{className:"filter-label"},i("SORT_BY"),":"),l.createElement("div",{className:"clearAll",onClick:s},i("ES_COMMON_CLEAR_ALL")),"desktop"===e.type&&l.createElement("span",{className:"clear-search",onClick:s},i("ES_COMMON_CLEAR_ALL")),"mobile"===e.type&&l.createElement("span",{onClick:e.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement(t.RadioButtons,{onSelect:function(t){e.onSort([{id:"createdTime",desc:"DESC"===t.code}]),e.onClose()},selectedOption:o,optionsKey:"name",options:[{code:"DESC",name:i("ES_INBOX_DATE_LATEST_FIRST")},{code:"ASC",name:i("ES_INBOX_DATE_LATEST_LAST")}]})))))},L=e=>{let{t:a,data:i,onFilterChange:o,onSearch:r,onSort:s,serviceRequestIdKey:u,isFstpOperator:d,isLoading:c,isSearch:m,searchParams:v,searchFields:p,sortParams:E,linkPrefix:f,filterComponent:g}=e;const[S,_]=n.useState(m?"SEARCH":""),[h,y]=n.useState(!!m),[A,C]=n.useState(E),[D]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent(g)});n.useEffect(()=>{S&&y(!0)},[S]);const b=()=>{y(!1),_(""),C(E)};if(c)return l.createElement(t.Loader,null);let T;return i&&0!==(null==i?void 0:i.length)?i&&(null==i?void 0:i.length)>0&&(T=l.createElement(t.DetailsCard,{data:i,serviceRequestIdKey:u,linkPrefix:f||"/digit-ui/employee/asset/"})):T=l.createElement(t.Card,{style:{marginTop:20}},a("CS_MYAPPLICATIONS_NO_APPLICATION").split("\\n").map((e,t)=>l.createElement("p",{key:t,style:{textAlign:"center"}},e))),l.createElement(l.Fragment,null,l.createElement("div",{className:"searchBox"},r&&l.createElement(t.SearchAction,{text:"SEARCH",handleActionClick:()=>{_("SEARCH"),y(!0)}}),!m&&o&&l.createElement(t.FilterAction,{text:"FILTER",handleActionClick:()=>{_("FILTER"),y(!0)}}),l.createElement(t.FilterAction,{text:"SORT",handleActionClick:()=>{_("SORT"),y(!0)}})),T,h&&l.createElement(t.PopUp,null,"FILTER"===S&&l.createElement("div",{className:"popup-module"},l.createElement(D,{onFilterChange:e=>{o(e),y(!1)},Close:b,type:"mobile",searchParams:v})),"SORT"===S&&l.createElement("div",{className:"popup-module"},l.createElement(x,{type:"mobile",sortParams:E,onClose:b,onSort:s})),"SEARCH"===S&&l.createElement("div",{className:"popup-module"},l.createElement(O,{type:"mobile",onClose:b,onSearch:r,isFstpOperator:d,searchParams:v,searchFields:p}))))},P=e=>{let{data:t,isLoading:n,isSearch:i,searchFields:o,onFilterChange:r,onSearch:s,onSort:u,parentRoute:d,searchParams:c,sortParams:m,linkPrefix:v,tableConfig:p,filterComponent:E}=e;const{t:f}=a.useTranslation();return l.createElement("div",{style:{padding:0}},l.createElement("div",{className:"inbox-container"},l.createElement("div",{className:"filters-container"},!i&&l.createElement(T,{classNameForMobileView:"linksWrapperForMobileInbox",linkPrefix:d,isMobile:!0}),l.createElement(L,{t:f,data:null==t?void 0:t.map(e=>{const t={};return(i?p.searchColumns():p.inboxColumns()).forEach(n=>{n.mobileCell&&(t[n.Header]=n.mobileCell(e))}),t}),onFilterChange:r,isLoading:n,isSearch:i,onSearch:s,onSort:u,searchParams:c,searchFields:o,linkPrefix:v,sortParams:m,serviceRequestIdKey:null==p?void 0:p.serviceRequestIdKey,filterComponent:E}))))},w=["isFetching","isLoading","searchResponseKey","data","searchFields"],M=e=>{var i,o,r,s,u;let{useNewInboxAPI:d,parentRoute:c,moduleCode:m="ASSET",initialStates:E={},filterComponent:f,isInbox:g,rawWfHandler:S,rawSearchHandler:_,combineResponse:h,wfConfig:y,searchConfig:A,middlewaresWf:C,middlewareSearch:D,EmptyResultInboxComp:b}=e;const T=Digit.ULBService.getCurrentTenantId(),{t:I}=a.useTranslation(),[O,N]=n.useState(()=>g?{}:{enabled:!1}),[x,L]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("ASTInboxTableConfig")}),[M,F]=n.useState(E.pageOffset||0),[B,k]=n.useState(E.pageSize||10),[U,H]=n.useState(E.sortParams||[{id:"createdTime",desc:!0}]),[j,W]=n.useState(E.searchParams||{});let V=window.Digit.Utils.browser.isMobile(),z=V?{limit:100,offset:0,sortBy:null==U||null===(i=U[0])||void 0===i?void 0:i.id,sortOrder:null!=U&&null!==(o=U[0])&&void 0!==o&&o.desc?"DESC":"ASC"}:{limit:B,offset:M,sortBy:null==U||null===(r=U[0])||void 0===r?void 0:r.id,sortOrder:null!=U&&null!==(s=U[0])&&void 0!==s&&s.desc?"DESC":"ASC"};const G=d?Digit.Hooks.useNewInboxGeneral({tenantId:T,ModuleCode:m,filters:v({},j,z,{sortParams:U})}):Digit.Hooks.useInboxGeneral({tenantId:T,businessService:m,isInbox:g,filters:v({},j,z,{sortParams:U}),rawWfHandler:S,rawSearchHandler:_,combineResponse:h,wfConfig:y,searchConfig:v({},O,A),middlewaresWf:C,middlewareSearch:D}),{isLoading:K,data:q,searchFields:Y}=G,$=p(G,w);n.useEffect(()=>{F(0)},[j]);const Z=e=>{let t=e.delete,n=v({},j,e);t&&t.forEach(e=>delete n[e]),delete e.delete,W(v({},n)),N({enabled:!0})},Q=n.useCallback(e=>{0!==e.length&&H(e)},[]);var X,J;if(null!==(null==$||null===(u=$.data)||void 0===u?void 0:u.length))return V?l.createElement(P,{data:q,isLoading:K,isSearch:!g,searchFields:Y,onFilterChange:Z,onSearch:Z,onSort:Q,parentRoute:c,searchParams:j,sortParams:U,linkPrefix:c+"/application-details/",tableConfig:null!=$&&$.tableConfig?null===(X=res)||void 0===X?void 0:X.tableConfig:x(I).ASSET,filterComponent:f,EmptyResultInboxComp:b,useNewInboxAPI:d}):l.createElement("div",null,g&&l.createElement(t.Header,null,I("ES_COMMON_INBOX")),l.createElement(R,{moduleCode:m,data:q,tableConfig:x(I).ASSET,isLoading:K,defaultSearchParams:E.searchParams,isSearch:!g,onFilterChange:Z,searchFields:Y,onSearch:Z,onSort:Q,onNextPage:()=>{F(e=>e+B)},onPrevPage:()=>{F(e=>e-B)},currentPage:Math.floor(M/B),pageSizeLimit:B,disableSort:!1,onPageSizeChange:e=>{k(Number(e.target.value))},parentRoute:c,searchParams:j,sortParams:U,totalRecords:Number(null==q||null===(J=q[0])||void 0===J?void 0:J.totalCount),filterComponent:f,EmptyResultInboxComp:b,useNewInboxAPI:d}))},F=e=>{var n,o,r,s,u,d,c,m,p,E,f,g,S,_,h,y,C,b,T,I,O,N,R,x;let{path:L,url:P,userType:w}=e;const{t:F}=a.useTranslation(),B=i.useLocation();sessionStorage.removeItem("revalidateddone");const k=window.Digit.Utils.browser.isMobile(),U={searchParams:{uuid:{code:"ASSIGNED_TO_ALL",name:"ES_INBOX_ASSIGNED_TO_ALL"},services:["asset-create"],applicationStatus:[],locality:[]}},H=e=>{let{location:n}=e;const{t:o}=a.useTranslation(),r=i.useLocation().search,s=(new URLSearchParams(r).get("from"),Digit.Hooks.useQueryParams(),[{path:"/digit-ui/employee",content:o("ES_COMMON_HOME"),show:!0},{path:"/digit-ui/employee/asset/assetservice/inbox",content:o("ES_TITLE_INBOX"),show:(n.pathname.includes("asset/assetservice/inbox"),!1)}]);return l.createElement(t.BreadCrumb,{style:k?{display:"flex"}:{margin:"0 0 4px",color:"#000000"},spanStyle:{maxWidth:"min-content"},crumbs:s})},j=null===(n=Digit)||void 0===n||null===(o=n.ComponentRegistryService)||void 0===o?void 0:o.getComponent("AssignAssetApplication"),W=null===(r=Digit)||void 0===r||null===(s=r.ComponentRegistryService)||void 0===s?void 0:s.getComponent("DisposeApplication"),V=null===(u=Digit)||void 0===u||null===(d=u.ComponentRegistryService)||void 0===d?void 0:d.getComponent("MaintenanceApplication"),z=null===(c=Digit)||void 0===c||null===(m=c.ComponentRegistryService)||void 0===m?void 0:m.getComponent("editResponse"),G=null===(p=Digit)||void 0===p||null===(E=p.ComponentRegistryService)||void 0===E?void 0:E.getComponent("editAsset"),K=null===(f=Digit)||void 0===f||null===(g=f.ComponentRegistryService)||void 0===g?void 0:g.getComponent("returnAssets"),q=null===(S=Digit)||void 0===S||null===(_=S.ComponentRegistryService)||void 0===_?void 0:_.getComponent("ApplicationDetails"),Y=null===(h=Digit)||void 0===h||null===(y=h.ComponentRegistryService)||void 0===y?void 0:y.getComponent("AssetCreateNew"),$=null===(C=Digit)||void 0===C||null===(b=C.ComponentRegistryService)||void 0===b?void 0:b.getComponent("AssetResponse"),Z=null===(T=Digit)||void 0===T||null===(I=T.ComponentRegistryService)||void 0===I?void 0:I.getComponent("DisposeResponse"),Q=null===(O=Digit)||void 0===O||null===(N=O.ComponentRegistryService)||void 0===N?void 0:N.getComponent("ProcessDepreciationResponse"),X=null===(R=Digit)||void 0===R||null===(x=R.ComponentRegistryService)||void 0===x?void 0:x.getComponent("returnResponse"),J=window.location.href.includes("asset/response"),ee=window.location.href.includes("new-assets")||window.location.href.includes("asset/assetservice/application-details");return l.createElement(i.Switch,null,l.createElement(t.AppContainer,null,l.createElement(l.Fragment,null,l.createElement("div",{className:"ground-container"},J?null:l.createElement("div",{style:ee?{marginLeft:"12px",display:"flex",alignItems:"center"}:{marginLeft:"-4px",display:"flex",alignItems:"center"}},l.createElement(t.BackButton,{location:B}),l.createElement("span",{style:{margin:"0 5px 16px",display:"inline-block"}},"|"),l.createElement(H,{location:B})),l.createElement(t.PrivateRoute,{exact:!0,path:L+"/",component:()=>l.createElement(oa,{matchPath:L,userType:w})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/inbox",component:()=>l.createElement(M,{useNewInboxAPI:!0,parentRoute:L,businessService:"asset-create",filterComponent:"AST_INBOX_FILTER",initialStates:U,isInbox:!0})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/assign-assets/:id",component:()=>l.createElement(j,{parentUrl:P})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/maintenance-assets/:id",component:()=>l.createElement(V,{parentUrl:P})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/dispose-assets/:id",component:()=>l.createElement(W,{parentUrl:P})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/return-assets/:id",component:()=>l.createElement(K,{parentUrl:P})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/edit/:id",component:()=>l.createElement(G,{parentUrl:P})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/new-assets",component:()=>l.createElement(Y,{parentUrl:P})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/application-details/:id",component:()=>l.createElement(q,{parentRoute:L})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/applicationsearch/application-details/:id",component:()=>l.createElement(q,{parentRoute:L})}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/assign-response",component:e=>l.createElement($,v({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/asset-dispose-response",component:e=>l.createElement(Z,v({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/asset-process-depreciation-response",component:e=>l.createElement(Q,v({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/return-response",component:e=>l.createElement(X,v({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/search",component:e=>l.createElement(Search,v({},e,{t:F,parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/my-asset",component:e=>l.createElement(A,v({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/report",component:e=>l.createElement(D,v({},e,{parentRoute:L}))}),l.createElement(t.PrivateRoute,{path:L+"/assetservice/edit-response",component:e=>l.createElement(z,v({},e,{parentRoute:L}))})))))},B=e=>{var n;let{status:i,searchParams:o,onAssignmentChange:r,statusMap:s}=e;return a.useTranslation(),l.createElement(t.CheckBox,{styles:{height:"unset"},onChange:e=>r(v({},e,{state:i.state}),i),checked:null==o?void 0:o.applicationStatus.some(e=>e.uuid===i.uuid),label:i.name+" ("+((null==s||null===(n=s.find(e=>e.statusid===i.uuid))||void 0===n?void 0:n.count)||"-")+")"})},k=e=>{var i,o,r,s,u;let{onAssignmentChange:d,searchParams:c,businessServices:m,statusMap:p}=e;const{t:E}=a.useTranslation(),[f,g]=n.useState(!1),{data:S,isLoading:_}=Digit.Hooks.useApplicationStatusGeneral({businessServices:m},{}),{userRoleStates:h}=S||{},y=(e,t)=>t(map[e.stateBusinessService])+" - "+t("ES_PTR_COMMON_STATUS_"+(e.state||"CREATED"));return _?l.createElement(t.Loader,null):null!=h&&h.filter(e=>!e.isTerminateState).length?l.createElement("div",{className:"status-container"},l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("ES_INBOX_STATUS")),null==h||null===(i=h.filter(e=>!e.isTerminateState))||void 0===i||null===(o=i.slice(0,4))||void 0===o?void 0:o.map((e,t)=>l.createElement(B,{businessServices:m,key:t,onAssignmentChange:d,status:v({name:y(e,E),code:e.applicationStatus},e),searchParams:c,statusMap:p})),(null==h||null===(r=h.filter(e=>!e.isTerminateState))||void 0===r?void 0:r.slice(4).length)>0?l.createElement(l.Fragment,null,f&&(null==h||null===(s=h.filter(e=>!e.isTerminateState))||void 0===s||null===(u=s.slice(4))||void 0===u?void 0:u.map((e,t)=>l.createElement(B,{businessServices:m,key:e.uuid,onAssignmentChange:d,status:v({name:y(e,E),code:e.applicationStatus},e),searchParams:c,statusMap:p}))),l.createElement("div",{className:"filter-button",onClick:()=>g(!f)}," ",E(f?"ES_COMMON_LESS":"ES_COMMON_MORE")," ")):null):null};var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(e,t){return e(t={exports:{}},t.exports),t.exports}var j=H(function(e,t){(function(){var n="Expected a function",l="__lodash_placeholder__",a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],i="[object Arguments]",o="[object Array]",r="[object Boolean]",s="[object Date]",u="[object Error]",d="[object Function]",c="[object GeneratorFunction]",m="[object Map]",v="[object Number]",p="[object Object]",E="[object RegExp]",f="[object Set]",g="[object String]",S="[object Symbol]",_="[object WeakMap]",h="[object ArrayBuffer]",y="[object DataView]",A="[object Float32Array]",C="[object Float64Array]",D="[object Int8Array]",b="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",O="[object Uint16Array]",N="[object Uint32Array]",R=/\b__p \+= '';/g,x=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,w=/[&<>"']/g,M=RegExp(P.source),F=RegExp(w.source),B=/<%-([\s\S]+?)%>/g,k=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,j=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,G=RegExp(z.source),K=/^\s+/,q=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,Q=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,X=/[()=,{}\[\]\/\s]/,J=/\\(\\)?/g,ee=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,te=/\w*$/,ne=/^[-+]0x[0-9a-f]+$/i,le=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,ie=/^0o[0-7]+$/i,oe=/^(?:0|[1-9]\d*)$/,re=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,ue=/['\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",me="["+ce+"]",ve="["+de+"]",pe="\\d+",Ee="[a-z\\xdf-\\xf6\\xf8-\\xff]",fe="[^\\ud800-\\udfff"+ce+pe+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ge="\\ud83c[\\udffb-\\udfff]",Se="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",ye="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="(?:"+Ee+"|"+fe+")",Ce="(?:"+ye+"|"+fe+")",De="(?:"+ve+"|"+ge+")?",be="[\\ufe0e\\ufe0f]?"+De+"(?:\\u200d(?:"+[Se,_e,he].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*",Te="(?:"+["[\\u2700-\\u27bf]",_e,he].join("|")+")"+be,Ie="(?:"+[Se+ve+"?",ve,_e,he,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['’]","g"),Ne=RegExp(ve,"g"),Re=RegExp(ge+"(?="+ge+")|"+Ie+be,"g"),xe=RegExp([ye+"?"+Ee+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[me,ye,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[me,ye+Ae,"$"].join("|")+")",ye+"?"+Ae+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ye+"+(?:['’](?: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_])",pe,Te].join("|"),"g"),Le=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[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"],Me=-1,Fe={};Fe[A]=Fe[C]=Fe[D]=Fe[b]=Fe[T]=Fe[I]=Fe["[object Uint8ClampedArray]"]=Fe[O]=Fe[N]=!0,Fe[i]=Fe[o]=Fe[h]=Fe[r]=Fe[y]=Fe[s]=Fe[u]=Fe[d]=Fe[m]=Fe[v]=Fe[p]=Fe[E]=Fe[f]=Fe[g]=Fe[_]=!1;var Be={};Be[i]=Be[o]=Be[h]=Be[y]=Be[r]=Be[s]=Be[A]=Be[C]=Be[D]=Be[b]=Be[T]=Be[m]=Be[v]=Be[p]=Be[E]=Be[f]=Be[g]=Be[S]=Be[I]=Be["[object Uint8ClampedArray]"]=Be[O]=Be[N]=!0,Be[u]=Be[d]=Be[_]=!1;var ke={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,He=parseInt,je="object"==typeof U&&U&&U.Object===Object&&U,We="object"==typeof self&&self&&self.Object===Object&&self,Ve=je||We||Function("return this")(),ze=t&&!t.nodeType&&t,Ge=ze&&e&&!e.nodeType&&e,Ke=Ge&&Ge.exports===ze,qe=Ke&&je.process,Ye=function(){try{return Ge&&Ge.require&&Ge.require("util").types||qe&&qe.binding&&qe.binding("util")}catch(e){}}(),$e=Ye&&Ye.isArrayBuffer,Ze=Ye&&Ye.isDate,Qe=Ye&&Ye.isMap,Xe=Ye&&Ye.isRegExp,Je=Ye&&Ye.isSet,et=Ye&&Ye.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,l){for(var a=-1,i=null==e?0:e.length;++a<i;){var o=e[a];t(l,o,n(o),e)}return l}function lt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function it(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(!t(e[n],n,e))return!1;return!0}function ot(e,t){for(var n=-1,l=null==e?0:e.length,a=0,i=[];++n<l;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}function rt(e,t){return!(null==e||!e.length)&&gt(e,t,0)>-1}function st(e,t,n){for(var l=-1,a=null==e?0:e.length;++l<a;)if(n(t,e[l]))return!0;return!1}function ut(e,t){for(var n=-1,l=null==e?0:e.length,a=Array(l);++n<l;)a[n]=t(e[n],n,e);return a}function dt(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}function ct(e,t,n,l){var a=-1,i=null==e?0:e.length;for(l&&i&&(n=e[++a]);++a<i;)n=t(n,e[a],a,e);return n}function mt(e,t,n,l){var a=null==e?0:e.length;for(l&&a&&(n=e[--a]);a--;)n=t(n,e[a],a,e);return n}function vt(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1}var pt=yt("length");function Et(e,t,n){var l;return n(e,function(e,n,a){if(t(e,n,a))return l=n,!1}),l}function ft(e,t,n,l){for(var a=e.length,i=n+(l?1:-1);l?i--:++i<a;)if(t(e[i],i,e))return i;return-1}function gt(e,t,n){return t==t?function(e,t,n){for(var l=n-1,a=e.length;++l<a;)if(e[l]===t)return l;return-1}(e,t,n):ft(e,_t,n)}function St(e,t,n,l){for(var a=n-1,i=e.length;++a<i;)if(l(e[a],t))return a;return-1}function _t(e){return e!=e}function ht(e,t){var n=null==e?0:e.length;return n?Dt(e,t)/n:NaN}function yt(e){return function(t){return null==t?void 0:t[e]}}function At(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,l,a){return a(e,function(e,a,i){n=l?(l=!1,e):t(n,e,a,i)}),n}function Dt(e,t){for(var n,l=-1,a=e.length;++l<a;){var i=t(e[l]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function bt(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}function Tt(e){return e?e.slice(0,zt(e)+1).replace(K,""):e}function It(e){return function(t){return e(t)}}function Ot(e,t){return ut(t,function(t){return e[t]})}function Nt(e,t){return e.has(t)}function Rt(e,t){for(var n=-1,l=e.length;++n<l&&gt(t,e[n],0)>-1;);return n}function xt(e,t){for(var n=e.length;n--&&gt(t,e[n],0)>-1;);return n}function Lt(e,t){for(var n=e.length,l=0;n--;)e[n]===t&&++l;return l}var Pt=At({"À":"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=At({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Mt(e){return"\\"+ke[e]}function Ft(e){return Le.test(e)}function Bt(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n}function kt(e,t){return function(n){return e(t(n))}}function Ut(e,t){for(var n=-1,a=e.length,i=0,o=[];++n<a;){var r=e[n];r!==t&&r!==l||(e[n]=l,o[i++]=n)}return o}function Ht(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function jt(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function Wt(e){return Ft(e)?function(e){for(var t=Re.lastIndex=0;Re.test(e);)++t;return t}(e):pt(e)}function Vt(e){return Ft(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}function zt(e){for(var t=e.length;t--&&q.test(e.charAt(t)););return t}var Gt=At({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),Kt=function e(t){var U,q=(t=null==t?Ve:Kt.defaults(Ve.Object(),t,Kt.pick(Ve,we))).Array,de=t.Date,ce=t.Error,me=t.Function,ve=t.Math,pe=t.Object,Ee=t.RegExp,fe=t.String,ge=t.TypeError,Se=q.prototype,_e=pe.prototype,he=t["__core-js_shared__"],ye=me.prototype.toString,Ae=_e.hasOwnProperty,Ce=0,De=(U=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",be=_e.toString,Te=ye.call(pe),Ie=Ve._,Re=Ee("^"+ye.call(Ae).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ke?t.Buffer:void 0,ke=t.Symbol,je=t.Uint8Array,We=Le?Le.allocUnsafe:void 0,ze=kt(pe.getPrototypeOf,pe),Ge=pe.create,qe=_e.propertyIsEnumerable,Ye=Se.splice,pt=ke?ke.isConcatSpreadable:void 0,At=ke?ke.iterator:void 0,qt=ke?ke.toStringTag:void 0,Yt=function(){try{var e=Xa(pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),$t=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Zt=de&&de.now!==Ve.Date.now&&de.now,Qt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Xt=ve.ceil,Jt=ve.floor,en=pe.getOwnPropertySymbols,tn=Le?Le.isBuffer:void 0,nn=t.isFinite,ln=Se.join,an=kt(pe.keys,pe),on=ve.max,rn=ve.min,sn=de.now,un=t.parseInt,dn=ve.random,cn=Se.reverse,mn=Xa(t,"DataView"),vn=Xa(t,"Map"),pn=Xa(t,"Promise"),En=Xa(t,"Set"),fn=Xa(t,"WeakMap"),gn=Xa(pe,"create"),Sn=fn&&new fn,_n={},hn=Ii(mn),yn=Ii(vn),An=Ii(pn),Cn=Ii(En),Dn=Ii(fn),bn=ke?ke.prototype:void 0,Tn=bn?bn.valueOf:void 0,In=bn?bn.toString:void 0;function On(e){if(Go(e)&&!wo(e)&&!(e instanceof Ln)){if(e instanceof xn)return e;if(Ae.call(e,"__wrapped__"))return Oi(e)}return new xn(e)}var Nn=function(){function e(){}return function(t){if(!zo(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Rn(){}function xn(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 Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}function Fn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mn;++t<n;)this.add(e[t])}function Bn(e){var t=this.__data__=new wn(e);this.size=t.size}function kn(e,t){var n=wo(e),l=!n&&Po(e),a=!n&&!l&&ko(e),i=!n&&!l&&!a&&Jo(e),o=n||l||a||i,r=o?bt(e.length,fe):[],s=r.length;for(var u in e)!t&&!Ae.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ii(u,s))||r.push(u);return r}function Un(e){var t=e.length;return t?e[Ml(0,t-1)]:void 0}function Hn(e,t){return Ai(fa(e),$n(t,0,e.length))}function jn(e){return Ai(fa(e))}function Wn(e,t,n){(void 0!==n&&!Ro(e[t],n)||void 0===n&&!(t in e))&&qn(e,t,n)}function Vn(e,t,n){var l=e[t];Ae.call(e,t)&&Ro(l,n)&&(void 0!==n||t in e)||qn(e,t,n)}function zn(e,t){for(var n=e.length;n--;)if(Ro(e[n][0],t))return n;return-1}function Gn(e,t,n,l){return el(e,function(e,a,i){t(l,e,n(e),i)}),l}function Kn(e,t){return e&&ga(t,yr(t),e)}function qn(e,t,n){"__proto__"==t&&Yt?Yt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Yn(e,t){for(var n=-1,l=t.length,a=q(l),i=null==e;++n<l;)a[n]=i?void 0:fr(e,t[n]);return a}function $n(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Zn(e,t,n,l,a,o){var u,_=1&t,R=2&t,x=4&t;if(n&&(u=a?n(e,l,a,o):n(e)),void 0!==u)return u;if(!zo(e))return e;var L=wo(e);if(L){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!_)return fa(e,u)}else{var P=ti(e),w=P==d||P==c;if(ko(e))return da(e,_);if(P==p||P==i||w&&!a){if(u=R||w?{}:li(e),!_)return R?function(e,t){return ga(e,ei(e),t)}(e,function(e,t){return e&&ga(t,Ar(t),e)}(u,e)):function(e,t){return ga(e,Ja(e),t)}(e,Kn(u,e))}else{if(!Be[P])return a?e:{};u=function(e,t,n){var l=e.constructor;switch(t){case h:return ca(e);case r:case s:return new l(+e);case y:return function(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case D:case b:case T:case I:case"[object Uint8ClampedArray]":case O:case N:return ma(e,n);case m:return new l;case v:case g:return new l(e);case E:return function(e){var t=new e.constructor(e.source,te.exec(e));return t.lastIndex=e.lastIndex,t}(e);case f:return new l;case S:return Tn?pe(Tn.call(e)):{}}}(e,P,_)}}o||(o=new Bn);var M=o.get(e);if(M)return M;o.set(e,u),Zo(e)?e.forEach(function(l){u.add(Zn(l,t,n,l,e,o))}):Ko(e)&&e.forEach(function(l,a){u.set(a,Zn(l,t,n,a,e,o))});var F=L?void 0:(x?R?Ga:za:R?Ar:yr)(e);return lt(F||e,function(l,a){F&&(l=e[a=l]),Vn(u,a,Zn(l,t,n,a,e,o))}),u}function Qn(e,t,n){var l=n.length;if(null==e)return!l;for(e=pe(e);l--;){var a=n[l],i=e[a];if(void 0===i&&!(a in e)||!(0,t[a])(i))return!1}return!0}function Xn(e,t,l){if("function"!=typeof e)throw new ge(n);return Si(function(){e.apply(void 0,l)},t)}function Jn(e,t,n,l){var a=-1,i=rt,o=!0,r=e.length,s=[],u=t.length;if(!r)return s;n&&(t=ut(t,It(n))),l?(i=st,o=!1):t.length>=200&&(i=Nt,o=!1,t=new Fn(t));e:for(;++a<r;){var d=e[a],c=null==n?d:n(d);if(d=l||0!==d?d:0,o&&c==c){for(var m=u;m--;)if(t[m]===c)continue e;s.push(d)}else i(t,c,l)||s.push(d)}return s}On.templateSettings={escape:B,evaluate:k,interpolate:H,variable:"",imports:{_:On}},(On.prototype=Rn.prototype).constructor=On,(xn.prototype=Nn(Rn.prototype)).constructor=xn,(Ln.prototype=Nn(Rn.prototype)).constructor=Ln,Pn.prototype.clear=function(){this.__data__=gn?gn(null):{},this.size=0},Pn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pn.prototype.get=function(e){var t=this.__data__;if(gn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ae.call(t,e)?t[e]:void 0},Pn.prototype.has=function(e){var t=this.__data__;return gn?void 0!==t[e]:Ae.call(t,e)},Pn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=gn&&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=zn(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},wn.prototype.get=function(e){var t=this.__data__,n=zn(t,e);return n<0?void 0:t[n][1]},wn.prototype.has=function(e){return zn(this.__data__,e)>-1},wn.prototype.set=function(e,t){var n=this.__data__,l=zn(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this},Mn.prototype.clear=function(){this.size=0,this.__data__={hash:new Pn,map:new(vn||wn),string:new Pn}},Mn.prototype.delete=function(e){var t=Za(this,e).delete(e);return this.size-=t?1:0,t},Mn.prototype.get=function(e){return Za(this,e).get(e)},Mn.prototype.has=function(e){return Za(this,e).has(e)},Mn.prototype.set=function(e,t){var n=Za(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this},Fn.prototype.add=Fn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Fn.prototype.has=function(e){return this.__data__.has(e)},Bn.prototype.clear=function(){this.__data__=new wn,this.size=0},Bn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Bn.prototype.get=function(e){return this.__data__.get(e)},Bn.prototype.has=function(e){return this.__data__.has(e)},Bn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wn){var l=n.__data__;if(!vn||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mn(l)}return n.set(e,t),this.size=n.size,this};var el=ha(sl),tl=ha(ul,!0);function nl(e,t){var n=!0;return el(e,function(e,l,a){return n=!!t(e,l,a)}),n}function ll(e,t,n){for(var l=-1,a=e.length;++l<a;){var i=e[l],o=t(i);if(null!=o&&(void 0===r?o==o&&!Xo(o):n(o,r)))var r=o,s=i}return s}function al(e,t){var n=[];return el(e,function(e,l,a){t(e,l,a)&&n.push(e)}),n}function il(e,t,n,l,a){var i=-1,o=e.length;for(n||(n=ai),a||(a=[]);++i<o;){var r=e[i];t>0&&n(r)?t>1?il(r,t-1,n,l,a):dt(a,r):l||(a[a.length]=r)}return a}var ol=ya(),rl=ya(!0);function sl(e,t){return e&&ol(e,t,yr)}function ul(e,t){return e&&rl(e,t,yr)}function dl(e,t){return ot(t,function(t){return jo(e[t])})}function cl(e,t){for(var n=0,l=(t=oa(t,e)).length;null!=e&&n<l;)e=e[Ti(t[n++])];return n&&n==l?e:void 0}function ml(e,t,n){var l=t(e);return wo(e)?l:dt(l,n(e))}function vl(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qt&&qt in pe(e)?function(e){var t=Ae.call(e,qt),n=e[qt];try{e[qt]=void 0;var l=!0}catch(e){}var a=be.call(e);return l&&(t?e[qt]=n:delete e[qt]),a}(e):function(e){return be.call(e)}(e)}function pl(e,t){return e>t}function El(e,t){return null!=e&&Ae.call(e,t)}function fl(e,t){return null!=e&&t in pe(e)}function gl(e,t,n){for(var l=n?st:rt,a=e[0].length,i=e.length,o=i,r=q(i),s=Infinity,u=[];o--;){var d=e[o];o&&t&&(d=ut(d,It(t))),s=rn(d.length,s),r[o]=!n&&(t||a>=120&&d.length>=120)?new Fn(o&&d):void 0}d=e[0];var c=-1,m=r[0];e:for(;++c<a&&u.length<s;){var v=d[c],p=t?t(v):v;if(v=n||0!==v?v:0,!(m?Nt(m,p):l(u,p,n))){for(o=i;--o;){var E=r[o];if(!(E?Nt(E,p):l(e[o],p,n)))continue e}m&&m.push(p),u.push(v)}}return u}function Sl(e,t,n){var l=null==(e=pi(e,t=oa(t,e)))?e:e[Ti(Ui(t))];return null==l?void 0:tt(l,e,n)}function _l(e){return Go(e)&&vl(e)==i}function hl(e,t,n,l,a){return e===t||(null==e||null==t||!Go(e)&&!Go(t)?e!=e&&t!=t:function(e,t,n,l,a,d){var c=wo(e),_=wo(t),A=c?o:ti(e),C=_?o:ti(t),D=(A=A==i?p:A)==p,b=(C=C==i?p:C)==p,T=A==C;if(T&&ko(e)){if(!ko(t))return!1;c=!0,D=!1}if(T&&!D)return d||(d=new Bn),c||Jo(e)?Wa(e,t,n,l,a,d):function(e,t,n,l,a,i,o){switch(n){case y:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case h:return!(e.byteLength!=t.byteLength||!i(new je(e),new je(t)));case r:case s:case v:return Ro(+e,+t);case u:return e.name==t.name&&e.message==t.message;case E:case g:return e==t+"";case m:var d=Bt;case f:if(d||(d=Ht),e.size!=t.size&&!(1&l))return!1;var c=o.get(e);if(c)return c==t;l|=2,o.set(e,t);var p=Wa(d(e),d(t),l,a,i,o);return o.delete(e),p;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,A,n,l,a,d);if(!(1&n)){var I=D&&Ae.call(e,"__wrapped__"),O=b&&Ae.call(t,"__wrapped__");if(I||O){var N=I?e.value():e,R=O?t.value():t;return d||(d=new Bn),a(N,R,n,l,d)}}return!!T&&(d||(d=new Bn),function(e,t,n,l,a,i){var o=1&n,r=za(e),s=r.length;if(s!=za(t).length&&!o)return!1;for(var u=s;u--;){var d=r[u];if(!(o?d in t:Ae.call(t,d)))return!1}var c=i.get(e),m=i.get(t);if(c&&m)return c==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var p=o;++u<s;){var E=e[d=r[u]],f=t[d];if(l)var g=o?l(f,E,d,t,e,i):l(E,f,d,e,t,i);if(!(void 0===g?E===f||a(E,f,n,l,i):g)){v=!1;break}p||(p="constructor"==d)}if(v&&!p){var S=e.constructor,_=t.constructor;S==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof _&&_ instanceof _||(v=!1)}return i.delete(e),i.delete(t),v}(e,t,n,l,a,d))}(e,t,n,l,hl,a))}function yl(e,t,n,l){var a=n.length,i=a,o=!l;if(null==e)return!i;for(e=pe(e);a--;){var r=n[a];if(o&&r[2]?r[1]!==e[r[0]]:!(r[0]in e))return!1}for(;++a<i;){var s=(r=n[a])[0],u=e[s],d=r[1];if(o&&r[2]){if(void 0===u&&!(s in e))return!1}else{var c=new Bn;if(l)var m=l(u,d,s,e,t,c);if(!(void 0===m?hl(d,u,3,l,c):m))return!1}}return!0}function Al(e){return!(!zo(e)||(t=e,De&&De in t))&&(jo(e)?Re:ae).test(Ii(e));var t}function Cl(e){return"function"==typeof e?e:null==e?qr:"object"==typeof e?wo(e)?Ol(e[0],e[1]):Il(e):ns(e)}function Dl(e){if(!di(e))return an(e);var t=[];for(var n in pe(e))Ae.call(e,n)&&"constructor"!=n&&t.push(n);return t}function bl(e,t){return e<t}function Tl(e,t){var n=-1,l=Fo(e)?q(e.length):[];return el(e,function(e,a,i){l[++n]=t(e,a,i)}),l}function Il(e){var t=Qa(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(n){return n===e||yl(n,e,t)}}function Ol(e,t){return ri(e)&&ci(t)?mi(Ti(e),t):function(n){var l=fr(n,e);return void 0===l&&l===t?gr(n,e):hl(t,l,3)}}function Nl(e,t,n,l,a){e!==t&&ol(t,function(i,o){if(a||(a=new Bn),zo(i))!function(e,t,n,l,a,i,o){var r=fi(e,n),s=fi(t,n),u=o.get(s);if(u)Wn(e,n,u);else{var d=i?i(r,s,n+"",e,t,o):void 0,c=void 0===d;if(c){var m=wo(s),v=!m&&ko(s),p=!m&&!v&&Jo(s);d=s,m||v||p?wo(r)?d=r:Bo(r)?d=fa(r):v?(c=!1,d=da(s,!0)):p?(c=!1,d=ma(s,!0)):d=[]:Yo(s)||Po(s)?(d=r,Po(r)?d=rr(r):zo(r)&&!jo(r)||(d=li(s))):c=!1}c&&(o.set(s,d),a(d,s,l,i,o),o.delete(s)),Wn(e,n,d)}}(e,t,o,n,Nl,l,a);else{var r=l?l(fi(e,o),i,o+"",e,t,a):void 0;void 0===r&&(r=i),Wn(e,o,r)}},Ar)}function Rl(e,t){var n=e.length;if(n)return ii(t+=t<0?n:0,n)?e[t]:void 0}function xl(e,t,n){t=t.length?ut(t,function(e){return wo(e)?function(t){return cl(t,1===e.length?e[0]:e)}:e}):[qr];var l=-1;return t=ut(t,It($a())),function(e,t){var l=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var l=-1,a=e.criteria,i=t.criteria,o=a.length,r=n.length;++l<o;){var s=va(a[l],i[l]);if(s)return l>=r?s:s*("desc"==n[l]?-1:1)}return e.index-t.index}(e,t,n)});l--;)e[l]=e[l].value;return e}(Tl(e,function(e,n,a){return{criteria:ut(t,function(t){return t(e)}),index:++l,value:e}}))}function Ll(e,t,n){for(var l=-1,a=t.length,i={};++l<a;){var o=t[l],r=cl(e,o);n(r,o)&&Hl(i,oa(o,e),r)}return i}function Pl(e,t,n,l){var a=l?St:gt,i=-1,o=t.length,r=e;for(e===t&&(t=fa(t)),n&&(r=ut(e,It(n)));++i<o;)for(var s=0,u=t[i],d=n?n(u):u;(s=a(r,d,s,l))>-1;)r!==e&&Ye.call(r,s,1),Ye.call(e,s,1);return e}function wl(e,t){for(var n=e?t.length:0,l=n-1;n--;){var a=t[n];if(n==l||a!==i){var i=a;ii(a)?Ye.call(e,a,1):Xl(e,a)}}return e}function Ml(e,t){return e+Jt(dn()*(t-e+1))}function Fl(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 Bl(e,t){return _i(vi(e,t,qr),e+"")}function kl(e){return Un(Rr(e))}function Ul(e,t){var n=Rr(e);return Ai(n,$n(t,0,n.length))}function Hl(e,t,n,l){if(!zo(e))return e;for(var a=-1,i=(t=oa(t,e)).length,o=i-1,r=e;null!=r&&++a<i;){var s=Ti(t[a]),u=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=o){var d=r[s];void 0===(u=l?l(d,s,r):void 0)&&(u=zo(d)?d:ii(t[a+1])?[]:{})}Vn(r,s,u),r=r[s]}return e}var jl=Sn?function(e,t){return Sn.set(e,t),e}:qr,Wl=Yt?function(e,t){return Yt(e,"toString",{configurable:!0,enumerable:!1,value:zr(t),writable:!0})}:qr;function Vl(e){return Ai(Rr(e))}function zl(e,t,n){var l=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=q(a);++l<a;)i[l]=e[l+t];return i}function Gl(e,t){var n;return el(e,function(e,l,a){return!(n=t(e,l,a))}),!!n}function Kl(e,t,n){var l=0,a=null==e?l:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;l<a;){var i=l+a>>>1,o=e[i];null!==o&&!Xo(o)&&(n?o<=t:o<t)?l=i+1:a=i}return a}return ql(e,t,qr,n)}function ql(e,t,n,l){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var o=(t=n(t))!=t,r=null===t,s=Xo(t),u=void 0===t;a<i;){var d=Jt((a+i)/2),c=n(e[d]),m=void 0!==c,v=null===c,p=c==c,E=Xo(c);if(o)var f=l||p;else f=u?p&&(l||m):r?p&&m&&(l||!v):s?p&&m&&!v&&(l||!E):!v&&!E&&(l?c<=t:c<t);f?a=d+1:i=d}return rn(i,4294967294)}function Yl(e,t){for(var n=-1,l=e.length,a=0,i=[];++n<l;){var o=e[n],r=t?t(o):o;if(!n||!Ro(r,s)){var s=r;i[a++]=0===o?0:o}}return i}function $l(e){return"number"==typeof e?e:Xo(e)?NaN:+e}function Zl(e){if("string"==typeof e)return e;if(wo(e))return ut(e,Zl)+"";if(Xo(e))return In?In.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ql(e,t,n){var l=-1,a=rt,i=e.length,o=!0,r=[],s=r;if(n)o=!1,a=st;else if(i>=200){var u=t?null:Fa(e);if(u)return Ht(u);o=!1,a=Nt,s=new Fn}else s=t?[]:r;e:for(;++l<i;){var d=e[l],c=t?t(d):d;if(d=n||0!==d?d:0,o&&c==c){for(var m=s.length;m--;)if(s[m]===c)continue e;t&&s.push(c),r.push(d)}else a(s,c,n)||(s!==r&&s.push(c),r.push(d))}return r}function Xl(e,t){return null==(e=pi(e,t=oa(t,e)))||delete e[Ti(Ui(t))]}function Jl(e,t,n,l){return Hl(e,t,n(cl(e,t)),l)}function ea(e,t,n,l){for(var a=e.length,i=l?a:-1;(l?i--:++i<a)&&t(e[i],i,e););return n?zl(e,l?0:i,l?i+1:a):zl(e,l?i+1:0,l?a:i)}function ta(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 na(e,t,n){var l=e.length;if(l<2)return l?Ql(e[0]):[];for(var a=-1,i=q(l);++a<l;)for(var o=e[a],r=-1;++r<l;)r!=a&&(i[a]=Jn(i[a]||o,e[r],t,n));return Ql(il(i,1),t,n)}function la(e,t,n){for(var l=-1,a=e.length,i=t.length,o={};++l<a;)n(o,e[l],l<i?t[l]:void 0);return o}function aa(e){return Bo(e)?e:[]}function ia(e){return"function"==typeof e?e:qr}function oa(e,t){return wo(e)?e:ri(e,t)?[e]:bi(sr(e))}var ra=Bl;function sa(e,t,n){var l=e.length;return n=void 0===n?l:n,!t&&n>=l?e:zl(e,t,n)}var ua=$t||function(e){return Ve.clearTimeout(e)};function da(e,t){if(t)return e.slice();var n=e.length,l=We?We(n):new e.constructor(n);return e.copy(l),l}function ca(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function ma(e,t){var n=t?ca(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function va(e,t){if(e!==t){var n=void 0!==e,l=null===e,a=e==e,i=Xo(e),o=void 0!==t,r=null===t,s=t==t,u=Xo(t);if(!r&&!u&&!i&&e>t||i&&o&&s&&!r&&!u||l&&o&&s||!n&&s||!a)return 1;if(!l&&!i&&!u&&e<t||u&&n&&a&&!l&&!i||r&&n&&a||!o&&a||!s)return-1}return 0}function pa(e,t,n,l){for(var a=-1,i=e.length,o=n.length,r=-1,s=t.length,u=on(i-o,0),d=q(s+u),c=!l;++r<s;)d[r]=t[r];for(;++a<o;)(c||a<i)&&(d[n[a]]=e[a]);for(;u--;)d[r++]=e[a++];return d}function Ea(e,t,n,l){for(var a=-1,i=e.length,o=-1,r=n.length,s=-1,u=t.length,d=on(i-r,0),c=q(d+u),m=!l;++a<d;)c[a]=e[a];for(var v=a;++s<u;)c[v+s]=t[s];for(;++o<r;)(m||a<i)&&(c[v+n[o]]=e[a++]);return c}function fa(e,t){var n=-1,l=e.length;for(t||(t=q(l));++n<l;)t[n]=e[n];return t}function ga(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?qn(n,r,s):Vn(n,r,s)}return n}function Sa(e,t){return function(n,l){var a=wo(n)?nt:Gn,i=t?t():{};return a(n,e,$a(l,2),i)}}function _a(e){return Bl(function(t,n){var l=-1,a=n.length,i=a>1?n[a-1]:void 0,o=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,o&&oi(n[0],n[1],o)&&(i=a<3?void 0:i,a=1),t=pe(t);++l<a;){var r=n[l];r&&e(t,r,l,i)}return t})}function ha(e,t){return function(n,l){if(null==n)return n;if(!Fo(n))return e(n,l);for(var a=n.length,i=t?a:-1,o=pe(n);(t?i--:++i<a)&&!1!==l(o[i],i,o););return n}}function ya(e){return function(t,n,l){for(var a=-1,i=pe(t),o=l(t),r=o.length;r--;){var s=o[e?r:++a];if(!1===n(i[s],s,i))break}return t}}function Aa(e){return function(t){var n=Ft(t=sr(t))?Vt(t):void 0,l=n?n[0]:t.charAt(0),a=n?sa(n,1).join(""):t.slice(1);return l[e]()+a}}function Ca(e){return function(t){return ct(jr(Pr(t).replace(Oe,"")),e,"")}}function Da(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=Nn(e.prototype),l=e.apply(n,t);return zo(l)?l:n}}function ba(e){return function(t,n,l){var a=pe(t);if(!Fo(t)){var i=$a(n,3);t=yr(t),n=function(e){return i(a[e],e,a)}}var o=e(t,n,l);return o>-1?a[i?t[o]:o]:void 0}}function Ta(e){return Va(function(t){var l=t.length,a=l,i=xn.prototype.thru;for(e&&t.reverse();a--;){var o=t[a];if("function"!=typeof o)throw new ge(n);if(i&&!r&&"wrapper"==qa(o))var r=new xn([],!0)}for(a=r?a:l;++a<l;){var s=qa(o=t[a]),u="wrapper"==s?Ka(o):void 0;r=u&&si(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?r[qa(u[0])].apply(r,u[3]):1==o.length&&si(o)?r[s]():r.thru(o)}return function(){var e=arguments,n=e[0];if(r&&1==e.length&&wo(n))return r.plant(n).value();for(var a=0,i=l?t[a].apply(this,e):n;++a<l;)i=t[a].call(this,i);return i}})}function Ia(e,t,n,l,a,i,o,r,s,u){var d=128&t,c=1&t,m=2&t,v=24&t,p=512&t,E=m?void 0:Da(e);return function f(){for(var g=arguments.length,S=q(g),_=g;_--;)S[_]=arguments[_];if(v)var h=Ya(f),y=Lt(S,h);if(l&&(S=pa(S,l,a,v)),i&&(S=Ea(S,i,o,v)),g-=y,v&&g<u){var A=Ut(S,h);return wa(e,t,Ia,f.placeholder,n,S,A,r,s,u-g)}var C=c?n:this,D=m?C[e]:e;return g=S.length,r?S=Ei(S,r):p&&g>1&&S.reverse(),d&&s<g&&(S.length=s),this&&this!==Ve&&this instanceof f&&(D=E||Da(D)),D.apply(C,S)}}function Oa(e,t){return function(n,l){return function(e,t,n,l){return sl(e,function(e,a,i){t(l,n(e),a,i)}),l}(n,e,t(l),{})}}function Na(e,t){return function(n,l){var a;if(void 0===n&&void 0===l)return t;if(void 0!==n&&(a=n),void 0!==l){if(void 0===a)return l;"string"==typeof n||"string"==typeof l?(n=Zl(n),l=Zl(l)):(n=$l(n),l=$l(l)),a=e(n,l)}return a}}function Ra(e){return Va(function(t){return t=ut(t,It($a())),Bl(function(n){var l=this;return e(t,function(e){return tt(e,l,n)})})})}function xa(e,t){var n=(t=void 0===t?" ":Zl(t)).length;if(n<2)return n?Fl(t,e):t;var l=Fl(t,Xt(e/Wt(t)));return Ft(t)?sa(Vt(l),0,e).join(""):l.slice(0,e)}function La(e){return function(t,n,l){return l&&"number"!=typeof l&&oi(t,n,l)&&(n=l=void 0),t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n,l){for(var a=-1,i=on(Xt((t-e)/(n||1)),0),o=q(i);i--;)o[l?i:++a]=e,e+=n;return o}(t,n,l=void 0===l?t<n?1:-1:lr(l),e)}}function Pa(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=or(t),n=or(n)),e(t,n)}}function wa(e,t,n,l,a,i,o,r,s,u){var d=8&t;t|=d?32:64,4&(t&=~(d?64:32))||(t&=-4);var c=[e,t,a,d?i:void 0,d?o:void 0,d?void 0:i,d?void 0:o,r,s,u],m=n.apply(void 0,c);return si(e)&&gi(m,c),m.placeholder=l,hi(m,e,t)}function Ma(e){var t=ve[e];return function(e,n){if(e=or(e),(n=null==n?0:rn(ar(n),292))&&nn(e)){var l=(sr(e)+"e").split("e");return+((l=(sr(t(l[0]+"e"+(+l[1]+n)))+"e").split("e"))[0]+"e"+(+l[1]-n))}return t(e)}}var Fa=En&&1/Ht(new En([,-0]))[1]==1/0?function(e){return new En(e)}:Xr;function Ba(e){return function(t){var n=ti(t);return n==m?Bt(t):n==f?jt(t):function(e,t){return ut(t,function(t){return[t,e[t]]})}(t,e(t))}}function ka(e,t,a,i,o,r,s,u){var d=2&t;if(!d&&"function"!=typeof e)throw new ge(n);var c=i?i.length:0;if(c||(t&=-97,i=o=void 0),s=void 0===s?s:on(ar(s),0),u=void 0===u?u:ar(u),c-=o?o.length:0,64&t){var m=i,v=o;i=o=void 0}var p=d?void 0:Ka(e),E=[e,t,a,i,o,m,v,r,s,u];if(p&&function(e,t){var n=e[1],a=t[1],i=n|a;if(!(i<131||128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n))return e;1&a&&(e[2]=t[2],i|=1&n?0:4);var o=t[3];if(o){var r=e[3];e[3]=r?pa(r,o,t[4]):o,e[4]=r?Ut(e[3],l):t[4]}(o=t[5])&&(e[5]=(r=e[5])?Ea(r,o,t[6]):o,e[6]=r?Ut(e[5],l):t[6]),(o=t[7])&&(e[7]=o),128&a&&(e[8]=null==e[8]?t[8]:rn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(E,p),e=E[0],t=E[1],a=E[2],i=E[3],o=E[4],!(u=E[9]=void 0===E[9]?d?0:e.length:on(E[9]-c,0))&&24&t&&(t&=-25),t&&1!=t)f=8==t||16==t?function(e,t,n){var l=Da(e);return function a(){for(var i=arguments.length,o=q(i),r=i,s=Ya(a);r--;)o[r]=arguments[r];var u=i<3&&o[0]!==s&&o[i-1]!==s?[]:Ut(o,s);if((i-=u.length)<n)return wa(e,t,Ia,a.placeholder,void 0,o,u,void 0,void 0,n-i);var d=this&&this!==Ve&&this instanceof a?l:e;return tt(d,this,o)}}(e,t,u):32!=t&&33!=t||o.length?Ia.apply(void 0,E):function(e,t,n,l){var a=1&t,i=Da(e);return function t(){for(var o=-1,r=arguments.length,s=-1,u=l.length,d=q(u+r),c=this&&this!==Ve&&this instanceof t?i:e;++s<u;)d[s]=l[s];for(;r--;)d[s++]=arguments[++o];return tt(c,a?n:this,d)}}(e,t,a,i);else var f=function(e,t,n){var l=1&t,a=Da(e);return function t(){var i=this&&this!==Ve&&this instanceof t?a:e;return i.apply(l?n:this,arguments)}}(e,t,a);return hi((p?jl:gi)(f,E),e,t)}function Ua(e,t,n,l){return void 0===e||Ro(e,_e[n])&&!Ae.call(l,n)?t:e}function Ha(e,t,n,l,a,i){return zo(e)&&zo(t)&&(i.set(t,e),Nl(e,t,void 0,Ha,i),i.delete(t)),e}function ja(e){return Yo(e)?void 0:e}function Wa(e,t,n,l,a,i){var o=1&n,r=e.length,s=t.length;if(r!=s&&!(o&&s>r))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var c=-1,m=!0,v=2&n?new Fn:void 0;for(i.set(e,t),i.set(t,e);++c<r;){var p=e[c],E=t[c];if(l)var f=o?l(E,p,c,t,e,i):l(p,E,c,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!vt(t,function(e,t){if(!Nt(v,t)&&(p===e||a(p,e,n,l,i)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,i)){m=!1;break}}return i.delete(e),i.delete(t),m}function Va(e){return _i(vi(e,void 0,wi),e+"")}function za(e){return ml(e,yr,Ja)}function Ga(e){return ml(e,Ar,ei)}var Ka=Sn?function(e){return Sn.get(e)}:Xr;function qa(e){for(var t=e.name+"",n=_n[t],l=Ae.call(_n,t)?n.length:0;l--;){var a=n[l],i=a.func;if(null==i||i==e)return a.name}return t}function Ya(e){return(Ae.call(On,"placeholder")?On:e).placeholder}function $a(){var e=On.iteratee||Yr;return e=e===Yr?Cl:e,arguments.length?e(arguments[0],arguments[1]):e}function Za(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function Qa(e){for(var t=yr(e),n=t.length;n--;){var l=t[n],a=e[l];t[n]=[l,a,ci(a)]}return t}function Xa(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Al(n)?n:void 0}var Ja=en?function(e){return null==e?[]:(e=pe(e),ot(en(e),function(t){return qe.call(e,t)}))}:is,ei=en?function(e){for(var t=[];e;)dt(t,Ja(e)),e=ze(e);return t}:is,ti=vl;function ni(e,t,n){for(var l=-1,a=(t=oa(t,e)).length,i=!1;++l<a;){var o=Ti(t[l]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++l!=a?i:!!(a=null==e?0:e.length)&&Vo(a)&&ii(o,a)&&(wo(e)||Po(e))}function li(e){return"function"!=typeof e.constructor||di(e)?{}:Nn(ze(e))}function ai(e){return wo(e)||Po(e)||!!(pt&&e&&e[pt])}function ii(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 oi(e,t,n){if(!zo(n))return!1;var l=typeof t;return!!("number"==l?Fo(n)&&ii(t,n.length):"string"==l&&t in n)&&Ro(n[t],e)}function ri(e,t){if(wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xo(e))||W.test(e)||!j.test(e)||null!=t&&e in pe(t)}function si(e){var t=qa(e),n=On[t];if("function"!=typeof n||!(t in Ln.prototype))return!1;if(e===n)return!0;var l=Ka(n);return!!l&&e===l[0]}(mn&&ti(new mn(new ArrayBuffer(1)))!=y||vn&&ti(new vn)!=m||pn&&"[object Promise]"!=ti(pn.resolve())||En&&ti(new En)!=f||fn&&ti(new fn)!=_)&&(ti=function(e){var t=vl(e),n=t==p?e.constructor:void 0,l=n?Ii(n):"";if(l)switch(l){case hn:return y;case yn:return m;case An:return"[object Promise]";case Cn:return f;case Dn:return _}return t});var ui=he?jo:os;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function ci(e){return e==e&&!zo(e)}function mi(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in pe(n))}}function vi(e,t,n){return t=on(void 0===t?e.length-1:t,0),function(){for(var l=arguments,a=-1,i=on(l.length-t,0),o=q(i);++a<i;)o[a]=l[t+a];a=-1;for(var r=q(t+1);++a<t;)r[a]=l[a];return r[t]=n(o),tt(e,this,r)}}function pi(e,t){return t.length<2?e:cl(e,zl(t,0,-1))}function Ei(e,t){for(var n=e.length,l=rn(t.length,n),a=fa(e);l--;){var i=t[l];e[l]=ii(i,n)?a[i]:void 0}return e}function fi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var gi=yi(jl),Si=Qt||function(e,t){return Ve.setTimeout(e,t)},_i=yi(Wl);function hi(e,t,n){var l=t+"";return _i(e,function(e,t){var n=t.length;if(!n)return e;var l=n-1;return t[l]=(n>1?"& ":"")+t[l],t=t.join(n>2?", ":" "),e.replace(Y,"{\n/* [wrapped with "+t+"] */\n")}(l,function(e,t){return lt(a,function(n){var l="_."+n[0];t&n[1]&&!rt(e,l)&&e.push(l)}),e.sort()}(function(e){var t=e.match($);return t?t[1].split(Z):[]}(l),n)))}function yi(e){var t=0,n=0;return function(){var l=sn(),a=16-(l-n);if(n=l,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Ai(e,t){var n=-1,l=e.length,a=l-1;for(t=void 0===t?l:t;++n<t;){var i=Ml(n,a),o=e[i];e[i]=e[n],e[n]=o}return e.length=t,e}var Ci,Di,bi=(Ci=Do(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(V,function(e,n,l,a){t.push(l?a.replace(J,"$1"):n||e)}),t},function(e){return 500===Di.size&&Di.clear(),e}),Di=Ci.cache,Ci);function Ti(e){if("string"==typeof e||Xo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ii(e){if(null!=e){try{return ye.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oi(e){if(e instanceof Ln)return e.clone();var t=new xn(e.__wrapped__,e.__chain__);return t.__actions__=fa(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ni=Bl(function(e,t){return Bo(e)?Jn(e,il(t,1,Bo,!0)):[]}),Ri=Bl(function(e,t){var n=Ui(t);return Bo(n)&&(n=void 0),Bo(e)?Jn(e,il(t,1,Bo,!0),$a(n,2)):[]}),xi=Bl(function(e,t){var n=Ui(t);return Bo(n)&&(n=void 0),Bo(e)?Jn(e,il(t,1,Bo,!0),void 0,n):[]});function Li(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),ft(e,$a(t,3),a)}function Pi(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l-1;return void 0!==n&&(a=ar(n),a=n<0?on(l+a,0):rn(a,l-1)),ft(e,$a(t,3),a,!0)}function wi(e){return null!=e&&e.length?il(e,1):[]}function Mi(e){return e&&e.length?e[0]:void 0}var Fi=Bl(function(e){var t=ut(e,aa);return t.length&&t[0]===e[0]?gl(t):[]}),Bi=Bl(function(e){var t=Ui(e),n=ut(e,aa);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?gl(n,$a(t,2)):[]}),ki=Bl(function(e){var t=Ui(e),n=ut(e,aa);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?gl(n,void 0,t):[]});function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Hi=Bl(ji);function ji(e,t){return e&&e.length&&t&&t.length?Pl(e,t):e}var Wi=Va(function(e,t){var n=null==e?0:e.length,l=Yn(e,t);return wl(e,ut(t,function(e){return ii(e,n)?+e:e}).sort(va)),l});function Vi(e){return null==e?e:cn.call(e)}var zi=Bl(function(e){return Ql(il(e,1,Bo,!0))}),Gi=Bl(function(e){var t=Ui(e);return Bo(t)&&(t=void 0),Ql(il(e,1,Bo,!0),$a(t,2))}),Ki=Bl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Ql(il(e,1,Bo,!0),void 0,t)});function qi(e){if(!e||!e.length)return[];var t=0;return e=ot(e,function(e){if(Bo(e))return t=on(e.length,t),!0}),bt(t,function(t){return ut(e,yt(t))})}function Yi(e,t){if(!e||!e.length)return[];var n=qi(e);return null==t?n:ut(n,function(e){return tt(t,void 0,e)})}var $i=Bl(function(e,t){return Bo(e)?Jn(e,t):[]}),Zi=Bl(function(e){return na(ot(e,Bo))}),Qi=Bl(function(e){var t=Ui(e);return Bo(t)&&(t=void 0),na(ot(e,Bo),$a(t,2))}),Xi=Bl(function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,na(ot(e,Bo),void 0,t)}),Ji=Bl(qi),eo=Bl(function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Yi(e,n)});function to(e){var t=On(e);return t.__chain__=!0,t}function no(e,t){return t(e)}var lo=Va(function(e){var t=e.length,n=t?e[0]:0,l=this.__wrapped__,a=function(t){return Yn(t,e)};return!(t>1||this.__actions__.length)&&l instanceof Ln&&ii(n)?((l=l.slice(n,+n+(t?1:0))).__actions__.push({func:no,args:[a],thisArg:void 0}),new xn(l,this.__chain__).thru(function(e){return t&&!e.length&&e.push(void 0),e})):this.thru(a)}),ao=Sa(function(e,t,n){Ae.call(e,n)?++e[n]:qn(e,n,1)}),io=ba(Li),oo=ba(Pi);function ro(e,t){return(wo(e)?lt:el)(e,$a(t,3))}function so(e,t){return(wo(e)?at:tl)(e,$a(t,3))}var uo=Sa(function(e,t,n){Ae.call(e,n)?e[n].push(t):qn(e,n,[t])}),co=Bl(function(e,t,n){var l=-1,a="function"==typeof t,i=Fo(e)?q(e.length):[];return el(e,function(e){i[++l]=a?tt(t,e,n):Sl(e,t,n)}),i}),mo=Sa(function(e,t,n){qn(e,n,t)});function vo(e,t){return(wo(e)?ut:Tl)(e,$a(t,3))}var po=Sa(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Eo=Bl(function(e,t){if(null==e)return[];var n=t.length;return n>1&&oi(e,t[0],t[1])?t=[]:n>2&&oi(t[0],t[1],t[2])&&(t=[t[0]]),xl(e,il(t,1),[])}),fo=Zt||function(){return Ve.Date.now()};function go(e,t,n){return t=n?void 0:t,ka(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function So(e,t){var l;if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){return--e>0&&(l=t.apply(this,arguments)),e<=1&&(t=void 0),l}}var _o=Bl(function(e,t,n){var l=1;if(n.length){var a=Ut(n,Ya(_o));l|=32}return ka(e,l,t,n,a)}),ho=Bl(function(e,t,n){var l=3;if(n.length){var a=Ut(n,Ya(ho));l|=32}return ka(t,l,e,n,a)});function yo(e,t,l){var a,i,o,r,s,u,d=0,c=!1,m=!1,v=!0;if("function"!=typeof e)throw new ge(n);function p(t){var n=a,l=i;return a=i=void 0,d=t,r=e.apply(l,n)}function E(e){return d=e,s=Si(g,t),c?p(e):r}function f(e){var n=e-u;return void 0===u||n>=t||n<0||m&&e-d>=o}function g(){var e=fo();if(f(e))return S(e);s=Si(g,function(e){var n=t-(e-u);return m?rn(n,o-(e-d)):n}(e))}function S(e){return s=void 0,v&&a?p(e):(a=i=void 0,r)}function _(){var e=fo(),n=f(e);if(a=arguments,i=this,u=e,n){if(void 0===s)return E(u);if(m)return ua(s),s=Si(g,t),p(u)}return void 0===s&&(s=Si(g,t)),r}return t=or(t)||0,zo(l)&&(c=!!l.leading,o=(m="maxWait"in l)?on(or(l.maxWait)||0,t):o,v="trailing"in l?!!l.trailing:v),_.cancel=function(){void 0!==s&&ua(s),d=0,a=u=i=s=void 0},_.flush=function(){return void 0===s?r:S(fo())},_}var Ao=Bl(function(e,t){return Xn(e,1,t)}),Co=Bl(function(e,t,n){return Xn(e,or(t)||0,n)});function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ge(n);var l=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=l.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return l.cache=i.set(a,o)||i,o};return l.cache=new(Do.Cache||Mn),l}function bo(e){if("function"!=typeof e)throw new ge(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)}}Do.Cache=Mn;var To=ra(function(e,t){var n=(t=1==t.length&&wo(t[0])?ut(t[0],It($a())):ut(il(t,1),It($a()))).length;return Bl(function(l){for(var a=-1,i=rn(l.length,n);++a<i;)l[a]=t[a].call(this,l[a]);return tt(e,this,l)})}),Io=Bl(function(e,t){return ka(e,32,void 0,t,Ut(t,Ya(Io)))}),Oo=Bl(function(e,t){return ka(e,64,void 0,t,Ut(t,Ya(Oo)))}),No=Va(function(e,t){return ka(e,256,void 0,void 0,void 0,t)});function Ro(e,t){return e===t||e!=e&&t!=t}var xo=Pa(pl),Lo=Pa(function(e,t){return e>=t}),Po=_l(function(){return arguments}())?_l:function(e){return Go(e)&&Ae.call(e,"callee")&&!qe.call(e,"callee")},wo=q.isArray,Mo=$e?It($e):function(e){return Go(e)&&vl(e)==h};function Fo(e){return null!=e&&Vo(e.length)&&!jo(e)}function Bo(e){return Go(e)&&Fo(e)}var ko=tn||os,Uo=Ze?It(Ze):function(e){return Go(e)&&vl(e)==s};function Ho(e){if(!Go(e))return!1;var t=vl(e);return t==u||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Yo(e)}function jo(e){if(!zo(e))return!1;var t=vl(e);return t==d||t==c||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wo(e){return"number"==typeof e&&e==ar(e)}function Vo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function zo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Go(e){return null!=e&&"object"==typeof e}var Ko=Qe?It(Qe):function(e){return Go(e)&&ti(e)==m};function qo(e){return"number"==typeof e||Go(e)&&vl(e)==v}function Yo(e){if(!Go(e)||vl(e)!=p)return!1;var t=ze(e);if(null===t)return!0;var n=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ye.call(n)==Te}var $o=Xe?It(Xe):function(e){return Go(e)&&vl(e)==E},Zo=Je?It(Je):function(e){return Go(e)&&ti(e)==f};function Qo(e){return"string"==typeof e||!wo(e)&&Go(e)&&vl(e)==g}function Xo(e){return"symbol"==typeof e||Go(e)&&vl(e)==S}var Jo=et?It(et):function(e){return Go(e)&&Vo(e.length)&&!!Fe[vl(e)]},er=Pa(bl),tr=Pa(function(e,t){return e<=t});function nr(e){if(!e)return[];if(Fo(e))return Qo(e)?Vt(e):fa(e);if(At&&e[At])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[At]());var t=ti(e);return(t==m?Bt:t==f?Ht:Rr)(e)}function lr(e){return e?(e=or(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ar(e){var t=lr(e),n=t%1;return t==t?n?t-n:t:0}function ir(e){return e?$n(ar(e),0,4294967295):0}function or(e){if("number"==typeof e)return e;if(Xo(e))return NaN;if(zo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=le.test(e);return n||ie.test(e)?He(e.slice(2),n?2:8):ne.test(e)?NaN:+e}function rr(e){return ga(e,Ar(e))}function sr(e){return null==e?"":Zl(e)}var ur=_a(function(e,t){if(di(t)||Fo(t))ga(t,yr(t),e);else for(var n in t)Ae.call(t,n)&&Vn(e,n,t[n])}),dr=_a(function(e,t){ga(t,Ar(t),e)}),cr=_a(function(e,t,n,l){ga(t,Ar(t),e,l)}),mr=_a(function(e,t,n,l){ga(t,yr(t),e,l)}),vr=Va(Yn),pr=Bl(function(e,t){e=pe(e);var n=-1,l=t.length,a=l>2?t[2]:void 0;for(a&&oi(t[0],t[1],a)&&(l=1);++n<l;)for(var i=t[n],o=Ar(i),r=-1,s=o.length;++r<s;){var u=o[r],d=e[u];(void 0===d||Ro(d,_e[u])&&!Ae.call(e,u))&&(e[u]=i[u])}return e}),Er=Bl(function(e){return e.push(void 0,Ha),tt(Dr,void 0,e)});function fr(e,t,n){var l=null==e?void 0:cl(e,t);return void 0===l?n:l}function gr(e,t){return null!=e&&ni(e,t,fl)}var Sr=Oa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),e[t]=n},zr(qr)),_r=Oa(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=be.call(t)),Ae.call(e,t)?e[t].push(n):e[t]=[n]},$a),hr=Bl(Sl);function yr(e){return Fo(e)?kn(e):Dl(e)}function Ar(e){return Fo(e)?kn(e,!0):function(e){if(!zo(e))return function(e){var t=[];if(null!=e)for(var n in pe(e))t.push(n);return t}(e);var t=di(e),n=[];for(var l in e)("constructor"!=l||!t&&Ae.call(e,l))&&n.push(l);return n}(e)}var Cr=_a(function(e,t,n){Nl(e,t,n)}),Dr=_a(function(e,t,n,l){Nl(e,t,n,l)}),br=Va(function(e,t){var n={};if(null==e)return n;var l=!1;t=ut(t,function(t){return t=oa(t,e),l||(l=t.length>1),t}),ga(e,Ga(e),n),l&&(n=Zn(n,7,ja));for(var a=t.length;a--;)Xl(n,t[a]);return n}),Tr=Va(function(e,t){return null==e?{}:function(e,t){return Ll(e,t,function(t,n){return gr(e,n)})}(e,t)});function Ir(e,t){if(null==e)return{};var n=ut(Ga(e),function(e){return[e]});return t=$a(t),Ll(e,n,function(e,n){return t(e,n[0])})}var Or=Ba(yr),Nr=Ba(Ar);function Rr(e){return null==e?[]:Ot(e,yr(e))}var xr=Ca(function(e,t,n){return t=t.toLowerCase(),e+(n?Lr(t):t)});function Lr(e){return Hr(sr(e).toLowerCase())}function Pr(e){return(e=sr(e))&&e.replace(re,Pt).replace(Ne,"")}var wr=Ca(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Mr=Ca(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Fr=Aa("toLowerCase"),Br=Ca(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),kr=Ca(function(e,t,n){return e+(n?" ":"")+Hr(t)}),Ur=Ca(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Hr=Aa("toUpperCase");function jr(e,t,n){return e=sr(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.match(Q)||[]}(e):e.match(t)||[]}var Wr=Bl(function(e,t){try{return tt(e,void 0,t)}catch(e){return Ho(e)?e:new ce(e)}}),Vr=Va(function(e,t){return lt(t,function(t){t=Ti(t),qn(e,t,_o(e[t],e))}),e});function zr(e){return function(){return e}}var Gr=Ta(),Kr=Ta(!0);function qr(e){return e}function Yr(e){return Cl("function"==typeof e?e:Zn(e,1))}var $r=Bl(function(e,t){return function(n){return Sl(n,e,t)}}),Zr=Bl(function(e,t){return function(n){return Sl(e,n,t)}});function Qr(e,t,n){var l=yr(t),a=dl(t,l);null!=n||zo(t)&&(a.length||!l.length)||(n=t,t=e,e=this,a=dl(t,yr(t)));var i=!(zo(n)&&"chain"in n&&!n.chain),o=jo(e);return lt(a,function(n){var l=t[n];e[n]=l,o&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),a=n.__actions__=fa(this.__actions__);return a.push({func:l,args:arguments,thisArg:e}),n.__chain__=t,n}return l.apply(e,dt([this.value()],arguments))})}),e}function Xr(){}var Jr=Ra(ut),es=Ra(it),ts=Ra(vt);function ns(e){return ri(e)?yt(Ti(e)):function(e){return function(t){return cl(t,e)}}(e)}var ls=La(),as=La(!0);function is(){return[]}function os(){return!1}var rs,ss=Na(function(e,t){return e+t},0),us=Ma("ceil"),ds=Na(function(e,t){return e/t},1),cs=Ma("floor"),ms=Na(function(e,t){return e*t},1),vs=Ma("round"),ps=Na(function(e,t){return e-t},0);return On.after=function(e,t){if("function"!=typeof t)throw new ge(n);return e=ar(e),function(){if(--e<1)return t.apply(this,arguments)}},On.ary=go,On.assign=ur,On.assignIn=dr,On.assignInWith=cr,On.assignWith=mr,On.at=vr,On.before=So,On.bind=_o,On.bindAll=Vr,On.bindKey=ho,On.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return wo(e)?e:[e]},On.chain=to,On.chunk=function(e,t,n){t=(n?oi(e,t,n):void 0===t)?1:on(ar(t),0);var l=null==e?0:e.length;if(!l||t<1)return[];for(var a=0,i=0,o=q(Xt(l/t));a<l;)o[i++]=zl(e,a,a+=t);return o},On.compact=function(e){for(var t=-1,n=null==e?0:e.length,l=0,a=[];++t<n;){var i=e[t];i&&(a[l++]=i)}return a},On.concat=function(){var e=arguments.length;if(!e)return[];for(var t=q(e-1),n=arguments[0],l=e;l--;)t[l-1]=arguments[l];return dt(wo(n)?fa(n):[n],il(t,1))},On.cond=function(e){var t=null==e?0:e.length,l=$a();return e=t?ut(e,function(e){if("function"!=typeof e[1])throw new ge(n);return[l(e[0]),e[1]]}):[],Bl(function(n){for(var l=-1;++l<t;){var a=e[l];if(tt(a[0],this,n))return tt(a[1],this,n)}})},On.conforms=function(e){return function(e){var t=yr(e);return function(n){return Qn(n,e,t)}}(Zn(e,1))},On.constant=zr,On.countBy=ao,On.create=function(e,t){var n=Nn(e);return null==t?n:Kn(n,t)},On.curry=function e(t,n,l){var a=ka(t,8,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},On.curryRight=function e(t,n,l){var a=ka(t,16,void 0,void 0,void 0,void 0,void 0,n=l?void 0:n);return a.placeholder=e.placeholder,a},On.debounce=yo,On.defaults=pr,On.defaultsDeep=Er,On.defer=Ao,On.delay=Co,On.difference=Ni,On.differenceBy=Ri,On.differenceWith=xi,On.drop=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=n||void 0===t?1:ar(t))<0?0:t,l):[]},On.dropRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,0,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t):[]},On.dropRightWhile=function(e,t){return e&&e.length?ea(e,$a(t,3),!0,!0):[]},On.dropWhile=function(e,t){return e&&e.length?ea(e,$a(t,3),!0):[]},On.fill=function(e,t,n,l){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&oi(e,t,n)&&(n=0,l=a),function(e,t,n,l){var a=e.length;for((n=ar(n))<0&&(n=-n>a?0:a+n),(l=void 0===l||l>a?a:ar(l))<0&&(l+=a),l=n>l?0:ir(l);n<l;)e[n++]=t;return e}(e,t,n,l)):[]},On.filter=function(e,t){return(wo(e)?ot:al)(e,$a(t,3))},On.flatMap=function(e,t){return il(vo(e,t),1)},On.flatMapDeep=function(e,t){return il(vo(e,t),1/0)},On.flatMapDepth=function(e,t,n){return n=void 0===n?1:ar(n),il(vo(e,t),n)},On.flatten=wi,On.flattenDeep=function(e){return null!=e&&e.length?il(e,1/0):[]},On.flattenDepth=function(e,t){return null!=e&&e.length?il(e,t=void 0===t?1:ar(t)):[]},On.flip=function(e){return ka(e,512)},On.flow=Gr,On.flowRight=Kr,On.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,l={};++t<n;){var a=e[t];l[a[0]]=a[1]}return l},On.functions=function(e){return null==e?[]:dl(e,yr(e))},On.functionsIn=function(e){return null==e?[]:dl(e,Ar(e))},On.groupBy=uo,On.initial=function(e){return null!=e&&e.length?zl(e,0,-1):[]},On.intersection=Fi,On.intersectionBy=Bi,On.intersectionWith=ki,On.invert=Sr,On.invertBy=_r,On.invokeMap=co,On.iteratee=Yr,On.keyBy=mo,On.keys=yr,On.keysIn=Ar,On.map=vo,On.mapKeys=function(e,t){var n={};return t=$a(t,3),sl(e,function(e,l,a){qn(n,t(e,l,a),e)}),n},On.mapValues=function(e,t){var n={};return t=$a(t,3),sl(e,function(e,l,a){qn(n,l,t(e,l,a))}),n},On.matches=function(e){return Il(Zn(e,1))},On.matchesProperty=function(e,t){return Ol(e,Zn(t,1))},On.memoize=Do,On.merge=Cr,On.mergeWith=Dr,On.method=$r,On.methodOf=Zr,On.mixin=Qr,On.negate=bo,On.nthArg=function(e){return e=ar(e),Bl(function(t){return Rl(t,e)})},On.omit=br,On.omitBy=function(e,t){return Ir(e,bo($a(t)))},On.once=function(e){return So(2,e)},On.orderBy=function(e,t,n,l){return null==e?[]:(wo(t)||(t=null==t?[]:[t]),wo(n=l?void 0:n)||(n=null==n?[]:[n]),xl(e,t,n))},On.over=Jr,On.overArgs=To,On.overEvery=es,On.overSome=ts,On.partial=Io,On.partialRight=Oo,On.partition=po,On.pick=Tr,On.pickBy=Ir,On.property=ns,On.propertyOf=function(e){return function(t){return null==e?void 0:cl(e,t)}},On.pull=Hi,On.pullAll=ji,On.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,$a(n,2)):e},On.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Pl(e,t,void 0,n):e},On.pullAt=Wi,On.range=ls,On.rangeRight=as,On.rearg=No,On.reject=function(e,t){return(wo(e)?ot:al)(e,bo($a(t,3)))},On.remove=function(e,t){var n=[];if(!e||!e.length)return n;var l=-1,a=[],i=e.length;for(t=$a(t,3);++l<i;){var o=e[l];t(o,l,e)&&(n.push(o),a.push(l))}return wl(e,a),n},On.rest=function(e,t){if("function"!=typeof e)throw new ge(n);return Bl(e,t=void 0===t?t:ar(t))},On.reverse=Vi,On.sampleSize=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),(wo(e)?Hn:Ul)(e,t)},On.set=function(e,t,n){return null==e?e:Hl(e,t,n)},On.setWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Hl(e,t,n,l)},On.shuffle=function(e){return(wo(e)?jn:Vl)(e)},On.slice=function(e,t,n){var l=null==e?0:e.length;return l?(n&&"number"!=typeof n&&oi(e,t,n)?(t=0,n=l):(t=null==t?0:ar(t),n=void 0===n?l:ar(n)),zl(e,t,n)):[]},On.sortBy=Eo,On.sortedUniq=function(e){return e&&e.length?Yl(e):[]},On.sortedUniqBy=function(e,t){return e&&e.length?Yl(e,$a(t,2)):[]},On.split=function(e,t,n){return n&&"number"!=typeof n&&oi(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=sr(e))&&("string"==typeof t||null!=t&&!$o(t))&&!(t=Zl(t))&&Ft(e)?sa(Vt(e),0,n):e.split(t,n):[]},On.spread=function(e,t){if("function"!=typeof e)throw new ge(n);return t=null==t?0:on(ar(t),0),Bl(function(n){var l=n[t],a=sa(n,0,t);return l&&dt(a,l),tt(e,this,a)})},On.tail=function(e){var t=null==e?0:e.length;return t?zl(e,1,t):[]},On.take=function(e,t,n){return e&&e.length?zl(e,0,(t=n||void 0===t?1:ar(t))<0?0:t):[]},On.takeRight=function(e,t,n){var l=null==e?0:e.length;return l?zl(e,(t=l-(t=n||void 0===t?1:ar(t)))<0?0:t,l):[]},On.takeRightWhile=function(e,t){return e&&e.length?ea(e,$a(t,3),!1,!0):[]},On.takeWhile=function(e,t){return e&&e.length?ea(e,$a(t,3)):[]},On.tap=function(e,t){return t(e),e},On.throttle=function(e,t,l){var a=!0,i=!0;if("function"!=typeof e)throw new ge(n);return zo(l)&&(a="leading"in l?!!l.leading:a,i="trailing"in l?!!l.trailing:i),yo(e,t,{leading:a,maxWait:t,trailing:i})},On.thru=no,On.toArray=nr,On.toPairs=Or,On.toPairsIn=Nr,On.toPath=function(e){return wo(e)?ut(e,Ti):Xo(e)?[e]:fa(bi(sr(e)))},On.toPlainObject=rr,On.transform=function(e,t,n){var l=wo(e),a=l||ko(e)||Jo(e);if(t=$a(t,4),null==n){var i=e&&e.constructor;n=a?l?new i:[]:zo(e)&&jo(i)?Nn(ze(e)):{}}return(a?lt:sl)(e,function(e,l,a){return t(n,e,l,a)}),n},On.unary=function(e){return go(e,1)},On.union=zi,On.unionBy=Gi,On.unionWith=Ki,On.uniq=function(e){return e&&e.length?Ql(e):[]},On.uniqBy=function(e,t){return e&&e.length?Ql(e,$a(t,2)):[]},On.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Ql(e,void 0,t):[]},On.unset=function(e,t){return null==e||Xl(e,t)},On.unzip=qi,On.unzipWith=Yi,On.update=function(e,t,n){return null==e?e:Jl(e,t,ia(n))},On.updateWith=function(e,t,n,l){return l="function"==typeof l?l:void 0,null==e?e:Jl(e,t,ia(n),l)},On.values=Rr,On.valuesIn=function(e){return null==e?[]:Ot(e,Ar(e))},On.without=$i,On.words=jr,On.wrap=function(e,t){return Io(ia(t),e)},On.xor=Zi,On.xorBy=Qi,On.xorWith=Xi,On.zip=Ji,On.zipObject=function(e,t){return la(e||[],t||[],Vn)},On.zipObjectDeep=function(e,t){return la(e||[],t||[],Hl)},On.zipWith=eo,On.entries=Or,On.entriesIn=Nr,On.extend=dr,On.extendWith=cr,Qr(On,On),On.add=ss,On.attempt=Wr,On.camelCase=xr,On.capitalize=Lr,On.ceil=us,On.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=or(n))==n?n:0),void 0!==t&&(t=(t=or(t))==t?t:0),$n(or(e),t,n)},On.clone=function(e){return Zn(e,4)},On.cloneDeep=function(e){return Zn(e,5)},On.cloneDeepWith=function(e,t){return Zn(e,5,t="function"==typeof t?t:void 0)},On.cloneWith=function(e,t){return Zn(e,4,t="function"==typeof t?t:void 0)},On.conformsTo=function(e,t){return null==t||Qn(e,t,yr(t))},On.deburr=Pr,On.defaultTo=function(e,t){return null==e||e!=e?t:e},On.divide=ds,On.endsWith=function(e,t,n){e=sr(e),t=Zl(t);var l=e.length,a=n=void 0===n?l:$n(ar(n),0,l);return(n-=t.length)>=0&&e.slice(n,a)==t},On.eq=Ro,On.escape=function(e){return(e=sr(e))&&F.test(e)?e.replace(w,wt):e},On.escapeRegExp=function(e){return(e=sr(e))&&G.test(e)?e.replace(z,"\\$&"):e},On.every=function(e,t,n){var l=wo(e)?it:nl;return n&&oi(e,t,n)&&(t=void 0),l(e,$a(t,3))},On.find=io,On.findIndex=Li,On.findKey=function(e,t){return Et(e,$a(t,3),sl)},On.findLast=oo,On.findLastIndex=Pi,On.findLastKey=function(e,t){return Et(e,$a(t,3),ul)},On.floor=cs,On.forEach=ro,On.forEachRight=so,On.forIn=function(e,t){return null==e?e:ol(e,$a(t,3),Ar)},On.forInRight=function(e,t){return null==e?e:rl(e,$a(t,3),Ar)},On.forOwn=function(e,t){return e&&sl(e,$a(t,3))},On.forOwnRight=function(e,t){return e&&ul(e,$a(t,3))},On.get=fr,On.gt=xo,On.gte=Lo,On.has=function(e,t){return null!=e&&ni(e,t,El)},On.hasIn=gr,On.head=Mi,On.identity=qr,On.includes=function(e,t,n,l){e=Fo(e)?e:Rr(e),n=n&&!l?ar(n):0;var a=e.length;return n<0&&(n=on(a+n,0)),Qo(e)?n<=a&&e.indexOf(t,n)>-1:!!a&&gt(e,t,n)>-1},On.indexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=null==n?0:ar(n);return a<0&&(a=on(l+a,0)),gt(e,t,a)},On.inRange=function(e,t,n){return t=lr(t),void 0===n?(n=t,t=0):n=lr(n),function(e,t,n){return e>=rn(t,n)&&e<on(t,n)}(e=or(e),t,n)},On.invoke=hr,On.isArguments=Po,On.isArray=wo,On.isArrayBuffer=Mo,On.isArrayLike=Fo,On.isArrayLikeObject=Bo,On.isBoolean=function(e){return!0===e||!1===e||Go(e)&&vl(e)==r},On.isBuffer=ko,On.isDate=Uo,On.isElement=function(e){return Go(e)&&1===e.nodeType&&!Yo(e)},On.isEmpty=function(e){if(null==e)return!0;if(Fo(e)&&(wo(e)||"string"==typeof e||"function"==typeof e.splice||ko(e)||Jo(e)||Po(e)))return!e.length;var t=ti(e);if(t==m||t==f)return!e.size;if(di(e))return!Dl(e).length;for(var n in e)if(Ae.call(e,n))return!1;return!0},On.isEqual=function(e,t){return hl(e,t)},On.isEqualWith=function(e,t,n){var l=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===l?hl(e,t,void 0,n):!!l},On.isError=Ho,On.isFinite=function(e){return"number"==typeof e&&nn(e)},On.isFunction=jo,On.isInteger=Wo,On.isLength=Vo,On.isMap=Ko,On.isMatch=function(e,t){return e===t||yl(e,t,Qa(t))},On.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,yl(e,t,Qa(t),n)},On.isNaN=function(e){return qo(e)&&e!=+e},On.isNative=function(e){if(ui(e))throw new ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Al(e)},On.isNil=function(e){return null==e},On.isNull=function(e){return null===e},On.isNumber=qo,On.isObject=zo,On.isObjectLike=Go,On.isPlainObject=Yo,On.isRegExp=$o,On.isSafeInteger=function(e){return Wo(e)&&e>=-9007199254740991&&e<=9007199254740991},On.isSet=Zo,On.isString=Qo,On.isSymbol=Xo,On.isTypedArray=Jo,On.isUndefined=function(e){return void 0===e},On.isWeakMap=function(e){return Go(e)&&ti(e)==_},On.isWeakSet=function(e){return Go(e)&&"[object WeakSet]"==vl(e)},On.join=function(e,t){return null==e?"":ln.call(e,t)},On.kebabCase=wr,On.last=Ui,On.lastIndexOf=function(e,t,n){var l=null==e?0:e.length;if(!l)return-1;var a=l;return void 0!==n&&(a=(a=ar(n))<0?on(l+a,0):rn(a,l-1)),t==t?function(e,t,n){for(var l=n+1;l--;)if(e[l]===t)return l;return l}(e,t,a):ft(e,_t,a,!0)},On.lowerCase=Mr,On.lowerFirst=Fr,On.lt=er,On.lte=tr,On.max=function(e){return e&&e.length?ll(e,qr,pl):void 0},On.maxBy=function(e,t){return e&&e.length?ll(e,$a(t,2),pl):void 0},On.mean=function(e){return ht(e,qr)},On.meanBy=function(e,t){return ht(e,$a(t,2))},On.min=function(e){return e&&e.length?ll(e,qr,bl):void 0},On.minBy=function(e,t){return e&&e.length?ll(e,$a(t,2),bl):void 0},On.stubArray=is,On.stubFalse=os,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=ms,On.nth=function(e,t){return e&&e.length?Rl(e,ar(t)):void 0},On.noConflict=function(){return Ve._===this&&(Ve._=Ie),this},On.noop=Xr,On.now=fo,On.pad=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;if(!t||l>=t)return e;var a=(t-l)/2;return xa(Jt(a),n)+e+xa(Xt(a),n)},On.padEnd=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?e+xa(t-l,n):e},On.padStart=function(e,t,n){e=sr(e);var l=(t=ar(t))?Wt(e):0;return t&&l<t?xa(t-l,n)+e:e},On.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),un(sr(e).replace(K,""),t||0)},On.random=function(e,t,n){if(n&&"boolean"!=typeof n&&oi(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=lr(e),void 0===t?(t=e,e=0):t=lr(t)),e>t){var l=e;e=t,t=l}if(n||e%1||t%1){var a=dn();return rn(e+a*(t-e+Ue("1e-"+((a+"").length-1))),t)}return Ml(e,t)},On.reduce=function(e,t,n){var l=wo(e)?ct:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,el)},On.reduceRight=function(e,t,n){var l=wo(e)?mt:Ct,a=arguments.length<3;return l(e,$a(t,4),n,a,tl)},On.repeat=function(e,t,n){return t=(n?oi(e,t,n):void 0===t)?1:ar(t),Fl(sr(e),t)},On.replace=function(){var e=arguments,t=sr(e[0]);return e.length<3?t:t.replace(e[1],e[2])},On.result=function(e,t,n){var l=-1,a=(t=oa(t,e)).length;for(a||(a=1,e=void 0);++l<a;){var i=null==e?void 0:e[Ti(t[l])];void 0===i&&(l=a,i=n),e=jo(i)?i.call(e):i}return e},On.round=vs,On.runInContext=e,On.sample=function(e){return(wo(e)?Un:kl)(e)},On.size=function(e){if(null==e)return 0;if(Fo(e))return Qo(e)?Wt(e):e.length;var t=ti(e);return t==m||t==f?e.size:Dl(e).length},On.snakeCase=Br,On.some=function(e,t,n){var l=wo(e)?vt:Gl;return n&&oi(e,t,n)&&(t=void 0),l(e,$a(t,3))},On.sortedIndex=function(e,t){return Kl(e,t)},On.sortedIndexBy=function(e,t,n){return ql(e,t,$a(n,2))},On.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var l=Kl(e,t);if(l<n&&Ro(e[l],t))return l}return-1},On.sortedLastIndex=function(e,t){return Kl(e,t,!0)},On.sortedLastIndexBy=function(e,t,n){return ql(e,t,$a(n,2),!0)},On.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=Kl(e,t,!0)-1;if(Ro(e[n],t))return n}return-1},On.startCase=kr,On.startsWith=function(e,t,n){return e=sr(e),n=null==n?0:$n(ar(n),0,e.length),t=Zl(t),e.slice(n,n+t.length)==t},On.subtract=ps,On.sum=function(e){return e&&e.length?Dt(e,qr):0},On.sumBy=function(e,t){return e&&e.length?Dt(e,$a(t,2)):0},On.template=function(e,t,n){var l=On.templateSettings;n&&oi(e,t,n)&&(t=void 0),e=sr(e),t=cr({},t,l,Ua);var a,i,o=cr({},t.imports,l.imports,Ua),r=yr(o),s=Ot(o,r),u=0,d=t.interpolate||se,c="__p += '",m=Ee((t.escape||se).source+"|"+d.source+"|"+(d===H?ee:se).source+"|"+(t.evaluate||se).source+"|$","g"),v="//# sourceURL="+(Ae.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Me+"]")+"\n";e.replace(m,function(t,n,l,o,r,s){return l||(l=o),c+=e.slice(u,s).replace(ue,Mt),n&&(a=!0,c+="' +\n__e("+n+") +\n'"),r&&(i=!0,c+="';\n"+r+";\n__p += '"),l&&(c+="' +\n((__t = ("+l+")) == null ? '' : __t) +\n'"),u=s+t.length,t}),c+="';\n";var p=Ae.call(t,"variable")&&t.variable;if(p){if(X.test(p))throw new ce("Invalid `variable` option passed into `_.template`")}else c="with (obj) {\n"+c+"\n}\n";c=(i?c.replace(R,""):c).replace(x,"$1").replace(L,"$1;"),c="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var E=Wr(function(){return me(r,v+"return "+c).apply(void 0,s)});if(E.source=c,Ho(E))throw E;return E},On.times=function(e,t){if((e=ar(e))<1||e>9007199254740991)return[];var n=4294967295,l=rn(e,4294967295);e-=4294967295;for(var a=bt(l,t=$a(t));++n<e;)t(n);return a},On.toFinite=lr,On.toInteger=ar,On.toLength=ir,On.toLower=function(e){return sr(e).toLowerCase()},On.toNumber=or,On.toSafeInteger=function(e){return e?$n(ar(e),-9007199254740991,9007199254740991):0===e?e:0},On.toString=sr,On.toUpper=function(e){return sr(e).toUpperCase()},On.trim=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=Zl(t)))return e;var l=Vt(e),a=Vt(t);return sa(l,Rt(l,a),xt(l,a)+1).join("")},On.trimEnd=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.slice(0,zt(e)+1);if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,0,xt(l,Vt(t))+1).join("")},On.trimStart=function(e,t,n){if((e=sr(e))&&(n||void 0===t))return e.replace(K,"");if(!e||!(t=Zl(t)))return e;var l=Vt(e);return sa(l,Rt(l,Vt(t))).join("")},On.truncate=function(e,t){var n=30,l="...";if(zo(t)){var a="separator"in t?t.separator:a;n="length"in t?ar(t.length):n,l="omission"in t?Zl(t.omission):l}var i=(e=sr(e)).length;if(Ft(e)){var o=Vt(e);i=o.length}if(n>=i)return e;var r=n-Wt(l);if(r<1)return l;var s=o?sa(o,0,r).join(""):e.slice(0,r);if(void 0===a)return s+l;if(o&&(r+=s.length-r),$o(a)){if(e.slice(r).search(a)){var u,d=s;for(a.global||(a=Ee(a.source,sr(te.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var c=u.index;s=s.slice(0,void 0===c?r:c)}}else if(e.indexOf(Zl(a),r)!=r){var m=s.lastIndexOf(a);m>-1&&(s=s.slice(0,m))}return s+l},On.unescape=function(e){return(e=sr(e))&&M.test(e)?e.replace(P,Gt):e},On.uniqueId=function(e){var t=++Ce;return sr(e)+t},On.upperCase=Ur,On.upperFirst=Hr,On.each=ro,On.eachRight=so,On.first=Mi,Qr(On,(rs={},sl(On,function(e,t){Ae.call(On.prototype,t)||(rs[t]=e)}),rs),{chain:!1}),On.VERSION="4.17.21",lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){On[e].placeholder=On}),lt(["drop","take"],function(e,t){Ln.prototype[e]=function(n){n=void 0===n?1:on(ar(n),0);var l=this.__filtered__&&!t?new Ln(this):this.clone();return l.__filtered__?l.__takeCount__=rn(n,l.__takeCount__):l.__views__.push({size:rn(n,4294967295),type:e+(l.__dir__<0?"Right":"")}),l},Ln.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),lt(["filter","map","takeWhile"],function(e,t){var n=t+1,l=1==n||3==n;Ln.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:$a(e,3),type:n}),t.__filtered__=t.__filtered__||l,t}}),lt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Ln.prototype[e]=function(){return this[n](1).value()[0]}}),lt(["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(qr)},Ln.prototype.find=function(e){return this.filter(e).head()},Ln.prototype.findLast=function(e){return this.reverse().find(e)},Ln.prototype.invokeMap=Bl(function(e,t){return"function"==typeof e?new Ln(this):this.map(function(n){return Sl(n,e,t)})}),Ln.prototype.reject=function(e){return this.filter(bo($a(e)))},Ln.prototype.slice=function(e,t){e=ar(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=ar(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)},sl(Ln.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),a=On[l?"take"+("last"==t?"Right":""):t],i=l||/^find/.test(t);a&&(On.prototype[t]=function(){var t=this.__wrapped__,o=l?[1]:arguments,r=t instanceof Ln,s=o[0],u=r||wo(t),d=function(e){var t=a.apply(On,dt([e],o));return l&&c?t[0]:t};u&&n&&"function"==typeof s&&1!=s.length&&(r=u=!1);var c=this.__chain__,m=!!this.__actions__.length,v=i&&!c,p=r&&!m;if(!i&&u){t=p?t:new Ln(this);var E=e.apply(t,o);return E.__actions__.push({func:no,args:[d],thisArg:void 0}),new xn(E,c)}return v&&p?e.apply(this,o):(E=this.thru(d),v?l?E.value()[0]:E.value():E)})}),lt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Se[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);On.prototype[e]=function(){var e=arguments;if(l&&!this.__chain__){var a=this.value();return t.apply(wo(a)?a:[],e)}return this[n](function(n){return t.apply(wo(n)?n:[],e)})}}),sl(Ln.prototype,function(e,t){var n=On[t];if(n){var l=n.name+"";Ae.call(_n,l)||(_n[l]=[]),_n[l].push({name:t,func:n})}}),_n[Ia(void 0,2).name]=[{name:"wrapper",func:void 0}],Ln.prototype.clone=function(){var e=new Ln(this.__wrapped__);return e.__actions__=fa(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=fa(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=fa(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),l=t<0,a=n?e.length:0,i=function(e,t,n){for(var l=-1,a=n.length;++l<a;){var i=n[l],o=i.size;switch(i.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=rn(t,e+o);break;case"takeRight":e=on(e,t-o)}}return{start:e,end:t}}(0,a,this.__views__),o=i.start,r=i.end,s=r-o,u=l?r:o-1,d=this.__iteratees__,c=d.length,m=0,v=rn(s,this.__takeCount__);if(!n||!l&&a==s&&v==s)return ta(e,this.__actions__);var p=[];e:for(;s--&&m<v;){for(var E=-1,f=e[u+=t];++E<c;){var g=d[E],S=g.type,_=(0,g.iteratee)(f);if(2==S)f=_;else if(!_){if(1==S)continue e;break e}}p[m++]=f}return p},On.prototype.at=lo,On.prototype.chain=function(){return to(this)},On.prototype.commit=function(){return new xn(this.value(),this.__chain__)},On.prototype.next=function(){void 0===this.__values__&&(this.__values__=nr(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(e){for(var t,n=this;n instanceof Rn;){var l=Oi(n);l.__index__=0,l.__values__=void 0,t?a.__wrapped__=l:t=l;var a=l;n=n.__wrapped__}return a.__wrapped__=e,t},On.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:[Vi],thisArg:void 0}),new xn(t,this.__chain__)}return this.thru(Vi)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ta(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,At&&(On.prototype[At]=function(){return this}),On}();Ge?((Ge.exports=Kt)._=Kt,ze._=Kt):Ve._=Kt}).call(U)});const W=["searchParams","onFilterChange","defaultSearchParams","statusMap","moduleCode"],V=e=>{var i;let{searchParams:o,onFilterChange:r,defaultSearchParams:s,statusMap:u,moduleCode:c}=e,m=p(e,W);const{t:E}=a.useTranslation(),f=d.useQueryClient(),[g,S]=n.useState(()=>v({},o,{services:[]})),_=[{label:"AST_NEW_ASSET",value:"asset-create"}],h=e=>{let t=e.delete,n=v({},g,e);t&&t.forEach(e=>delete n[e]),delete e.delete,S(v({},n))},y=()=>{S(v({},s,{services:[]})),r(v({},s))},A=Digit.ULBService.getCurrentTenantId();return l.createElement(l.Fragment,null,l.createElement("div",{className:"filter"},l.createElement("div",{className:"filter-card"},l.createElement("div",{className:"heading",style:{alignItems:"center"}},l.createElement("div",{className:"filter-label",style:{display:"flex",alignItems:"center"}},l.createElement("span",null,l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M0.66666 2.48016C3.35999 5.9335 8.33333 12.3335 8.33333 12.3335V20.3335C8.33333 21.0668 8.93333 21.6668 9.66666 21.6668H12.3333C13.0667 21.6668 13.6667 21.0668 13.6667 20.3335V12.3335C13.6667 12.3335 18.6267 5.9335 21.32 2.48016C22 1.60016 21.3733 0.333496 20.2667 0.333496H1.71999C0.613327 0.333496 -0.01334 1.60016 0.66666 2.48016Z",fill:"#505A5F"}))),l.createElement("span",{style:{marginLeft:"8px",fontWeight:"normal"}},E("ES_COMMON_FILTER_BY"),":")),l.createElement("div",{className:"clearAll",onClick:y},E("ES_COMMON_CLEAR_ALL")),"desktop"===m.type&&l.createElement("span",{className:"clear-search",onClick:y,style:{border:"1px solid #e0e0e0",padding:"6px"}},l.createElement("svg",{width:"17",height:"17",viewBox:"0 0 16 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M8 5V8L12 4L8 0V3C3.58 3 0 6.58 0 11C0 12.57 0.46 14.03 1.24 15.26L2.7 13.8C2.25 12.97 2 12.01 2 11C2 7.69 4.69 5 8 5ZM14.76 6.74L13.3 8.2C13.74 9.04 14 9.99 14 11C14 14.31 11.31 17 8 17V14L4 18L8 22V19C12.42 19 16 15.42 16 11C16 9.43 15.54 7.97 14.76 6.74Z",fill:"#505A5F"}))),"mobile"===m.type&&l.createElement("span",{onClick:m.onClose},l.createElement(t.CloseSvg,null))),l.createElement("div",null,l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("ES_INBOX_LOCALITY"),":"),l.createElement(t.Localities,{selectLocality:e=>{h({locality:[...(null==g?void 0:g.locality)||[],e]})},tenantId:A,boundaryType:"revenue"}),l.createElement("div",{className:"tag-container"},null==g||null===(i=g.locality)||void 0===i?void 0:i.map((e,n)=>l.createElement(t.RemoveableTag,{key:n,text:E(e.i18nkey),onClick:()=>{h({locality:null==g?void 0:g.locality.filter(t=>t.code!==e.code)})}})))),l.createElement("div",null,l.createElement("div",{className:"filter-label",style:{fontWeight:"normal"}},E("AST_APPLICATION_TYPE")),_.map((e,n)=>{var a;const i=null==g||null===(a=g.services)||void 0===a?void 0:a.includes(e.value);return l.createElement(t.CheckBox,{key:n+"service",label:E(e.label),value:e.label,checked:i,onChange:t=>((e,t)=>{var n;h(e.target.checked?{services:Array.isArray(g.services)?[...g.services,t]:[t]}:{services:g.services.filter(e=>e!==t),applicationStatus:null===(n=g.applicationStatus)||void 0===n?void 0:n.filter(e=>e.stateBusinessService!==t)})})(t,e.value)})})),l.createElement("div",null,l.createElement(k,{searchParams:g,businessServices:g.services,statusMap:u||f.getQueryData("INBOX_STATUS_MAP_"+c),moduleCode:c,onAssignmentChange:(e,t)=>{if(e.target.checked)h({applicationStatus:[...null==g?void 0:g.applicationStatus,t]});else{let e=null==g?void 0:g.applicationStatus.filter(e=>e.state!==t.state);h({applicationStatus:e})}}})),l.createElement("div",null,l.createElement(t.SubmitBar,{onSubmit:()=>{r(0===g.services.length?v({},g,{services:_.map(e=>e.value)}):g)},label:E("ES_COMMON_APPLY")}))))))},z=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)),q=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;const{data:E,isLoading:f}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:g,data:S}=Digit.Hooks.pt.useMDMS(s,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[_,y]=n.useState({}),[A,C]=n.useState({}),[D,b]=n.useState([]),[T,I]=n.useState(null),[O,N]=n.useState(null),[R,x]=n.useState(null),[L,P]=n.useState(null),[w,M]=n.useState([]),[F,B]=n.useState(null),[k,U]=n.useState(!1);function H(e){N(e.target.files[0])}return n.useEffect(()=>{var e;S&&S["egf-master"]&&M(null===(e=S["egf-master"])||void 0===e?void 0:e.FinancialYear)},[S]),n.useEffect(()=>{var e;b(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{P(null);const e=function(){if(O){const e=function(){if(O.size>=5242880)P(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",O,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?x(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):P(o("CS_FILE_UPLOAD_ERROR"))})},function(){P(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[O]),n.useEffect(()=>{r&&y(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:a,financialYears:i,selectedFinancialYear:o,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+a.action+"_APPLICATION",submit:"WF_PT.CREATE_"+a.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(t.RadioButtons,{options:i,optionsKey:"name",onSelect:r,selectedOption:o})}]}]}})({t:o,action:r,financialYears:w,selectedFinancialYear:F,setSelectedFinancialYear:B}):(e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:v}=e;return{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==i?void 0:i.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||"SENDBACKTOCITIZEN"===(null==i?void 0:i.action)?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("ES_PT_ATTACH_FILE")+(i.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,hintText:a("PT_ATTACH_RESTRICTIONS_SIZE"),message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:D,selectedApprover:T,setSelectedApprover:I,selectFile:H,uploadedFile:R,setUploadedFile:x,businessService:m}))},[r,D,w,F,R]),r&&_.form?l.createElement(t.Modal,{headerBarMain:l.createElement(z,{label:o(_.label.heading)}),headerBarEnd:l.createElement(K,{onClick:u}),actionCancelLabel:o(_.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(_.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!F:f||(null==r?void 0:r.docUploadRequired)&&!R,formId:"modal-action"},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let t={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:v({},c,{workflow:t})})}else if(null!=r&&r.showFinancialYearsModal)d({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==F?void 0:F.name,propertyId:null==c?void 0:c.propertyId,tenantId:s,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let t={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:m,moduleName:p};t.assignes=null!=r&&r.isTerminateState||!T?[]:[T],R&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==O?void 0:O.name,fileStoreId:R}]),d({Property:v({},c,{workflow:t})})}},defaultValues:A,formId:"modal-action"})):l.createElement(t.Loader,null)},Y=e=>l.createElement("h1",{className:"heading-m"},e.label),$=()=>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"})),Z=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement($,null)),Q=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const{data:p}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:f}=Digit.Hooks.pt.useMDMS(s,m,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[g,S]=n.useState({}),[_,y]=n.useState({}),[A,C]=n.useState([]),[D,b]=n.useState({}),[T,I]=n.useState(null),[O,N]=n.useState(null),[R,x]=n.useState(null),[L,P]=n.useState([]),[w,M]=n.useState(null);n.useEffect(()=>{var e;f&&f["egf-master"]&&P(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]);const{data:F}=Digit.Hooks.useCustomMDMS(s,"common-masters",[{name:"Department"}]);function B(e){I(e.target.files[0])}return n.useEffect(()=>{if(p&&F){var e;const t=F["common-masters"].Department;C(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var n,l,a;const i=null==e||null===(n=e.assignments)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.department,o=null==t?void 0:t.find(e=>(null==e?void 0:e.code)===i);return console.log("matchedDept===",o),{uuid:null==e?void 0:e.uuid,name:(null==e||null===(a=e.user)||void 0===a?void 0:a.name)+" - "+(null==o?void 0:o.name)}}))}},[p]),n.useEffect(()=>{!function(){try{x(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)x(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",T,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?N(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):x(o("CS_FILE_UPLOAD_ERROR"))})},function(){x(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),n.useEffect(()=>{r&&S((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c}=e,m=!0;return"SENDBACKTOCITIZEN"!=(null==a?void 0:a.action)&&"APPROVE"!=(null==a?void 0:a.action)||(m=!1),a.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:m?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:A,selectedApprover:D,setSelectedApprover:b,selectFile:B,uploadedFile:O,setUploadedFile:N,businessService:m}))},[r,A,L,w,O]),r&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Y,{label:o(g.label.heading)}),headerBarEnd:l.createElement(Z,{onClick:u}),actionCancelLabel:o(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=v({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=D&&D.uuid?[null==D?void 0:D.uuid]:null,wfDocuments:O?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:O}]:null}),d({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},X=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),J=()=>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"})),ee=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(J,null)),te=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),x=!!Digit.Utils.browser.isMobile();function L(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))R(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",b,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,approvers:i,selectedApprover:o,setSelectedApprover:r,selectFile:s,uploadedFile:u,setUploadedFile:d,businessService:c,error:m}=e,v=!0;return"SENDBACKTOCITIZEN"==(null==a?void 0:a.action)&&(v=!1),a.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:v?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:v?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:v?l.createElement(t.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:o}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:s,onDelete:()=>{d(null)},message:u?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:L,uploadedFile:I,setUploadedFile:O,businessService:m,error:N}))},[r,y,I,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(X,{label:o(f.label.heading)}),headerBarEnd:l.createElement(ee,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:x?{width:"720px"}:{},style:x?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:x?{paddingLeft:"5px"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){c=v({},c,{action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null,wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null}),d({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},ne=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-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"})),ae=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(le,null)),ie=e=>{var a,i,o,r,s,u,c,m,p,E,f,g;let{t:S,action:_,tenantId:y,closeModal:A,submitAction:C,applicationDetails:D,applicationData:b,businessService:T,workflowDetails:I,blockReason:O}=e;console.log("applicationData",b),console.log("workflowDetails",I),Digit.Hooks.obps.useObpsAPI(null!==(a=b)&&void 0!==a&&null!==(i=a.landInfo)&&void 0!==i&&null!==(o=i.address)&&void 0!==o&&o.city?null===(r=b)||void 0===r||null===(s=r.landInfo)||void 0===s||null===(u=s.address)||void 0===u?void 0:u.city:y,!1);const{data:N,isLoading:R}=Digit.Hooks.useEmployeeSearch(y,{roles:null==I||null===(c=I.data)||void 0===c||null===(m=c.initialActionState)||void 0===m||null===(p=m.nextActions)||void 0===p||null===(E=p.filter(e=>(null==e?void 0:e.action)==(null==_?void 0:_.action)))||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.assigneeRoles)||void 0===g?void 0:g.map(e=>({code:e})),isActive:!0},{enabled:!(null!=_&&_.isTerminateState)}),[x,L]=(d.useQueryClient(),n.useState({})),[P,w]=n.useState({}),[M,F]=n.useState([]),[B,k]=n.useState([]),[U,H]=n.useState({}),[j,W]=n.useState({}),[V,z]=n.useState(null),[G,K]=n.useState(null),[q,Y]=n.useState(null),[$,Z]=n.useState(null),Q=!!Digit.Utils.browser.isMobile();function X(e){z(e.target.files[0])}n.useEffect(()=>{var e;F(null==N||null===(e=N.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[N]),n.useEffect(()=>{!function(){try{Y(null);const e=function(){if(V){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(V.size>=5242880)Y(S("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=V&&V.type&&!e.test(null==V?void 0:V.type))Y(S("NOT_SUPPORTED_FILE_TYPE"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",V,Digit.ULBService.getStateId()||(null==y?void 0:y.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?K(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):Y(S("CS_FILE_UPLOAD_ERROR"))})},function(){Y(S("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[V]);const J=e=>{let t=[];return e&&e.map((e,n)=>{t.push({documentType:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_","."),fileStoreId:e.fileStoreId,fileStore:e.fileStoreId,fileName:"",dropDownValues:{value:(e.documentType+"_"+e.documentType.split("_")[1]).replaceAll("_",".")}})}),t},ee=e=>{let t=[];var n;for(n=0;n<(null==e?void 0:e.questionLength);n++){var l;t.push({remarks:e["Remarks_"+n],question:null==e?void 0:e.questionList[n].question,value:null==e||null===(l=e["question_"+n])||void 0===l?void 0:l.code})}return t},te=e=>{var t,n;let l=[],a=[];var i,o;return(null==e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.fieldinspection_pending)||void 0===n?void 0:n.length)>0&&(a=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),a=a.filter(e=>{if(!e.date)return!1;const t=new Date;return new Date(e.date)<=t}),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(o=l)||void 0===o?void 0:o.length)>0&&l.map((e,t)=>{a.push({docs:J(e.Documents),date:e.InspectionDate,questions:ee(e),time:null==e?void 0:e.InspectionTime})}),console.log("FIELDINSPECTION_INPROGRESS",a),a=a.filter(e=>e.date&&e.time),console.log("inspectionObinspectionOb",a)):sessionStorage.removeItem("INSPECTION_DATA"),[...a]},le=e=>{let t=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),n=[];return t.map(e=>{var t,l,a,i,o,r;(null==e||null===(t=e.uploadedDocuments)||void 0===t||null===(l=t[0])||void 0===l||null===(a=l.values)||void 0===a?void 0:a.length)>0&&(n=[...n,...null==e||null===(i=e.uploadedDocuments)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(n=[...n,...null==e?void 0:e.newUploadedDocs])}),n},ie=()=>{var e;const t=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),n=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==t?void 0:t.reduce((e,t)=>null!=t&&t.checked?e.push(null==t?void 0:t.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==n?n.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return n.useEffect(()=>{k(null==O?void 0:O.map(e=>({code:null==e?void 0:e.code,name:null==e?void 0:e.value}))),_&&L((e=>{var n,a,i,o,r,s,u;let{t:d,action:c,approvers:m,selectedApprover:v,setSelectedApprover:p,selectedBlockReason:E,setBlockReason:f,selectFile:g,uploadedFile:S,setUploadedFile:_,assigneeLabel:h,businessService:y,error:A,blockReasonFiltered:C}=e,D=!1;return"REVOCATE"!=(null==c?void 0:c.action)&&"REJECT"!=(null==c?void 0:c.action)&&"SKIP_PAYMENT"!=c.action&&"SEND_BACK_TO_CITIZEN"!=(null==c?void 0:c.action)&&"APPROVE"!=(null==c?void 0:c.action)||(D=!0),{label:{heading:"WF_"+(null==c?void 0:c.action)+"_APPLICATION",submit:"WF_"+y+"_"+(null==c?void 0:c.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(n=c.state)||void 0===n?void 0:n.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(a=c.state)||void 0===a?void 0:a.state)?null:d(h||"WF_ROLE_"+(null===(i=c.assigneeRoles)||void 0===i?void 0:i[0])),type:"dropdown",populators:c.isTerminateState||D||"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(o=c.state)||void 0===o?void 0:o.state)||"FORWARD"==(null==c?void 0:c.action)&&"FIELDINSPECTION_PENDING"==(null==c||null===(r=c.state)||void 0===r?void 0:r.state)?null:l.createElement(t.Dropdown,{option:m,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:p,selected:v})},{label:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(s=c.state)||void 0===s?void 0:s.state)?d("BLOCK_REASON"):null,type:"dropdown",populators:"BLOCK"==(null==c?void 0:c.action)&&"PENDINGAPPROVAL"==(null==c||null===(u=c.state)||void 0===u?void 0:u.state)?l.createElement(t.Dropdown,{option:C,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:f,selected:E,isMandatory:!0}):null},{label:d("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+d("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:g,onDelete:()=>{_(null)},message:S?"1 "+d("ES_PT_ACTION_FILEUPLOADED"):d("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:A})}]}]}})({t:S,action:_,approvers:M,selectedApprover:U,setSelectedApprover:H,selectedBlockReason:j,setBlockReason:W,selectFile:X,uploadedFile:G,setUploadedFile:K,businessService:T,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL_BPA",error:q,blockReasonFiltered:B}))},[_,M,$,G,q]),_&&x.form?l.createElement(t.Modal,{headerBarMain:l.createElement(ne,{label:S(x.label.heading)}),headerBarEnd:l.createElement(ae,{onClick:A}),actionCancelLabel:S(x.label.cancel),actionCancelOnSubmit:A,actionSaveLabel:S(x.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Q?{width:"720px"}:{},style:Q?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Q?{paddingLeft:"5px"}:{}},R?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:x.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var t,n,l,a,i,o,r,s,u,d,c,m,p,E,f,g,h,T,O,N,R,x,L,P,w,M,F;b=v({},b,{documents:le(),additionalDetails:v({},null===(t=b)||void 0===t?void 0:t.additionalDetails,{fieldinspection_pending:te(b),pendingapproval:ie(),blockingReason:null==j?void 0:j.name}),workflow:{action:null==_?void 0:_.action,comment:(null==e||null===(n=e.comments)||void 0===n?void 0:n.length)>0?null==e?void 0:e.comments:null,comments:(null==e||null===(l=e.comments)||void 0===l?void 0:l.length)>0?null==e?void 0:e.comments:null,assignee:"FIELDINSPECTION_INPROGRESS"===(null==I||null===(a=I.data)||void 0===a||null===(i=a.processInstances)||void 0===i||null===(o=i[0])||void 0===o||null===(r=o.state)||void 0===r?void 0:r.applicationStatus)?[null==I||null===(s=I.data)||void 0===s||null===(u=s.processInstances)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.assigner)||void 0===c?void 0:c.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,assignes:"FIELDINSPECTION_INPROGRESS"===(null==I||null===(m=I.data)||void 0===m||null===(p=m.processInstances)||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.state)||void 0===f?void 0:f.applicationStatus)?[null==I||null===(g=I.data)||void 0===g||null===(h=g.processInstances)||void 0===h||null===(T=h[0])||void 0===T||null===(O=T.assigner)||void 0===O?void 0:O.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,varificationDocuments:G?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:G}]:null},action:null==_?void 0:_.action,comment:null==e?void 0:e.comments,assignee:"FIELDINSPECTION_INPROGRESS"===(null==I||null===(N=I.data)||void 0===N||null===(R=N.processInstances)||void 0===R||null===(x=R[0])||void 0===x||null===(L=x.state)||void 0===L?void 0:L.applicationStatus)?[null==I||null===(P=I.data)||void 0===P||null===(w=P.processInstances)||void 0===w||null===(M=w[0])||void 0===M||null===(F=M.assigner)||void 0===F?void 0:F.uuid]:null!=U&&U.uuid?[null==U?void 0:U.uuid]:null,wfDocuments:G?[{documentType:(null==_?void 0:_.action)+" DOC",fileName:null==V?void 0:V.name,fileStoreId:G}]:null});const B=function(e,t,n,l,a,i,o,r,s,u,d,c){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null===(e=b)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null===(l=b)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null===(o=b)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(s=r.selfCertificationCharges)||void 0===s?void 0:s.BPA_WATER_CHARGES)+parseInt(null===(u=b)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.selfCertificationCharges)||void 0===c?void 0:c.BPA_GAUSHALA_CHARGES_CESS))){var m,p,E;b.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",b.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",b.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",b.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),b.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const e=null==D||null===(m=D.nocData)||void 0===m?void 0:m.map(e=>{const t=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:v({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...t||[]]})}});let t={sourceRefId:null==e||null===(p=e[0])||void 0===p||null===(E=p.Noc)||void 0===E?void 0:E.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(y,t)).then(function(t){var n;let l=!0,a=!0;null==t||null===(n=t.Noc)||void 0===n||n.map(e=>{var t,n,i,o,r;"APPROVED"!==(null==e||null===(t=e.applicationStatus)||void 0===t?void 0:t.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=l&&1!=a||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?l=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(a=!1))});let i=[];if(e&&e.map(e=>{var t,n,o,r,s,u,d,c,m,v,p,E;("APPROVED"!=(null==e||null===(t=e.Noc)||void 0===t||null===(n=t.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(o=e.Noc)||void 0===o||null===(r=o.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(u=s.applicationStatus)||void 0===u?void 0:u.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(d=e.Noc)||void 0===d||null===(c=d.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(m=e.Noc)||void 0===m||null===(v=m.applicationStatus)||void 0===v?void 0:v.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(p=e.Noc)||void 0===p?void 0:p.nocType)&&l||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&a)&&i.push(e)}),"FIELDINSPECTION_INPROGRESS"==b.status){let e=JSON.parse(sessionStorage.getItem("INSPECTION_DATA"));(null==e?void 0:e.length)>0&&e.map((e,t)=>{e.InspectionDate&&e.InspectionTime?C({BPA:b},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0}):(A(),alert(S("Please fill Inspection Date and Time"))),console.log(" ob.InspectionDate && ob.InspectionTime",e.InspectionDate,e.InspectionTime)})}else C({BPA:b},(null==i?void 0:i.length)>0&&i,{isStakeholder:!1,bpa:!0})})}A(),alert(S("Enterd Less Adjustment amount is invalid"))}();return Promise.resolve(B&&B.then?B.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:P,formId:"modal-action"})):l.createElement(t.Loader,null)},oe=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),re=()=>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"})),se=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(re,null)),ue=e=>{var a,o;let{t:r,action:s,tenantId:u,closeModal:c,submitAction:m,applicationData:p,businessService:E}=e;const{data:f,isLoading:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==s||null===(a=s.assigneeRoles)||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),[S,_]=(d.useQueryClient(),n.useState({})),[y,A]=n.useState({}),[C,D]=n.useState([]),[b,T]=n.useState({}),[I,O]=n.useState(null),[N,R]=n.useState(null),[x,L]=n.useState(null),P=!!Digit.Utils.browser.isMobile();function w(e){O(e.target.files[0])}return i.useHistory(),n.useEffect(()=>{var e;D(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[f]),n.useEffect(()=>{!function(){try{L(null);const e=function(){if(I){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(I.size>=5242880)L(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=I&&I.type&&!e.test(null==I?void 0:I.type))L(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",I,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?R(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):L(r("CS_FILE_UPLOAD_ERROR"))})},function(){L(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[I]),n.useEffect(()=>{s&&_((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,assigneeLabel:m,businessService:v,error:p}=e,E=!1;"REVOCATE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)||(E=!0);let f=!1;return"APPROVE"!=(null==i?void 0:i.action)&&"REJECT"!=(null==i?void 0:i.action)&&"AUTO_APPROVE"!=i.action&&"AUTO_REJECT"!=i.action||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+v+"_"+(null==i?void 0:i.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:i.isTerminateState||f?null:a(m||"WF_ROLE_"+(null===(n=i.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:i.isTerminateState||f?null:l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r})},{label:a("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+a("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{c(null)},showHint:!0,message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:p})}]}]}})({t:r,action:s,approvers:C,selectedApprover:b,setSelectedApprover:T,selectFile:w,uploadedFile:N,setUploadedFile:R,businessService:E,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:x}))},[s,C,N,x]),s&&S.form?l.createElement(t.Modal,{headerBarMain:l.createElement(oe,{label:r(S.label.heading)}),headerBarEnd:l.createElement(se,{onClick:c}),actionCancelLabel:r(S.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:P?{width:"720px"}:{},style:P?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:P?{paddingLeft:"5px"}:{}},g?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:S.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l;let a=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(t=p)||void 0===t||null===(n=t.documents)||void 0===n?void 0:n.length)>0?[...null===(l=p)||void 0===l?void 0:l.documents]:[];a.map((e,t)=>{i.push(e)}),p=v({},p,{workflow:{action:null==s?void 0:s.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=b&&b.uuid?[null==b?void 0:b.uuid]:null,documents:N?[{documentType:(null==s?void 0:s.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:N}]:null},documents:i}),m({Noc:p},!1,{isNoc:!0})},defaultValues:y,formId:"modal-action"})):l.createElement(t.Loader,null)};var de=function(e,t){return e===t||e!=e&&t!=t},ce=function(e,t){for(var n=e.length;n--;)if(de(e[n][0],t))return n;return-1},me=Array.prototype.splice;function ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}ve.prototype.clear=function(){this.__data__=[],this.size=0},ve.prototype.delete=function(e){var t=this.__data__,n=ce(t,e);return!(n<0||(n==t.length-1?t.pop():me.call(t,n,1),--this.size,0))},ve.prototype.get=function(e){var t=this.__data__,n=ce(t,e);return n<0?void 0:t[n][1]},ve.prototype.has=function(e){return ce(this.__data__,e)>-1},ve.prototype.set=function(e,t){var n=this.__data__,l=ce(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var pe,Ee=ve,fe="object"==typeof U&&U&&U.Object===Object&&U,ge="object"==typeof self&&self&&self.Object===Object&&self,Se=fe||ge||Function("return this")(),_e=Se.Symbol,he=Object.prototype,ye=he.hasOwnProperty,Ae=he.toString,Ce=_e?_e.toStringTag:void 0,De=Object.prototype.toString,be=_e?_e.toStringTag:void 0,Te=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":be&&be in Object(e)?function(e){var t=ye.call(e,Ce),n=e[Ce];try{e[Ce]=void 0;var l=!0}catch(e){}var a=Ae.call(e);return l&&(t?e[Ce]=n:delete e[Ce]),a}(e):function(e){return De.call(e)}(e)},Ie=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Oe=function(e){if(!Ie(e))return!1;var t=Te(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Ne=Se["__core-js_shared__"],Re=(pe=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||""))?"Symbol(src)_1."+pe:"",xe=Function.prototype.toString,Le=function(e){if(null!=e){try{return xe.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Pe=/^\[object .+?Constructor\]$/,we=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Me=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ie(e)||(t=e,Re&&Re in t))&&(Oe(e)?we:Pe).test(Le(e));var t}(n)?n:void 0},Fe=Me(Se,"Map"),Be=Me(Object,"create"),ke=Object.prototype.hasOwnProperty,Ue=Object.prototype.hasOwnProperty;function He(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}He.prototype.clear=function(){this.__data__=Be?Be(null):{},this.size=0},He.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},He.prototype.get=function(e){var t=this.__data__;if(Be){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return ke.call(t,e)?t[e]:void 0},He.prototype.has=function(e){var t=this.__data__;return Be?void 0!==t[e]:Ue.call(t,e)},He.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Be&&void 0===t?"__lodash_hash_undefined__":t,this};var je=He,We=function(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map};function Ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Ve.prototype.clear=function(){this.size=0,this.__data__={hash:new je,map:new(Fe||Ee),string:new je}},Ve.prototype.delete=function(e){var t=We(this,e).delete(e);return this.size-=t?1:0,t},Ve.prototype.get=function(e){return We(this,e).get(e)},Ve.prototype.has=function(e){return We(this,e).has(e)},Ve.prototype.set=function(e,t){var n=We(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var ze=Ve;function Ge(e){var t=this.__data__=new Ee(e);this.size=t.size}Ge.prototype.clear=function(){this.__data__=new Ee,this.size=0},Ge.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ge.prototype.get=function(e){return this.__data__.get(e)},Ge.prototype.has=function(e){return this.__data__.has(e)},Ge.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ee){var l=n.__data__;if(!Fe||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new ze(l)}return n.set(e,t),this.size=n.size,this};var Ke=Ge,qe=function(){try{var e=Me(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ye=function(e,t,n){"__proto__"==t&&qe?qe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},$e=Object.prototype.hasOwnProperty,Ze=function(e,t,n){var l=e[t];$e.call(e,t)&&de(l,n)&&(void 0!==n||t in e)||Ye(e,t,n)},Qe=function(e,t,n,l){var a=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var r=t[i],s=l?l(n[r],e[r],r,n,e):void 0;void 0===s&&(s=e[r]),a?Ye(n,r,s):Ze(n,r,s)}return n},Xe=function(e){return null!=e&&"object"==typeof e},Je=function(e){return Xe(e)&&"[object Arguments]"==Te(e)},et=Object.prototype,tt=et.hasOwnProperty,nt=et.propertyIsEnumerable,lt=Je(function(){return arguments}())?Je:function(e){return Xe(e)&&tt.call(e,"callee")&&!nt.call(e,"callee")},at=Array.isArray,it=function(){return!1},ot=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Se.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||it}),rt=/^(?:0|[1-9]\d*)$/,st=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&rt.test(e))&&e>-1&&e%1==0&&e<t},ut=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},dt={};dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object Boolean]"]=dt["[object DataView]"]=dt["[object Date]"]=dt["[object Error]"]=dt["[object Function]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object WeakMap]"]=!1;var ct=function(e){return function(t){return e(t)}},mt=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&fe.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),vt=mt&&mt.isTypedArray,pt=vt?ct(vt):function(e){return Xe(e)&&ut(e.length)&&!!dt[Te(e)]},Et=Object.prototype.hasOwnProperty,ft=function(e,t){var n=at(e),l=!n&&lt(e),a=!n&&!l&&ot(e),i=!n&&!l&&!a&&pt(e),o=n||l||a||i,r=o?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!t&&!Et.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||st(u,s))||r.push(u);return r},gt=Object.prototype,St=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||gt)},_t=function(e,t){return function(n){return e(t(n))}},ht=_t(Object.keys,Object),yt=Object.prototype.hasOwnProperty,At=function(e){return null!=e&&ut(e.length)&&!Oe(e)},Ct=function(e){return At(e)?ft(e):function(e){if(!St(e))return ht(e);var t=[];for(var n in Object(e))yt.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)},Dt=Object.prototype.hasOwnProperty,bt=function(e){return At(e)?ft(e,!0):function(e){if(!Ie(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=St(e),n=[];for(var l in e)("constructor"!=l||!t&&Dt.call(e,l))&&n.push(l);return n}(e)},Tt=H(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?Se.Buffer:void 0,i=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,l=i?i(n):new e.constructor(n);return e.copy(l),l}}),It=function(){return[]},Ot=Object.prototype.propertyIsEnumerable,Nt=Object.getOwnPropertySymbols,Rt=Nt?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,i=0,o=[];++l<a;){var r=t[l];Ot.call(e,r)&&(o[i++]=r)}return o}(Nt(e)))}:It,xt=function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e},Lt=_t(Object.getPrototypeOf,Object),Pt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)xt(t,Rt(e)),e=Lt(e);return t}:It,wt=function(e,t,n){var l=t(e);return at(e)?l:xt(l,n(e))},Mt=function(e){return wt(e,Ct,Rt)},Ft=function(e){return wt(e,bt,Pt)},Bt=Me(Se,"DataView"),kt=Me(Se,"Promise"),Ut=Me(Se,"Set"),Ht=Me(Se,"WeakMap"),jt=Le(Bt),Wt=Le(Fe),Vt=Le(kt),zt=Le(Ut),Gt=Le(Ht),Kt=Te;(Bt&&"[object DataView]"!=Kt(new Bt(new ArrayBuffer(1)))||Fe&&"[object Map]"!=Kt(new Fe)||kt&&"[object Promise]"!=Kt(kt.resolve())||Ut&&"[object Set]"!=Kt(new Ut)||Ht&&"[object WeakMap]"!=Kt(new Ht))&&(Kt=function(e){var t=Te(e),n="[object Object]"==t?e.constructor:void 0,l=n?Le(n):"";if(l)switch(l){case jt:return"[object DataView]";case Wt:return"[object Map]";case Vt:return"[object Promise]";case zt:return"[object Set]";case Gt:return"[object WeakMap]"}return t});var qt=Kt,Yt=Object.prototype.hasOwnProperty,$t=Se.Uint8Array,Zt=function(e){var t=new e.constructor(e.byteLength);return new $t(t).set(new $t(e)),t},Qt=/\w*$/,Xt=_e?_e.prototype:void 0,Jt=Xt?Xt.valueOf:void 0,en=Object.create,tn=function(){function e(){}return function(t){if(!Ie(t))return{};if(en)return en(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),nn=mt&&mt.isMap,ln=nn?ct(nn):function(e){return Xe(e)&&"[object Map]"==qt(e)},an=mt&&mt.isSet,on=an?ct(an):function(e){return Xe(e)&&"[object Set]"==qt(e)},rn={};rn["[object Arguments]"]=rn["[object Array]"]=rn["[object ArrayBuffer]"]=rn["[object DataView]"]=rn["[object Boolean]"]=rn["[object Date]"]=rn["[object Float32Array]"]=rn["[object Float64Array]"]=rn["[object Int8Array]"]=rn["[object Int16Array]"]=rn["[object Int32Array]"]=rn["[object Map]"]=rn["[object Number]"]=rn["[object Object]"]=rn["[object RegExp]"]=rn["[object Set]"]=rn["[object String]"]=rn["[object Symbol]"]=rn["[object Uint8Array]"]=rn["[object Uint8ClampedArray]"]=rn["[object Uint16Array]"]=rn["[object Uint32Array]"]=!0,rn["[object Error]"]=rn["[object Function]"]=rn["[object WeakMap]"]=!1;var sn=function e(t,n,l,a,i,o){var r,s=1&n,u=2&n,d=4&n;if(l&&(r=i?l(t,a,i,o):l(t)),void 0!==r)return r;if(!Ie(t))return t;var c=at(t);if(c){if(r=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Yt.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!s)return function(e,t){var n=-1,l=e.length;for(t||(t=Array(l));++n<l;)t[n]=e[n];return t}(t,r)}else{var m=qt(t),v="[object Function]"==m||"[object GeneratorFunction]"==m;if(ot(t))return Tt(t,s);if("[object Object]"==m||"[object Arguments]"==m||v&&!i){if(r=u||v?{}:function(e){return"function"!=typeof e.constructor||St(e)?{}:tn(Lt(e))}(t),!s)return u?function(e,t){return Qe(e,Pt(e),t)}(t,function(e,t){return e&&Qe(t,bt(t),e)}(r,t)):function(e,t){return Qe(e,Rt(e),t)}(t,function(e,t){return e&&Qe(t,Ct(t),e)}(r,t))}else{if(!rn[m])return i?t:{};r=function(e,t,n){var l,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Zt(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var n=t?Zt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var n=t?Zt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(l=e).constructor(l.source,Qt.exec(l))).lastIndex=l.lastIndex,a;case"[object Set]":return new i;case"[object Symbol]":return Jt?Object(Jt.call(e)):{}}}(t,m,s)}}o||(o=new Ke);var p=o.get(t);if(p)return p;o.set(t,r),on(t)?t.forEach(function(a){r.add(e(a,n,l,a,t,o))}):ln(t)&&t.forEach(function(a,i){r.set(i,e(a,n,l,i,t,o))});var E=c?void 0:(d?u?Ft:Mt:u?bt:Ct)(t);return function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l&&!1!==t(e[n],n););}(E||t,function(a,i){E&&(a=t[i=a]),Ze(r,i,e(a,n,l,i,t,o))}),r},un=function(e){return sn(e,5)};const dn=e=>l.createElement("h1",{className:"heading-m"},e.label),cn=()=>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"})),mn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(cn,null)),vn=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}},pn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const{data:p,isLoading:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState({}),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),x=window.Digit.Utils.browser.isMobile(),L=window.location.href.includes("/employee");function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==p||null===(e=p.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[p]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=b&&b.type&&!e.test(null==b?void 0:b.type))R(o("NOT_SUPPORTED_FILE_TYPE"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",b,Digit.ULBService.getCurrentTenantId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{var e,n,a,i;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(a=c)||void 0===a||null===(i=a.processInstance)||void 0===i?void 0:i.businessService)?r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:m,error:p}=e,E=!0,f=!1;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==i?void 0:i.action)||"RESUBMIT_APPLICATION"==(null==i?void 0:i.action))&&(E=!1),i.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==i?void 0:i.action)&&"DISCONNECTION_EXECUTED"!=(null==i?void 0:i.action)||(f=!0),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},f&&{label:a("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!f,type:"custom",populators:f?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(t.DatePicker,v({onChange:e.onChange,date:e.value},n))}:null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:m,error:N})):r&&g((e=>{var n;let{t:a,action:i,approvers:o,selectedApprover:r,setSelectedApprover:s,selectFile:u,uploadedFile:d,setUploadedFile:c,businessService:m,error:v}=e,p=!0;return(null!=i&&null!==(n=i.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==i?void 0:i.action))&&(p=!1),i.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==i?void 0:i.action)+"_APPLICATION",submit:"WF_"+(null==m?void 0:m.toUpperCase())+"_"+(null==i?void 0:i.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:p?a("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?a("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(t.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:s,selected:r}):null},{label:a("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:a("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(t.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:u,onDelete:()=>{c(null)},message:d?"1 "+a("ES_PT_ACTION_FILEUPLOADED"):a("CS_ACTION_NO_FILEUPLOADED"),error:v,iserror:v,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:m,error:N}))},[r,y,I,N]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(dn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(mn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:x&&L?{width:"100%",height:"auto"}:{}},E?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t,n,l,a,i,o,u,m,p,E;if(null!==(t=c)&&void 0!==t&&t.isBillAmend){var f,g,S,_,h,y,A,D,T;const t=v({},null===(f=c)||void 0===f||null===(g=f.billAmendmentDetails)||void 0===g?void 0:g.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),n=v({},null===(S=c)||void 0===S?void 0:S.billAmendmentDetails,{workflow:{businessId:null===(_=c)||void 0===_||null===(h=_.billAmendmentDetails)||void 0===h?void 0:h.amendmentId,action:null==r?void 0:r.action,tenantId:s,businessService:null!==(y=c)&&void 0!==y&&null!==(A=y.applicationType)&&void 0!==A&&A.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(D=c)&&void 0!==D&&null!==(T=D.applicationType)&&void 0!==T&&T.includes("WATER")?"WS":"SW",assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:[]},additionalDetails:t,comment:(null==e?void 0:e.comments)||"",wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:[]}});d({AmendmentUpdate:n})}else{if(c=v({},c,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=C&&C.uuid?[null==C?void 0:C.uuid]:[],assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],wfDocuments:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:null,processInstance:v({},null===(n=c)||void 0===n?void 0:n.processInstance,{action:null==r?void 0:r.action,assignes:null!=C&&C.uuid?[{uuid:null==C?void 0:C.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]:[]})}),null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(a=l.applicationType)&&void 0!==a&&a.includes("DISCONNECT")){const t=un(null==e?void 0:e.date);c.disconnectionExecutionDate=vn(t)}else if(null!=e&&e.date){const t=un(null==e?void 0:e.date);c.connectionExecutionDate=vn(t)}var O;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(o=i.processInstance)||void 0===o?void 0:o.businessService)||"DisconnectSWConnection"==(null===(u=c)||void 0===u||null===(m=u.processInstance)||void 0===m?void 0:m.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(O=c)||void 0===O?void 0:O.serviceType)?d({WaterConnection:c,disconnectRequest:!0}):d({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(p=c)||void 0===p?void 0:p.applicationType))d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=c)||void 0===E?void 0:E.applicationType))d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var N,R,x,L,P,w,M,F,B,k,U,H,j;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),t=e?JSON.parse(e):"";null!=t&&null!==(N=t.value)&&void 0!==N&&N.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==t||null===(R=t.value)||void 0===R?void 0:R.adhocPenalty)||""),null!=t&&null!==(x=t.value)&&void 0!==x&&x.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==t||null===(L=t.value)||void 0===L?void 0:L.adhocPenaltyComment)||""),null!=t&&null!==(P=t.value)&&void 0!==P&&P.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==t||null===(w=t.value)||void 0===w?void 0:w.adhocPenaltyReason)||""),null!=t&&null!==(M=t.value)&&void 0!==M&&M.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==t||null===(F=t.value)||void 0===F?void 0:F.adhocRebate)||""),null!=t&&null!==(B=t.value)&&void 0!==B&&B.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==t||null===(k=t.value)||void 0===k?void 0:k.adhocRebateComment)||""),null!=t&&null!==(U=t.value)&&void 0!==U&&U.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==t||null===(H=t.value)||void 0===H?void 0:H.adhocRebateReason)||""),"WATER"==(null===(j=c)||void 0===j?void 0:j.serviceType)?d({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):d({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},En=e=>l.createElement("h1",{className:"heading-m"},e.label),fn=()=>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"})),gn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(fn,null)),Sn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),[x,L]=n.useState(!1);function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:t,action:n,businessService:l}=e;return{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:t("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:m}))},[r,y,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(En,{label:o(f.label.heading)}),headerBarEnd:l.createElement(gn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("COMMON_APPROVED"==(null==r?void 0:r.action)){let t={action:"OPEN",comments:null==e?void 0:e.comments,businessService:"ptr",moduleName:"pet-services"};c.creationReason="CREATE",d({PetRegistrationApplications:[v({},c,{workflow:t})]})}let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:p};t.assignes=null!=r&&r.isTerminateState||!C?[]:[C],I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]),d({PetRegistrationApplications:[v({},c,{workflow:t})]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},_n=e=>l.createElement("h1",{className:"heading-m"},e.label),hn=()=>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"})),yn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(hn,null)),An=e=>{var a,i,o;let{t:r,action:s,closeModal:u,submitAction:d,applicationData:c,businessService:m}=e;const p=Digit.ULBService.getStateId(),{data:E,isLoading:f}=Digit.Hooks.tl.useTradeLicenseMDMS(p,"TradeLicense","TradeUnits","[?(@.type=='TL')]");console.log("tradeMdmsData",null==E||null===(a=E.TradeLicense)||void 0===a?void 0:a.TradeType),console.log("applicationData",c);const[g,S]=n.useState({}),[_,h]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState(""),[b,T]=n.useState([]),[I,O]=n.useState(null),N=null===(i=c)||void 0===i||null===(o=i.tradeLicenseDetail)||void 0===o?void 0:o.tradeUnits;console.log("tradeUnits",N);const R=n.useMemo(()=>{var e;if(f||!E||!N.length)return[];const t=new Set(N.map(e=>e.tradeType)),n=(null===(e=E.TradeLicense)||void 0===e?void 0:e.TradeType.filter(e=>t.has(e.code))).some(e=>null==e?void 0:e.ishazardous);return console.log("hasHazardous",n),n?["1"]:["1","2","3"]},[f,E,N]);return console.log("years",R),n.useEffect(()=>{s&&S((e=>{let{t:n,action:a,years:i,selectedApprover:o,setSelectedApprover:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+(null==s?void 0:s.toUpperCase())+"_"+(null==a?void 0:a.action),cancel:"WF_EMPLOYEE_NEWTL_CANCEL"},form:[{body:[{label:n("TL_VALID_FOR_NO_OF_YEARS"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:i,autoComplete:"off",select:r,selected:o})}]}]}})({t:r,action:s,years:R,selectedApprover:C,setSelectedApprover:D,businessService:m}))},[s,R,b,I]),s&&g.form?l.createElement(t.Modal,{headerBarMain:l.createElement(_n,{label:r(g.label.heading)}),headerBarEnd:l.createElement(yn,{onClick:u}),actionCancelLabel:r(g.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:r(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},f?l.createElement(t.Loader,null):l.createElement(t.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n=null===(t=c)||void 0===t?void 0:t.financialYear;const l=null==n?void 0:n.split("-")[1],a="20"+Number(l)+"-"+(Number(l)+1);c=v({},c,{financialYear:a,action:"INITIATE",additionalDetail:v({},c.additionalDetail,{validityYears:C.length>0?parseInt(C):""})}),d({Licenses:[c]})},defaultValues:_,formId:"modal-action"})):l.createElement(t.Loader,null)},Cn=e=>l.createElement("h1",{className:"heading-m"},e.label),Dn=()=>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"})),bn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Dn,null)),Tn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:null==r?void 0:r.isTerminateState}),[f,g]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),[x,L]=n.useState(!1);function P(e){L(!0),T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=function(e,t){try{var n=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",b,s)).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))})}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}(0,function(e,t){if(L(!1),e)throw t;return t});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),console.log("actyhdesh,jhfsefsef",r,c),n.useEffect(()=>{g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,approvers:s,selectedApprover:u,setSelectedApprover:d,isUploading:c}=e;const m=()=>l.createElement("div",{className:"loading-spinner"});return console.log("isuploading ",c),{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"SV_"+(null==a?void 0:a.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==a?void 0:a.action)||"REJECT"===(null==a?void 0:a.action)||"SENDBACKTOCITIZEN"===(null==a?void 0:a.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(t.Dropdown,{option:s,t:n,optionKey:"name",select:d,selected:u})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{r(null)},message:c?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(m,null),l.createElement("span",null,"Uploading...")):o?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:m,isUploading:x}))},[r,y,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(Cn,{label:o(f.label.heading)}),headerBarEnd:l.createElement(bn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var t;let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:p,assignes:"SENDBACKTOCITIZEN"===(null==r?void 0:r.action)?[null==c||null===(t=c.auditDetails)||void 0===t?void 0:t.createdBy]:null!=C&&C.uuid?[null==C?void 0:C.uuid]:null};I&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:I}]),d({streetVendingDetail:v({},c,{workflow:n})})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},In=e=>l.createElement("h1",{className:"heading-m"},e.label),On=()=>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"})),Nn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(On,null)),Rn=e=>{var a,i;let{t:o,action:r,tenantId:s,closeModal:u,submitAction:d,applicationData:c,businessService:m,moduleCode:p}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(s,{roles:null==r||null===(a=r.assigneeRoles)||void 0===a||null===(i=a.map)||void 0===i?void 0:i.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[f,g]=n.useState({}),[S,_]=n.useState({}),[y,A]=n.useState([]),[C,D]=n.useState(null),[b,T]=n.useState(null),[I,O]=n.useState(null),[N,R]=n.useState(null),[x,L]=n.useState(!1);function P(e){T(e.target.files[0])}return n.useEffect(()=>{var e;A(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[E]),n.useEffect(()=>{!function(){try{R(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)R(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",b,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):R(o("CS_FILE_UPLOAD_ERROR"))})},function(){R(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[b]),n.useEffect(()=>{r&&g((e=>{let{t:n,action:a,selectFile:i,uploadedFile:o,setUploadedFile:r,businessService:s}=e;return{label:{heading:"WF_"+(null==a?void 0:a.action)+"_APPLICATION",submit:"WF_"+s+"_"+(null==a?void 0:a.action),cancel:"ES_CHB_COMMON_CANCEL"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_CHB_ATTACH_FILE")+(a.docUploadRequired?" *":""),populators:l.createElement(t.UploadFile,{id:"workflow-doc",onUpload:i,onDelete:()=>{r(null)},showHint:!0,hintText:n("CHB_ATTACH_RESTRICTIONS_SIZE"),message:o?"1 "+n("ES_CHB_ACTION_FILEUPLOADED"):n("ES_CHB_ACTION_NO_FILEUPLOADED")})}]}]}})({t:o,action:r,approvers:y,selectedApprover:C,setSelectedApprover:D,selectFile:P,uploadedFile:I,setUploadedFile:O,businessService:m}))},[r,y,I]),r&&f.form?l.createElement(t.Modal,{headerBarMain:l.createElement(In,{label:o(f.label.heading)}),headerBarEnd:l.createElement(Nn,{onClick:u}),actionCancelLabel:o(f.label.cancel),actionCancelOnSubmit:u,actionSaveLabel:o(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(t.FormComposer,{config:f.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:p};I&&(t.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==b?void 0:b.name,filestoreId:I}]),d({hallsBookingApplication:[v({},c,{workflow:t})]})},defaultValues:S,formId:"modal-action"})):l.createElement(t.Loader,null)},xn=e=>l.createElement("h1",{className:"heading-m"},e.label),Ln=()=>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"})),Pn=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ln,null)),wn=e=>{var t,a,o;let{t:r,action:s,tenantId:u,closeModal:d,submitAction:m,applicationData:p,businessService:E,moduleCode:f}=e;const{data:g}=Digit.Hooks.useEmployeeSearch(u,{roles:null==s||null===(t=s.roles)||void 0===t||null===(a=t[0])||void 0===a||null===(o=a.map)||void 0===o?void 0:o.call(a,e=>({code:e})),isActive:!0},{enabled:!(null!=s&&s.isTerminateState)}),S=i.useHistory(),[_,h]=n.useState({}),[y,A]=n.useState({}),[C,D]=n.useState([]),[b,T]=n.useState(null),[I,O]=n.useState(null);return n.useEffect(()=>{var e;D(null==g||null===(e=g.Employees)||void 0===e?void 0:e.map(e=>{var t;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(t=e.user)||void 0===t?void 0:t.name}}))},[g]),n.useEffect(()=>{"INITIATED"===(null==s?void 0:s.state)?S.push("/digit-ui/employee/asset/assetservice/edit/"+(null==p?void 0:p.applicationNo)):h((e=>{let{t:t,action:n,businessService:l}=e;return console.log("njhsegfdhjsbedwfdwe",n),{label:{heading:"WF_"+(null==n?void 0:n.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==n?void 0:n.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:t("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:r,action:s,approvers:C,selectedApprover:b,setSelectedApprover:T,uploadedFile:I,setUploadedFile:O,businessService:E}))},[s,C,I]),s&&_.form?l.createElement(c.Modal,{headerBarMain:l.createElement(xn,{label:r(_.label.heading)}),headerBarEnd:l.createElement(Pn,{onClick:d}),actionCancelLabel:r(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:r(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(c.FormComposer,{config:_.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let t={action:null==s?void 0:s.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:f};I&&(t.documents=[]),m({Asset:v({},p,{workflow:t})})},defaultValues:y,formId:"modal-action"})):l.createElement(c.Loader,null)},Mn=e=>null!=e&&e.businessService.includes("PT")?l.createElement(q,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Sn,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")?l.createElement(Q,e):null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(An,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(te,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(ie,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(ue,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(pn,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(Tn,e):null!=e&&e.businessService.includes("chb")?l.createElement(Rn,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(wn,e):void 0;function Fn(e){let{documents:n,svgStyles:i={},isSendBackFlow:o=!1,isHrLine:r=!1,titleStyles:s}=e;const{t:u}=a.useTranslation(),d=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px",display:"flex",flexWrap:"wrap",flexDirection:"row",borderRadius:"4px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px"}},!d&&(null==n?void 0:n.map((e,a)=>{var i,d,c;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(i=e.values)||void 0===i?void 0:i.map((n,a)=>{var i;return l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)),l.createElement("a",{target:"_",href:null==n?void 0:n.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}},u(null==n?void 0:n.title)),o?null!=n&&null!==(i=n.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==n?void 0:n.documentType)):""))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")),l.createElement("div",{style:{width:"180px"}},l.createElement(t.CardSubHeader,{style:s||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}}),l.createElement("div",{style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:a},l.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"start",color:"#505A5F"}}),o?(null!==(d=value)&&void 0!==d&&null!==(c=d.documentType)&&void 0!==c&&c.includes("NOC"),l.createElement("p",{style:{textAlign:"center"}})):"")))),r&&(null==n?void 0:n.length)!=a+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null))})),d&&(null==n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=i&&i.minWidth?null==i?void 0:i.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},u(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+u(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+u(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const Bn=e=>{var t,a;let{t:i,formData:o,applicationData:r,docs:s,bpaActionsDetails:u}=e;const d=(null==r?void 0:r.status)||"",c=(null==u||null===(t=u.data)||void 0===t?void 0:t.nextActions)||[],m=Digit.ULBService.getStateId(),[v,p]=n.useState((null==o||null===(a=o.documents)||void 0===a?void 0:a.documents)||[]),[E,f]=n.useState(null),[g,S]=n.useState([]),[_,h]=n.useState(!0),[y,A]=n.useState(!1),[C,D]=n.useState(!1),{isLoading:b,data:T}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"]),{isLoading:I,data:O}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]);return n.useEffect(()=>{var e,t,n,l;let a=[];var i,o;null!=T&&null!==(e=T.BPA)&&void 0!==e&&e.DocTypeMapping&&(a=null==T||null===(i=T.BPA)||void 0===i||null===(o=i.DocTypeMapping)||void 0===o?void 0:o.filter(e=>{var t,n;return e.WFState==(null==r?void 0:r.status)?null==r?void 0:r.status:e.RiskType==(null==r?void 0:r.riskType)&&e.ServiceType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==r||null===(n=r.additionalDetails)||void 0===n?void 0:n.applicationType)}));let u=[];null===(t=a)||void 0===t||null===(n=t[0])||void 0===n||null===(l=n.docTypes)||void 0===l||l.forEach(e=>{var t,n,l,a;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==O||null===(t=O["common-masters"])||void 0===t||null===(n=t.DocumentType)||void 0===n||n.forEach(t=>{let n=t.code.slice(0,i.length);i===n&&(e.hasDropdown=!0,t.i18nKey=t.code,e.dropdownData.push(t))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==s||null===(l=s[0])||void 0===l||null===(a=l.values)||void 0===a||a.map(t=>{var n,l;i===(null==t||null===(n=t.documentType)||void 0===n?void 0:n.split(".")[0])+"."+(null==t||null===(l=t.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(t)}),u.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(u)),S(u)},[!b,!I]),n.useEffect(()=>{let e=0;g.map(t=>{let n=!1;v.map(e=>{t.required&&t.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(n=!0)}),!n&&t.required&&(e+=1)}),h("0"!=e&&0!=e||!(v.length>0))},[v,y]),n.useEffect(()=>{D("DOC_VERIFICATION_INPROGRESS"===d&&(null==c?void 0:c.length)>0)},[r,u]),l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==g?void 0:g.map((e,t)=>l.createElement("div",{style:{padding:"20px"}},l.createElement(kn,{key:t,index:t,document:e,t:i,error:E,setError:f,setDocuments:p,documents:v,setCheckRequiredFields:A,applicationStatus:d,actions:c,bpaTaxDocuments:g,checkEnablingDocs:C}))))};function kn(e){var a,i;let{t:o,document:r,setDocuments:s,documents:u,index:d,bpaTaxDocuments:c,checkEnablingDocs:m}=e;const p=null==u?void 0:u.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[f,g]=n.useState(p?v({},p,{active:!0,code:null==p?void 0:p.documentType,i18nKey:null==p?void 0:p.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[S,_]=n.useState(null),[h,y]=n.useState(()=>(null==p?void 0:p.fileStoreId)||null),[A,C]=n.useState([]);return n.useEffect(()=>{null!=f&&f.code&&s(e=>{var t;const n=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==f?void 0:f.code));return 0===(null==h?void 0:h.length)||null===h?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==h),{documentType:null==f?void 0:f.code,fileStoreId:h,documentUid:h,fileName:(null==S?void 0:S.name)||"",id:u?null===(t=u.find(e=>e.documentType===(null==f?void 0:f.code)))||void 0===t?void 0:t.id:void 0}]})},[h,f]),n.useEffect(()=>{try{A.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],A.map(e=>{var t,n,l;null!=f&&f.code&&r.newUploadedDocs.push({documentType:null==f?void 0:f.code,fileStoreId:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,documentUid:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[d]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[A,f]),n.useEffect(()=>{},[S]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+o(null==r?void 0:r.code)),(null==r||null===(i=r.uploadedDocuments)||void 0===i?void 0:i.length)&&l.createElement(Fn,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),m?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?o(null==r?void 0:r.code)+"* ":""+o(null==r?void 0:r.code)),l.createElement(t.Dropdown,{className:"form-field",t:o,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:f,optionKey:"i18nKey",select:e=>g(e),style:{width:"100%"}})),l.createElement(t.LabelFieldPair,{style:{width:"100%"}},l.createElement(t.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,t)=>{let n=Object.fromEntries(t),l=Object.values(n);var a;0!==Object.keys(n).length&&C(l),(a=l[l.length-1])&&_(a.file)})(0,e),t:o,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Un(e){let{fiReport:n,isCitizen:i=!1}=e;const{t:o}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i?t.CardHeader:t.CardSectionHeader,{style:{fontSize:"24px"}},""+o("BPA_FI_REPORT")),n.map((e,a)=>{var i,r,s,u,d,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(t.StatusTable,null,l.createElement(t.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+o("BPA_FI_REPORT"):o("BPA_FI_REPORT")+" - "+(a+1)),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(i=e.date)||void 0===i?void 0:i.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(s=e.date)||void 0===s?void 0:s.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(u=e.questions)||void 0===u?void 0:u.length)&&(null==e||null===(d=e.questions)||void 0===d?void 0:d.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(t.Row,{className:"border-none",label:""+o(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(t.Row,{className:"border-none",label:""+o("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Fn,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var t;return{title:null==e||null===(t=e.documentType)||void 0===t?void 0:t.replaceAll(".","_"),documentType:null==e?void 0:e.documentType,documentUid:null==e?void 0:e.documentUid,fileStoreId:null==e?void 0:e.fileStoreId,id:null==e?void 0:e.id,url:null==e?void 0:e.url}})}]),svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}})))})))}function Hn(e){let{t:a,document:i,setNocDocuments:o,setError:r,nocDocuments:s}=e;const u=null==s?void 0:s.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==i?void 0:i.code)})[0],d=Digit.ULBService.getStateId(),[c,m]=n.useState(),[v,p]=n.useState(null),[E,f]=n.useState(()=>(null==u?void 0:u.fileStoreId)||null);return n.useEffect(()=>{var e,t;null!=i&&null!==(e=i.dropdownData)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&t.code&&o(e=>{var t;const n=null==e?void 0:e.filter(e=>{var t,n;return(null==e?void 0:e.documentType)!==(null==i||null===(t=i.dropdownData)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.code)});return 0===(null==E?void 0:E.length)||null===E?n:[...null==n?void 0:n.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==i||null===(t=i.dropdownData)||void 0===t?void 0:t[0].code,fileStoreId:E,documentUid:E,fileName:(null==v?void 0:v.name)||""}]})},[E]),n.useEffect(()=>{!function(){try{r(null);const e=function(){if(v){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(v.size>=5242880)r(a("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=v&&v.type&&!e.test(null==v?void 0:v.type))r(a("NOT_SUPPORTED_FILE_TYPE"));else{const e=h(function(){return f(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",v,Digit.ULBService.getStateId())).then(function(e){var t,n,l,i;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(i=l.files[0])||void 0===i?void 0:i.fileStoreId):r(a("CS_FILE_UPLOAD_ERROR"))})},function(){r(a("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[v]),l.createElement("div",{style:{}},l.createElement(t.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(t.CardLabel,{style:{width:"100%"}},null!=i&&i.required?a("TL_BUTTON_UPLOAD FILE")+"*":""+a("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(t.MultiUploadWrapper,{module:"NOC",tenantId:d,getFormState:e=>(e=>{let t=Object.fromEntries(e),n=Object.values(t);var l;(l=n[n.length-1])&&p(l.file)})(e),t:a,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const jn=e=>{var a;let{t:i,noc:o,docs:r,isNoc:s,applicationData:u,NOCdata:d,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const m=Digit.ULBService.getStateId(),v=(null==u?void 0:u.status)||"",p=(null==c||null===(a=c.data)||void 0===a?void 0:a.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(m,"NOC",["DocumentTypeMapping"],{enabled:s}),{data:f}=Digit.Hooks.obps.useMDMS(m,"BPA",["DocTypeMapping"],{enabled:!s}),{data:g}=Digit.Hooks.obps.useMDMS(m,"common-masters",["DocumentType"]),[S,_]=n.useState([]),[h,y]=n.useState([]),[A,C]=n.useState(!1),[D,b]=Digit.Hooks.useSessionStorage(null==o?void 0:o.nocType,[]),[T,I]=n.useState(null),O=window.location.href.includes("/employee/");return n.useEffect(()=>{var e;_(null==g||null===(e=g["common-masters"])||void 0===e?void 0:e.DocumentType)},[g]),n.useEffect(()=>{var e,t,n;let l,a=[];var i,r,d,c;l=s?null==E||null===(i=E.NOC)||void 0===i||null===(r=i.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==o?void 0:o.applicationType)&&(null==e?void 0:e.nocType)===(null==o?void 0:o.nocType)):null==f||null===(d=f.BPA)||void 0===d||null===(c=d.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var t,n;return e.WFState==(null==u?void 0:u.status)&&e.RiskType==(null==u?void 0:u.riskType)&&e.ServiceType==(null==u||null===(t=u.additionalDetails)||void 0===t?void 0:t.serviceType)&&e.applicationType==(null==u||null===(n=u.additionalDetails)||void 0===n?void 0:n.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(t=e[0])&&void 0!==t&&null!==(n=t.docTypes)&&void 0!==n&&n[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==o?void 0:o.additionalDetails,applicationStatus:null==o?void 0:o.applicationStatus,appNumberLink:null==o?void 0:o.applicationNo,nocNo:null==o?void 0:o.nocNo},a.push(l[0].docTypes[0]));let m=[];a&&a.length>0&&(a.map(e=>{let t=e.documentType;e.dropdownData=[],null==S||S.forEach(n=>{let l=n.code.slice(0,null==t?void 0:t.length);t===l&&(e.hasDropdown=!0,e.dropdownData.push(n))}),m.push(e)}),y(m))},[E,S]),n.useEffect(()=>{C("NOC_VERIFICATION_INPROGRESS"===v&&(null==p?void 0:p.length)>0)},[u,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:O?""+i("BPA_"+(null==o?void 0:o.nocType)+"_HEADER"):i("BPA_"+(null==o?void 0:o.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),d&&d.map((e,n)=>{if(null!=e&&e.value)return l.createElement(t.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:O?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA"),textStyle:"APPROVED"==(null==e?void 0:e.value)||"AUTO_APPROVED"==(null==e?void 0:e.value)?{color:"#00703C"}:{color:"#D4351C"}}:{className:"border-none",label:O?""+i(null==e?void 0:e.title):i(null==e?void 0:e.title),text:i(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Fn,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),A&&(null==h?void 0:h.map((e,t)=>l.createElement(Hn,{key:t,document:e,t:i,error:T,setError:I,setNocDocuments:b,nocDocuments:D,checkEnablingDocs:A}))))},Wn=e=>{let{permissions:a,t:i}=e;const[o,r,s]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==a?void 0:a.map(e=>({label:e,checked:!1}))),[u,d,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);n.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const m=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},i("BPA_PERMIT_CONDITIONS")),null==o?void 0:o.map((e,n)=>l.createElement(t.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:m?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,t,n)=>{const l=e.target.checked;r(()=>null==o?void 0:o.map((e,t)=>n===t?v({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==u?void 0:u.map((e,n)=>l.createElement("div",null,l.createElement(t.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,t)=>{d(()=>null==u?void 0:u.map((n,l)=>{var a;return t===l?{label:null==e||null===(a=e.target)||void 0===a?void 0:a.value}:n}))})(e,n),textInputStyle:{maxWidth:m?"96%":"830px",width:m?"96%":"830px"},style:m?{paddingRight:"10%"}:{},placeholder:i("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(t.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(t.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:m?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const t=[...u];t.splice(e,1),d([...t])})(n)}))),l.createElement(t.LinkButton,{style:{color:"#a82227",maxWidth:m?"fit-content":"10%",marginRight:"3%"},label:i("BPA_ADD_MORE"),onClick:()=>{d([...u,{label:""}])}}))};function Vn(e){let{documents:i,svgStyles:o={},isSendBackFlow:r=!1}=e;const{t:s}=a.useTranslation(),[u,d]=n.useState(()=>[]),[c,m]=(Digit.ULBService.getCurrentTenantId(),n.useState({}));n.useEffect(()=>{var e;let t=[];null==i||i.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),d(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[i]),n.useEffect(()=>{var e;null!=u&&u.length&&"BillAmend"===(null==i||null===(e=i[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(u,Digit.ULBService.getCurrentTenantId()).then(e=>{m(null==e?void 0:e.data)}):null!=u&&u.length&&Digit.UploadServices.Filefetch(u,Digit.ULBService.getStateId()).then(e=>{m(null==e?void 0:e.data)})},[u]);const v=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),p=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!p&&(null==i?void 0:i.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:v?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"}},null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a,i;return l.createElement("a",{target:"_",href:null===(a=c[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(t.PDFSvg,null)),l.createElement("p",{style:v?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},s(null==e?void 0:e.title)),r?null!=e&&null!==(i=e.documentType)&&void 0!==i&&i.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},s(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),p&&(null==i?void 0:i.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(t.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},s(null==e?void 0:e.title)):null,l.createElement("div",null,null!=e&&e.values&&(null==e?void 0:e.values.length)>0?null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement("a",{target:"_",href:null===(a=c[e.fileStoreId])||void 0===a?void 0:a.split(",")[0],style:{minWidth:null!=o&&o.minWidth?null==o?void 0:o.minWidth:"160px",marginRight:"20px"},key:n},l.createElement("div",{style:{maxWidth:"940px",padding:"8px",borderRadius:"4px",border:"1px solid #D6D5D4",background:"#FAFAFA"}},l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",marginBottom:"10px"}},s(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+s(null==e?void 0:e.docInfo)):null,l.createElement(t.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+s(null==e?void 0:e.title))))}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,s("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}function zn(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:i}=n,{t:o}=a.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:o("ES_PT_TITLE_TAX_HEADS"),text:o("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==i?void 0:i.map((e,n)=>l.createElement(t.Row,{key:o(e.taxHeadCode),label:o(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==i?void 0:i.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(t.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(t.Row,{label:o("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function Gn(e){let{floors:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},i(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var a;return l.createElement(l.Fragment,{key:n},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},i(e.title)),l.createElement(t.StatusTable,{style:{position:"relative",padding:"8px"}},l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px",marginTop:"8px",borderRadius:"4px",background:"#FAFAFA",maxWidth:"100%"}},null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function Kn(e){let{owners:n}=e,i={};i=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:o}=a.useTranslation(),r=(null==n?void 0:n.length)||1;let s={marginTop:"19px"},u={position:"relative",padding:"8px"},d={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?s={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(s={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},u={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(s=v({},s,{maxWidth:"950px"}),s=v({},s,{maxWidth:"950px"}),d={}),n.sort((e,t)=>{var n,l;return(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.ownerSequence)-(null==t||null===(l=t.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},i.map((e,n)=>{var a;return l.createElement("div",{key:o(null==e?void 0:e.title),style:s,className:"owner-details-child"},l.createElement(t.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?o(null==e?void 0:e.title)+" "+(n+1):o(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:u},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return!0===e.map&&"N/A"!==e.value?l.createElement(t.Row,{key:o(e.title),label:o(e.title),text:l.createElement("img",{src:o(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(t.Row,{key:o(e.title),label:""+o(e.title),text:o(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:d}))}))))})))}const qn=e=>{var i,o,r,s,u,d,c,m,v,p,E,f,g,S,_,y,A,C,D,b,T,I,O;let{scrutinyDetails:N,paymentsList:R=[],additionalDetails:x,applicationData:L}=e;const P=(window.location.href.includes("editApplication")||"FIELDINSPECTION_INPROGRESS"==(null==L?void 0:L.status))&&window.location.href.includes("bpa"),[w,M]=n.useState(),[F,B]=n.useState(),[k,U]=n.useState(),H=Digit.ULBService.getStateId(),[j,W]=n.useState(),[V,z]=n.useState(),[G,K]=n.useState([]),[q,Y]=n.useState(),[$,Z]=n.useState(""),[Q,X]=n.useState(null),[J,ee]=n.useState({}),te={buttonStyle:{display:"flex",justifyContent:"flex-start",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},[ne,le]=n.useState(!1),[ae,ie]=n.useState(!1);n.useEffect(()=>{!function(){try{X(null);const e=function(){if(q&&null!=q&&q.type){const e=function(e,t,n){if(null!==(e=".pdf".split(","))&&void 0!==e&&e.includes("."+(null==q||null===(t=q.type)||void 0===t||null===(n=t.split("/"))||void 0===n?void 0:n.pop()))){const e=function(){if(q.size>=2e6)X(oe("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=h(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",q,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?K([...G,{fileStoreId:null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId,time:new Date}]):X(oe("PT_FILE_UPLOAD_ERROR"))})},function(){});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}else X(oe("PT_UPLOAD_FORMAT_NOT_SUPPORTED"))}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[q]),n.useEffect(()=>{sessionStorage.setItem("uploadedFileLess",JSON.stringify(G))},[G]),n.useEffect(()=>{var e,t,n,l,a,i,o;if(null!=x&&null!==(e=x.lessAdjustmentFeeFiles)&&void 0!==e&&e.length){const e=null==x?void 0:x.lessAdjustmentFeeFiles.map((e,t)=>{var n,l,a;return t===(null==x||null===(n=x.lessAdjustmentFeeFiles)||void 0===n?void 0:n.length)-1?null==x||null===(l=x.lessAdjustmentFeeFiles[(null==x||null===(a=x.lessAdjustmentFeeFiles)||void 0===a?void 0:a.length)-1])||void 0===l?void 0:l.fileStoreId:null});Digit.UploadServices.Filefetch(e,H).then(e=>ee(null==e?void 0:e.data))}M(null==x||null===(t=x.selfCertificationCharges)||void 0===t?void 0:t.BPA_DEVELOPMENT_CHARGES),sessionStorage.setItem("development",null==x||null===(n=x.selfCertificationCharges)||void 0===n?void 0:n.BPA_DEVELOPMENT_CHARGES),B(null==x||null===(l=x.selfCertificationCharges)||void 0===l?void 0:l.BPA_OTHER_CHARGES),sessionStorage.setItem("otherCharges",null==x||null===(a=x.selfCertificationCharges)||void 0===a?void 0:a.BPA_OTHER_CHARGES),U(null==x||null===(i=x.selfCertificationCharges)||void 0===i?void 0:i.BPA_LESS_ADJUSMENT_PLOT),sessionStorage.setItem("lessAdjusment",null==x||null===(o=x.selfCertificationCharges)||void 0===o?void 0:o.BPA_LESS_ADJUSMENT_PLOT),W(null==x?void 0:x.otherFeesDiscription),sessionStorage.setItem("otherChargesDisc",null==x?void 0:x.otherFeesDiscription),K(null==x?void 0:x.lessAdjustmentFeeFiles)},[x]);const{t:oe}=a.useTranslation(),re=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},oe(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?oe(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void oe("NA");return l.createElement(n.Fragment,null,!(null!=N&&N.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(t.StatusTable,null,l.createElement("div",null,null==N||null===(i=N.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red"}:{},key:""+e.title,label:""+oe(""+e.title),text:null!=e&&e.value?re(e)+" "+oe(null==e?void 0:e.isUnit):oe("NA"),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):null==e||!e.isHeader||null!=e&&e.isUnit?null==e||!e.isSubTitle||null!=e&&e.isUnit?l.createElement(t.Row,{className:"border-none",textStyle:"Paid"===(null==e?void 0:e.value)?{color:"darkgreen",wordBreak:"break-all"}:"Unpaid"===(null==e?void 0:e.value)?{color:"red",wordBreak:"break-all"}:{wordBreak:"break-all"},key:""+e.title,label:""+oe(""+e.title),text:re(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},oe(null==e?void 0:e.title)):l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},oe(null==e?void 0:e.title))),null==N||null===(o=N.permit)||void 0===o?void 0:o.map((e,n)=>l.createElement(t.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==N||null===(r=N.values[0])||void 0===r?void 0:r.title)&&l.createElement("div",null,!ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!0)}},oe("SHOW_P1_FEES_DETAILS"))),ae&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{ie(!1)}},oe("HIDE_P1_FEES_DETAILS"))),ae&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P1_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BUILDING_APPLICATION_FEES"),text:"₹ "+Math.round(10.7639*(null==x?void 0:x.builtUpArea)*2.5)}),l.createElement(t.Row,{className:"border-none",label:oe("BOUNDARY_WALL_FEES"),text:"₹ "+2.5*(null==x?void 0:x.boundaryWallLength)}),l.createElement(t.Row,{className:"border-none"}))),window.location.href.includes("employee")&&"BPA_APPL_FEES_DETAILS"==(null==N||null===(s=N.values[0])||void 0===s?void 0:s.title)&&l.createElement("div",null,!ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!0)}},oe("SHOW_P2_FEES_DETAILS"))),ne&&l.createElement("div",{style:te.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{le(!1)}},oe("HIDE_P2_FEES_DETAILS"))),ne&&l.createElement("div",null,l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST")),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_MALBA_AMT"),text:"₹ "+(null==x||null===(u=x.selfCertificationCharges)||void 0===u?void 0:u.BPA_MALBA_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_LABOUR_AMT"),text:"₹ "+(null==x||null===(d=x.selfCertificationCharges)||void 0===d?void 0:d.BPA_LABOUR_CESS)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_WATER_AMT"),text:"₹ "+(null==x||null===(c=x.selfCertificationCharges)||void 0===c?void 0:c.BPA_WATER_CHARGES)}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_COMMON_GAUSHALA_AMT"),text:"₹ "+(null==x||null===(m=x.selfCertificationCharges)||void 0===m?void 0:m.BPA_GAUSHALA_CHARGES_CESS)}),l.createElement(t.CardSubHeader,null,oe("BPA_P2_SUMMARY_FEE_EST_MANUAL")),l.createElement(t.CardLabel,null,oe("BPA_COMMON_DEVELOPMENT_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"development",defaultValue:(null==x||null===(v=x.selfCertificationCharges)||void 0===v?void 0:v.BPA_DEVELOPMENT_CHARGES)||0,value:w,disabled:!P,onChange:e=>{!function(e){/^\d{0,9}$/.test(e)&&(M(e),sessionStorage.setItem("development",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"otherCharges",defaultValue:(null==x||null===(p=x.selfCertificationCharges)||void 0===p?void 0:p.BPA_OTHER_CHARGES)||0,value:F,disabled:!P,onChange:e=>{!function(e){/^[0-9]*$/.test(e)&&(B(e),sessionStorage.setItem("otherCharges",e))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(F)>0?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_OTHER_AMT_DISCRIPTION")),l.createElement(t.TextArea,{t:oe,type:"text",name:"otherChargesDiscription",defaultValue:null==x||null===(E=x.selfCertificationCharges)||void 0===E?void 0:E.BPA_COMMON_OTHER_AMT_DISCRIPTION,value:j,disabled:!P,onChange:e=>{!function(e){W(e),sessionStorage.setItem("otherChargesDisc",e)}(e.target.value)},required:!0})):null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT")),l.createElement(t.TextInput,{t:oe,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lessAdjusment",defaultValue:(null==x||null===(f=x.selfCertificationCharges)||void 0===f?void 0:f.BPA_LESS_ADJUSMENT_PLOT)||"",value:k,disabled:!P,onChange:e=>{!function(e){var t,n,l,a;/^[0-9]*$/.test(e)&&(parseFloat(e)>(parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==x||null===(t=x.selfCertificationCharges)||void 0===t?void 0:t.BPA_MALBA_CHARGES)+parseFloat(null==x||null===(n=x.selfCertificationCharges)||void 0===n?void 0:n.BPA_LABOUR_CESS)+parseFloat(null==x||null===(l=x.selfCertificationCharges)||void 0===l?void 0:l.BPA_WATER_CHARGES)+parseFloat(null==x||null===(a=x.selfCertificationCharges)||void 0===a?void 0:a.BPA_GAUSHALA_CHARGES_CESS)?alert("Less adjustment fees cannot be grater than Total of other P2 fees"):(U(e),sessionStorage.setItem("lessAdjusment",e)))}(e.target.value)},required:!0,pattern:"^[0-9]*$",type:"text"}),parseInt(k)>0&&P?l.createElement("div",null,l.createElement(t.CardLabel,null,oe("BPA_COMMON_LESS_AMT_FILE")),l.createElement(t.UploadFile,{id:"noc-doc",style:{marginBottom:"200px"},onUpload:function(e){z(e.target.files[0]),Y(e.target.files[0])},disabled:!P,onDelete:()=>{z(null),Y("")},message:V?"1 "+oe("FILEUPLOADED"):oe("ES_NO_FILE_SELECTED_LABEL"),error:Q,uploadMessage:$})):null,(null==J||null===(g=J.fileStoreIds)||void 0===g?void 0:g.length)&&parseInt(null==x||null===(S=x.selfCertificationCharges)||void 0===S?void 0:S.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement(t.CardLabel,{style:{marginTop:"15px"}},oe("BPA_COMMON_LESS_AMT_PREVIOUS_FILE")),(null==J||null===(_=J.fileStoreIds)||void 0===_?void 0:_.length)&&parseInt(null==x||null===(y=x.selfCertificationCharges)||void 0===y?void 0:y.BPA_LESS_ADJUSMENT_PLOT)>0&&l.createElement("a",{target:"_blank",href:null==J||null===(A=J.fileStoreIds[(null==J||null===(C=J.fileStoreIds)||void 0===C?void 0:C.length)-1])||void 0===A?void 0:A.url},l.createElement(t.PDFSvg,null)),l.createElement(t.Row,{className:"border-none"}),l.createElement(t.Row,{className:"border-none",label:oe("BPA_P2_TOTAL_FEE"),text:"₹ "+((parseFloat(w)?parseFloat(w):0)+parseFloat(F?parseFloat(F):0)+parseFloat(null==x||null===(D=x.selfCertificationCharges)||void 0===D?void 0:D.BPA_MALBA_CHARGES)+parseFloat(null==x||null===(b=x.selfCertificationCharges)||void 0===b?void 0:b.BPA_LABOUR_CESS)+parseFloat(null==x||null===(T=x.selfCertificationCharges)||void 0===T?void 0:T.BPA_WATER_CHARGES)+parseFloat(null==x||null===(I=x.selfCertificationCharges)||void 0===I?void 0:I.BPA_GAUSHALA_CHARGES_CESS)-(parseFloat(k)?parseFloat(k):0))}))),l.createElement("div",null,null==N||null===(O=N.scruntinyDetails)||void 0===O?void 0:O.map((e,a)=>l.createElement(n.Fragment,null,l.createElement(t.Row,{className:"border-none",label:""+oe(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(t.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},oe(null==e?void 0:e.text))))))))},Yn=e=>{var i,o,r,s,u;let{edcrDetails:d,applicationData:c}=e;const{t:m}=a.useTranslation(),v=window.Digit.Utils.browser.isMobile(),p=[{name:"BPA_TABLE_COL_FLOOR",id:"Floor"},{name:"BPA_TABLE_COL_LEVEL",id:"Level"},{name:"BPA_TABLE_COL_OCCUPANCY",id:"Occupancy"},{name:"BPA_TABLE_COL_BUILDUPAREA",id:"BuildupArea"},{name:"BPA_TABLE_COL_FLOORAREA",id:"FloorArea"}],E=e=>{const t=e;return(e,n,l)=>e[t]},f=n.useMemo(()=>p.map(e=>({Header:m(""+e.name),accessor:E(e.id),id:e.id})));function g(e){var t;let n=[];return null==e||null===(t=e.building)||void 0===t||t.floors.map(e=>{var t,l,a,i,o,r,s,u;n.push({Floor:m("BPA_FLOOR_NAME_"+e.number),Level:e.number,Occupancy:m(""+(null===(t=e.occupancies)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.type)),BuildupArea:null===(a=e.occupancies)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.builtUpArea,FloorArea:(null===(o=e.occupancies)||void 0===o||null===(r=o[0])||void 0===r?void 0:r.floorArea)||0,CarpetArea:(null===(s=e.occupancies)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.CarpetArea)||0,key:m("BPA_FLOOR_NAME_"+e.number)})}),n}function S(e){var t;let n=null==c||null===(t=c.landInfo)||void 0===t?void 0:t.unit,l="";if((null==n?void 0:n.length)>0){var a,i;let t=null===(a=n[e])||void 0===a||null===(i=a.usageCategory)||void 0===i?void 0:i.split(",");null!=t&&t.length&&(l=t.map(e=>e?""+m("BPA_SUBOCCUPANCYTYPE_"+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}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(n.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(t.StatusTable,null,null==d||null===(i=d.values)||void 0===i?void 0:i.map((e,n)=>null!=e&&e.isHeader?l.createElement(t.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},m(null==e?void 0:e.title)):l.createElement(t.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+m(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==d||null===(o=d.subOccupancyTableDetails)||void 0===o||null===(r=o[0])||void 0===r||null===(s=r.value)||void 0===s||null===(u=s.planDetail)||void 0===u?void 0:u.blocks.map((e,n)=>{var a,i,o,r,s;return l.createElement("div",{key:n,style:(null==d||null===(a=d.subOccupancyTableDetails)||void 0===a||null===(i=a[0])||void 0===i||null===(o=i.value)||void 0===o||null===(r=o.planDetail)||void 0===r||null===(s=r.blocks)||void 0===s?void 0:s.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},m("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(t.StatusTable,null,l.createElement(t.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+m("BPA_SUB_OCCUPANCY_LABEL"),text:S(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||v?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(t.Table,{className:"customTable table-fixed-first-column table-border-style",t:m,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:g(e),columns:f,getCellProps:e=>({style:{}})})))})))},$n=e=>{let{headComment:t,otherComment:n}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,t),l.createElement("p",null,n))},Zn=e=>{var i,o,r;let{data:s,OpenImage:u,privacy:d={}}=e;const[c,m]=n.useState(!1),{t:v}=a.useTranslation();return l.createElement("div",null,s.date&&l.createElement("p",null,s.date),l.createElement("p",null,s.name),s.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(t.TelePhone,{mobile:s.mobileNumber,privacy:d}),l.createElement("p",null,"    ")),s.source&&l.createElement("p",null,v("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+s.source.toUpperCase())),s.comment&&l.createElement($n,{otherComment:null==s?void 0:s.otherComment,headComment:null==s?void 0:s.comment}),null!=s&&s.wfComment?l.createElement("div",null,null==s||null===(i=s.wfComment)||void 0===i?void 0:i.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("WF_COMMON_COMMENTS")),!c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical"}},e),e.length>36?l.createElement("button",{type:"button",onClick:()=>{m(!0)},style:{color:"#800000"}},v("View More")):null),c&&l.createElement("div",null,l.createElement("p",{style:{overflow:"visible"}},e),l.createElement("button",{type:"button",onClick:()=>{m(!1)},style:{color:"#800000"}},v("View Less")))))):null,(null==s||null===(o=s.thumbnailsToShow)||void 0===o||null===(r=o.thumbs)||void 0===r?void 0:r.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,v("CS_COMMON_ATTACHMENTS")),l.createElement(t.DisplayPhotos,{srcs:null==s?void 0:s.thumbnailsToShow.thumbs,onClick:(e,t)=>{u(e,t,null==s?void 0:s.thumbnailsToShow)}})):null)};function Qn(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},i(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"N/A",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function Xn(e){let{units:n}=e;const{t:i}=a.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var a;return l.createElement("div",{key:i(null==e?void 0:e.title),style:{marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}},l.createElement(t.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},i(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(t.StatusTable,{style:{position:"relative",marginTop:"19px"}},l.createElement("div",{style:{position:"absolute",maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(a=e.values)||void 0===a?void 0:a.map((e,n)=>{var a;return l.createElement(t.Row,!0===e.map&&"N/A"!==e.value?{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:""})}:{key:i(e.title),label:i(e.title)+":",text:i(e.value)||"NA",last:n===(null==e||null===(a=e.values)||void 0===a?void 0:a.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const Jn=e=>{var i,o,r,s,u;let{wsAdditionalDetails:d}=e;const{t:c}=a.useTranslation();let m=(v=location.search)?(/^[?#]/.test(v)?v.slice(1):v).split("&").reduce((e,t)=>{let[n,l]=t.split("=");return e[n]=l?decodeURIComponent(l.replace(/\+/g," ")):"",e},{}):{};var v;const p=null==m?void 0:m.mode;var{connectionDetails:E,plumberDetails:f,roadCuttingDetails:g,roadCuttingAddlDetails:S,activationDetails:_}=(null==d?void 0:d.additionalDetails)||{connectionDetails:[],plumberDetails:[],roadCuttingAddlDetails:[]};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==d||null===(i=d.additionalDetails)||void 0===i?void 0:i.connectionDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==E?void 0:E.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(o=d.additionalDetails)||void 0===o?void 0:o.plumberDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==f?void 0:f.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:"",privacy:e.privacy}))))),(null==d||null===(r=d.additionalDetails)||void 0===r?void 0:r.roadCuttingDetails)&&"MODIFY"!=p&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_COMMON_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"road-cutting-details-new-value-wrapper"},null==g?void 0:g.map(e=>{var n;return l.createElement("div",{style:(null==g?void 0:g.length)>1?{border:"1px solid #D6D5D4",background:"#FAFAFA",borderRadius:"4px",padding:"10px 10px 0px 10px",margin:"5px 0px"}:{}},null==e||null===(n=e.values)||void 0===n?void 0:n.map(e=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))}))),(null==d||null===(s=d.additionalDetails)||void 0===s?void 0:s.roadCuttingAddlDetails)&&l.createElement("div",null,l.createElement("br",null),l.createElement("div",{className:"road-cutting-addl-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))),(null==d||null===(u=d.additionalDetails)||void 0===u?void 0:u.activationDetails)&&l.createElement(t.StatusTable,null,l.createElement(t.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},c("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==_?void 0:_.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+c(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},el=[{title:"PT_PENDING_DUES_FROM_EARLIER",value:"Pending dues from earlier"},{title:"PT_MISCALCULATION_OF_EARLIER_ASSESSMENT",value:"Miscalculation of earlier Assessment"},{title:"PT_ONE_TIME_PENALITY",value:"One time penality"},{title:"PT_OTHERS",value:"Others"}],tl=[{title:"PT_ADVANCED_PAID_BY_CITIZEN_EARLIER",value:"Advanced Paid By Citizen Earlier"},{title:"PT_REBATE_PROVIDED_BY_COMMISSIONER_EO",value:"Rebate provided by commissioner/EO"},{title:"PT_ADDITIONAL_AMOUNT_CHARGED_FROM_THE_CITIZEN",value:"Additional amount charged from the citizen"},{title:"PT_OTHERS",value:"Others"}],nl=e=>{var i,o,r,s;let{wsAdditionalDetails:u}=e;const{t:d}=a.useTranslation(),[c,m,p]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),S=!(null==u||null===(i=u.additionalDetails)||void 0===i||!i.isPaid),[h,y]=n.useState(!1),[A,C]=n.useState(c||{}),[D,b]=n.useState(null),[T,I]=n.useState(u.additionalDetails.data?u.additionalDetails.data:{}),[O,N]=n.useState(u.additionalDetails.values?u.additionalDetails.values:[]),R=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(R,"BillingService",["TaxHeadMaster"]),n.useEffect(()=>{var e,t,n;const a=v({},null==u||null===(e=u.additionalDetails)||void 0===e||null===(t=e.appDetails)||void 0===t?void 0:t.additionalDetails);if((null==c||null===(n=c.billDetails)||void 0===n?void 0:n.length)>0){var i,o,r,s,d,p,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(d=c.billDetails)||void 0===d||null===(p=d[0])||void 0===p?void 0:p.taxAmount)}];N(e),I(null==c||null===(E=c.billDetails)||void 0===E?void 0:E[0])}else m(a),C(a)},[]);let x={};const L=e=>l.createElement("h1",{className:"heading-m"},e.label),P=()=>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"})),w=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(P,null)),M=function(e,t,n){void 0===t&&(t=!1);let l=v({},A);if("adhocPenalty"!=e&&"adhocRebate"!=e||!n.target.value)t?(l[e+"_data"]=n,l[e]=n.title,"PT_OTHERS"==n.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==n.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=n.target.value;else{var a,i;const t=0==(null==n||null===(a=n.target)||void 0===a?void 0:a.value)?1:Math.sign(null==n||null===(i=n.target)||void 0===i?void 0:i.value)||-1;l[e]=1==t?n.target.value:""}C(l)};return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},O&&l.createElement(t.StatusTable,null,l.createElement("div",null,null==O?void 0:O.map((e,n)=>l.createElement(t.Row,{className:"border-none",key:""+e.title,label:""+d(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),l.createElement("hr",{style:{border:"1px solid #D6D5D4",color:"#D6D5D4",margin:"16px 0px"}}),l.createElement("div",null,l.createElement(t.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+d("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==T?void 0:T.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(t.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+d("CS_INBOX_STATUS_FILTER"),text:d(S?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:S?{color:"#00703C"}:{color:"#D4351C"}}))),null!=u&&null!==(o=u.additionalDetails)&&void 0!==o&&o.isAdhocRebate?l.createElement("div",{onClick:e=>{y(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},d("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,h&&l.createElement(t.Modal,{headerBarMain:l.createElement(L,{label:d("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(w,{onClick:()=>{C(c),y(!1)}}),actionCancelLabel:d("PT_CANCEL"),actionCancelOnSubmit:()=>{C(c),y(!1)},actionSaveLabel:d("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const t=null!=A&&A.adhocPenalty?Number(null==A?void 0:A.adhocPenalty):0,n=null!=A&&A.adhocRebate?Number(null==A?void 0:A.adhocRebate):0;var l,a;if(t||n)if(n>(null==u||null===(l=u.additionalDetails)||void 0===l||null===(a=l.data)||void 0===a?void 0:a.totalAmount))b({isError:!1,isWarning:!0,key:"error",message:d("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,o,r,s,c,p,E,g,S,h;const e=null==u||null===(i=u.additionalDetails)||void 0===i||null===(o=i.appDetails)||void 0===o?void 0:o.applicationNo,t=null==u||null===(r=u.additionalDetails)||void 0===r||null===(s=r.appDetails)||void 0===s?void 0:s.tenantId,n=v({},null==u||null===(c=u.additionalDetails)||void 0===c||null===(p=c.appDetails)||void 0===p?void 0:p.additionalDetails,A);u.additionalDetails.appDetails.additionalDetails=n;const l={CalculationCriteria:"WATER"==(null==u||null===(E=u.additionalDetails)||void 0===E||null===(g=E.appDetails)||void 0===g?void 0:g.service)?[{applicationNo:e,tenantId:t,waterConnection:u.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:t,sewerageConnection:u.additionalDetails.appDetails}],isconnectionCalculation:!1};let a="WATER"==(null==u||null===(S=u.additionalDetails)||void 0===S||null===(h=S.appDetails)||void 0===h?void 0:h.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,a).then((e,t)=>{var n,l,a,i,o,r,s,u,d,c,v,p,E,g,S;(null==e||null===(n=e.Calculation)||void 0===n||null===(l=n[0])||void 0===l||null===(a=l.taxHeadEstimates)||void 0===a?void 0:a.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(g=E[0])||void 0===g||null===(S=g.taxHeadEstimates)||void 0===S||S.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.taxHeadEstimates,"category");const h=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(u=e.Calculation)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.taxAmount}];f(un(e.Calculation[0])),I(null==e||null===(p=e.Calculation)||void 0===p?void 0:p[0]),N(h),A.billDetails=null==e?void 0:e.Calculation,m(A),y(!1)}).catch(e=>{var t,n,l,a,i,o;b({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors[0])&&void 0!==l&&l.message?d(""+(null==e||null===(a=e.response)||void 0===a||null===(i=a.data)||void 0===i||null===(o=i.Errors[0])||void 0===o?void 0:o.code)):d("PT_COMMON_ADD_REBATE_PENALITY")})})}else b({isError:!1,isWarning:!0,key:"warning",message:d("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_PENALTY")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:el,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==A?void 0:A.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:d})),"PT_OTHERS"===(null==A||null===(r=A.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==A?void 0:A.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},x={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")})))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==A?void 0:A.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},x={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(t.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(t.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},d("PT_AD_REBATE")),l.createElement(t.CardLabel,null,d("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(t.Dropdown,{isMandatory:!0,option:tl,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==A?void 0:A.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:d})),"PT_OTHERS"===(null==A||null===(s=A.adhocRebateReason_data)||void 0===s?void 0:s.title)&&l.createElement("div",{className:"field"},l.createElement(t.CardLabel,null,d("PT_REASON")),l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:d,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==A?void 0:A.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},x={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:d("TL_NAME_ERROR_MESSAGE")}))),l.createElement(t.CardLabel,null,d("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({style:{background:"#FAFAFA"},t:d,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==A?void 0:A.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},x={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:d("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),D&&l.createElement(t.Toast,{style:{zIndex:"10000"},warning:null==D?void 0:D.isWarning,error:null==D||!D.isWarning,label:d(null==D?void 0:D.message),onClose:()=>{b(!1)},isDleteBtn:!0})))},ll=e=>{let{style:t}=e;return l.createElement("span",null,l.createElement("svg",{style:v({},t),display:"inline",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l.createElement("path",{d:"M11 0.5C6 0.5 1.73 3.61 0 8C1.73 12.39 6 15.5 11 15.5C16 15.5 20.27 12.39 22 8C20.27 3.61 16 0.5 11 0.5ZM11 13C8.24 13 6 10.76 6 8C6 5.24 8.24 3 11 3C13.76 3 16 5.24 16 8C16 10.76 13.76 13 11 13ZM11 5C9.34 5 8 6.34 8 8C8 9.66 9.34 11 11 11C12.66 11 14 9.66 14 8C14 6.34 12.66 5 11 5Z",fill:"#a82227"})))},al=e=>{let{t:n,userType:a=!1,infoBannerLabel:i="",infoClickLable:o="",infoClickInfoLabel:r="",infoClickInfoLabel1:s=""}=e;a=a||Digit.SessionStorage.get("userType");const u=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:u?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(t.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(i))),n(o)+" ",l.createElement(ll,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(s)))))},il=e=>{var i,o,r,s,u,d,c;let{wsAdditionalDetails:m}=e;const{t:v}=a.useTranslation(),[p,E]=n.useState(!1),[f,g]=n.useState({}),S=e=>l.createElement("h1",{className:"heading-m"},e.label),_=()=>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"})),h=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(_,null));return l.createElement(n.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=m&&null!==(i=m.additionalDetails)&&void 0!==i&&i.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let t=m.additionalDetails.data||{};const n=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=n?JSON.parse(n):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(t=null==l?void 0:l.value),g(t),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},v("WS_PAYMENT_VIEW_BREAKUP"))):null,p&&l.createElement(t.Modal,{headerBarMain:l.createElement(S,{label:v("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(h,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(t.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_APPLICATION_FEE_HEADER")),null==f||null===(o=f.billSlabData)||void 0===o||null===(r=o.FEE)||void 0===r?void 0:r.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(t.CardSectionHeader,{style:{margin:"10px 0px"}},v("WS_SERVICE_FEE_HEADER")),null==f||null===(s=f.billSlabData)||void 0===s||null===(u=s.CHARGES)||void 0===u?void 0:u.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==f||null===(d=f.billSlabData)||void 0===d||null===(c=d.TAX)||void 0===c?void 0:c.map(e=>l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+v(""+(null==e?void 0:e.taxHeadCode)),text:l.createElement("span",null,"₹",Number(null==e?void 0:e.amount)||0),textStyle:{textAlign:"right"}})),l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",marginBottom:"10px"}}),l.createElement(t.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+v("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==f?void 0:f.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},ol={root:{width:"100%",marginTop:"2px",overflowX:"auto",boxShadow:"none"},table:{minWidth:700,backgroundColor:"rgba(250, 250, 250, var(--bg-opacity))"},cell:{maxWidth:"7em",minWidth:"1em",border:"1px solid #e8e7e6",padding:"4px 5px",fontSize:"0.8em",textAlign:"left",lineHeight:"1.5em"},cellHeader:{overflow:"hidden",textOverflow:"ellipsis"},cellLeft:{},cellRight:{}},rl=e=>{let{className:t="table",headers:n=[],values:i=[],arrears:o=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:ol.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:ol.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:v({},ol.cell,ol.cellLeft,ol.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:v({},ol.cell,n.length==t+1?ol.cellRight:{},ol.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:v({},ol.cell,ol.cellLeft),component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:v({},ol.cell,{textAlign:"left"},n.length==a+1?ol.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:v({},ol.cell,ol.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:v({},ol.cell,ol.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:v({},ol.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:ol.cell,key:t,numeric:!0})))))))},sl={buttonStyle:{display:"flex",justifyContent:"flex-end",color:"#a82227"},headerStyle:{marginTop:"10px",fontSize:"16px",fontWeight:"700",lineHeight:"24px",color:" rgba(11, 12, 12, var(--text-opacity))"}},ul=e=>{var t,i,o;let{bill:r={}}=e;const{t:s}=a.useTranslation();let u={},d=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];d=[...d];const c=(null===(i=d)||void 0===i?void 0:i.reduce((e,t,n)=>e+t.amount,0))||0;let m="₹ "+((null==c||null===(o=c.toFixed)||void 0===o?void 0:o.call(c,0))||Number(0).toFixed(0));d.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:i=[]}=e;return i.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);u[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?"FY"+(n.getYear()+1900)+"-"+(l.getYear()-100):n.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=t});let v={};!u||Object.keys(u).map((e,t)=>{Object.keys(u[e]).map(t=>{v[t]=u[e]&&u[e][t]&&u[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,f]=n.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:sl.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(rl,{headers:[...p],values:u,arrears:m}),!E&&l.createElement("div",{style:sl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:sl.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))};function dl(e){var o,r,s,u,d,c,m,v,p,E,f,g,S,h;let{applicationDetails:y,demandData:A,workflowDetails:C,isDataLoading:D,applicationData:b,totalDemandTax:T,timelineStatusPrefix:I,showTimeLine:O=!0,statusAttribute:N="status",paymentsList:R,oldValue:x,isInfoLabel:L=!1}=e;const{t:P}=a.useTranslation();let w=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");function M(e,t,n){var l;window.open(null==n||null===(l=n.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("appl",y);const[F,B]=n.useState({}),[k,U]=n.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==b?void 0:b.status)||k.loading||k.loaded||k.canLoad||U({loading:!1,loaded:!1,canLoad:!0}),null==k||!k.canLoad||k.loading||k.loaded||(U({loading:!0,loaded:!1,canLoad:!0}),function(e,t,n,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:t}})).then(function(a){function i(){n(o),l({loading:!1,loaded:!0,canLoad:!0})}let o={};const r=function(n){if((null==a||null===(n=a.Assessments)||void 0===n?void 0:n.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:t})).then(function(e){o=e})}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==b?void 0:b.tenantId)||tenantId,null==b?void 0:b.propertyId,B,U));const H=e=>{if(null==e||null==e||""==e)return"NA";const t=new Date(e);let n=t.getMonth()+1,l=t.getDate();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+t.getFullYear()},j=function(e,t,n){if(void 0===t&&(t=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var a;const e={date:H(null==b||null===(a=b.auditDetails)||void 0===a?void 0:a.createdTime),source:(null==b?void 0:b.channel)||""};return l.createElement(Zn,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,o,r,s,u,d,c,m,v,p,E,f,g,S,h,A,C,D;const a={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.uuid,fieldName:"mobileNumber",model:"User",showValue:!1,loadData:{serviceName:"/egov-workflow-v2/egov-wf/process/_search",requestBody:{},requestParam:{tenantId:null==y?void 0:y.tenantId,businessIds:null==y?void 0:y.applicationNo,history:!0},jsonPath:"ProcessInstances[0].assignes[0].mobileNumber",isArray:!1,d:e=>{let n="";return n="+91 "+_.get(e,"ProcessInstances["+t+"].assignes[0].mobileNumber"),n}}},T=n[t-1],I={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(s=e.assignes)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.name,mobileNumber:(null==b||null===(d=b.processInstance)||void 0===d||null===(c=d.assignes)||void 0===c||null===(m=c[0])||void 0===m?void 0:m.uuid)===(null==e||null===(v=e.assignes)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.uuid)&&null!=b&&null!==(E=b.processInstance)&&void 0!==E&&null!==(f=E.assignes)&&void 0!==f&&null!==(g=f[0])&&void 0!==g&&g.mobileNumber?null==b||null===(S=b.processInstance)||void 0===S||null===(h=S.assignes)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.mobileNumber:null==e||null===(C=e.assignes)||void 0===C||null===(D=C[0])||void 0===D?void 0:D.mobileNumber,comment:P(null==e?void 0:e.comment),wfComment:T?T.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(Zn,{data:I,OpenImage:M,privacy:a})}{var T,I,O,N,R;const t={date:H(null==b||null===(T=b.auditDetails)||void 0===T?void 0:T.lastModifiedTime),name:null==e||null===(I=e.assignes)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.name,wfComment:null==e?void 0:e.wfComment,mobileNumber:null==e||null===(N=e.assignes)||void 0===N||null===(R=N[0])||void 0===R?void 0:R.mobileNumber};return l.createElement(Zn,{data:t})}},W=(e,t)=>e?t?e:P(e):P("NA"),V=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),z=window.location.href.includes("employee/noc"),G=window.location.href.includes("employee/obps"),K=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||V?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),q={table:{border:"2px solid black",width:"100%",fontFamily:"sans-serif"},td:{padding:"10px",border:"1px solid black",textAlign:"center"},th:{padding:"10px",border:"1px solid black",textAlign:"center"}},Y=e=>null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+P(null==e?void 0:e.isUnit):P("N/A"):null!=e&&e.value?W(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):P("N/A"),[$,Z]=n.useState(!1);console.log("demand Data arr",A);const Q=null==A?void 0:A.reduce((e,t)=>e+t.demandInterest,0),X=null==A?void 0:A.reduce((e,t)=>e+t.demandPenality,0),J=null==A?void 0:A.reduce((e,t)=>e+t.collectionTax,0),ee=null==A?void 0:A.reduce((e,t)=>e+t.collectionInterest,0),te=null==A?void 0:A.reduce((e,t)=>e+t.collectionPenality,0),ne=null==A?void 0:A.reduce((e,t)=>e+t.balanceTax,0);return null==A||A.reduce((e,t)=>e+t.balanceInterest,0),null==A||A.reduce((e,t)=>e+t.balancePenality,0),l.createElement(t.Card,{style:{position:"relative"},className:"employeeCard-override"},L?l.createElement(al,{t:P,userType:!1,infoBannerLabel:"CS_FILE_APPLICATION_INFO_LABEL",infoClickLable:"WS_CLICK_ON_LABEL",infoClickInfoLabel:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO_LABEL":"WS_CLICK_ON_INFO_LABEL",infoClickInfoLabel1:window.location.href.includes("disconnection")||window.location.href.includes("application")?"WS_DISCONNECTION_CLICK_ON_INFO1_LABEL":""}):null,null==y||null===(o=y.applicationDetails)||void 0===o?void 0:o.map((e,a)=>{var o,r,s,u,d,c,m,v,p,E,f,g,S,_,h,A,D,b,T,I,O,N,L,M,B,k,U,H,j,W,q,$,Z,Q,X,J,ee,te,ne,le;return l.createElement(l.Fragment,{key:a},l.createElement("div",{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||window.location.href.includes("employee/ws")?{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}:V?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==a||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(t.CardSectionHeader,{style:0==a&&V?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},z?""+P(e.title):P(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(t.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},P(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"0px"}},P(e)))),null==e?void 0:e.tableRows.map((t,a)=>a===(null==e?void 0:e.tableRows.length)-1?l.createElement(n.Fragment,null,l.createElement("hr",{style:{width:"370%",marginTop:"15px"},className:"underline"}),l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{textAlign:"left"}},P(e))))):l.createElement("tr",null,t.map(e=>l.createElement("td",{style:{paddingTop:"20px",textAlign:"left"}},P(e)))))),l.createElement(t.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||V?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(o=e.values)||void 0===o?void 0:o.map((n,a)=>{var o,r,s;return!0===n.map&&"N/A"!==n.value?l.createElement(t.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:P(n.title),label:P(n.title),text:l.createElement("img",{src:P(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(t.Row,{key:P(n.title),label:window.location.href.includes("tl")||window.location.href.includes("ws")?l.createElement("div",{style:{width:"200%"}},l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},P(null==n?void 0:n.title)))):z||G?""+P(n.title):P(n.title),text:l.createElement("div",null,l.createElement(i.Link,{to:null==n?void 0:n.to},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==n?void 0:n.value))),last:a===(null==e||null===(s=e.values)||void 0===s?void 0:s.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:K(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(t.Row,{className:"border-none",key:""+n.title,label:""+P(""+n.title),privacy:null==n?void 0:n.privacy,text:null!=n&&n.oldValue?null==n?void 0:n.oldValue:null!=n&&n.value?null==n?void 0:n.value:"",labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement(t.Row,{key:P(n.title),label:P(n.title),text:Y(n),last:a===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:n.caption,className:"border-none",privacy:null==n?void 0:n.privacy,rowContainerStyle:K(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}),"PT_TOTAL_DUES"===n.title?l.createElement(ul,{bill:null===(r=F.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(r=e.additionalDetails)||void 0===r?void 0:r.inspectionReport)&&l.createElement(qn,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:R,additionalDetails:null==y||null===(s=y.applicationData)||void 0===s?void 0:s.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==y||null===(u=y.applicationData)||void 0===u||null===(d=u.additionalDetails)||void 0===d||null===(c=d.fieldinspection_pending)||void 0===c?void 0:c.length)>0&&(null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.fiReport)&&l.createElement(Un,{fiReport:null==y||null===(v=y.applicationData)||void 0===v||null===(p=v.additionalDetails)||void 0===p?void 0:p.fieldinspection_pending}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.floors)&&l.createElement(Gn,{floors:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.floors}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.owners)&&l.createElement(Kn,{owners:null==e||null===(S=e.additionalDetails)||void 0===S?void 0:S.owners}),(null==e||null===(_=e.additionalDetails)||void 0===_?void 0:_.units)&&l.createElement(Xn,{units:null==e||null===(h=e.additionalDetails)||void 0===h?void 0:h.units}),(null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.accessories)&&l.createElement(Qn,{units:null==e||null===(D=e.additionalDetails)||void 0===D?void 0:D.accessories}),!w&&(null==e||null===(b=e.additionalDetails)||void 0===b?void 0:b.permissions)&&(null==C||null===(T=C.data)||void 0===T||null===(I=T.nextActions)||void 0===I?void 0:I.length)>0&&l.createElement(Wn,{applicationData:null==y?void 0:y.applicationData,t:P,permissions:null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.permissions}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.obpsDocuments)&&l.createElement("div",{style:{display:"flex"}},l.createElement(Bn,{t:P,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:C})),(null==e||null===(L=e.additionalDetails)||void 0===L?void 0:L.noc)&&l.createElement(jn,{t:P,isNoc:!0,NOCdata:e.values,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.noc,noc:null===(M=e.additionalDetails)||void 0===M?void 0:M.data,bpaActionsDetails:C}),(null==e||null===(B=e.additionalDetails)||void 0===B?void 0:B.scruntinyDetails)&&l.createElement(qn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.buildingExtractionDetails)&&l.createElement(qn,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.subOccupancyTableDetails)&&l.createElement(Yn,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==e||null===(H=e.additionalDetails)||void 0===H?void 0:H.documentsWithUrl)&&l.createElement(Fn,{documents:null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documentsWithUrl}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.documents)&&l.createElement(Vn,{documents:null==e||null===(q=e.additionalDetails)||void 0===q?void 0:q.documents}),(null==e||null===($=e.additionalDetails)||void 0===$?void 0:$.taxHeadEstimatesCalculation)&&l.createElement(zn,{taxHeadEstimatesCalculation:null==e||null===(Z=e.additionalDetails)||void 0===Z?void 0:Z.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(Jn,{wsAdditionalDetails:e,oldValue:x}),(null==e||null===(Q=e.additionalDetails)||void 0===Q?void 0:Q.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(X=e.additionalDetails)||void 0===X||null===(J=X.redirectUrl)||void 0===J?void 0:J.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(te=ee.redirectUrl)||void 0===te?void 0:te.title))),(null==e||null===(ne=e.additionalDetails)||void 0===ne?void 0:ne.estimationDetails)&&l.createElement(nl,{wsAdditionalDetails:e,workflowDetails:C}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(il,{wsAdditionalDetails:e,workflowDetails:C}))}),O&&(null==C||null===(r=C.data)||void 0===r||null===(s=r.timeline)||void 0===s?void 0:s.length)>0&&l.createElement(l.Fragment,null,l.createElement(t.BreakLine,null),((null==C?void 0:C.isLoading)||D)&&l.createElement(t.Loader,null),!(null!=C&&C.isLoading)&&!D&&l.createElement(n.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},P("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=C&&null!==(u=C.data)&&void 0!==u&&u.timeline&&1===(null==C||null===(d=C.data)||void 0===d||null===(c=d.timeline)||void 0===c?void 0:c.length)?l.createElement(t.CheckPoint,{isCompleted:!0,label:P(""+I+(null==C||null===(m=C.data)||void 0===m||null===(v=m.timeline[0])||void 0===v?void 0:v.state)),customChild:j(null==C||null===(p=C.data)||void 0===p?void 0:p.timeline[0],null==C||null===(E=C.data)||void 0===E?void 0:E.timeline)}):l.createElement(t.ConnectingCheckPoints,null,(null==C||null===(f=C.data)||void 0===f?void 0:f.timeline)&&(null==C||null===(g=C.data)||void 0===g?void 0:g.timeline.slice(0,$?null==C?void 0:C.data.timeline.length:2).map((e,n,a)=>{var i;let o="";var r,s,u,d,c,m;return window.location.href.includes("/obps/")&&(o=null!=C&&null!==(r=C.data)&&void 0!==r&&null!==(s=r.timeline[n-1])&&void 0!==s&&null!==(u=s.state)&&void 0!==u&&u.includes("BACK_FROM")||null!=C&&null!==(d=C.data)&&void 0!==d&&null!==(c=d.timeline[n-1])&&void 0!==c&&null!==(m=c.state)&&void 0!==m&&m.includes("SEND_TO_CITIZEN")?"_NOT_DONE":"SEND_TO_ARCHITECT"===(null==e?void 0:e.performedAction)?"_BY_ARCHITECT_DONE":0==n?"":"_DONE"),l.createElement(l.Fragment,{key:n},l.createElement(t.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:P(""+I+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[N])+o),customChild:j(e,n,null==C||null===(i=C.data)||void 0===i?void 0:i.timeline)}))}))),(null==C||null===(S=C.data)||void 0===S||null===(h=S.timeline)||void 0===h?void 0:h.length)>2&&l.createElement(t.LinkButton,{label:P($?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{Z(e=>!e)}})))),l.createElement(t.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"16px",fontSize:"24px"}},"DCB Details"),l.createElement("table",{border:"1px",style:q.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:q.th},"Installments"),l.createElement("th",{colSpan:"3",style:q.th},"Demand"),l.createElement("th",{colSpan:"3",style:q.th},"Collection"),l.createElement("th",{colSpan:"3",style:q.th},"Balance"),l.createElement("th",{style:q.th},"Advance")),l.createElement("tr",null,l.createElement("th",{style:q.th}),l.createElement("th",{style:q.th},"Tax"),l.createElement("th",{style:q.th},"Interest"),l.createElement("th",{style:q.th},"Penalty"),l.createElement("th",{style:q.th},"Tax"),l.createElement("th",{style:q.th},"Interest"),l.createElement("th",{style:q.th},"Penalty"),l.createElement("th",{style:q.th},"Tax"),l.createElement("th",{style:q.th},"Interest"),l.createElement("th",{style:q.th},"Penalty"),l.createElement("th",{style:q.th},"Advance"))),l.createElement("tbody",null,null==A?void 0:A.map(e=>l.createElement("tr",null,l.createElement("td",{style:q.td},e.taxPeriodFrom,"-",e.taxPeriodTo),l.createElement("td",{style:q.td},e.demandTax),l.createElement("td",{style:q.td},e.demandInterest),l.createElement("td",{style:q.td},e.demandPenality),l.createElement("td",{style:q.td},e.collectionTax),l.createElement("td",{style:q.td},e.collectionInterest),l.createElement("td",{style:q.td},e.collectionPenality),l.createElement("td",{style:q.td},e.balanceTax),l.createElement("td",{style:q.td},e.balanceInterest),l.createElement("td",{style:q.td},e.balancePenality),l.createElement("td",{style:q.td},e.advance))),l.createElement("tr",null,l.createElement("th",{style:q.th},"Total"),l.createElement("td",{style:q.td},T),l.createElement("td",{style:q.td},Q),l.createElement("td",{style:q.td},X),l.createElement("td",{style:q.td},J),l.createElement("td",{style:q.td},ee),l.createElement("td",{style:q.td},te),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td})),l.createElement("tr",null,l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("th",{style:q.th},"Total"),l.createElement("td",{style:q.td},ne),l.createElement("td",{style:q.td},"0"),l.createElement("td",{style:q.td},"0"),l.createElement("td",{style:q.td},"0")),l.createElement("tr",null,l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("td",{style:q.td}),l.createElement("th",{style:q.th},"Total Balance"),l.createElement("td",{style:q.td},ne)))))}function cl(e){var n,a,i,o,r,s,u,d,c,m,v,p,E,f,g,S,_,h;let{t:y,showToast:A,closeToast:C,businessService:D}=e;if(null!=D&&D.includes("NewTL")||null!=D&&D.includes("TL")||null!=D&&D.includes("EDITRENEWAL")){var b;let e="";switch(null==A||null===(b=A.action)||void 0===b?void 0:b.action){case"SENDBACK":e="error"===(null==A?void 0:A.key)?null==A||null===(n=A.error)||void 0===n?void 0:n.message:y("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==A?void 0:A.key)?null==A||null===(a=A.error)||void 0===a?void 0:a.message:y("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==A?void 0:A.key)?null==A||null===(i=A.error)||void 0===i?void 0:i.message:y("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==A?void 0:A.key)?null==A||null===(o=A.error)||void 0===o?void 0:o.message:y("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==A?void 0:A.key)?null==A||null===(r=A.error)||void 0===r?void 0:r.message:y("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==A?void 0:A.key)?null==A||null===(s=A.error)||void 0===s?void 0:s.message:y("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==A?void 0:A.key)?null==A||null===(u=A.error)||void 0===u?void 0:u.message:y("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==A?void 0:A.key)?null==A||null===(d=A.error)||void 0===d?void 0:d.message:y("ES_"+D+"_"+(null==A||null===(c=A.action)||void 0===c?void 0:c.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:e,onClose:C}))}if(null!=D&&D.includes("BPA")||null!=D&&D.includes("BPA_LOW")||null!=D&&D.includes("BPA_OC")){var T;const e=function(e){var t;void 0===e&&(e=[]);let n=e[0];return n=2==(null===(t=e)||void 0===t?void 0:t.length)&&null!=D&&D.includes("BPA_OC")?y(e[1]):y(e[0]),n};let n="";switch(null==A||null===(T=A.action)||void 0===T?void 0:T.action){case"REVOCATE":n="error"===(null==A?void 0:A.key)?null==A||null===(m=A.error)||void 0===m?void 0:m.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(v=A.error)||void 0===v?void 0:v.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==A?void 0:A.key)?null==A||null===(p=A.error)||void 0===p?void 0:p.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==A?void 0:A.key)?null==A||null===(E=A.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==A?void 0:A.key)?null==A||null===(f=A.error)||void 0===f?void 0:f.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==A?void 0:A.key)?null==A||null===(g=A.error)||void 0===g?void 0:g.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==A?void 0:A.key)?null==A||null===(S=A.error)||void 0===S?void 0:S.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==A?void 0:A.key)?null==A||null===(_=A.error)||void 0===_?void 0:_.message:y("ES_"+D+"_"+(null==A||null===(h=A.action)||void 0===h?void 0:h.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:n,onClose:C}))}{var I,O;const e="error"===(null==A?void 0:A.key)?null==A||null===(I=A.error)||void 0===I?void 0:I.message:"ES_"+D+"_"+(null==A||null===(O=A.action)||void 0===O?void 0:O.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,A&&l.createElement(t.Toast,{error:"error"===A.key,label:y(e),onClose:C}))}}function ml(e){var i,o,r,s,u,d,c,m,p,E,f,g,S,_,h,y;let{workflowDetails:A,displayMenu:C,onActionSelect:D,setDisplayMenu:b,businessService:T,forcedActionPrefix:I,ActionBarStyle:O={},MenuStyle:N={}}=e;const{t:R}=a.useTranslation();let x=Digit.UserService.getUser();const L=n.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),t=e?JSON.parse(e):{};x=null==t?void 0:t.value}const P=null===(i=x)||void 0===i||null===(o=i.info)||void 0===o||null===(r=o.roles)||void 0===r?void 0:r.map(e=>e.code);let w=!1,M=!1,F=(null==A||null===(s=A.data)||void 0===s||null===(u=s.actionState)||void 0===u||null===(d=u.nextActions)||void 0===d?void 0:d.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles))||(null==A||null===(c=A.data)||void 0===c||null===(m=c.nextActions)||void 0===m?void 0:m.filter(e=>(null==P?void 0:P.some(t=>{var n;return null===(n=e.roles)||void 0===n?void 0:n.includes(t)}))||!e.roles));return Digit.Hooks.useClickOutside(L,()=>{b(!1)},C),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==F?void 0:F.length)||null!=F&&null!==(p=F[0])&&void 0!==p&&null!==(E=p.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==F?void 0:F.length)?(M=!1,w=!0):(null==F?void 0:F.length)>0&&(M=!0,w=!1),l.createElement(l.Fragment,null,!(null!=A&&A.isLoading)&&M&&!w&&l.createElement(t.ActionBar,{style:v({},O)},C&&(null!=A&&null!==(f=A.data)&&void 0!==f&&null!==(g=f.actionState)&&void 0!==g&&g.nextActions||null!=A&&null!==(S=A.data)&&void 0!==S&&S.nextActions)?l.createElement(t.Menu,{localeKeyPrefix:I||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()),options:F,optionKey:"action",t:R,onSelect:D,style:N}):null,l.createElement(t.SubmitBar,{ref:L,label:R("WF_TAKE_ACTION"),onSubmit:()=>b(!C)})),!(null!=A&&A.isLoading)&&!M&&w&&l.createElement(t.ActionBar,{style:v({},O)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==F||null===(_=F[0])||void 0===_?void 0:_.action,value:null==F||null===(h=F[0])||void 0===h?void 0:h.action,onClick:e=>{D((null==F?void 0:F[0])||{})}},R((I||"WF_EMPLOYEE_"+(null==T?void 0:T.toUpperCase()))+"_"+(null==F||null===(y=F[0])||void 0===y?void 0:y.action)))))}const vl=()=>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"})),pl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(vl,null));function El(e){let{action:n,closeWarningPopup:i}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(t.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},o("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(pl,{onClick:()=>{i()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(t.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,o("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",o("PT_DUE_WARNING_MSG2"))),l.createElement(t.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+o("PT_AMOUNT_DUE"),text:"₹"+o(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(t.ButtonSelector,{theme:"border",label:o("ES_PT_COMMON_CANCEL"),onSubmit:i,style:{marginLeft:"10px"}}),l.createElement(t.ButtonSelector,{label:o("PT_COLLECT"),onSubmit:()=>{var e;return window.location.assign(""+window.location.origin+(null==n||null===(e=n.redirectionUrl)||void 0===e?void 0:e.pathname))},style:{marginLeft:"10px"}})))),")")}const fl=e=>{var o,r;console.log("props",e);let s=window.location.href.includes("editApplication")&&window.location.href.includes("bpa");const u=Digit.ULBService.getCurrentTenantId(),c=Digit.ULBService.getStateId(),{data:m}=Digit.Hooks.obps.useMDMS(c,"BPA",["BlockReason"]),{t:p}=a.useTranslation(),E=i.useHistory();let{id:f}=i.useParams();const[g,S]=n.useState(!1),[_,y]=n.useState(null),[A,C]=n.useState(!1),[D,b]=n.useState(!1),[T,I]=n.useState(!1),{data:O}=Digit.Hooks.obps.useMDMS(c,"BPA",["RiskTypeComputation"]),{applicationDetails:N,demandData:R,totalDemandTax:x,totalBalanceTax:L,showToast:P,setShowToast:w,isLoading:M,isDataLoading:F,applicationData:B,mutate:k,nocMutation:U,workflowDetails:H,id:j,businessService:W,closeToast:V,moduleCode:z,timelineStatusPrefix:G,forcedActionPrefix:K,statusAttribute:q,ActionBarStyle:Y,MenuStyle:$,paymentsList:Z,showTimeLine:Q=!0,oldValue:X,isInfoLabel:J=!1,clearDataDetails:ee}=e;n.useEffect(()=>{P&&H.revalidate()},[P]);const te=d.useQueryClient(),ne=()=>{y(null),C(!1)};return M||D?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,M?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(dl,{applicationDetails:N,demandData:R,id:j,workflowDetails:H,isDataLoading:F,applicationData:B,totalDemandTax:x,totalBalanceTax:L,businessService:W,timelineStatusPrefix:G,statusAttribute:q,paymentsList:Z,showTimeLine:Q,oldValue:X,isInfoLabel:J}),A?l.createElement(Mn,{t:p,action:_,tenantId:u,state:c,id:f,applicationDetails:N,applicationData:null==N?void 0:N.applicationData,closeModal:ne,submitAction:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n={});try{let l=!1;const a=function(a,i,o,r,s,u,d,c,m,f,g,S,y,A,C,D,T,I){if(0==(null==e||null===(a=e.Property)||void 0===a||null===(i=a.workflow)||void 0===i||null===(o=i.comment)||void 0===o?void 0:o.length)||("INITIATE"===(null==e||null===(r=e.Licenses)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.action)?0==(null==e||null===(u=e.Licenses)||void 0===u||null===(d=u[0])||void 0===d||null===(c=d.additionalDetail)||void 0===c||null===(m=c.validityYears)||void 0===m?void 0:m.length):0==(null==e||null===(f=e.Licenses)||void 0===f||null===(g=f[0])||void 0===g||null===(S=g.comment)||void 0===S?void 0:S.length))||0==(null==e||null===(y=e.WaterConnection)||void 0===y||null===(A=y.comment)||void 0===A?void 0:A.length)||0==(null==e||null===(C=e.SewerageConnection)||void 0===C||null===(D=C.comment)||void 0===D?void 0:D.length)||0==(null==e||null===(T=e.BPA)||void 0===T||null===(I=T.comment)||void 0===I?void 0:I.length)){var O,N;"INITIATE"===(null==e||null===(O=e.Licenses)||void 0===O||null===(N=O[0])||void 0===N?void 0:N.action)?alert(p("Please fill in the validity before submitting")):alert(p("Please fill in the comments before submitting"))}else{const a=function(a,i,o,r,s){if("BPA"!=(null==e||null===(a=e.BPA)||void 0===a?void 0:a.businessService)||null!=e&&null!==(i=e.BPA)&&void 0!==i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.blockingReason||"BLOCK"!=(null==e||null===(r=e.BPA)||void 0===r||null===(s=r.workflow)||void 0===s?void 0:s.action)){function u(t){if(l)return t;k&&(b(!0),k(e,{onError:(e,t)=>{b(!1),w({key:"error",error:e}),setTimeout(V,5e3)},onSuccess:(e,t)=>{var l,a,i,o,r,s;if(sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),b(!1),null!==(l=n)&&void 0!==l&&l.bpa&&(e.selectedAction=_,E.replace("/digit-ui/employee/obps/response",{data:e})),null!==(a=n)&&void 0!==a&&a.isStakeholder&&(e.selectedAction=_,E.push("/digit-ui/employee/obps/stakeholder-response",{data:e})),null!==(i=n)&&void 0!==i&&i.isNoc&&E.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(o=e.Amendments)||void 0===o?void 0:o.length)>0){var u,d,c,m,v,f,g,S;null!=t&&null!==(u=t.AmendmentUpdate)&&void 0!==u&&null!==(d=u.workflow)&&void 0!==d&&d.action.includes("SEND_BACK")?w({key:"success",label:p("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=t&&null!==(c=t.AmendmentUpdate)&&void 0!==c&&null!==(m=c.workflow)&&void 0!==m&&m.action.includes("RE-SUBMIT")?w({key:"success",label:p("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=t&&null!==(v=t.AmendmentUpdate)&&void 0!==v&&null!==(f=v.workflow)&&void 0!==f&&f.action.includes("APPROVE")?w({key:"success",label:p("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=t&&null!==(g=t.AmendmentUpdate)&&void 0!==g&&null!==(S=g.workflow)&&void 0!==S&&S.action.includes("REJECT")&&w({key:"success",label:p("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")})}else{var h;if((null==e||null===(r=e.Licenses)||void 0===r?void 0:r.length)>0&&null!=e&&null!==(s=e.Licenses[0])&&void 0!==s&&s.applicationNumber)return w({key:"success",action:_}),void E.replace("/digit-ui/employee/tl/application-details/"+(null==e||null===(h=e.Licenses[0])||void 0===h?void 0:h.applicationNumber));w({key:"success",action:_}),ee&&setTimeout(ee,3e3),setTimeout(V,5e3),te.clear(),te.refetchQueries("APPLICATION_SEARCH")}}})),ne()}b(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(v({},e)));const a=function(){if(!1!==t&&U){var e;const n=null===(e=t)||void 0===e?void 0:e.map(e=>null==U?void 0:U.mutateAsync(e)),a=h(function(){return b(!0),Promise.resolve(Promise.all(n)).then(function(e){e&&e.map(e=>{var t,n;Digit.SessionStorage.del(null==e||null===(t=e.Noc)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.nocType)})})},function(e){var t,n,a,i,o,r,s,u,d,c,m,v;b(!1);let E=null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(a=n.Errors)&&void 0!==a&&null!==(i=a[0])&&void 0!==i&&i.code?p(null==e||null===(o=e.response)||void 0===o||null===(r=o.data)||void 0===r||null===(s=r.Errors)||void 0===s||null===(u=s[0])||void 0===u?void 0:u.code):(null==e||null===(d=e.response)||void 0===d||null===(c=d.data)||void 0===c||null===(m=c.Errors)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.message)||e;ne(),w({key:"error",error:{message:E}}),setTimeout(V,5e3),l=!0});if(a&&a.then)return a.then(function(){})}}();return a&&a.then?a.then(u):u(a)}alert(p("Please select Blocking reason"))}();if(a&&a.then)return a.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==H||null===(o=H.data)||void 0===o?void 0:o.timeline,businessService:W,workflowDetails:H,moduleCode:z,blockReason:null==m||null===(r=m.BPA)||void 0===r?void 0:r.BlockReason}):null,T?l.createElement(El,{action:_,workflowDetails:H,businessService:W,isWarningPop:T,closeWarningPopup:()=>{I(!1)}}):null,l.createElement(cl,{t:p,showToast:P,closeToast:V,businessService:W}),s?l.createElement("div",null,l.createElement(t.SubmitBar,{style:{marginRight:20},label:p("BPA_EDIT_UPDATE"),onSubmit:function(e){try{return Promise.resolve(Digit.OBPSService.BPASearch(u,{applicationNo:null==B?void 0:B.applicationNo})).then(function(e){var t,n,l,a,i,o;const r=Digit.Utils.obps.calculateRiskType(null==O||null===(t=O.BPA)||void 0===t?void 0:t.RiskTypeComputation,null==N||null===(n=N.edcrDetails)||void 0===n||null===(l=n.planDetail)||void 0===l||null===(a=l.plot)||void 0===a?void 0:a.area,null==N||null===(i=N.edcrDetails)||void 0===i||null===(o=i.planDetail)||void 0===o?void 0:o.blocks),s={BPA:e.BPA[0]};s.BPA.riskType=r,s.BPA.workflow={action:"EDIT PAY 2",assignes:[],comments:null,varificationDocuments:null},s.BPA.additionalDetails.selfCertificationCharges.BPA_DEVELOPMENT_CHARGES=sessionStorage.getItem("development")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_OTHER_CHARGES=sessionStorage.getItem("otherCharges")||"0",s.BPA.additionalDetails.selfCertificationCharges.BPA_LESS_ADJUSMENT_PLOT=sessionStorage.getItem("lessAdjusment")||"0",s.BPA.additionalDetails.otherFeesDiscription=sessionStorage.getItem("otherChargesDisc"),s.BPA.additionalDetails.lessAdjustmentFeeFiles=JSON.parse(sessionStorage.getItem("uploadedFileLess"));const d=function(e,t,n,l,a,i,o,r,d,c,m,v){if(!(parseInt(sessionStorage.getItem("lessAdjusment"))>parseInt(sessionStorage.getItem("development"))+parseInt(sessionStorage.getItem("otherCharges"))+parseInt(null==s||null===(e=s.BPA)||void 0===e||null===(t=e.additionalDetails)||void 0===t||null===(n=t.selfCertificationCharges)||void 0===n?void 0:n.BPA_MALBA_CHARGES)+parseInt(null==s||null===(l=s.BPA)||void 0===l||null===(a=l.additionalDetails)||void 0===a||null===(i=a.selfCertificationCharges)||void 0===i?void 0:i.BPA_LABOUR_CESS)+parseInt(null==s||null===(o=s.BPA)||void 0===o||null===(r=o.additionalDetails)||void 0===r||null===(d=r.selfCertificationCharges)||void 0===d?void 0:d.BPA_WATER_CHARGES)+parseInt(null==s||null===(c=s.BPA)||void 0===c||null===(m=c.additionalDetails)||void 0===m||null===(v=m.selfCertificationCharges)||void 0===v?void 0:v.BPA_GAUSHALA_CHARGES_CESS)))return Promise.resolve(Digit.OBPSService.update(s,u)).then(function(e){window.location.assign(window.location.href.split("/editApplication")[0]+window.location.href.split("editApplication")[1])});alert(p("Enterd Less Adjustment amount is invalid"))}();if(d&&d.then)return d.then(function(){})})}catch(e){return Promise.reject(e)}},id:!0})):l.createElement(ml,{workflowDetails:H,displayMenu:g,onActionSelect:function(e){var t,n,l;if(e)if("EDIT PAY 2"==(null==e?void 0:e.action)&&window.location.href.includes("bpa")&&window.location.assign(window.location.href.split("bpa")[0]+"editApplication/bpa"+window.location.href.split("bpa")[1]),null!=e&&e.isToast)w({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(V,5e3);else if(null!=e&&e.isWarningPopUp)I(!0);else if(null!=e&&e.redirectionUrll){var a,i,o,r,s;if("ACTIVATE_CONNECTION"===(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.action))E.push(""+(null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.pathname),JSON.stringify({data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state,url:""+(null===(s=location)||void 0===s?void 0:s.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(i=e.redirectionUrll)||void 0===i?void 0:i.action)){var u,d;E.push(""+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname),{data:null==e||null===(d=e.redirectionUrll)||void 0===d?void 0:d.state})}else{var c;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(c=e.redirectionUrll)||void 0===c?void 0:c.pathname))}}else if(null!=e&&e.redirectionUrl||"EDIT PAY 2"==(null==e?void 0:e.action))if("DIRECTRENEWAL"===(null==e||null===(t=e.redirectionUrl)||void 0===t||null===(n=t.state)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.workflowCode))console.log("Got Inside Direct"),C(!0);else{var m,p;E.push({pathname:null===(m=e.redirectionUrl)||void 0===m?void 0:m.pathname,state:v({},null===(p=e.redirectionUrl)||void 0===p?void 0:p.state)})}else C(!0);y(e),S(!1)},setDisplayMenu:S,businessService:W,forcedActionPrefix:K,ActionBarStyle:Y,MenuStyle:$})))};var gl=l.memo(()=>{var e,t,o,r;const{t:s}=a.useTranslation(),u=(Digit.Hooks.useStore.getInitData(),Digit.ULBService.getCurrentTenantId()),{id:d}=i.useParams(),[c,m]=n.useState(null),[v,p]=n.useState({}),[E,f]=n.useState(!1),[g,S]=n.useState(!1),[_,h]=n.useState("asset-create"),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetApplicationDetail(s,u,d),{mutate:C}=Digit.Hooks.asset.useASSETApplicationAction(u);let D=Digit.Hooks.useWorkflowDetails({tenantId:(null==A||null===(e=A.applicationData)||void 0===e?void 0:e.tenantId)||u,id:null==A||null===(t=A.applicationData)||void 0===t||null===(o=t.applicationData)||void 0===o?void 0:o.applicationNo,moduleCode:_,role:["ASSET_INITIATOR","ASSET_VERIFIER","ASSET_APPROVER"]});return Digit.Hooks.asset.useASSETSearch({tenantId:u,filters:{applicationNo:d,audit:!0}}),n.useEffect(()=>{A&&p(j.cloneDeep(A))},[A]),n.useEffect(()=>{var e,t,n;null==D||null===(e=D.data)||void 0===e||!e.applicationBusinessService||"asset-create"===(null==D||null===(t=D.data)||void 0===t?void 0:t.applicationBusinessService)&&"asset-create"===_||h(null==D||null===(n=D.data)||void 0===n?void 0:n.applicationBusinessService)},[D.data]),s("AST_REPORT"),l.createElement("div",null,l.createElement(fl,{applicationDetails:null==v?void 0:v.applicationData,isLoading:y,isDataLoading:y,applicationData:null==v||null===(r=v.applicationData)||void 0===r?void 0:r.applicationData,mutate:C,workflowDetails:D,businessService:_,moduleCode:"ASSET",showToast:c,setShowToast:m,closeToast:()=>{m(null)},timelineStatusPrefix:"AST_STATUS_",forcedActionPrefix:"AST",statusAttribute:"state",MenuStyle:{color:"#FFFFFF",fontSize:"18px"}}))});const Sl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),_l=(e,t,n,l)=>Sl("LABEL",e,t,n,l),hl=e=>{var n,a,i,o,r,s,u,d,c,m,v,p,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,v=e.isSuccess,p=e.isEmployee,E=e.t,Sl("ACTION",m,v,p,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:_l((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},yl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"ASSIGN")+"_"+e+(n?"":"_ERROR")),Al=(e,t,n,l)=>yl("ACTION",e,t,n,l),Cl=(e,t,n,l)=>yl("LABEL",e,t,n,l),Dl=e=>{let{data:n,action:a,isSuccess:i,isEmployee:o,t:r}=e;return l.createElement(t.Banner,{message:Al((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),applicationNumber:null==n?void 0:n.disposalId,info:Cl((null==n?void 0:n.assetDisposalStatus)||a,i,o,r),successful:i})},bl=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"RETURN")+"_"+e+(n?"":"_ERROR")),Tl=(e,t,n,l)=>bl("LABEL",e,t,n,l),Il=e=>{var n,a,i,o,r,s,u,d,c,m,v,p,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,v=e.isSuccess,p=e.isEmployee,E=e.t,bl("ACTION",m,v,p,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:Tl((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},Ol=e=>l.createElement("span",{className:"cell-text"},e),Nl=e=>l.createElement("span",{className:"sla-cell"},e),Rl=[{body:[{component:"AssetAssign",withoutLabel:!0,key:"assigndetails",type:"component"}]}],xl=[{body:[{component:"AssetDispose",withoutLabel:!0,key:"disposeDetails",type:"component"}]}],Ll=function(e){return void 0===e&&(e=""),function(e){return void 0===e&&(e=""),!(!e||null==e||null==e||""==e)}(e)?e:"NA"},Pl=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},wl=e=>{const t=e.replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},Ml=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},Fl=[{body:[{component:"AssetMaintenance",withoutLabel:!0,key:"maintenanceDetails",type:"component"}]}];function Bl(e){var a,i;let{t:o,document:r,setDocuments:s,setError:u,documents:d,setFormError:c,clearFormErrors:m,config:p,formState:E,comingDataFromAPI:f,id:g}=e;const S=null==d?void 0:d.filter(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==r?void 0:r.code)})[0],[_,y]=n.useState(S?v({},S,{active:"ACTIVE"===(null==S?void 0:S.status),code:null==S?void 0:S.documentType}):1===(null==r||null===(a=r.dropdownData)||void 0===a?void 0:a.length)?null==r?void 0:r.dropdownData[0]:{}),[A,C]=n.useState(null),[D,b]=n.useState(()=>(null==S?void 0:S.fileStoreId)||null),[T,I]=n.useState(!1),O=()=>{var e,t;let n=null===(e=E.errors)||void 0===e||null===(t=e[p.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(null==r?void 0:r.code)&&(n=n.filter(e=>e!=(null==r?void 0:r.code)),n.length?c(p.key,{type:n}):m(p.key))};return n.useEffect(()=>{null!=_&&_.code&&s(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==_?void 0:_.code));return 0===(null==D?void 0:D.length)||null===D?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==D),{documentType:null==_?void 0:_.code,fileStoreId:D,documentUid:D}]}),T?T&&O():D&&null!=_&&_.code?D&&null!=_&&_.code&&O():(()=>{var e,t;let n=null===(e=E.errors)||void 0===e||null===(t=e[p.key])||void 0===t?void 0:t.type;Array.isArray(n)||(n=[]),n.includes(r.code)||(n.push(r.code),c(p.key,{type:n}))})()},[D,_,T]),n.useEffect(()=>{!function(){try{u(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)u(o("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=h(function(){return b(null),Promise.resolve(Digit.UploadServices.Filestorage("ASSET",A,Digit.ULBService.getStateId())).then(function(e){var t,n,l,a;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(a=l.files[0])||void 0===a?void 0:a.fileStoreId):u(o("CS_FILE_UPLOAD_ERROR"))})},function(){u(o("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),n.useEffect(()=>{T&&b(null)},[T]),l.createElement("div",{style:{marginBottom:"24px"}},null!=r&&r.hasDropdown?l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},o(null==r?void 0:r.code.replaceAll(".","_"))+" *")):null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"}),l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:function(e){C(e.target.files[0])},selectedDocument:null==f||null===(i=f[0])||void 0===i?void 0:i.fileStoreId,onDelete:()=>{b(null)},id:g,message:D?"1 "+o("CS_ACTION_FILEUPLOADED"):o("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!D}))))}let kl=[];const Ul=e=>{let{currentStep:n=1,flow:i=""}=e;const{t:o}=a.useTranslation(),r=window.Digit.Utils.browser.isMobile();return(e=>{switch(e){case"STAKEHOLDER":kl=[];break;default:kl=["ASSET_GENERAL_DETAILS","AST_DETAILS","AST_ADDRESS_DETAILS","AST_DOCUMENT_DETAILS","AST_SUMMARY"]}})(i),l.createElement("div",{className:"timeline-container",style:r?{}:{maxWidth:"960px",minWidth:"640px",marginRight:"auto",marginLeft:"auto",display:"flex",justifyContent:"center"}},kl.map((e,a,i)=>l.createElement("div",{className:"timeline-checkpoint",key:a},l.createElement("div",{className:"timeline-content"},l.createElement("span",{className:"circle "+(a<=n-1&&"active")},a<n-1?l.createElement(t.TickMark,null):a+1),l.createElement("span",{className:"secondary-color"},o(e))),a<i.length-1&&l.createElement("span",{className:"line "+(a<n-1&&"active")}))))},Hl=[{head:"ES_TITILE_OWNER_DETAILS",body:[{route:"info",component:"ServiceDoc",nextStep:"asset-deatils",key:"Documents"},{route:"asset-deatils",component:"NewAssetClassification",withoutLabel:!0,key:"asset",type:"component",nextStep:"assets",hideInEmployee:!0,isMandatory:!0,texts:{header:"ASSET_GENERAL_DETAILS",submitBarLabel:"COMMON_NEXT"}}]},{head:"TITLE_ASSET_DEATIL",body:[{route:"assets",component:"NewAsset",withoutLabel:!0,key:"assetDetails",type:"component",isMandatory:!0,hideInEmployee:!0,nextStep:"pincode",texts:{header:"AST_DETAILS",submitBarLabel:"COMMON_NEXT"}}]},{head:"AST_ADDRESS_DETAILS",body:[{route:"pincode",component:"AssetPincode",texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"COMMON_NEXT",skipText:"CORE_COMMON_SKIP_CONTINUE"},withoutLabel:!0,key:"address",nextStep:"address",type:"component"},{route:"address",component:"AssetAddress",withoutLabel:!0,texts:{header:"AST_ADDRESS_DETAILS",submitBarLabel:"COMMON_NEXT"},key:"address",nextStep:"documents",isMandatory:!0,type:"component"}]},{head:"ES_TITILE_DOCUMENT_DETAILS",body:[{route:"documents",component:"NewDocument",withoutLabel:!0,key:"documents",type:"component",nextStep:null,texts:{header:"AST_DOCUMENT_DETAILS",submitBarLabel:"COMMON_NEXT"}}]}];function jl(e){var a;let{t:i,document:o,setDocuments:r,setError:s,documents:u,formData:d,id:c}=e;const p=null==u?void 0:u.find(e=>{var t;return null==e||null===(t=e.documentType)||void 0===t?void 0:t.includes(null==o?void 0:o.code)}),[E,f]=n.useState(p?v({},p,{active:!0===(null==o?void 0:o.active),code:null==p?void 0:p.documentType}):1===(null==o||null===(a=o.dropdownData)||void 0===a?void 0:a.length)?null==o?void 0:o.dropdownData[0]:{}),[g,S]=n.useState(null),[_,h]=n.useState((null==p?void 0:p.fileStoreId)||null),[y,A]=n.useState((null==d?void 0:d.latitude)||null),[C,D]=n.useState((null==d?void 0:d.longitude)||null),b=e=>new Promise(t=>{m.getData(e,function(){const e=m.getTag(this,"GPSLatitude"),n=m.getTag(this,"GPSLongitude");if(e&&n){const l=T(e),a=T(n);t({latitude:l,longitude:a})}else t({latitude:null,longitude:null}),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&alert("Please upload a photo with location details")})}),T=e=>e[0]+e[1]/60+e[2]/3600;return n.useEffect(()=>{g&&(g.size>=5242880?s(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")):(h(null),Digit.UploadServices.Filestorage("ASSET",g,Digit.ULBService.getStateId()).then(e=>{var t,n;(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?h(e.data.files[0].fileStoreId):s(i("CS_FILE_UPLOAD_ERROR"))}).catch(()=>s(i("CS_FILE_UPLOAD_ERROR")))))},[g,i]),n.useEffect(()=>{null!=E&&E.code&&r(e=>{const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==E?void 0:E.code));return _?[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==_),{documentType:null==E?void 0:E.code,fileStoreId:_,documentUid:_,latitude:y,longitude:C}]:t})},[_,E,y,C,r]),l.createElement("div",{style:{marginBottom:"24px"}},(null==o?void 0:o.hasDropdown)&&l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},i(null==o?void 0:o.code.replaceAll(".","_"))+" *")),l.createElement(t.LabelFieldPair,null,l.createElement("div",{className:"field"},l.createElement(t.UploadFile,{onUpload:e=>{const t=e.target.files[0];S(t),b(t).then(e=>{let{latitude:t,longitude:n}=e;A(t),D(n),"OWNER.ASSETPHOTO"!==(null==o?void 0:o.code)||t&&n||s("Please upload a photo with location details")})},onDelete:()=>{h(null),A(null),D(null)},id:c,message:_?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},accept:".pdf, .jpeg, .jpg, .png",buttonType:"button",error:!_}))),"OWNER.ASSETPHOTO"===(null==o?void 0:o.code)&&y&&C&&l.createElement("div",{style:{marginTop:"10px",textAlign:"center"}},l.createElement("p",null,l.createElement("strong",null,i("Location Details"),":")),l.createElement("p",null,i("Latitude"),": ",y),l.createElement("p",null,i("Longitude"),": ",C)))}const Wl=e=>{let{jumpTo:n}=e;const{t:o}=a.useTranslation(),r=i.useHistory();return l.createElement(t.LinkButton,{label:o("CS_COMMON_CHANGE"),className:"check-page-link-button",onClick:function(){r.push(n)}})},Vl=e=>{const{t:t}=a.useTranslation();return e.isSuccess?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_SUCCESS"):t("ES_ASSET_RESPONSE_CREATE_ACTION"):e.isLoading?window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_PENDING"):t("CS_AST_APPLICATION_PENDING"):e.isSuccess?void 0:window.location.href.includes("edit-application")?t("CS_AST_UPDATE_APPLICATION_FAILED"):t("CS_AST_APPLICATION_FAILED")},zl={padding:"4px 0px",justifyContent:"space-between"},Gl=e=>{var n,a;return l.createElement(t.Banner,{message:Vl(e),applicationNumber:null===(n=e.data)||void 0===n||null===(a=n.Assets)||void 0===a?void 0:a[0].applicationNo,info:e.isSuccess?e.t("ES_ASSET_RESPONSE_CREATE_LABEL"):"",successful:e.isSuccess,style:{width:"100%"}})},Kl=e=>{var a,r,s,u,d,c,m,p,E;const{assigndetails:f,focusIndex:g,allAssets:S,setassigndetails:_,t:h,config:y,setError:A,clearErrors:C,formState:D,setFocusIndex:b,departNamefromMDMS:T,designationNamefromMDMS:I}=e,[O,N]=n.useState(null),{control:R,formState:x,watch:L,trigger:P}=o.useForm(),w=L(),{errors:M}=x,{id:F}=i.useParams(),B=Digit.ULBService.getCurrentTenantId(),{data:k}=Digit.Hooks.asset.useAssetApplicationDetail(h,B,F),[U,H]=l.useState({});n.useEffect(()=>{j.isEqual(U,w)||(H(v({},w)),_(e=>e.map(e=>e.key&&e.key===f.key?v({},e,w):v({},e))),P())},[w]),n.useEffect(()=>{var e;Object.keys(M).length&&!j.isEqual((null===(e=D.errors[y.key])||void 0===e?void 0:e.type)||{},M)?A(y.key,{type:M}):!Object.keys(M).length&&D.errors[y.key]&&C(y.key)},[M]);const W={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==S?void 0:S.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:h("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+h(Ll(null==k||null===(a=k.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:h("AST_DEPARTMENT_LABEL"),text:""+h(Ll("COMMON_MASTERS_DEPARTMENT_"+(null==k||null===(s=k.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.department)))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_ASSIGNED_USER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:R,name:"assignedUser",defaultValue:null==f?void 0:f.assignedUser,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==f?void 0:f.key)&&"assignedUser"===g.type,onChange:t=>{e.onChange(t.target.value),b({index:f.key,type:"assignedUser"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},x.touched.assignedUser?null==M||null===(d=M.assignedUser)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_EMP_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:R,name:"employeeCode",defaultValue:null==f?void 0:f.employeeCode,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:g.index===(null==f?void 0:f.key)&&"employeeCode"===g.type,onChange:t=>{e.onChange(t.target.value),b({index:f.key,type:"employeeCode"})},onBlur:t=>{b({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:W},x.touched.employeeCode?null==M||null===(c=M.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_DESIGNATION")),l.createElement(o.Controller,{control:R,name:"designation",defaultValue:null==f?void 0:f.designation,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:I,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:W},x.touched.designation?null==M||null===(m=M.designation)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_ALLOCATED_DEPARTMENT")),l.createElement(o.Controller,{control:R,name:"allocatedDepartment",defaultValue:null==f?void 0:f.allocatedDepartment,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:T,optionKey:"i18nKey",t:h})})),l.createElement(t.CardLabelError,{style:W},x.touched.allocatedDepartment?null==M||null===(p=M.allocatedDepartment)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},h("AST_TRANSFER_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:R,name:"transferDate",defaultValue:null==f?void 0:f.transferDate,rules:{required:h("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||h("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:W},x.touched.employeeCode?null==M||null===(E=M.employeeCode)||void 0===E?void 0:E.message:""))),(null==O?void 0:O.label)&&l.createElement(t.Toast,{label:null==O?void 0:O.label,onClose:e=>{N(e=>null)}}))},ql=e=>{var a,r,s,u,d,c,m,p,E,f,g,S,_,h;const{disposeDetails:y,focusIndex:A,allAssets:C,setdisposeDetails:D,t:b,config:T,setError:I,clearErrors:O,formState:N,setFocusIndex:R}=e,[x,L]=n.useState(null),[P,w]=n.useState(!1),[M,F]=n.useState(""),{control:B,formState:k,watch:U,setValue:H,trigger:W,register:V}=o.useForm(),z=U(),{errors:G}=k,{id:K}=i.useParams(),q=Digit.ULBService.getCurrentTenantId(),[Y,$]=l.useState({}),[Z,Q]=n.useState(null),[X,J]=n.useState(""),[ee,te]=n.useState(""),[ne,le]=n.useState({}),{data:ae}=Digit.Hooks.asset.useAssetApplicationDetail(b,q,K);n.useEffect(()=>{if(ae){var e,t,n,l,a,i;const o=function(e){const t=new Date(1e3*e),n=new Date;return Math.floor((n-t)/864e5)}(null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate);V("currentAgeOfAsset"),V("assetId"),V("lifeOfAsset"),H("currentAgeOfAsset",o),H("assetId",null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.id),H("lifeOfAsset",null==ae||null===(a=ae.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.lifeOfAsset)}},[ae]),n.useEffect(()=>{j.isEqual(Y,z)||($(v({},z)),D(e=>e.map(e=>e.key&&e.key===y.key?v({},e,z):v({},e))),W())},[z]),n.useEffect(()=>{var e;Object.keys(G).length&&!j.isEqual((null===(e=N.errors[T.key])||void 0===e?void 0:e.type)||{},G)?I(T.key,{type:G}):!Object.keys(G).length&&N.errors[T.key]&&O(T.key)},[G]);const ie={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},oe=()=>{w(!P)};n.useEffect(()=>{V("fileStoreId"),X&&H("fileStoreId",X)},[X,V,H]);const re=[{code:"End of Life",i18nKey:"END_OF_LIFE"},{code:"Obsolete(outdated)",i18nKey:"OBSOLETE(OUTDATED)"},{code:"Damaged",i18nKey:"DAMAGED"},{code:"Others",i18nKey:"OTHERS"}];n.useEffect(()=>{Z&&(Z.size>=5242880?(I(b("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED")),J(null)):(I(""),Digit.UploadServices.Filestorage("ASSET",Z,Digit.ULBService.getStateId()).then(e=>{var t,n;console.log("Upload Response:",e),(null==e||null===(t=e.data)||void 0===t||null===(n=t.files)||void 0===n?void 0:n.length)>0?J(e.data.files[0].fileStoreId):I(b("CS_FILE_UPLOAD_ERROR"))}).catch(()=>I(b("CS_FILE_UPLOAD_ERROR")))))},[Z,b]);const se=e=>{const t=e.target.files[0];if(t){if(t.size>5242880)return void te("File size should not exceed 5MB");Q(t),te("")}};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_NAME"),text:""+b(Ll(null==ae||null===(a=ae.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.assetName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_CURRENT_COST"),text:""+b(Ll(null==ae||null===(s=ae.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u?void 0:u.bookValue))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_LIFE"),text:""+b(Ll(null==ae||null===(d=ae.applicationData)||void 0===d||null===(c=d.applicationData)||void 0===c?void 0:c.lifeOfAsset))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_RESIDUAL_LIFE"),text:(()=>{var e,t,n,l;let a=null==ae||null===(e=ae.applicationData)||void 0===e||null===(t=e.applicationData)||void 0===t?void 0:t.purchaseDate,i=(null==ae||null===(n=ae.applicationData)||void 0===n||null===(l=n.applicationData)||void 0===l?void 0:l.lifeOfAsset)-(Date.now()-1e3*a)/315576e5;if(i<=0)return"0 years, 0 months, 0 days";let o=Math.floor(i),r=365.25*(i-o);return o+" years, "+Math.floor(r/30.44)+" months, "+Math.round(r%30.44)+" days"})()})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"disposalDate",defaultValue:null==y?void 0:y.disposalDate,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.employeeCode?null==G||null===(m=G.employeeCode)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_REASON_DISPOSAL")),l.createElement(o.Controller,{control:B,name:"reasonForDisposal",defaultValue:null==y?void 0:y.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:re,optionKey:"i18nKey",t:b})})),l.createElement(t.CardLabelError,{style:ie},k.touched.designation?null==G||null===(p=G.designation)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"comments",defaultValue:null==y?void 0:y.comments,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"comments"===A.type,onChange:t=>{e.onChange(t.target.value),R({index:y.key,type:"comments"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.assignedUser?null==G||null===(E=G.assignedUser)||void 0===E?void 0:E.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"amountReceived",defaultValue:null==y?void 0:y.amountReceived,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"amountReceived"===A.type,onChange:t=>{e.onChange(t.target.value),R({index:y.key,type:"amountReceived"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.employeeCode?null==G||null===(f=G.employeeCode)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:B,name:"isAssetDisposedInFacility",defaultValue:null==y?void 0:y.isAssetDisposedInFacility,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:b(" If disposed in facility, amount received will become zero"),onChange:oe,styles:{height:"auto"},value:e.value,checked:!P})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.employeeCode?null==G||null===(g=G.employeeCode)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_DISPOSE_RECIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onUpload:se,onDelete:()=>{Q(null),e.onChange(null)},message:Z?"1 "+b("CS_ACTION_FILEUPLOADED"):b("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:ee||!Z})}))),P&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"purchaserName",defaultValue:null==y?void 0:y.purchaserName,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"purchaserName"===A.type,onChange:t=>{e.onChange(t.target.value),R({index:y.key,type:"purchaserName"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.employeeCode?null==G||null===(S=G.employeeCode)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"paymentMode",defaultValue:null==y?void 0:y.paymentMode,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"paymentMode"===A.type,onChange:t=>{e.onChange(t.target.value),R({index:y.key,type:"paymentMode"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.employeeCode?null==G||null===(_=G.employeeCode)||void 0===_?void 0:_.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:B,name:"receiptNumber",defaultValue:null==y?void 0:y.receiptNumber,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:A.index===(null==y?void 0:y.key)&&"receiptNumber"===A.type,onChange:t=>{e.onChange(t.target.value),R({index:y.key,type:"receiptNumber"})},onBlur:t=>{R({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:ie},k.touched.employeeCode?null==G||null===(h=G.employeeCode)||void 0===h?void 0:h.message:"")))),(null==x?void 0:x.label)&&l.createElement(t.Toast,{label:null==x?void 0:x.label,onClose:e=>{L(e=>null)}}))},Yl=e=>{var a,r,s,u,d,c,m,v,p;const{maintenanceDetails:E,focusIndex:f,t:g,config:S,setError:_,clearErrors:h,formState:y,setFocusIndex:A}=e,[C,D]=n.useState(null),[b,T]=n.useState(!1),[I,O]=n.useState(""),{control:N,formState:R,watch:x}=o.useForm(),{errors:L}=(x(),R),{id:P}=i.useParams(),w=Digit.ULBService.getCurrentTenantId(),[M,F]=l.useState({}),[B,k]=n.useState(null),[U,H]=n.useState(""),[W,V]=n.useState(""),[z,G]=n.useState({});Digit.Hooks.asset.useAssetApplicationDetail(g,w,P),n.useEffect(()=>{var e;Object.keys(L).length&&!j.isEqual((null===(e=y.errors[S.key])||void 0===e?void 0:e.type)||{},L)?_(S.key,{type:L}):!Object.keys(L).length&&y.errors[S.key]&&h(S.key)},[L]);const K={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"},q=[{code:"AMC",i18nKey:"AST_AMC"},{code:"CMC",i18nKey:"AST_CMC"},{code:"OTHER",i18nKey:"AST_OTHER"}];return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"disposalDate",defaultValue:null==E?void 0:E.disposalDate,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(a=L.employeeCode)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_TYPE_OF_SERVICE")),l.createElement(o.Controller,{control:N,name:"reasonForDisposal",defaultValue:null==E?void 0:E.reasonForDisposal,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:q,optionKey:"i18nKey",t:g})})),l.createElement(t.CardLabelError,{style:K},R.touched.designation?null==L||null===(r=L.designation)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_ADD_COMMENTS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"comments",defaultValue:null==E?void 0:E.comments,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z\s]*$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{type:"textarea",value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"comments"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"comments"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.assignedUser?null==L||null===(s=L.assignedUser)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_AMOUNT_RECEIVED_DISPOSAL")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"amountReceived",defaultValue:null==E?void 0:E.amountReceived,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"amountReceived"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"amountReceived"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(u=L.employeeCode)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field",style:{marginTop:"20px",marginBottom:"20px"}},l.createElement(o.Controller,{control:N,name:"isAssetDisposedInFacility",defaultValue:null==E?void 0:E.isAssetDisposedInFacility,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.CheckBox,{label:g(" If disposed in facility, amount received will become zero"),styles:{height:"auto"},value:e.value,checked:!b})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(d=L.employeeCode)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_SERVICE_UNDER_WARRANTY")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"disposalFile",render:e=>l.createElement(t.UploadFile,{id:"disposalFile",onDelete:()=>{k(null),e.onChange(null)},message:B?"1 "+g("CS_ACTION_FILEUPLOADED"):g("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",buttonType:"button",error:W||!B})}))),b&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_PURCHASER_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"purchaserName",defaultValue:null==E?void 0:E.purchaserName,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"purchaserName"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"purchaserName"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(c=L.employeeCode)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_PAYMENT_MODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"paymentMode",defaultValue:null==E?void 0:E.paymentMode,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"paymentMode"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"paymentMode"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(m=L.employeeCode)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_RECEIPT")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"receiptNumber",defaultValue:null==E?void 0:E.receiptNumber,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"receiptNumber"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"receiptNumber"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(v=L.employeeCode)||void 0===v?void 0:v.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},g("AST_DISPOSAL_CODE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:N,name:"employeeCode",defaultValue:null==E?void 0:E.employeeCode,rules:{required:g("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z0-9\s\-/]+$/.test(e)||g("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,autoFocus:f.index===(null==E?void 0:E.key)&&"employeeCode"===f.type,onChange:t=>{e.onChange(t.target.value),A({index:E.key,type:"employeeCode"})},onBlur:t=>{A({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:K},R.touched.employeeCode?null==L||null===(p=L.employeeCode)||void 0===p?void 0:p.message:"")))),(null==C?void 0:C.label)&&l.createElement(t.Toast,{label:null==C?void 0:C.label,onClose:e=>{D(e=>null)}}))},$l=[{body:[{component:"ReturnAssignedAsset",withoutLabel:!0,key:"returndetails",type:"component"}]}],Zl=e=>{var a,r,s,u,d,c,m,p,E,f,g,S,_,h,y;const{returndetails:A,allAssets:C,setreturndetails:D,t:b,config:T,setError:I,clearErrors:O,formState:N}=e,[R,x]=n.useState(null),{control:L,formState:P,watch:w,trigger:M}=o.useForm(),F=w(),{errors:B}=P,{id:k}=i.useParams(),U=Digit.ULBService.getCurrentTenantId(),{data:H}=Digit.Hooks.asset.useAssetApplicationDetail(b,U,k),[W,V]=l.useState({});return n.useEffect(()=>{j.isEqual(W,F)||(V(v({},F)),D(e=>e.map(e=>e.key&&e.key===A.key?v({},e,F):v({},e))),M())},[F]),n.useEffect(()=>{var e;Object.keys(B).length&&!j.isEqual((null===(e=N.errors[T.key])||void 0===e?void 0:e.type)||{},B)?I(T.key,{type:B}):!Object.keys(B).length&&N.errors[T.key]&&O(T.key)},[B]),l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},(null==C?void 0:C.length)>2?l.createElement("div",{style:{marginBottom:"16px",padding:"5px",cursor:"pointer",textAlign:"right"}},"X"):null,l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("ES_ASSET_RESPONSE_CREATE_LABEL"),text:""+b(Ll(null==H||null===(a=H.applicationData)||void 0===a||null===(r=a.applicationData)||void 0===r?void 0:r.applicationNo))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_ASSIGNED_USER"),text:""+b(Ll(null==H||null===(s=H.applicationData)||void 0===s||null===(u=s.applicationData)||void 0===u||null===(d=u.assetAssignment)||void 0===d?void 0:d.assignedUserName))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_ASSIGNED_DATE"),text:""+b(Ll((z=null==H||null===(c=H.applicationData)||void 0===c||null===(m=c.applicationData)||void 0===m||null===(p=m.assetAssignment)||void 0===p?void 0:p.assignedDate,z?new Date(z).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}).replace(/\//g,"/"):"")))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_DESIGNATION"),text:""+b(Ll(null==H||null===(E=H.applicationData)||void 0===E||null===(f=E.applicationData)||void 0===f||null===(g=f.assetAssignment)||void 0===g?void 0:g.designation))})),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:b("AST_EMP_CODE"),text:""+b(Ll(null==H||null===(S=H.applicationData)||void 0===S||null===(_=S.applicationData)||void 0===_||null===(h=_.assetAssignment)||void 0===h?void 0:h.employeeCode))})),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},b("AST_RETURN_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:L,name:"returnDate",defaultValue:null==A?void 0:A.returnDate,rules:{required:b("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||b("ERR_DEFAULT_INPUT_FIELD_MSG")},render:e=>l.createElement(t.TextInput,{type:"date",value:e.value,onChange:t=>{e.onChange(t.target.value)},max:(new Date).toISOString().split("T")[0]})}))),l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},P.touched.employeeCode?null==B||null===(y=B.employeeCode)||void 0===y?void 0:y.message:""))),(null==R?void 0:R.label)&&l.createElement(t.Toast,{label:null==R?void 0:R.label,onClose:e=>{x(e=>null)}}));var z},Ql=[{head:"ASSET_GENERAL_DETAILS",body:[{component:"EditGeneralDetails",withoutLabel:!0,key:"editAssignDetails",type:"component"}]},{head:"AST_DETAILS",body:[{component:"EditAssetDetails",withoutLabel:!0,key:"editNewAssetDetails",type:"component"}]}],Xl=e=>{const t=new Date(1e3*e);return t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")},Jl=e=>{var a,i,r,s,u,d,c,m,p,E,f,g,S,_;const{editAssignDetails:h,focusIndex:y,seteditAssignDetails:A,t:C,config:D,setError:b,clearErrors:T,setFocusIndex:I,menu_Asset:O,asset_type:N,asset_sub_type:R,asset_parent_sub_category:x,departNamefromMDMS:L,financal:P,sourcefinance:w,assetType:M,comingDataFromAPI:F,assetCurrentUsage:B,modeOfAcquisition:k}=e,[U,H]=n.useState(null),{control:W,formState:V,watch:z,trigger:G}=o.useForm(),K=z(),{errors:q}=V,[Y,$]=l.useState({}),Z=e=>e?{i18nKey:e,code:e,value:e}:null;n.useEffect(()=>{j.isEqual(Y,K)||($(v({},K)),A(e=>e.map(e=>e.key===h.key?v({},e,K):e)),G())},[K]),n.useEffect(()=>{var e;Object.keys(q).length&&!j.isEqual((null===(e=V.errors[D.key])||void 0===e?void 0:e.type)||{},q)?b(D.key,{type:q}):!Object.keys(q).length&&V.errors[D.key]&&T(D.key)},[q]);const Q={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_FINANCIAL_YEAR")),l.createElement(o.Controller,{control:W,name:"financialYear",defaultValue:Z(null==F?void 0:F.financialYear),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:P,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.financialYear?null==q||null===(a=q.financialYear)||void 0===a?void 0:a.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SOURCE_FINANCE")),l.createElement(o.Controller,{control:W,name:"sourceOfFinance",defaultValue:Z(null==F?void 0:F.sourceOfFinance),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,option:w,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.sourceOfFinance?null==q||null===(i=q.sourceOfFinance)||void 0===i?void 0:i.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetclassification",defaultValue:Z(null==F?void 0:F.assetClassification),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:O,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetclassification?null==q||null===(r=q.assetclassification)||void 0===r?void 0:r.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assettype",defaultValue:Z(null==F?void 0:F.assetParentCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!0,option:N,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assettype?null==q||null===(s=q.assettype)||void 0===s?void 0:s.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetsubtype",defaultValue:Z(null==F?void 0:F.assetCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:R,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetsubtype?null==q||null===(u=q.assetsubtype)||void 0===u?void 0:u.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:W,name:"assetparentsubCategory",defaultValue:Z(null==F?void 0:F.assetSubCategory),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:x,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetparentsubCategory?null==q||null===(d=q.assetparentsubCategory)||void 0===d?void 0:d.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_REF_SERIAL_NUM")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"BookPagereference",defaultValue:null==F?void 0:F.assetBookRefNo,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>!!/^[a-zA-Z0-9/-\s]*$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"BookPagereference"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"BookPagereference"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.BookPagereference?null==q||null===(c=q.BookPagereference)||void 0===c?void 0:c.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_NAME")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"AssetName",defaultValue:null==F?void 0:F.assetName,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"AssetName"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"AssetName"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.AssetName?null==q||null===(m=q.AssetName)||void 0===m?void 0:m.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("ASSET_DESCRIPTION")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"Assetdescription",defaultValue:null==F?void 0:F.description,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextArea,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"Assetdescription"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"Assetdescription"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.Assetdescription?null==q||null===(p=q.Assetdescription)||void 0===p?void 0:p.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_DEPARTMENT")),l.createElement(o.Controller,{control:W,name:"Department",defaultValue:Z("COMMON_MASTERS_DEPARTMENT_"+(null==F?void 0:F.department)),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:!1,select:e.onChange,onBlur:e.onBlur,option:L,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.Department?null==q||null===(E=q.Department)||void 0===E?void 0:E.message:""),l.createElement("br",null),l.createElement(t.CardCaption,null,"Asset Common Details "),l.createElement("br",null),l.createElement("br",null),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_TYPE")),l.createElement(o.Controller,{control:W,name:"assetType",defaultValue:Z(null==F?void 0:F.assetType),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:M,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetType?null==q||null===(f=q.assetType)||void 0===f?void 0:f.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_USAGE")),l.createElement(o.Controller,{control:W,name:"assetUsage",defaultValue:Z(null==F?void 0:F.assetUsage),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,onBlur:e.onBlur,disable:!1,option:B,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.assetUsage?null==q||null===(g=q.assetUsage)||void 0===g?void 0:g.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_MODE_OF_POSSESSION_OR_ACQUISITION")),l.createElement(o.Controller,{control:W,name:"modeOfPossessionOrAcquisition",defaultValue:Z(null==F?void 0:F.modeOfPossessionOrAcquisition),render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,select:e.onChange,disable:!1,onBlur:e.onBlur,option:k,optionKey:"i18nKey",t:C})})),l.createElement(t.CardLabelError,{style:Q},V.touched.modeOfPossessionOrAcquisition?null==q||null===(S=q.modeOfPossessionOrAcquisition)||void 0===S?void 0:S.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"invoiceDate",defaultValue:Xl(null==F?void 0:F.invoiceDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"invoiceDate"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"invoiceDate"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.CardLabelError,{style:Q},V.touched.Assetdescription?null==q||null===(_=q.Assetdescription)||void 0===_?void 0:_.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_INVOICE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"invoiceNumber",defaultValue:null==F?void 0:F.invoiceNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"invoiceNumber"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"invoiceNumber"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_DATE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseDate",defaultValue:Xl(null==F?void 0:F.purchaseDate),rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,type:"date",disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"purchaseDate"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"purchaseDate"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_ORDER")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseOrderNumber",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"purchaseOrderNumber"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"purchaseOrderNumber"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LIFE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"lifeOfAsset",defaultValue:null==F?void 0:F.purchaseOrderNumber,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"lifeOfAsset"===y.type,onChange:t=>{if(t.target.value.length>3)return alert("Maximum limit is 3 digits only!"),!1;e.onChange(t.target.value),I({index:h.key,type:"lifeOfAsset"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_LOCATION_DETAILS")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"location",defaultValue:null==F?void 0:F.location,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"location"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"location"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_PURCHASE_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"purchaseCost",defaultValue:null==F?void 0:F.purchaseCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"purchaseCost"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"purchaseCost"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_ACQUISITION_COST")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"acquisitionCost",defaultValue:null==F?void 0:F.acquisitionCost,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"acquisitionCost"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"acquisitionCost"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},C("AST_BOOK_VALUE")),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:W,name:"bookValue",defaultValue:null==F?void 0:F.bookValue,rules:{required:C("CORE_COMMON_REQUIRED_ERRMSG"),validate:{pattern:e=>/^[a-zA-Z\s\-/]+$/.test(e)||C("ERR_DEFAULT_INPUT_FIELD_MSG")}},render:e=>l.createElement(t.TextInput,{value:e.value,disable:!1,autoFocus:y.index===(null==h?void 0:h.key)&&"bookValue"===y.type,onChange:t=>{e.onChange(t.target.value),I({index:h.key,type:"bookValue"})},onBlur:t=>{I({index:-1}),e.onBlur(t)}})}))))),(null==U?void 0:U.label)&&l.createElement(t.Toast,{label:null==U?void 0:U.label,onClose:e=>{H(e=>null)}}))},ea=e=>{var a;const{editNewAssetDetails:i,focusIndex:r,seteditAssignDetails:s,t:u,config:d,setError:c,clearErrors:m,setFocusIndex:p,comingDataFromAPI:E}=e;let f=[];const g=Digit.ULBService.getStateId(),S=Digit.ULBService.getCurrentTenantId(),_=Digit.Hooks.useCustomMDMSV2(S,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),h=Digit.Hooks.useCustomMDMSV2(g,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});let y;y=_||h||[],Array.isArray(null===(a=y)||void 0===a?void 0:a.data)&&y.data.length>0?f=y.data.filter(e=>e.assetParentCategory===(null==E?void 0:E.assetParentCategory)||"COMMON"===e.assetParentCategory).map(e=>e.fields).flat().filter(e=>!0===e.active):console.log("combinedData.data is not an array or is empty.");const[A,C]=n.useState(null),{control:D,formState:b,watch:T,trigger:I}=o.useForm(),O=T(),{errors:N}=b,[R,x]=l.useState({});n.useEffect(()=>{j.isEqual(R,O)||(x(v({},O)),s(e=>e.map(e=>e.key===i.key?v({},e,O):e)),I())},[O]),n.useEffect(()=>{var e;Object.keys(N).length&&!j.isEqual((null===(e=b.errors[d.key])||void 0===e?void 0:e.type)||{},N)?c(d.key,{type:N}):!Object.keys(N).length&&b.errors[d.key]&&m(d.key)},[N]);const L={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginBottom:"16px"}},l.createElement("div",{style:{border:"1px solid #E3E3E3",padding:"16px",marginTop:"8px"}},l.createElement(l.Fragment,null,f.map((e,n)=>{var a,s,d,c;return l.createElement("div",{key:n},"date"===e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:"date",max:(new Date).toISOString().split("T")[0],autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),p({index:i.key,type:e.name})},onBlur:e=>{p({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(a=N[e.name])||void 0===a?void 0:a.message:"")):"dropdown"==e.type?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:n.value,select:n.onChange,onBlur:n.onBlur,option:e.options,optionKey:"i18nKey",t:u})})),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(s=N[e.name])||void 0===s?void 0:s.message:"")):!0===e.addCurrentLocationButton?l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:(null==E?void 0:E.additionalDetails[e.name])||"",rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),p({index:i.key,type:e.name})},onBlur:e=>{p({index:-1}),n.onBlur(e)},onClick:()=>{var t;t=e.name,"geolocation"in navigator?navigator.geolocation.getCurrentPosition(e=>{const{latitude:n,longitude:l}=e.coords;setAssetDetails(e=>v({},e,{[t]:n+", "+l}))},e=>{console.error("Error getting location:",e)}):alert("Geolocation is not supported by your browser.")}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(d=N[e.name])||void 0===d?void 0:d.message:"")):l.createElement("div",{key:n},l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},u(e.code)),l.createElement("div",{className:"field"},l.createElement(o.Controller,{control:D,name:e.name,defaultValue:null==E?void 0:E.additionalDetails[e.name],rules:{required:u("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||u("ERR_DEFAULT_INPUT_FIELD_MSG")},render:n=>l.createElement(t.TextInput,{value:n.value,type:e.type,autoFocus:r.index===(null==i?void 0:i.key)&&r.type===e.name,onChange:t=>{n.onChange(t.target.value),p({index:i.key,type:e.name})},onBlur:e=>{p({index:-1}),n.onBlur(e)}})}))),l.createElement(t.CardLabelError,{style:L},b.touched[e.name]?null===(c=N[e.name])||void 0===c?void 0:c.message:"")))})))),(null==A?void 0:A.label)&&l.createElement(t.Toast,{label:null==A?void 0:A.label,onClose:e=>{C(e=>null)}}))},ta=(e,t,n,l,a)=>a((l?"E":"C")+"S_ASSET_RESPONSE_"+(t||"EDIT")+"_"+e+(n?"":"_ERROR")),na=(e,t,n,l)=>ta("LABEL",e,t,n,l),la=e=>{var n,a,i,o,r,s,u,d,c,m,v,p,E;return l.createElement(t.Banner,{message:(m=(null==e||null===(n=e.data)||void 0===n||null===(a=n.Asset)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.applicationStatus)||e.action,v=e.isSuccess,p=e.isEmployee,E=e.t,ta("ACTION",m,v,p,E)),applicationNumber:null==e||null===(o=e.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo,info:na((null===(u=e.data)||void 0===u||null===(d=u.Assets)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.applicationStatus)||e.action,e.isSuccess,e.isEmployee,e.t),successful:e.isSuccess})},aa={AssignAssetApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d),[m,p,E]=Digit.Hooks.useSessionStorage("store-data",null),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,h,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),y()},[]);const A=Rl;return l.createElement(t.FormComposer,{heading:o("AST_ASSIGN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>v({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,v,p,E,f,g,S,_,h,y,A;const C=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.assigndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.transferDate),D={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:"",assetApplicaltionNo:"",assetId:"",assignedUserName:null==t||null===(s=t.assigndetails)||void 0===s||null===(d=s[0])||void 0===d?void 0:d.assignedUser,designation:null==t||null===(m=t.assigndetails)||void 0===m||null===(v=m[0])||void 0===v||null===(p=v.designation)||void 0===p?void 0:p.code,department:null==t||null===(E=t.assigndetails)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.allocatedDepartment)||void 0===g?void 0:g.code,assignedDate:C,isAssigned:!0,allocatedDepartment:null==t||null===(S=t.assigndetails)||void 0===S||null===(_=S[0])||void 0===_||null===(h=_.allocatedDepartment)||void 0===h?void 0:h.code,employeeCode:null==t||null===(y=t.assigndetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.employeeCode,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/assign-response",{Assets:D})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},DisposeApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[o,r]=n.useState(),{t:s}=a.useTranslation(),[u,d]=n.useState(!1),c=i.useHistory(),{id:m}=i.useParams(),[p,E,f]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,m),Digit.Hooks.useSessionStorage("store-data",null)),[g,S,_]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),D=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{S(!1),C()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const b=xl;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_DISPOSE_ASSET"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:b.map(e=>v({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,i,o,u,d,m,v,p,E,f,g,S,_,y,A,C,b,T,I,O,N,R,x,L,P;const w={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(o=t.disposeDetails)||void 0===o||null===(u=o[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(d=t.disposeDetails)||void 0===d||null===(m=d[0])||void 0===m?void 0:m.currentAgeOfAsset,disposalDate:D(null==t||null===(v=t.disposeDetails)||void 0===v||null===(p=v[0])||void 0===p?void 0:p.disposalDate),reasonForDisposal:null==t||null===(E=t.disposeDetails)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.reasonForDisposal)||void 0===g?void 0:g.code,amountReceived:wl(null==t||null===(S=t.disposeDetails)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.amountReceived),purchaserName:null==t||null===(y=t.disposeDetails)||void 0===y||null===(A=y[0])||void 0===A?void 0:A.purchaserName,paymentMode:null==t||null===(C=t.disposeDetails)||void 0===C||null===(b=C[0])||void 0===b?void 0:b.paymentMode,receiptNumber:null==t||null===(T=t.disposeDetails)||void 0===T||null===(I=T[0])||void 0===I?void 0:I.receiptNumber,comments:null==t||null===(O=t.disposeDetails)||void 0===O||null===(N=O[0])||void 0===N?void 0:N.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"OWNER.RECIEPTPHOTO",fileStoreId:null==t||null===(R=t.disposeDetails)||void 0===R||null===(x=R[0])||void 0===x?void 0:x.fileStoreId,documentUid:null==t||null===(L=t.disposeDetails)||void 0===L||null===(P=L[0])||void 0===P?void 0:P.fileStoreId,latitude:null,longitude:null}]},M=h(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:w})).then(function(e){e&&(console.log("success data is coming"),c.replace("/digit-ui/employee/asset/assetservice/asset-dispose-response",{AssetDisposal:e}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(M&&M.then?M.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{d(!0)}}),o&&l.createElement(t.Toast,{error:o.error,warning:o.warning,label:s(o.label),onClose:()=>{r(null)}}))},MaintenanceApplication:()=>{const e=Digit.ULBService.getCurrentTenantId(),[o,r]=n.useState(),{t:s}=a.useTranslation(),[u,d]=n.useState(!1),{id:c}=(i.useHistory(),i.useParams()),[m,p,E]=(Digit.Hooks.asset.useAssetApplicationDetail(s,e,c),Digit.Hooks.useSessionStorage("store-data",null)),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,y,A]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{}),C=e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()};n.useEffect(()=>{g(!1),A()},[]),n.useEffect(()=>{if(o){const e=setTimeout(()=>{r(null)},2e3);return()=>clearTimeout(e)}},[o]);const D=Fl;return l.createElement("div",null,l.createElement(t.FormComposer,{heading:s("AST_MAINTENANCET_REPAIR"),isDisabled:!u,label:s("ES_COMMON_APPLICATION_SUBMIT"),config:D.map(e=>v({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:function(t){try{var n,l,a,i,o,u,d,c,m,v,p,E,f,g,S,_,y,A,D,b,T,I,O,N,R,x,L;const P={disposalId:"",assetId:null==t||null===(n=t.disposeDetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.assetId,tenantId:e,lifeOfAsset:null==t||null===(a=t.disposeDetails)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.lifeOfAsset,isAssetDisposedInFacility:null==t||null===(o=t.disposeDetails)||void 0===o||null===(u=o[0])||void 0===u?void 0:u.isAssetDisposedInFacility,currentAgeOfAsset:null==t||null===(d=t.disposeDetails)||void 0===d||null===(c=d[0])||void 0===c?void 0:c.currentAgeOfAsset,disposalDate:C(null==t||null===(m=t.disposeDetails)||void 0===m||null===(v=m[0])||void 0===v?void 0:v.disposalDate),reasonForDisposal:null==t||null===(p=t.disposeDetails)||void 0===p||null===(E=p[0])||void 0===E||null===(f=E.reasonForDisposal)||void 0===f?void 0:f.code,amountReceived:wl(null==t||null===(g=t.disposeDetails)||void 0===g||null===(S=g[0])||void 0===S?void 0:S.amountReceived),purchaserName:null==t||null===(_=t.disposeDetails)||void 0===_||null===(y=_[0])||void 0===y?void 0:y.purchaserName,paymentMode:null==t||null===(A=t.disposeDetails)||void 0===A||null===(D=A[0])||void 0===D?void 0:D.paymentMode,receiptNumber:null==t||null===(b=t.disposeDetails)||void 0===b||null===(T=b[0])||void 0===T?void 0:T.receiptNumber,comments:null==t||null===(I=t.disposeDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.comments,glCode:"111111",assetDisposalStatus:"DISPOSED",additionalDetails:{approvalNumber:"APPROVAL202501",disposedBy:"Jane Smith"},auditDetail:{createdBy:"admin",createdTime:16725312e5,lastModifiedBy:"admin",lastModifiedTime:16725348e5},documents:[{documentType:"OWNER.RECIEPTPHOTO",fileStoreId:null==t||null===(N=t.disposeDetails)||void 0===N||null===(R=N[0])||void 0===R?void 0:R.fileStoreId,documentUid:null==t||null===(x=t.disposeDetails)||void 0===x||null===(L=x[0])||void 0===L?void 0:L.fileStoreId,latitude:null,longitude:null}]},w=h(function(){return Promise.resolve(Digit.ASSETService.assetDisposedCreate({AssetDisposal:P})).then(function(e){e&&(console.log("success data is coming"),r({error:!1,label:"Asset Dispose Successfully"}))})},function(){r({error:!0,label:s("CS_SOMETHING_WENT_WRONG")})});return Promise.resolve(w&&w.then?w.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:{},onFormValueChange:(e,t,n)=>{d(!0)}}),o&&l.createElement(t.Toast,{error:o.error,warning:o.warning,label:s(o.label),onClose:()=>{r(null)}}))},AssetDocuments:e=>{var a,o;let{t:r,config:s,onSelect:u,formData:d,setError:c,clearErrors:m,formState:p}=e;const E=Digit.ULBService.getStateId(),[f,g]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[S,_]=n.useState(null),{id:h}=i.useParams(),y=Digit.ULBService.getCurrentTenantId(),{isLoading:A,data:C}=(Digit.Hooks.asset.useAssetApplicationDetail(r,y,h),i.useLocation(),Digit.Hooks.asset.useAssetDocumentsMDMS(E,"ASSET","Documents")),D=null==C||null===(o=C.ASSET)||void 0===o?void 0:o.Documents.map(e=>v({},e,{hasDropdown:!0}));return n.useEffect(()=>{u(s.key,{documents:f,AssetsDocumentLength:null==D?void 0:D.length})},[f]),A?l.createElement(t.Loader,null):l.createElement("div",null,null==D?void 0:D.map((e,t)=>l.createElement(Bl,{key:t,document:e,action:"create",t:r,id:"document-"+t,error:S,setError:_,setDocuments:g,accept:".pdf, .jpeg, .jpg, .png",documents:f,formData:d,setFormError:c,clearFormErrors:m,config:s,formState:p})),S&&l.createElement(t.Toast,{label:S,onClose:()=>_(null),error:!0}))},AssetPincode:e=>{var a;let{t:o,config:r,onSelect:s,formData:u={},userType:d}=e;const c=Digit.Hooks.asset.useTenants(),{pathname:m}=i.useLocation(),p=m.includes("modify"),[E,f]=n.useState(()=>{var e,t,n;return p&&"employee"===d?(null==u||null===(e=u.originalData)||void 0===e||null===(t=e.address)||void 0===t?void 0:t.pincode)||"":(null==u||null===(n=u.address)||void 0===n?void 0:n.pincode)||""}),g=[{label:"AST_PINCODE",type:"text",name:"pincode",validation:{minlength:6,maxlength:7,pattern:"[0-9]+",max:"9999999",title:o("PTR_ADDRESS_PINCODE_INVALID")},style:{width:"50%"}}],[S,_]=n.useState(null),[h,y]=n.useState("");function A(e){f(e.target.value),_(null),y("");let t=Digit.Utils.getPattern("Pincode").test(e.target.value);"employee"===d&&(e.target.value&&!t&&y(o("ERR_DEFAULT_INPUT_FIELD_MSG")),t&&((null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t.toString()===e.target.value)}))||y(o("PTR_COMMON_PINCODE_NOT_SERVICABLE"))),s(r.key,v({},u.address,{pincode:e.target.value})))}return n.useEffect(()=>{var e;null!=u&&null!==(e=u.address)&&void 0!==e&&e.pincode&&f(u.address.pincode)},[null==u||null===(a=u.address)||void 0===a?void 0:a.pincode]),"employee"===d?null==g?void 0:g.map((e,n)=>l.createElement(l.Fragment,null,l.createElement(t.LabelFieldPair,{key:n},l.createElement(t.CardLabel,{className:"card-label-smaller"},o(e.label)),l.createElement("div",{className:"field"},l.createElement(t.TextInput,v({key:e.name,style:e.style,value:E,onChange:A},e.validation,{disable:p,autoFocus:p})))),h?l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},h):null)):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Ul,{currentStep:3}):null,l.createElement(t.FormStep,{t:o,config:v({},r,{inputs:g}),onSelect:function(e){try{return(null==c?void 0:c.find(t=>{var n;return null===(n=t.pincode)||void 0===n?void 0:n.find(t=>t==(null==e?void 0:e.pincode))}))?s(r.key,{pincode:E}):_("COMMON_PINCODE_NOT_SERVICABLE"),Promise.resolve()}catch(e){return Promise.reject(e)}},_defaultValues:{pincode:E},onChange:A,onSkip:()=>s(),forcedError:o(S)}))},AssetAddress:e=>{var a;let{t:r,config:s,onSelect:u,userType:d,formData:c}=e;const m=Digit.Hooks.asset.useTenants();let p=Digit.ULBService.getCurrentTenantId();const E=Digit.UserService.getUser().info,{pathname:f}=i.useLocation(),g=f.includes("modify");let S=(null==c?void 0:c.isEditAddress)||!1;g&&(S=!0);const{pincode:_}=(null==c?void 0:c.address)||"",h="EMPLOYEE"===E.type?m.filter(e=>e.code===p):_?m.filter(e=>{var t;return null==e||null===(t=e.pincode)||void 0===t?void 0:t.some(e=>e==_)}):m,[y,A]=n.useState(()=>{var e;return(null==c||null===(e=c.address)||void 0===e?void 0:e.city)||null}),{data:C}=Digit.Hooks.useBoundaryLocalities(null==y?void 0:y.code,"revenue",{enabled:!!y},r),[D,b]=n.useState(),[T,I]=n.useState();n.useEffect(()=>{if("employee"===d&&g&&null!=D&&D.length){var e,t,n;const l=null==c||null===(e=c.originalData)||void 0===e||null===(t=e.address)||void 0===t||null===(n=t.locality)||void 0===n?void 0:n.code,a=null==D?void 0:D.filter(e=>e.code===l)[0];x("locality",a)}},[D]),n.useEffect(()=>{h&&1===h.length&&A(h[0])},[h]),n.useEffect(()=>{if(y&&C){var e,t;let l=C,a=[];var n;null!=c&&null!==(e=c.address)&&void 0!==e&&e.locality&&I(c.address.locality),null!=c&&null!==(t=c.address)&&void 0!==t&&t.pincode&&(a=l.filter(e=>{var t;return null===(t=e.pincode)||void 0===t?void 0:t.find(e=>e==c.address.pincode)}),null!=c&&null!==(n=c.address)&&void 0!==n&&n.locality||I()),b(()=>a.length>0?a:l),1===a.length&&I(a[0])}},[y,null==c||null===(a=c.address)||void 0===a?void 0:a.pincode,C]);const{control:O,formState:N,watch:R,setValue:x}=o.useForm(),L=R(),{errors:P}=N,w={width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"};var M,F;return n.useEffect(()=>{if("employee"===d){let e=Object.keys(L);const t={};e.forEach(e=>{var n;return t[e]=null===(n=c[s.key])||void 0===n?void 0:n[e]}),j.isEqual(L,t)||u(s.key,v({},c[s.key],L))}},[L]),n.useEffect(()=>{},[N]),"employee"===d?l.createElement("div",null,l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("MYCITY_CODE_LABEL")+" *"),l.createElement(o.Controller,{name:"city",defaultValue:1===(null==h?void 0:h.length)?h[0]:y,control:O,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,disable:S||1===(null==h?void 0:h.length),option:h,select:e.onChange,optionKey:"code",onBlur:e.onBlur,t:r})})),l.createElement(t.CardLabelError,{style:w},N.touched.city?null==P||null===(M=P.city)||void 0===M?void 0:M.message:""),l.createElement(t.LabelFieldPair,null,l.createElement(t.CardLabel,{className:"card-label-smaller"},r("AST_LOCALITY")+" *"),l.createElement(o.Controller,{name:"locality",defaultValue:null,control:O,render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:e.value,option:D,select:e.onChange,onBlur:e.onBlur,optionKey:"i18nkey",t:r,disable:S||!1})})),l.createElement(t.CardLabelError,{style:w},N.touched.locality?null==P||null===(F=P.locality)||void 0===F?void 0:F.message:"")):l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Ul,{currentStep:3}):null,l.createElement(t.FormStep,{config:s,onSelect:function(){u(s.key,{city:y,locality:T})},t:r,isDisabled:!T},l.createElement("div",null,l.createElement(t.CardLabel,null,r("MYCITY_CODE_LABEL")+" "),l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{options:h.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:y,optionKey:"i18nKey",onSelect:function(e){I(null),b(null),A(e)},t:r,isPTFlow:!0,disabled:S})),y&&D&&l.createElement(t.CardLabel,null,r("AST_LOCALITY")+" "),y&&D&&l.createElement("span",{className:"form-ptr-dropdown-only"},l.createElement(t.RadioOrSelect,{dropdownStyle:{paddingBottom:"20px"},isMandatory:s.isMandatory,options:D.sort((e,t)=>e.name.localeCompare(t.name)),selectedOption:T,optionKey:"i18nkey",onSelect:function(e){var t;null!=c&&null!==(t=c.address)&&void 0!==t&&t.locality&&(c.address.locality=e),I(e),"employee"===d&&u(s.key,v({},c[s.key],{locality:e}))},t:r,labelKey:"",disabled:S})))))},AssetStreets:e=>{var a,i,r,s,u,d,c,m,p;let{t:E,config:f,onSelect:g,userType:S,formData:_,formState:h,setError:y,clearErrors:A}=e;const[C,D]=n.useState({index:-1,type:""}),[b,T]=n.useState((null==_||null===(a=_.address)||void 0===a?void 0:a.street)||""),[I,O]=n.useState((null==_||null===(i=_.address)||void 0===i?void 0:i.addressLine1)||""),[N,R]=n.useState((null==_||null===(r=_.address)||void 0===r?void 0:r.addressLine2)||""),[x,L]=n.useState((null==_||null===(s=_.address)||void 0===s?void 0:s.landmark)||""),[P,w]=n.useState((null==_||null===(u=_.address)||void 0===u?void 0:u.latitude)||""),[M,F]=n.useState((null==_||null===(d=_.address)||void 0===d?void 0:d.longitude)||""),[B,k]=n.useState((null==_||null===(c=_.address)||void 0===c?void 0:c.doorNo)||""),[U,H]=n.useState(!(null==_||null===(m=_.address)||void 0===m||!m.latitude||null==_||null===(p=_.address)||void 0===p||!p.longitude)),{formState:W,watch:V,setError:z,clearErrors:G,trigger:K}=o.useForm(),q=V(),{errors:Y}=W;return window.location.href.includes("tl/new-application")||window.location.href.includes("tl/renew-application-details"),window.location.href.includes("edit-application")||window.location.href.includes("tl/renew-application-details"),n.useEffect(()=>{K()},[]),n.useEffect(()=>{var e;"employee"===S&&(Object.keys(Y).length&&!j.isEqual((null===(e=h.errors[f.key])||void 0===e?void 0:e.type)||{},Y)?y(f.key,{type:Y}):!Object.keys(Y).length&&h.errors[f.key]&&A(f.key))},[Y]),n.useEffect(()=>{const e=Object.keys(q),t={};if(e.forEach(e=>{var n;return t[e]=null===(n=_[f.key])||void 0===n?void 0:n[e]}),!j.isEqual(q,t)){g(f.key,v({},_[f.key],q));for(let e in q)q[e]||null!=W&&W.errors[e]?q[e]&&W.errors[e]&&G([e]):z(e,{type:e.toUpperCase()+"_REQUIRED",message:E("CORE_COMMON_REQUIRED_ERRMSG")});K()}},[q]),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Ul,{currentStep:3}):null,l.createElement(t.FormStep,{config:v({},f),onSelect:e=>{((e,t)=>{g(e,{street:b,doorNo:B,addressLine1:I,addressLine2:N,landmark:x,latitude:P,longitude:M})})(f.key)},onSkip:()=>g(),isDisabled:"",t:E},l.createElement(t.CardLabel,null,""+E("AST_STREET")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"street",onChange:e=>T(e.target.value),value:b,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_DOOR_NO")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"doorNo",onChange:e=>k(e.target.value),style:{width:"50%"},value:B,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_ADDRESS_LINE_1")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"addressLine1",onChange:e=>O(e.target.value),value:I,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_ADDRESS_LINE_2")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"addressLine2",onChange:e=>R(e.target.value),style:{width:"50%"},value:N,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_LANDMARK")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"landmark",onChange:e=>L(e.target.value),value:x,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)}),U&&l.createElement(l.Fragment,null,l.createElement(t.CardLabel,null,""+E("AST_LATITUDE")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"latitude",onChange:e=>w(e.target.value),style:{width:"50%"},value:P,errorStyle:!1,autoFocus:1==(null==C?void 0:C.index)}),l.createElement(t.CardLabel,null,""+E("AST_LONGITUDE")),l.createElement(t.TextInput,{t:E,type:"text",optionKey:"i18nKey",name:"longitude",onChange:e=>F(e.target.value),value:M,style:{width:"50%"},errorStyle:!0,autoFocus:1==(null==C?void 0:C.index)})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:E("AST_FETCH_LOCATION"),onSubmit:()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{const{latitude:t,longitude:n}=e.coords;w(t),F(n),H(!0)},e=>{console.error("Error Code = "+e.code+" - "+e.message)}):console.error("Geolocation is not supported by this browser.")},disabled:U}),l.createElement("br",null)))},ServiceDoc:e=>{var n;let{t:a,config:i,onSelect:o}=e;Digit.ULBService.getCurrentTenantId();const r=Digit.ULBService.getStateId();sessionStorage.removeItem("docReqScreenByBack");const s=null!=i&&i.isMutation?["MutationDocuments"]:"Documents",{isLoading:u,data:d={}}=Digit.Hooks.asset.useAssetDocumentsMDMS(r,"ASSET",s);let c=null==d||null===(n=d.ASSET)||void 0===n?void 0:n.Documents;return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement("div",null,l.createElement(t.CardSubHeader,null,a("AST_REQ_SCREEN_LABEL")),l.createElement(t.CardText,{style:{color:"red"}},a("AST_DOCUMENT_ACCEPTED_PDF_JPG_PNG")),l.createElement("div",null,u&&l.createElement(t.Loader,null),Array.isArray(c)?c.map(null!=i&&i.isMutation?(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(i)),l.createElement(t.CardText,{className:"primaryColor"},o.map(e=>a(null==e?void 0:e.code)).join(", ")))}:(e,n)=>{let{code:i,dropdownData:o}=e;return l.createElement("div",{key:n},l.createElement(t.CardSubHeader,null,n+1,". ",a(Ml(i,".","_"))),o.map((e,n)=>l.createElement(t.CardText,{className:"primaryColor"},""+(n+1),". ",a(Ml(null==e?void 0:e.code,".","_")))))}):null)),l.createElement("span",null,l.createElement(t.SubmitBar,{label:a("COMMON_NEXT"),onSubmit:o}))))},AssetCreateNew:e=>{var t,n,o,r;const s=d.useQueryClient(),u=i.useRouteMatch(),{t:c}=a.useTranslation(),{pathname:m}=i.useLocation(),p=i.useHistory();Digit.ULBService.getStateId();let E=[];const[f,g,S]=Digit.Hooks.useSessionStorage("Asset_Test",{});function _(e,t,n,l,a){if(void 0===a&&(a=!1),"owners"===e){let n=f.owners||[];n[l]=t,g(v({},f,{[e]:[...n]}))}else if("units"===e){let e=f.units||[];e=t,g(v({},f,{units:e}))}else g(v({},f,{[e]:v({},f[e],t)}));((e,t,n,l)=>{let a,i=m.split("/").pop(),o=i.charAt(i.length-1),r=!1;Number(parseInt(i))||"0"==i||"-1"==i?"-1"==i||"-2"==i?(i=m.slice(0,-3),i=i.split("/").pop(),r=!0):(i=m.slice(0,-2),i=i.split("/").pop(),r=!0):r=!1,isNaN(o)||(r=!0);let{nextStep:s={}}=E.find(e=>e.route===(i||"0")),d=p.push;if(e&&(d=p.replace),n&&(s=l),null===s)return d(u.path+"/check");a=isNaN(s.split("/").pop())&&r&&"map"!==s?u.path+"/"+s+"/"+t:u.path+"/"+s,d(a)})(n,l,a,e)}f&&Object.keys(f).length>0&&window.location.href.includes("/info")&&"true"!==sessionStorage.getItem("docReqScreenByBack")&&(S(),s.invalidateQueries("AST_CREATE"));const h=()=>{},y=()=>{};Hl.forEach(e=>{E=E.concat(e.body.filter(e=>!e.hideInCitizen))}),E.indexRoute="info";const A=null===(t=Digit)||void 0===t||null===(n=t.ComponentRegistryService)||void 0===n?void 0:n.getComponent("ASTCheckPage"),C=null===(o=Digit)||void 0===o||null===(r=o.ComponentRegistryService)||void 0===r?void 0:r.getComponent("NewResponse");return l.createElement(i.Switch,null,E.map((e,t)=>{const{component:n,texts:a,inputs:o,key:r}=e,s="string"==typeof n?Digit.ComponentRegistryService.getComponent(n):n;return l.createElement(i.Route,{path:u.path+"/"+e.route,key:t},l.createElement(s,{config:{texts:a,inputs:o,key:r},onSelect:_,onSkip:h,t:c,formData:f,onAdd:y}))}),l.createElement(i.Route,{path:u.path+"/check"},l.createElement(A,{onSubmit:function(){try{return p.push(u.path+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:f})),l.createElement(i.Route,{path:u.path+"/acknowledgement"},l.createElement(C,{data:f,onSuccess:()=>{S(),s.invalidateQueries("AST_CREATE")}})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:u.path+"/"+E.indexRoute})))},NewAssetClassification:e=>{var a,r,s,u,d,c,m,p,E,f,g,S;let{t:_,config:h,onSelect:y,userType:A,formData:C}=e;const{control:D}=o.useForm();i.useLocation();let b={};const T=(()=>{const e=new Date,t=e.getFullYear();return e.getMonth()+1>=4?t+"-"+(t+1):t-1+"-"+t})(),[I,O]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetclassification||(null==C||null===(a=C.asset)||void 0===a?void 0:a.assetclassification)||""),[N,R]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assettype||(null==C||null===(r=C.asset)||void 0===r?void 0:r.assettype)||""),[x,L]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsubtype||(null==C||null===(s=C.asset)||void 0===s?void 0:s.assetsubtype)||""),[P,w]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetparentsubCategory||(null==C||null===(u=C.asset)||void 0===u?void 0:u.assetparentsubCategory)||""),[M,F]=n.useState(C.asset&&C.asset[0]&&C.asset[0].BookPagereference||(null==C||null===(d=C.asset)||void 0===d?void 0:d.BookPagereference)||""),[B,k]=n.useState(C.asset&&C.asset[0]&&C.asset[0].AssetName||(null==C||null===(c=C.asset)||void 0===c?void 0:c.AssetName)||""),[U,H]=n.useState(C.asset&&C.asset[0]&&C.asset[0].Assetdescription||(null==C||null===(m=C.asset)||void 0===m?void 0:m.Assetdescription)||""),[j,W]=n.useState(C.asset&&C.asset[0]&&C.asset[0].Department||(null==C||null===(p=C.asset)||void 0===p?void 0:p.Department)||""),[V,z]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsOfType||(null==C||null===(E=C.asset)||void 0===E?void 0:E.assetsOfType)||""),[G,K]=n.useState(C.asset&&C.asset[0]&&C.asset[0].assetsUsage||(null==C||null===(f=C.asset)||void 0===f?void 0:f.assetsUsage)||""),[q,Y]=n.useState(C.asset&&C.asset[0]&&C.asset[0].financialYear||(null==C||null===(g=C.asset)||void 0===g?void 0:g.financialYear)||T),[$,Z]=n.useState(C.asset&&C.asset[0]&&C.asset[0].sourceOfFinance||(null==C||null===(S=C.asset)||void 0===S?void 0:S.sourceOfFinance)||""),Q=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),{data:X}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetClassification"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetClassification;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:J}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetParentCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategory;return null==n?void 0:n.filter(e=>!0===e.active)}}),{data:ee}=Digit.Hooks.asset.useAssetSubType(Q,"ASSET","assetCategory"),{data:te}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetSubCategory"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetSubCategory;return null==n?void 0:n.filter(e=>!0===e.active)}});console.log("E data:- ",te);const{data:ne}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let le=[];ne&&ne.map(e=>{le.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:ae}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let ie=[];ae&&ae.map(e=>{ie.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:oe}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let re=[];oe&&oe.map(e=>{re.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});let se=[],ue=[],de=[],ce=[];X&&X.map(e=>{se.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),J&&J.map(e=>{e.assetClassification==(null==I?void 0:I.code)&&ue.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),ee&&ee.map(e=>{e.assetParentCategory==(null==N?void 0:N.code)&&de.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),te&&te.map(e=>{e.assetCategory==(null==x?void 0:x.code)&&ce.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const me=()=>{let e,t=C.asset&&C.asset[0];"citizen"===A?(e=v({},t,{financialYear:q,sourceOfFinance:$,assetclassification:I,assetparentsubCategory:P,assetsubtype:x,assettype:N}),y(h.key,v({},C[h.key],e),!1,0)):(e=v({},t,{financialYear:q,sourceOfFinance:$,assetclassification:I,assetparentsubCategory:P,assetsubtype:x,assettype:N,BookPagereference:M,AssetName:B,Department:j,assetsOfType:V,assetsUsage:G,Assetdescription:U}),y(h.key,e,!1,0))};n.useEffect(()=>{"citizen"===A&&me()},[q,$,I,x,N,P,M,B,j,V,G,U]);const{data:ve}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let pe=[];ve&&ve.map(e=>{pe.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:Ee}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let fe=[];return Ee&&Ee.map(e=>{fe.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})}),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Ul,{currentStep:1}):null,l.createElement(t.FormStep,{config:h,onSelect:me,onSkip:()=>y(),t:_,isDisabled:!(I&&x&&N&&M)},l.createElement("div",null,l.createElement("div",null,_("AST_FINANCIAL_YEAR"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_WHICH_FINANCIAL_YEAR")))),l.createElement(o.Controller,{control:D,name:"financialYear",defaultValue:q,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:q,select:Y,option:ie,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_SOURCE_FINANCE"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_SOURCE_OF_FUNDING")))),l.createElement(o.Controller,{control:D,name:"sourceOfFinance",defaultValue:$,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:$,select:Z,option:le,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_CATEGORY"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_CLASSIFICATION_ASSET")))),l.createElement(o.Controller,{control:D,name:"assetclassification",defaultValue:I,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:I,select:O,option:se,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement(t.CardLabel,null,""+_("AST_PARENT_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assettype",defaultValue:N,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:N,select:R,option:ue,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement(t.CardLabel,null,""+_("AST_SUB_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assetsubtype",defaultValue:x,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:x,select:L,option:de,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement(t.CardLabel,null,""+_("AST_CATEGORY_SUB_CATEGORY")),l.createElement(o.Controller,{control:D,name:"assetparentsubCategory",defaultValue:P,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:P,select:w,option:ce,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_TYPE")),l.createElement(o.Controller,{control:D,name:"assetsOfType",defaultValue:V,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:V,select:z,option:pe,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_BOOK_REF_SERIAL_NUM"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_BOOK_REF_NUMBER")))),l.createElement(t.TextInput,v({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"BookPagereference",value:M,onChange:function(e){F(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement(t.CardLabel,null,""+_("AST_NAME")),l.createElement(t.TextInput,v({t:_,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"AssetName",value:B,onChange:function(e){k(e.target.value)},style:{width:"50%"},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")})),l.createElement("div",null,_("ASSET_DESCRIPTION"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_ANY_DESCRIPTION")))),l.createElement("div",{className:"form-field"},l.createElement(t.TextArea,v({t:_,type:"textarea",isMandatory:!1,optionKey:"i18nKey",name:"Assetdescription",value:U,onChange:function(e){H(e.target.value)},ValidationRequired:!1},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:_("PT_NAME_ERROR_MESSAGE")}))),l.createElement("div",null,_("AST_DEPARTMENT"),l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},""+_("AST_PROCURED_DEPARTMENT")))),l.createElement(o.Controller,{control:D,name:"Department",defaultValue:j,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:j,select:W,option:re,optionKey:"i18nKey",placeholder:"Select",t:_})}),l.createElement("div",null,_("AST_USAGE")),l.createElement(o.Controller,{control:D,name:"assetsUsage",defaultValue:G,rules:{required:_("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:G,select:K,option:fe,optionKey:"i18nKey",placeholder:"Select",t:_})}))))},NewAsset:e=>{var a,r,s,u;let{t:d,config:c,onSelect:m,formData:p}=e;const[E,f]=n.useState(p.assetDetails&&p.assetDetails.assetParentCategory===(null==p||null===(a=p.asset)||void 0===a||null===(r=a.assettype)||void 0===r?void 0:r.code)?p.assetDetails:{assetParentCategory:null==p||null===(s=p.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code}),[g,S]=n.useState(),_=Digit.ULBService.getCurrentTenantId(),h=Digit.ULBService.getStateId(),y=Digit.Hooks.useCustomMDMSV2(_,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),A=Digit.Hooks.useCustomMDMSV2(h,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}});n.useEffect(()=>{let e;null!=y&&y.data?e=y.data:null!=A&&A.data?e=A.data:(e=[],console.log("Both cityResponseObject and stateResponseObject data are unavailable.")),S(e)},[y,A]);let C=[];Array.isArray(g)&&(C=g.filter(e=>{var t,n;return e.assetParentCategory===(null==p||null===(t=p.asset)||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),i.useLocation();let D=window.location.href.charAt(window.location.href.length-1),b={};const{control:T}=o.useForm(),I=e=>e&&"number"===e?"^[0-9]+(\\.[0-9]+)?$":"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",O=e=>{const{name:t,value:n}=e.target?e.target:{name:e.name,value:e};if("lifeOfAsset"===t&&n.length>3)return alert("Maximum limit is 3 digits only!"),!1;f(e=>{const l=v({},e,{[t]:n}),a=parseFloat(l.acquisitionCost)||0,i=parseFloat(l.purchaseCost)||0;return(a>=0||i>=0)&&(l.bookValue=a+i),"purchaseDate"===t&&(e=>{const t=new Date,n=new Date(e),l=t.getFullYear()-n.getFullYear(),a=t.getMonth()-n.getMonth();let i;if(l>0)i=l+" "+d("YEAR");else if(a>=0)i=a+" "+d("MONTH");else{const e=t.getDate()-n.getDate();i=e+" "+d("DAY")}f(e=>v({},e,{assetAge:i}))})(n),l})},N=e=>{"geolocation"in navigator?navigator.geolocation.getCurrentPosition(t=>{const{latitude:n,longitude:l}=t.coords;f(t=>v({},t,{[e]:n+", "+l}))},e=>{console.error("Error getting location:",e),alert("Unable to retrieve your location. Please check your browser settings.")}):alert("Geolocation is not supported by your browser.")},R=e=>{const t=e?e.trim():"",{data:n}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:t}],{select:e=>{var n;return null==e||null===(n=e.ASSET)||void 0===n?void 0:n[t]}});let l=[];return n&&n.map(e=>{l.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})}),l};return l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Ul,{currentStep:2}):null,l.createElement(t.Card,null,l.createElement(t.CardCaption,null,d(p.asset.Department.value),"/",p.asset.assetclassification.value,"/",p.asset.assettype.value,"/",p.asset.assetsubtype.value,"/",p.asset.BookPagereference)),l.createElement(t.FormStep,{config:c,onSelect:()=>{E.owner=p.assetDetails&&p.assetDetails[D],m(c.key,E,!1,D)},onSkip:()=>m(),t:d,isDisabled:!E.purchaseDate||!E.modeOfPossessionOrAcquisition||!E.purchaseOrderNumber},l.createElement(l.Fragment,null,l.createElement("div",null,d("AST_MODE_OF_POSSESSION_OR_ACQUISITION")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(o.Controller,{control:T,name:"modeOfPossessionOrAcquisition",isMandatory:!1,defaultValue:E.modeOfPossessionOrAcquisition?E.modeOfPossessionOrAcquisition:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:e=>l.createElement(t.Dropdown,{className:"form-field",selected:E.modeOfPossessionOrAcquisition,select:O,option:R("ModeOfPossessionOrAcquisition"),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}),l.createElement("div",null,d("AST_INVOICE_DATE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"invoiceDate",value:E.invoiceDate,onChange:O,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,d("AST_INVOICE_NUMBER")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,v({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"invoiceNumber",value:E.invoiceNumber,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_PURCHASE_DATE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:"purchaseDate",value:E.purchaseDate,onChange:O,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}),l.createElement("div",null,d("AST_PURCHASE_ORDER")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,v({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"purchaseOrderNumber",value:E.purchaseOrderNumber,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_LIFE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,v({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"lifeOfAsset",value:E.lifeOfAsset,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_LOCATION_DETAILS")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,v({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"location",value:E.location||"",onChange:O,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:"^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$",type:"text",title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{N("location")},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))),l.createElement("div",null,d("AST_PURCHASE_COST")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,v({t:d,type:"number",isMandatory:!1,optionKey:"i18nKey",name:"purchaseCost",value:E.purchaseCost,onChange:O,ValidationRequired:!0},b={isRequired:!0,pattern:I("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_ACQUISITION_COST")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,v({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"acquisitionCost",value:E.acquisitionCost,onChange:O,ValidationRequired:!0},b={isRequired:!0,pattern:I("number"),type:"number",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),l.createElement("div",null,d("AST_BOOK_VALUE")+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d("")+" "))),l.createElement(t.TextInput,v({t:d,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"bookValue",value:E.bookValue,onChange:O},b={isRequired:!0,pattern:"^[a-zA-Z0-9/-]*$",type:"text",title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"}})),C.map((e,n)=>l.createElement("div",{key:n},l.createElement("div",null,d(e.code)+" *",l.createElement("div",{className:"tooltip",style:{width:"12px",height:"5px",marginLeft:"10px",display:"inline-flex",alignItems:"center"}},l.createElement(t.InfoBannerIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"pre-wrap",fontSize:"small",wordWrap:"break-word",width:"300px",marginLeft:"15px",marginBottom:"-10px"}},d(e.iLable)+" "))),"date"===e.type?l.createElement(t.TextInput,{t:d,type:"date",isMandatory:!1,optionKey:"i18nKey",name:e.name,value:E[e.name],onChange:O,style:{width:"50%"},max:(new Date).toISOString().split("T")[0],rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG"),validDate:e=>!!/^\d{4}-\d{2}-\d{2}$/.test(e)||d("ERR_DEFAULT_INPUT_FIELD_MSG")}}):"dropdown"==e.type?l.createElement(o.Controller,{control:T,name:e.name,isMandatory:!1,defaultValue:E[e.name]?E[e.name]:"",rules:{required:d("CORE_COMMON_REQUIRED_ERRMSG")},render:n=>l.createElement(t.Dropdown,{className:"form-field",selected:E[e.name],select:O,option:R(e.masterName),optionKey:"i18nKey",placeholder:"Select",isMandatory:!1,t:d})}):!0===e.addCurrentLocationButton?l.createElement("div",{style:{position:"relative",width:"50%"}},l.createElement(t.TextInput,v({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:O,style:{flex:1},ValidationRequired:!1},b={isRequired:!0,pattern:I(e.columnType),type:e.columnType,title:d("VALID_LAT_LONG")})),l.createElement("div",{className:"butt-icon",onClick:()=>{N(e.name)},style:{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px 5px"}},l.createElement(t.LocationIcon,{styles:{width:"16px",border:"none"},className:"fill-path-primary-main"}))):l.createElement(t.TextInput,v({t:d,type:e.type,isMandatory:e.isMandatory,optionKey:"i18nKey",name:e.name,value:E[e.name]||"",onChange:O},b={isRequired:e.isMandatory,pattern:I(e.columnType),type:e.columnType,title:d("PT_NAME_ERROR_MESSAGE")},{style:{width:"50%"},readOnly:e.isReadOnly})))))))},NewDocument:e=>{var a,i,o;let{t:r,config:s,onSelect:u,formData:d}=e;const[c,m]=n.useState((null==d||null===(a=d.documents)||void 0===a?void 0:a.documents)||[]),[p,E]=n.useState(null),[f,g]=n.useState(!0),[S,_]=n.useState(!0),h=Digit.ULBService.getStateId(),{isLoading:y,data:A}=Digit.Hooks.asset.useAssetDocumentsMDMS(h,"ASSET","Documents");return n.useEffect(()=>{var e;let t=0;null==A||null===(e=A.ASSET)||void 0===e||e.Documents.forEach(e=>{e.hasDropdown=!0,!c.some(t=>e.required&&(null==t?void 0:t.documentType.includes(e.code)))&&e.required&&(t+=1)}),g(!(0===t&&c.length>0))},[c,S,A]),l.createElement("div",null,l.createElement(Ul,{currentStep:4}),y?l.createElement(t.Loader,null):l.createElement(t.FormStep,{t:r,config:s,onSelect:()=>{let e=v({},d.documents,{documents:c});u(s.key,e)},onSkip:()=>u(),isDisabled:f},null==A||null===(i=A.ASSET)||void 0===i||null===(o=i.Documents)||void 0===o?void 0:o.map((e,t)=>l.createElement(jl,{key:t,document:e,t:r,error:p,setError:E,setDocuments:m,documents:c,setCheckRequiredFields:_,formData:d})),p&&l.createElement(t.Toast,{label:p,onClose:()=>E(null),error:!0})))},ASTCheckPage:e=>{var o,r,s,u,d,c,m,v,p,E,f,g;let{onSubmit:S,value:_={}}=e;const{t:h}=a.useTranslation(),[y,A]=(i.useHistory(),n.useState(!1)),[C,D]=n.useState(),b=Digit.ULBService.getCurrentTenantId(),T=Digit.ULBService.getStateId(),I=Digit.Hooks.useCustomMDMS(b,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),O=Digit.Hooks.useCustomMDMS(T,"ASSET",[{name:"AssetParentCategoryFields"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetParentCategoryFields}}),{address:N,assetDetails:R,asset:x}=_;n.useEffect(()=>{let e;e=null!=I&&I.data?I.data:null!=O&&O.data?O.data:[],D(e)},[I,O]);let L=[];return Array.isArray(C)&&(L=C.filter(e=>{var t;return e.assetParentCategory===(null==x||null===(t=x.assettype)||void 0===t?void 0:t.code)||"COMMON"===e.assetParentCategory}).map(e=>e.fields).flat().filter(e=>!0===e.active)),l.createElement(l.Fragment,null,window.location.href.includes("/employee")?l.createElement(Ul,{currentStep:5}):null,l.createElement(t.Card,null,l.createElement(t.CardHeader,null,h("AST_CHECK_DETAILS")),l.createElement("div",null,l.createElement("br",null),l.createElement(t.CardSubHeader,null,h("ASSET_GENERAL_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:h("AST_FINANCIAL_YEAR"),text:""+h(Ll(null==x||null===(o=x.financialYear)||void 0===o?void 0:o.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_SOURCE_FINANCE"),text:""+h(Ll(null==x||null===(r=x.sourceOfFinance)||void 0===r?void 0:r.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_ASSET_CATEGORY_LABEL"),text:""+h(Ll(null==x||null===(s=x.assetclassification)||void 0===s?void 0:s.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_PARENT_CATEGORY_LABEL"),text:""+h(Ll(null==x||null===(u=x.assettype)||void 0===u?void 0:u.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_SUB_CATEGORY"),text:""+h(Ll(null==x||null===(d=x.assetsubtype)||void 0===d?void 0:d.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_CATEGORY_SUB_CATEGORY"),text:""+h(Ll(null==x||null===(c=x.assetparentsubCategory)||void 0===c?void 0:c.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_BOOK_REF_SERIAL_NUM"),text:""+h(Ll(null==x?void 0:x.BookPagereference)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_NAME"),text:""+h(Ll(null==x?void 0:x.AssetName)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("ASSET_DESCRIPTION"),text:""+h(Ll(null==x?void 0:x.Assetdescription)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_DEPARTMENT"),text:""+h(Ll(null==x||null===(m=x.Department)||void 0===m?void 0:m.value)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_TYPE"),text:""+h(Ll(null==x||null===(v=x.assetsOfType)||void 0===v?void 0:v.value)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})}),l.createElement(t.Row,{label:h("AST_USAGE"),text:""+h(Ll(null==x||null===(p=x.assetsUsage)||void 0===p?void 0:p.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/asset-deatils"})})),l.createElement("br",null),l.createElement(t.CardSubHeader,null,h("AST_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(l.Fragment,null,l.createElement(t.Row,{label:h("AST_MODE_OF_POSSESSION_OR_ACQUISITION"),text:""+h(Ll(null==R||null===(E=R.modeOfPossessionOrAcquisition)||void 0===E?void 0:E.code)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_INVOICE_DATE"),text:""+h(Ll(null==R?void 0:R.invoiceDate)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_INVOICE_NUMBER"),text:""+h(Ll(null==R?void 0:R.invoiceNumber)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_PURCHASE_DATE"),text:""+h(Ll(null==R?void 0:R.purchaseDate)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_PURCHASE_ORDER"),text:""+h(Ll(null==R?void 0:R.purchaseOrderNumber)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_LIFE"),text:""+h(Ll(null==R?void 0:R.lifeOfAsset)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_LOCATION_DETAILS"),text:""+h(Ll(null==R?void 0:R.location)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_PURCHASE_COST"),text:""+h(Ll(null==R?void 0:R.purchaseCost)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_ACQUISITION_COST"),text:""+h(Ll(null==R?void 0:R.acquisitionCost)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),l.createElement(t.Row,{label:h("AST_BOOK_VALUE"),text:""+h(Ll(null==R?void 0:R.bookValue)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})}),L.map((e,n)=>{return l.createElement(t.Row,{key:n,label:h(e.code),text:""+(a=e.name,i=R[a],"object"==typeof i?i.code:i),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/assets"})});var a,i}))),l.createElement("br",null),l.createElement(t.CardSubHeader,null,h("AST_ADDRESS_DETAILS")),l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:h("MYCITY_CODE_LABEL"),text:""+h(Ll(null==N||null===(f=N.city)||void 0===f?void 0:f.name)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})}),l.createElement(t.Row,{label:h("AST_LOCALITY"),text:""+h(Ll(null==N||null===(g=N.locality)||void 0===g?void 0:g.name)),actionButton:l.createElement(Wl,{jumpTo:"/digit-ui/employee/asset/assetservice/new-assets/address"})})),l.createElement("br",null),l.createElement(t.CheckBox,{label:h("AST_FINAL_DECLARATION_MESSAGE"),onChange:()=>{A(!y)},styles:{height:"auto"}})),l.createElement("br",null),l.createElement(t.SubmitBar,{label:h("COMMON_BUTTON_SUBMIT"),onSubmit:S,disabled:!y})))},NewResponse:e=>{var o,r;let{data:s,onSuccess:u}=e;const{t:d}=a.useTranslation(),c=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.asset.useAssetCreateAPI(null==s||null===(o=s.address)||void 0===o||null===(r=o.city)||void 0===r?void 0:r.code));return Digit.Hooks.useStore.getInitData(),i.useRouteMatch(),n.useEffect(()=>{try{var e,t;s.tenantId=null===(e=s.address)||void 0===e||null===(t=e.city)||void 0===t?void 0:t.code;let n=(e=>{var t,n,l,a,i,o,r,s,u,d,c,m,v,p,E,f,g,S,_,h,y,A,C,D,b,T,I,O,N,R,x,L,P,w,M,F,B,k,U,H,j,W,V,z,G,K,q,Y,$,Z,Q;const X=["acquisitionCost","assetAge","bookValue","invoiceDate","invoiceNumber","purchaseDate","purchaseOrderNumber","purchaseCost","location","lifeOfAsset"],J=(null==e?void 0:e.assetDetails)||{},ee=Object.keys(J).filter(e=>!X.includes(e)).reduce((e,t)=>(e[t]=J[t],e),{});return{Asset:{accountId:"",tenantId:null==e||null===(t=e.address)||void 0===t||null===(n=t.city)||void 0===n?void 0:n.code,assetBookRefNo:null==e||null===(l=e.asset)||void 0===l?void 0:l.BookPagereference,assetName:null==e||null===(a=e.asset)||void 0===a?void 0:a.AssetName,description:null==e||null===(i=e.asset)||void 0===i?void 0:i.Assetdescription,assetClassification:null==e||null===(o=e.asset)||void 0===o||null===(r=o.assetclassification)||void 0===r?void 0:r.code,assetParentCategory:null==e||null===(s=e.asset)||void 0===s||null===(u=s.assettype)||void 0===u?void 0:u.code,assetCategory:null==e||null===(d=e.asset)||void 0===d||null===(c=d.assetsubtype)||void 0===c?void 0:c.code,assetSubCategory:null==e||null===(m=e.asset)||void 0===m||null===(v=m.assetparentsubCategory)||void 0===v?void 0:v.code,department:null==e||null===(p=e.asset)||void 0===p||null===(E=p.Department)||void 0===E?void 0:E.code,assetType:null==e||null===(f=e.asset)||void 0===f||null===(g=f.assetsOfType)||void 0===g?void 0:g.code,assetUsage:null==e||null===(S=e.asset)||void 0===S||null===(_=S.assetsUsage)||void 0===_?void 0:_.code,financialYear:null==e||null===(h=e.asset)||void 0===h||null===(y=h.financialYear)||void 0===y?void 0:y.code,sourceOfFinance:null==e||null===(A=e.asset)||void 0===A||null===(C=A.sourceOfFinance)||void 0===C?void 0:C.code,applicationNo:"",approvalDate:"",applicationDate:"",status:"",modeOfPossessionOrAcquisition:null==e||null===(D=e.assetDetails)||void 0===D||null===(b=D.modeOfPossessionOrAcquisition)||void 0===b?void 0:b.code,invoiceDate:Pl(null==e||null===(T=e.assetDetails)||void 0===T?void 0:T.invoiceDate),invoiceNumber:null==e||null===(I=e.assetDetails)||void 0===I?void 0:I.invoiceNumber,purchaseDate:Pl(null==e||null===(O=e.assetDetails)||void 0===O?void 0:O.purchaseDate),purchaseOrderNumber:null==e||null===(N=e.assetDetails)||void 0===N?void 0:N.purchaseOrderNumber,assetAge:null==e||null===(R=e.assetDetails)||void 0===R?void 0:R.assetAge,location:null==e||null===(x=e.assetDetails)||void 0===x?void 0:x.location,lifeOfAsset:null==e||null===(L=e.assetDetails)||void 0===L?void 0:L.lifeOfAsset,purchaseCost:wl(null==e||null===(P=e.assetDetails)||void 0===P?void 0:P.purchaseCost),acquisitionCost:wl(null==e||null===(w=e.assetDetails)||void 0===w?void 0:w.acquisitionCost),bookValue:null==e||null===(M=e.assetDetails)||void 0===M?void 0:M.bookValue,originalBookValue:null==e||null===(F=e.assetDetails)||void 0===F?void 0:F.bookValue,islegacyData:!1,minimumValue:0,assetStatus:"1",action:"",businessService:"asset-create",addressDetails:{addressLine1:null==e||null===(B=e.address)||void 0===B?void 0:B.addressLine1,addressLine2:null==e||null===(k=e.address)||void 0===k?void 0:k.addressLine2,buildingName:null==e||null===(U=e.address)||void 0===U?void 0:U.buildingName,doorNo:null==e||null===(H=e.address)||void 0===H?void 0:H.doorNo,street:null==e||null===(j=e.address)||void 0===j?void 0:j.street,pincode:null==e||null===(W=e.address)||void 0===W?void 0:W.pincode,city:null==e||null===(V=e.address)||void 0===V||null===(z=V.city)||void 0===z?void 0:z.name,locality:{code:null==e||null===(G=e.address)||void 0===G||null===(K=G.locality)||void 0===K?void 0:K.code,area:null==e||null===(q=e.address)||void 0===q||null===(Y=q.locality)||void 0===Y?void 0:Y.area,latitude:null==e||null===($=e.address)||void 0===$?void 0:$.latitude,longitude:null==e||null===(Z=e.address)||void 0===Z?void 0:Z.longitude}},documents:null==e||null===(Q=e.documents)||void 0===Q?void 0:Q.documents,workflow:{action:"INITIATE",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:ee}}})(s);c.mutate(n,{onSuccess:u})}catch(e){}},[]),c.isLoading||c.isIdle?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(Gl,{t:d,data:c.data,isSuccess:c.isSuccess,isLoading:c.isIdle||c.isLoading}),l.createElement(t.StatusTable,null,c.isSuccess&&l.createElement(t.Row,{rowContainerStyle:zl,last:!0,textStyle:{whiteSpace:"pre",width:"60%"}})),l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.LinkButton,{label:d("CORE_COMMON_GO_TO_HOME")})))},ApplicationDetails:gl,AssetResponse:e=>{console.log("For coming data from props in response:- ",e);const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[v,p]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useAssignCreateAPI(y,"UPDATE"!==A.key),D=Digit.Hooks.asset.useAssignCreateAPI(y,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==A?void 0:A.Assets},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&p(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(hl,{t:o,data:(null==C?void 0:C.data)||S,action:null==A?void 0:A.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},DisposeResponse:e=>{const o=i.useLocation(),{AssetDisposal:r}=o.state||{},{t:s}=a.useTranslation(),[u,c]=(d.useQueryClient(),i.useHistory(),n.useState(null)),[m,v]=n.useState(null),[p,E]=n.useState(!1),[f,g]=n.useState(null);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status&&g(r.AssetDisposals[0])},[r]),l.createElement("div",null,l.createElement(t.Card,null,f?l.createElement(Dl,{t:s,data:f,action:e.action,isSuccess:!0,isEmployee:e.parentRoute.includes("employee")}):l.createElement(t.Loader,null)),m&&l.createElement(t.Toast,{error:"error"===m.key,label:u,onClose:()=>{v(null),c(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},ProcessDepreciationResponse:e=>{const o=i.useLocation(),{ProcessDepreciation:r}=o.state||{},{t:s}=a.useTranslation(),[u,d]=n.useState(null),[c,m]=n.useState(!1);return n.useEffect(()=>{r&&"successful"===r.ResponseInfo.status?d(r.Message):(m(!0),d(s("CS_SOMETHING_WENT_WRONG")))},[r,s]),l.createElement("div",null,l.createElement(t.Card,null,l.createElement(t.Banner,u&&!c?{message:((e,t)=>t("CS_DEPRECIATION_SUCCESS_MESSAGE"))(0,s),info:((e,t)=>t("CS_DEPRECIATION_SUCCESS_LABEL"))(0,s),successful:!0}:{message:"Processing...",successful:!1})),c&&u&&l.createElement(t.Toast,{error:!0,label:u,onClose:()=>{d(null),m(!1)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:s("CORE_COMMON_GO_TO_HOME")}))))},returnResponse:e=>{const{t:o}=a.useTranslation(),r=d.useQueryClient(),[s,u]=(i.useHistory(),n.useState(null)),[c,m]=n.useState(null),[v,p]=n.useState(!1),[E,f,g]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),y=Digit.ULBService.getCurrentTenantId(),{state:A}=e.location,C=Digit.Hooks.asset.useReturnAPI(y,"UPDATE"!==A.key),D=Digit.Hooks.asset.useReturnAPI(y,!1);return n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[C.data]),n.useEffect(()=>{D.data&&D.isSuccess&&_(D.data)},[D.data]),n.useEffect(()=>{E||C.mutate({Asset:null==A?void 0:A.Asset},{onError:(e,t)=>{var n,l,a;m({key:"error"}),u((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return f(!0),r.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&p(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),C.isLoading||C.isIdle&&!E?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(Il,{t:o,data:(null==C?void 0:C.data)||S,action:null==A?void 0:A.action,isSuccess:!!Object.keys(S||{}).length||(null==C?void 0:C.isSuccess),isLoading:C.isIdle&&!E||(null==C?void 0:C.isLoading),isEmployee:e.parentRoute.includes("employee")})),c&&l.createElement(t.Toast,{error:"error"===c.key,label:s,onClose:()=>{m(null),u(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:e.parentRoute.includes("employee")?"/digit-ui/employee":"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:o("CORE_COMMON_GO_TO_HOME")}))))},AssetAssign:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,m]=n.useState((null==o?void 0:o.assigndetails)||[{department:"",assignedUser:"",designation:"",employeeCode:"",transferDate:"",returnDate:"",allocatedDepartment:"",key:Date.now()}]),[p,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const{data:f}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let g=[];f&&f.map(e=>{g.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const{data:S}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Designation"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Designation;return null==n?void 0:n.filter(e=>!0===e.active)}}),_=[];S&&S.map(e=>{_.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const h={focusIndex:p,allAssets:c,setFocusIndex:E,formData:o,formState:s,setassigndetails:m,t:d,setError:r,clearErrors:u,config:t,departNamefromMDMS:g,designationNamefromMDMS:_};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(Kl,v({key:e.key,index:t,assigndetails:e},h))))},AssetDispose:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[d,c]=n.useState((null==o?void 0:o.disposeDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[m,p]=n.useState({index:-1,type:""}),[E,f]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const g={focusIndex:m,allAssets:d,setFocusIndex:p,formData:o,formState:r,setdisposeDetails:c,t:u,setError:f,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(ql,v({key:e.key,index:t,disposeDetails:e},g))))},AssetMaintenance:e=>{let{config:t,onSelect:i,formData:o,formState:r,clearErrors:s}=e;const{t:u}=a.useTranslation(),[d,c]=n.useState((null==o?void 0:o.maintenanceDetails)||[{disposalDate:"",reasonForDisposal:"",comments:"",amountReceived:"",isAssetDisposedInFacility:!0,purchaserName:"",paymentMode:"",receipt:"",disposedFacility:"",currentAgeOfAsset:"",assetId:"",key:Date.now()}]),[m,p]=n.useState({index:-1,type:""}),[E,f]=n.useState(null);n.useEffect(()=>{i(null==t?void 0:t.key,d)},[d]);const g={focusIndex:m,allAssets:d,setFocusIndex:p,formData:o,formState:r,setMaintenanceDetails:c,t:u,setError:f,clearErrors:s,config:t};return l.createElement(l.Fragment,null,d.map((e,t)=>l.createElement(Yl,v({key:e.key,index:t,maintenanceDetails:e},g))))},returnAssets:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),u=i.useHistory(),{id:d}=i.useParams(),{data:c}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,d);console.log("Data is application from Hook:- ",c);const[m,p,E]=Digit.Hooks.useSessionStorage("store-data",null),[f,g,S]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[_,h,y]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});n.useEffect(()=>{g(!1),y()},[]);const A=$l;return l.createElement(t.FormComposer,{heading:o("AST_RETURN_ASSET"),isDisabled:!r,label:o("ES_COMMON_APPLICATION_SUBMIT"),config:A.map(e=>v({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:t=>{var n,l,a,i,o,r,s,d,m,v,p,E,f,g,S,_,h,y,A,C,D,b,T,I;const O=(e=>{const[t,n,l]=e.split("-").map(Number);return new Date(t,n-1,l).getTime()})(null==t||null===(n=t.returndetails)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.returnDate),N={id:null==c||null===(a=c.applicationData)||void 0===a||null===(i=a.applicationData)||void 0===i?void 0:i.id,tenantId:e,applicationNo:null==c||null===(o=c.applicationData)||void 0===o||null===(r=o.applicationData)||void 0===r?void 0:r.applicationNo,assetAssignment:{assignmentId:null==c||null===(s=c.applicationData)||void 0===s||null===(d=s.applicationData)||void 0===d||null===(m=d.assetAssignment)||void 0===m?void 0:m.assignmentId,assetId:"",assignedUserName:null==c||null===(v=c.applicationData)||void 0===v||null===(p=v.applicationData)||void 0===p||null===(E=p.assetAssignment)||void 0===E?void 0:E.assignedUserName,designation:(null==c||null===(f=c.applicationData)||void 0===f||null===(g=f.applicationData)||void 0===g||null===(S=g.assetAssignment)||void 0===S?void 0:S.designation)||"",department:(null==c||null===(_=c.applicationData)||void 0===_||null===(h=_.applicationData)||void 0===h||null===(y=h.assetAssignment)||void 0===y?void 0:y.department)||"",assignedDate:null==c||null===(A=c.applicationData)||void 0===A||null===(C=A.applicationData)||void 0===C||null===(D=C.assetAssignment)||void 0===D?void 0:D.assignedDate,employeeCode:null==c||null===(b=c.applicationData)||void 0===b||null===(T=b.applicationData)||void 0===T||null===(I=T.assetAssignment)||void 0===I?void 0:I.employeeCode,isAssigned:!1,returnDate:O,auditDetails:{createdBy:"",lastModifiedBy:"",createdTime:"",lastModifiedTime:""}}};u.replace("/digit-ui/employee/asset/assetservice/return-response",{Asset:N})},defaultValues:{},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},ReturnAssignedAsset:e=>{let{config:t,onSelect:i,formData:o,setError:r,formState:s,clearErrors:u}=e;const{t:d}=a.useTranslation(),[c,m]=n.useState((null==o?void 0:o.returndetails)||[{returnDate:"",key:Date.now()}]),[p,E]=n.useState({index:-1,type:""});n.useEffect(()=>{i(null==t?void 0:t.key,c)},[c]);const f={focusIndex:p,allAssets:c,setFocusIndex:E,formData:o,formState:s,setreturndetails:m,t:d,setError:r,clearErrors:u,config:t};return l.createElement(l.Fragment,null,c.map((e,t)=>l.createElement(Zl,v({key:e.key,index:t,returndetails:e},f))))},editAsset:()=>{const e=Digit.ULBService.getCurrentTenantId(),{t:o}=a.useTranslation(),[r,s]=n.useState(!1),[u,d]=n.useState(!0),c=i.useHistory(),{id:m}=i.useParams(),{data:p}=Digit.Hooks.asset.useAssetApplicationDetail(o,e,m),[E,f,g]=Digit.Hooks.useSessionStorage("store-data",null),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",{});if(n.useEffect(()=>{_(!1),C()},[]),n.useEffect(()=>{p&&d(!1)},[p]),u)return l.createElement(t.Loader,null);const D=e=>{const t=new Date(e);return isNaN(t)?null:Math.floor(t.getTime()/1e3)},b=e=>{const t=String(e).replace(/,/g,""),n=parseFloat(t);return isNaN(n)?null:n},T=Ql;return l.createElement(t.FormComposer,{heading:o("AST_EDIT_ASSET"),label:o("ES_COMMON_APPLICATION_SUBMIT"),config:T.map(e=>v({},e,{body:e.body.filter(e=>!e.hideInEmployee)})),fieldStyle:{marginRight:0},cardStyle:{Width:60},onSubmit:e=>{var t,n,l,a,i,o,r,s,u,d,m,E,f,g,S,_,h,y,A,C,T,I,O,N,R,x,L,P,w,M,F,B,k,U,H,j,W,V,z,G,K,q,Y,$,Z,Q,X,J,ee,te,ne,le,ae,ie,oe,re,se,ue,de,ce,me,ve,pe,Ee,fe,ge,Se,_e,he,ye,Ae,Ce,De,be,Te,Ie,Oe,Ne,Re,xe,Le,Pe,we,Me,Fe,Be,ke,Ue,He,je,We,Ve,ze,Ge,Ke,qe,Ye,$e,Ze,Qe,Xe,Je;const et={accountId:null==p||null===(t=p.applicationData)||void 0===t||null===(n=t.applicationData)||void 0===n?void 0:n.accountId,tenantId:null==p||null===(l=p.applicationData)||void 0===l||null===(a=l.applicationData)||void 0===a?void 0:a.tenantId,assetBookRefNo:null==e||null===(i=e.editAssignDetails)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.BookPagereference,assetName:null==e||null===(r=e.editAssignDetails)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.AssetName,description:null==e||null===(u=e.editAssignDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.Assetdescription,assetClassification:null==e||null===(m=e.editAssignDetails)||void 0===m||null===(E=m[0])||void 0===E||null===(f=E.assetclassification)||void 0===f?void 0:f.code,assetParentCategory:null==e||null===(g=e.editAssignDetails)||void 0===g||null===(S=g[0])||void 0===S||null===(_=S.assettype)||void 0===_?void 0:_.code,assetCategory:null==e||null===(h=e.editAssignDetails)||void 0===h||null===(y=h[0])||void 0===y||null===(A=y.assetsubtype)||void 0===A?void 0:A.code,assetSubCategory:null==e||null===(C=e.editAssignDetails)||void 0===C||null===(T=C[0])||void 0===T||null===(I=T.assetparentsubCategory)||void 0===I?void 0:I.code,department:null==e||null===(O=e.editAssignDetails)||void 0===O||null===(N=O[0])||void 0===N||null===(R=N.Department)||void 0===R?void 0:R.code,assetType:null==e||null===(x=e.editAssignDetails)||void 0===x||null===(L=x[0])||void 0===L||null===(P=L.assetType)||void 0===P?void 0:P.code,assetUsage:null==e||null===(w=e.editAssignDetails)||void 0===w||null===(M=w[0])||void 0===M||null===(F=M.assetUsage)||void 0===F?void 0:F.code,modeOfPossessionOrAcquisition:null==e||null===(B=e.editAssignDetails)||void 0===B||null===(k=B[0])||void 0===k||null===(U=k.modeOfPossessionOrAcquisition)||void 0===U?void 0:U.code,invoiceDate:D(null==e||null===(H=e.editAssignDetails)||void 0===H||null===(j=H[0])||void 0===j?void 0:j.invoiceDate),invoiceNumber:null==e||null===(W=e.editAssignDetails)||void 0===W||null===(V=W[0])||void 0===V?void 0:V.invoiceNumber,purchaseDate:D(null==e||null===(z=e.editAssignDetails)||void 0===z||null===(G=z[0])||void 0===G?void 0:G.purchaseDate),purchaseOrderNumber:null==e||null===(K=e.editAssignDetails)||void 0===K||null===(q=K[0])||void 0===q?void 0:q.purchaseOrderNumber,lifeOfAsset:null==e||null===(Y=e.editAssignDetails)||void 0===Y||null===($=Y[0])||void 0===$?void 0:$.lifeOfAsset,location:null==e||null===(Z=e.editAssignDetails)||void 0===Z||null===(Q=Z[0])||void 0===Q?void 0:Q.location,purchaseCost:b(null==e||null===(X=e.editAssignDetails)||void 0===X||null===(J=X[0])||void 0===J?void 0:J.purchaseCost),acquisitionCost:b(null==e||null===(ee=e.editAssignDetails)||void 0===ee||null===(te=ee[0])||void 0===te?void 0:te.acquisitionCost),bookValue:b(null==e||null===(ne=e.editAssignDetails)||void 0===ne||null===(le=ne[0])||void 0===le?void 0:le.bookValue),financialYear:null==e||null===(ae=e.editAssignDetails)||void 0===ae||null===(ie=ae[0])||void 0===ie||null===(oe=ie.financialYear)||void 0===oe?void 0:oe.code,sourceOfFinance:null==e||null===(re=e.editAssignDetails)||void 0===re||null===(se=re[0])||void 0===se||null===(ue=se.sourceOfFinance)||void 0===ue?void 0:ue.code,applicationNo:null==p||null===(de=p.applicationData)||void 0===de||null===(ce=de.applicationData)||void 0===ce?void 0:ce.applicationNo,approvalDate:"",id:null==p||null===(me=p.applicationData)||void 0===me||null===(ve=me.applicationData)||void 0===ve?void 0:ve.id,applicationDate:"",status:null==p||null===(pe=p.applicationData)||void 0===pe||null===(Ee=pe.applicationData)||void 0===Ee?void 0:Ee.status,action:"",businessService:"asset-create",addressDetails:{addressLine1:null==p||null===(fe=p.applicationData)||void 0===fe||null===(ge=fe.applicationData)||void 0===ge||null===(Se=ge.addressDetails)||void 0===Se?void 0:Se.addressLine1,addressLine2:null==p||null===(_e=p.applicationData)||void 0===_e||null===(he=_e.applicationData)||void 0===he||null===(ye=he.addressDetails)||void 0===ye?void 0:ye.addressLine2,buildingName:null==p||null===(Ae=p.applicationData)||void 0===Ae||null===(Ce=Ae.applicationData)||void 0===Ce||null===(De=Ce.addressDetails)||void 0===De?void 0:De.buildingName,doorNo:null==p||null===(be=p.applicationData)||void 0===be||null===(Te=be.applicationData)||void 0===Te||null===(Ie=Te.addressDetails)||void 0===Ie?void 0:Ie.doorNo,street:null==p||null===(Oe=p.applicationData)||void 0===Oe||null===(Ne=Oe.applicationData)||void 0===Ne||null===(Re=Ne.addressDetails)||void 0===Re?void 0:Re.street,pincode:null==p||null===(xe=p.applicationData)||void 0===xe||null===(Le=xe.applicationData)||void 0===Le||null===(Pe=Le.addressDetails)||void 0===Pe?void 0:Pe.pincode,city:null==p||null===(we=p.applicationData)||void 0===we||null===(Me=we.applicationData)||void 0===Me||null===(Fe=Me.addressDetails)||void 0===Fe?void 0:Fe.city,locality:{code:null==p||null===(Be=p.applicationData)||void 0===Be||null===(ke=Be.applicationData)||void 0===ke||null===(Ue=ke.addressDetails)||void 0===Ue||null===(He=Ue.locality)||void 0===He?void 0:He.code,area:null==p||null===(je=p.applicationData)||void 0===je||null===(We=je.applicationData)||void 0===We||null===(Ve=We.addressDetails)||void 0===Ve||null===(ze=Ve.locality)||void 0===ze?void 0:ze.area,latitude:null==p||null===(Ge=p.applicationData)||void 0===Ge||null===(Ke=Ge.applicationData)||void 0===Ke||null===(qe=Ke.addressDetails)||void 0===qe?void 0:qe.latitude,longitude:null==p||null===(Ye=p.applicationData)||void 0===Ye||null===($e=Ye.applicationData)||void 0===$e||null===(Ze=$e.addressDetails)||void 0===Ze?void 0:Ze.longitude}},documents:null==p||null===(Qe=p.applicationData)||void 0===Qe||null===(Xe=Qe.applicationData)||void 0===Xe?void 0:Xe.documents,workflow:{action:"SUBMIT",businessService:"asset-create",moduleName:"asset-services"},additionalDetails:v({},null==e||null===(Je=e.editNewAssetDetails)||void 0===Je?void 0:Je[0],{acquisitionProcessionDetails:{}})};console.log("Form Data:- ",et),c.replace("/digit-ui/employee/asset/assetservice/edit-response",{Assets:et})},onFormValueChange:(e,t,n)=>{s(!Object.keys(n.errors).length)}})},EditGeneralDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),m=Digit.ULBService.getStateId(),[p,E]=n.useState((null==s?void 0:s.editAssignDetails)||[{financialYear:"",assetclassification:"",assettype:"",assetparentsubCategory:"",BookPagereference:"",AssetName:"",assetsubtype:"",Assetdescription:"",Department:"",sourceOfFinance:"",assetclassification:"",key:Date.now()}]),{id:f}=i.useParams(),g=Digit.ULBService.getCurrentTenantId(),{data:S}=Digit.Hooks.asset.useAssetApplicationDetail(c,g,f);let _=null==S||null===(t=S.applicationData)||void 0===t?void 0:t.applicationData;const[h,y]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,p)},[p]);const{data:A}=Digit.Hooks.asset.useAssetClassification(m,"ASSET","assetClassification"),{data:C}=Digit.Hooks.asset.useAssetType(m,"ASSET","assetParentCategory"),{data:D}=Digit.Hooks.asset.useAssetSubType(m,"ASSET","assetCategory"),{data:b}=Digit.Hooks.asset.useAssetparentSubType(m,"ASSET","assetSubCategory"),{data:T}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"SourceFinance"}],{select:e=>{var t;const n=null==e||null===(t=e.ASSET)||void 0===t?void 0:t.SourceFinance;return null==n?void 0:n.filter(e=>!0===e.active)}});let I=[];T&&T.map(e=>{I.push({i18nKey:"AST_"+e.code,code:""+e.code,value:""+e.name})});const{data:O}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"FinancialYear"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.FinancialYear}});let N=[];O&&O.map(e=>{N.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:R}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"Department"}],{select:e=>{var t;const n=null==e||null===(t=e["common-masters"])||void 0===t?void 0:t.Department;return null==n?void 0:n.filter(e=>!0===e.active)}});let x=[];R&&R.map(e=>{x.push({i18nKey:"COMMON_MASTERS_DEPARTMENT_"+e.code,code:""+e.code,value:"COMMON_MASTERS_DEPARTMENT_"+e.code})});const{data:L}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetType"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetType}});let P=[];L&&L.map(e=>{P.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:w}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"AssetUsage"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.AssetUsage}});let M=[];w&&w.map(e=>{M.push({i18nKey:""+e.code,code:""+e.code,value:""+e.name})});const{data:F}=Digit.Hooks.useCustomMDMSV2(Digit.ULBService.getStateId(),"ASSET",[{name:"ModeOfPossessionOrAcquisition"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.ModeOfPossessionOrAcquisition}});let B=[];F&&F.map(e=>{B.push({i18nKey:""+e.code,code:""+e.code,name:""+e.name})});let k=[],U=[],H=[],j=[];A&&A.map(e=>{k.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),C&&C.map(e=>{var t,n;e.assetClassification==(null==p||null===(t=p[0])||void 0===t||null===(n=t.assetclassification)||void 0===n?void 0:n.code)&&U.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),D&&D.map(e=>{var t,n;e.assetParentCategory==(null==p||null===(t=p[0])||void 0===t||null===(n=t.assettype)||void 0===n?void 0:n.code)&&H.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})}),b&&b.map(e=>{var t,n;e.assetCategory==(null==p||null===(t=p[0])||void 0===t||null===(n=t.assetsubtype)||void 0===n?void 0:n.code)&&j.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const W={focusIndex:h,allAssets:p,setFocusIndex:y,formData:s,seteditAssignDetails:E,t:c,setError:u,clearErrors:d,config:o,menu_Asset:k,asset_type:U,asset_sub_type:H,asset_parent_sub_category:j,departNamefromMDMS:x,financal:N,sourcefinance:I,comingDataFromAPI:_,assetType:P,assetCurrentUsage:M,modeOfAcquisition:B};return l.createElement(l.Fragment,null,p.map((e,t)=>l.createElement(Jl,v({key:e.key,index:t,editAssignDetails:e},W))))},EditAssetDetails:e=>{var t;let{config:o,onSelect:r,formData:s,setError:u,clearErrors:d}=e;const{t:c}=a.useTranslation(),[m,p]=n.useState((null==s?void 0:s.editNewAssetDetails)||[{key:Date.now()}]),{id:E}=i.useParams(),f=Digit.ULBService.getCurrentTenantId(),{data:g}=Digit.Hooks.asset.useAssetApplicationDetail(c,f,E);let S=null==g||null===(t=g.applicationData)||void 0===t?void 0:t.applicationData;const[_,h]=n.useState({index:-1,type:""});n.useEffect(()=>{r(null==o?void 0:o.key,m)},[m]);const{data:y}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"ASSET",[{name:"Warranty"}],{select:e=>{var t;return null==e||null===(t=e.ASSET)||void 0===t?void 0:t.Warranty}});let A=[];y&&y.map(e=>{A.push({i18nKey:""+e.name,code:""+e.code,value:""+e.name})});const C={focusIndex:_,allAssets:m,setFocusIndex:h,formData:s,seteditAssignDetails:p,t:c,setError:u,clearErrors:d,config:o,comingDataFromAPI:S,warrantyTime:A};return l.createElement(l.Fragment,null,m.map((e,t)=>l.createElement(ea,v({key:e.key,index:t,editNewAssetDetails:e},C))))},editResponse:e=>{var o,r,s;const{t:u}=a.useTranslation(),c=d.useQueryClient(),[m,v]=(i.useHistory(),n.useState(null)),[p,E]=n.useState(null),[f,g]=n.useState(!1),[S,_,h]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_HAPPENED",!1),[y,A,C]=Digit.Hooks.useSessionStorage("EMPLOYEE_MUTATION_SUCCESS_DATA",!1),D=Digit.ULBService.getCurrentTenantId(),{state:b}=e.location,T=Digit.Hooks.asset.useEditUpdateAPI(D,"UPDATE"!==b.key),I=Digit.Hooks.asset.useEditUpdateAPI(D,!1);return n.useEffect(()=>{I.data&&I.isSuccess&&A(I.data)},[T.data]),n.useEffect(()=>{I.data&&I.isSuccess&&A(I.data)},[I.data]),n.useEffect(()=>{S||T.mutate({Asset:null==b?void 0:b.Assets},{onError:(e,t)=>{var n,l,a;E({key:"error"}),v((null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors[0])||void 0===a?void 0:a.message)||null)},onSuccess:function(e){try{var t;return _(!0),c.clear(),"successful"===(null==e||null===(t=e.ResponseInfo)||void 0===t?void 0:t.status)&&g(!0),Promise.resolve()}catch(e){return Promise.reject(e)}}})},[]),T.isLoading||T.isIdle&&!S?l.createElement(t.Loader,null):l.createElement("div",null,l.createElement(t.Card,null,l.createElement(la,{t:u,data:(null==T?void 0:T.data)||y,action:null==b?void 0:b.action,isSuccess:!!Object.keys(y||{}).length||(null==T?void 0:T.isSuccess),isLoading:T.isIdle&&!S||(null==T?void 0:T.isLoading),isEmployee:e.parentRoute.includes("employee")})),p&&l.createElement(t.Toast,{error:"error"===p.key,label:m,onClose:()=>{E(null),v(null)}}),l.createElement(t.ActionBar,null,l.createElement(i.Link,{to:""+(!!e.parentRoute.includes("employee")&&"/digit-ui/employee/asset/assetservice/applicationsearch/application-details/"+(null==T||null===(o=T.data)||void 0===o||null===(r=o.Assets)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.applicationNo))},l.createElement(t.SubmitBar,{label:u("MY_APPLICATIONS")}))))}},ia=e=>{let{stateCode:t,userType:a,tenants:o}=e;const{path:r,url:s}=i.useRouteMatch(),u=Digit.StoreData.getCurrentLanguage();return Digit.Services.useStore({stateCode:t,moduleCode:"ASSET",language:u}),Object.entries(aa).forEach(e=>{let[t,n]=e;Digit.ComponentRegistryService.setComponent(t,n)}),Digit.SessionStorage.set("ASSET_TENANTS",o),n.useEffect(()=>"employee"===a&&Digit.LocalizationService.getLocale({modules:["rainmaker-"+Digit.ULBService.getCurrentTenantId()],locale:Digit.StoreData.getCurrentLanguage(),tenantId:Digit.ULBService.getCurrentTenantId()}),[]),"employee"===a?l.createElement(F,{path:r,url:s,userType:a}):l.createElement(CitizenApp,null)},oa=e=>{a.useTranslation();const[t,l,i]=Digit.Hooks.useSessionStorage("ASSET",{});return n.useEffect(()=>{i()},[]),null};exports.ASSETComponents={ASSETCard:()=>{const{t:e}=a.useTranslation(),[i,o]=n.useState("-"),{data:r,isLoading:s,isFetching:u,isSuccess:d}=Digit.Hooks.useNewInboxGeneral({tenantId:Digit.ULBService.getCurrentTenantId(),ModuleCode:"ASSET",filters:{limit:10,offset:0,services:["asset-create"]},config:{select:e=>({totalCount:null==e?void 0:e.totalCount,nearingSlaCount:null==e?void 0:e.nearingSlaCount}||"0"),enabled:Digit.Utils.assetAccess()}});if(n.useEffect(()=>{!u&&d&&o(r)},[u]),!Digit.Utils.assetAccess())return null;const c=[{count:s?"0":null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"},{label:e("ASSET_ADD"),link:"/digit-ui/employee/asset/assetservice/new-assets",role:"ASSET_INITIATOR"},{label:e("MY_ASSET_APPLICATION"),link:"/digit-ui/employee/asset/assetservice/my-asset"}],m=Digit.UserService.hasAccess(["ASSET_INITIATOR"])||!1,v={moduleName:e("TITLE_ASSET_MANAGEMENT"),kpis:[{count:null==i?void 0:i.totalCount,label:e("Inbox"),link:"/digit-ui/employee/asset/assetservice/inbox"}],links:c.filter(e=>!(null!=e&&e.role)||m)};return l.createElement(t.EmployeeModuleCard,v)},ASSETModule:ia,ASSETLinks:oa,AST_INBOX_FILTER:e=>l.createElement(V,e),ASTInboxTableConfig:e=>({ASSET:{inboxColumns:t=>[{Header:e("ES_ASSET_RESPONSE_CREATE_LABEL"),Cell:e=>{var n,a,o,r;let{row:s}=e;return l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:t.parentRoute+"/assetservice/application-details/"+(null==s||null===(n=s.original)||void 0===n||null===(a=n.searchData)||void 0===a?void 0:a.applicationNo)},null===(o=s.original)||void 0===o||null===(r=o.searchData)||void 0===r?void 0:r.applicationNo)))},mobileCell:e=>{var t;return Nl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}},{Header:e("AST_ASSET_CATEGORY_LABEL"),Cell:e=>{var t,n,l,a;return Ol(""+(null==e||null===(t=e.cell)||void 0===t||null===(n=t.row)||void 0===n||null===(l=n.original)||void 0===l||null===(a=l.searchData)||void 0===a?void 0:a.assetClassification))},mobileCell:e=>{var t;return Nl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetClassification)}},{Header:e("AST_PARENT_CATEGORY_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return Ol(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetParentCategory))},mobileCell:e=>{var t;return Nl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetParentCategory)}},{Header:e("AST_NAME_LABEL"),Cell:e=>{var t,n;let{row:l}=e;return Ol(""+(null===(t=l.original)||void 0===t||null===(n=t.searchData)||void 0===n?void 0:n.assetName))},mobileCell:e=>{var t;return Nl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.assetName)}},{Header:e("AST_DEPARTMENT_LABEL"),Cell:t=>{var n,l;let{row:a}=t;return Ol(e("COMMON_MASTERS_DEPARTMENT_"+(null==a||null===(n=a.original)||void 0===n||null===(l=n.searchData)||void 0===l?void 0:l.department)))},mobileCell:t=>{var n;return Nl(e("AST_COMMON_STATUS_"+(null==t||null===(n=t.searchData)||void 0===n?void 0:n.department)))}},{Header:e("AST_ACTION"),Cell:n=>{var a,o,r,s,u,d,c,m,v;let{row:p}=n;return l.createElement("div",null,l.createElement("span",{className:"link"},"APPROVED"===(null==p||null===(a=p.original)||void 0===a||null===(o=a.searchData)||void 0===o?void 0:o.status)?null!=p&&null!==(r=p.original)&&void 0!==r&&null!==(s=r.searchData)&&void 0!==s&&null!==(u=s.assetAssignment)&&void 0!==u&&u.isAssigned?l.createElement(i.Link,{to:t.parentRoute+"/assetservice/return-assets/"+(null==p||null===(d=p.original)||void 0===d||null===(c=d.searchData)||void 0===c?void 0:c.applicationNo)},e("AST_RETURN")):l.createElement(i.Link,{to:t.parentRoute+"/assetservice/assign-assets/"+(null==p||null===(m=p.original)||void 0===m||null===(v=m.searchData)||void 0===v?void 0:v.applicationNo)},e("AST_ASSIGN")):e("AST_SHOULD_BE_APPROVED_FIRST")))},mobileCell:e=>{var t;return Nl(null==e||null===(t=e.searchData)||void 0===t?void 0:t.applicationNo)}}],serviceRequestIdKey:t=>{var n,l;return null==t||null===(n=t[e("AST_INBOX_UNIQUE_APPLICATION_NUMBER")])||void 0===n||null===(l=n.props)||void 0===l?void 0:l.children}}})},exports.ASSETLinks=oa,exports.ASSETModule=ia;