@djb25/digit-ui-module-ws 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +586 -380
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7,4 +7,4 @@ var e,t=require("react"),l=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
var eo="function"==typeof Symbol&&Symbol.for,no=eo?Symbol.for("react.element"):60103,to=eo?Symbol.for("react.portal"):60106,lo=eo?Symbol.for("react.fragment"):60107,oo=eo?Symbol.for("react.strict_mode"):60108,io=eo?Symbol.for("react.profiler"):60114,ao=eo?Symbol.for("react.provider"):60109,ro=eo?Symbol.for("react.context"):60110,uo=eo?Symbol.for("react.async_mode"):60111,so=eo?Symbol.for("react.concurrent_mode"):60111,co=eo?Symbol.for("react.forward_ref"):60112,vo=eo?Symbol.for("react.suspense"):60113,po=eo?Symbol.for("react.suspense_list"):60120,mo=eo?Symbol.for("react.memo"):60115,Eo=eo?Symbol.for("react.lazy"):60116,So=eo?Symbol.for("react.block"):60121,_o=eo?Symbol.for("react.fundamental"):60117,fo=eo?Symbol.for("react.responder"):60118,go=eo?Symbol.for("react.scope"):60119;function Co(e){if("object"==typeof e&&null!==e){var n=e.$$typeof;switch(n){case no:switch(e=e.type){case uo:case so:case lo:case io:case oo:case vo:return e;default:switch(e=e&&e.$$typeof){case ro:case co:case Eo:case mo:case ao:return e;default:return n}}case to:return n}}}function No(e){return Co(e)===so}var yo={AsyncMode:uo,ConcurrentMode:so,ContextConsumer:ro,ContextProvider:ao,Element:no,ForwardRef:co,Fragment:lo,Lazy:Eo,Memo:mo,Portal:to,Profiler:io,StrictMode:oo,Suspense:vo,isAsyncMode:function(e){return No(e)||Co(e)===uo},isConcurrentMode:No,isContextConsumer:function(e){return Co(e)===ro},isContextProvider:function(e){return Co(e)===ao},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===no},isForwardRef:function(e){return Co(e)===co},isFragment:function(e){return Co(e)===lo},isLazy:function(e){return Co(e)===Eo},isMemo:function(e){return Co(e)===mo},isPortal:function(e){return Co(e)===to},isProfiler:function(e){return Co(e)===io},isStrictMode:function(e){return Co(e)===oo},isSuspense:function(e){return Co(e)===vo},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===lo||e===so||e===io||e===oo||e===vo||e===po||"object"==typeof e&&null!==e&&(e.$$typeof===Eo||e.$$typeof===mo||e.$$typeof===ao||e.$$typeof===ro||e.$$typeof===co||e.$$typeof===_o||e.$$typeof===fo||e.$$typeof===go||e.$$typeof===So)},typeOf:Co},Do=F(function(e,n){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,r=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,d=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,v=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,S=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,f=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function C(e){if("object"==typeof e&&null!==e){var n=e.$$typeof;switch(n){case t:var p=e.type;switch(p){case d:case s:case o:case a:case i:case v:return p;default:var S=p&&p.$$typeof;switch(S){case u:case c:case E:case m:case r:return S;default:return n}}case l:return n}}}var N=s,y=u,D=r,T=t,h=c,A=o,I=E,O=m,b=l,L=a,R=i,w=v,W=!1;function P(e){return C(e)===s}n.AsyncMode=d,n.ConcurrentMode=N,n.ContextConsumer=y,n.ContextProvider=D,n.Element=T,n.ForwardRef=h,n.Fragment=A,n.Lazy=I,n.Memo=O,n.Portal=b,n.Profiler=L,n.StrictMode=R,n.Suspense=w,n.isAsyncMode=function(e){return W||(W=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(e)||C(e)===d},n.isConcurrentMode=P,n.isContextConsumer=function(e){return C(e)===u},n.isContextProvider=function(e){return C(e)===r},n.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},n.isForwardRef=function(e){return C(e)===c},n.isFragment=function(e){return C(e)===o},n.isLazy=function(e){return C(e)===E},n.isMemo=function(e){return C(e)===m},n.isPortal=function(e){return C(e)===l},n.isProfiler=function(e){return C(e)===a},n.isStrictMode=function(e){return C(e)===i},n.isSuspense=function(e){return C(e)===v},n.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===s||e===a||e===i||e===v||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===m||e.$$typeof===r||e.$$typeof===u||e.$$typeof===c||e.$$typeof===_||e.$$typeof===f||e.$$typeof===g||e.$$typeof===S)},n.typeOf=C}()}),To=F(function(e){e.exports="production"===process.env.NODE_ENV?yo:Do}),ho=Object.getOwnPropertySymbols,Ao=Object.prototype.hasOwnProperty,Io=Object.prototype.propertyIsEnumerable;function Oo(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var bo=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,n){for(var t,l,o=Oo(e),i=1;i<arguments.length;i++){for(var a in t=Object(arguments[i]))Ao.call(t,a)&&(o[a]=t[a]);if(ho){l=ho(t);for(var r=0;r<l.length;r++)Io.call(t,l[r])&&(o[l[r]]=t[l[r]])}}return o},Lo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ro=Function.call.bind(Object.prototype.hasOwnProperty),wo=function(){};if("production"!==process.env.NODE_ENV){var Wo=Lo,Po={},Mo=Ro;wo=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}}function xo(e,n,t,l,o){if("production"!==process.env.NODE_ENV)for(var i in e)if(Mo(e,i)){var a;try{if("function"!=typeof e[i]){var r=Error((l||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}a=e[i](n,i,l,t,null,Wo)}catch(e){a=e}if(!a||a instanceof Error||wo((l||"React class")+": type specification of "+t+" `"+i+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in Po)){Po[a.message]=!0;var u=o?o():"";wo("Failed "+t+" type: "+a.message+(null!=u?u:""))}}}xo.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Po={})};var Bo=xo,Fo=function(){};function Uo(){return null}function ko(){}function Ho(){}"production"!==process.env.NODE_ENV&&(Fo=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}),Ho.resetWarningCache=ko;var jo=F(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,n){var t="function"==typeof Symbol&&Symbol.iterator,l={array:r("array"),bigint:r("bigint"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),symbol:r("symbol"),any:a(Uo),arrayOf:function(e){return a(function(n,t,l,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=n[t];if(!Array.isArray(r))return new i("Invalid "+o+" `"+a+"` of type `"+s(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var d=e(r,u,l,o,a+"["+u+"]",Lo);if(d instanceof Error)return d}return null})},element:a(function(n,t,l,o,a){var r=n[t];return e(r)?null:new i("Invalid "+o+" `"+a+"` of type `"+s(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:a(function(e,n,t,l,o){var a=e[n];return To.isValidElementType(a)?null:new i("Invalid "+l+" `"+o+"` of type `"+s(a)+"` supplied to `"+t+"`, expected a single ReactElement type.")}),instanceOf:function(e){return a(function(n,t,l,o,a){var r;return n[t]instanceof e?null:new i("Invalid "+o+" `"+a+"` of type `"+((r=n[t]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:a(function(e,n,t,l,o){return d(e[n])?null:new i("Invalid "+l+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}),objectOf:function(e){return a(function(n,t,l,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=n[t],u=s(r);if("object"!==u)return new i("Invalid "+o+" `"+a+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var d in r)if(Ro(r,d)){var c=e(r,d,l,o,a+"."+d,Lo);if(c instanceof Error)return c}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Fo(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),Uo;function n(n,t,l,a,r){for(var u=n[t],d=0;d<e.length;d++)if(o(u,e[d]))return null;var s=JSON.stringify(e,function(e,n){return"symbol"===c(n)?String(n):n});return new i("Invalid "+a+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+s+".")}return a(n)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Fo("Invalid argument supplied to oneOfType, expected an instance of array."),Uo;for(var n=0;n<e.length;n++){var t=e[n];if("function"!=typeof t)return Fo("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+v(t)+" at index "+n+"."),Uo}return a(function(n,t,l,o,a){for(var r=[],u=0;u<e.length;u++){var d=(0,e[u])(n,t,l,o,a,Lo);if(null==d)return null;d.data&&Ro(d.data,"expectedType")&&r.push(d.data.expectedType)}return new i("Invalid "+o+" `"+a+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return a(function(n,t,l,o,a){var r=n[t],d=s(r);if("object"!==d)return new i("Invalid "+o+" `"+a+"` of type `"+d+"` supplied to `"+l+"`, expected `object`.");for(var v in e){var p=e[v];if("function"!=typeof p)return u(l,o,a,v,c(p));var m=p(r,v,l,o,a+"."+v,Lo);if(m)return m}return null})},exact:function(e){return a(function(n,t,l,o,a){var r=n[t],d=s(r);if("object"!==d)return new i("Invalid "+o+" `"+a+"` of type `"+d+"` supplied to `"+l+"`, expected `object`.");var v=bo({},n[t],e);for(var p in v){var m=e[p];if(Ro(e,p)&&"function"!=typeof m)return u(l,o,a,p,c(m));if(!m)return new i("Invalid "+o+" `"+a+"` key `"+p+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(n[t],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=m(r,p,l,o,a+"."+p,Lo);if(E)return E}return null})}};function o(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}function i(e,n){this.message=e,this.data=n&&"object"==typeof n?n:{},this.stack=""}function a(e){function n(n,t,l,o,a,r,u){if(o=o||"<<anonymous>>",r=r||l,u!==Lo){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}return null==t[l]?n?new i(null===t[l]?"The "+a+" `"+r+"` is marked as required in `"+o+"`, but its value is `null`.":"The "+a+" `"+r+"` is marked as required in `"+o+"`, but its value is `undefined`."):null:e(t,l,o,a,r)}process;var t=n.bind(null,!1);return t.isRequired=n.bind(null,!0),t}function r(e){return a(function(n,t,l,o,a,r){var u=n[t];return s(u)!==e?new i("Invalid "+o+" `"+a+"` of type `"+c(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,n,t,l,o){return new i((e||"React class")+": "+n+" type `"+t+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function d(n){switch(typeof n){case"number":case"string":case"undefined":return!0;case"boolean":return!n;case"object":if(Array.isArray(n))return n.every(d);if(null===n||e(n))return!0;var l=function(e){var n=e&&(t&&e[t]||e["@@iterator"]);if("function"==typeof n)return n}(n);if(!l)return!1;var o,i=l.call(n);if(l!==n.entries){for(;!(o=i.next()).done;)if(!d(o.value))return!1}else for(;!(o=i.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function s(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,n){return"symbol"===e||!!n&&("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}(n,e)?"symbol":n}function c(e){if(null==e)return""+e;var n=s(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function v(e){var n=c(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}return i.prototype=Error.prototype,l.checkPropTypes=Bo,l.resetWarningCache=Bo.resetWarningCache,l.PropTypes=l,l}(To.isElement):function(){function e(e,n,t,l,o,i){if(i!==Lo){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function n(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:Ho,resetWarningCache:ko};return t.PropTypes=t,t}()});const Vo=e=>{var n;let{config:r,formData:u}=e;const{t:d}=o.useTranslation();let s={};const c=i.useHistory(),p=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser(),[E,S]=t.useState((null==u?void 0:u.mobileNumber)||""),[_,f]=t.useState((null==u?void 0:u.consumerNumber)||""),[g,C]=t.useState((null==u?void 0:u.oldconsumerNumber)||""),[N,y]=t.useState((null==u?void 0:u.doorNumber)||""),[D,T]=t.useState((null==u?void 0:u.propertyId)||""),[h,A]=t.useState((null==u?void 0:u.consumerName)||""),[I,O]=t.useState((null==u?void 0:u.Servicecateogry)||""),[b,L]=t.useState((null==u?void 0:u.city)||""),[R,w]=t.useState(null),[W,P]=t.useState((null==u?void 0:u.locality)||""),[M,x]=t.useState((null==u?void 0:u.searchType)||{code:"CONSUMER_NUMBER",i18nKey:"WS_CONSUMER_NUMBER_SEARCH"}),B=null===(n=Digit.Hooks.ws.usewsTenants())||void 0===n?void 0:n.sort((e,n)=>{var t,l;return null==e||null===(t=e.i18nKey)||void 0===t||null===(l=t.localeCompare)||void 0===l?void 0:l.call(t,null==n?void 0:n.i18nKey)}),[F,U]=t.useState(null);let k={};const{isLoading:H}=Digit.Hooks.mcollect.useMCollectMDMS(p,"BillingService","BusinessService"),{data:j}=Digit.Hooks.pt.useMDMS(Digit.ULBService.getStateId(),"DIGIT-UI","HelpText",{select:e=>{var n,t,l;return null==e||null===(n=e["DIGIT-UI"])||void 0===n||null===(t=n.HelpText)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.PT}});return H?l.createElement(a.Loader,null):l.createElement("div",{style:{marginTop:"16px"}},l.createElement(a.FormStep,{config:r,label:r.texts.submitButtonLabel,heading:r.texts.header,text:r.texts.text,cardStyle:{margin:"auto",maxWidth:"960px"},headingStyle:{fontSize:"32px",marginBottom:"16px"},onSelect:function(e){try{const e=function(){if("CONSUMER_NUMBER"===M.code)b.code?E||_||g||D?c.push("/digit-ui/citizen/ws/search-results?mobileNumber="+E+"&consumerNumber="+_+"&oldconsumerNumber="+g+"&propertyId="+D+"&tenantId="+b.code+"&locality="+void 0):w({key:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"}):w({key:!0,label:"WS_PLEASE_PROVIDE_CITY"});else{const e=function(){if(b.code){const e=function(){if(null!=m||W){const e=function(){if(N||h)return"undefined"!==W&&(k.locality=null==W?void 0:W.code),N&&(k.doorNo=N),h&&(k.ownerName=h),k=v({},k,{searchType:"CONNECTION"}),Promise.resolve(Digit.WSService.search({tenantId:null==b?void 0:b.code,filters:v({},k),businessService:"WS"})).then(function(e){return Promise.resolve(Digit.WSService.search({tenantId:null==b?void 0:b.code,filters:v({},k),businessService:"SW"})).then(function(n){null!=j&&j.maxResultValidation&&(null==e?void 0:e.TotalCount)+(null==n?void 0:n.TotalCount)>(null==j?void 0:j.maxPropertyResult)?w({key:!0,label:"Refine your search"}):c.push("/digit-ui/citizen/ws/search-results?doorNumber="+N+"&consumerName="+h+"&tenantId="+b.code+"&locality="+W.code)})});w({key:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"})}();if(e&&e.then)return e.then(function(){})}else w({key:!0,label:"WS_PLEASE_PROVIDE_LOCALITY"})}();if(e&&e.then)return e.then(function(){})}else w({key:!0,label:"WS_PLEASE_PROVIDE_CITY"})}();if(e&&e.then)return e.then(function(){})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),isDisabled:!1,forcedError:d(F),t:d},l.createElement(a.RadioOrSelect,v({className:"form-field",isMandatory:!0,t:d,optionKey:"code",name:"SearchType",options:[{code:"CONSUMER_NUMBER",i18nKey:"WS_CONSUMER_NUMBER_SEARCH"},{code:"CONNECTION_DETAILS",i18nKey:"WS_CONNECTION_DETAILS_SEARCH"}],value:M,selectedOption:M,onSelect:function(e){x(e)}},s={isRequired:!0,title:d("WS_SEARCH_TYPE_MANDATORY")})),l.createElement(a.CardLabel,null,d("WS_PROP_DETAIL_CITY")+"*"),l.createElement(a.RadioOrSelect,v({className:"form-field",isMandatory:!0,t:d,optionKey:"code",name:"City",options:B,value:b,selectedOption:b,onSelect:function(e){L(e),P("")}},s={isRequired:!0,title:d("UC_CITY_MANDATORY")})),b&&M&&"CONNECTION_DETAILS"==(null==M?void 0:M.code)&&l.createElement(a.CardLabel,null,d("WS_PROP_DETAIL_LOCALITY_LABEL")+"*"),b&&M&&"CONNECTION_DETAILS"==(null==M?void 0:M.code)&&l.createElement(a.Localities,{selectLocality:function(e){P(e)},tenantId:null==b?void 0:b.code,boundaryType:"revenue",keepNull:!1,optionCardStyles:{height:"600px",overflow:"auto",zIndex:"10"},selected:W,disableLoader:!1}),M&&"CONSUMER_NUMBER"==(null==M?void 0:M.code)&&l.createElement("div",{style:{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"}},l.createElement(a.CardText,null,d("WS_SEARCH_TEXT")),l.createElement(a.CardLabel,null,""+d("WS_CONSUMER_NUMBER_LABEL")),l.createElement("div",{className:"field-container"},l.createElement("span",{className:"employee-card-input employee-card-input--front",style:{marginTop:"-1px"}},"+91"),l.createElement(a.TextInput,v({type:"mobileNumber",style:{background:"#FAFAFA",maxWidth:"500px"},t:d,isMandatory:!1,optionKey:"i18nKey",name:"mobileNumber",value:E,onChange:function(e){U(null),e.target.value.match("^\\d{10}$")||U("CORE_COMMON_PHONENO_INVALIDMSG"),S(e.target.value)}},s={isRequired:!1,pattern:"[6-9]{1}[0-9]{9}",type:"tel",title:d("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID")}))),l.createElement(a.CardLabel,{style:{textAlign:"center",color:"#505A5F"}},""+d("(or)")),l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(a.CardLabel,null,""+d("WS_MYCONNECTIONS_CONSUMER_NO")),l.createElement(a.InfoBannerIcon,{fill:"#0b0c0c"}),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"70%",marginLeft:"50%",fontSize:"medium"}},d("WS_CONSUMER_NO_DESCRIPTION")+" "+d("WS_CONSUMER_NO_FORMAT")))),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"consumerNumber",value:_,onChange:function(e){f(e.target.value)}},s={isRequired:!1,pattern:"[A-Za-z]{2}/[0-9]{3,4}/[0-9]{4}-[0-9]{2}/[0-9]{6}",type:"text",title:d("ERR_INVALID_CONSUMER_NO")})),l.createElement(a.CardLabel,{style:{textAlign:"center",color:"#505A5F"}},""+d("(or)")),l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(a.CardLabel,null,""+d("WS_SEARCH_CONNNECTION_OLD_CONSUMER_LABEL")),l.createElement(a.InfoBannerIcon,{fill:"#0b0c0c"}),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"55%",marginLeft:"50%",fontSize:"medium"}},d("WS_CONSUMER_NO_DESCRIPTION")+" "+d("WS_CONSUMER_NO_FORMAT")))),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"oldconsumerNumber",value:g,onChange:function(e){C(e.target.value)}},s={isRequired:!1,pattern:"[A-Za-z]{2}/[0-9]{3}/[0-9]{4}-[0-9]{2}/[0-9]{6}",type:"text",title:d("ERR_INVALID_CONSUMER_NO")})),l.createElement(a.CardLabel,{style:{textAlign:"center",color:"#505A5F"}},""+d("(or)")),l.createElement(a.CardLabel,null,""+d("WS_PROPERTY_ID_LABEL")),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"propertyId",value:D,onChange:function(e){T(e.target.value)}},s={isRequired:!1,pattern:"[A-Za-z]{2}-[A-Za-z]{2}-[0-9]{4}-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}|[A-Za-z]{2}-[A-Za-z]{2}-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}",type:"text",title:d("ERR_INVALID_PROPERTY_ID")}))),M&&"CONNECTION_DETAILS"==(null==M?void 0:M.code)&&l.createElement("div",{style:{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"}},l.createElement(a.CardText,null,d("WS_SEARCH_TEXT")),l.createElement(a.CardLabel,null,""+d("WS_DOOR_NO_LABEL")),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"doorNumber",value:N,onChange:function(e){y(e.target.value)}},s={isRequired:!1,pattern:"^([1-9][0-9]*)$",type:"text",title:d("ERR_INVALID_DOOR_NO")})),l.createElement(a.CardLabel,null,""+d("WS_CONSUMER_NAME_LABEL")),l.createElement(a.TextInput,{t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"consumerName",value:h,onChange:function(e){A(e.target.value)}}))),R&&l.createElement(a.Toast,{isDleteBtn:!0,error:R.key,label:d(R.label),onClose:()=>{w(null)}}))};Vo.propTypes={loginParams:jo.any},Vo.defaultProps={loginParams:null};const zo=[{texts:{header:"CS_SEARCH_RESULTS",actionButtonLabel:"WS_VIEW_DETAILS_AND_PAY"},labels:[{label:"WS_COMMON_TABLE_COL_AMT_DUE_LABEL",key:"AmountDue",noteStyle:{fontSize:"24px",fontWeight:"bold"},notePrefix:"₹ "},{label:"WS_MYCONNECTIONS_CONSUMER_NO",key:"ConsumerNumber"},{label:"WS_CONSUMER_NAME_LABEL",key:"ConsumerName"},{label:"WS_MYCONNECTION_ADDRESS",key:"Address"},{label:"WS_VIEW_BILL_DUE_DATE_LABEL",key:"DueDate"}]}];var Yo=function(e,n){return function(){for(var t=new Array(arguments.length),l=0;l<t.length;l++)t[l]=arguments[l];return e.apply(n,t)}},Go=Object.prototype.toString;function qo(e){return"[object Array]"===Go.call(e)}function Ko(e){return void 0===e}function Xo(e){return null!==e&&"object"==typeof e}function Zo(e){if("[object Object]"!==Go.call(e))return!1;var n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}function $o(e){return"[object Function]"===Go.call(e)}function Jo(e,n){if(null!=e)if("object"!=typeof e&&(e=[e]),qo(e))for(var t=0,l=e.length;t<l;t++)n.call(null,e[t],t,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.call(null,e[o],o,e)}var Qo={isArray:qo,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Go.call(e)},isBuffer:function(e){return null!==e&&!Ko(e)&&null!==e.constructor&&!Ko(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Xo,isPlainObject:Zo,isUndefined:Ko,isDate:function(e){return"[object Date]"===Go.call(e)},isFile:function(e){return"[object File]"===Go.call(e)},isBlob:function(e){return"[object Blob]"===Go.call(e)},isFunction:$o,isStream:function(e){return Xo(e)&&$o(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:Jo,merge:function e(){var n={};function t(t,l){n[l]=Zo(n[l])&&Zo(t)?e(n[l],t):Zo(t)?e({},t):qo(t)?t.slice():t}for(var l=0,o=arguments.length;l<o;l++)Jo(arguments[l],t);return n},extend:function(e,n,t){return Jo(n,function(n,l){e[l]=t&&"function"==typeof n?Yo(n,t):n}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function ei(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ni=function(e,n,t){if(!n)return e;var l;if(t)l=t(n);else if(Qo.isURLSearchParams(n))l=n.toString();else{var o=[];Qo.forEach(n,function(e,n){null!=e&&(Qo.isArray(e)?n+="[]":e=[e],Qo.forEach(e,function(e){Qo.isDate(e)?e=e.toISOString():Qo.isObject(e)&&(e=JSON.stringify(e)),o.push(ei(n)+"="+ei(e))}))}),l=o.join("&")}if(l){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+l}return e};function ti(){this.handlers=[]}ti.prototype.use=function(e,n){return this.handlers.push({fulfilled:e,rejected:n}),this.handlers.length-1},ti.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ti.prototype.forEach=function(e){Qo.forEach(this.handlers,function(n){null!==n&&e(n)})};var li=ti,oi=function(e,n,t){return Qo.forEach(t,function(t){e=t(e,n)}),e},ii=function(e){return!(!e||!e.__CANCEL__)},ai=function(e,n){Qo.forEach(e,function(t,l){l!==n&&l.toUpperCase()===n.toUpperCase()&&(e[n]=t,delete e[l])})},ri=function(e,n,t,l,o){return function(e,n,t,l,o){return e.config=n,t&&(e.code=t),e.request=l,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),n,t,l,o)},ui=Qo.isStandardBrowserEnv()?{write:function(e,n,t,l,o,i){var a=[];a.push(e+"="+encodeURIComponent(n)),Qo.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),Qo.isString(l)&&a.push("path="+l),Qo.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},di=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],si=Qo.isStandardBrowserEnv()?function(){var e,n=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");function l(e){var l=e;return n&&(t.setAttribute("href",l),l=t.href),t.setAttribute("href",l),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return e=l(window.location.href),function(n){var t=Qo.isString(n)?l(n):n;return t.protocol===e.protocol&&t.host===e.host}}():function(){return!0},ci={"Content-Type":"application/x-www-form-urlencoded"};function vi(e,n){!Qo.isUndefined(e)&&Qo.isUndefined(e["Content-Type"])&&(e["Content-Type"]=n)}var pi,mi={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(pi=function(e){return new Promise(function(n,t){var l=e.data,o=e.headers;Qo.isFormData(l)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+r)}var u,d,s=(d=e.url,(u=e.baseURL)&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(d)?function(e,n){return n?e.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):e}(u,d):d);if(i.open(e.method.toUpperCase(),ni(s,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var l,o,a,r,u,d="getAllResponseHeaders"in i?(l=i.getAllResponseHeaders(),u={},l?(Qo.forEach(l.split("\n"),function(e){if(r=e.indexOf(":"),o=Qo.trim(e.substr(0,r)).toLowerCase(),a=Qo.trim(e.substr(r+1)),o){if(u[o]&&di.indexOf(o)>=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([a]):u[o]?u[o]+", "+a:a}}),u):u):null;!function(e,n,t){var l=t.config.validateStatus;t.status&&l&&!l(t.status)?n(ri("Request failed with status code "+t.status,t.config,null,t.request,t)):e(t)}(n,t,{data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:d,config:e,request:i}),i=null}},i.onabort=function(){i&&(t(ri("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){t(ri("Network Error",e,null,i)),i=null},i.ontimeout=function(){var n="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(n=e.timeoutErrorMessage),t(ri(n,e,"ECONNABORTED",i)),i=null},Qo.isStandardBrowserEnv()){var c=(e.withCredentials||si(s))&&e.xsrfCookieName?ui.read(e.xsrfCookieName):void 0;c&&(o[e.xsrfHeaderName]=c)}if("setRequestHeader"in i&&Qo.forEach(o,function(e,n){void 0===l&&"content-type"===n.toLowerCase()?delete o[n]:i.setRequestHeader(n,e)}),Qo.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(n){if("json"!==e.responseType)throw n}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){i&&(i.abort(),t(e),i=null)}),l||(l=null),i.send(l)})}),pi),transformRequest:[function(e,n){return ai(n,"Accept"),ai(n,"Content-Type"),Qo.isFormData(e)||Qo.isArrayBuffer(e)||Qo.isBuffer(e)||Qo.isStream(e)||Qo.isFile(e)||Qo.isBlob(e)?e:Qo.isArrayBufferView(e)?e.buffer:Qo.isURLSearchParams(e)?(vi(n,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Qo.isObject(e)?(vi(n,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Qo.forEach(["delete","get","head"],function(e){mi.headers[e]={}}),Qo.forEach(["post","put","patch"],function(e){mi.headers[e]=Qo.merge(ci)});var Ei=mi;function Si(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var _i=function(e){return Si(e),e.headers=e.headers||{},e.data=oi(e.data,e.headers,e.transformRequest),e.headers=Qo.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Qo.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]}),(e.adapter||Ei.adapter)(e).then(function(n){return Si(e),n.data=oi(n.data,n.headers,e.transformResponse),n},function(n){return ii(n)||(Si(e),n&&n.response&&(n.response.data=oi(n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})},fi=function(e,n){n=n||{};var t={},l=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function r(e,n){return Qo.isPlainObject(e)&&Qo.isPlainObject(n)?Qo.merge(e,n):Qo.isPlainObject(n)?Qo.merge({},n):Qo.isArray(n)?n.slice():n}function u(l){Qo.isUndefined(n[l])?Qo.isUndefined(e[l])||(t[l]=r(void 0,e[l])):t[l]=r(e[l],n[l])}Qo.forEach(l,function(e){Qo.isUndefined(n[e])||(t[e]=r(void 0,n[e]))}),Qo.forEach(o,u),Qo.forEach(i,function(l){Qo.isUndefined(n[l])?Qo.isUndefined(e[l])||(t[l]=r(void 0,e[l])):t[l]=r(void 0,n[l])}),Qo.forEach(a,function(l){l in n?t[l]=r(e[l],n[l]):l in e&&(t[l]=r(void 0,e[l]))});var d=l.concat(o).concat(i).concat(a),s=Object.keys(e).concat(Object.keys(n)).filter(function(e){return-1===d.indexOf(e)});return Qo.forEach(s,u),t};function gi(e){this.defaults=e,this.interceptors={request:new li,response:new li}}gi.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=fi(this.defaults,e)).method=e.method?e.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var n=[_i,void 0],t=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){n.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){n.push(e.fulfilled,e.rejected)});n.length;)t=t.then(n.shift(),n.shift());return t},gi.prototype.getUri=function(e){return e=fi(this.defaults,e),ni(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Qo.forEach(["delete","get","head","options"],function(e){gi.prototype[e]=function(n,t){return this.request(fi(t||{},{method:e,url:n,data:(t||{}).data}))}}),Qo.forEach(["post","put","patch"],function(e){gi.prototype[e]=function(n,t,l){return this.request(fi(l||{},{method:e,url:n,data:t}))}});var Ci=gi;function Ni(e){this.message=e}Ni.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ni.prototype.__CANCEL__=!0;var yi=Ni;function Di(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(e){n=e});var t=this;e(function(e){t.reason||(t.reason=new yi(e),n(t.reason))})}Di.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Di.source=function(){var e;return{token:new Di(function(n){e=n}),cancel:e}};var Ti=Di;function hi(e){var n=new Ci(e),t=Yo(Ci.prototype.request,n);return Qo.extend(t,Ci.prototype,n),Qo.extend(t,n),t}var Ai=hi(Ei);Ai.Axios=Ci,Ai.create=function(e){return hi(fi(Ai.defaults,e))},Ai.Cancel=yi,Ai.CancelToken=Ti,Ai.isCancel=ii,Ai.all=function(e){return Promise.all(e)},Ai.spread=function(e){return function(n){return e.apply(null,n)}},Ai.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},Ai.default=Ai;const Ii=e=>{let{template:n,header:t,actionButtonLabel:r}=e;const{t:u}=o.useTranslation(),d=i.useHistory(),{mobileNumber:s,consumerNumber:c,oldconsumerNumber:p,tenantId:E,propertyId:S,locality:_,doorNumber:f,consumerName:g,PToffset:C}=Digit.Hooks.useQueryParams();let N,y,D={},T=C;isNaN(parseInt(T))?N=5:(y=T,N=parseInt(T)+5);let h=isNaN(parseInt(T))?{limit:"5",sortOrder:"ASC",sortBy:"createdTime",offset:"0"}:{limit:"5",sortOrder:"ASC",sortBy:"createdTime",offset:y};s&&(D.mobileNumber=s),c&&(D.connectionNumber=c),p&&(D.oldConnectionNumber=p),S&&(D.propertyId=S),"undefined"!==_&&(D.locality=_),f&&(D.doorNo=f),g&&(D.ownerName=g),(_||searchQuery&&searchQuery.locality)&&(D.limit=h.limit,D.sortOrder=h.sortOrder,D.sortBy=h.sortBy,D.offset=h.offset),D=v({},D,{searchType:"CONNECTION"});const{isLoading:A,data:I}=Digit.Hooks.ws.useWaterSearch({tenantId:E,filters:v({},D),BusinessService:"WS",t:u},{privacy:Digit.Utils.getPrivacyObject()}),{isLoading:O,data:b}=Digit.Hooks.ws.useSewarageSearch({tenantId:E,filters:v({},D),BusinessService:"SW",t:u},{privacy:Digit.Utils.getPrivacyObject()});if(A||O)return l.createElement(a.Loader,null);const L=I&&b?I.concat(b):I||b||[];return l.createElement("div",{style:{marginTop:"16px"}},l.createElement("div",null,t&&l.createElement(a.Header,{style:{marginLeft:"8px"}},u(t)," (",null==L?void 0:L.length,")"),l.createElement(a.ResponseComposer,{data:L,template:n,actionButtonLabel:r,onSubmit:e=>{d.push("/digit-ui/citizen/payment/my-bills/"+(null==e?void 0:e.ConsumerNumber.split("/")[0])+"/"+m(null==e?void 0:e.ConsumerNumber,"/","+")+"?workflow=WNS&tenantId="+E+"&ConsumerName="+(null==e?void 0:e.ConsumerName))}}),!(null!=L&&L.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("WS_NO_APP_FOUND_MSG")),0!==(null==L?void 0:L.length)&&(5==(null==L?void 0:L.length)||50==(null==L?void 0:L.length))&&(_||searchQuery&&searchQuery.locality)&&l.createElement("div",null,l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("WS_LOAD_MORE_MSG")," ",l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/citizen/ws/search-results?doorNumber="+f+"&consumerName="+g+"&tenantId="+(null==E?void 0:E.split(".")[0])+"&locality="+_.code+"&PToffset="+N},u("PT_COMMON_CLICK_HERE"))))),l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("WS_WANT_TO_ADD_NEW_CONNECTION")," ",l.createElement("span",{className:"link",style:{display:"block"}},l.createElement(i.Link,{to:"/digit-ui/citizen/ws/create-application/search-property"},u("WS_CLICK_HERE_TO_APPLY"))))))};Ii.propTypes={template:jo.any,header:jo.string,actionButtonLabel:jo.string},Ii.defaultProps={template:[],header:null,actionButtonLabel:null};const Oi=e=>{var n,t,i;let{data:r,OpenImage:u}=e;const{t:d}=o.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement(a.TelePhone,{mobile:r.mobileNumber}),r.source&&l.createElement("p",null,d("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(Reason,{otherComment:null==r?void 0:r.otherComment,headComment:null==r?void 0:r.comment}),null!=r&&r.wfComment?l.createElement("div",null,null==r||null===(n=r.wfComment)||void 0===n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(t=r.thumbnailsToShow)||void 0===t||null===(i=t.thumbs)||void 0===i?void 0:i.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("CS_COMMON_ATTACHMENTS")),l.createElement(a.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,n)=>{u(e,n,null==r?void 0:r.thumbnailsToShow)}})):null)},bi=e=>{var n,r,u,d,s,c;const{t:v}=o.useTranslation(),p=null===(n=e.application)||void 0===n?void 0:n.applicationNo.split("_")[0],{isLoading:m,data:E}=Digit.Hooks.useWorkflowDetails({tenantId:null===(r=e.application)||void 0===r?void 0:r.tenantId,id:e.id,moduleCode:p}),[S,_]=t.useState(!1);function f(e,n,t){var l;window.open(null==t||null===(l=t.fullImage)||void 0===l?void 0:l[0],"_blank")}const g=n=>{if("OPEN"===n.state){var t,o,r;const n={date:Digit.DateUtils.ConvertTimestampToDate(null===(t=e.application)||void 0===t||null===(o=t.auditDetails)||void 0===o?void 0:o.createdTime),source:(null===(r=e.application)||void 0===r?void 0:r.channel)||""};return l.createElement(Oi,{data:n})}var u,d;if("ACTIVE"===n.status)return l.createElement("div",null,l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+(null==e||null===(u=e.application)||void 0===u?void 0:u.propertyId)+"&tenantId="+(null==e||null===(d=e.application)||void 0===d?void 0:d.tenantId)},l.createElement(a.ActionLinks,null,v("PT_VIEW_PROPERTY_DETAILS"))));{var s,c,p,m,E,S;const t={source:(null===(s=e.application)||void 0===s?void 0:s.channel)||"",date:null==n||null===(c=n.auditDetails)||void 0===c?void 0:c.lastModified,name:null==n||null===(p=n.assignes)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.name,mobileNumber:null==n||null===(E=n.assignes)||void 0===E||null===(S=E[0])||void 0===S?void 0:S.mobileNumber,comment:v(null==n?void 0:n.comment),wfComment:n.wfComment,thumbnailsToShow:null==n?void 0:n.thumbnailsToShow};return l.createElement(Oi,{data:t,OpenImage:f})}};return m?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,!m&&l.createElement(t.Fragment,null,(null==E||null===(u=E.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},v("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=E&&E.timeline&&1===(null==E||null===(d=E.timeline)||void 0===d?void 0:d.length)?l.createElement(a.CheckPoint,{isCompleted:!0,label:v((null==E||null===(s=E.timeline[0])||void 0===s?void 0:s.state)&&"CS_"+E.timeline[0].state||"NA"),customChild:g(null==E?void 0:E.timeline[0])}):l.createElement(a.ConnectingCheckPoints,null,(null==E?void 0:E.timeline)&&(null==E?void 0:E.timeline.slice(0,S?E.timeline.length:2).map((e,n,t)=>l.createElement(l.Fragment,{key:n},l.createElement(a.CheckPoint,{keyValue:n,isCompleted:0===n,label:e.state?v("CS_"+e.state):"NA",customChild:g(e)}))))),(null==E||null===(c=E.timeline)||void 0===c?void 0:c.length)>2&&l.createElement(a.LinkButton,{label:v(S?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{_(e=>!e)}})),E&&(n=>{var t;let o=n[0];const r=n.map(e=>e.action);if(r.includes("PAY")||r.includes("EDIT")){let e=r.indexOf("EDIT")||r.indexOf("PAY");e=-1!=e?e:r.indexOf("PAY"),o=n[e]}switch(null===(t=o)||void 0===t?void 0:t.action){case"PAY":if(!1!==(null==e?void 0:e.paymentbuttonenabled))return l.createElement("div",{style:{marginTop:"1em",bottom:"0px",width:"100%",marginBottom:"1.2em"}},l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/payment/collect/"+p+"/"+e.id+"?consumerCode="+e.id+"&&workflow=WNS",state:{tenantId:e.application.tenantId}}},l.createElement(a.SubmitBar,{label:v("CS_APPLICATION_DETAILS_MAKE_PAYMENT")})));break;case"EDIT":return l.createElement("div",{style:{marginTop:"1em",bottom:"0px",width:"100%",marginBottom:"1.2em"}},"PT.MUTATION"!=p&&l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/pt/property/edit-application/action=edit-"+p+"/"+e.id,state:{tenantId:e.application.tenantId}}},l.createElement(a.SubmitBar,{label:v("CS_APPLICATION_DETAILS_EDIT")})));case"SUBMIT_FEEDBACK":return l.createElement("div",{style:{marginTop:"24px"}},l.createElement(i.Link,{to:"/digit-ui/citizen/fsm/rate/"+e.id},l.createElement(a.SubmitBar,{label:v("CS_APPLICATION_DETAILS_RATE")})))}})(null==E?void 0:E.nextActions))};function Li(e){var n;let{value:t={},Code:i,index:r,showFileName:u=!1}=e;const{t:d}=o.useTranslation(),{isLoading:s,data:c}=Digit.Hooks.ws.useWSDocumentSearch({value:t},{value:t},i,r),v=[];return null!=t&&t.documents?null==t||null===(n=t.documents)||void 0===n||n.documents.filter(e=>(null==e?void 0:e.documentType)===i).map(e=>{v.push(e)}):t.filter(e=>(null==e?void 0:e.documentType)===i).map(e=>{v.push(e)}),s?l.createElement(a.Loader,null):l.createElement("div",{style:{marginTop:"19px"}},l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==v?void 0:v.map((e,n)=>{let t=function(e,n,t){void 0===e&&(e={}),void 0===n&&(n="");let l=e[n]||"",o=(null==l?void 0:l.split(","))||[],i="";return o.length>0&&o.map(e=>{e.includes("large")||e.includes("medium")||e.includes("small")||(i=e)}),i}(c.pdfFiles,null==e?void 0:e.fileStoreId);return l.createElement("a",{target:"_",href:t,style:{minWidth:"160px"},key:n},l.createElement(a.PDFSvg,null),u?l.createElement("p",{style:{marginTop:"8px"}},d(null==i?void 0:i.split(".").slice(0,3).join("_"))):null)}))))}const Ri=e=>{var n;const t=null==e?void 0:e.doorNo,l=null==e?void 0:e.street,o=null==e?void 0:e.landmark,i=null==e||null===(n=e.locality)||void 0===n?void 0:n.name,a=null==e?void 0:e.pincode;return(t?t+", ":"")+(l?l+", ":"")+(o?o+", ":"")+(i?i+", ":"")+((null==e?void 0:e.city)||"")+(a?", "+a:"")},wi=(e,n)=>{var t,l,o;const i=null===(l=((null==e||null===(t=e.owners)||void 0===t?void 0:t.filter(e=>1==e.active))||[]).sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===l||null===(o=l.map(e=>e.name))||void 0===o?void 0:o.join(",");return{title:n("WS_COMMON_PROPERTY_DETAILS"),values:[{title:n("WS_PROPERTY_ID_LABEL"),value:n(""+(null==e?void 0:e.propertyId))||n("CS_NA")},{title:n("WS_OWN_DETAIL_NAME"),value:i||n("CS_NA")},{title:n("WS_PROPERTY_ADDRESS_LABEL"),value:Ri(null==e?void 0:e.address)||n("CS_NA")}]}},Wi=(e,n)=>({title:n("WS_COMMON_CONNECTION_DETAILS"),values:[{title:n("WS_DISCONNECTION_TYPE"),value:!0===(null==e?void 0:e.isDisconnectionTemporary)?n("WS_DISCONNECTIONTYPE_TEMPORARY"):n("WS_DISCONNECTIONTYPE_PERMANENT")||n("CS_NA")},{title:n("WS_DISCONNECTION_PROPOSED_DATE"),value:null!=e&&e.dateEffectiveFrom?Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.dateEffectiveFrom):n("CS_NA")},{title:n("WS_DISCONNECTION_REASON"),value:(null==e?void 0:e.disconnectionReason)||n("CS_NA")}]}),Pi=(e,n)=>{var t,l,o,i,a,r,u,d,s,c,v;return{title:n("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER"),values:(null==e||null===(t=e.connectionHolders)||void 0===t?void 0:t.length)>0?[{title:n("WS_OWN_DETAIL_NAME"),value:(null==e||null===(l=e.connectionHolders)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.name)||n("CS_NA")},{title:n("CORE_COMMON_MOBILE_NUMBER"),value:(null==e||null===(i=e.connectionHolders)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.mobileNumber)||n("CS_NA")},{title:n("WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME"),value:(null==e||null===(r=e.connectionHolders)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fatherOrHusbandName)||n("CS_NA")},{title:n("WS_CORRESPONDANCE_ADDRESS_LABEL"),value:(null==e||null===(d=e.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.correspondenceAddress)||n("CS_NA")},{title:n("CORE_COMMON_EMAIL_ID"),value:(null==e||null===(c=e.connectionHolders)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.emailId)||n("CS_NA")}]:[{title:n("WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS"),value:n("SCORE_YES")||n("CS_NA")}]}},Mi=(e,n)=>{const t=null==e?void 0:e.documents;return{title:n("WS_COMMON_DOCUMENTS_DETAILS"),isAttachments:!0,values:null==t?void 0:t.map(e=>n(null==e?void 0:e.documentType))}},xi=function(e,n,t,l){try{var o,i;function a(){return Promise.resolve(function(e,n,t){try{return Promise.resolve(E(t,n)).then(function(t){var l,o;let i=[];return null!=e&&e.applicationNo&&i.push({title:n("PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL")+":",value:null==e?void 0:e.applicationNo}),null!=e&&e.applicationType&&i.push({title:n("WS_SERVICE_NAME")+":",value:n("WS_APPLICATION_TYPE_"+(null==e?void 0:e.applicationType))}),v({title:"",isHeader:!0,typeOfApplication:null!=e&&null!==(l=e.applicationNo)&&void 0!==l&&l.includes("SW")?n("WS_NEW_SEWERAGE_DISCONNECTION"):n("WS_NEW_WATER_DISCONNECTION"),date:Digit.DateUtils.ConvertEpochToDate(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.createdTime)||"NA",values:i},t)})}catch(e){return Promise.reject(e)}}(e,l,t)).then(function(o){return{t:l,tenantId:t,title:"PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER",name:""+l("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER"),email:"",phoneNumber:"",headerDetails:[o],details:[wi(n,l),Pi(e,l),Wi(e,l),Mi(e,l)]}})}const r=null==e||null===(o=e.tradeLicenseDetail)||void 0===o||null===(i=o.applicationDocuments)||void 0===i?void 0:i.map(e=>null==e?void 0:e.fileStoreId);let u;const d=function(){if(r)return Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(function(e){u=e})}();return Promise.resolve(d&&d.then?d.then(a):a())}catch(e){return Promise.reject(e)}},Bi=e=>{var n;const t=null==e?void 0:e.doorNo,l=null==e?void 0:e.street,o=null==e?void 0:e.landmark,i=null==e||null===(n=e.locality)||void 0===n?void 0:n.name,a=null==e?void 0:e.pincode;return(t?t+", ":"")+(l?l+", ":"")+(o?o+", ":"")+(i?i+", ":"")+((null==e?void 0:e.city)||"")+(a?", "+a:"")},Fi=(e,n)=>{var t,l,o;const i=null===(l=((null==e||null===(t=e.owners)||void 0===t?void 0:t.filter(e=>1==e.active))||[]).sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===l||null===(o=l.map(e=>e.name))||void 0===o?void 0:o.join(",");return{title:n("WS_COMMON_PROPERTY_DETAILS"),values:[{title:n("WS_PROPERTY_ID_LABEL"),value:n(""+(null==e?void 0:e.propertyId))||n("CS_NA")},{title:n("WS_OWN_DETAIL_NAME"),value:i||n("CS_NA")},{title:n("WS_PROPERTY_ADDRESS_LABEL"),value:Bi(null==e?void 0:e.address)||n("CS_NA")}]}},Ui=(e,n)=>{var t,l,o,i,a,r,u,d,s,c,v,p,E,_;return{title:n("WS_COMMON_CONNECTION_DETAILS"),values:null!=e&&null!==(t=e.applicationNo)&&void 0!==t&&t.includes("WS")&&"Metered"==(null==e?void 0:e.connectionType)?[{title:n("WS_SERV_DETAIL_CONN_TYPE"),value:n(null!=e&&e.connectionType?"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(l=e.connectionType)||void 0===l?void 0:l.toUpperCase()," ","_"):"CS_NA")},{title:n("WS_SERV_DETAIL_NO_OF_TAPS"),value:(null==e?void 0:e.noOfTaps)||n("CS_NA")},{title:n("WS_PIPE_SIZE_IN_INCHES_LABEL"),value:(null==e?void 0:e.pipeSize)||n("CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SOURCE"),value:n(null!=e&&e.waterSource?"WS_SERVICES_MASTERS_WATERSOURCE_"+(null==e||null===(o=e.waterSource)||void 0===o||null===(i=o.toUpperCase())||void 0===i?void 0:i.split(".")[0]):"CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SUB_SOURCE"),value:n(null!=e&&e.waterSource?""+(null==e||null===(a=e.waterSource)||void 0===a||null===(r=a.toUpperCase())||void 0===r?void 0:r.split(".")[1]):"CS_NA")},{title:n("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),value:null!=e&&e.connectionExecutionDate?S(null==e?void 0:e.connectionExecutionDate):n("CS_NA")},{title:n("WS_SERV_DETAIL_METER_ID"),value:(null==e?void 0:e.meterId)||n("CS_NA")},{title:n("WS_INITIAL_METER_READING_LABEL"),value:(null==e||null===(u=e.additionalDetails)||void 0===u?void 0:u.initialMeterReading)||n("CS_NA")},{title:n("WS_INSTALLATION_DATE_LABEL"),value:null!=e&&e.meterInstallationDate?S(null==e?void 0:e.meterInstallationDate):n("CS_NA")}]:null!=e&&null!==(d=e.applicationNo)&&void 0!==d&&d.includes("WS")&&"Metered"!==(null==e?void 0:e.connectionType)?[{title:n("WS_SERV_DETAIL_CONN_TYPE"),value:n(null!=e&&e.connectionType?"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(s=e.connectionType)||void 0===s?void 0:s.toUpperCase()," ","_"):"CS_NA")},{title:n("WS_SERV_DETAIL_NO_OF_TAPS"),value:(null==e?void 0:e.noOfTaps)||n("CS_NA")},{title:n("WS_PIPE_SIZE_IN_INCHES_LABEL"),value:(null==e?void 0:e.pipeSize)||n("CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SOURCE"),value:n(null!=e&&e.waterSource?"WS_SERVICES_MASTERS_WATERSOURCE_"+(null==e||null===(c=e.waterSource)||void 0===c||null===(v=c.toUpperCase())||void 0===v?void 0:v.split(".")[0]):"CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SUB_SOURCE"),value:n(null!=e&&e.waterSource?""+(null==e||null===(p=e.waterSource)||void 0===p||null===(E=p.toUpperCase())||void 0===E?void 0:E.split(".")[1]):"CS_NA")},{title:n("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),value:null!=e&&e.connectionExecutionDate?S(null==e?void 0:e.connectionExecutionDate):n("CS_NA")}]:[{title:n("WS_SERV_DETAIL_CONN_TYPE"),value:n(null!=e&&e.connectionType?"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(_=e.connectionType)||void 0===_?void 0:_.toUpperCase()," ","_"):"CS_NA")},{title:n("WS_NUMBER_WATER_CLOSETS_LABEL"),value:(null==e?void 0:e.noOfWaterClosets)||n("CS_NA")},{title:n("WS_SERV_DETAIL_NO_OF_TOILETS"),value:(null==e?void 0:e.noOfToilets)||n("CS_NA")},{title:n("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),value:null!=e&&e.connectionExecutionDate?S(null==e?void 0:e.connectionExecutionDate):n("CS_NA")}]}},ki=(e,n)=>{var t,l,o,i,a,r,u,d,s,c,v;return{title:n("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER"),values:(null==e||null===(t=e.connectionHolders)||void 0===t?void 0:t.length)>0?[{title:n("WS_OWN_DETAIL_NAME"),value:(null==e||null===(l=e.connectionHolders)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.name)||n("CS_NA")},{title:n("CORE_COMMON_MOBILE_NUMBER"),value:(null==e||null===(i=e.connectionHolders)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.mobileNumber)||n("CS_NA")},{title:n("WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME"),value:(null==e||null===(r=e.connectionHolders)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fatherOrHusbandName)||n("CS_NA")},{title:n("WS_CORRESPONDANCE_ADDRESS_LABEL"),value:(null==e||null===(d=e.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.correspondenceAddress)||n("CS_NA")},{title:n("CORE_COMMON_EMAIL_ID"),value:(null==e||null===(c=e.connectionHolders)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.emailId)||n("CS_NA")}]:[{title:n("WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS"),value:n("SCORE_YES")||n("CS_NA")}]}},Hi=function(e,n,t,l){try{var o,i;function a(){return Promise.resolve(function(e,n,t){try{return Promise.resolve(E(t,n)).then(function(t){var l,o,i,a;let r=[];return null!=e&&e.connectionNo&&r.push({title:n("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL")+":",value:null==e?void 0:e.connectionNo}),v({title:"",isHeader:!0,typeOfApplication:null!=e&&null!==(l=e.connectionNo)&&void 0!==l&&l.includes("SW")?n("PDF_STATIC_LABEL_SW_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER"):n("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_WATER_CONNECTIONDETAIL"),date:(null!=e&&null!==(o=e.auditDetails)&&void 0!==o&&o.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.createdTime):Digit.DateUtils.ConvertEpochToDate(null==e||null===(a=e.additionalDetails)||void 0===a?void 0:a.appCreatedDate))||"NA",values:r},t)})}catch(e){return Promise.reject(e)}}(e,l,t)).then(function(o){return{t:l,tenantId:t,title:"PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER",name:""+l("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER"),email:"",phoneNumber:"",headerDetails:[o],details:[Ui(e,l),Fi(n,l),ki(e,l)]}})}const r=null==e||null===(o=e.tradeLicenseDetail)||void 0===o||null===(i=o.applicationDocuments)||void 0===i?void 0:i.map(e=>null==e?void 0:e.fileStoreId);let u;const d=function(){if(r)return Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(function(e){u=e})}();return Promise.resolve(d&&d.then?d.then(a):a())}catch(e){return Promise.reject(e)}},ji=e=>{var n,t,i,r,u,d,s,c,p,m,E,S,_,g,C;let{application:N}=e;const{t:y}=o.useTranslation();return l.createElement(a.Card,null,l.createElement(a.KeyNote,{noteStyle:{fontSize:"24px",fontWeight:"700"},keyValue:y("CS_PAYMENT_AMOUNT_DUE_WITHOUT_SYMBOL"),note:"₹ "+(null==N||null===(n=N.paymentDetails)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.totalAmountPaid)}),l.createElement(a.KeyNote,{keyValue:y("WS_SERVICE_NAME_LABEL"),note:y("WS_SERVICE_TYPE_"+(null==N||null===(i=N.paymentDetails)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.businessService))}),l.createElement(a.KeyNote,{keyValue:y("WS_CONSUMER_CODE"),note:y(null==N||null===(u=N.paymentDetails)||void 0===u||null===(d=u[0])||void 0===d||null===(s=d.bill)||void 0===s?void 0:s.consumerCode)}),l.createElement(a.KeyNote,{keyValue:y("WS_CONSUMER_NAME"),note:(null==N||null===(c=N.property)||void 0===c||null===(p=c.connectionHolders)||void 0===p?void 0:p.map(e=>null==e?void 0:e.name).join(","))||(null==N||null===(m=N.property)||void 0===m||null===(E=m.owners)||void 0===E?void 0:E.map(e=>null==e?void 0:e.name).join(","))||(null==N?void 0:N.payerName)}),l.createElement(a.KeyNote,{keyValue:y("WS_RECEIPT_NO_LABEL"),note:y(null==N||null===(S=N.paymentDetails)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.receiptNumber)}),l.createElement(a.KeyNote,{keyValue:y("WS_RECEIPT_DATE_LABEL"),note:f(null==N||null===(g=N.paymentDetails)||void 0===g||null===(C=g[0])||void 0===C?void 0:C.receiptDate)||y("CS_NA")}),l.createElement(a.KeyNote,{keyValue:y("WS_PAYMENT_STATUS"),note:y(null==N?void 0:N.paymentStatus)}),l.createElement(a.SubmitBar,{label:y("WS_DOWNLOAD_RECEIPT"),onSubmit:e=>{var n,t,l,o;return function(e,n,t,l){try{function o(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:n.filestoreIds[0]})).then(function(e){var t;window.open(e[null===(t=n)||void 0===t?void 0:t.filestoreIds[0]],"_blank")})}let n=null;const l=function(){if(null==e||!e.fileStoreId)return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[v({},e)]},"ws-onetime-receipt")).then(function(e){n=e});n={filestoreIds:[null==e?void 0:e.fileStoreId]}}();return Promise.resolve(l&&l.then?l.then(o):o())}catch(e){return Promise.reject(e)}}(N,0,null==N?void 0:N.tenantId,null!=N&&null!==(n=N.paymentDetails)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&null!==(l=t.bill)&&void 0!==l&&null!==(o=l.consumerCode)&&void 0!==o&&o.includes("SW"))}}))},Vi=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),zi=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),Yi=e=>{var n,t,r,u,d,s,c,p;let{application:m}=e;const{t:E}=o.useTranslation();let S=encodeURI(m.applicationNo);return l.createElement(a.Card,null,l.createElement(a.KeyNote,{keyValue:E("WS_MYCONNECTIONS_CONSUMER_NO"),note:null==m?void 0:m.connectionNo}),l.createElement(a.KeyNote,{keyValue:E("WS_SERVICE_NAME_LABEL"),note:E("WS_APPLICATION_TYPE_"+(null==m?void 0:m.applicationType))}),l.createElement(a.KeyNote,{keyValue:E("WS_CONSUMER_NAME"),note:(null==m||null===(n=m.connectionHolders)||void 0===n?void 0:n.map(e=>e.name).join(","))||(null==m||null===(t=m.property)||void 0===t||null===(r=t.owners.sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===r?void 0:r.map(e=>e.name).join(","))}),l.createElement(a.KeyNote,{keyValue:E("WS_MYCONNECTION_ADDRESS"),note:C(null==m||null===(u=m.property)||void 0===u?void 0:u.address,E),privacy:{uuid:null==m||null===(d=m.property)||void 0===d||null===(s=d.owners)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.uuid,fieldName:["doorNo","street","landmark"],model:"Property",showValue:!0,loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:null==m?void 0:m.tenantId,propertyIds:null==m||null===(p=m.property)||void 0===p?void 0:p.propertyId},jsonPath:"Properties[0].address.street",isArray:!1,d:e=>(U.get(e,"Properties[0].address.doorNo")?U.get(e,"Properties[0].address.doorNo")+", ":"")+(U.get(e,"Properties[0].address.street")?U.get(e,"Properties[0].address.street")+", ":"")+(U.get(e,"Properties[0].address.landmark")?""+U.get(e,"Properties[0].address.landmark"):"")}}}),l.createElement(a.KeyNote,{keyValue:E("WS_MYCONNECTIONS_STATUS"),note:E(null==m?void 0:m.status)}),l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/ws/connection/details/"+S,state:v({},m)}},l.createElement(a.SubmitBar,{label:E("WS_VIEW_DETAILS_LABEL")})))},Gi=e=>{const{t:n}=o.useTranslation();return e.isSuccess?n("CS_WATER_UPDATE_APPLICATION_SUCCESS"):e.isLoading?n("CS_WATER_UPDATE_APPLICATION_PENDING"):e.isSuccess?void 0:n("CS_WATER_UPDATE_APPLICATION_FAILED")},qi=e=>{var n,t,o,i,r,u;return l.createElement(a.Banner,{message:Gi(e),info:e.isSuccess&&null!=e&&e.Waterdata?e.t("WS_ACKNO_APP_NO_LABEL"):"",applicationNumber:null!=e&&e.Waterdata?null==e||null===(n=e.Waterdata)||void 0===n||null===(t=n.WaterConnection)||void 0===t||null===(o=t[0])||void 0===o?void 0:o.applicationNo:"",infoOne:e.isSuccess&&null!=e&&e.Seweragedata?e.t("WS_ACKNO_SEW_APP_NO_LABEL"):"",applicationNumberOne:null!=e&&e.Seweragedata?null==e||null===(i=e.Seweragedata)||void 0===i||null===(r=i.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.applicationNo:"",successful:e.isSuccess})},Ki=[{texts:{header:"CS_TITLE_MY_BILLS",actionButtonLabel:"WS_VIEW_DETAILS_AND_PAY"},labels:[{label:"WNS_COMMON_TABLE_COL_AMT_DUE_LABEL",key:"AmountDue",noteStyle:{fontSize:"24px",fontWeight:"bold"},notePrefix:"₹ "},{label:"WNS_MYCONNECTIONS_SERVICE",key:"ServiceName"},{label:"WNS_MYCONNECTIONS_CONSUMER_NO",key:"ConsumerNumber"},{label:"WNS_BILLING_PERIOD",key:"BillingPeriod"},{label:"WNS_CONSUMER_NAME_LABEL",key:"ConsumerName"},{label:"WNS_MYCONNECTION_ADDRESS",key:"Address"},{label:"WNS_VIEW_BILL_DUE_DATE_LABEL",key:"DueDate"}]}],Xi=e=>{var n,t,r,u,d,s,c,p,E;let{template:S,header:_,actionButtonLabel:f}=e;const{t:g}=o.useTranslation(),C=i.useHistory(),N=i.useLocation(),{tenantId:y}=Digit.Hooks.useQueryParams();let{tenantId:D}=(null===(n=Digit.UserService.getUser())||void 0===n?void 0:n.info)||(null==N?void 0:N.state)||{tenantId:y}||{};D=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||(null===(r=Digit.UserService.getUser())||void 0===r||null===(u=r.info)||void 0===u?void 0:u.permanentCity)||D,D||null!=N&&null!==(d=N.state)&&void 0!==d&&d.fromSearchResults||C.replace("/digit-ui/citizen/login",{from:url});let T={};const{mobileNumber:h}=(null===(s=Digit.UserService.getUser())||void 0===s?void 0:s.info)||{};T=v({},T,{searchType:"CONNECTION"});const A=v({mobileNumber:h},T),I=Digit.Hooks.ws.useMyBillsWaterSearch({tenantId:D,filters:v({},A),BusinessService:"WS",t:g},{privacy:Digit.Utils.getPrivacyObject()}),O=Digit.Hooks.ws.useMyBillsSewarageSearch({tenantId:D,filters:v({},A),BusinessService:"SW",t:g},{privacy:Digit.Utils.getPrivacyObject()});if(null!=I&&I.isLoading||null!=O&&O.isLoading||null==I||null==O)return l.createElement(a.Loader,null);let b=I&&O?I.concat(O):[];return b=null===(c=b)||void 0===c?void 0:c.filter(e=>(null==e?void 0:e.AmountDue)&&"0"!==(null==e?void 0:e.AmountDue)),l.createElement("div",{style:{marginTop:"16px"}},l.createElement("div",null,_&&l.createElement(a.Header,{style:{marginLeft:10,marginTop:10}},g(_)," (",null===(p=b)||void 0===p?void 0:p.length,")"),l.createElement(j,{t:g}),l.createElement(a.ResponseComposer,{data:b,template:S,actionButtonLabel:f,onSubmit:e=>{C.push("/digit-ui/citizen/payment/my-bills/"+(null==e?void 0:e.ConsumerNumber.split("/")[0])+"/"+m(null==e?void 0:e.ConsumerNumber,"/","+")+"?workflow=WNS&tenantId="+D+"&ConsumerName="+(null==e?void 0:e.ConsumerName))}})),!(null!==(E=b)&&void 0!==E&&E.length)>0&&l.createElement("p",{style:{paddingLeft:"16px"}},g("CS_BILLS_TEXT_NO_BILLS_FOUND")))};Xi.propTypes={template:jo.any,header:jo.string,actionButtonLabel:jo.string},Xi.defaultProps={template:[],header:null,actionButtonLabel:null};const Zi=["register","control","watch","setValue","unregister","handleSubmit","formState","getValues","reset"],$i=["errors"];function Ji(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const Qi=e=>l.createElement("h1",{className:"heading-m"},e.label),ea=()=>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"})),na=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ea,null)),ta=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;const{data:E,isLoading:S}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:_,data:f}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[g,C]=t.useState({}),[N,y]=t.useState({}),[D,T]=t.useState([]),[h,A]=t.useState(null),[I,O]=t.useState(null),[b,L]=t.useState(null),[R,w]=t.useState(null),[W,P]=t.useState([]),[M,x]=t.useState(null),[B,F]=t.useState(!1);function U(e){O(e.target.files[0])}return t.useEffect(()=>{var e;f&&f["egf-master"]&&P(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]),t.useEffect(()=>{var e;T(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{w(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)w(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",I,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):w(i("CS_FILE_UPLOAD_ERROR"))})},function(){w(i("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)}}()},[I]),t.useEffect(()=>{r&&C(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:t,financialYears:o,selectedFinancialYear:i,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+t.action+"_APPLICATION",submit:"WF_PT.CREATE_"+t.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(a.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:i})}]}]}})({t:i,action:r,financialYears:W,selectedFinancialYear:M,setSelectedFinancialYear:x}):(e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:v,businessService:p}=e;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:t(v||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:t("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,hintText:t("PT_ATTACH_RESTRICTIONS_SIZE"),message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:D,selectedApprover:h,setSelectedApprover:A,selectFile:U,uploadedFile:b,setUploadedFile:L,businessService:p}))},[r,D,W,M,b]),r&&g.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Qi,{label:i(g.label.heading)}),headerBarEnd:l.createElement(na,{onClick:d}),actionCancelLabel:i(g.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(g.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!M:S||(null==r?void 0:r.docUploadRequired)&&!b,formId:"modal-action"},_?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let n={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:v({},c,{workflow:n})})}else if(null!=r&&r.showFinancialYearsModal)s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==c?void 0:c.propertyId,tenantId:u,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let n={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:m};n.assignes=null!=r&&r.isTerminateState||!h?[]:[h],b&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:b}]),s({Property:v({},c,{workflow:n})})}},defaultValues:N,formId:"modal-action"})):l.createElement(a.Loader,null)},la=e=>l.createElement("h1",{className:"heading-m"},e.label),oa=()=>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"})),ia=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(oa,null)),aa=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:m}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:S}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[_,f]=t.useState({}),[g,C]=t.useState({}),[N,y]=t.useState([]),[D,T]=t.useState({}),[h,A]=t.useState(null),[I,O]=t.useState(null),[b,L]=t.useState(null),[R,w]=t.useState([]),[W,P]=t.useState(null);function M(e){A(e.target.files[0])}return t.useEffect(()=>{var e;S&&S["egf-master"]&&w(null===(e=S["egf-master"])||void 0===e?void 0:e.FinancialYear)},[S]),t.useEffect(()=>{var e;y(null==m||null===(e=m.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[m]),t.useEffect(()=>{!function(){try{L(null);const e=function(){if(h){const e=function(){if(h.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",h,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("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)}}()},[h]),t.useEffect(()=>{r&&f((e=>{let{t:n,action:t,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c}=e,v=!0;return"SENDBACKTOCITIZEN"!=(null==t?void 0:t.action)&&"APPROVE"!=(null==t?void 0:t.action)||(v=!1),t.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==t?void 0:t.action),cancel:"WF_EMPLOYEE_NEWTL_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(a.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:N,selectedApprover:D,setSelectedApprover:T,selectFile:M,uploadedFile:I,setUploadedFile:O,businessService:p}))},[r,N,R,W,I]),r&&_.form?l.createElement(a.Modal,{headerBarMain:l.createElement(la,{label:i(_.label.heading)}),headerBarEnd:l.createElement(ia,{onClick:d}),actionCancelLabel:i(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:_.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:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==h?void 0:h.name,fileStoreId:I}]:null}),s({Licenses:[c]})},defaultValues:g,formId:"modal-action"})):l.createElement(a.Loader,null)},ra=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ua=()=>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"})),da=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ua,null)),sa=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:m,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState({}),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),L=!!Digit.Utils.browser.isMobile();function R(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==m||null===(e=m.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[m]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))b(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",T,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(){b(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c,error:v}=e,p=!0;return"SENDBACKTOCITIZEN"==(null==t?void 0:t.action)&&(p=!1),t.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==t?void 0:t.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:p?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(a.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:v})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:R,uploadedFile:A,setUploadedFile:I,businessService:p,error:O}))},[r,C,A,O]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(ra,{label:i(S.label.heading)}),headerBarEnd:l.createElement(da,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{paddingLeft:"5px"}:{}},E?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:S.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!=y&&y.uuid?[null==y?void 0:y.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:null}),s({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},ca=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),va=()=>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"})),pa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(va,null)),ma=e=>{var n,o,i,r,u,s,c,p,m,E,S,_;let{t:f,action:g,tenantId:C,closeModal:N,submitAction:y,applicationDetails:D,applicationData:T,businessService:h,workflowDetails:A}=e;Digit.Hooks.obps.useObpsAPI(null!==(n=T)&&void 0!==n&&null!==(o=n.landInfo)&&void 0!==o&&null!==(i=o.address)&&void 0!==i&&i.city?null===(r=T)||void 0===r||null===(u=r.landInfo)||void 0===u||null===(s=u.address)||void 0===s?void 0:s.city:C,!1);const{data:I,isLoading:O}=Digit.Hooks.useEmployeeSearch(C,{roles:null==A||null===(c=A.data)||void 0===c||null===(p=c.initialActionState)||void 0===p||null===(m=p.nextActions)||void 0===m||null===(E=m.filter(e=>(null==e?void 0:e.action)==(null==g?void 0:g.action)))||void 0===E||null===(S=E[0])||void 0===S||null===(_=S.assigneeRoles)||void 0===_?void 0:_.map(e=>({code:e})),isActive:!0},{enabled:!(null!=g&&g.isTerminateState)}),[b,L]=(d.useQueryClient(),t.useState({})),[R,w]=t.useState({}),[W,P]=t.useState([]),[M,x]=t.useState({}),[B,F]=t.useState(null),[U,k]=t.useState(null),[H,j]=t.useState(null),[V,z]=t.useState(null),Y=!!Digit.Utils.browser.isMobile();function G(e){F(e.target.files[0])}t.useEffect(()=>{var e;P(null==I||null===(e=I.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[I]),t.useEffect(()=>{!function(){try{j(null);const e=function(){if(B){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(B.size>=5242880)j(f("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=B&&B.type&&!e.test(null==B?void 0:B.type))j(f("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",B,Digit.ULBService.getStateId()||(null==C?void 0:C.split(".")[0]))).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?k(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):j(f("CS_FILE_UPLOAD_ERROR"))})},function(){j(f("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[B]);const q=e=>{let n=[];return e&&e.map((e,t)=>{n.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("_",".")}})}),n},K=e=>{let n=[];var t;for(t=0;t<(null==e?void 0:e.questionLength);t++){var l;n.push({remarks:e["Remarks_"+t],question:null==e?void 0:e.questionList[t].question,value:null==e||null===(l=e["question_"+t])||void 0===l?void 0:l.code})}return n},X=e=>{var n,t;let l=[],o=[];var i,a;return(null==e||null===(n=e.additionalDetails)||void 0===n||null===(t=n.fieldinspection_pending)||void 0===t?void 0:t.length)>0&&(o=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(a=l)||void 0===a?void 0:a.length)>0&&l.map((e,n)=>{o.push({docs:q(e.Documents),date:e.InspectionDate,questions:K(e),time:null==e?void 0:e.InspectionTime})}),o=o.filter(e=>e.docs&&e.docs.length>0)):sessionStorage.removeItem("INSPECTION_DATA"),[...o]},Z=e=>{let n=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),t=[];return n.map(e=>{var n,l,o,i,a,r;(null==e||null===(n=e.uploadedDocuments)||void 0===n||null===(l=n[0])||void 0===l||null===(o=l.values)||void 0===o?void 0:o.length)>0&&(t=[...t,...null==e||null===(i=e.uploadedDocuments)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(t=[...t,...null==e?void 0:e.newUploadedDocs])}),t},$=()=>{var e;const n=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),t=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==n?void 0:n.reduce((e,n)=>null!=n&&n.checked?e.push(null==n?void 0:n.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==t?t.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return t.useEffect(()=>{g&&L((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:v,businessService:p,error:m}=e,E=!1;return"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SKIP_PAYMENT"!=o.action&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(E=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:o.isTerminateState||E?null:t(v||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||E?null:l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:t("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+t("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:f,action:g,approvers:W,selectedApprover:M,setSelectedApprover:x,selectFile:G,uploadedFile:U,setUploadedFile:k,businessService:h,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:H}))},[g,W,V,U,H]),g&&b.form?l.createElement(a.Modal,{headerBarMain:l.createElement(ca,{label:f(b.label.heading)}),headerBarEnd:l.createElement(pa,{onClick:N}),actionCancelLabel:f(b.label.cancel),actionCancelOnSubmit:N,actionSaveLabel:f(b.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Y?{width:"720px"}:{},style:Y?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Y?{paddingLeft:"5px"}:{}},O?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:b.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var n,t,l,o,i,a;T=v({},T,{documents:Z(),additionalDetails:v({},null===(n=T)||void 0===n?void 0:n.additionalDetails,{fieldinspection_pending:X(T),pendingapproval:$()}),workflow:{action:null==g?void 0:g.action,comment:(null==e||null===(t=e.comments)||void 0===t?void 0:t.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:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,assignes:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,varificationDocuments:U?[{documentType:(null==g?void 0:g.action)+" DOC",fileName:null==B?void 0:B.name,fileStoreId:U}]:null},action:null==g?void 0:g.action,comment:null==e?void 0:e.comments,assignee:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,wfDocuments:U?[{documentType:(null==g?void 0:g.action)+" DOC",fileName:null==B?void 0:B.name,fileStoreId:U}]:null});const r=null==D||null===(o=D.nocData)||void 0===o?void 0:o.map(e=>{const n=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:v({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...n||[]]})}});let u={sourceRefId:null==r||null===(i=r[0])||void 0===i||null===(a=i.Noc)||void 0===a?void 0:a.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(C,u)).then(function(e){var n;let t=!0,l=!0;null==e||null===(n=e.Noc)||void 0===n||n.map(e=>{var n,o,i,a,r;"APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=t&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?t=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let o=[];r&&r.map(e=>{var n,i,a,r,u,d,s,c,v,p,m,E;("APPROVED"!=(null==e||null===(n=e.Noc)||void 0===n||null===(i=n.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(a=e.Noc)||void 0===a||null===(r=a.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(d=u.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(c=s.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(v=e.Noc)||void 0===v||null===(p=v.applicationStatus)||void 0===p?void 0:p.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(m=e.Noc)||void 0===m?void 0:m.nocType)&&t||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&o.push(e)}),y({BPA:T},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})})}catch(e){return Promise.reject(e)}},defaultValues:R,formId:"modal-action"})):l.createElement(a.Loader,null)},Ea=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Sa=()=>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"})),_a=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Sa,null)),fa=e=>{var n,o;let{t:r,action:u,tenantId:s,closeModal:c,submitAction:p,applicationData:m,businessService:E}=e;const{data:S,isLoading:_}=Digit.Hooks.useEmployeeSearch(s,{roles:null==u||null===(n=u.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),[f,g]=(d.useQueryClient(),t.useState({})),[C,N]=t.useState({}),[y,D]=t.useState([]),[T,h]=t.useState({}),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(null),w=!!Digit.Utils.browser.isMobile();function W(e){I(e.target.files[0])}return i.useHistory(),t.useEffect(()=>{var e;D(null==S||null===(e=S.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[S]),t.useEffect(()=>{!function(){try{R(null);const e=function(){if(A){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(A.size>=5242880)R(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=A&&A.type&&!e.test(null==A?void 0:A.type))R(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",A,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):R(r("CS_FILE_UPLOAD_ERROR"))})},function(){R(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),t.useEffect(()=>{u&&g((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:v,businessService:p,error:m}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let S=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(S=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||S?null:t(v||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||S?null:l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:t("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+t("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:r,action:u,approvers:y,selectedApprover:T,setSelectedApprover:h,selectFile:W,uploadedFile:O,setUploadedFile:b,businessService:E,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:L}))},[u,y,O,L]),u&&f.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Ea,{label:r(f.label.heading)}),headerBarEnd:l.createElement(_a,{onClick:c}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},_?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var n,t,l;let o=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(n=m)||void 0===n||null===(t=n.documents)||void 0===t?void 0:t.length)>0?[...null===(l=m)||void 0===l?void 0:l.documents]:[];o.map((e,n)=>{i.push(e)}),m=v({},m,{workflow:{action:null==u?void 0:u.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,documents:O?[{documentType:(null==u?void 0:u.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:O}]:null},documents:i}),p({Noc:m},!1,{isNoc:!0})},defaultValues:C,formId:"modal-action"})):l.createElement(a.Loader,null)},ga=e=>l.createElement("h1",{className:"heading-m"},e.label),Ca=()=>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"})),Na=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ca,null)),ya=function(e,n){void 0===n&&(n="dayend");try{const t=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(t[1],t[2]-1,t[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===n&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(n){return e}},Da=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:m,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState({}),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),L=window.Digit.Utils.browser.isMobile(),R=window.location.href.includes("/employee");function w(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==m||null===(e=m.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[m]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))b(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",T,Digit.ULBService.getCurrentTenantId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),b(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),t.useEffect(()=>{var e,n,t,o;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(t=c)||void 0===t||null===(o=t.processInstance)||void 0===o?void 0:o.businessService)?r&&_((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:p,error:m}=e,E=!0,S=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(S=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==p?void 0:p.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?t("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?t("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},S&&{label:t("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!S,type:"custom",populators:S?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(a.DatePicker,v({onChange:e.onChange,date:e.value},n))}:null},{label:t("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),error:m,iserror:m,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p,error:O})):r&&_((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:v,error:p}=e,m=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(m=!1),o.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:m?t("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?t("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:t("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p,error:O}))},[r,C,A,O]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(ga,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Na,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&R?{width:"100%",height:"auto"}:{}},E?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var n,t,l,o,i,a,d,p,m,E;if(null!==(n=c)&&void 0!==n&&n.isBillAmend){var S,_,f,g,C,N,D,h,I;const n=v({},null===(S=c)||void 0===S||null===(_=S.billAmendmentDetails)||void 0===_?void 0:_.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),t=v({},null===(f=c)||void 0===f?void 0:f.billAmendmentDetails,{workflow:{businessId:null===(g=c)||void 0===g||null===(C=g.billAmendmentDetails)||void 0===C?void 0:C.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(N=c)&&void 0!==N&&null!==(D=N.applicationType)&&void 0!==D&&D.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(h=c)&&void 0!==h&&null!==(I=h.applicationType)&&void 0!==I&&I.includes("WATER")?"WS":"SW",assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:[]},additionalDetails:n,comment:(null==e?void 0:e.comments)||"",wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:[]}});s({AmendmentUpdate:t})}else{if(c=v({},c,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:[],assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:null,processInstance:v({},null===(t=c)||void 0===t?void 0:t.processInstance,{action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:[]})}),null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(o=l.applicationType)&&void 0!==o&&o.includes("DISCONNECT")){const n=Lt(null==e?void 0:e.date);c.disconnectionExecutionDate=ya(n)}else if(null!=e&&e.date){const n=Lt(null==e?void 0:e.date);c.connectionExecutionDate=ya(n)}var O;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(a=i.processInstance)||void 0===a?void 0:a.businessService)||"DisconnectSWConnection"==(null===(d=c)||void 0===d||null===(p=d.processInstance)||void 0===p?void 0:p.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(O=c)||void 0===O?void 0:O.serviceType)?s({WaterConnection:c,disconnectRequest:!0}):s({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(m=c)||void 0===m?void 0:m.applicationType))s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=c)||void 0===E?void 0:E.applicationType))s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var b,L,R,w,W,P,M,x,B,F,U,k,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),n=e?JSON.parse(e):"";null!=n&&null!==(b=n.value)&&void 0!==b&&b.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==n||null===(L=n.value)||void 0===L?void 0:L.adhocPenalty)||""),null!=n&&null!==(R=n.value)&&void 0!==R&&R.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==n||null===(w=n.value)||void 0===w?void 0:w.adhocPenaltyComment)||""),null!=n&&null!==(W=n.value)&&void 0!==W&&W.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==n||null===(P=n.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=n&&null!==(M=n.value)&&void 0!==M&&M.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==n||null===(x=n.value)||void 0===x?void 0:x.adhocRebate)||""),null!=n&&null!==(B=n.value)&&void 0!==B&&B.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==n||null===(F=n.value)||void 0===F?void 0:F.adhocRebateComment)||""),null!=n&&null!==(U=n.value)&&void 0!==U&&U.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==n||null===(k=n.value)||void 0===k?void 0:k.adhocRebateReason)||""),"WATER"==(null===(H=c)||void 0===H?void 0:H.serviceType)?s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},Ta=e=>l.createElement("h1",{className:"heading-m"},e.label),ha=()=>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"})),Aa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ha,null)),Ia=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState(null),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(!1);function w(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",T,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(){b(i("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]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==t?void 0:t.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:n("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_PTR_ATTACH_FILE")+(t.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("PTR_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_PTR_ACTION_FILEUPLOADED"):n("ES_PTR_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p}))},[r,C,A]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Ta,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Aa,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:m};A&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,filestoreId:A}]),s({PetRegistrationApplications:[v({},c,{workflow:n})]})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},Oa=e=>l.createElement("h1",{className:"heading-m"},e.label),ba=()=>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"})),La=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ba,null)),Ra=e=>{var n,o,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:p,applicationData:m,businessService:E,moduleCode:S}=e;const{data:_}=Digit.Hooks.useEmployeeSearch(s,{roles:null==d||null===(n=d.roles)||void 0===n||null===(o=n[0])||void 0===o||null===(r=o.map)||void 0===r?void 0:r.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),f=i.useHistory(),[g,C]=t.useState({}),[N,y]=t.useState({}),[D,T]=t.useState([]),[h,A]=t.useState(null),[I,O]=t.useState(null);return t.useEffect(()=>{var e;T(null==_||null===(e=_.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[_]),t.useEffect(()=>{"INITIATED"===(null==d?void 0:d.state)?f.push("/digit-ui/employee/asset/assetservice/edit/"+(null==m?void 0:m.applicationNo)):C((e=>{let{t:n,action:t,businessService:l}=e;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==t?void 0:t.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:n("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:d,approvers:D,selectedApprover:h,setSelectedApprover:A,uploadedFile:I,setUploadedFile:O,businessService:E}))},[d,D,I]),d&&g.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Oa,{label:u(g.label.heading)}),headerBarEnd:l.createElement(La,{onClick:c}),actionCancelLabel:u(g.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==d?void 0:d.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:S};I&&(n.documents=[]),p({Asset:v({},m,{workflow:n})})},defaultValues:N,formId:"modal-action"})):l.createElement(a.Loader,null)},wa=e=>l.createElement("h1",{className:"heading-m"},e.label),Wa=()=>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"})),Pa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Wa,null)),Ma=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState(null),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(!1);function w(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",T,u)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(){b(i("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]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:r}=e;return{label:{heading:"CHB_"+(null==t?void 0:t.action),submit:"CHB_"+(null==t?void 0:t.action),cancel:"CS_COMMON_BACK"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("ES_CHB_ATTACH_FILE")+(t.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},message:i?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p}))},[r,C,A]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(wa,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Pa,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:m};A&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]),s({hallsBookingApplication:v({},c,{workflow:n})})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},xa=e=>l.createElement("h1",{className:"heading-m"},e.label),Ba=()=>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"})),Fa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ba,null)),Ua=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;console.log("snjdskbjdfbjskfjkbs",r);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState(null),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(null),[w,W]=t.useState(!1);function P(e){I(e.target.files[0])}return t.useEffect(()=>{var e;N(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{R(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",A,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("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]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;console.log("action",t);const d=(new Date).toISOString().split("T")[0];return console.log("todayedsta ::",d),{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==t?void 0:t.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:["COMPLETIONPENDING"===(null==t?void 0:t.state)?{label:n("EW_PICKUP_DATE"),type:"date",isMandatory:!0,populators:{name:"date",min:(new Date).toISOString().split("T")[0],max:new Date(Date.now()+6048e5).toISOString().split("T")[0]}}:"null","REQUESTCOMPLETED"===(null==t?void 0:t.state)?{label:n("ES_EW_ACTION_TRANSACTION_ID"),type:"text",isMandatory:!0,populators:{name:"transactionId"}}:"null","REQUESTCOMPLETED"===(null==t?void 0:t.state)?{label:n("ES_EW_ACTION_FINALAMOUNT"),type:"text",isMandatory:!0,populators:{name:"finalAmount"}}:"null",{label:n("ES_EW_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_EW_PHOTO")+(t.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("EW_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_EW_ACTION_FILEUPLOADED"):n("ES_EW_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:P,uploadedFile:O,setUploadedFile:b,businessService:p}))},[r,C,O]),console.log("conggg",S),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(xa,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Fa,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:m};console.log("applicationData",e),O&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,filestoreId:O},{}]),c.pickUpDate=null==e?void 0:e.date,c.transactionId=null==e?void 0:e.transactionId,c.finalAmount=null==e?void 0:e.finalAmount,s({EwasteApplication:[v({},c,{workflow:n})]})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)};var ka=F(function(e,t){(function(){var l=function(e){return e instanceof l?e:this instanceof l?void(this.EXIFwrapped=e):new l(e)};e.exports&&(t=e.exports=l),t.EXIF=l;var o=l.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},i=l.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},a=l.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},r=l.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},u=l.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function d(e){return!!e.exifdata}function s(e){var n=new DataView(e);if(255!=n.getUint8(0)||216!=n.getUint8(1))return!1;for(var t=2,l=e.byteLength;t<l;){if(255!=n.getUint8(t))return!1;if(225==n.getUint8(t+1))return S(n,t+4,n.getUint16(t+2));t+=2+n.getUint16(t+2)}}var c={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};function v(e,n,t){for(var l,o,i,a,r=new DataView(e),u={},d=n;d<n+t;)28===r.getUint8(d)&&2===r.getUint8(d+1)&&(a=r.getUint8(d+2))in c&&(i=r.getInt16(d+3),o=c[a],l=E(r,d+5,i),u.hasOwnProperty(o)?u[o]instanceof Array?u[o].push(l):u[o]=[u[o],l]:u[o]=l),d++;return u}function p(e,n,t,l,o){var i,a,r=e.getUint16(t,!o),u={};for(a=0;a<r;a++)u[l[e.getUint16(i=t+12*a+2,!o)]]=m(e,i,n,0,o);return u}function m(e,n,t,l,o){var i,a,r,u,d,s,c=e.getUint16(n+2,!o),v=e.getUint32(n+4,!o),p=e.getUint32(n+8,!o)+t;switch(c){case 1:case 7:if(1==v)return e.getUint8(n+8,!o);for(i=v>4?p:n+8,a=[],u=0;u<v;u++)a[u]=e.getUint8(i+u);return a;case 2:return E(e,i=v>4?p:n+8,v-1);case 3:if(1==v)return e.getUint16(n+8,!o);for(i=v>2?p:n+8,a=[],u=0;u<v;u++)a[u]=e.getUint16(i+2*u,!o);return a;case 4:if(1==v)return e.getUint32(n+8,!o);for(a=[],u=0;u<v;u++)a[u]=e.getUint32(p+4*u,!o);return a;case 5:if(1==v)return d=e.getUint32(p,!o),s=e.getUint32(p+4,!o),(r=new Number(d/s)).numerator=d,r.denominator=s,r;for(a=[],u=0;u<v;u++)d=e.getUint32(p+8*u,!o),s=e.getUint32(p+4+8*u,!o),a[u]=new Number(d/s),a[u].numerator=d,a[u].denominator=s;return a;case 9:if(1==v)return e.getInt32(n+8,!o);for(a=[],u=0;u<v;u++)a[u]=e.getInt32(p+4*u,!o);return a;case 10:if(1==v)return e.getInt32(p,!o)/e.getInt32(p+4,!o);for(a=[],u=0;u<v;u++)a[u]=e.getInt32(p+8*u,!o)/e.getInt32(p+4+8*u,!o);return a}}function E(e,t,l){var o="";for(n=t;n<t+l;n++)o+=String.fromCharCode(e.getUint8(n));return o}function S(e,n){if("Exif"!=E(e,n,4))return!1;var t,l,d,s,c,v=n+6;if(18761==e.getUint16(v))t=!1;else{if(19789!=e.getUint16(v))return!1;t=!0}if(42!=e.getUint16(v+2,!t))return!1;var m=e.getUint32(v+4,!t);if(m<8)return!1;if((l=p(e,v,v+m,i,t)).ExifIFDPointer)for(d in s=p(e,v,v+l.ExifIFDPointer,o,t)){switch(d){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":s[d]=u[d][s[d]];break;case"ExifVersion":case"FlashpixVersion":s[d]=String.fromCharCode(s[d][0],s[d][1],s[d][2],s[d][3]);break;case"ComponentsConfiguration":s[d]=u.Components[s[d][0]]+u.Components[s[d][1]]+u.Components[s[d][2]]+u.Components[s[d][3]]}l[d]=s[d]}if(l.GPSInfoIFDPointer)for(d in c=p(e,v,v+l.GPSInfoIFDPointer,a,t)){switch(d){case"GPSVersionID":c[d]=c[d][0]+"."+c[d][1]+"."+c[d][2]+"."+c[d][3]}l[d]=c[d]}return l.thumbnail=function(e,n,t,l){var o=function(e,n,t){var l=e.getUint16(n,!t);return e.getUint32(n+2+12*l,!t)}(e,n+t,l);if(!o)return{};if(o>e.byteLength)return{};var i=p(e,n,n+o,r,l);if(i.Compression)switch(i.Compression){case 6:i.JpegIFOffset&&i.JpegIFByteCount&&(i.blob=new Blob([new Uint8Array(e.buffer,n+i.JpegIFOffset,i.JpegIFByteCount)],{type:"image/jpeg"}));break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",i.Compression)}else 2==i.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return i}(e,v,m,t),l}function _(e){var n={};if(1==e.nodeType){if(e.attributes.length>0){n["@attributes"]={};for(var t=0;t<e.attributes.length;t++){var l=e.attributes.item(t);n["@attributes"][l.nodeName]=l.nodeValue}}}else if(3==e.nodeType)return e.nodeValue;if(e.hasChildNodes())for(var o=0;o<e.childNodes.length;o++){var i=e.childNodes.item(o),a=i.nodeName;if(null==n[a])n[a]=_(i);else{if(null==n[a].push){var r=n[a];n[a]=[],n[a].push(r)}n[a].push(_(i))}}return n}function f(e){try{var n={};if(e.children.length>0)for(var t=0;t<e.children.length;t++){var l=e.children.item(t),o=l.attributes;for(var i in o){var a=o[i],r=a.nodeName;void 0!==r&&(n[r]=a.nodeValue)}var u=l.nodeName;if(void 0===n[u])n[u]=_(l);else{if(void 0===n[u].push){var d=n[u];n[u]=[],n[u].push(d)}n[u].push(_(l))}}else n=e.textContent;return n}catch(e){console.log(e.message)}}l.enableXmp=function(){l.isXmpEnabled=!0},l.disableXmp=function(){l.isXmpEnabled=!1},l.getData=function(e,n){return!((self.Image&&e instanceof self.Image||self.HTMLImageElement&&e instanceof self.HTMLImageElement)&&!e.complete||(d(e)?n&&n.call(e):function(e,n){function t(t){var o=s(t);e.exifdata=o||{};var i=function(e){var n=new DataView(e);if(255!=n.getUint8(0)||216!=n.getUint8(1))return!1;for(var t=2,l=e.byteLength,o=function(e,n){return 56===e.getUint8(n)&&66===e.getUint8(n+1)&&73===e.getUint8(n+2)&&77===e.getUint8(n+3)&&4===e.getUint8(n+4)&&4===e.getUint8(n+5)};t<l;){if(o(n,t)){var i=n.getUint8(t+7);return i%2!=0&&(i+=1),0===i&&(i=4),v(e,t+8+i,n.getUint16(t+6+i))}t++}}(t);if(e.iptcdata=i||{},l.isXmpEnabled){var a=function(e){if("DOMParser"in self){var n=new DataView(e);if(255!=n.getUint8(0)||216!=n.getUint8(1))return!1;for(var t=2,l=e.byteLength,o=new DOMParser;t<l-4;){if("http"==E(n,t,4)){var i=t-1,a=n.getUint16(t-2)-1,r=E(n,i,a),u=r.indexOf("xmpmeta>")+8,d=(r=r.substring(r.indexOf("<x:xmpmeta"),u)).indexOf("x:xmpmeta")+10;return r=r.slice(0,d)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+r.slice(d),f(o.parseFromString(r,"text/xml"))}t++}}}(t);e.xmpdata=a||{}}n&&n.call(e)}if(e.src)if(/^data\:/i.test(e.src))t(function(e,n){n=n||e.match(/^data\:([^\;]+)\;base64,/im)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var t=atob(e),l=t.length,o=new ArrayBuffer(l),i=new Uint8Array(o),a=0;a<l;a++)i[a]=t.charCodeAt(a);return o}(e.src));else if(/^blob\:/i.test(e.src))(i=new FileReader).onload=function(e){t(e.target.result)},function(e,n){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="blob",t.onload=function(e){200!=this.status&&0!==this.status||i.readAsArrayBuffer(this.response)},t.send()}(e.src);else{var o=new XMLHttpRequest;o.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";t(o.response),o=null},o.open("GET",e.src,!0),o.responseType="arraybuffer",o.send(null)}else if(self.FileReader&&(e instanceof self.Blob||e instanceof self.File)){var i;(i=new FileReader).onload=function(e){t(e.target.result)},i.readAsArrayBuffer(e)}}(e,n),0))},l.getTag=function(e,n){if(d(e))return e.exifdata[n]},l.getIptcTag=function(e,n){if(d(e))return e.iptcdata[n]},l.getAllTags=function(e){if(!d(e))return{};var n,t=e.exifdata,l={};for(n in t)t.hasOwnProperty(n)&&(l[n]=t[n]);return l},l.getAllIptcTags=function(e){if(!d(e))return{};var n,t=e.iptcdata,l={};for(n in t)t.hasOwnProperty(n)&&(l[n]=t[n]);return l},l.pretty=function(e){if(!d(e))return"";var n,t=e.exifdata,l="";for(n in t)t.hasOwnProperty(n)&&(l+="object"==typeof t[n]?t[n]instanceof Number?n+" : "+t[n]+" ["+t[n].numerator+"/"+t[n].denominator+"]\r\n":n+" : ["+t[n].length+" values]\r\n":n+" : "+t[n]+"\r\n");return l},l.readFromBinaryFile=function(e){return s(e)}}).call(B)});const Ha=e=>l.createElement("h1",{className:"heading-m"},e.label),ja=()=>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"})),Va=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ja,null)),za=e=>{var n,o;let{t:r,action:u,tenantId:d,closeModal:s,submitAction:c,applicationData:p,businessService:m,moduleCode:E,vending_Zone:S,UserVendingZone:_,UserVendingZoneCode:f}=e;i.useHistory();const g=Digit.UserService.getUser().info,C=null==g?void 0:g.roles,{data:N}=Digit.Hooks.useEmployeeSearch(d,{roles:null==u||null===(n=u.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:null==u?void 0:u.isTerminateState}),[y,D]=t.useState({}),[T,h]=t.useState({}),[A,I]=t.useState([]),[O,b]=t.useState(null),[L,R]=t.useState(null),[w,W]=t.useState(null),[P,M]=t.useState(null),[x,B]=t.useState(!1),[F,U]=t.useState(),[k,H]=t.useState(),[j,V]=t.useState("");function z(e){B(!0),R(e.target.files[0])}function Y(e){return e[0]+e[1]/60+e[2]/3600}return t.useEffect(()=>{var e;I(null==N||null===(e=N.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[N]),t.useEffect(()=>{!function(){try{M(null);const e=function(){if(L){(function(e){return new Promise(n=>{ka.getData(e,function(){const e=ka.getTag(this,"GPSLatitude"),t=ka.getTag(this,"GPSLongitude");if(e&&t){const l=Y(e),o=Y(t);n({latitude:l,longitude:o})}else n({latitude:null,longitude:null})})})})(L).then(e=>{let{latitude:n,longitude:t}=e;n&&t?function(e,n){try{Promise.resolve(Ji(function(){return Promise.resolve(fetch(((e,n)=>"https://nominatim.openstreetmap.org/reverse?format=json&lat="+e+"&lon="+n+"&zoom=18&addressdetails=1")(e,n))).then(function(e){if(!e.ok)throw new Error("Failed to fetch address");return Promise.resolve(e.json()).then(function(e){if(e&&e.address){var n,t,l,o,i,a,r,u;const d=[null===(n=e.address)||void 0===n?void 0:n.amenity,null===(t=e.address)||void 0===t?void 0:t.road,null===(l=e.address)||void 0===l?void 0:l.neighbourhood,null===(o=e.address)||void 0===o?void 0:o.suburb,null===(i=e.address)||void 0===i?void 0:i.city,null===(a=e.address)||void 0===a?void 0:a.state,null===(r=e.address)||void 0===r?void 0:r.postcode,null===(u=e.address)||void 0===u?void 0:u.country].filter(Boolean).join(", ");U(d)}})})},function(e){console.error("Error fetching address:",e)}))}catch(e){return Promise.reject(e)}}(n,t):console.log("No geolocation data found in the image.")});const e=function(){if(L.size>=5242880)M(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=function(e,n){try{var t=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",L,d)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?W(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):M(r("CS_FILE_UPLOAD_ERROR"))})},function(){M(r("CS_FILE_UPLOAD_ERROR"))})}catch(e){return n(!0,e)}return t&&t.then?t.then(n.bind(null,!1),n.bind(null,!0)):n(!1,t)}(0,function(e,n){if(B(!1),e)throw n;return n});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)}}()},[L]),t.useEffect(()=>{D((e=>{let{t:n,action:o,selectFile:i,uploadedFile:r,setUploadedFile:u,approvers:d,selectedApprover:s,setSelectedApprover:c,isUploading:v,geoLocationData:p,vending_Zone:m,vendingZones:E,setvendingZones:S,UserVendingZone:_,selectApprover:f}=e;const g=()=>l.createElement("div",{className:"loading-spinner"});return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"SV_"+(null==o?void 0:o.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==o?void 0:o.action)||"REJECT"===(null==o?void 0:o.action)||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(a.Dropdown,{option:d,t:n,optionKey:"name",select:c,selected:s})},(f||[]).some(e=>"TVCEMPLOYEE"===e.code||"SVCEMP"===e.code)&&{label:n("SV_CONFIRM_VENDING_ZONE"),type:"dropdown",populators:l.createElement(a.Dropdown,{option:m,t:n,optionKey:"i18nKey",select:S,selected:(e=>e?{i18nKey:e,code:e,value:e}:null)(_)||E})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.Fragment,null,l.createElement(a.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{u(null)},message:v?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(g,null),l.createElement("span",null,"Uploading...")):r?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")}),(f||[]).some(e=>"INSPECTIONOFFICER"===e.code)&&p&&l.createElement("div",null,l.createElement("strong",null," Location: ",p," ")))}]}]}})({t:r,action:u,approvers:A,selectedApprover:O,setSelectedApprover:b,selectFile:z,uploadedFile:w,setUploadedFile:W,businessService:m,isUploading:x,geoLocationData:F,vending_Zone:S,vendingZones:k,setvendingZones:H,UserVendingZone:_,selectApprover:C}))},[u,A,w]),u&&y.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Ha,{label:r(y.label.heading)}),headerBarEnd:l.createElement(Va,{onClick:s}),actionCancelLabel:r(y.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:(null==u?void 0:u.docUploadRequired)&&!w&&!j||!j},l.createElement(a.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var n;let t={action:null==u?void 0:u.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:E,assignes:"SENDBACKTOCITIZEN"===(null==u?void 0:u.action)?[null==p||null===(n=p.auditDetails)||void 0===n?void 0:n.createdBy]:null!=O&&O.uuid?[null==O?void 0:O.uuid]:null};w&&(t.documents=[{documentType:(null==u?void 0:u.action)+" DOC",fileName:null==L?void 0:L.name,fileStoreId:w}]),c({streetVendingDetail:v({},p,{vendingZone:(null==k?void 0:k.code)||f,workflow:t})})},defaultValues:T,formId:"modal-action",onFormValueChange:(e,n)=>{V(null==n?void 0:n.comments)}})):l.createElement(a.Loader,null)},Ya=e=>l.createElement("h1",{className:"heading-m"},e.label),Ga=()=>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"})),qa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ga,null)),Ka=e=>{var n,o,a,r;let{t:u,action:d,tenantId:c,closeModal:p,submitAction:m,applicationData:E,businessService:S,moduleCode:_}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==d||null===(n=d.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),{data:g}=Digit.Hooks.fsm.useVendorSearch({tenantId:c,config:{enabled:"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==d?void 0:d.state)}});let C=[];null==g||null===(a=g.vendor)||void 0===a||a.map(e=>{var n,t;(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.serviceType)===(null==E?void 0:E.bookingNo.split("-")[0])&&C.push({code:null==e?void 0:e.name,name:null==e?void 0:e.name,i18nKey:null==e?void 0:e.name,vendorId:null==e?void 0:e.id,uuid:null==e||null===(t=e.owner)||void 0===t?void 0:t.uuid})});const{data:N}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,config:{enabled:"DELIVERY_PENDING"===(null==d?void 0:d.state)}});let y=[];null==N||null===(r=N.vehicle)||void 0===r||r.map(e=>{var n;y.push({code:null==e?void 0:e.registrationNumber,name:null==e?void 0:e.registrationNumber,i18nKey:null==e?void 0:e.registrationNumber,tankerCapacity:null==e?void 0:e.tankCapacity,vehicleId:null==e?void 0:e.id,uuid:null==e||null===(n=e.owner)||void 0===n?void 0:n.uuid})});const[D,T]=t.useState({}),[h,A]=t.useState({}),[I,O]=t.useState([]),[b,L]=t.useState(null),[R,w]=t.useState(null),[W,P]=t.useState(null),[M,x]=t.useState(null),[B,F]=t.useState(null),[U,k]=t.useState(""),H=i.useHistory();function j(e){L(e.target.files[0])}return t.useEffect(()=>{var e;O(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[f]),t.useEffect(()=>{!function(){try{P(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)P(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",b,c)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):P(u("CS_FILE_UPLOAD_ERROR"))})},function(){P(u("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]),t.useEffect(()=>{if(d){if("PAY"===d.action){var e;const n=null===(e=E.bookingNo)||void 0===e?void 0:e.split("-")[0];let t="";switch(n){case"WT":t="request-service.water_tanker";break;case"MT":t="request-service.mobile_toilet";break;case"TP":t="request-service.tree_pruning";break;default:return void console.error("Unknown booking prefix:",n)}return H.push("/digit-ui/employee/payment/collect/"+t+"/"+E.bookingNo)}T((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:a,selectedVendor:r,setSelectedVendor:u,vendorDescription:d,vehicleDescription:c,selectVehicle:v,setSelectVehicle:p}=e;return{label:{heading:"RS_"+(null==t?void 0:t.action),submit:"RS_"+(null==t?void 0:t.action),cancel:"CS_COMMON_BACK"},form:[{body:["PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==t?void 0:t.state)?{label:n("RS_ASSIGN"),type:"dropdown",isMandatory:!0,populators:l.createElement(s.Dropdown,{option:d,t:n,optionKey:"i18nKey",select:u,selected:r})}:"null","DELIVERY_PENDING"===(null==t?void 0:t.state)?{label:n("RS_REGISTRATION_NUMBER"),isMandatory:!0,type:"dropdown",populators:l.createElement(s.Dropdown,{option:c,t:n,optionKey:"i18nKey",select:p,selected:v})}:"null",{label:n("ES_RS_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("ES_RS_ATTACH_FILE")+(t.docUploadRequired?" *":""),populators:l.createElement(s.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{a(null)},message:i?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:u,action:d,selectFile:j,uploadedFile:R,setUploadedFile:w,selectedVendor:M,setSelectedVendor:x,vendorDescription:g?C:void 0,vehicleDescription:N?y:void 0,selectVehicle:B,setSelectVehicle:F}))}},[d,I,R,g,B,N]),d&&D.form?l.createElement(s.Modal,{headerBarMain:l.createElement(Ya,{label:u(D.label.heading)}),headerBarEnd:l.createElement(qa,{onClick:p}),actionCancelLabel:u(D.label.cancel),actionCancelOnSubmit:p,actionSaveLabel:u(D.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:(null==d?void 0:d.docUploadRequired)&&!R&&!U||"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==d?void 0:d.state)&&!M&&!U||"DELIVERY_PENDING"===(null==d?void 0:d.state)&&!B&&!U||!U},l.createElement(s.FormComposer,{config:D.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n,t={action:null==d?void 0:d.action,comments:null==e?void 0:e.comments,businessService:S,moduleName:_};R&&(t.documents=[{documentType:(null==d?void 0:d.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:R}]),"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==d?void 0:d.state)&&(t.assignes=[null==M?void 0:M.uuid],E.vendorId=null==M?void 0:M.vendorId),"DELIVERY_PENDING"===(null==d?void 0:d.state)&&(E.vehicleId=null==B?void 0:B.vehicleId),n="watertanker"===S?{waterTankerBookingDetail:v({},E,{workflow:t})}:"treePruning"===S?{treePruningBookingDetail:v({},E,{workflow:t})}:{mobileToiletBookingDetail:v({},E,{workflow:t})},m(n)},defaultValues:h,formId:"modal-action",onFormValueChange:(e,n)=>{k(null==n?void 0:n.comments)}})):l.createElement(s.Loader,null)},Xa=e=>null!=e&&e.businessService.includes("PT")?l.createElement(ta,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Ia,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")||null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(aa,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(sa,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(ma,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(fa,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(Da,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Ra,e):null!=e&&e.businessService.includes("ewst")?l.createElement(Ua,e):null!=e&&e.businessService.includes("booking-refund")?l.createElement(Ma,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(za,e):null!=e&&e.businessService.includes("watertanker")||null!=e&&e.businessService.includes("mobileToilet")||null!=e&&e.businessService.includes("treePruning")?l.createElement(Ka,e):void 0;function Za(e){let{documents:n,svgStyles:t={},isSendBackFlow:i=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:d}=o.useTranslation(),s=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!s&&(null==n?void 0:n.map((e,t)=>{var o;return l.createElement(l.Fragment,{key:t},null!=e&&e.title?l.createElement(a.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var t;return l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(a.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"center",color:"#505A5F"}},d(null==e?void 0:e.title)),i?null!=e&&null!==(t=e.documentType)&&void 0!==t&&t.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))),r&&(null==n?void 0:n.length)!=t+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)})),s&&(null==n?void 0:n.map((e,n)=>{var o;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(a.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=t&&t.minWidth?null==t?void 0:t.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"}},d(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+d(null==e?void 0:e.docInfo)):null,l.createElement(a.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+d(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const $a=e=>{var n,o;let{t:i,formData:a,applicationData:r,docs:u,bpaActionsDetails:d}=e;const s=(null==r?void 0:r.status)||"",c=(null==d||null===(n=d.data)||void 0===n?void 0:n.nextActions)||[],v=Digit.ULBService.getStateId(),[p,m]=t.useState((null==a||null===(o=a.documents)||void 0===o?void 0:o.documents)||[]),[E,S]=t.useState(null),[_,f]=t.useState([]),[g,C]=t.useState(!0),[N,y]=t.useState(!1),[D,T]=t.useState(!1),{isLoading:h,data:A}=Digit.Hooks.obps.useMDMS(v,"BPA",["DocTypeMapping"]),{isLoading:I,data:O}=Digit.Hooks.obps.useMDMS(v,"common-masters",["DocumentType"]);return t.useEffect(()=>{var e,n,t,l;let o=[];var i,a;null!=A&&null!==(e=A.BPA)&&void 0!==e&&e.DocTypeMapping&&(o=null==A||null===(i=A.BPA)||void 0===i||null===(a=i.DocTypeMapping)||void 0===a?void 0:a.filter(e=>{var n,t;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===(n=r.additionalDetails)||void 0===n?void 0:n.serviceType)&&e.applicationType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.applicationType)}));let d=[];null===(n=o)||void 0===n||null===(t=n[0])||void 0===t||null===(l=t.docTypes)||void 0===l||l.forEach(e=>{var n,t,l,o;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==O||null===(n=O["common-masters"])||void 0===n||null===(t=n.DocumentType)||void 0===t||t.forEach(n=>{let t=n.code.slice(0,i.length);i===t&&(e.hasDropdown=!0,n.i18nKey=n.code,e.dropdownData.push(n))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(o=l.values)||void 0===o||o.map(n=>{var t,l;i===(null==n||null===(t=n.documentType)||void 0===t?void 0:t.split(".")[0])+"."+(null==n||null===(l=n.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(n)}),d.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)),f(d)},[!h,!I]),t.useEffect(()=>{let e=0;_.map(n=>{let t=!1;p.map(e=>{n.required&&n.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(t=!0)}),!t&&n.required&&(e+=1)}),C("0"!=e&&0!=e||!(p.length>0))},[p,N]),t.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===s&&(null==c?void 0:c.length)>0)},[r,d]),l.createElement("div",null,null==_?void 0:_.map((e,n)=>l.createElement("div",null,l.createElement(Ja,{key:n,index:n,document:e,t:i,error:E,setError:S,setDocuments:m,documents:p,setCheckRequiredFields:y,applicationStatus:s,actions:c,bpaTaxDocuments:_,checkEnablingDocs:D}))))};function Ja(e){var n,o;let{t:i,document:r,setDocuments:u,documents:d,index:s,bpaTaxDocuments:c,checkEnablingDocs:p}=e;const m=null==d?void 0:d.filter(e=>{var n;return null==e||null===(n=e.documentType)||void 0===n?void 0:n.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[S,_]=t.useState(m?v({},m,{active:!0,code:null==m?void 0:m.documentType,i18nKey:null==m?void 0:m.documentType}):1===(null==r||null===(n=r.dropdownData)||void 0===n?void 0:n.length)?null==r?void 0:r.dropdownData[0]:{}),[f,g]=t.useState(null),[C,N]=t.useState(()=>(null==m?void 0:m.fileStoreId)||null),[y,D]=t.useState([]);return t.useEffect(()=>{null!=S&&S.code&&u(e=>{var n;const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==S?void 0:S.code));return 0===(null==C?void 0:C.length)||null===C?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==C),{documentType:null==S?void 0:S.code,fileStoreId:C,documentUid:C,fileName:(null==f?void 0:f.name)||"",id:d?null===(n=d.find(e=>e.documentType===(null==S?void 0:S.code)))||void 0===n?void 0:n.id:void 0}]})},[C,S]),t.useEffect(()=>{try{y.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],y.map(e=>{var n,t,l;null!=S&&S.code&&r.newUploadedDocs.push({documentType:null==S?void 0:S.code,fileStoreId:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,documentUid:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[s]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[y,S]),t.useEffect(()=>{},[f]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(Za,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),p?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(a.LabelFieldPair,{style:{width:"100%"}},l.createElement(a.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(a.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:S,optionKey:"i18nKey",select:e=>_(e),style:{width:"100%"}})),l.createElement(a.LabelFieldPair,{style:{width:"100%"}},l.createElement(a.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(a.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,n)=>{let t=Object.fromEntries(n),l=Object.values(t);0!==Object.keys(t).length&&D(l),function(e){e&&g(e.file)}(l[l.length-1])})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Qa(e){let{fiReport:n,isCitizen:t=!1}=e;const{t:i}=o.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(t?a.CardHeader:a.CardSectionHeader,{style:{fontSize:"24px"}},""+i("BPA_FI_REPORT")),n.map((e,t)=>{var o,r,u,d,s,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(a.StatusTable,null,l.createElement(a.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+i("BPA_FI_REPORT"):i("BPA_FI_REPORT")+" - "+(t+1)),l.createElement(a.Row,{className:"border-none",label:""+i("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(u=e.date)||void 0===u?void 0:u.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(a.Row,{className:"border-none",label:""+i("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(d=e.questions)||void 0===d?void 0:d.length)&&(null==e||null===(s=e.questions)||void 0===s?void 0:s.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(a.Row,{className:"border-none",label:""+i(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(a.Row,{className:"border-none",label:""+i("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Za,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var n;return{title:null==e||null===(n=e.documentType)||void 0===n?void 0:n.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 er(e){let{t:n,document:o,setNocDocuments:i,setError:r,nocDocuments:u}=e;const d=null==u?void 0:u.filter(e=>{var n;return null==e||null===(n=e.documentType)||void 0===n?void 0:n.includes(null==o?void 0:o.code)})[0],s=Digit.ULBService.getStateId(),[c,v]=t.useState(),[p,m]=t.useState(null),[E,S]=t.useState(()=>(null==d?void 0:d.fileStoreId)||null);return t.useEffect(()=>{var e,n;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.code&&i(e=>{var n;const t=null==e?void 0:e.filter(e=>{var n,t;return(null==e?void 0:e.documentType)!==(null==o||null===(n=o.dropdownData)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.code)});return 0===(null==E?void 0:E.length)||null===E?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==o||null===(n=o.dropdownData)||void 0===n?void 0:n[0].code,fileStoreId:E,documentUid:E,fileName:(null==p?void 0:p.name)||""}]})},[E]),t.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(n("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(n("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return S(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,l,o,i;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?S(null==e||null===(o=e.data)||void 0===o||null===(i=o.files[0])||void 0===i?void 0:i.fileStoreId):r(n("CS_FILE_UPLOAD_ERROR"))})},function(){r(n("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)}}()},[p]),l.createElement("div",{style:{}},l.createElement(a.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(a.CardLabel,{style:{width:"100%"}},null!=o&&o.required?n("TL_BUTTON_UPLOAD FILE")+"*":""+n("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(a.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let n=Object.fromEntries(e),t=Object.values(n);!function(e){e&&m(e.file)}(t[t.length-1])})(e),t:n,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const nr=e=>{var n;let{t:o,noc:i,docs:r,isNoc:u,applicationData:d,NOCdata:s,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const v=Digit.ULBService.getStateId(),p=(null==d?void 0:d.status)||"",m=(null==c||null===(n=c.data)||void 0===n?void 0:n.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(v,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:S}=Digit.Hooks.obps.useMDMS(v,"BPA",["DocTypeMapping"],{enabled:!u}),{data:_}=Digit.Hooks.obps.useMDMS(v,"common-masters",["DocumentType"]),[f,g]=t.useState([]),[C,N]=t.useState([]),[y,D]=t.useState(!1),[T,h]=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),[A,I]=t.useState(null),O=window.location.href.includes("/employee/");return t.useEffect(()=>{var e;g(null==_||null===(e=_["common-masters"])||void 0===e?void 0:e.DocumentType)},[_]),t.useEffect(()=>{var e,n,t;let l,o=[];var a,r,s,c;l=u?null==E||null===(a=E.NOC)||void 0===a||null===(r=a.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==S||null===(s=S.BPA)||void 0===s||null===(c=s.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var n,t;return e.WFState==(null==d?void 0:d.status)&&e.RiskType==(null==d?void 0:d.riskType)&&e.ServiceType==(null==d||null===(n=d.additionalDetails)||void 0===n?void 0:n.serviceType)&&e.applicationType==(null==d||null===(t=d.additionalDetails)||void 0===t?void 0:t.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&null!==(t=n.docTypes)&&void 0!==t&&t[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},o.push(l[0].docTypes[0]));let v=[];o&&o.length>0&&(o.map(e=>{let n=e.documentType;e.dropdownData=[],null==f||f.forEach(t=>{let l=t.code.slice(0,null==n?void 0:n.length);n===l&&(e.hasDropdown=!0,e.dropdownData.push(t))}),v.push(e)}),N(v))},[E,f]),t.useEffect(()=>{D("NOC_VERIFICATION_INPROGRESS"===p&&(null==m?void 0:m.length)>0)},[d,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(a.StatusTable,null,l.createElement(a.Row,{label:O?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),s&&s.map((e,n)=>{if(null!=e&&e.value)return l.createElement(a.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:O?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(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?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Za,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),y&&(null==C?void 0:C.map((e,n)=>l.createElement(er,{key:n,document:e,t:o,error:A,setError:I,setNocDocuments:h,nocDocuments:T,checkEnablingDocs:y}))))},tr=e=>{let{permissions:n,t:o}=e;const[i,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==n?void 0:n.map(e=>({label:e,checked:!1}))),[d,s,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);t.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const p=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(a.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==i?void 0:i.map((e,n)=>l.createElement(a.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:p?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,n,t)=>{const l=e.target.checked;r(()=>null==i?void 0:i.map((e,n)=>t===n?v({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==d?void 0:d.map((e,n)=>l.createElement("div",null,l.createElement(a.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,n)=>{s(()=>null==d?void 0:d.map((t,l)=>{var o;return n===l?{label:null==e||null===(o=e.target)||void 0===o?void 0:o.value}:t}))})(e,n),textInputStyle:{maxWidth:p?"96%":"830px",width:p?"96%":"830px"},style:p?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(a.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(a.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:p?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const n=[...d];n.splice(e,1),s([...n])})(n)}))),l.createElement(a.LinkButton,{style:{color:"#a82227",maxWidth:p?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{s([...d,{label:""}])}}))};function lr(e){let{documents:n,svgStyles:i={},isSendBackFlow:r=!1}=e;const{t:u}=o.useTranslation(),[d,s]=t.useState(()=>[]),[c,v]=(Digit.ULBService.getCurrentTenantId(),t.useState({}));t.useEffect(()=>{var e;let t=[];null==n||n.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),s(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[n]),t.useEffect(()=>{var e;null!=d&&d.length&&"BillAmend"===(null==n||null===(e=n[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(d,Digit.ULBService.getCurrentTenantId()).then(e=>{v(null==e?void 0:e.data)}):null!=d&&d.length&&Digit.UploadServices.Filefetch(d,Digit.ULBService.getStateId()).then(e=>{v(null==e?void 0:e.data)})},[d]);const p=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),m=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!m&&(null==n?void 0:n.map((e,n)=>{var t;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(a.CardSubHeader,{style:p?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(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===(t=e.values)||void 0===t?void 0:t.map((e,n)=>{var t,o;return l.createElement("a",{target:"_",href:null===(t=c[e.fileStoreId])||void 0===t?void 0:t.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(a.PDFSvg,null)),l.createElement("p",{style:p?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),r?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),m&&(null==n?void 0:n.map((e,n)=>{var t;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(a.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===(t=e.values)||void 0===t?void 0:t.map((e,n)=>{var t;return l.createElement("a",{target:"_",href:null===(t=c[e.fileStoreId])||void 0===t?void 0:t.split(",")[0],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(a.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+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")))))})))}function or(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:t}=n,{t:i}=o.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(a.StatusTable,null,l.createElement(a.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(a.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==t?void 0:t.map((e,n)=>l.createElement(a.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==t?void 0:t.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(a.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(a.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function ir(e){let{floors:n}=e;const{t:t}=o.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:t(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},t(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var o;return l.createElement(l.Fragment,{key:n},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},t(e.title)),l.createElement(a.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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var o;return l.createElement(a.Row,!0===e.map&&"N/A"!==e.value?{key:t(e.title),label:t(e.title),text:l.createElement("img",{src:t(e.value),alt:""})}:{key:t(e.title),label:t(e.title),text:t(e.value)||"N/A",last:n===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function ar(e){let{owners:n}=e,t={};t=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:i}=o.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},d={position:"relative",padding:"8px"},s={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},d={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u=v({},u,{maxWidth:"950px"}),u=v({},u,{maxWidth:"950px"}),s={}),n.sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},t.map((e,n)=>{var t;return l.createElement("div",{key:i(null==e?void 0:e.title),style:u,className:"owner-details-child"},l.createElement(a.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(a.StatusTable,{style:d},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(t=e.values)||void 0===t?void 0:t.map((e,n)=>{var t;return!0===e.map&&"N/A"!==e.value?l.createElement(a.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(a.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(t=e.values)||void 0===t?void 0:t.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:s}))}))))})))}const rr=e=>{var n,i,r;let{scrutinyDetails:u,paymentsList:d=[]}=e;const{t:s}=o.useTranslation(),c=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},s(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?s(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void s("NA");return l.createElement(t.Fragment,null,!(null!=u&&u.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(a.StatusTable,null,l.createElement("div",null,null==u||null===(n=u.values)||void 0===n?void 0:n.map((e,n)=>null!=e&&e.isUnit?l.createElement(a.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:""+s(""+e.title),text:null!=e&&e.value?c(e)+" "+s(null==e?void 0:e.isUnit):s("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(a.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:""+s(""+e.title),text:c(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(a.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},s(null==e?void 0:e.title)):l.createElement(a.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},s(null==e?void 0:e.title))),null==u||null===(i=u.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(a.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),l.createElement("div",null,null==u||null===(r=u.scruntinyDetails)||void 0===r?void 0:r.map((e,n)=>l.createElement(t.Fragment,null,l.createElement(a.Row,{className:"border-none",label:""+s(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(a.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},s(null==e?void 0:e.text))))))))},ur=e=>{var n,i,r,u,d,s,c,v,p;let{edcrDetails:m,applicationData:E}=e;const{t:S}=o.useTranslation(),_=window.Digit.Utils.browser.isMobile(),f=[{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"},{name:"BPA_TABLE_COL_CARPETAREA",id:"CarpetArea"}],g=e=>{const n=e;return(e,t,l)=>e[n]},C=t.useMemo(()=>f.map(e=>({Header:S(""+e.name),accessor:g(e.id),id:e.id})));function N(e){var n;let t=[];return null==e||null===(n=e.building)||void 0===n||n.floors.map(e=>{var n,l,o,i,a,r,u,d;t.push({Floor:(null==e?void 0:e.floorName)||S("BPA_FLOOR_NAME_"+e.number),Level:(null==e?void 0:e.number)||(null==e?void 0:e.floorNo),Occupancy:S(""+("BPA-PAP"===(null==E?void 0:E.businessService)?"Residential":null===(n=e.occupancies)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.type))||"NA",BuildupArea:(null==e||null===(o=e.occupancies)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.builtUpArea)||(null==e?void 0:e.builtUpArea),FloorArea:(null==e||null===(a=e.occupancies)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.floorArea)||(null==e?void 0:e.builtUpArea),CarpetArea:(null==e||null===(u=e.occupancies)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.carpetArea)||0,key:(null==e?void 0:e.floorName)||S("BPA_FLOOR_NAME_"+e.number)})}),t}function y(e){var n;let t=null==E||null===(n=E.landInfo)||void 0===n?void 0:n.unit,l="";if((null==t?void 0:t.length)>0){var o,i;let n=null===(o=t[e])||void 0===o||null===(i=o.usageCategory)||void 0===i?void 0:i.split(",");null!=n&&n.length&&(l=n.map(e=>e?""+S("BPA_SUBOCCUPANCYTYPE_"+function(e,n,t){if(void 0===e&&(e=""),void 0===n&&(n=""),void 0===t&&(t=""),""==n)return e;for(;e.includes(n);)e=e.replace(n,t);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(t.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(a.StatusTable,null,null==m||null===(n=m.values)||void 0===n?void 0:n.map((e,n)=>null!=e&&e.isHeader?l.createElement(a.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},S(null==e?void 0:e.title)):l.createElement(a.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+S(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==m||null===(i=m.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.value)||void 0===u||null===(d=u.planDetail)||void 0===d?void 0:d.blocks.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:n,style:(null==m||null===(t=m.subOccupancyTableDetails)||void 0===t||null===(o=t[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},S("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+S("BPA_SUB_OCCUPANCY_LABEL"),text:y(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||_?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(a.Table,{className:"customTable table-fixed-first-column table-border-style",t:S,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:N(e),columns:C,getCellProps:e=>({style:{}})})))}),null==m||null===(s=m.subOccupancyTableDetails)||void 0===s||null===(c=s[0])||void 0===c||null===(v=c.value)||void 0===v||null===(p=v.drawingDetail)||void 0===p?void 0:p.blocks.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:n,style:(null==m||null===(t=m.subOccupancyTableDetails)||void 0===t||null===(o=t[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.drawingDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},S("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+S("BPA_SUB_OCCUPANCY_LABEL"),text:y(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||_?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(a.Table,{className:"customTable table-fixed-first-column table-border-style",t:S,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:N(e),columns:C,getCellProps:e=>({style:{}})})))})))},dr=e=>{let{headComment:n,otherComment:t}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,n),l.createElement("p",null,t))},sr=e=>{var n,t,i;let{data:r,OpenImage:u,privacy:d={}}=e;const{t:s}=o.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(a.TelePhone,{mobile:r.mobileNumber,privacy:d}),l.createElement("p",null," ")),r.source&&l.createElement("p",null,s("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(dr,{otherComment:null==r?void 0:r.otherComment,headComment:null==r?void 0:r.comment}),null!=r&&r.wfComment?l.createElement("div",null,null==r||null===(n=r.wfComment)||void 0===n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,s("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(t=r.thumbnailsToShow)||void 0===t||null===(i=t.thumbs)||void 0===i?void 0:i.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,s("CS_COMMON_ATTACHMENTS")),l.createElement(a.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,n)=>{u(e,n,null==r?void 0:r.thumbnailsToShow)}})):null)};function cr(e){let{units:n}=e;const{t:t}=o.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var o;return l.createElement("div",{key:t(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(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},t(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(a.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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var o;return l.createElement(a.Row,!0===e.map&&"N/A"!==e.value?{key:t(e.title),label:t(e.title),text:l.createElement("img",{src:t(e.value),alt:""})}:{key:t(e.title),label:t(e.title)+":",text:t(e.value)||"N/A",last:n===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function vr(e){let{units:n}=e;const{t:t}=o.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var o;return l.createElement("div",{key:t(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(a.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},t(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(a.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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var o;return l.createElement(a.Row,!0===e.map&&"N/A"!==e.value?{key:t(e.title),label:t(e.title),text:l.createElement("img",{src:t(e.value),alt:""})}:{key:t(e.title),label:t(e.title)+":",text:t(e.value)||"NA",last:n===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const pr=e=>{var n,i,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=o.useTranslation();let c=g(location.search);const v=null==c?void 0:c.mode;var{connectionDetails:p,plumberDetails:m,roadCuttingDetails:E,activationDetails:S}=(null==d?void 0:d.additionalDetails)||{connectionDetails:[],plumberDetails:[]};return l.createElement(t.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==d||null===(n=d.additionalDetails)||void 0===n?void 0:n.connectionDetails)&&l.createElement(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==p?void 0:p.map((e,n)=>l.createElement("div",null,l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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===(i=d.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=v&&l.createElement(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==m?void 0:m.map((e,n)=>l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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"!=v&&l.createElement(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==E?void 0:E.map(e=>{var n;return l.createElement("div",{style:(null==E?void 0:E.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(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},mr=[{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"}],Er=[{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"}],Sr=e=>{var n,i,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=o.useTranslation(),[c,p,m]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,S,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),g=!(null==d||null===(n=d.additionalDetails)||void 0===n||!n.isPaid),[C,N]=t.useState(!1),[y,D]=t.useState(c||{}),[T,h]=t.useState(null),[A,I]=t.useState(d.additionalDetails.data?d.additionalDetails.data:{}),[O,b]=t.useState(d.additionalDetails.values?d.additionalDetails.values:[]),L=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(L,"BillingService",["TaxHeadMaster"]),t.useEffect(()=>{var e,n,t;const o=v({},null==d||null===(e=d.additionalDetails)||void 0===e||null===(n=e.appDetails)||void 0===n?void 0:n.additionalDetails);if((null==c||null===(t=c.billDetails)||void 0===t?void 0:t.length)>0){var i,a,r,u,s,m,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(s=c.billDetails)||void 0===s||null===(m=s[0])||void 0===m?void 0:m.taxAmount)}];b(e),I(null==c||null===(E=c.billDetails)||void 0===E?void 0:E[0])}else p(o),D(o)},[]);let R={};const w=e=>l.createElement("h1",{className:"heading-m"},e.label),W=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(W,null)),M=function(e,n,t){void 0===n&&(n=!1);let l=v({},y);if("adhocPenalty"!=e&&"adhocRebate"!=e||!t.target.value)n?(l[e+"_data"]=t,l[e]=t.title,"PT_OTHERS"==t.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==t.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=t.target.value;else{var o,i;const n=0==(null==t||null===(o=t.target)||void 0===o?void 0:o.value)?1:Math.sign(null==t||null===(i=t.target)||void 0===i?void 0:i.value)||-1;l[e]=1==n?t.target.value:""}D(l)};return l.createElement(t.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},O&&l.createElement(a.StatusTable,null,l.createElement("div",null,null==O?void 0:O.map((e,n)=>l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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(a.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+s("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==A?void 0:A.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(a.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+s("CS_INBOX_STATUS_FILTER"),text:s(g?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:g?{color:"#00703C"}:{color:"#D4351C"}}))),null!=d&&null!==(i=d.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{N(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},s("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,C&&l.createElement(a.Modal,{headerBarMain:l.createElement(w,{label:s("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{D(c),N(!1)}}),actionCancelLabel:s("PT_CANCEL"),actionCancelOnSubmit:()=>{D(c),N(!1)},actionSaveLabel:s("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const n=null!=y&&y.adhocPenalty?Number(null==y?void 0:y.adhocPenalty):0,t=null!=y&&y.adhocRebate?Number(null==y?void 0:y.adhocRebate):0;var l,o;if(n||t)if(t>(null==d||null===(l=d.additionalDetails)||void 0===l||null===(o=l.data)||void 0===o?void 0:o.totalAmount))h({isError:!1,isWarning:!0,key:"error",message:s("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,a,r,u,c,m,E,f,g,C;const e=null==d||null===(i=d.additionalDetails)||void 0===i||null===(a=i.appDetails)||void 0===a?void 0:a.applicationNo,n=null==d||null===(r=d.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,t=v({},null==d||null===(c=d.additionalDetails)||void 0===c||null===(m=c.appDetails)||void 0===m?void 0:m.additionalDetails,y);d.additionalDetails.appDetails.additionalDetails=t;const l={CalculationCriteria:"WATER"==(null==d||null===(E=d.additionalDetails)||void 0===E||null===(f=E.appDetails)||void 0===f?void 0:f.service)?[{applicationNo:e,tenantId:n,waterConnection:d.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:n,sewerageConnection:d.additionalDetails.appDetails}],isconnectionCalculation:!1};let o="WATER"==(null==d||null===(g=d.additionalDetails)||void 0===g||null===(C=g.appDetails)||void 0===C?void 0:C.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,o).then((e,n)=>{var t,l,o,i,a,r,u,d,s,c,v,m,E,f,g;(null==e||null===(t=e.Calculation)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.taxHeadEstimates)||void 0===o?void 0:o.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.taxHeadEstimates)||void 0===g||g.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.taxHeadEstimates,"category");const C=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.taxAmount}];S(Lt(e.Calculation[0])),I(null==e||null===(m=e.Calculation)||void 0===m?void 0:m[0]),b(C),y.billDetails=null==e?void 0:e.Calculation,p(y),N(!1)}).catch(e=>{var n,t,l,o,i,a;h({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(n=e.response)&&void 0!==n&&null!==(t=n.data)&&void 0!==t&&null!==(l=t.Errors[0])&&void 0!==l&&l.message?s(""+(null==e||null===(o=e.response)||void 0===o||null===(i=o.data)||void 0===i||null===(a=i.Errors[0])||void 0===a?void 0:a.code)):s("PT_COMMON_ADD_REBATE_PENALITY")})})}else h({isError:!1,isWarning:!0,key:"warning",message:s("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(a.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(a.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_PENALTY")),l.createElement(a.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{isMandatory:!0,option:mr,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==y?void 0:y.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:s})),"PT_OTHERS"===(null==y||null===(r=y.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(a.CardLabel,null,s("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==y?void 0:y.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")})))),l.createElement(a.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==y?void 0:y.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(a.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(a.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_REBATE")),l.createElement(a.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{isMandatory:!0,option:Er,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==y?void 0:y.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:s})),"PT_OTHERS"===(null==y||null===(u=y.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(a.CardLabel,null,s("PT_REASON")),l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==y?void 0:y.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")}))),l.createElement(a.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==y?void 0:y.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&l.createElement(a.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:s(null==T?void 0:T.message),onClose:()=>{h(!1)},isDleteBtn:!0})))},_r=e=>{let{style:n}=e;return l.createElement("span",null,l.createElement("svg",{style:v({},n),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"})))},fr=e=>{let{t:n,userType:t=!1,infoBannerLabel:o="",infoClickLable:i="",infoClickInfoLabel:r="",infoClickInfoLabel1:u=""}=e;t=t||Digit.SessionStorage.get("userType");const d=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:d?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(a.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(o))),n(i)+" ",l.createElement(_r,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},gr=e=>{var n,i,r,u,d,s,c;let{wsAdditionalDetails:v}=e;const{t:p}=o.useTranslation(),[m,E]=t.useState(!1),[S,_]=t.useState({}),f=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"})),C=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(g,null));return l.createElement(t.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=v&&null!==(n=v.additionalDetails)&&void 0!==n&&n.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let n=v.additionalDetails.data||{};const t=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=t?JSON.parse(t):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(n=null==l?void 0:l.value),_(n),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},p("WS_PAYMENT_VIEW_BREAKUP"))):null,m&&l.createElement(a.Modal,{headerBarMain:l.createElement(f,{label:p("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(C,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(a.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(a.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_APPLICATION_FEE_HEADER")),null==S||null===(i=S.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(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(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==S?void 0:S.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(a.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_SERVICE_FEE_HEADER")),null==S||null===(u=S.billSlabData)||void 0===u||null===(d=u.CHARGES)||void 0===d?void 0:d.map(e=>l.createElement(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(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(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==S?void 0:S.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==S||null===(s=S.billSlabData)||void 0===s||null===(c=s.TAX)||void 0===c?void 0:c.map(e=>l.createElement(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(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(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==S?void 0:S.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},Cr={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:{}},Nr=e=>{let{className:n="table",headers:t=[],values:i=[],arrears:a=0}=e;const{t:r}=o.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:Cr.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:Cr.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:v({},Cr.cell,Cr.cellLeft,Cr.cellHeader)},r("CS_BILL_PERIOD")),t.map((e,n)=>l.createElement("th",{style:v({},Cr.cell,t.length==n+1?Cr.cellRight:{},Cr.cellHeader),key:n},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,n)=>l.createElement("tr",{key:n},l.createElement("td",{style:v({},Cr.cell,Cr.cellLeft),component:"th",scope:"row"},Object.keys(i)[n]),t.map((n,o)=>l.createElement("td",{style:v({},Cr.cell,{textAlign:"left"},t.length==o+1?Cr.cellRight:{},{whiteSpace:"pre"}),key:o,numeric:!0},o>1&&"₹",e[n]&&e[n].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:v({},Cr.cell,Cr.cellLeft)}),t.map((e,n)=>n==t.length-1?l.createElement("td",{style:v({},Cr.cell,Cr.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:n,numeric:!0},a):n==t.length-2?l.createElement("td",{style:v({},Cr.cell,{textAlign:"left"}),key:n,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:Cr.cell,key:n,numeric:!0})))))))},yr={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))"}},Dr=e=>{var n,i,a;let{bill:r={}}=e;const{t:u}=o.useTranslation();let d={},s=(null==r||null===(n=r.billDetails)||void 0===n?void 0:n.sort((e,n)=>n.fromPeriod-e.fromPeriod))||[];s=[...s];const c=(null===(i=s)||void 0===i?void 0:i.reduce((e,n,t)=>0===t?e:e+n.amount,0))||0;let v="₹ "+((null==c||null===(a=c.toFixed)||void 0===a?void 0:a.call(c,0))||Number(0).toFixed(0));s.shift(),s.map(e=>{let n=function(e){var n,t,l;void 0===e&&(e={});let o={};const{billAccountDetails:i=[]}=e;return i.map(e=>{o[e.taxHeadCode]={value:e.amount,order:e.order}}),o.CS_BILL_NO={value:(null===(n=e)||void 0===n?void 0:n.billNumber)||"NA",order:-2},o.CS_BILL_DUEDATE={value:(null===(t=e)||void 0===t?void 0:t.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},o.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},o}(e);d[((e,n)=>{const t=new Date(e),l=new Date(n);return l.getYear()-t.getYear()!=0?"FY"+(t.getYear()+1900)+"-"+(l.getYear()-100):t.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=n});let p={};!d||Object.keys(d).map((e,n)=>{Object.keys(d[e]).map(n=>{p[n]=d[e]&&d[e][n]&&d[e][n].order||0})});let m=[];m=Object.keys(p),m.sort((e,n)=>p[e]-p[n]);const[E,S]=t.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:yr.headerStyle},u("CS_ARREARS_DETAILS")),E&&l.createElement(Nr,{headers:[...m],values:d,arrears:v}),!E&&l.createElement("div",{style:yr.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{S(!0)}},u("CS_SHOW_CARD"))),E&&l.createElement("div",{style:yr.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{S(!1)}},u("CS_HIDE_CARD"))))},Tr=()=>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"})),hr=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Tr,null)),Ar=e=>{let{t:n,closeModal:t}=e;console.log(" ----- Renew POP coming "),Digit.Hooks.sv.useCreateDemand();const o=i.useHistory();return l.createElement(l.Fragment,null,l.createElement(s.Modal,{headerBarMain:l.createElement(e=>l.createElement("h1",{className:"heading-m"},e.label),{label:"SV_WANT_TO_EDIT"}),headerBarEnd:l.createElement(hr,{onClick:t}),actionCancelLabel:n("CS_COMMON_BACK"),actionCancelOnSubmit:t,hideSubmit:!0,formId:"modal-action"},l.createElement(s.Card,{style:{boxShadow:"none"}},l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},l.createElement(s.SubmitBar,{label:n("SV_YES_PROCEED_WITH_APPLICATION"),onSubmit:()=>{o.push("renew-application/info")}}),l.createElement(s.SubmitBar,{label:n("SV_NO_PROCEED_PAYEMNT"),onSubmit:()=>{console.log(" testing coming compilter"),o.push("renew-application/check/makePayment")}})))))};function Ir(e){var n,r,u,d,s,c,v,p,m,E,S,f,g,C,N;let{applicationDetails:y,workflowDetails:D,isDataLoading:T,applicationData:h,timelineStatusPrefix:A,showTimeLine:I=!0,statusAttribute:O="status",paymentsList:b,oldValue:L,isInfoLabel:R=!1}=e;const{t:w}=o.useTranslation(),W=(i.useHistory(),i.useLocation()),[P,M]=t.useState(!1),[x,B]=t.useState(null);new URLSearchParams(W.search);let{id:F}=i.useParams();const U=null==y||null===(n=y.applicationData)||void 0===n?void 0:n.owners;function k(e,n,t){var l;window.open(null==t||null===(l=t.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("ownersSequences:- ",U);const[H,j]=t.useState({}),[V,z]=t.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==h?void 0:h.status)||V.loading||V.loaded||V.canLoad||z({loading:!1,loaded:!1,canLoad:!0}),null==V||!V.canLoad||V.loading||V.loaded||(z({loading:!0,loaded:!1,canLoad:!0}),function(e,n,t,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:n}})).then(function(o){function i(){t(a),l({loading:!1,loaded:!0,canLoad:!0})}let a={};const r=function(t){if((null==o||null===(t=o.Assessments)||void 0===t?void 0:t.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:n})).then(function(e){a=e})}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==h?void 0:h.tenantId)||tenantId,null==h?void 0:h.propertyId,j,z));const Y=e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()},G=function(e,n,t){if(void 0===n&&(n=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var o;const e={date:Y(null==h||null===(o=h.auditDetails)||void 0===o?void 0:o.createdTime),source:(null==h?void 0:h.channel)||""};return l.createElement(sr,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,a,r,u,d,s,c,v,p,m,E,S,f,g,C,N,D,T;const o={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.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 t="";return t="+91 "+_.get(e,"ProcessInstances["+n+"].assignes[0].mobileNumber"),t}}},A=t&&t[n-1]&&(null==t?void 0:t[n-1]),I={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.name,mobileNumber:(null==h||null===(s=h.processInstance)||void 0===s||null===(c=s.assignes)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.uuid)===(null==e||null===(p=e.assignes)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.uuid)&&null!=h&&null!==(E=h.processInstance)&&void 0!==E&&null!==(S=E.assignes)&&void 0!==S&&null!==(f=S[0])&&void 0!==f&&f.mobileNumber?null==h||null===(g=h.processInstance)||void 0===g||null===(C=g.assignes)||void 0===C||null===(N=C[0])||void 0===N?void 0:N.mobileNumber:null==e||null===(D=e.assignes)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.mobileNumber,comment:w(e&&(null==e?void 0:e.comment)),wfComment:A?A&&A.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(sr,{data:I,OpenImage:k,privacy:o})}{var A,I,O,b,L;const n={date:Y(null==h||null===(A=h.auditDetails)||void 0===A?void 0:A.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===(b=e.assignes)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.mobileNumber,thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(sr,{data:n,OpenImage:k})}},q=(e,n)=>e?n?e:w(e):w("NA"),K=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),X=window.location.href.includes("employee/noc"),Z=window.location.href.includes("employee/obps"),$=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||K?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),J=e=>{if(null!=e&&e.isTimeValue&&null!=e&&e.value){const n=e.value,[t,l]=n.split(":").map(e=>parseInt(e,10));if(!isNaN(t)&&!isNaN(l)){const e=t>=12?"PM":"AM";return(t%12||12)+":"+String(l).padStart(2,"0")+" "+e}return e.value}return null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?q(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+w(null==e?void 0:e.isUnit):w("N/A"):null!=e&&e.value?q(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):w("N/A")},[Q,ee]=t.useState(!1);return l.createElement(a.Card,{style:{position:"relative"},className:"employeeCard-override"},R?l.createElement(fr,{t:w,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===(r=y.applicationDetails)||void 0===r?void 0:r.map((e,n)=>{var t,o,r,u,d,s,c,v,p,m,E,S,_,f,g,C,N,T,h,A,I,O,R,W,P,x,U,k,j,V,z,Y,G,q,Q,ee,ne,te,le;return l.createElement(l.Fragment,{key:n},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"}:K?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==n||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(a.CardSectionHeader,{style:0==n&&K?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},X?""+w(e.title):w(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(a.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},w(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse",borderCollapse:"collapse",border:"1px solid black"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"5px",border:"1px solid black"}},w(e)))),null==e?void 0:e.tableRows.map((n,t)=>l.createElement("tr",null,n.map((n,o)=>Array.isArray(n)&&n.length>1&&!0===e.isMaintenance?l.createElement("td",{style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"},key:o},l.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"5px"}},n.map((e,n)=>l.createElement("a",{key:n,onClick:()=>{Digit.UploadServices.Filefetch([e.fileStoreId],Digit.ULBService.getStateId()).then(e=>{var n,t,l;console.log("Response of file:",e);const o=null==e||null===(n=e.data)||void 0===n||null===(t=n.fileStoreIds)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.url;if(o){const e=o.split(",")[0];e?window.open(e,"_blank"):console.error("No valid URL found to open!")}else console.error("URL is missing in the response!")}).catch(e=>{console.error("Error fetching file:",e)})},rel:"noopener noreferrer",style:{marginRight:"5px",display:"inline-block",cursor:"pointer"}},l.createElement(a.PDFSvg,{style:{width:"25px",height:"25px"}}))))):l.createElement("td",{key:o,style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"}},console.log("Comming Maintainaince data row:- ",n.data),n&&!0===n.editButton?l.createElement("span",{style:{display:"inline-flex",gap:"10px",alignItems:"center"}},l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/asset/assetservice/maintenance-edit/"+F,state:{data:n.data}}},l.createElement("button",null," ",l.createElement(a.EditIcon,null)," ")),l.createElement("div",{key:t,onClick:()=>(B(n.data),void M(!0)),style:{cursor:"pointer"}},l.createElement(a.ViewsIcon,null))):w(n)))))),l.createElement(a.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||K?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(t=e.values)||void 0===t?void 0:t.map((n,t)=>{var o,r,u;return!0===n.map&&"N/A"!==n.value?l.createElement(a.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:w(n.title),label:w(n.title),text:l.createElement("img",{src:w(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(a.Row,{key:w(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"}},w(null==n?void 0:n.title)))):X||Z?""+w(n.title):w(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:t===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:$(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(a.Row,{className:"border-none",key:""+n.title,label:""+w(""+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(a.Row,{key:w(n.title),label:w(n.title),text:J(n),last:t===(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:$(),labelStyle:{wordBreak:"break-all",fontWeight:n.isBold?"bold":"normal",fontStyle:n.isBold?"italic":"normal"},textStyle:{wordBreak:"break-all",fontWeight:n.isBold?"bold":"normal",fontStyle:n.isBold?"italic":"normal"}}),"PT_TOTAL_DUES"===n.title?l.createElement(Dr,{bill:null===(r=H.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.inspectionReport)&&l.createElement(rr,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:b}),(null==y||null===(r=y.applicationData)||void 0===r||null===(u=r.additionalDetails)||void 0===u||null===(d=u.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(s=e.additionalDetails)||void 0===s?void 0:s.fiReport)&&l.createElement(Qa,{fiReport:null==y||null===(c=y.applicationData)||void 0===c||null===(v=c.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(ir,{floors:null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.floors}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.owners)&&l.createElement(ar,{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(vr,{units:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.units}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.accessories)&&l.createElement(cr,{units:null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.accessories}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.permissions)&&(null==D||null===(T=D.data)||void 0===T||null===(h=T.nextActions)||void 0===h?void 0:h.length)>0&&l.createElement(tr,{applicationData:null==y?void 0:y.applicationData,t:w,permissions:null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.permissions}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.obpsDocuments)&&l.createElement($a,{t:w,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:D}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.noc)&&l.createElement(nr,{t:w,isNoc:!0,NOCdata:e.values,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.noc,noc:null===(R=e.additionalDetails)||void 0===R?void 0:R.data,bpaActionsDetails:D}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.scruntinyDetails)&&l.createElement(rr,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(P=e.additionalDetails)||void 0===P?void 0:P.buildingExtractionDetails)&&l.createElement(rr,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.subOccupancyTableDetails)&&l.createElement(ur,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl)&&l.createElement(Za,{documents:null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl}),(null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documents)&&l.createElement(lr,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documents}),(null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.taxHeadEstimatesCalculation)&&l.createElement(or,{taxHeadEstimatesCalculation:null==e||null===(Y=e.additionalDetails)||void 0===Y?void 0:Y.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(pr,{wsAdditionalDetails:e,oldValue:L}),(null==e||null===(G=e.additionalDetails)||void 0===G?void 0:G.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(q=e.additionalDetails)||void 0===q||null===(Q=q.redirectUrl)||void 0===Q?void 0:Q.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(ne=ee.redirectUrl)||void 0===ne?void 0:ne.title))),(null==e||null===(te=e.additionalDetails)||void 0===te?void 0:te.estimationDetails)&&l.createElement(Sr,{wsAdditionalDetails:e,workflowDetails:D}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(gr,{wsAdditionalDetails:e,workflowDetails:D}))}),I&&(null==D||null===(u=D.data)||void 0===u||null===(d=u.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(l.Fragment,null,l.createElement(a.BreakLine,null),((null==D?void 0:D.isLoading)||T)&&l.createElement(a.Loader,null),!(null!=D&&D.isLoading)&&!T&&l.createElement(t.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},w("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=D&&null!==(s=D.data)&&void 0!==s&&s.timeline&&1===(null==D||null===(c=D.data)||void 0===c||null===(v=c.timeline)||void 0===v?void 0:v.length)?l.createElement(a.CheckPoint,{isCompleted:!0,label:w(""+A+(null==D||null===(p=D.data)||void 0===p||null===(m=p.timeline[0])||void 0===m?void 0:m.state)),customChild:G(null==D||null===(E=D.data)||void 0===E?void 0:E.timeline[0],null==D||null===(S=D.data)||void 0===S?void 0:S.timeline)}):l.createElement(a.ConnectingCheckPoints,null,(null==D||null===(f=D.data)||void 0===f?void 0:f.timeline)&&(null==D||null===(g=D.data)||void 0===g?void 0:g.timeline.slice(0,Q?null==D?void 0:D.data.timeline.length:2).map((e,n,t)=>{var o;let i="";var r,u,d,s,c,v;return window.location.href.includes("/obps/")&&(i=null!=D&&null!==(r=D.data)&&void 0!==r&&null!==(u=r.timeline[n-1])&&void 0!==u&&null!==(d=u.state)&&void 0!==d&&d.includes("BACK_FROM")||null!=D&&null!==(s=D.data)&&void 0!==s&&null!==(c=s.timeline[n-1])&&void 0!==c&&null!==(v=c.state)&&void 0!==v&&v.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(a.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:w(""+A+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[O])+i),customChild:G(e,n,null==D||null===(o=D.data)||void 0===o?void 0:o.timeline)}))}))),(null==D||null===(C=D.data)||void 0===C||null===(N=C.timeline)||void 0===N?void 0:N.length)>2&&l.createElement(a.LinkButton,{label:w(Q?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ee(e=>!e)}})))),l.createElement("div",null,P&&l.createElement(Ar,{t:w,closeModal:()=>setRnewButton(!1),actionCancelOnSubmit:()=>setRnewButton(!1),application:application})))}function Or(e){var n,t,o,i,r,u,d,s,c,v,p,m,E,S,_,f,g,C;let{t:N,showToast:y,closeToast:D,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var h;let e="";switch(null==y||null===(h=y.action)||void 0===h?void 0:h.action){case"SENDBACK":e="error"===(null==y?void 0:y.key)?null==y||null===(n=y.error)||void 0===n?void 0:n.message:N("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==y?void 0:y.key)?null==y||null===(t=y.error)||void 0===t?void 0:t.message:N("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==y?void 0:y.key)?null==y||null===(o=y.error)||void 0===o?void 0:o.message:N("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==y?void 0:y.key)?null==y||null===(i=y.error)||void 0===i?void 0:i.message:N("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==y?void 0:y.key)?null==y||null===(r=y.error)||void 0===r?void 0:r.message:N("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==y?void 0:y.key)?null==y||null===(u=y.error)||void 0===u?void 0:u.message:N("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==y?void 0:y.key)?null==y||null===(d=y.error)||void 0===d?void 0:d.message:N("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==y?void 0:y.key)?null==y||null===(s=y.error)||void 0===s?void 0:s.message:N("ES_"+T+"_"+(null==y||null===(c=y.action)||void 0===c?void 0:c.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,y&&l.createElement(a.Toast,{error:"error"===y.key,label:e,onClose:D}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var A;const e=function(e){var n;void 0===e&&(e=[]);let t=e[0];return t=2==(null===(n=e)||void 0===n?void 0:n.length)&&null!=T&&T.includes("BPA_OC")?N(e[1]):N(e[0]),t};let n="";switch(null==y||null===(A=y.action)||void 0===A?void 0:A.action){case"REVOCATE":n="error"===(null==y?void 0:y.key)?null==y||null===(v=y.error)||void 0===v?void 0:v.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==y?void 0:y.key)?null==y||null===(p=y.error)||void 0===p?void 0:p.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==y?void 0:y.key)?null==y||null===(m=y.error)||void 0===m?void 0:m.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==y?void 0:y.key)?null==y||null===(E=y.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==y?void 0:y.key)?null==y||null===(S=y.error)||void 0===S?void 0:S.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==y?void 0:y.key)?null==y||null===(_=y.error)||void 0===_?void 0:_.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==y?void 0:y.key)?null==y||null===(f=y.error)||void 0===f?void 0:f.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==y?void 0:y.key)?null==y||null===(g=y.error)||void 0===g?void 0:g.message:N("ES_"+T+"_"+(null==y||null===(C=y.action)||void 0===C?void 0:C.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,y&&l.createElement(a.Toast,{error:"error"===y.key,label:n,onClose:D}))}{var I,O;const e="error"===(null==y?void 0:y.key)?null==y||null===(I=y.error)||void 0===I?void 0:I.message:"ES_"+T+"_"+(null==y||null===(O=y.action)||void 0===O?void 0:O.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,y&&l.createElement(a.Toast,{error:"error"===y.key,label:N(e),onClose:D}))}}function br(e){var n,i,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T;let{workflowDetails:h,displayMenu:A,onActionSelect:I,setDisplayMenu:O,businessService:b,forcedActionPrefix:L,ActionBarStyle:R={},MenuStyle:w={},isAction:W,applicationDetails:P}=e;const{t:M}=o.useTranslation();let x=Digit.UserService.getUser();const B=t.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),n=e?JSON.parse(e):{};x=null==n?void 0:n.value}const F=null===(n=x)||void 0===n||null===(i=n.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let U=!1,k=!1,H=(null==h||null===(u=h.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s?void 0:s.filter(e=>(null==F?void 0:F.some(n=>{var t;return null===(t=e.roles)||void 0===t?void 0:t.includes(n)}))||!e.roles))||(null==h||null===(c=h.data)||void 0===c||null===(p=c.nextActions)||void 0===p?void 0:p.filter(e=>(null==F?void 0:F.some(n=>{var t;return null===(t=e.roles)||void 0===t?void 0:t.includes(n)}))||!e.roles));Digit.Hooks.useClickOutside(B,()=>{O(!1)},A),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==H?void 0:H.length)||null!=H&&null!==(m=H[0])&&void 0!==m&&null!==(E=m.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==H?void 0:H.length)?(k=!1,U=!0):(null==H?void 0:H.length)>0&&(k=!0,U=!1);const j=Digit.SessionStorage.get("User"),V=null==j||null===(S=j.info)||void 0===S?void 0:S.uuid,z=null==P||null===(_=P.applicationData)||void 0===_||null===(f=_.auditDetails)||void 0===f?void 0:f.lastModifiedBy;return l.createElement(l.Fragment,null,!(null!=h&&h.isLoading)&&k&&!U&&!W&&l.createElement(a.ActionBar,{style:v({},R)},A&&(null!=h&&null!==(g=h.data)&&void 0!==g&&null!==(C=g.actionState)&&void 0!==C&&C.nextActions||null!=h&&null!==(N=h.data)&&void 0!==N&&N.nextActions)?l.createElement(a.Menu,{localeKeyPrefix:L||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()),options:H,optionKey:"action",t:M,onSelect:I,style:w}):null,"ewst"===b?z===V||null==z?l.createElement(a.SubmitBar,{ref:B,label:M("WF_TAKE_ACTION"),onSubmit:()=>O(!A)}):l.createElement(a.CardLabel,{style:{color:"red",font:"30px",fontWeight:"bold"}},""+M("EW_ALERT_ANOTHER_VENDOR")):l.createElement(a.SubmitBar,{ref:B,label:M("WF_TAKE_ACTION"),onSubmit:()=>O(!A)})),!(null!=h&&h.isLoading)&&!k&&U&&!W&&l.createElement(a.ActionBar,{style:v({},R)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==H||null===(y=H[0])||void 0===y?void 0:y.action,value:null==H||null===(D=H[0])||void 0===D?void 0:D.action,onClick:e=>{I((null==H?void 0:H[0])||{})}},M((L||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()))+"_"+(null==H||null===(T=H[0])||void 0===T?void 0:T.action)))))}const Lr=()=>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"})),Rr=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Lr,null));function wr(e){let{action:n,closeWarningPopup:t}=e;const{t:i}=o.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(a.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Rr,{onClick:()=>{t()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(a.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(a.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(a.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:t,style:{marginLeft:"10px"}}),l.createElement(a.ButtonSelector,{label:i("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 Wr=e=>{var n;const r=Digit.ULBService.getCurrentTenantId(),u=Digit.ULBService.getStateId(),{t:s}=o.useTranslation(),c=i.useHistory();let{id:p}=i.useParams();const[m,E]=t.useState(!1),[S,_]=t.useState(null),[f,g]=t.useState(!1),[C,N]=t.useState(!1),[y,D]=t.useState(!1),{applicationDetails:T,showToast:h,setShowToast:A,isLoading:I,isDataLoading:O,applicationData:b,mutate:L,nocMutation:R,workflowDetails:w,id:W,businessService:P,closeToast:M,moduleCode:x,timelineStatusPrefix:B,forcedActionPrefix:F,statusAttribute:U,ActionBarStyle:k,MenuStyle:H,paymentsList:j,showTimeLine:V=!0,oldValue:z,isInfoLabel:Y=!1,clearDataDetails:G,isAction:q=!1}=e;t.useEffect(()=>{h&&w.revalidate()},[h]);const K=d.useQueryClient(),X=()=>{_(null),g(!1)};return I||C?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,I?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(Ir,{applicationDetails:T,id:W,workflowDetails:w,isDataLoading:O,applicationData:b,businessService:P,timelineStatusPrefix:B,statusAttribute:U,paymentsList:j,showTimeLine:V,oldValue:z,isInfoLabel:Y}),f?l.createElement(Xa,{t:s,vending_Zone:(null==e?void 0:e.vending_Zone)||[],UserVendingZone:(null==e?void 0:e.UserVendingZone)||"",UserVendingZoneCode:(null==e?void 0:e.UserVendingZoneCode)||"",action:S,tenantId:r,state:u,id:p,applicationDetails:T,applicationData:null==T?void 0:T.applicationData,closeModal:X,submitAction:function(e,n,t){void 0===n&&(n=!1),void 0===t&&(t={});try{let l=!1;const o=function(o,i,a,r,u,d,p,m,E,S,_,f){if(0!=(null==e||null===(o=e.Property)||void 0===o||null===(i=o.workflow)||void 0===i||null===(a=i.comment)||void 0===a?void 0:a.length)&&0!=(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.comment)||void 0===d?void 0:d.length)&&0!=(null==e||null===(p=e.WaterConnection)||void 0===p||null===(m=p.comment)||void 0===m?void 0:m.length)&&0!=(null==e||null===(E=e.SewerageConnection)||void 0===E||null===(S=E.comment)||void 0===S?void 0:S.length)&&0!=(null==e||null===(_=e.BPA)||void 0===_||null===(f=_.comment)||void 0===f?void 0:f.length)){function g(n){if(l)return n;sessionStorage.setItem("updateData",JSON.stringify(e)),L&&(N(!0),L(e,{onError:(e,n)=>{N(!1),A({key:"error",error:e}),setTimeout(M,5e3)},onSuccess:(e,n)=>{var l,o,i,a,r,u,d,v,p,m,E,S;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),N(!1),null!==(l=t)&&void 0!==l&&l.bpa&&c.replace("/digit-ui/employee/obps/response",{data:e}),null!==(o=t)&&void 0!==o&&o.isStakeholder&&c.push("/digit-ui/employee/obps/stakeholder-response",{data:e}),null!==(i=t)&&void 0!==i&&i.isNoc&&c.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(a=e.Amendments)||void 0===a?void 0:a.length)>0?null!=n&&null!==(r=n.AmendmentUpdate)&&void 0!==r&&null!==(u=r.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?A({key:"success",label:s("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=n&&null!==(d=n.AmendmentUpdate)&&void 0!==d&&null!==(v=d.workflow)&&void 0!==v&&v.action.includes("RE-SUBMIT")?A({key:"success",label:s("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=n&&null!==(p=n.AmendmentUpdate)&&void 0!==p&&null!==(m=p.workflow)&&void 0!==m&&m.action.includes("APPROVE")?A({key:"success",label:s("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=n&&null!==(E=n.AmendmentUpdate)&&void 0!==E&&null!==(S=E.workflow)&&void 0!==S&&S.action.includes("REJECT")&&A({key:"success",label:s("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(G&&setTimeout(G,3e3),setTimeout(M,5e3),K.clear(),K.refetchQueries("APPLICATION_SEARCH"))}})),X()}N(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(v({},e)));const o=function(){if(!1!==n&&R){var e;const t=null===(e=n)||void 0===e?void 0:e.map(e=>null==R?void 0:R.mutateAsync(e)),o=Ji(function(){return N(!0),Promise.resolve(Promise.all(t)).then(function(e){e&&e.map(e=>{var n,t;Digit.SessionStorage.del(null==e||null===(n=e.Noc)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.nocType)})})},function(e){var n,t,o,i,a,r,u,d,c,v,p,m;N(!1);let E=null!=e&&null!==(n=e.response)&&void 0!==n&&null!==(t=n.data)&&void 0!==t&&null!==(o=t.Errors)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.code?s(null==e||null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.code):(null==e||null===(c=e.response)||void 0===c||null===(v=c.data)||void 0===v||null===(p=v.Errors)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.message)||e;X(),A({key:"error",error:{message:E}}),setTimeout(M,5e3),l=!0});if(o&&o.then)return o.then(function(){})}}();return o&&o.then?o.then(g):g(o)}alert("Please fill in the comments before submitting")}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==w||null===(n=w.data)||void 0===n?void 0:n.timeline,businessService:P,workflowDetails:w,moduleCode:x}):null,y?l.createElement(wr,{action:S,workflowDetails:w,businessService:P,isWarningPop:y,closeWarningPopup:()=>{D(!1)}}):null,l.createElement(Or,{t:s,showToast:h,closeToast:M,businessService:P}),l.createElement(br,{isAction:q,workflowDetails:w,displayMenu:m,onActionSelect:function(e){if(sessionStorage.setItem("SELECTED_ACTION",null==e?void 0:e.action),e)if(null!=e&&e.isToast)A({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(M,5e3);else if(null!=e&&e.isWarningPopUp)D(!0);else if(null!=e&&e.redirectionUrll){var n,t,l,o,i;if("ACTIVATE_CONNECTION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action))c.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.state,url:""+(null===(i=location)||void 0===i?void 0:i.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action)){var a,r;c.push(""+(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.pathname),{data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state})}else{var u;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname))}}else if(null!=e&&e.redirectionUrl){var d,s;c.push({pathname:null===(d=e.redirectionUrl)||void 0===d?void 0:d.pathname,state:v({},null===(s=e.redirectionUrl)||void 0===s?void 0:s.state)})}else g(!0);_(e),E(!1)},setDisplayMenu:E,businessService:P,forcedActionPrefix:F,ActionBarStyle:k,MenuStyle:H,applicationDetails:T})))};function Pr(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var t=function(){var l=arguments,o=n?n.apply(this,l):l[0],i=t.cache;if(i.has(o))return i.get(o);var a=e.apply(this,l);return t.cache=i.set(o,a)||i,a};return t.cache=new(Pr.Cache||vn),t}Pr.Cache=vn;var Mr,xr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Br=/\\(\\)?/g;Mr=Pr(function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(xr,function(e,t,l,o){n.push(l?o.replace(Br,"$1"):t||e)}),n},function(e){return 500===Mr.size&&Mr.clear(),e}).cache;const Fr=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),Ur=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),kr=e=>{let{register:n,reset:o,t:i}=e;return i("ES_SEARCH_APPLICATION_MOBILE_INVALID"),i("ERR_DEFAULT_INPUT_FIELD_MSG"),l.createElement(t.Fragment,null,l.createElement(a.SearchField,{style:{width:"100%"}},l.createElement("label",null,i("WS_PROPERTY_ID_LABEL")),l.createElement(a.TextInput,{name:"propertyId",inputRef:n({})})),l.createElement(a.SearchField,{className:"submit"},l.createElement(a.SubmitBar,{label:i("WS_SEARCH_CONNECTION_SEARCH_INTEGRATED_BUTTON"),submit:!0}),l.createElement("p",{onClick:()=>{o({searchType:"CONNECTION",mobileNumber:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",propertyId:"",connectionNumber:"",oldConnectionNumber:""})}},i("WS_SEARCH_CONNECTION_RESET_BUTTON"))))},Hr=e=>{let{tenantId:n,onSubmit:u,data:d,count:s,resultOk:c,isLoading:v}=e;console.log("dafff",d);const{t:p}=o.useTranslation(),{register:m,control:E,handleSubmit:S,setValue:_,getValues:f,reset:g}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",searchType:"CONNECTION"}});t.useEffect(()=>{m("offset",0),m("limit",10),m("sortBy","commencementDate"),m("searchType","CONNECTION"),m("sortOrder","DESC"),m("propertyId","")},[m]);const C=t.useCallback(e=>{0!==e.length&&(_("sortBy",e.id),_("sortOrder",e.desc?"DESC":"ASC"))},[]),N=e=>l.createElement("span",{className:"cell-text"},e),y=t.useMemo(()=>[{Header:p("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a;let{row:r}=e;return l.createElement("div",null,r.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+r.original.connectionNo+"&tenantId="+n+"&service="+(null===(t=r.original)||void 0===t?void 0:t.service)+"&connectionType="+(null===(o=r.original)||void 0===o?void 0:o.connectionType)+"&due="+((null===(a=r.original)||void 0===a?void 0:a.due)||0)+"&from=WS_SEWERAGE_CONNECTION_SEARCH_LABEL"},r.original.connectionNo||"NA")):l.createElement("span",null,p("NA")))}},{Header:p("WS_COMMON_TABLE_COL_SERVICE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return N(null!=t&&null!==(n=t.original)&&void 0!==n&&n.applicationNo.includes("WS")?"Water Service":"Sewerage Service")}},{Header:p("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o,i;let{row:a}=e;return N(null!=a&&null!==(n=a.original)&&void 0!==n&&null!==(t=n.connectionHolders)&&void 0!==t&&t.map(e=>null==e?void 0:e.name).join(",")?null==a||null===(l=a.original)||void 0===l||null===(o=l.connectionHolders)||void 0===o?void 0:o.map(e=>null==e?void 0:e.name).join(","):""+((null===(i=a.original)||void 0===i?void 0:i.owner)||"NA"))}},{Header:p("WS_COMMON_TABLE_COL_STATUS_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return N(p("WS_"+(null===(n=l.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())))}},{Header:p("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return N(""+((null===(n=t.original)||void 0===n?void 0:n.due)||"NA"))}},{Header:p("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return N(""+((null===(n=t.original)||void 0===n?void 0:n.address)||"NA"))}},{Header:p("WS_COMMON_TABLE_COL_DUE_DATE_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o;let{row:i}=e;const a=(null===(n=i.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())||"",r="NA"===(null===(l=i.original)||void 0===l?void 0:l.dueDate)?p("WS_NA"):(e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()})(null===(o=i.original)||void 0===o?void 0:o.dueDate);return N(p("INACTIVE"===a?"WS_NA":""+r))}}],[]);return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},p("WS_WATER_SEWERAGE_INTEGRATED_BILL_SUB_HEADER")),l.createElement(a.SearchForm,{className:"ws-custom-wrapper",onSubmit:u,handleSubmit:S},l.createElement(kr,{register:m,control:E,reset:g,tenantId:n,t:p})),v?l.createElement(a.Loader,null):null,null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},p(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement("div",null,l.createElement(a.Table,{t:p,data:d,totalRecords:s,columns:y,getCellProps:e=>({style:{minWidth:e.column.Header===p("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){_("limit",Number(e.target.value)),S(u)()},currentPage:f("offset")/f("limit"),onNextPage:function(){_("offset",f("offset")+f("limit")),S(u)()},onPrevPage:function(){_("offset",f("offset")-f("limit")),S(u)()},pageSizeLimit:f("limit"),onSort:C,disableSort:!1,sortParams:[{id:f("sortBy"),desc:"DESC"===f("sortOrder")}]}),l.createElement("button",{className:"submit-bar",type:"button",onClick:function(){try{console.log("integrated",d);const e=function(){if((null==d?void 0:d.length)>0){const e=he(function(){return Promise.resolve(Digit.WSService.wnsGroupBill({propertyId:d[0].propertyId,tenantId:n})).then(function(e){((e,n)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var t=new FileReader;t.readAsDataURL(e),t.onloadend=function(){window.mSewaApp.downloadBase64File(t.result,"IntegratedBill.pdf")}}else{const n=document.createElement("a");n.href=URL.createObjectURL(e),n.download="IntegratedBill.pdf",document.body.append(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(n.href),7e3)}})(new Blob([e.data],{type:"application/pdf"}))})},function(e){console.log("errorrrrrr",e)});if(e&&e.then)return e.then(function(){})}else alert("NO Pdf")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},style:{fontFamily:"sans-serif",color:"white",fontSize:"19px",marginTop:"10px",float:"right"}},p("WS_DOWNLOAD_BILL"))):null)},jr={WSModule:e=>{var n;let{stateCode:t,userType:o,tenants:r}=e;const u=["ws","pt","common",(null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code)||Digit.ULBService.getCurrentTenantId(),"bill-amend","abg"],{path:d}=i.useRouteMatch(),s=Digit.StoreData.getCurrentLanguage(),{isLoading:c}=Digit.Services.useStore({stateCode:t,moduleCode:u,language:s});return Digit.SessionStorage.set("WS_TENANTS",r),Digit.SessionStorage.set("PT_TENANTS",r),c?l.createElement(a.Loader,null):l.createElement("citizen"===o?z:ye,{path:d,stateCode:t})},WSLinks:e=>{let{matchPath:n}=e;const{t:t}=o.useTranslation(),i=[{link:n+"/my-bills",i18nKey:t("ACTION_TEST_WNS_MY_BILLS")},{link:n+"/my-payments",i18nKey:t("ACTION_TEST_MY_PAYMENTS")},{link:n+"/create-application",i18nKey:t("ACTION_TEST_APPLY_NEW_CONNECTION")},{link:n+"/search",i18nKey:t("ACTION_TEXT_WS_SEARCH_AND_PAY")},{link:n+"/my-applications",i18nKey:t("ACTION_TEXT_WS_MY_APPLICATION")},{link:n+"/my-connections",i18nKey:t("ACTION_TEXT_WS_MY_CONNECTION")}];return l.createElement(a.CitizenHomeCard,{header:t("ACTION_TEST_WATER_AND_SEWERAGE"),links:i,Icon:()=>l.createElement(a.WSICon,null)})},WSServiceName:e=>{let{t:n,config:o,onSelect:i,userType:r,formData:u}=e;const[d,s]=t.useState((null==u?void 0:u.serviceName)||""),[c,v]=t.useState(u||{}),p=window.location.href.includes("/ws/edit-application/");return l.createElement("div",null,"citizen"===r&&l.createElement(Te,{currentStep:2}),l.createElement(a.FormStep,{t:n,config:o,onSelect:()=>{var e;if("WATER"==(null==d?void 0:d.code)?sessionStorage.setItem("serviceName","WATER"):"SEWERAGE"==(null==d?void 0:d.code)?sessionStorage.setItem("serviceName","SEWERAGE"):sessionStorage.setItem("serviceName",""),"BOTH"!=(null==d?void 0:d.code)&&(null==c||null===(e=c.serviceName)||void 0===e?void 0:e.code)!=(null==d?void 0:d.code)){let e=c;e.waterConectionDetails={},e.sewerageConnectionDetails={},e.serviceName=d,i("",e)}else i(o.key,d)},onSkip:()=>i(),isDisabled:!d,onAdd:function(){}},l.createElement(a.CardLabel,null,n("WS_SELECT_SERVICE_TYPE_WANT_TO_APPLY")),l.createElement(a.RadioOrSelect,{name:"gender",options:[{i18nKey:"WS_WATER_CONNECTION_ONLY",code:"WATER"},{i18nKey:"WS_SEWERAGE_CONNECTION_ONLY",code:"SEWERAGE"},{i18nKey:"WS_BOTH_WATER_AND_SEWERAGE",code:"BOTH"}],selectedOption:d,optionKey:"i18nKey",onSelect:function(e){s(e)},t:n,disabled:p})))},WSWaterConnectionDetails:e=>{var n,o;let{t:i,config:r,userType:u,onSelect:d,formData:s}=e;const c=Digit.ULBService.getStateId(),[p,m]=t.useState((null==s||null===(n=s.waterConectionDetails)||void 0===n?void 0:n.proposedTaps)||""),[E,S]=t.useState((null==s||null===(o=s.waterConectionDetails)||void 0===o?void 0:o.proposedPipeSize)||""),[_,f]=t.useState(!1),[g,C]=t.useState(null),[N,y]=t.useState(null),[D,T]=t.useState([]),{isLoading:h,data:A}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesCalculation(c);return t.useEffect(()=>{var e;if((null==A||null===(e=A.PipeSize)||void 0===e?void 0:e.length)>0){var n;let e=[];null==A||null===(n=A.PipeSize)||void 0===n||n.forEach(n=>{e.push({i18nKey:n.size+" "+i("WS_INCHES_LABEL"),code:n.size,id:n.id,size:n.size})}),T(e)}},[A]),l.createElement("div",null,"citizen"===u&&l.createElement(Te,{currentStep:2}),h?l.createElement(a.Loader,null):l.createElement(a.FormStep,{t:i,config:r,onSelect:()=>{var e,n,t,l;if((null==s||!s.WaterConnectionResult||null==s||null===(e=s.WaterConnectionResult)||void 0===e||null===(n=e.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t||!t.id)&&"WATER"===(null==s||null===(l=s.serviceName)||void 0===l?void 0:l.code)||null!=s&&s.isModifyConnection){f(!0);let e={};var o,i,a,u,c,m,S,_,g,N,D,T,h,A,I,O,b,L,R,w,W,P,M,x;e=null!=s&&s.isModifyConnection?{WaterConnection:v({},null==s||null===(o=s.WaterConnectionResult)||void 0===o||null===(i=o.WaterConnection)||void 0===i?void 0:i[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:{WaterConnection:{water:!0,sewerage:!1,property:v({},null==s||null===(a=s.cpt)||void 0===a?void 0:a.details),proposedTaps:p,proposedPipeSize:null==E?void 0:E.code,proposedWaterClosets:null,proposedToilets:null,connectionHolders:null!=s&&null!==(u=s.ConnectionHolderDetails)&&void 0!==u&&u.isOwnerSame?null:[{correspondenceAddress:null==s||null===(c=s.ConnectionHolderDetails)||void 0===c?void 0:c.address,fatherOrHusbandName:null==s||null===(m=s.ConnectionHolderDetails)||void 0===m?void 0:m.guardian,gender:null==s||null===(S=s.ConnectionHolderDetails)||void 0===S||null===(_=S.gender)||void 0===_?void 0:_.code,mobileNumber:null==s||null===(g=s.ConnectionHolderDetails)||void 0===g?void 0:g.mobileNumber,name:null==s||null===(N=s.ConnectionHolderDetails)||void 0===N?void 0:N.name,emailId:null==s||null===(D=s.ConnectionHolderDetails)||void 0===D?void 0:D.emailId,ownerType:(null==s||null===(T=s.ConnectionHolderDetails)||void 0===T||null===(h=T.specialCategoryType)||void 0===h?void 0:h.code)||"NONE",relationship:null==s||null===(A=s.ConnectionHolderDetails)||void 0===A||null===(I=A.relationship)||void 0===I?void 0:I.code,sameAsPropertyAddress:!1}],service:"Water",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(O=s.cptId)||void 0===O?void 0:O.id)||(null==s||null===(b=s.cpt)||void 0===b||null===(L=b.details)||void 0===L?void 0:L.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(R=s.cpt)||void 0===R||null===(w=R.details)||void 0===w||null===(W=w.address)||void 0===W||null===(P=W.locality)||void 0===P?void 0:P.code},tenantId:null==s||null===(M=s.cpt)||void 0===M||null===(x=M.details)||void 0===x?void 0:x.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1},Digit.WSService.create(e,"WATER").then((e,n)=>{f(!1);let t=v({},s,{WaterConnectionResult:e,waterConectionDetails:{proposedTaps:p,proposedPipeSize:E}});d("",t,"",!0)}).catch(e=>{var n,t,l;f(!1),C({key:"error"}),y((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}else{let e={};e.proposedTaps=p,e.proposedPipeSize=E,d(r.key,e)}},onSkip:()=>d(),isDisabled:!p||!E||_,onAdd:function(){}},l.createElement(a.CardLabel,null,i("WS_NO_OF_TAPS_PROPOSED"),"*"),l.createElement(a.TextInput,v({isMandatory:!1,optionKey:"i18nKey",t:i,name:"proposedTaps",onChange:function(e){m(e.target.value)},value:p},{isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:i("ERR_DEFAULT_INPUT_FIELD_MSG"),type:"text"})),l.createElement(a.CardLabel,null,i("WS_PROPOSED_PIPE_SIZE"),"*"),l.createElement(a.RadioOrSelect,{name:"proposedPipeSize",options:D,selectedOption:E,optionKey:"i18nKey",onSelect:function(e){S(e)},t:i})),g&&l.createElement(a.Toast,{error:"error"===(null==g?void 0:g.key),label:N,isDleteBtn:!0,onClose:()=>{C(null),y(null)}}))},WSDocsRequired:e=>{var n;let{onSelect:r,userType:u}=e;const{t:d}=o.useTranslation(),s=i.useHistory(),c=i.useRouteMatch(),v=Digit.ULBService.getStateId();sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists"),sessionStorage.removeItem("FORMSTATE_ERRORS");const{isLoading:p,data:m}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(v);var E;return"citizen"===u?l.createElement(t.Fragment,null,l.createElement(a.Card,null,l.createElement(a.CardHeader,null,d("WS_COMMON_APPL_NEW_CONNECTION")),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px",textAlign:"center"},textStyle:{color:"#0B0C0C"},text:d("WS_DOCS_REQUIRED_TIME"),showInfo:!1}),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},d("WS_NEW_CONNECTION_TEST_1")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},d("WS_NEW_CONNECTION_TEST_2")),l.createElement(a.CardSubHeader,null,d("WS_DOC_REQ_SCREEN_LABEL")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},d("WS_NEW_CONNECTION_TEST_3")),p?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,null==m||null===(E=m.Documents)||void 0===E?void 0:E.map((e,n)=>{var t;return l.createElement("div",null,l.createElement("div",{style:{fontWeight:700,marginBottom:"8px"},key:n},l.createElement("div",{style:{display:"flex"}},l.createElement("div",null,n+1+"."," "),l.createElement("div",null," "+d(null==e?void 0:e.code.replace(".","_"))))),l.createElement("div",{style:{marginBottom:"16px",marginLeft:"18px"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((n,t)=>{var o;return(null==e||null===(o=e.dropdownData)||void 0===o?void 0:o.length)!==t+1?l.createElement("span",null,d(null==n?void 0:n.i18nKey)+", "):l.createElement("span",null,""+d(null==n?void 0:n.i18nKey))})))})),l.createElement(a.SubmitBar,{label:d("CS_COMMON_NEXT"),onSubmit:()=>{r("DocsReq","")}}))):l.createElement("div",{style:{margin:"16px"}},l.createElement("div",null,l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px",display:"flex",justifyContent:"space-between",marginRight:"12px"}},l.createElement("div",null,d("WS_WATER_AND_SEWERAGE_NEW_CONNECTION_LABEL")),l.createElement("div",{onClick:()=>{let e=document.getElementById("documents-div").innerHTML;if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.mSewaApp.downloadBase64File(window.btoa(e),d("WS_REQ_DOCS"));else{let n=window.open("","");n.document.write("<html><body>"+e+"</body></html>"),n.document.close(),n.focus(),n.print()}},style:{cursor:"pointer",display:"flex"}},l.createElement(a.PrintBtnCommon,null),l.createElement("div",{style:{fontSize:"24px",fontWeight:"400",color:"#0B0C0C"}},"Print")))),l.createElement(a.Card,null,p?l.createElement(a.Loader,null):l.createElement("div",{id:"documents-div"},null==m||null===(n=m.Documents)||void 0===n?void 0:n.map((e,n)=>{var t;return l.createElement("div",{key:n,style:{marginTop:"16px"}},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",lineHeight:"28px",fontSize:"24px"}},d(null==e?void 0:e.code.replace(".","_"))),e.dropdownData&&e.dropdownData.length>1&&l.createElement("p",{style:{lineHeight:"24px",fontSize:"16px"}},d((null==e?void 0:e.code.replace(".","_"))+"_DESCRIPTION")),l.createElement("div",{style:{margin:"16px 0",lineHeight:"18px",fontSize:"16px"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((e,n)=>l.createElement("p",{style:{fontWeight:"bold",lineHeight:"32px"}},n+1+". "+d(null==e?void 0:e.i18nKey)))),l.createElement("p",{style:{fontSize:"16px"}},d((null==e?void 0:e.code.replace(".","_"))+"_BELOW_DESCRIPTION")))})),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:d("ACTION_TEST_APPLY"),onSubmit:()=>{s.push(c.path.replace("create-application","new-application"))},style:{margin:"10px 10px 0px 0px"},disabled:!!p}))))},WSDocumentDetails:e=>{var n,o;let{t:i,config:r,onSelect:u,userType:d,formData:s}=e;const c=Digit.ULBService.getStateId(),[p,m]=t.useState((null==s||null===(n=s.documents)||void 0===n?void 0:n.documents)||[]),[E,S]=t.useState(null),[_,f]=t.useState(!0),[g,C]=t.useState(!1),{isLoading:N,data:y}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(c);return t.useEffect(()=>{let e=0;null==y||y.Documents.map(n=>{let t=!1;p.map(e=>{n.required&&null!=e&&e.documentType.includes(n.code)&&(t=!0)}),!t&&n.required&&(e+=1)}),f("0"!=e&&0!=e||!(p.length>0))},[p,g]),l.createElement("div",null,"citizen"===d&&l.createElement(Te,{currentStep:3}),N?l.createElement(a.Loader,null):l.createElement(a.FormStep,{t:i,config:r,onSelect:()=>{let e;e=v({},s.documents,{documents:p}),u(r.key,e)},onSkip:()=>u(),isDisabled:_,onAdd:function(){}},null==y||null===(o=y.Documents)||void 0===o?void 0:o.map((e,n)=>l.createElement(Ae,{key:n,document:e,t:i,error:E,setError:S,setDocuments:m,documents:p,setCheckRequiredFields:C})),E&&l.createElement(a.Toast,{label:E,onClose:()=>S(null),error:!0})))},WSSewerageConnectionDetails:e=>{var n,o;let{t:i,config:r,userType:u,onSelect:d,formData:s}=e;const[c,p]=t.useState((null==s||null===(n=s.sewerageConnectionDetails)||void 0===n?void 0:n.proposedWaterClosets)||""),[m,E]=t.useState((null==s||null===(o=s.sewerageConnectionDetails)||void 0===o?void 0:o.proposedToilets)||""),[S,_]=t.useState(!1),[f,g]=t.useState(null),[C,N]=t.useState(null);let y={};return l.createElement("div",null,"citizen"===u&&l.createElement(Te,{currentStep:2}),l.createElement(a.FormStep,{t:i,config:r,onSelect:()=>{var e,n,t,l,o,i,a,u,p;if(null!=s&&s.SewerageConnectionResult&&null!=s&&null!==(e=s.SewerageConnectionResult)&&void 0!==e&&null!==(n=e.SewerageConnections)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&t.id&&(null==s||!s.isModifyConnection)||"SEWERAGE"!==(null==s||null===(l=s.serviceName)||void 0===l?void 0:l.code))if((null!=s&&s.SewerageConnectionResult&&null!=s&&null!==(o=s.SewerageConnectionResult)&&void 0!==o&&null!==(i=o.SewerageConnection)&&void 0!==i&&i.id||null!=s&&s.WaterConnectionResult&&null!=s&&null!==(a=s.WaterConnectionResult)&&void 0!==a&&null!==(u=a.WaterConnection)&&void 0!==u&&u.id)&&(null==s||!s.isModifyConnection)||"BOTH"!==(null==s||null===(p=s.serviceName)||void 0===p?void 0:p.code)){let e={};e.proposedWaterClosets=c,e.proposedToilets=m,d(r.key,e)}else{_(!0);let e={};var E,S,f,C,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z;null!=s&&s.isModifyConnection?payload={WaterConnection:v({},null==s||null===(E=s.WaterConnectionResult)||void 0===E||null===(S=E.WaterConnection)||void 0===S?void 0:S[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:e={WaterConnection:{water:!0,sewerage:!0,property:v({},null==s||null===(f=s.cpt)||void 0===f?void 0:f.details),proposedTaps:null==s||null===(C=s.waterConectionDetails)||void 0===C?void 0:C.proposedTaps,proposedPipeSize:null==s||null===(y=s.waterConectionDetails)||void 0===y||null===(D=y.proposedPipeSize)||void 0===D?void 0:D.code,proposedWaterClosets:parseInt(c),proposedToilets:parseInt(m),connectionHolders:null!=s&&null!==(T=s.ConnectionHolderDetails)&&void 0!==T&&T.isOwnerSame?null:[{correspondenceAddress:null==s||null===(h=s.ConnectionHolderDetails)||void 0===h?void 0:h.address,fatherOrHusbandName:null==s||null===(A=s.ConnectionHolderDetails)||void 0===A?void 0:A.guardian,gender:null==s||null===(I=s.ConnectionHolderDetails)||void 0===I||null===(O=I.gender)||void 0===O?void 0:O.code,mobileNumber:null==s||null===(b=s.ConnectionHolderDetails)||void 0===b?void 0:b.mobileNumber,name:null==s||null===(L=s.ConnectionHolderDetails)||void 0===L?void 0:L.name,emailId:null==s||null===(R=s.ConnectionHolderDetails)||void 0===R?void 0:R.emailId,ownerType:(null==s||null===(w=s.ConnectionHolderDetails)||void 0===w||null===(W=w.specialCategoryType)||void 0===W?void 0:W.code)||"NONE",relationship:null==s||null===(P=s.ConnectionHolderDetails)||void 0===P||null===(M=P.relationship)||void 0===M?void 0:M.code,sameAsPropertyAddress:!1}],service:"Water and Sewerage",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(x=s.cptId)||void 0===x?void 0:x.id)||(null==s||null===(B=s.cpt)||void 0===B||null===(F=B.details)||void 0===F?void 0:F.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(U=s.cpt)||void 0===U||null===(k=U.details)||void 0===k||null===(H=k.address)||void 0===H||null===(j=H.locality)||void 0===j?void 0:j.code},tenantId:null==s||null===(V=s.cpt)||void 0===V||null===(z=V.details)||void 0===z?void 0:z.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1};let n={};var Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e;n=null!=s&&s.isModifyConnection?{SewerageConnection:v({},null==s||null===(Y=s.SewerageConnectionResult)||void 0===Y||null===(G=Y.SewerageConnections)||void 0===G?void 0:G[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:{SewerageConnection:{water:!0,sewerage:!0,property:v({},null==s||null===(q=s.cpt)||void 0===q?void 0:q.details),proposedTaps:null==s||null===(K=s.waterConectionDetails)||void 0===K?void 0:K.proposedTaps,proposedPipeSize:null==s||null===(X=s.waterConectionDetails)||void 0===X||null===(Z=X.proposedPipeSize)||void 0===Z?void 0:Z.code,proposedWaterClosets:parseInt(c),proposedToilets:parseInt(m),connectionHolders:null!=s&&null!==($=s.ConnectionHolderDetails)&&void 0!==$&&$.isOwnerSame?null:[{correspondenceAddress:null==s||null===(J=s.ConnectionHolderDetails)||void 0===J?void 0:J.address,fatherOrHusbandName:null==s||null===(Q=s.ConnectionHolderDetails)||void 0===Q?void 0:Q.guardian,gender:null==s||null===(ee=s.ConnectionHolderDetails)||void 0===ee||null===(ne=ee.gender)||void 0===ne?void 0:ne.code,mobileNumber:null==s||null===(te=s.ConnectionHolderDetails)||void 0===te?void 0:te.mobileNumber,name:null==s||null===(le=s.ConnectionHolderDetails)||void 0===le?void 0:le.name,emailId:null==s||null===(oe=s.ConnectionHolderDetails)||void 0===oe?void 0:oe.emailId,ownerType:(null==s||null===(ie=s.ConnectionHolderDetails)||void 0===ie||null===(ae=ie.specialCategoryType)||void 0===ae?void 0:ae.code)||"NONE",relationship:null==s||null===(re=s.ConnectionHolderDetails)||void 0===re||null===(ue=re.relationship)||void 0===ue?void 0:ue.code,sameAsPropertyAddress:!1}],service:"Water and Sewerage",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(de=s.cptId)||void 0===de?void 0:de.id)||(null==s||null===(se=s.cpt)||void 0===se||null===(ce=se.details)||void 0===ce?void 0:ce.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(ve=s.cpt)||void 0===ve||null===(pe=ve.details)||void 0===pe||null===(me=pe.address)||void 0===me||null===(Ee=me.locality)||void 0===Ee?void 0:Ee.code},tenantId:null==s||null===(Se=s.cpt)||void 0===Se||null===(_e=Se.details)||void 0===_e?void 0:_e.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1},Digit.WSService.create(e,"WATER").then((e,t)=>{Digit.WSService.create(n,"SEWERAGE").then((n,t)=>{_(!1);let l=v({},s,{WaterConnectionResult:e,SewerageConnectionResult:n,sewerageConnectionDetails:{proposedWaterClosets:c,proposedToilets:m}});d("",l,"",!0)}).catch(e=>{var n,t,l;_(!1),g({key:"error"}),N((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}).catch(e=>{var n,t,l;_(!1),g({key:"error"}),N((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}else{_(!0);let e={};var fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He;e=null!=s&&s.isModifyConnection?{SewerageConnection:v({},null==s||null===(fe=s.SewerageConnectionResult)||void 0===fe||null===(ge=fe.SewerageConnections)||void 0===ge?void 0:ge[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:{SewerageConnection:{water:!1,sewerage:!0,property:v({},null==s||null===(Ce=s.cpt)||void 0===Ce?void 0:Ce.details),proposedTaps:null,proposedPipeSize:null,proposedWaterClosets:parseInt(c),proposedToilets:parseInt(m),connectionHolders:null!=s&&null!==(Ne=s.ConnectionHolderDetails)&&void 0!==Ne&&Ne.isOwnerSame?null:[{correspondenceAddress:null==s||null===(ye=s.ConnectionHolderDetails)||void 0===ye?void 0:ye.address,fatherOrHusbandName:null==s||null===(De=s.ConnectionHolderDetails)||void 0===De?void 0:De.guardian,gender:null==s||null===(Te=s.ConnectionHolderDetails)||void 0===Te||null===(he=Te.gender)||void 0===he?void 0:he.code,mobileNumber:null==s||null===(Ae=s.ConnectionHolderDetails)||void 0===Ae?void 0:Ae.mobileNumber,name:null==s||null===(Ie=s.ConnectionHolderDetails)||void 0===Ie?void 0:Ie.name,emailId:null==s||null===(Oe=s.ConnectionHolderDetails)||void 0===Oe?void 0:Oe.emailId,ownerType:(null==s||null===(be=s.ConnectionHolderDetails)||void 0===be||null===(Le=be.specialCategoryType)||void 0===Le?void 0:Le.code)||"NONE",relationship:null==s||null===(Re=s.ConnectionHolderDetails)||void 0===Re||null===(we=Re.relationship)||void 0===we?void 0:we.code,sameAsPropertyAddress:!1}],service:"Sewerage",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(We=s.cptId)||void 0===We?void 0:We.id)||(null==s||null===(Pe=s.cpt)||void 0===Pe||null===(Me=Pe.details)||void 0===Me?void 0:Me.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(xe=s.cpt)||void 0===xe||null===(Be=xe.details)||void 0===Be||null===(Fe=Be.address)||void 0===Fe||null===(Ue=Fe.locality)||void 0===Ue?void 0:Ue.code},tenantId:null==s||null===(ke=s.cpt)||void 0===ke||null===(He=ke.details)||void 0===He?void 0:He.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1},Digit.WSService.create(e,"SEWERAGE").then((e,n)=>{_(!1);let t=v({},s,{SewerageConnectionResult:e,sewerageConnectionDetails:{proposedWaterClosets:c,proposedToilets:m}});d("",t,"",!0)}).catch(e=>{var n,t,l;_(!1),g({key:"error"}),N((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}},onSkip:()=>d(),isDisabled:!c||!m||S,onAdd:function(){}},l.createElement(a.CardLabel,null,i("WS_NO_OF_WATER_CLOSETS"),"*"),l.createElement(a.TextInput,v({type:"number",isMandatory:!1,optionKey:"i18nKey",t:i,name:"proposedWaterClosets",onChange:function(e){p(e.target.value)},value:c},y={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:i("ERR_DEFAULT_INPUT_FIELD_MSG")})),l.createElement(a.CardLabel,null,i("WS_SERV_DETAIL_NO_OF_TOILETS"),"*"),l.createElement(a.TextInput,v({type:"number",isMandatory:!1,optionKey:"i18nKey",t:i,name:"proposedToilets",onChange:function(e){E(e.target.value)},value:m},y={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:i("ERR_DEFAULT_INPUT_FIELD_MSG")}))),f&&l.createElement(a.Toast,{error:"error"===(null==f?void 0:f.key),label:C,isDleteBtn:!0,onClose:()=>{g(null),N(null)}}))},WSPlumberPreference:e=>{var n;let{t:o,config:i,onSelect:r,userType:u,formData:d}=e;const[s,c]=t.useState((null==d||null===(n=d.plumberPreference)||void 0===n?void 0:n.plumberPreference)||{i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE",code:"ULB"});return l.createElement("div",null,"citizen"===u&&l.createElement(Te,{currentStep:2}),l.createElement(a.FormStep,{t:o,config:i,onSelect:()=>{r(i.key,{plumberPreference:s})},onSkip:()=>r(),isDisabled:!s,onAdd:function(){}},l.createElement(a.RadioOrSelect,{name:"plumberPreference",options:[{i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE",code:"ULB"},{i18nKey:"WS_I_WILL_ARRAGE_THE_PLUMBER_MYSELF",code:"Self"}],selectedOption:s,optionKey:"i18nKey",onSelect:function(e){c(e)},t:o,innerStyles:{display:"flex"},inputStyle:{marginTop:"10px"}})))},WSConnectionHolder:e=>{var n,o,i,r,u,d,s,c,p,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k;let{t:H,config:j,onSelect:V,userType:z,formData:Y}=e,G={};const[q,K]=t.useState((null==Y||null===(n=Y.ConnectionHolderDetails)||void 0===n?void 0:n.name)||(null==Y||null===(o=Y.formData)||void 0===o||null===(i=o.ConnectionHolderDetails)||void 0===i?void 0:i.name)||""),[X,Z]=t.useState((null==Y||null===(r=Y.ConnectionHolderDetails)||void 0===r?void 0:r.guardian)||(null==Y||null===(u=Y.formData)||void 0===u||null===(d=u.ConnectionHolderDetails)||void 0===d?void 0:d.guardian)||""),[$,J]=t.useState((null==Y||null===(s=Y.ConnectionHolderDetails)||void 0===s?void 0:s.gender)||(null==Y||null===(c=Y.formData)||void 0===c||null===(p=c.ConnectionHolderDetails)||void 0===p?void 0:p.gender)),[Q,ee]=t.useState((null==Y||null===(E=Y.ConnectionHolderDetails)||void 0===E?void 0:E.relationship)||(null==Y||null===(S=Y.formData)||void 0===S||null===(_=S.ConnectionHolderDetails)||void 0===_?void 0:_.relationship)),[ne,te]=t.useState((null==Y||null===(f=Y.ConnectionHolderDetails)||void 0===f?void 0:f.mobileNumber)||(null==Y||null===(g=Y.formData)||void 0===g||null===(C=g.ConnectionHolderDetails)||void 0===C?void 0:C.mobileNumber)||""),[le,oe]=t.useState((null==Y||null===(N=Y.ConnectionHolderDetails)||void 0===N?void 0:N.address)||(null==Y||null===(y=Y.formData)||void 0===y||null===(D=y.ConnectionHolderDetails)||void 0===D?void 0:D.address)||""),[ie,ae]=t.useState((null==Y||null===(T=Y.ConnectionHolderDetails)||void 0===T?void 0:T.documentId)||(null==Y||null===(h=Y.formData)||void 0===h||null===(A=h.ConnectionHolderDetails)||void 0===A?void 0:A.documentId)||""),[re,ue]=t.useState(0!=(null==Y||null===(I=Y.ConnectionHolderDetails)||void 0===I?void 0:I.isOwnerSame)&&0!=(null==Y||null===(O=Y.formData)||void 0===O||null===(b=O.ConnectionHolderDetails)||void 0===b?void 0:b.isOwnerSame)),[de,se]=t.useState((null==Y||null===(L=Y[j.key])||void 0===L?void 0:L.fileStoreId)||null),[ce,ve]=t.useState(null),[pe,me]=t.useState(null),[Ee,Se]=t.useState((null==Y||null===(R=Y.ConnectionHolderDetails)||void 0===R?void 0:R.documentType)||""),[_e,fe]=t.useState((null==Y||null===(w=Y.ConnectionHolderDetails)||void 0===w?void 0:w.specialCategoryType)||{});let ge=window.Digit.Utils.browser.isMobile();const[Ce,Ne]=t.useState((null==Y||null===(W=Y.ConnectionHolderDetails)||void 0===W?void 0:W.emailId)||(null==Y||null===(P=Y.formData)||void 0===P||null===(M=P.ConnectionHolderDetails)||void 0===M?void 0:M.emailId)||""),ye=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId());let De=[];const{data:Ae={}}=Digit.Hooks.pt.usePropertyMDMS(ye,"PropertyTax","Documents"),Ie=null==Ae||null===(x=Ae.PropertyTax)||void 0===x?void 0:x.Documents,Oe=Array.isArray(Ie)&&Ie.filter(e=>e.code.includes("SPECIALCATEGORYPROOF"));var be,Le;Oe.length>0&&(De=null===(be=Oe[0])||void 0===be?void 0:be.dropdownData,De.forEach(e=>{e.i18nKey=m(e.code,".","_")}),De=null===(Le=De)||void 0===Le?void 0:Le.filter(e=>e.parentValue.includes(null==_e?void 0:_e.code)),1==De.length&&Ee!=De[0]&&function(e){Se(e)}(De[0]));const{isLoading:Re,data:we}=Digit.Hooks.obps.useMDMS(ye,"common-masters",["GenderType"]),{data:We}=Digit.Hooks.pt.usePropertyMDMS(ye,"PropertyTax","OwnerType");We&&We.sort((e,n)=>e.name.localeCompare(n.name));let Pe=[];we&&we["common-masters"].GenderType.filter(e=>e.active).map(e=>{Pe.push({i18nKey:"COMMON_GENDER_"+e.code,code:""+e.code,value:""+e.code})});const Me=e=>{""===e||/^[a-zA-Z0-9._%+-]+@[a-z.-]+\.(com|org|in)$/.test(e)?me(""):me(H("CORE_INVALID_EMAIL_ID_PATTERN"))};t.useEffect(()=>{!function(){try{me(null);const e=function(){if(ce){const e=function(){if(ce.size>=2e6)me(H("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=he(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",ce,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?se(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):me(H("PT_FILE_UPLOAD_ERROR"))})},function(){me(H("PT_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)}}()},[ce]),t.useEffect(()=>{Ce&&Me(Ce)},[Ce]);const xe=Array.isArray(null==Y||null===(B=Y.cpt)||void 0===B||null===(F=B.details)||void 0===F?void 0:F.owners)?null==Y||null===(U=Y.cpt)||void 0===U||null===(k=U.details)||void 0===k?void 0:k.owners.slice().reverse():[];return l.createElement("div",null,"citizen"===z&&l.createElement(Te,{currentStep:2}),Re?l.createElement(a.Loader,null):l.createElement(a.FormStep,{config:j,onSelect:()=>{if(!pe)if(1==re){var e,n,t,l,o,i,a,r,u,d,s;let c={isOwnerSame:re,name:null==xe||null===(e=xe[0])||void 0===e?void 0:e.name,mobileNumber:null==xe||null===(n=xe[0])||void 0===n?void 0:n.mobileNumber,gender:null!=xe&&null!==(t=xe[0])&&void 0!==t&&t.gender?{code:null==xe||null===(l=xe[0])||void 0===l?void 0:l.gender,i18nKey:"COMMON_GENDER_"+(null==xe||null===(o=xe[0])||void 0===o?void 0:o.gender)}:null,guardian:null==xe||null===(i=xe[0])||void 0===i?void 0:i.fatherOrHusbandName,address:null==xe||null===(a=xe[0])||void 0===a?void 0:a.permanentAddress,emailId:null==xe||null===(r=xe[0])||void 0===r?void 0:r.emailId,relationship:null!=xe&&null!==(u=xe[0])&&void 0!==u&&u.relationship?{code:null==xe||null===(d=xe[0])||void 0===d?void 0:d.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==xe||null===(s=xe[0])||void 0===s?void 0:s.relationship)}:null,specialCategoryType:_e,documentId:ie,fileStoreId:de,documentType:Ee};V(j.key,c)}else V(j.key,{isOwnerSame:re,name:q,mobileNumber:ne,gender:$,guardian:X,address:le,relationship:Q,specialCategoryType:_e,emailId:Ce,documentId:ie,fileStoreId:de,documentType:Ee})},onSkip:()=>V(),t:H,isDisabled:!(re||q&&ne&&$&&X&&Q&&null!=_e&&_e.code&&le)},l.createElement("div",null,l.createElement(a.CheckBox,{label:H("WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS"),onChange:e=>{ue(!re)},checked:re,style:{paddingBottom:"10px",paddingTop:"3px"}})),!re&&l.createElement("div",{style:{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA"}},l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_NAME")+"*"),l.createElement(a.TextInput,v({t:H,type:"text",style:{background:"#FAFAFA"},isMandatory:!1,optionKey:"i18nKey",name:"name",value:q,onChange:function(e){K(e.target.value)}},G={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:H("WS_NAME_ERROR_MESSAGE")})),l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_GENDER_LABEL")+"*"),l.createElement(a.RadioButtons,{t:H,options:Pe,optionsKey:"code",name:"gender",value:$,selectedOption:$,onSelect:function(e){J(e)},isDependent:!0,labelKey:"COMMON_GENDER"}),l.createElement(a.CardLabel,null,H("WS_OWN_MOBILE_NO")+"*"),l.createElement(a.MobileNumber,{value:ne,name:"mobileNumber",onChange:e=>function(e){te(e.target.value)}({target:{value:e}}),style:{background:"#FAFAFA"},required:!0,pattern:"[6-9]{1}[0-9]{9}",type:"tel",title:H("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID")}),l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_GUARDIAN_LABEL")+"*"),l.createElement(a.TextInput,v({t:H,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"guardian",value:X,style:{background:"#FAFAFA"},onChange:function(e){Z(e.target.value)}},G={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:H("WS_NAME_ERROR_MESSAGE")})),l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_RELATIONSHIP_LABEL")+"*"),l.createElement(a.RadioButtons,{t:H,optionsKey:"i18nKey",name:"relationship",options:[{name:"Father",code:"FATHER",i18nKey:"COMMON_MASTERS_OWNERTYPE_FATHER"},{name:"HUSBAND",code:"HUSBAND",i18nKey:"COMMON_MASTERS_OWNERTYPE_HUSBAND"}],value:Q,selectedOption:Q,onSelect:function(e){ee(e)},isDependent:!0,labelKey:"COMMON_MASTERS_OWNERTYPE"}),l.createElement(a.CardLabel,null,H("WS_COMMON_TABLE_COL_ADDRESS")+"*"),l.createElement(a.TextInput,v({t:H,type:"text",style:{background:"#FAFAFA"},isMandatory:!1,optionKey:"i18nKey",name:"address",value:le,onChange:function(e){oe(e.target.value)}},G={isRequired:!0,title:H("WS_ADDR_ERROR_MESSAGE")})),l.createElement(a.CardLabel,null,H("WS_OWN_SPECIAL_CAT_LABEL")+"*"),l.createElement(a.Dropdown,{className:"form-field",selected:_e,style:ge?{}:{width:"540px"},isMandatory:!0,option:We,select:function(e){fe(e)},optionKey:"i18nKey",t:H}),l.createElement("div",null,l.createElement(a.CardLabel,null,""+H("WS_EMAIL_ID")),l.createElement(a.TextInput,v({t:H,isMandatory:!1,name:"emailId",value:Ce,onChange:e=>{const n=e.target.value;Ne(n),Me(n)}},G={pattern:"[A-Za-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$",type:"Email",title:H("CORE_COMMON_APPLICANT_EMAILI_ID_INVALID")})),pe&&l.createElement("span",{style:{color:"red"}},pe)))))},WSInfoLabel:j,WSActivationDetails:e=>{let{t:n}=e;const[t,o]=l.useState({meterId:"",meterInstallationDate:"",meterInitialReading:"",connectionExecutionDate:""});return l.useEffect(()=>{}),l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_METER_ID")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{t:n,type:"text",optionKey:"i18nKey",name:"meterId",value:t.meterId,onChange:e=>{o(v({},t,{meterId:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_METER_INSTALLATION_DATE")),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:t.meterInstallationDate,onChange:e=>{o(v({},t,{meterInstallationDate:e}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_INIT_METER_READING")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{value:t.meterInitialReading,onChange:e=>{o(v({},t,{meterInitialReading:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_CONN_EXEC_DATE")),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:t.connectionExecutionDate,onChange:e=>{o(v({},t,{connectionExecutionDate:e}))}}))))},WSConnectionDetails:e=>{var n;let{config:r,onSelect:u,userType:d,formData:s,setError:c,formState:p,clearErrors:m}=e;const{t:E}=o.useTranslation(),[S,_]=(i.useLocation(),t.useState(null!=s&&s.ConnectionDetails?[null==s||null===(n=s.ConnectionDetails)||void 0===n?void 0:n[0]]:[{water:!0,sewerage:!1,proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])),[f,g]=t.useState({index:-1,type:""}),C=Digit.ULBService.getStateId(),[N,y]=t.useState(!1),[D,T]=t.useState({water:!0,sewerage:!1}),[h,A]=t.useState([]),{isWSServicesCalculationLoading:I,data:O}=Digit.Hooks.ws.useMDMS(C,"ws-services-calculation",["PipeSize"]);if(t.useEffect(()=>{const e=S.map(e=>e);u(null==r?void 0:r.key,e)},[S]),t.useEffect(()=>{var e;const n=(null==O||null===(e=O["ws-services-calculation"])||void 0===e?void 0:e.PipeSize)||[];null==n||n.forEach(e=>e.i18nKey=e.size),A(n)},[O]),t.useEffect(()=>{var e,n;"employee"===d&&u(r.key,v({},s[r.key],S)),null!=S&&null!==(e=S[0])&&void 0!==e&&e.water&&T({water:!0,sewerage:!1}),null!=S&&null!==(n=S[0])&&void 0!==n&&n.sewerage&&T({water:!1,sewerage:!0})},[S]),t.useEffect(()=>{null!=s&&s.ConnectionDetails||_([{water:!0,sewerage:!1,proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])},[null==s?void 0:s.ConnectionDetails]),I)return l.createElement(a.Loader,null);const b={focusIndex:f,connectionDetails:S,setFocusIndex:g,formData:s,formState:p,t:E,setError:c,clearErrors:m,config:r,setConnectionDetails:_,setIsErrors:y,isErrors:N,pipeSizeList:h,wsServicesCalculationData:O,waterSewarageSelection:D,formData:s};return l.createElement(l.Fragment,null,S.map((e,n)=>l.createElement(Ie,v({key:e.key,index:n,connectionDetail:e},b))))},WSDocumentsRequired:()=>l.createElement("div",null,"WSDocumentsRequired"),WSPlumberDetails:e=>{let{t:n,config:t}=e;const[o,i]=l.useState({plumberName:"",plumberMobileNo:"",plumberLicenseNo:"",plumberProvideBy:{code:"",value:"",i18nKey:""}});return l.useEffect(()=>{}),l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_PROVIDED_BY")),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{t:n,key:null==t?void 0:t.key,selected:o.plumberProvideBy,select:e=>{i(v({},o,{plumberProvideBy:e}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_LICENSE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:t.key,value:o.plumberLicenseNo,onChange:e=>{i(v({},o,{plumberLicenseNo:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_NAME")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:t.key,value:o.plumberName,onChange:e=>{i(v({},o,{plumberName:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_MOB_NUMBER")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:t.key,value:o.plumberMobileNo,onChange:e=>{i(v({},o,{plumberMobileNo:e.target.value}))}}))))},WSRoadCuttingDetails:e=>{let{config:n,onSelect:r,formData:u,setError:d,formState:s,clearErrors:c}=e;const{t:p}=o.useTranslation(),{pathname:m}=i.useLocation(),E=m.includes("/modify-application/"),S=Digit.ULBService.getStateId(),{isMdmsLoading:_,data:f}=Digit.Hooks.ws.useMDMS(S,window.location.href.includes("sewerage")?"sw-services-calculation":"ws-services-calculation",["RoadType"]),[g,C]=t.useState((null==u?void 0:u.roadCuttingDetails)||[Oe()]),[N,y]=t.useState({index:-1,type:""});t.useEffect(()=>{r(null==n?void 0:n.key,g)},[g]);const D={focusIndex:N,allRoadCuttingDetails:g,setFocusIndex:y,removeroadCutt:e=>{C(null!==(null==e?void 0:e.id)?n=>n.map(n=>n.key==e.key&&null!==n.id?v({},e,{id:n.id,status:"INACTIVE"}):v({},n)):n=>n.filter(n=>n.key!=e.key))},formData:u,formState:s,setRoadCuttingDetails:C,mdmsData:f,t:p,setError:d,clearErrors:c,config:n,isEditScreen:E};return _?l.createElement(Loader,null):l.createElement(l.Fragment,null,g.filter(e=>"INACTIVE"!==e.status).map((e,n)=>l.createElement(be,v({key:e.key,index:n,roadCutt:e},D))),l.createElement(a.LinkButton,{label:p("WS_ADD_ROAD_TYPE"),onClick:()=>{const e=Oe();C(n=>[...n,e])},style:{color:"orange",display:"inline-block"}}))},WSPropertyDetails:e=>{var n,t,o,r,u,d;let{t:s,config:c,onSelect:v,formData:p}=e;const[m,E]=l.useState(""),S=null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code,{isLoading:_,data:f}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:null==p||null===(t=p.cptId)||void 0===t?void 0:t.id},tenantId:S},{filters:{propertyIds:null==p||null===(o=p.cptId)||void 0===o?void 0:o.id},tenantId:S});return _?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("PROPERTY_ID")),l.createElement("div",{className:"field",style:{marginTop:"20px"}},l.createElement(a.TextInput,{key:c.key,value:m,onChange:e=>{E(e.target.value),v(c.key,{id:e.target.value})},style:{width:"65%",float:"left",marginRight:"20px"}}),l.createElement("button",{className:"submit-bar",type:"button",onClick:()=>E(m)},""+s("PT_SEARCH")))),l.createElement(i.Link,{to:"/digit-ui/employee/pt/search"},l.createElement(a.LinkButton,{label:s("CPT_SEARCH_PROPERTY"),style:{color:"#a82227",display:"inline-block"}}))," | ",l.createElement(i.Link,{to:"/digit-ui/employee/pt/new-application"},l.createElement(a.LinkButton,{label:s("CPT_CREATE_PROPERTY"),style:{color:"#a82227",display:"inline-block"}})),f&&(null==f?void 0:f.Properties.length)&&l.createElement(l.Fragment,null,l.createElement("header",{className:"card-section-header",style:{marginBottom:0,marginTop:"20px"}},s("PT_DETAILS")),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("PROPERTY_ID")),l.createElement("div",{className:"field"},l.createElement("p",null,null==f||null===(r=f.Properties[0])||void 0===r?void 0:r.propertyId))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("OWNER_NAME")),l.createElement("div",{className:"field"},l.createElement("p",null,null==f||null===(u=f.Properties[0])||void 0===u||null===(d=u.owners[0])||void 0===d?void 0:d.name))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("PROPERTY_ADDRESS")),l.createElement("div",{className:"field"},l.createElement("p",null,(()=>{var e,n,t,l,o,i,a;const r=null==f||null===(e=f.Properties)||void 0===e?void 0:e.at(0),u=null==r?void 0:r.doorNo,d=null==r||null===(n=r.address)||void 0===n?void 0:n.street,s=null==r||null===(t=r.address)||void 0===t?void 0:t.landmark,c=null==r||null===(l=r.address)||void 0===l||null===(o=l.locality)||void 0===o?void 0:o.name,v=null==r||null===(i=r.address)||void 0===i?void 0:i.city,p=null==r||null===(a=r.address)||void 0===a?void 0:a.pincode;return(u?u+", ":"")+"\n "+(d?d+", ":"")+"\n "+(s?s+", ":"")+"\n "+(c?c+", ":"")+"\n "+(v||"")+"\n "+(p?", "+p:"")})()))),l.createElement(i.Link,{to:"/digit-ui/employee/commonpt/view-property?propertyId="+m+"&tenantId="+S},l.createElement(a.LinkButton,{label:s("CPT_COMPLETE_PROPERTY_DETAILS"),style:{color:"#a82227"}}))))},WSConnectionHolderDetails:e=>{var n,a,r,u;let{config:d,onSelect:s,userType:c,formData:p,setError:E,formState:S,clearErrors:_}=e;const{t:f}=o.useTranslation(),C=(i.useLocation(),g(location.search)),[N,y]=t.useState(null!=p&&p.ConnectionHolderDetails?[v({},null==p||null===(n=p.ConnectionHolderDetails)||void 0===n?void 0:n[0])]:[{sameAsOwnerDetails:!0,name:"",gender:"",mobileNumber:"",guardian:"",relationship:"",address:"",ownerType:"",documentId:"",documentType:"",file:"",emailId:""}]),[D,T]=t.useState({index:-1,type:""}),h=Digit.ULBService.getStateId(),[A,I]=t.useState(!1),[O,b]=t.useState((null==p||null===(a=p[d.key])||void 0===a?void 0:a.fileStoreId)||null),[L,R]=t.useState(null),{data:w}=Digit.Hooks.obps.useMDMS(h,"common-masters",["GenderType"]);let W=[];w&&w["common-masters"].GenderType.filter(e=>e.active).map(e=>{W.push({i18nKey:"COMMON_GENDER_"+e.code,code:""+e.code,value:""+e.code})});let P=[];const{data:M={}}=Digit.Hooks.pt.usePropertyMDMS(h,"PropertyTax","Documents"),x=null==M||null===(r=M.PropertyTax)||void 0===r?void 0:r.Documents,B=Array.isArray(x)&&x.filter(e=>e.code.includes("SPECIALCATEGORYPROOF"));var F,U;B.length>0&&(P=null===(F=B[0])||void 0===F?void 0:F.dropdownData,P.forEach(e=>{e.i18nKey=m(e.code,".","_")}),P=null===(U=P)||void 0===U?void 0:U.filter(e=>{var n;return e.parentValue.includes(null==N||null===(n=N[0])||void 0===n?void 0:n.ownerType)}),1==P.length&&dropdownValue!=P[0]&&setTypeOfDropdownValue(P[0]));const{data:k}=Digit.Hooks.pt.usePropertyMDMS(h,"PropertyTax","OwnerType");k&&k.sort((e,n)=>e.name.localeCompare(n.name)),t.useEffect(()=>{const e=N.map(e=>e);s(null==d?void 0:d.key,e)},[N]),t.useEffect(()=>{var e;"employee"===c&&s(d.key,[v({},null===(e=p[d.key])||void 0===e?void 0:e[0],null==N?void 0:N[0])])},[N]),t.useEffect(()=>{var e,n,t,l,o,i,a,r,u,d,s,c,v,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B;e=sessionStorage.getItem("eyeIconClicked"),(window.location.href.includes("edit")||window.location.href.includes("modify"))&&null!=p&&p.ConnectionHolderDetails&&(null===(n=Object.values(null==p||null===(t=p.ConnectionHolderDetails)||void 0===t?void 0:t[0]))||void 0===n?void 0:n.length)>1&&("gender"===e&&null!=N&&null!==(l=N[0])&&void 0!==l&&null!==(o=l.gender)&&void 0!==o&&o.code&&(null==p||null===(i=p.ConnectionHolderDetails)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.gender)||void 0===r?void 0:r.code)!==(null==N||null===(u=N[0])||void 0===u||null===(d=u.gender)||void 0===d?void 0:d.code)||"connectionHoldersMobileNumber"===e&&null!=N&&null!==(s=N[0])&&void 0!==s&&s.mobileNumber&&(null==p||null===(c=p.ConnectionHolderDetails)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.mobileNumber)!==(null==N||null===(m=N[0])||void 0===m?void 0:m.mobileNumber)||"fatherOrHusbandName"===e&&null!=N&&null!==(E=N[0])&&void 0!==E&&E.guardian&&(null==p||null===(S=p.ConnectionHolderDetails)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.guardian)!==(null==N||null===(f=N[0])||void 0===f?void 0:f.guardian)||"relationship"===e&&null!=N&&null!==(g=N[0])&&void 0!==g&&null!==(C=g.relationship)&&void 0!==C&&C.code&&(null==p||null===(y=p.ConnectionHolderDetails)||void 0===y||null===(D=y[0])||void 0===D||null===(T=D.relationship)||void 0===T?void 0:T.code)!==(null==N||null===(h=N[0])||void 0===h||null===(A=h.relationship)||void 0===A?void 0:A.code)||"correspondenceAddress"===e&&null!=N&&null!==(I=N[0])&&void 0!==I&&I.address&&(null==p||null===(O=p.ConnectionHolderDetails)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.address)!==(null==N||null===(L=N[0])||void 0===L?void 0:L.address)||"ownerType"===e&&null!=N&&null!==(R=N[0])&&void 0!==R&&null!==(w=R.ownerType)&&void 0!==w&&w.code&&(null==p||null===(W=p.ConnectionHolderDetails)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.ownerType)||void 0===M?void 0:M.code)!==(null==N||null===(x=N[0])||void 0===x||null===(B=x.ownerType)||void 0===B?void 0:B.code))&&(sessionStorage.removeItem("eyeIconClicked"),window.location.reload())},[null==p||null===(u=p.ConnectionHolderDetails)||void 0===u?void 0:u[0],N,p]),t.useEffect(()=>{null!=p&&p.ConnectionHolderDetails||y([{sameAsOwnerDetails:!0,name:"",gender:"",mobileNumber:"",guardian:"",relationship:"",address:"",ownerType:"",documentId:"",documentType:"",file:"",emailId:""}])},[null==p?void 0:p.ConnectionHolderDetails]);const H={focusIndex:D,connectionHolderDetails:N,setFocusIndex:T,formData:p,formState:S,t:f,setError:E,clearErrors:_,config:d,setConnectionHolderDetails:y,setIsErrors:I,isErrors:A,connectionHolderDetails:N,filters:C,menu:W,uploadedFile:O,setUploadedFile:b,file:L,setFile:R,dropdownData:P,GuardianOptions:[{name:"HUSBAND",code:"HUSBAND",i18nKey:"COMMON_MASTERS_OWNERTYPE_HUSBAND"},{name:"Father",code:"FATHER",i18nKey:"COMMON_MASTERS_OWNERTYPE_FATHER"}],Menu:k};return l.createElement(l.Fragment,null,N.map((e,n)=>l.createElement(Le,v({key:e.key,index:n,connectionHolderDetail:e},H))))},WSActivationConnectionDetails:e=>{var n,r,u;let{config:d,onSelect:s,userType:c,formData:p,setError:E,formState:S,clearErrors:_}=e;const{t:f}=o.useTranslation(),C=(i.useLocation(),g(location.search)),[N,y]=window.location.href.includes("modify")?t.useState(null!=p&&p.connectionDetails?[null==p||null===(n=p.connectionDetails)||void 0===n?void 0:n[0]]:[Rt(null==C||null===(r=C.service)||void 0===r?void 0:r.toUpperCase())]):t.useState((null==p?void 0:p.connectionDetails)||[Rt(null==C||null===(u=C.service)||void 0===u?void 0:u.toUpperCase())]),[D,T]=t.useState({index:-1,type:""}),h=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),[A,I]=t.useState(!1),[O,b]=t.useState([]),[L,R]=t.useState([]),[w,W]=t.useState([]),[P,M]=t.useState([]),{isMdmsLoading:x,data:B}=Digit.Hooks.ws.useMDMS(h,"ws-services-masters",["connectionType","waterSource"]),{isWSServicesCalculationLoading:F,data:U}=Digit.Hooks.ws.useMDMS(h,"ws-services-calculation",["PipeSize"]);if(t.useEffect(()=>{const e=N.map(e=>e);s(null==d?void 0:d.key,e)},[N]),t.useEffect(()=>{var e,n,t,l,o,i;const a=(null==U||null===(e=U["ws-services-calculation"])||void 0===e?void 0:e.PipeSize)||[];null==a||a.forEach(e=>e.i18nKey=e.size);const r=(null==B||null===(n=B["ws-services-masters"])||void 0===n?void 0:n.connectionType)||[];null==r||r.forEach(e=>{var n;return e.i18nKey="WS_CONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")});const u=(null==B||null===(t=B["ws-services-masters"])||void 0===t?void 0:t.waterSource)&&Lt(null==B||null===(l=B["ws-services-masters"])||void 0===l?void 0:l.waterSource)||[];null==u||u.forEach(e=>{var n,t;return e.i18nKey="WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(n=e.code)||void 0===n||null===(t=n.split(".")[0])||void 0===t?void 0:t.toUpperCase()," ","_")});var d,s=[],c=[],v=u.length;for(d=0;d<v;d++){var p,E;s[u[d].i18nKey]||(s[u[d].i18nKey]=!0,c.push({i18nKey:null==u||null===(p=u[d])||void 0===p?void 0:p.i18nKey,code:null==u||null===(E=u[d])||void 0===E?void 0:E.code}))}if(b(a),R(r),W(c),null!=N&&null!==(o=N[0])&&void 0!==o&&null!==(i=o.waterSource)&&void 0!==i&&i.code){var S,_;const e=(null==B||null===(S=B["ws-services-masters"])||void 0===S?void 0:S.waterSource)&&Lt(null==B||null===(_=B["ws-services-masters"])||void 0===_?void 0:_.waterSource)||[];null==e||e.forEach(e=>{var n;return e.i18nKey="WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase(),".","_")});const n=null==e?void 0:e.filter(e=>{var n,t,l,o;return(null==N||null===(n=N[0])||void 0===n||null===(t=n.waterSource)||void 0===t||null===(l=t.code)||void 0===l?void 0:l.split(".")[0])==(null==e||null===(o=e.code)||void 0===o?void 0:o.split(".")[0])});M(n)}},[B,U]),t.useEffect(()=>{"employee"===c&&s(d.key,v({},p[d.key],N))},[N]),x||F)return l.createElement(a.Loader,null);const k={focusIndex:D,allOwners:N,setFocusIndex:T,formData:p,formState:S,t:f,setError:E,clearErrors:_,config:d,setConnectionDetails:y,setIsErrors:I,isErrors:A,connectionDetails:N,connectionTypeList:L,waterSourceList:w,waterSubSourceList:P,pipeSizeList:O,filters:C,setWaterSubSourceList:M,mdmsData:B};return l.createElement(l.Fragment,null,N.map((e,n)=>l.createElement(wt,v({key:e.key,index:n,connectionDetail:e},k))))},WSActivationPlumberDetails:e=>{var n,i;let{config:a,onSelect:r,formData:u,setError:d,formState:s,clearErrors:c}=e;const{t:p}=o.useTranslation(),m=g(location.search),[E,S]=t.useState((null==u?void 0:u.plumberDetails)||[[{plumberName:"",plumberMobileNo:"",plumberLicenseNo:"",detailsProvidedBy:""}]]),[_,f]=t.useState({index:-1,type:""}),[C,N]=t.useState(!1);t.useEffect(()=>{const e=E.map(e=>e);r(null==a?void 0:a.key,e)},[E,null==u||null===(n=u.connectionDetails)||void 0===n||null===(i=n[0])||void 0===i?void 0:i.connectionType]);const y={focusIndex:_,allOwners:E,setFocusIndex:f,formData:u,formState:s,t:p,setError:d,clearErrors:c,config:a,setPlumberDetails:S,setIsErrors:N,isErrors:C,plumberDetails:E,filters:m,options:[{i18nKey:"WS_PLUMBER_ULB",code:"ULB"},{i18nKey:"WS_PLUMBER_SELF",code:"Self"}],setPlumberDetails:S};return l.createElement(l.Fragment,null,E.map((e,n)=>l.createElement(Wt,v({key:e.key,index:n,plumberDetail:e},y))))},WSActivationPageDetails:e=>{var n;let{config:i,onSelect:a,userType:r,formData:u,setError:d,formState:s,clearErrors:c}=e;const{t:p}=o.useTranslation(),m=g(location.search),[E,S]=window.location.href.includes("modify")?t.useState(null!=u&&u.activationDetails?[null==u||null===(n=u.activationDetails)||void 0===n?void 0:n[0]]:[{meterId:"",meterInstallationDate:null,meterInitialReading:"",connectionExecutionDate:null}]):t.useState((null==u?void 0:u.activationDetails)||[{meterId:"",meterInstallationDate:null,meterInitialReading:"",connectionExecutionDate:null}]),[_,f]=t.useState({index:-1,type:""}),[C,N]=t.useState(!1);t.useEffect(()=>{const e=E.map(e=>e);a(null==i?void 0:i.key,e)},[E]),t.useEffect(()=>{"employee"===r&&a(i.key,v({},u[i.key],E))},[E]);const y={focusIndex:_,allOwners:E,setFocusIndex:f,formData:u,formData2:u,formState:s,t:p,setError:d,clearErrors:c,config:i,setActivationDetails:S,setIsErrors:N,isErrors:C,activationDetails:E,filters:m};return l.createElement(l.Fragment,null,E.map((e,n)=>l.createElement(Pt,v({key:e.key,index:n,activationDetail:e},y))))},WSActivationCommentsDetails:e=>{var n;let{t:o,config:i,userType:r,formData:u,onSelect:d}=e;const[s,c]=t.useState({comments:(null==u||null===(n=u.comments)||void 0===n?void 0:n.comments)||""});return t.useEffect(()=>{}),t.useEffect(()=>{"employee"===r&&d(i.key,v({},u[i.key],s))},[s]),l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"700"},className:"card-label-smaller"},o("WF_COMMON_COMMENTS"),":"),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:i.key,value:s.comments,onChange:e=>{c(v({},s,{comments:e.target.value}))}}))))},WSActivationSupportingDocuments:e=>{var n,o;let{t:i,config:r,userType:u,formData:d,onSelect:s}=e;Digit.ULBService.getStateId();const c=Digit.ULBService.getCurrentTenantId(),[p,m]=t.useState(null!=d&&null!==(n=d.supportingDocuments)&&void 0!==n&&n[0]?[null==d||null===(o=d.supportingDocuments)||void 0===o?void 0:o[0]]:[]),[E,S]=t.useState(null),[_,f]=t.useState(null),[g,C]=t.useState(null);return t.useEffect(()=>{s(r.key,{documents:p})},[p]),t.useEffect(()=>{"employee"===u&&s(r.key,v({},d[r.key],p))},[p]),t.useEffect(()=>{!function(){try{S(null);const e=function(){if(g){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(g.size>=5242880)S(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=g&&g.type&&!e.test(null==g?void 0:g.type))S(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=he(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",g,c)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):S(i("CS_FILE_UPLOAD_ERROR"))})},function(){S(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[g]),t.useEffect(()=>{_&&m(e=>[{fileStoreId:_,documentUid:_}])},[_]),l.createElement("div",null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},i("WF_APPROVAL_UPLOAD_HEAD"),":"),l.createElement("div",{className:"field"},l.createElement(a.UploadFile,{onUpload:e=>{!function(e){C(e.target.files[0])}(e)},onDelete:()=>{f(null)},message:_?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},buttonType:"button",accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:E}))))},WSDocumentsEmployee:e=>{var n,o,r,u;let{t:d,config:s,onSelect:c,formData:v,setError:p,clearErrors:m,formState:E}=e;Digit.ULBService.getCurrentTenantId();const S=Digit.ULBService.getStateId(),[_,f]=t.useState((null==v||null===(n=v.DocumentsRequired)||void 0===n?void 0:n.documents)||[]),[g,C]=t.useState(null),N=window.location.href.includes("modify")?"ModifyConnectionDocuments":window.location.href.includes("disconnection")?"DisconnectionDocuments":"Documents";let y="create";const{pathname:D}=i.useLocation(),T=D.includes("/modify-application/");D.includes("/property-mutate/"),T&&(y="update");const{isLoading:h,data:A}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(S,N);if(t.useEffect(()=>{c(s.key,{documents:_})},[_]),h)return l.createElement(a.Loader,null);const I=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS"));if(window.location.href.includes("edit")&&(null==I||null===(o=I.applicationData)||void 0===o||null===(r=o.documents)||void 0===r?void 0:r.length)>0){var O;const e=(null==I||null===(O=I.applicationData)||void 0===O?void 0:O.documents)||[];null==e||e.map(e=>{var n;null==A||null===(n=A[N])||void 0===n||n.forEach(n=>{var t,l,o,i,a,r,u,d;(null!=n&&null!==(t=n.code)&&void 0!==t&&t.split(".")[1]?(null==n||null===(l=n.code)||void 0===l?void 0:l.split(".")[0])+"."+(null==n||null===(o=n.code)||void 0===o?void 0:o.split(".")[1]):null==n||null===(i=n.code)||void 0===i?void 0:i.split(".")[0])==(null!=e&&null!==(a=e.documentType)&&void 0!==a&&a.split(".")[1]?(null==e||null===(r=e.documentType)||void 0===r?void 0:r.split(".")[0])+"."+(null==e||null===(u=e.documentType)||void 0===u?void 0:u.split(".")[1]):null==e||null===(d=e.documentType)||void 0===d?void 0:d.split(".")[0])&&(n.auditDetails=e.auditDetails,n.documentType=n.documentType,n.documentUid=e.documentUid,n.fileStoreId=e.fileStoreId,n.id=e.id,n.status="ACTIVE")})})}return l.createElement("div",null,null==A||null===(u=A[N])||void 0===u?void 0:u.map((e,n)=>l.createElement(Mt,{key:n,document:e,action:y,t:d,id:"pt-document-"+n,error:g,setError:C,setDocuments:f,documents:_,formData:v,setFormError:p,clearFormErrors:m,config:s,formState:E})),g&&l.createElement(a.Toast,{label:g,onClose:()=>C(null),error:!0}))},WSEditConnectionDetails:e=>{var n;let{config:r,onSelect:u,userType:d,formData:s,setError:c,formState:p,clearErrors:m}=e,E=g(location.search);const S=null==E?void 0:E.applicationNumber,{t:_}=o.useTranslation(),[f,C]=(i.useLocation(),t.useState(null!=s&&s.ConnectionDetails?[null==s||null===(n=s.ConnectionDetails)||void 0===n?void 0:n[0]]:[{water:!0,sewerage:!1,applicationNo:"",serviceName:"",proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])),[N,y]=t.useState({index:-1,type:""}),D=Digit.ULBService.getStateId(),[T,h]=t.useState(!1),[A,I]=t.useState({water:!0,sewerage:!1}),[O,b]=t.useState([]),{isWSServicesCalculationLoading:L,data:R}=Digit.Hooks.ws.useMDMS(D,"ws-services-calculation",["PipeSize"]);if(t.useEffect(()=>{const e=f.map(e=>e);u(null==r?void 0:r.key,e)},[f]),t.useEffect(()=>{var e;const n=(null==R||null===(e=R["ws-services-calculation"])||void 0===e?void 0:e.PipeSize)||[];null==n||n.forEach(e=>e.i18nKey=e.size),b(n)},[R]),t.useEffect(()=>{var e,n;"employee"===d&&u(r.key,v({},s[r.key],f)),null!=f&&null!==(e=f[0])&&void 0!==e&&e.water&&I({water:!0,sewerage:!1}),null!=f&&null!==(n=f[0])&&void 0!==n&&n.sewerage&&I({water:!1,sewerage:!0})},[f]),t.useEffect(()=>{null!=s&&s.ConnectionDetails||C([{water:!0,sewerage:!1,applicationNo:"",serviceName:"",proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])},[null==s?void 0:s.ConnectionDetails]),L)return l.createElement(a.Loader,null);const w={focusIndex:N,connectionDetails:f,setFocusIndex:y,formData:s,formState:p,t:_,setError:c,clearErrors:m,config:r,setConnectionDetails:C,setIsErrors:h,isErrors:T,pipeSizeList:O,wsServicesCalculationData:R,waterSewarageSelection:A,applicationNumber:S};return l.createElement(l.Fragment,null,f.map((e,n)=>l.createElement(xt,v({key:e.key,index:n,connectionDetail:e},w))))},WSDisconnectionDocsRequired:e=>{var n;let{userType:r}=e;const{t:u}=o.useTranslation(),d=i.useHistory(),s=i.useRouteMatch(),c=Digit.ULBService.getStateId(),{isLoading:v,data:p}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(c,"DisconnectionDocuments");var m;return"citizen"===r?l.createElement(t.Fragment,null,l.createElement(a.Card,null,l.createElement(a.CardHeader,null,u("WS_COMMON_APPLICATION_DISCONNECTION")),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px"},textStyle:{color:"#0B0C0C",paddingLeft:"40px",paddingRight:"40px"},text:u("WS_DOCS_REQUIRED_TIME"),showInfo:!1}),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},u("WS_NEW_CONNECTION_TEST_1")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},u("WS_NEW_CONNECTION_TEST_2")),l.createElement(a.CardSubHeader,null,u("WS_DOC_REQ_SCREEN_LABEL")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},u("WS_NEW_CONNECTION_TEST_3")),v?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,null==p||null===(m=p.DisconnectionDocuments)||void 0===m?void 0:m.map((e,n)=>{var t;return l.createElement("div",null,l.createElement("div",{style:{fontWeight:700,marginBottom:"8px"},key:n},l.createElement("div",{style:{display:"flex"}},l.createElement("div",null,n+1+"."," "),l.createElement("div",null," "+u(null==e?void 0:e.code.replace(".","_"))))),l.createElement("div",{style:{marginBottom:"16px",marginLeft:"18px",color:"gray"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((n,t)=>{var o;return(null==e||null===(o=e.dropdownData)||void 0===o?void 0:o.length)!==t+1?l.createElement("span",{style:{color:"gray"}},u(null==n?void 0:n.i18nKey)+", "):l.createElement("span",{style:{color:"gray"}},""+u(null==n?void 0:n.i18nKey))})))})),l.createElement(a.SubmitBar,{label:u("CS_COMMON_NEXT"),onSubmit:()=>{d.push(s.path.replace("docsrequired","application-form"))}}))):l.createElement("div",{style:{margin:"16px"}},l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px"}},u("WS_WATER_AND_SEWERAGE_DISCONNECTION")),l.createElement(a.Card,null,v?l.createElement(a.Loader,null):l.createElement("div",{id:"documents-div"},null==p||null===(n=p.DisconnectionDocuments)||void 0===n?void 0:n.map((e,n)=>{var t;return l.createElement("div",{key:n,style:{marginTop:"16px"}},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",lineHeight:"28px",fontSize:"24px"}},u(null==e?void 0:e.code.replace(".","_"))),e.dropdownData&&e.dropdownData.length>1&&l.createElement("p",{style:{lineHeight:"24px",fontSize:"16px"}},u((null==e?void 0:e.code.replace(".","_"))+"_DESCRIPTION")),l.createElement("div",{style:{margin:"16px 0",lineHeight:"18px",fontSize:"16px"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((e,n)=>l.createElement("p",{style:{fontWeight:"bold",lineHeight:"32px"}},n+1+". "+u(null==e?void 0:e.i18nKey)))),l.createElement("p",{style:{fontSize:"16px"}},u((null==e?void 0:e.code.replace(".","_"))+"_BELOW_DESCRIPTION")))})),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:u("ACTION_TEST_APPLY"),onSubmit:()=>{d.push(s.path.replace("docsrequired","application-form"))},style:{margin:"10px 10px 0px 0px"},disabled:!!v}))))},WSDisconnectionForm:e=>{var n,o,r,u,d,s,c,p,E,S,_;let{t:f,config:g,onSelect:C,userType:y}=e;const D=Digit.ULBService.getStateId(),T=Digit.ULBService.getCurrentTenantId(),h=window.Digit.Utils.browser.isMobile(),O=Digit.SessionStorage.get("WS_DISCONNECTION"),b=i.useHistory(),L=i.useRouteMatch(),[R,w]=t.useState({type:O.WSDisconnectionForm?O.WSDisconnectionForm.type:"",date:O.WSDisconnectionForm?O.WSDisconnectionForm.date:"",endDate:O.WSDisconnectionForm&&(null==O||null===(n=O.WSDisconnectionForm)||void 0===n?void 0:n.endDate)||"",reason:O.WSDisconnectionForm?O.WSDisconnectionForm.reason:"",documents:O.WSDisconnectionForm?O.WSDisconnectionForm.documents:[]}),[W,P]=t.useState(O.WSDisconnectionForm?O.WSDisconnectionForm.documents:[]),[M,x]=t.useState(null),[B,F]=t.useState([]),[U,k]=t.useState([]),[H,j]=t.useState(!1),[V,z]=t.useState(!1),{isMdmsLoading:Y,data:G}=Digit.Hooks.ws.useMDMS(D,"ws-services-masters",["disconnectionType"]),{data:q}=Digit.Hooks.ws.useMDMS(D,"ws-services-masters",["DisconnectionReason"]),{isLoading:K,data:X}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(D,"DisconnectionDocuments"),{isLoading:Z,data:$}=Digit.Hooks.ws.useDisconnectionWorkflow({tenantId:T}),J=window.location.href.includes("resubmit"),{mutate:Q}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:ee}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:ne}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:te}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),le=()=>{x(null)};t.useEffect(()=>{const e=v({},R);e.documents=W,w(e)},[W]),t.useEffect(()=>{var e;const n=(null==G||null===(e=G["ws-services-masters"])||void 0===e?void 0:e.disconnectionType)||[];null==n||n.forEach(e=>{var n;return e.i18nKey="WS_DISCONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")}),F(n)},[G]),t.useEffect(()=>{var e;const n=(null==q||null===(e=q["ws-services-masters"])||void 0===e?void 0:e.DisconnectionReason)||[];null==n||n.forEach(e=>{var n;return e.i18nKey="WS_DISCONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")}),k(n)},[q]),t.useEffect(()=>{Digit.SessionStorage.set("WS_DISCONNECTION",v({},O,{WSDisconnectionForm:R}))},[R]);const oe=()=>C(),ie=e=>{const n=v({},R);n[e.code]=e,w(n)};return Y||K||V||Z?l.createElement(a.Loader,null):"citizen"===y?l.createElement("div",null,"citizen"===y&&l.createElement(Ft,{currentStep:1}),l.createElement(a.FormStep,{config:g,onSelect:()=>C(g.key,{WSDisConnectionForm:R}),onSkip:oe,t:f},l.createElement("div",{style:{padding:"0px 10px 10px 10px"}},l.createElement(a.CardHeader,null,f(J?"RESUBMIT_DISCONNECTION_FORM":"WS_APPLICATION_FORM")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==O?void 0:O.connectionNo,className:"border-none"})),l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_TYPE")+"*"),l.createElement(a.RadioButtons,{t:f,options:B,optionsKey:"i18nKey",value:null===(ae=R.type)||void 0===ae||null===(re=ae.value)||void 0===re?void 0:re.code,selectedOption:null===(ue=R.type)||void 0===ue?void 0:ue.value,isMandatory:!1,onSelect:e=>ie({code:"type",value:e}),labelKey:"WS_DISCONNECTION_TYPE",inputStyle:h?{marginLeft:"unset"}:{}}),l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_PROPOSED_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium",width:Digit.Utils.browser.isMobile()?"150px":"unset"}},f("SHOULD_BE_DATE")+" "+(null==$?void 0:$.slaDays)+" "+f("DAYS_OF_APPLICATION_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.date,onChange:e=>{w(v({},R,{date:e}))}})),"Temporary"===(null===(de=R.type)||void 0===de||null===(se=de.value)||void 0===se?void 0:se.code)?l.createElement("div",null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_PROPOSED_END_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium",width:Digit.Utils.browser.isMobile()?"150px":"unset"}},f("SHOULD_BE_DATE")+" "+f("DAYS_OF_PROPOSED_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.endDate,onChange:e=>{w(v({},R,{endDate:e}))}}))):"",l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_REASON")+"*"),l.createElement(a.Dropdown,{option:U,isMandatory:!1,optionKey:"i18nKey",t:f,name:"reason",value:null===(ce=R.reason)||void 0===ce||null===(ve=ce.value)||void 0===ve?void 0:ve.code,selectedOption:null===(pe=R.reason)||void 0===pe?void 0:pe.value,labelKey:"WS_DISCONNECTION_REASON",select:e=>ie({code:"reason",value:e})})),l.createElement(a.SubmitBar,{label:f("CS_COMMON_NEXT"),onSubmit:()=>{var e,n;const t=Ol(jt(new Date,null==$?void 0:$.slaDays),"yyyy-MM-dd").toString();N(null==R?void 0:R.date)<=N(t)?(x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_DATE"}),setTimeout(()=>{x(!1)},3e3)):"Temporary"==(null==R||null===(e=R.type)||void 0===e||null===(n=e.value)||void 0===n?void 0:n.code)&&parseInt(N(R.endDate))<=parseInt(N(null==R?void 0:R.date))?(console.log("Temporary connection"),x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_END_DATE"}),setTimeout(()=>{x(!1)},3e3)):b.push(L.path.replace("application-form","documents-upload"))},disabled:""===(null==R||null===(me=R.reason)||void 0===me?void 0:me.value)||""===(null==R?void 0:R.reason)||""===(null==R?void 0:R.date)||""===(null==R?void 0:R.type)}),M&&l.createElement(a.Toast,{error:"error"===(null==M?void 0:M.key),label:f(null==M?void 0:M.message),onClose:()=>x(null)}))),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px"},textStyle:{color:"#0B0C0C"},text:f("WS_DISONNECT_APPL_INFO"),info:f("CS_COMMON_INFO")})):l.createElement("div",{style:{margin:"16px"}},l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px"}},f("WS_WATER_AND_SEWERAGE_DISCONNECTION")),l.createElement(a.FormStep,{config:g,onSelect:()=>{C(g.key,{WSDisConnectionForm:v({},R,{documents:W})})},onSkip:oe,t:f},l.createElement("div",{style:{padding:"10px",paddingTop:"20px",marginTop:"10px"}},l.createElement(a.CardSectionHeader,null,f("CS_TITLE_APPLICATION_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==O||null===(o=O.applicationData)||void 0===o?void 0:o.connectionNo,className:"border-none"})),l.createElement(a.CardSectionHeader,null,f("WS_DISCONNECTION_TYPE")+"*",l.createElement("div",{className:"tooltip",style:{marginLeft:"8px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium",width:Digit.Utils.browser.isMobile()&&window.location.href.includes("/employee")?"200px":""}},""+f("WS_DISCONNECTION_PERMANENT_TOOLTIP"),l.createElement("br",null),l.createElement("br",null),""+f("WS_DISCONNECTION_TEMPORARY_TOOLTIP")))),l.createElement(a.RadioButtons,{t:f,options:B,optionsKey:"i18nKey",value:null===(r=R.type)||void 0===r||null===(u=r.value)||void 0===u?void 0:u.code,selectedOption:null===(d=R.type)||void 0===d?void 0:d.value,isMandatory:!1,onSelect:e=>ie({code:"type",value:e}),labelKey:"WS_DISCONNECTION_TYPE",style:{display:"flex",gap:"0px 3rem"},inputStyle:h?{marginLeft:"unset"}:{}}),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},f("WS_DISCONNECTION_PROPOSED_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute",marginLeft:"4px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium"}},f("SHOULD_BE_DATE")+" "+(null==$?void 0:$.slaDays)+" "+f("DAYS_OF_APPLICATION_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.date,onChange:e=>{w(v({},R,{date:e}))}}))),"Temporary"===(null===(s=R.type)||void 0===s||null===(c=s.value)||void 0===c?void 0:c.code)?l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},f("WS_DISCONNECTION_PROPOSED_END_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute",marginLeft:"4px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium"}},f("SHOULD_BE_DATE")+" "+f("DAYS_OF_APPLICATION_END_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.endDate,onChange:e=>{w(v({},R,{endDate:e}))}}))):"",l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},f("WS_DISCONNECTION_REASON")+"*"),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{option:U,isMandatory:!1,optionKey:"i18nKey",t:f,name:"reason",value:null===(p=R.reason)||void 0===p||null===(E=p.value)||void 0===E?void 0:E.code,selectedOption:null===(S=R.reason)||void 0===S?void 0:S.value,select:e=>ie({code:"reason",value:e}),labelKey:"WS_DISCONNECTION_REASON"}))),l.createElement(a.CardSectionHeader,{style:{marginBottom:"8px"}},f("WS_DISCONNECTION_DOCUMENTS")+"*"),null==X||null===(_=X.DisconnectionDocuments)||void 0===_?void 0:_.map((e,n)=>l.createElement(Ll,{key:n,document:e,t:f,error:M,setError:x,setDocuments:P,documents:W,setCheckRequiredFields:j})),M&&l.createElement(a.Toast,{error:"error"===(null==M?void 0:M.key),label:f(null==M?void 0:M.message),warning:null==M?void 0:M.warning,onClose:()=>x(null)}))),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:f("ACTION_TEST_SUBMIT"),onSubmit:()=>function(e){try{const n=Ol(jt(new Date,null==$?void 0:$.slaDays),"yyyy-MM-dd").toString(),t=function(){if(N(null==e?void 0:e.date)<=N(n))x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_DATE"}),setTimeout(()=>{x(!1)},3e3);else{const n=function(n,t){if("Temporary"==(null==e||null===(n=e.type)||void 0===n||null===(t=n.value)||void 0===t?void 0:t.name)&&N(null==e?void 0:e.endDate)<=N(null==e?void 0:e.date))x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_END_DATE"}),setTimeout(()=>{x(!1)},3e3);else{const n=function(n){var t;if(!(K||W.length<2||""===(null==R||null===(n=R.reason)||void 0===n?void 0:n.value)||""===(null==R?void 0:R.reason)||""===(null==R?void 0:R.date)||""===(null==R?void 0:R.type)))return Promise.resolve(A(e,O,null==O||null===(t=O.applicationData)||void 0===t?void 0:t.serviceType)).then(function(e){const n=function(n){if(null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n.water){const n=function(){if(Q)return z(!0),Promise.resolve(Q(e,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(I(null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0],"WATER")).then(function(e){let n={WaterConnection:e};return n=v({},n,{disconnectRequest:!0}),Promise.resolve(ee(n,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},O,{DisconnectionResponse:null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]})),b.push("/digit-ui/employee/ws/ws-disconnection-response?applicationNumber="+(null==e||null===(l=e.WaterConnection)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}else{const n=function(n){if(null!=e&&null!==(n=e.SewerageConnection)&&void 0!==n&&n.sewerage){const n=function(){if(ne)return z(!0),Promise.resolve(ne(e,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(I(null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0],"SEWERAGE")).then(function(e){let n={SewerageConnection:e};return n=v({},n,{disconnectRequest:!0}),Promise.resolve(te(n,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},O,{DisconnectionResponse:null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0]})),b.push("/digit-ui/employee/ws/ws-disconnection-response?applicationNumber="+(null==e||null===(l=e.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})});x({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{x(!1)},3e3)}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(R),style:{margin:"10px 10px 0px 0px"}})));var ae,re,ue,de,se,ce,ve,pe,me},WSRestorationForm:e=>{var n,o,r,u;let{t:d,config:s,onSelect:c,userType:p}=e;const E=Digit.ULBService.getStateId(),S=Digit.ULBService.getCurrentTenantId(),_=(window.Digit.Utils.browser.isMobile(),Digit.SessionStorage.get("WS_DISCONNECTION")),f=i.useHistory(),g=i.useRouteMatch(),[C,y]=t.useState({type:_.WSDisconnectionForm?_.WSDisconnectionForm.type:"",date:_.WSDisconnectionForm?_.WSDisconnectionForm.date:"",reason:_.WSDisconnectionForm?_.WSDisconnectionForm.reason:"",documents:_.WSDisconnectionForm?_.WSDisconnectionForm.documents:[]}),[D,T]=t.useState(_.WSDisconnectionForm?_.WSDisconnectionForm.documents:[]),[h,A]=t.useState(null),[I,b]=t.useState([]),[L,R]=t.useState(!1),[w,W]=t.useState(!1),{isMdmsLoading:P,data:M}=Digit.Hooks.ws.useMDMS(E,"ws-services-masters",["disconnectionType"]),{isLoading:x}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(E,"DisconnectionDocuments"),{isLoading:B,data:F}=Digit.Hooks.ws.useDisconnectionWorkflow({tenantId:S}),U=window.location.href.includes("resubmit"),{mutate:k}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:H}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:j}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:V}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),z=()=>{A(null)};t.useEffect(()=>{const e=v({},C);e.documents=D,y(e)},[D]),t.useEffect(()=>{var e;const n=(null==M||null===(e=M["ws-services-masters"])||void 0===e?void 0:e.disconnectionType)||[];null==n||n.forEach(e=>{var n;return e.i18nKey="WS_DISCONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")}),console.log("disconnectionTypes",n),b(n)},[M]),t.useEffect(()=>{Digit.SessionStorage.set("WS_DISCONNECTION",v({},_,{WSDisconnectionForm:C}))},[C]);const Y=()=>c(),G=e=>{const n=v({},C);n[e.code]=e,y(n)};return P||x||w||B?l.createElement(a.Loader,null):"citizen"===p?l.createElement("div",null,"citizen"===p&&l.createElement(Ft,{currentStep:1}),l.createElement(a.FormStep,{config:s,onSelect:()=>c(s.key,{WSDisConnectionForm:C}),onSkip:Y,t:d},l.createElement("div",{style:{padding:"0px 10px 10px 10px"}},l.createElement(a.CardHeader,null,d(U?"RESUBMIT_RESTORATION_FORM":"WS_APPLICATION_FORM")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==_?void 0:_.connectionNo,className:"border-none"})),l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},d("WS_RESTORATION_PROPOSED_DATE")+"*"),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==C?void 0:C.date,onChange:e=>{y(v({},C,{date:e}))}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},d("WS_DISCONNECTION_REASON")+"*"),l.createElement(a.TextArea,{isMandatory:!1,optionKey:"i18nKey",t:d,name:"reason",value:null===(q=C.reason)||void 0===q?void 0:q.value,onChange:e=>G({code:"reason",value:e.target.value})})),l.createElement(a.SubmitBar,{label:d("CS_COMMON_NEXT"),onSubmit:()=>{Ol(jt(new Date,null==F?void 0:F.slaDays),"yyyy-MM-dd").toString(),f.push(g.path.replace("restoration-application","check"))},disabled:""===(null==C||null===(K=C.reason)||void 0===K?void 0:K.value)||""===(null==C?void 0:C.reason)||""===(null==C?void 0:C.date)}),h&&l.createElement(a.Toast,{error:"error"===(null==h?void 0:h.key),label:d(null==h?void 0:h.message),onClose:()=>A(null)}))),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px"},textStyle:{color:"#0B0C0C"},text:d("WS_DISONNECT_APPL_INFO"),info:d("CS_COMMON_INFO")})):(console.log("applicationData",_),l.createElement("div",{style:{margin:"16px"}},l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px"}},d("WS_WATER_AND_SEWERAGE_RESTORATION")),l.createElement(a.FormStep,{config:s,onSelect:()=>{c(s.key,{WSDisConnectionForm:v({},C,{documents:D})})},onSkip:Y,t:d},l.createElement("div",{style:{padding:"10px",paddingTop:"20px",marginTop:"10px"}},l.createElement(a.CardSectionHeader,null,d("CS_TITLE_APPLICATION_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==_||null===(n=_.applicationData)||void 0===n?void 0:n.connectionNo,className:"border-none"}),l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_TYPE_OF_SERVICE_LABEL"),label:""+d("PDF_STATIC_LABEL_TYPE_OF_SERVICE_LABEL"),text:null==_||null===(o=_.applicationData)||void 0===o?void 0:o.serviceType,className:"border-none"}),l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_PROPERTY_ID_LABEL"),label:""+d("PDF_STATIC_LABEL_PROPERTY_ID_LABEL"),text:null==_||null===(r=_.applicationData)||void 0===r?void 0:r.propertyId,className:"border-none"})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},d("WS_RESTORATION_PROPOSED_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute",marginLeft:"4px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium"}},d("SHOULD_BE_DATE")+" "+(null==F?void 0:F.slaDays)+" "+d("DAYS_OF_APPLICATION_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==C?void 0:C.date,onChange:e=>{y(v({},C,{date:e}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},d("WS_RESTORATION_REASON")+"*"),l.createElement("div",{className:"field"},l.createElement(a.TextArea,{isMandatory:!1,optionKey:"i18nKey",t:d,name:"reason",value:null===(u=C.reason)||void 0===u?void 0:u.value,onChange:e=>G({code:"reason",value:e.target.value})}))),h&&l.createElement(a.Toast,{error:"error"===(null==h?void 0:h.key),label:d(null==h?void 0:h.message),warning:null==h?void 0:h.warning,onClose:()=>A(null)}))),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:d("ACTION_TEST_SUBMIT"),onSubmit:()=>function(e){try{const n=Ol(jt(new Date,null==F?void 0:F.slaDays),"yyyy-MM-dd").toString(),t=function(){if(N(null==e?void 0:e.date)<=N(n))A({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_DATE"}),setTimeout(()=>{A(!1)},3e3);else{const n=function(n){var t;if(""!==(null==C||null===(n=C.reason)||void 0===n?void 0:n.value)&&""!==(null==C?void 0:C.reason)&&""!==(null==C?void 0:C.date))return Promise.resolve(function(e,n,t){try{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne;const Ae=Digit.UserService.getType();let Ie=[];if((null==n||null===(l=n.applicationData)||void 0===l||null===(o=l.plumberInfo)||void 0===o?void 0:o.length)>0){var te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he;let e={};null!=n&&null!==(te=n.applicationData)&&void 0!==te&&null!==(le=te.plumberInfo)&&void 0!==le&&null!==(oe=le[0])&&void 0!==oe&&oe.licenseNo&&(e.licenseNo=null==n||null===(ie=n.applicationData)||void 0===ie||null===(ae=ie.plumberInfo)||void 0===ae||null===(re=ae[0])||void 0===re?void 0:re.licenseNo),null!=n&&null!==(ue=n.applicationData)&&void 0!==ue&&null!==(de=ue.plumberInfo)&&void 0!==de&&null!==(se=de[0])&&void 0!==se&&se.mobileNumber&&(e.mobileNumber=null==n||null===(ce=n.applicationData)||void 0===ce||null===(ve=ce.plumberInfo)||void 0===ve||null===(pe=ve[0])||void 0===pe?void 0:pe.mobileNumber),null!=n&&null!==(me=n.applicationData)&&void 0!==me&&null!==(Ee=me.plumberInfo)&&void 0!==Ee&&null!==(Se=Ee[0])&&void 0!==Se&&Se.id&&(e.id=null==n||null===(_e=n.applicationData)||void 0===_e||null===(fe=_e.plumberInfo)||void 0===fe||null===(ge=fe[0])||void 0===ge?void 0:ge.id),null!=n&&null!==(Ce=n.applicationData)&&void 0!==Ce&&null!==(Ne=Ce.plumberInfo)&&void 0!==Ne&&null!==(ye=Ne[0])&&void 0!==ye&&ye.name&&(e.name=null==n||null===(De=n.applicationData)||void 0===De||null===(Te=De.plumberInfo)||void 0===Te||null===(he=Te[0])||void 0===he?void 0:he.name),Ie=[e]}let Oe={WaterConnection:{id:null==n||null===(i=n.applicationData)||void 0===i?void 0:i.id,applicationNo:null==n||null===(a=n.applicationData)||void 0===a?void 0:a.applicationNo,applicationStatus:null==n||null===(r=n.applicationData)||void 0===r?void 0:r.applicationStatus,status:null==n||null===(u=n.applicationData)||void 0===u?void 0:u.status,connectionNo:null==n||null===(d=n.applicationData)||void 0===d?void 0:d.connectionNo,connectionHolders:null==n||null===(s=n.applicationData)||void 0===s?void 0:s.connectionHolders,applicationType:"WATER_RECONNECTION",dateEffectiveFrom:N(null==e?void 0:e.date),isdisconnection:!0,isDisconnectionTemporary:"Temporary"===(null==e||null===(c=e.type)||void 0===c||null===(p=c.value)||void 0===p?void 0:p.code)||"TEMPORARY"===(null==e||null===(m=e.type)||void 0===m||null===(E=m.value)||void 0===E?void 0:E.code),disconnectionReason:null==e||null===(S=e.reason.value)||void 0===S?void 0:S.code,documents:null==e?void 0:e.documents,water:!0,sewerage:!1,proposedTaps:(null==n||null===(_=n.applicationData)||void 0===_?void 0:_.proposedTaps)&&Number(null==n||null===(f=n.applicationData)||void 0===f?void 0:f.proposedTaps),proposedPipeSize:(null==n||null===(g=n.applicationData)||void 0===g||null===(C=g.proposedPipeSize)||void 0===C?void 0:C.size)&&Number(null==n||null===(y=n.applicationData)||void 0===y||null===(D=y.proposedPipeSize)||void 0===D?void 0:D.size),service:"Water",property:null==n||null===(T=n.applicationData)||void 0===T?void 0:T.property,propertyId:null==n||null===(h=n.applicationData)||void 0===h?void 0:h.propertyId,oldConnectionNo:null,plumberInfo:(null===(A=Ie)||void 0===A?void 0:A.length)>0?Ie:null,roadCuttingInfo:null==n||null===(I=n.applicationData)||void 0===I?void 0:I.roadCuttingInfo,roadCuttingArea:null,roadType:null,connectionExecutionDate:null==n||null===(O=n.applicationData)||void 0===O?void 0:O.connectionExecutionDate,noOfTaps:null==n||null===(b=n.applicationData)||void 0===b?void 0:b.noOfTaps,additionalDetails:null==n||null===(L=n.applicationData)||void 0===L?void 0:L.additionalDetails,tenantId:null==n||null===(R=n.applicationData)||void 0===R?void 0:R.tenantId,connectionType:n.applicationData.connectionType||null,waterSource:n.applicationData.waterSource||null,processInstance:v({},null==n||null===(w=n.applicationData)||void 0===w?void 0:w.processInstance,{action:"INITIATE",businessService:"WSReconnection"}),channel:"citizen"===Ae?"CITIZEN":"CFC_COUNTER"},disconnectRequest:!1};n.applicationData.connectionType&&(n.applicationData.meterInstallationDate&&(Oe.WaterConnection.meterInstallationDate=n.applicationData.meterInstallationDate),n.applicationData.meterId&&(Oe.WaterConnection.meterId=n.applicationData.meterId));let be={SewerageConnection:{id:null==n||null===(W=n.applicationData)||void 0===W?void 0:W.id,applicationNo:null==n||null===(P=n.applicationData)||void 0===P?void 0:P.applicationNo,applicationStatus:null==n||null===(M=n.applicationData)||void 0===M?void 0:M.applicationStatus,status:null==n||null===(x=n.applicationData)||void 0===x?void 0:x.status,connectionNo:null==n||null===(B=n.applicationData)||void 0===B?void 0:B.connectionNo,connectionHolders:null==n||null===(F=n.applicationData)||void 0===F?void 0:F.connectionHolders,applicationType:"WATER_RECONNECTION",dateEffectiveFrom:N(null==e?void 0:e.date),isdisconnection:!0,isDisconnectionTemporary:"Temporary"===(null==e||null===(U=e.type)||void 0===U||null===(k=U.value)||void 0===k?void 0:k.code),disconnectionReason:null==e||null===(H=e.reason.value)||void 0===H?void 0:H.code,documents:null==e?void 0:e.documents,water:!1,sewerage:!0,proposedWaterClosets:(null==n||null===(j=n.applicationData)||void 0===j?void 0:j.proposedWaterClosets)&&Number(null==n||null===(V=n.applicationData)||void 0===V?void 0:V.proposedWaterClosets),proposedToilets:(null==n||null===(z=n.applicationData)||void 0===z?void 0:z.proposedToilets)&&Number(null==n||null===(Y=n.applicationData)||void 0===Y?void 0:Y.proposedToilets),service:"Sewerage",property:null==n||null===(G=n.applicationData)||void 0===G?void 0:G.property,propertyId:null==n||null===(q=n.applicationData)||void 0===q?void 0:q.propertyId,oldConnectionNo:null,plumberInfo:(null===(K=Ie)||void 0===K?void 0:K.length)>0?Ie:null,roadCuttingInfo:null==n||null===(X=n.applicationData)||void 0===X?void 0:X.roadCuttingInfo,roadCuttingArea:null,roadType:null,connectionExecutionDate:null==n||null===(Z=n.applicationData)||void 0===Z?void 0:Z.connectionExecutionDate,noOfWaterClosets:null==n||null===($=n.applicationData)||void 0===$?void 0:$.noOfWaterClosets,noOfToilets:null==n||null===(J=n.applicationData)||void 0===J?void 0:J.noOfToilets,additionalDetails:null==n||null===(Q=n.applicationData)||void 0===Q?void 0:Q.additionalDetails,tenantId:null==n||null===(ee=n.applicationData)||void 0===ee?void 0:ee.tenantId,connectionType:"Non Metered",waterSource:n.applicationData.waterSource||null,processInstance:v({},null==n||null===(ne=n.applicationData)||void 0===ne?void 0:ne.processInstance,{action:"INITIATE",businessService:"SWReconnection"}),channel:"citizen"===Ae?"CITIZEN":"CFC_COUNTER"},disconnectRequest:!1};return Promise.resolve("WATER"===t?Oe:be)}catch(e){return Promise.reject(e)}}(e,_,null==_||null===(t=_.applicationData)||void 0===t?void 0:t.serviceType)).then(function(e){const n=function(n){if(null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n.water){e.WaterConnection.isdisconnection=!1,e.WaterConnection.isDisconnectionTemporary=!0,e.WaterConnection.reconnectionReason=e.WaterConnection.disconnectionReason,e.WaterConnection.disconnectionReason="",e.reconnectRequest=!0,e.disconnectRequest=!1;const n=function(){if(k)return W(!0),Promise.resolve(k(e,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(O(null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0],"WATER")).then(function(e){let n={WaterConnection:e};return n=v({},n,{disconnectRequest:!1,reconnectRequest:!0}),console.log("response"),Promise.resolve(H(n,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},_,{DisconnectionResponse:null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]})),f.push("/digit-ui/employee/ws/ws-restoration-response?applicationNumber="+(null==e||null===(l=e.WaterConnection)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}else{const n=function(n){if(null!=e&&null!==(n=e.SewerageConnection)&&void 0!==n&&n.sewerage){e.SewerageConnection.isdisconnection=!1,e.SewerageConnection.reconnectionReason=e.SewerageConnection.disconnectionReason,e.SewerageConnection.disconnectionReason="",e.SewerageConnection.isDisconnectionTemporary=!0,e.reconnectRequest=!0,e.disconnectRequest=!1;const n=function(){if(j)return W(!0),Promise.resolve(j(e,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(O(null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0],"SEWERAGE")).then(function(e){let n={SewerageConnection:e};return n=v({},n,{disconnectRequest:!1,reconnectRequest:!0}),Promise.resolve(V(n,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},_,{DisconnectionResponse:null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0]})),f.push("/digit-ui/employee/ws/ws-restoration-response?applicationNumber="+(null==e||null===(l=e.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})});A({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{A(!1)},3e3)}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(C),style:{margin:"10px 10px 0px 0px"}}))));var q,K},WSDisconnectionDocumentsForm:function(e){var n;let{t:o,config:r,onSelect:u,userType:d}=e;const s=Digit.ULBService.getStateId(),c=Digit.SessionStorage.get("WS_DISCONNECTION"),[p,m]=t.useState(c.WSDisconnectionForm.documents?c.WSDisconnectionForm.documents:[]),[E,S]=t.useState(null),[_,f]=t.useState(!1),g=i.useHistory(),C=i.useRouteMatch();t.useEffect(()=>{Digit.SessionStorage.set("WS_DISCONNECTION",v({},c,{WSDisconnectionForm:v({},c.WSDisconnectionForm,{documents:p})}))},[p]);const{isLoading:N,data:y}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(s,"DisconnectionDocuments");return N?l.createElement(a.Loader,null):l.createElement("div",{style:{marginTop:"19px"}},"citizen"===d&&l.createElement(Ft,{currentStep:2}),l.createElement(a.FormStep,{t:o,config:r,onSelect:()=>{u(r.key,{WSDisconnectionDocumentsForm:p})}},l.createElement(a.CardHeader,null,o("WS_DISCONNECTION_UPLOAD_DOCUMENTS")),null==y||null===(n=y.DisconnectionDocuments)||void 0===n?void 0:n.map((e,n)=>l.createElement(Rl,{key:n,document:e,t:o,error:E,setError:S,setDocuments:m,documents:p,setCheckRequiredFields:f})),l.createElement(a.SubmitBar,{label:o("CS_COMMON_NEXT"),onSubmit:()=>{g.push(C.path.replace("documents-upload","check"))},disabled:p.length<2}),E&&l.createElement(a.Toast,{error:"error"===(null==E?void 0:E.key),label:o(null==E?void 0:E.message),onClose:()=>S(null)})))},WSDisconnectAcknowledgement:()=>{var e;const{t:n}=o.useTranslation(),t=Digit.SessionStorage.get("WS_DISCONNECTION");return l.createElement(a.Card,{style:{padding:"10px"}},l.createElement(a.CardSectionHeader,null,l.createElement(wl,{isSuccess:!0,message:n("WS_APPLICATION_COMPLETED_SUCCESSFULLY_LABEL"),applicationNumber:null==t||null===(e=t.DisconnectionResponse)||void 0===e?void 0:e.applicationNo})," ",l.createElement("successSvg",null)),l.createElement(a.CardText,null,n("WS_DISCONNECTION_APPLICATION_SUCC_MSG")),l.createElement(a.SubmitBar,{label:n("WS_DOWNLOAD_ACK_FORM"),onSubmit:()=>{const e=null==t?void 0:t.DisconnectionResponse;pe(e,null==t?void 0:t.property,null==e?void 0:e.tenantId,n).then(e=>Digit.Utils.pdf.generatev1(e))}}),l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(a.LinkButton,{label:n("CORE_COMMON_GO_TO_HOME"),onClick:()=>Digit.SessionStorage.del("WS_DISCONNECTION")})))},WSRestorationAcknowledgement:()=>{var e;const{t:n}=o.useTranslation(),t=Digit.SessionStorage.get("WS_DISCONNECTION");return l.createElement(a.Card,{style:{padding:"10px"}},l.createElement(a.CardSectionHeader,null,l.createElement(Wl,{isSuccess:!0,message:n("WS_APPLICATION_COMPLETED_SUCCESSFULLY_LABEL"),applicationNumber:null==t||null===(e=t.DisconnectionResponse)||void 0===e?void 0:e.applicationNo})," ",l.createElement("successSvg",null)),l.createElement(a.CardText,null,n("WS_RESTORATION_APPLICATION_SUCC_MSG")),l.createElement(a.SubmitBar,{label:n("WS_DOWNLOAD_ACK_FORM"),onSubmit:()=>{const e=null==t?void 0:t.DisconnectionResponse;ge(e,null==t?void 0:t.property,null==e?void 0:e.tenantId,n).then(e=>Digit.Utils.pdf.generatev1(e))}}),l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(a.LinkButton,{label:n("CORE_COMMON_GO_TO_HOME"),onClick:()=>Digit.SessionStorage.del("WS_DISCONNECTION")})))},WSDisconnectionAppDetails:e=>{let{config:n,onSelect:i,formData:a,setError:r,formState:u,clearErrors:d}=e;const{t:s}=o.useTranslation(),[c,p]=t.useState((null==a?void 0:a.disConnectionDetails)||[[{consumerNumber:"",disConnectionType:"",disConnectionProposeDate:"",disConnectionReason:""}]]),[m,E]=t.useState({index:-1,type:""}),[S,_]=t.useState(!1),[f,g]=t.useState([]),C=Digit.ULBService.getStateId(),N=Digit.ULBService.getCurrentTenantId(),{data:y}=Digit.Hooks.ws.useMDMS(C,"ws-services-masters",["disconnectionType"]);Digit.Hooks.ws.useDisconnectionWorkflow({tenantId:N}),t.useEffect(()=>{var e;const n=(null==y||null===(e=y["ws-services-masters"])||void 0===e?void 0:e.disconnectionType)||[];null==n||n.forEach(e=>{var n,t,l,o;e.code=null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase(),e.i18nKey="WS_DISCONNECTIONTYPE_"+(null==e||null===(t=e.code)||void 0===t?void 0:t.toUpperCase()),e.value=null==e||null===(l=e.code)||void 0===l?void 0:l.toUpperCase(),e.name=null==e||null===(o=e.code)||void 0===o?void 0:o.toUpperCase()}),g(n)},[y]),t.useEffect(()=>{const e=c.map(e=>e);i(null==n?void 0:n.key,e)},[c]);const D={focusIndex:m,setFocusIndex:E,t:s,config:n,setError:r,clearErrors:d,formState:u,disConnectionDetails:c,setIsErrors:_,setDisConnectionDetails:p,disconnectionTypeList:f};return l.createElement(l.Fragment,null,c.map((e,n)=>l.createElement(Pl,v({key:e.key,index:n,disConnectionDetail:e},D))))},WSInbox:e=>{let{parentRoute:n}=e;const{t:u}=o.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),s=window.location.pathname.includes("water/inbox"),c={mobileNumber:"",applicationNumber:"",consumerNo:""},p={businessService:s?["NewWS1","ModifyWSConnection","DisconnectWSConnection"]:["NewSW1","ModifySWConnection","DisconnectSWConnection"],moduleName:s?"ws-services":"sw-services",locality:[],assignee:"ASSIGNED_TO_ALL",applicationStatus:[],applicationType:[]},m={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"};sessionStorage.removeItem("Digit.BILL.INBOX"),sessionStorage.removeItem("Digit.SW.INBOX");const E=Digit.SessionStorage.get("BILL.INBOX"),S=t.useMemo(()=>E||{filterForm:p,searchForm:c,tableForm:m},[Object.values((null==E?void 0:E.filterForm)||{}),Object.values((null==E?void 0:E.searchForm)||{}),Object.values((null==E?void 0:E.tableForm)||{})]),[_,f]=t.useReducer(function(e,n){if(s)switch(n.action){case"mutateSearchForm":return Digit.SessionStorage.set("BILL.INBOX",v({},e,{searchForm:n.data})),v({},e,{searchForm:n.data});case"mutateFilterForm":return Digit.SessionStorage.set("BILL.INBOX",v({},e,{filterForm:n.data})),v({},e,{filterForm:n.data});case"mutateTableForm":return Digit.SessionStorage.set("BILL.INBOX",v({},e,{tableForm:n.data})),v({},e,{tableForm:n.data})}else switch(n.action){case"mutateSearchForm":return Digit.SessionStorage.set("BILL.SW.INBOX",v({},e,{searchForm:n.data})),v({},e,{searchForm:n.data});case"mutateFilterForm":return Digit.SessionStorage.set("BILL.SW.INBOX",v({},e,{filterForm:n.data})),v({},e,{filterForm:n.data});case"mutateTableForm":return Digit.SessionStorage.set("BILL.SW.INBOX",v({},e,{tableForm:n.data})),v({},e,{tableForm:n.data})}},S),{data:g,isLoading:C}=Digit.Hooks.useBoundaryLocalities(d,"revenue",{},u),{isLoading:N,data:{table:y,statuses:D,totalCount:T}={}}=Digit.Hooks.ws.useInbox({tenantId:d,filters:v({},_)});let h=[{text:u("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"),link:"/digit-ui/employee/ws/create-application",roles:["WS_CEMP","SW_CEMP"]}];h=h.filter(e=>!e.roles||b(e.roles));const A={logoIcon:l.createElement(a.DropIcon,null),headerText:s?"MODULE_WATER":"MODULE_SW",links:[...h,{text:u("WS_SEWERAGE_CONNECTION_SEARCH_LABEL"),link:s?"/digit-ui/employee/ws/water/search-connection?from=WS_SEWERAGE_INBOX":"/digit-ui/employee/ws/sewerage/search-connection?from=WS_SEWERAGE_INBOX",roles:s?["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]},{text:u("WS_SEWERAGE_APPLICATION_SEARCH"),link:s?"/digit-ui/employee/ws/water/search-application?from=WS_SEWERAGE_INBOX":"/digit-ui/employee/ws/sewerage/search-application?from=WS_SEWERAGE_INBOX",roles:s?["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]}]},I=t.useCallback(e=>{let{registerRef:n,searchFormState:t}=e;return l.createElement(Ml,{registerRef:n,searchFormState:t,className:"search"})},[]),O=t.useCallback(e=>{let{registerRef:n,controlFilterForm:t,setFilterFormValue:o,getFilterFormValue:i}=e;return l.createElement(xl,{statuses:D,isInboxLoading:N,registerRef:n,controlFilterForm:t,setFilterFormValue:o,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:i,localitiesForEmployeesCurrentTenant:g,loadingLocalitiesForEmployeesCurrentTenant:C,checkPathName:s})},[D,N,g,C]),L={SearchFormFields:I,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:c,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),f({action:"mutateSearchForm",data:c})},className:"search-form-wns-inbox"},R={FilterFormFields:O,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:p,onFilterFormReset:e=>{e("moduleName",s?"ws-services":"sw-services"),e("applicationStatus",[]),e("applicationType",[]),e("locality",[]),e("assignee","ASSIGNED_TO_ALL"),f({action:"mutateFilterForm",data:p})}},w=(e=>{var n,a,r,u;let{onPageSizeChange:d,formState:s,totalCount:c,table:p,dispatch:m,onSortingByData:E,tenantId:S,inboxStyles:_={},tableStyle:f={}}=e;const{t:g}=o.useTranslation(),C=e=>l.createElement("span",{className:"cell-text styled-cell"},e),N=t.useMemo(()=>[{Header:g("WS_ACK_COMMON_APP_NO_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var n,t,o,a,r,u;let{row:d}=e,s="WATER";d.original.applicationNo.includes("SW")&&(s="SEWERAGE");let c="application";return null!=d&&null!==(n=d.original)&&void 0!==n&&null!==(t=n.applicationType)&&void 0!==t&&null!==(o=t.toUpperCase())&&void 0!==o&&o.includes("DISCONNECT")?c="disconnection":null!=d&&null!==(a=d.original)&&void 0!==a&&null!==(r=a.applicationType)&&void 0!==r&&null!==(u=r.toUpperCase())&&void 0!==u&&u.includes("MODIFY")&&(c="modify"),l.createElement("div",null,l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+c+"-details?applicationNumber="+d.original.applicationNo+"&tenantId="+S+"&service="+s+"&from=WS_SEWERAGE_INBOX"}," ",l.createElement("span",{className:"link"},d.original.applicationNo)))}},{Header:g("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),accessor:"connectionNo",disableSortBy:!0},{Header:g("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),accessor:"owner",disableSortBy:!0},{Header:g("WS_COMMON_TABLE_COL_APP_TYPE_LABEL"),accessor:e=>{var n;return C(g("CS_COMMON_INBOX_"+(null==e||null===(n=e.applicationType)||void 0===n?void 0:n.toUpperCase())))},disableSortBy:!0},{Header:g("WS_COMMON_TABLE_COL_APPLICATION_STATUS"),accessor:e=>C(g("CS_"+(null==e?void 0:e.status))),disableSortBy:!0},{Header:g("ES_INBOX_SLA_DAYS_REMAINING"),accessor:e=>{return l.createElement("span","Active"===(n=null==e?void 0:e.sla)||n>0?{className:"sla-cell-success"}:{className:"sla-cell-error"},n);var n}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:d,currentPage:(null===(n=s.tableForm)||void 0===n?void 0:n.offset)/(null===(a=s.tableForm)||void 0===a?void 0:a.limit),onNextPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},onPrevPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},pageSizeLimit:null===(r=s.tableForm)||void 0===r?void 0:r.limit,onSort:E,totalRecords:c,onSearch:null==s||null===(u=s.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:10*Math.ceil(c/10)-parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>m({action:"mutateTableForm",data:v({},s.tableForm,{offset:0})}),data:p,columns:N,inboxStyles:v({},_),tableStyle:v({},f)}})(v({},{parentRoute:n,onPageSizeChange:e=>{f({action:"mutateTableForm",data:v({},_.tableForm,{limit:e.target.value})})},formState:_,totalCount:T,table:y,dispatch:f,onSortingByData:e=>{if(e.length>0){const[{id:n,desc:t}]=e,l=t?"DESC":"ASC";_.tableForm.sortBy===n&&_.tableForm.sortOrder===l||f({action:"mutateTableForm",data:v({},_.tableForm,{sortBy:n,sortOrder:t?"DESC":"ASC"})})}},tenantId:d,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}})),W=(e=>{let{table:n}=e;const{t:t}=o.useTranslation(),u=(e,n,t)=>{var o,a;let r=null!=e&&e.includes("WS")?"WATER":"SEWERAGE",u="application";return null!=t&&null!==(o=t.toUpperCase())&&void 0!==o&&o.includes("DISCONNECT")?u="disconnection":null!=t&&null!==(a=t.toUpperCase())&&void 0!==a&&a.includes("MODIFY")&&(u="modify"),l.createElement("div",null,l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+u+"-details?applicationNumber="+e+"&tenantId="+n+"&service="+r}," ",l.createElement("span",{className:"link"},e)))};return{data:null==n?void 0:n.map(e=>{let{applicationNo:n,status:o,owner:i,sla:a,businessService:r,connectionNo:d,applicationType:s,tenantId:c}=e;return{[t("WS_ACK_COMMON_APP_NO_LABEL")]:u(n,c,s),[t("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL")]:d,[t("WS_COMMON_TABLE_COL_OWN_NAME_LABEL")]:i,[t("WS_COMMON_TABLE_COL_APP_TYPE_LABEL")]:t("WS_"+(null==s?void 0:s.toUpperCase())),[t("WS_COMMON_TABLE_COL_SERVICE_LABEL")]:r?t("WS_COMMON_INBOX_"+(null==r?void 0:r.toUpperCase())):"NA",[t("WS_COMMON_TABLE_COL_APPLICATION_STATUS")]:t("CS_"+o),[t("ES_INBOX_SLA_DAYS_REMAINING")]:(v=a,l.createElement("span","Active"===v||v>0?{className:"sla-cell-success"}:{className:"sla-cell-error"},v))};var v}),serviceRequestIdKey:t("NOC_APP_NO_LABEL"),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(a.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:t,value:o}=n;return l.createElement(a.RadioButtons,{onSelect:e=>{t(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:n,table:y}),P={onMobileSortOrderData:e=>{const{sortOrder:n}=e;f({action:"mutateTableForm",data:v({},_.tableForm,{sortOrder:n})})},sortFormDefaultValues:null==_?void 0:_.tableForm,onSortFormReset:e=>{e("sortOrder","DESC"),f({action:"mutateTableForm",data:m})}};return l.createElement(t.Fragment,null,l.createElement(a.Header,null,u("ES_COMMON_INBOX"),T?l.createElement("p",{className:"inbox-count"},T):null),l.createElement(a.InboxComposer,v({isInboxLoading:N,PropsForInboxLinks:A},L,R,P,{propsForInboxTable:w,propsForInboxMobileCards:W,formState:_})))},BillAmendmentCard:()=>{if(!Digit.Utils.wsAccess())return null;const{t:e}=o.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),[i,r]=t.useState(0);sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const u={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},d={},s={applicationStatus:[],businessService:["WS.AMENDMENT"],moduleName:"bsWs-service",locality:[],assignee:"ASSIGNED_TO_ALL"},c={filterForm:s,searchForm:d,tableForm:u},p={filterForm:v({},s,{businessService:["SW.AMENDMENT"],moduleName:"bsSw-service"}),searchForm:d,tableForm:u},{isLoading:m,data:E}=Digit.Hooks.useBillAmendmentInbox({tenantId:n,filters:v({},c)}),{isLoading:S,data:_}=Digit.Hooks.useBillAmendmentInbox({tenantId:n,filters:v({},p)});t.useEffect(()=>{m&&S||r(null!=E&&E.totalCount&&null!=_&&_.totalCount?(null==E?void 0:E.totalCount)+(null==_?void 0:_.totalCount):null!=E&&E.totalCount?null==E?void 0:E.totalCount:null!=_&&_.totalCount?null==_?void 0:_.totalCount:0)},[E,_]);const f=t.useMemo(()=>({Icon:l.createElement(a.WSICon,null),moduleName:e("WS_BILL_AMENDMENT_BUTTON"),kpis:[{count:m?"-":i,label:e("TOTAL_WS"),link:"/digit-ui/employee/ws/water/bill-amendment/inbox"},{count:m?"-":null==E?void 0:E.slaCount,label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/ws/water/bill-amendment/inbox"}],links:[{count:m?"-":null==E?void 0:E.totalCount,label:e("WS_WATER_INBOX"),link:"/digit-ui/employee/ws/water/bill-amendment/inbox",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]},{count:m?"-":null==_?void 0:_.totalCount,label:e("SW_WATER_INBOX"),link:"/digit-ui/employee/ws/sewerage/bill-amendment/inbox",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]}]}),[m,E,i]);return l.createElement(a.EmployeeModuleCard,f)},WSSearchApplication:e=>{let{tenantId:n,onSubmit:u,data:d,count:s,resultOk:c,businessService:v,isLoading:p}=e;const[m,E,S]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[_,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),{t:C}=o.useTranslation(),{register:N,control:y,handleSubmit:D,setValue:T,getValues:h,reset:A}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",isConnectionSearch:!0}});t.useEffect(()=>{N("offset",0),N("limit",10),N("sortBy","commencementDate"),N("sortOrder","DESC"),N("sortOrder","DESC"),N("isConnectionSearch",!0)},[N]),t.useEffect(()=>{S(),E({}),f({}),g()},[]);const I=t.useCallback(e=>{0!==e.length&&(T("sortBy",e.id),T("sortOrder",e.desc?"DESC":"ASC"))},[]);function O(){T("offset",h("offset")-h("limit")),D(u)()}if(window.Digit.Utils.browser.isMobile())return l.createElement(kl,{Controller:r.Controller,register:N,control:y,t:C,reset:A,previousPage:O,handleSubmit:D,tenantId:n,data:d,onSubmit:u,businessService:v});const b=e=>l.createElement("span",{className:"cell-text"},e),L=t.useMemo(()=>[{Header:C("WS_MYCONNECTIONS_CONSUMER_NO"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a,r,u,d,s,c,v;let{row:p}=e,m="WATER";return"NEW_WATER_CONNECTION"==(null==p||null===(t=p.original)||void 0===t?void 0:t.applicationType)||"MODIFY_WATER_CONNECTION"==(null==p||null===(o=p.original)||void 0===o?void 0:o.applicationType)||"DISCONNECT_WATER_CONNECTION"==(null==p||null===(a=p.original)||void 0===a?void 0:a.applicationType)||"WATER_RECONNECTION"==(null==p||null===(r=p.original)||void 0===r?void 0:r.applicationType)?m="WATER":"NEW_SEWERAGE_CONNECTION"!=(null==p||null===(u=p.original)||void 0===u?void 0:u.applicationType)&&"MODIFY_SEWERAGE_CONNECTION"!=(null==p||null===(d=p.original)||void 0===d?void 0:d.applicationType)&&"DISCONNECT_SEWERAGE_CONNECTION"!=(null==p||null===(s=p.original)||void 0===s?void 0:s.applicationType)&&"SEWERAGE_RECONNECTION"!=(null==p||null===(c=p.original)||void 0===c?void 0:c.applicationType)||(m="SEWERAGE"),l.createElement("div",null,p.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+p.original.connectionNo+"&tenantId="+n+"&service="+m+"&due="+((null===(v=p.original)||void 0===v?void 0:v.due)||0)+"&from=WS_SEWERAGE_APPLICATION_SEARCH"},p.original.connectionNo||"NA")):l.createElement("span",null,C("NA")))}},{Header:C("WS_ACK_COMMON_APP_NO_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,o,a,r,u,d,s,c;let{row:v}=e,p="WATER";if("NEW_WATER_CONNECTION"==(null==v||null===(t=v.original)||void 0===t?void 0:t.applicationType)||"MODIFY_WATER_CONNECTION"==(null==v||null===(o=v.original)||void 0===o?void 0:o.applicationType)||"DISCONNECT_WATER_CONNECTION"==(null==v||null===(a=v.original)||void 0===a?void 0:a.applicationType)||"WATER_RECONNECTION"==(null==v||null===(r=v.original)||void 0===r?void 0:r.applicationType)?p="WATER":"NEW_SEWERAGE_CONNECTION"!=(null==v||null===(u=v.original)||void 0===u?void 0:u.applicationType)&&"MODIFY_SEWERAGE_CONNECTION"!=(null==v||null===(d=v.original)||void 0===d?void 0:d.applicationType)&&"DISCONNECT_SEWERAGE_CONNECTION"!=(null==v||null===(s=v.original)||void 0===s?void 0:s.applicationType)&&"SEWERAGE_RECONNECTION"!=(null==v||null===(c=v.original)||void 0===c?void 0:c.applicationType)||(p="SEWERAGE"),"MODIFY_SEWERAGE_CONNECTION"===v.original.applicationType||"MODIFY_WATER_CONNECTION"===v.original.applicationType){var m,E,S,_,f,g;let e="application";return null!=v&&null!==(m=v.original)&&void 0!==m&&null!==(E=m.applicationType)&&void 0!==E&&null!==(S=E.toUpperCase())&&void 0!==S&&S.includes("DISCONNECT")?e="disconnection":null!=v&&null!==(_=v.original)&&void 0!==_&&null!==(f=_.applicationType)&&void 0!==f&&null!==(g=f.toUpperCase())&&void 0!==g&&g.includes("MODIFY")&&(e="modify"),l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+e+"-details?applicationNumber="+v.original.applicationNo+"&tenantId="+n+"&service="+p+"&mode=MODIFY&from=WS_SEWERAGE_APPLICATION_SEARCH"},v.original.applicationNo)))}{var C,N,y,D;let e="application";return null!=v&&null!==(C=v.original)&&void 0!==C&&null!==(N=C.applicationType)&&void 0!==N&&N.includes("DISCONNECT")?e="disconnection":null!=v&&null!==(y=v.original)&&void 0!==y&&null!==(D=y.applicationType)&&void 0!==D&&D.includes("MODIFY")&&(e="modify"),l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+e+"-details?applicationNumber="+v.original.applicationNo+"&tenantId="+n+"&service="+p+"&from=WS_SEWERAGE_APPLICATION_SEARCH"},v.original.applicationNo)))}}},{Header:C("WS_APPLICATION_TYPE_LABEL"),disableSortBy:!0,accessor:e=>b(C("WS_"+e.applicationType))},{Header:C("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),disableSortBy:!0,accessor:e=>{var n,t,l,o;return b(null!=e&&null!==(n=e.connectionHolders)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&t.name?null==e||null===(l=e.connectionHolders)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.name:(null==e?void 0:e.ownerNames)||"-")}},{Header:C("WS_COMMON_TABLE_COL_APPLICATION_STATUS_LABEL"),accessor:e=>b(C((null==e?void 0:e.applicationStatus)||"NA")),disableSortBy:!0},{Header:C("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,accessor:e=>b((null==e?void 0:e.address)||"-")}],[]);return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},C("WS"===v?"WS_WATER_SEARCH_APPLICATION_SUB_HEADER":"WS_SEWERAGE_SEARCH_APPLICATION_SUB_HEADER")),l.createElement(a.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},C("WS_INFO_VALIDATION"))),l.createElement(a.SearchForm,{onSubmit:u,handleSubmit:D},l.createElement(Bl,{register:N,control:y,reset:A,tenantId:n,t:C,businessService:v})),p?l.createElement(a.Loader,null):null,null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},C(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement(a.Table,{t:C,data:d,totalRecords:s,columns:L,getCellProps:e=>({style:{minWidth:e.column.Header===C("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){T("limit",Number(e.target.value)),D(u)()},currentPage:h("offset")/h("limit"),onNextPage:function(){T("offset",h("offset")+h("limit")),D(u)()},onPrevPage:O,pageSizeLimit:h("limit"),onSort:I,disableSort:!1,sortParams:[{id:h("sortBy"),desc:"DESC"===h("sortOrder")}]}):null)},WSSearchWaterConnection:e=>{let{tenantId:n,onSubmit:u,data:d,count:s,resultOk:c,isLoading:v}=e;const p=i.useHistory(),[m,E]=t.useState([]),[S,_]=t.useState(null);t.useEffect(function(){try{return Promise.resolve(Digit.WSService.WSSewsearchDemand({BulkBillCriteria:{tenantId:"pg.citya"}},window.location.href.includes("ws/sewerage/search-demand")?"sw":"ws")).then(function(e){E(e.connection)})}catch(e){return Promise.reject(e)}},[]);const{t:f}=o.useTranslation(),{register:g,control:C,handleSubmit:N,setValue:y,getValues:D,reset:T}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",searchType:"CONNECTION"}});t.useEffect(()=>{g("offset",0),g("limit",10),g("sortBy","commencementDate"),g("searchType","CONNECTION"),g("sortOrder","DESC"),g("propertyId","")},[g]);const h=t.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function A(e){y("limit",Number(e.target.value)),N(u)()}function I(){y("offset",D("offset")+D("limit")),N(u)()}function O(){y("offset",D("offset")-D("limit")),N(u)()}if(window.Digit.Utils.browser.isMobile())return l.createElement(zl,{Controller:r.Controller,register:g,control:C,t:f,reset:T,previousPage:O,handleSubmit:N,tenantId:n,data:d,onSubmit:u});const b=e=>l.createElement("span",{className:"cell-text"},e),L=t.useMemo(()=>[{Header:f("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a;let{row:r}=e;return l.createElement("div",null,r.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+r.original.connectionNo+"&tenantId="+n+"&service="+(null===(t=r.original)||void 0===t?void 0:t.service)+"&connectionType="+(null===(o=r.original)||void 0===o?void 0:o.connectionType)+"&due="+((null===(a=r.original)||void 0===a?void 0:a.due)||0)+"&from=WS_SEWERAGE_CONNECTION_SEARCH_LABEL"},r.original.connectionNo||"NA")):l.createElement("span",null,f("NA")))}},{Header:f("WS_COMMON_TABLE_COL_SERVICE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return b(f("WS_"+(null===(n=t.original)||void 0===n?void 0:n.service)))}},{Header:f("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o,i;let{row:a}=e;return b(null!=a&&null!==(n=a.original)&&void 0!==n&&null!==(t=n.connectionHolders)&&void 0!==t&&t.map(e=>null==e?void 0:e.name).join(",")?null==a||null===(l=a.original)||void 0===l||null===(o=l.connectionHolders)||void 0===o?void 0:o.map(e=>null==e?void 0:e.name).join(","):""+((null===(i=a.original)||void 0===i?void 0:i.ownerNames)||"NA"))}},{Header:f("WS_COMMON_TABLE_COL_STATUS_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return b(f("WS_"+(null===(n=l.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())))}},{Header:f("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;var l,o;return(null==t||null===(n=t.original)||void 0===n?void 0:n.due)<=0?b(""+(null===(l=t.original)||void 0===l?void 0:l.due)):b(""+((null===(o=t.original)||void 0===o?void 0:o.due)||"NA"))}},{Header:f("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return b(""+((null===(n=t.original)||void 0===n?void 0:n.address)||"NA"))}},{Header:f("WS_COMMON_TABLE_COL_DUE_DATE_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o;let{row:i}=e;const a=(null===(n=i.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())||"",r="NA"===(null===(l=i.original)||void 0===l?void 0:l.dueDate)?f("WS_NA"):(e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()})(null===(o=i.original)||void 0===o?void 0:o.dueDate);return b(f("INACTIVE"===a?"WS_NA":""+r))}},{Header:f("WS_COMMON_TABLE_COL_ACTION_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;const l=null===(n=t.original)||void 0===n?void 0:n.due;var o;return b(l||0==l?P(null===(o=t.original)||void 0===o?void 0:o.status,t):f("WS_NA"))}}],[]),R=t.useMemo(()=>[{Header:f("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a;let{row:r}=e;return l.createElement("div",null,r.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+r.original.connectionNo+"&tenantId="+n+"&service="+(null===(t=r.original)||void 0===t?void 0:t.service)+"&connectionType="+(null===(o=r.original)||void 0===o?void 0:o.connectionType)+"&due="+((null===(a=r.original)||void 0===a?void 0:a.due)||0)+"&from=WS_SEWERAGE_CONNECTION_SEARCH_LABEL"},r.original.connectionNo||"NA")):l.createElement("span",null,f("NA")))}},{Header:f("WS_COMMON_TABLE_COL_applicationNo_LABEL"),disableSortBy:!0,Cell:e=>{let{row:n}=e;return l.createElement("div",null,n.original.applicationNo)}},{Header:f("WS_COMMON_TABLE_COL_propertyId_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return b(f("WS_"+(null===(n=l.original)||void 0===n||null===(t=n.propertyId)||void 0===t?void 0:t.toUpperCase())))}},{Header:f("WS_COMMON_TABLE_COL_ACTION_LABEL"),disableSortBy:!0,Cell:e=>{let{row:n}=e;return b(w(n))}}],[]),w=e=>l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement("button",{onClick:()=>{W(e)}},f("WS_COMMON_COLLECT_DEMAND")," "))),W=function(e){try{return Promise.resolve(Digit.WSService.WSSewsearchDemandGen({BulkBillCriteria:{tenantId:"pg.citya",consumerCode:e.original.connectionNo}},window.location.href.includes("ws/sewerage/search-demand")?"sw":"ws")).then(function(n){var t,l,o;_({label:""+n}),p.push("/digit-ui/employee/payment/collect/SW/"+encodeURIComponent(null===(t=e.original)||void 0===t?void 0:t.connectionNo)+"/"+(null===(l=e.original)||void 0===l?void 0:l.tenantId)+"?tenantId="+(null===(o=e.original)||void 0===o?void 0:o.tenantId)+"?workflow=WS&ISWSCON")})}catch(e){return Promise.reject(e)}},P=(e,n)=>{var t,o,a,r,u,d,s,c,v;if(!(Digit.UserService.getUser().info.roles.map(e=>e.code).filter(e=>"WS_CEMP"===e||"SW_CEMP"===e).length>0))return null;switch(e){case"Active":return l.createElement("div",null,l.createElement("span",{className:"link"},"WATER"===(null===(t=n.original)||void 0===t?void 0:t.service)?l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/payment/collect/"+("WATER"===(null===(o=n.original)||void 0===o?void 0:o.service)?"WS":"SW")+"/"+encodeURIComponent(null===(a=n.original)||void 0===a?void 0:a.connectionNo)+"/"+(null===(r=n.original)||void 0===r?void 0:r.tenantId)+"?tenantId="+(null===(u=n.original)||void 0===u?void 0:u.tenantId)+"?workflow=WS&ISWSCON"}},f("WS_COMMON_COLLECT_LABEL")," "):l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/payment/collect/"+("WATER"===(null===(d=n.original)||void 0===d?void 0:d.service)?"WS":"SW")+"/"+encodeURIComponent(null===(s=n.original)||void 0===s?void 0:s.connectionNo)+"/"+(null===(c=n.original)||void 0===c?void 0:c.tenantId)+"?tenantId="+(null===(v=n.original)||void 0===v?void 0:v.tenantId)+"?workflow=SW&ISWSCON"}},f("WS_COMMON_COLLECT_LABEL")," ")))}};return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},window.location.href.includes("water")?f("WS_WATER_SEARCH_CONNECTION_SUB_HEADER"):f("WS_SEWERAGE_SEARCH_CONNECTION_SUB_HEADER")),window.location.href.includes("search-demand")?"":l.createElement(a.SearchForm,{className:"ws-custom-wrapper",onSubmit:u,handleSubmit:N},l.createElement(Hl,{register:g,control:C,reset:T,tenantId:n,t:f})),v?l.createElement(a.Loader,null):null,null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},f(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement(a.Table,{t:f,data:d,totalRecords:s,columns:L,getCellProps:e=>({style:{minWidth:e.column.Header===f("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:A,currentPage:D("offset")/D("limit"),onNextPage:I,onPrevPage:O,pageSizeLimit:D("limit"),onSort:h,disableSort:!1,sortParams:[{id:D("sortBy"),desc:"DESC"===D("sortOrder")}]}):null,window.location.href.includes("search-demand")?(null==m?void 0:m.length)>0?l.createElement(a.Table,{t:f,data:m,totalRecords:s,columns:R,getCellProps:e=>({style:{minWidth:e.column.Header===f("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:A,currentPage:D("offset")/D("limit"),onNextPage:I,onPrevPage:O,pageSizeLimit:D("limit"),onSort:h,disableSort:!1,sortParams:[{id:D("sortBy"),desc:"DESC"===D("sortOrder")}]}):l.createElement(a.Card,{style:{marginTop:20}},l.createElement("p",{style:{textAlign:"center"}},"No Data Found")):"",(null==S?void 0:S.label)&&l.createElement(a.Toast,{label:null==S?void 0:S.label,onClose:e=>{_(e=>null)}}))},WSBulkBillSearch:e=>{let{tenantId:n,onSubmit:i,data:d,count:s,resultOk:c,businessService:v,isLoading:p}=e;const[m,E]=t.useState(null),[S,_]=t.useState(null),[f,g]=t.useState(null),[C,N]=t.useState(()=>null),[y,D]=t.useState(""),[T,h]=t.useState([]),[A,I]=t.useState([]),[O,b]=t.useState([]),[L,R]=t.useState(!1),{mutate:w}=Digit.Hooks.ws.useBulkMeterReadingCreateAPI(v),W=e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()},P=()=>{_(!1)},M=e=>l.createElement("h1",{className:"heading-m"},e.label),x=()=>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"})),B=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(x,null)),{t:F}=o.useTranslation(),{register:U,control:k,handleSubmit:H,setValue:j,getValues:V,reset:z}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"consumerNo",sortOrder:"DESC",searchType:"CONNECTION",locality:"",tenantId:""}}),Y=e=>l.createElement("div",{onClick:e.onClick},l.createElement(a.DownloadBtnCommon,null));t.useEffect(()=>{U("offset",0),U("limit",10),U("sortBy","commencementDate"),U("searchType","CONNECTION"),U("sortOrder","DESC"),U("locality",""),U("tenantId","")},[U]);const G=t.useCallback(e=>{0!==e.length&&(j("sortBy",e.id),j("sortOrder",e.desc?"DESC":"ASC"))},[]);function q(e){j("limit",Number(e.target.value)),H(i)()}function K(){j("offset",V("offset")+V("limit")),H(i)()}function X(){j("offset",V("offset")-V("limit")),H(i)()}const Z=()=>{E(null)};if(window.Digit.Utils.browser.isMobile())return l.createElement(zl,{Controller:r.Controller,register:U,control:k,t:F,reset:z,previousPage:X,handleSubmit:H,tenantId:n,data:d,onSubmit:i,setValue:j});const $=e=>l.createElement("span",{className:"cell-text"},e),J=(e,n)=>{if(e.preventDefault(),void 0!==(null==n?void 0:n[0]))return Digit.Download.Excel(n,"Bulk-Bill")},Q=t.useMemo(()=>[{Header:F("BILLING_CYCLE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.billingPeriod)}},{Header:F("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,n.original.connectionNo?n.original.connectionNo||"NA":F("NA")))}},{Header:F("LAST_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.lastReading)}},{Header:F("METER_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.lastReadingDate))}},{Header:F("METER_STATUS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.meterStatus)}},{Header:F("CURRECT_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.currentReading)}},{Header:F("CURRECT_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.currentReadingDate))}}]),ee=t.useMemo(()=>[{Header:F("BILLING_CYCLE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.billingPeriod)}},{Header:F("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,n.original.connectionNo?n.original.connectionNo||"NA":F("NA")))}},{Header:F("LAST_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.lastReading)}},{Header:F("METER_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.lastReadingDate))}},{Header:F("METER_STATUS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.meterStatus)}},{Header:F("CURRECT_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.currentReading)}},{Header:F("CURRECT_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.currentReadingDate))}},{Header:F("CURRECT_STATUS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.status)}}]);return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},F("WS_WATER_SEARCH_BULK_CONNECTION_SUB_HEADER")),l.createElement(a.SearchForm,{className:"ws-custom-wrapper",onSubmit:i,handleSubmit:H},l.createElement(Yl,{register:U,control:k,reset:z,tenantId:n,t:F,setValue:j})),p?l.createElement(a.Loader,null):null,L&&l.createElement(a.Loader,null),null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},F(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement("div",{style:{backgroundColor:"white"}},l.createElement("div",{className:"sideContent",style:{float:"right",padding:"10px 30px"}},l.createElement("span",{className:"table-search-wrapper",style:{cursor:"pointer"}},l.createElement(Y,{className:"mrlg cursorPointer",onClick:e=>J(e,d)}))),l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"70%"}},l.createElement(a.UploadFile,{id:"Bulk-Bill",extraStyleName:"propertyCreate",message:C?"1 "+F("CS_WS_ACTION_FILEUPLOADED"):F("CS_WS_ACTION_NO_FILEUPLOADED"),accept:".xlsx",onUpload:e=>function(e){e.preventDefault(),D(e.target.files[0]),function(e){try{new Promise((n,t)=>{const l=new FileReader;l.readAsArrayBuffer(e),l.onload=e=>{const t=u.read(e.target.result,{type:"buffer"}),l=u.utils.sheet_to_json(t.Sheets[t.SheetNames[0]]).map(e=>({billingPeriod:e.billingPeriod,currentReading:e.currentReading,currentReadingDate:e.currentReadingDate,lastReading:e.lastReading,lastReadingDate:e.lastReadingDate,connectionNo:e.connectionNo,meterStatus:e.meterStatus,tenantId:"pg.citya"})),o=l.filter(e=>e.currentReading>=e.lastReading&&(e=>{var n;const t=new Date(0).getTimezoneOffset(),l=new Date(0,0,e-1,0,-t,0);return Digit.Utils.pt.convertDateToEpoch(null==l||null===(n=l.toJSON())||void 0===n?void 0:n.split("T")[0])})(null==e?void 0:e.currentReadingDate)>e.lastReadingDate),i=l.filter(e=>!o.includes(e));console.log("reading list",o,i),I(i),n(o,i)},l.onerror=e=>{t(e)}}).then(function(e,n){try{return h(e),Promise.resolve()}catch(e){return Promise.reject(e)}}),Promise.resolve()}catch(e){return Promise.reject(e)}}(e.target.files[0]),N("bulk")}(e),onDelete:e=>{N(null),h([])}})),(null==T?void 0:T.length)>0?l.createElement("div",{style:{top:"5px",left:"10px",position:"relative"}},l.createElement("span",null,l.createElement(a.SubmitBar,{label:F("WS_COMMON_SUBMIT_READING"),onSubmit:()=>{(null==A?void 0:A.length)>0&&_(!0)}}))):""),l.createElement(a.Table,{t:F,data:d,totalRecords:s,columns:Q,getCellProps:e=>({style:{minWidth:e.column.Header===F("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onSort:G,disableSort:!1,sortParams:[{id:V("sortBy"),desc:"DESC"===V("sortOrder")}]})):null,l.createElement("div",null,S&&l.createElement(a.Modal,{headerBarMain:l.createElement(M,{label:F("WS_BULK_READING_REJECT")}),headerBarEnd:l.createElement(B,{onClick:P}),actionCancelLabel:"Cancel",actionCancelOnSubmit:P,actionSaveLabel:"Proceed",actionSaveOnSubmit:()=>{_(!1),function(){try{const e=function(){if(w)return R(!0),Promise.resolve(w({meterReadingList:T},{onError:(e,n)=>{R(!1),E({error:!0,label:null!=e&&e.message?e.message:e}),setTimeout(Z,5e3)},onSuccess:function(e,n){try{return R(!1),console.log("data",e),g(!0),b(e.meterReadings),E({key:"success",label:"WS_METER_READING_ADDED_SUCCESFULLY"}),setTimeout(Z,3e3),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},formId:"modal-action",popupStyles:{width:"auto"}}," ",l.createElement("div",{style:{width:"100%"}},l.createElement(a.Card,null,l.createElement("div",null,l.createElement(a.CardText,null,F("WS_REASON_FOR_REJECT"))),l.createElement("div",null,l.createElement(a.CardText,null,F("WS_SUCCESS_DATA_COUNT")," - ",null==T?void 0:T.length)),l.createElement("div",null,l.createElement(a.CardText,null,F("WS_REJECT_DATA_COUNT")," - ",null==A?void 0:A.length)),l.createElement(a.Table,{t:F,data:A,totalRecords:null==A?void 0:A.length,columns:Q,getCellProps:e=>({style:{minWidth:e.column.Header===F("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:q,currentPage:V("offset")/V("limit"),onNextPage:K,onPrevPage:X,pageSizeLimit:V("limit"),onSort:G,disableSort:!0,sortParams:[{id:V("sortBy"),desc:"DESC"===V("sortOrder")}]})))),f&&l.createElement(a.Modal,{headerBarMain:l.createElement(M,{label:F("WS_BULK_READING_STATUS")}),headerBarEnd:l.createElement(B,{onClick:()=>{g(!1)}}),formId:"modal-action",popupStyles:{width:"auto"}}," ",l.createElement("div",{style:{width:"100%"}},l.createElement(a.Card,null,l.createElement("div",null,l.createElement(a.CardText,null,F("Bulk Meter Reading Status"))),l.createElement("div",{className:"sideContent",style:{float:"right",padding:"10px 30px"}},l.createElement("span",{className:"table-search-wrapper",style:{cursor:"pointer"}},l.createElement(Y,{className:"mrlg cursorPointer",onClick:e=>J(e,O)}))),l.createElement(a.Table,{t:F,data:O,totalRecords:null==O?void 0:O.length,columns:ee,getCellProps:e=>({style:{minWidth:e.column.Header===F("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:q,currentPage:V("offset")/V("limit"),onNextPage:K,onPrevPage:X,pageSizeLimit:V("limit"),onSort:G,disableSort:!0,sortParams:[{id:V("sortBy"),desc:"DESC"===V("sortOrder")}]}))))),(null==m?void 0:m.label)&&l.createElement(a.Toast,{label:null==m?void 0:m.label,onClose:e=>{E(e=>null)}}))},WSCard:()=>{if(!Digit.Utils.wsAccess())return null;const{t:e}=o.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),[i,r]=t.useState(0);sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const{isLoading:u,data:d}=Digit.Hooks.ws.useInbox({tenantId:n,filters:v({},{filterForm:{businessService:["NewWS1","ModifyWSConnection","DisconnectWSConnection"],moduleName:"ws-services",locality:[],applicationStatus:[],applicationType:[]},searchForm:{},tableForm:{sortBy:"auditDetails.lastModifiedTime",sortOrder:"DESC"}})});t.useEffect(()=>{u||r(null!=d&&d.totalCount?null==d?void 0:d.totalCount:0)},[d]);let s=[{label:e("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"),link:"/digit-ui/employee/ws/create-application",roles:["WS_CEMP","SW_CEMP"]}];s=s.filter(e=>!e.roles||b(e.roles));const c={Icon:l.createElement(a.WSICon,null),moduleName:e("ACTION_TEST_WATER"),kpis:[{count:u?"-":i,label:e("TOTAL_WS"),link:"/digit-ui/employee/ws/water/inbox"},{count:u?"-":null==d?void 0:d.slaCount,label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/ws/water/inbox"}],links:[{count:u?"-":null==d?void 0:d.totalCount,label:e("WS_INBOX_HEADER"),link:"/digit-ui/employee/ws/water/inbox",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]},...s,{label:e("WS_WATER_CONNECTION_SEARCH_LABEL"),link:"/digit-ui/employee/ws/water/search-connection",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]},{label:e("WS_WATER_APPLICATION_SEARCH"),link:"/digit-ui/employee/ws/water/search-application",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]}]};return l.createElement(a.EmployeeModuleCard,c)},SWCard:()=>{if(!Digit.Utils.swAccess())return null;const{t:e}=o.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),[i,r]=t.useState(0);sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const{isLoading:u,data:d}=Digit.Hooks.ws.useInbox({tenantId:n,filters:v({},{filterForm:{businessService:["NewSW1","ModifySWConnection","DisconnectSWConnection"],moduleName:"sw-services",locality:[],applicationStatus:[],applicationType:[]},searchForm:{},tableForm:{sortBy:"auditDetails.lastModifiedTime",sortOrder:"DESC"}})});t.useEffect(()=>{u||r(null!=d&&d.totalCount?null==d?void 0:d.totalCount:0)},[d]);let s=[{label:e("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"),link:"/digit-ui/employee/ws/create-application",roles:["WS_CEMP","SW_CEMP"]}];s=s.filter(e=>!e.roles||b(e.roles));const c={Icon:l.createElement(a.WSICon,null),moduleName:e("ACTION_TEST_SEWERAGE"),kpis:[{count:u?"-":i,label:e("TOTAL_SW"),link:"/digit-ui/employee/ws/sewerage/inbox"},{count:u?"-":null==d?void 0:d.slaCount,label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/ws/sewerage/inbox"}],links:[{count:u?"-":null==d?void 0:d.totalCount,label:e("WS_SEWERAGE_INBOX"),link:"/digit-ui/employee/ws/sewerage/inbox",roles:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]},...s,{label:e("WS_SEWERAGE_CONNECTION_SEARCH_LABEL"),link:"/digit-ui/employee/ws/sewerage/search-connection",roles:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]},{label:e("WS_SEWERAGE_APPLICATION_SEARCH"),link:"/digit-ui/employee/ws/sewerage/search-application",roles:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]}]};return l.createElement(a.EmployeeModuleCard,c)},WSBillIAmendMentInbox:e=>{let{parentRoute:n}=e;const{t:u}=o.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),s=window.location.href.includes("/ws/water/bill-amendment/inbox"),c={mobileNumber:"",applicationNumber:"",consumerCode:""},p={applicationStatus:[],businessService:s?["WS.AMENDMENT"]:["SW.AMENDMENT"],moduleName:s?"bsWs-service":"bsSw-service",locality:[],assignee:"ASSIGNED_TO_ALL"},m={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"ASC"};sessionStorage.removeItem("Digit.BILL.AMENDMENT.INBOX");const E=Digit.SessionStorage.get("BILL.AMENDMENT.INBOX"),S=t.useMemo(()=>E||{filterForm:p,searchForm:c,tableForm:m},[Object.values((null==E?void 0:E.filterForm)||{}),Object.values((null==E?void 0:E.searchForm)||{}),Object.values((null==E?void 0:E.tableForm)||{})]),[_,f]=t.useReducer(function(e,n){switch(n.action){case"mutateSearchForm":return Digit.SessionStorage.set("BILL.AMENDMENT.INBOX",v({},e,{searchForm:n.data})),v({},e,{searchForm:n.data});case"mutateFilterForm":return Digit.SessionStorage.set("BILL.AMENDMENT.INBOX",v({},e,{filterForm:n.data})),v({},e,{filterForm:n.data});case"mutateTableForm":return Digit.SessionStorage.set("BILL.AMENDMENT.INBOX",v({},e,{tableForm:n.data})),v({},e,{tableForm:n.data})}},S),{data:g,isLoading:C}=Digit.Hooks.useBoundaryLocalities(d,"revenue",{},u),{isLoading:N,data:{table:y,statuses:D,totalCount:T}={}}=Digit.Hooks.useBillAmendmentInbox({tenantId:d,filters:v({},_),config:{cacheTime:0}}),{data:h}=Digit.Hooks.useApplicationStatusGeneral({businessServices:["WS.AMENDMENT","SW.AMENDMENT"],tenantId:d},{enabled:(null==D?void 0:D.length)>0});null==D||D.map(e=>{var n,t;null==h||null===(n=h.otherRoleStates)||void 0===n||n.map(n=>{(null==n?void 0:n.uuid)===(null==e?void 0:e.statusid)&&(e.applicationstatus=u(null==n?void 0:n.state))}),null==h||null===(t=h.userRoleStates)||void 0===t||t.map(n=>{(null==n?void 0:n.uuid)===(null==e?void 0:e.statusid)&&(e.applicationstatus=u(null==n?void 0:n.state))})});const A={logoIcon:l.createElement(a.CollectionIcon,null),headerText:"ACTION_TEST_BILLAMENDMENT",links:[]},I=t.useCallback(e=>{let{registerRef:n,searchFormState:t}=e;return l.createElement(Gl,{registerRef:n,searchFormState:t,className:"search"})},[]),O=t.useCallback(e=>{let{registerRef:n,controlFilterForm:t,setFilterFormValue:o,getFilterFormValue:i}=e;return l.createElement(ql,{statuses:D,isInboxLoading:N,registerRef:n,controlFilterForm:t,setFilterFormValue:o,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:i,localitiesForEmployeesCurrentTenant:g,loadingLocalitiesForEmployeesCurrentTenant:C})},[D,N,g,C,h]),b={SearchFormFields:I,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:c,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNo",null),e("consumerCode",null),f({action:"mutateSearchForm",data:c})},className:"search-form-wns-inbox"},L={FilterFormFields:O,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:p,onFilterFormReset:e=>{e("moduleName",s?"bsWs-service":"bsSw-service"),e("locality",[]),e("assignee","ASSIGNED_TO_ALL"),e("applicationStatus",[]),f({action:"mutateFilterForm",data:p})}},R=(e=>{var n,a,r,u;let{onPageSizeChange:d,formState:s,totalCount:c,table:p,dispatch:m,onSortingByData:E,inboxStyles:S={},tableStyle:_={}}=e;const{t:f}=o.useTranslation(),g=Digit.ULBService.getCurrentTenantId(),C=e=>l.createElement("span",{className:"cell-text styled-cell"},e),N=t.useMemo(()=>[{Header:f("WS_COMMON_TABLE_COL_SERVICE_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return C(f("ACTION_TEST_"+(null!=l&&null!==(n=l.original)&&void 0!==n&&null!==(t=n.service)&&void 0!==t&&t.includes("WS")?"WATER":"SEWERAGE")))}},{Header:f("WS_MYCONNECTIONS_APPLICATION_NO"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(i.Link,{to:"/digit-ui/employee/ws/generate-note-bill-amendment?applicationNumber="+t.original.applicationNo},l.createElement("span",{className:"link"},t.original.applicationNo)),C(f("BILLAMENDMENT_"+(null==t||null===(n=t.original)||void 0===n?void 0:n.amendmentReason)+"_HEADING")))}},,{Header:f("CORE_COMMON_NAME"),disableSortBy:!0,accessor:"owner"},{Header:f("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,accessor:e=>C(f(Digit.Utils.locale.getRevenueLocalityCode(e.address,g)))},{Header:f("WS_COMMON_TABLE_COL_APPLICATION_STATUS"),disableSortBy:!0,accessor:e=>{return"Approved"===(n=f(null==e?void 0:e.status))?l.createElement("span",{style:{color:"#00703C"}},n):"Rejected"===n?l.createElement("span",{style:{color:"#0B0C0C"}},n):"Inworkflow"===n?l.createElement("span",{style:{color:"#E50000"}},n):void 0;var n}},{Header:f("WS_COMMON_TABLE_COL_TASK_OWNER"),disableSortBy:!0,accessor:"taskOwner"}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:d,currentPage:(null===(n=s.tableForm)||void 0===n?void 0:n.offset)/(null===(a=s.tableForm)||void 0===a?void 0:a.limit),onNextPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},onPrevPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},pageSizeLimit:null===(r=s.tableForm)||void 0===r?void 0:r.limit,onSort:E,totalRecords:c,onSearch:null==s||null===(u=s.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:10*Math.ceil(c/10)-parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>m({action:"mutateTableForm",data:v({},s.tableForm,{offset:0})}),data:p,columns:N,inboxStyles:v({},S),tableStyle:v({},_)}})(v({},{parentRoute:n,onPageSizeChange:e=>{f({action:"mutateTableForm",data:v({},_.tableForm,{limit:e.target.value})})},formState:_,totalCount:T,table:y,dispatch:f,onSortingByData:e=>{if(e.length>0){const[{id:n,desc:t}]=e,l=t?"DESC":"ASC";_.tableForm.sortBy===n&&_.tableForm.sortOrder===l||f({action:"mutateTableForm",data:v({},_.tableForm,{sortBy:n,sortOrder:t?"DESC":"ASC"})})}},inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}})),w=(e=>{let{table:n}=e;const{t:t}=o.useTranslation(),u=(e,n)=>l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(i.Link,{to:"/digit-ui/employee/ws/generate-note-bill-amendment?applicationNumber="+e},l.createElement("span",{className:"link"},e)),(e=>l.createElement("span",{className:"cell-text styled-cell"},e))(t("BILLAMENDMENT_"+n+"_HEADING")));return{data:null==n?void 0:n.map(e=>{let{applicationNo:n,address:l,status:o,owner:i,service:a,tenantId:r,amendmentReason:d,taskOwner:s}=e;return{[t("WS_COMMON_TABLE_COL_SERVICE_LABEL")]:t("ACTION_TEST_"+a),[t("WS_MYCONNECTIONS_APPLICATION_NO")]:u(n,d),[t("CORE_COMMON_NAME")]:i,[t("WS_COMMON_TABLE_COL_ADDRESS")]:t(Digit.Utils.locale.getRevenueLocalityCode(l,r)),[t("WS_COMMON_TABLE_COL_APPLICATION_STATUS")]:t(o),[t("WS_COMMON_TABLE_COL_TASK_OWNER")]:s}}),serviceRequestIdKey:t("NOC_APP_NO_LABEL"),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(a.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:t,value:o}=n;return l.createElement(a.RadioButtons,{onSelect:e=>{t(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:n,table:y}),W={onMobileSortOrderData:e=>{const{sortOrder:n}=e;f({action:"mutateTableForm",data:v({},_.tableForm,{sortOrder:n})})},sortFormDefaultValues:null==_?void 0:_.tableForm,onSortFormReset:e=>{e("sortOrder","DESC"),f({action:"mutateTableForm",data:m})}};return l.createElement(t.Fragment,null,l.createElement(a.Header,null,u("ES_COMMON_INBOX"),T?l.createElement("p",{className:"inbox-count"},T):null),l.createElement(a.InboxComposer,v({isInboxLoading:N,PropsForInboxLinks:A},b,L,W,{propsForInboxTable:R,propsForInboxMobileCards:w,formState:_})))},WSCreate:()=>{var e,n,t,a,r,u;const s=d.useQueryClient(),{t:c}=o.useTranslation(),{pathname:p,state:m}=(i.useRouteMatch(),i.useLocation()),E=i.useRouteMatch(),S=i.useHistory(),[_,f,g]=(i.useLocation(),Digit.ULBService.getCurrentTenantId(),Digit.Hooks.useSessionStorage("WS_CREATE",null!=m&&m.edcrNumber?{data:{scrutinyNumber:{edcrNumber:null==m?void 0:m.edcrNumber}}}:{})),C=null===(e=Digit)||void 0===e||null===(n=e.ComponentRegistryService)||void 0===n?void 0:n.getComponent("WSCheckPage"),N=null===(t=Digit)||void 0===t||null===(a=t.ComponentRegistryService)||void 0===a?void 0:a.getComponent("WSAcknowledgement"),y=Digit.ULBService.getStateId();let{data:D}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(y,[]),T=window.location.href.includes("/modify-connection/")||window.location.href.includes("/edit-application/");_&&Object.keys(_).length>0&&window.location.href.includes("/citizen/ws/create-application/search-property")&&(g(),s.invalidateQueries("WS_CREATE"));const h=(e,n,t,l)=>{f(l?n:""===e?v({},n):v({},_,{[e]:v({},_[e],n)})),(e=>{var n,t,l,o,i;const a=p.split("/").pop();let{nextStep:r}=I.find(e=>e.route===a),u=I.find(e=>e.route===a&&e);"object"==typeof r&&null!=r&&(!r[sessionStorage.getItem("KnowProperty")]||"search-property"!==r[sessionStorage.getItem("KnowProperty")]&&"create-property"!==r[sessionStorage.getItem("KnowProperty")]||(r=""+r[sessionStorage.getItem("KnowProperty")])),u[sessionStorage.getItem("serviceName")]&&(r=u[sessionStorage.getItem("serviceName")]),(null!=_&&null!==(n=_.cptId)&&void 0!==n&&n.id||null!=_&&null!==(t=_.cpt)&&void 0!==t&&null!==(l=t.details)&&void 0!==l&&l.propertyId||T&&null!=_&&null!==(o=_.cpt)&&void 0!==o&&null!==(i=o.details)&&void 0!==i&&i.propertyId)&&"know-your-property"===r&&(r="property-details"),"docsrequired"===r&&"yes"===sessionStorage.getItem("changePropertySelected")&&(r="property-details");let d=S.push;if(null===r)return d(Xl(E.path,E.params)+"/check");d(Xl(E.path,E.params)+"/"+r)})()},A=()=>{};let I=[];return D=null!==(r=D)&&void 0!==r&&r.WSCreateConfig?null===(u=D)||void 0===u?void 0:u.WSCreateConfig:Kl,D.forEach(e=>{I=I.concat(e.body.filter(e=>!e.hideInCitizen))}),I.indexRoute="search-property",l.createElement(i.Switch,null,I.map((e,n)=>{const{component:t,texts:o,inputs:a,key:r,isSkipEnabled:u}=e,d="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:Xl(E.path,E.params)+"/"+e.route,key:n},l.createElement(d,{config:{texts:o,inputs:a,key:r,isSkipEnabled:u},onSelect:h,onSkip:A,t:c,formData:_,userType:"citizen"}))}),l.createElement(i.Route,{path:Xl(E.path,E.params)+"/check"},l.createElement(C,{onSubmit:function(){try{return sessionStorage.setItem("isCreateEnabled","true"),S.push(Xl(E.path,E.params)+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:_})),l.createElement(i.Route,{path:Xl(E.path,E.params)+"/acknowledgement"},l.createElement(N,{data:_,onSuccess:()=>{s.invalidateQueries("WS_CREATE")},clearParams:g})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Xl(E.path,E.params)+"/"+I.indexRoute})))},WSDisconnection:()=>{var e,n,t;d.useQueryClient();const{t:a}=o.useTranslation(),r=i.useRouteMatch(),u=Digit.ULBService.getStateId();let s=[],{data:c}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(u,{});return c=null!==(e=c)&&void 0!==e&&e.WSDisconnectionConfig?null===(n=c)||void 0===n?void 0:n.WSDisconnectionConfig:Zl,c=Zl,null===(t=c.filter(e=>"NEW_DISCONNECTION"===e.head))||void 0===t||t.forEach(e=>{s=s.concat(e.body.filter(e=>!e.hideInCitizen))}),s.indexRoute="docsrequired",l.createElement(i.Switch,null,s.map((e,n)=>{const{component:t,texts:o,inputs:u,key:d,isSkipEnabled:s}=e,c="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:$l(r.path,r.params)+"/"+e.route,key:n},l.createElement(c,{config:{texts:o,inputs:u,key:d,isSkipEnabled:s},t:a,userType:"citizen"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:$l(r.path,r.params)+"/"+s.indexRoute})))},WSRestoration:()=>{var e,n,t;d.useQueryClient();const{t:a}=o.useTranslation(),r=i.useRouteMatch(),u=Digit.ULBService.getStateId();let s=[],{data:c}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(u,{});c=null!==(e=c)&&void 0!==e&&e.WSDisconnectionConfig?null===(n=c)||void 0===n?void 0:n.WSDisconnectionConfig:Zl,c=Zl,null===(t=c.filter(e=>"NEW_DISCONNECTION"===e.head))||void 0===t||t.forEach(e=>{s=s.concat(e.body.filter(e=>!e.hideInCitizen))}),s.indexRoute="restoration-application";let v=[{route:"restoration-application",component:"WSRestorationForm",key:"WSRestorationForm",type:"component",withoutLabel:!0,nextStep:"check"},{route:"check",component:"WSRestorationCheckPage",key:"WSRestorationCheckPage",type:"component",isMandatory:!0,withoutLabel:!0,nextStep:"restoration-acknowledge",hideInEmployee:!0},{route:"restoration-acknowledge",component:"WSRestorationAcknowledgement",key:"WSRestorationAcknowledgement",type:"component",isMandatory:!0,withoutLabel:!0,hideInEmployee:!0}];return console.log(v,s),l.createElement(i.Switch,null,v.map((e,n)=>{const{component:t,texts:o,inputs:u,key:d,isSkipEnabled:s}=e,c="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:Jl(r.path,r.params)+"/"+e.route,key:n},l.createElement(c,{config:{texts:o,inputs:u,key:d,isSkipEnabled:s},t:a,userType:"citizen"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Jl(r.path,r.params)+"/"+s.indexRoute})))},WSSearchConnectionComponent:()=>{const{t:e}=o.useTranslation(),{path:n}=i.useRouteMatch(),a=t.useMemo(()=>Ql.map(n=>{const t={};for(const l in n.texts)t[l]=e(n.texts[l]);return v({},n,{texts:t})},[Ql]));return l.createElement(i.Switch,null,l.createElement(i.Route,{path:""+n,exact:!0},l.createElement(Vo,{config:a[0]})))},WSSearchResultsComponent:()=>{const{t:e}=o.useTranslation(),{path:n}=i.useRouteMatch(),a=t.useMemo(()=>zo.map(n=>{const t={};for(const l in n.texts)t[l]=e(n.texts[l]);return v({},n,{texts:t})},[zo]));return l.createElement(i.Switch,null,l.createElement(i.Route,{path:""+n,exact:!0},l.createElement(Ii,{template:a[0].labels,header:a[0].texts.header,actionButtonLabel:a[0].texts.actionButtonLabel,t:e})))},WSCitizenApplicationDetails:()=>{var e,n,r,u,d,s,c,p,E,_,g,N,y,D,h,A,I,O,b,L,R,w,W,P,M,x,B,F,k,H,V,z,Y,G,q,K,X,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn,sn,cn,vn,pn,mn,En,Sn,_n,fn,gn,Cn,Nn,yn,Dn,Tn,hn,An,In,On,bn,Ln,Rn,wn,Wn,Pn,Mn,xn,Bn,Fn,Un,kn,Hn,jn,Vn,zn,Yn,Gn,qn,Kn,Xn,Zn,$n,Jn,Qn,et,nt,tt,lt,ot,it,at,rt,ut,dt,st,ct,vt,pt,mt,Et,St,_t,ft,gt,Ct,Nt,yt,Dt,Tt,ht,At,It,Ot,bt,Lt,Rt,wt,Wt,Pt,Mt,xt,Bt,Ft,Ut,kt,Ht,jt,Vt,zt,Yt,Gt,qt,Kt,Xt,Zt,$t,Jt,Qt,el,nl,tl,ll,ol,il,al,rl,ul,dl,sl,cl,vl,pl,ml,El,Sl,_l,fl,gl,Cl,Nl,yl,Dl,Tl,hl,Al,Il,Ol,bl,Ll,Rl,wl,Wl,Pl,Ml,xl,Bl,Fl,Ul,kl,Hl,jl,Vl,zl,Yl,Gl,ql,Kl,Xl,Zl,$l,Jl,Ql,eo,no,to,lo,oo,io,ao,ro,uo,so,co,vo,po,mo,Eo,So,_o,fo,go,Co,No,yo,Do,To,ho,Ao,Io,Oo,bo,Lo,Ro,wo,Wo,Po,Mo,xo,Bo,Fo,Uo,ko,Ho,jo,Vo,zo,Yo,Go,qo,Ko,Xo,Zo,$o,Jo,Qo,ei,ni,ti,li,oi,ii,ai,ri,ui,di,si,ci,vi,pi,mi,Ei,Si,_i,fi,gi,Ci,Ni,yi,Di,Ti,hi,Ai,Ii,Oi,Ri,wi,Wi,Pi,Mi,Bi,Fi,Ui,ki,Hi,ji,Vi,zi,Yi,Gi,qi,Ki,Xi,Zi,$i,Ji,Qi,ea,na,ta,la,oa,ia,aa,ra,ua,da,sa,ca,va,pa,ma,Ea,Sa,_a,fa,ga,Ca,Na,ya,Da,Ta,ha,Aa,Ia,Oa,ba,La,Ra,wa,Wa,Pa,Ma,xa,Ba,Fa,Ua,ka,Ha,ja,Va,za;const{t:Ya}=o.useTranslation(),Ga=t.useRef(),qa=Digit.UserService.getUser(),Ka=(null===(e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===e?void 0:e.code)||(null==qa||null===(n=qa.info)||void 0===n?void 0:n.permanentCity)||Digit.ULBService.getCurrentTenantId(),[Xa,Za]=(Digit.ULBService.getStateId(),t.useState(!1)),[$a,Ja]=t.useState(!1),Qa=window.location.href.includes("SW_")?window.location.href.substring(window.location.href.indexOf("SW_")):window.location.href.substring(window.location.href.indexOf("WS_"));let er={tenantId:Ka,applicationNumber:Qa};const{isLoading:nr,data:tr}=Digit.Hooks.ws.useMyApplicationSearch({filters:er,BusinessService:null!=Qa&&Qa.includes("SW")?"SW":"WS"},{filters:er,privacy:Digit.Utils.getPrivacyObject()});Digit.Hooks.useClickOutside(Ga,()=>{Za(!1)},Xa);const lr={consumerCode:null!=Qa&&Qa.includes("DC")?(null==tr||null===(r=tr.WaterConnection)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.connectionNo)||(null==tr||null===(d=tr.SewerageConnections)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.connectionNo):(null==tr||null===(c=tr.WaterConnection)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.applicationNo)||(null==tr||null===(E=tr.SewerageConnections)||void 0===E||null===(_=E[0])||void 0===_?void 0:_.applicationNo)},{data:or}=Digit.Hooks.useCommonMDMS(Ka,"common-masters","ReceiptKey",{select:e=>{var n,t,l;return(null===(n=e["common-masters"])||void 0===n||null===(t=n.uiCommonPay)||void 0===t||null===(l=t.filter(e=>{let{code:n}=e;return"WS.ONE_TIME_FEE".includes(n)})[0])||void 0===l?void 0:l.receiptKey)||"consolidatedreceipt"}}),ir=Digit.Hooks.useFetchBillsForBuissnessService(v({businessService:null!=Qa&&Qa.includes("SW")?null!=Qa&&Qa.includes("DC")?"SW":"SW.ONE_TIME_FEE":null!=Qa&&Qa.includes("DC")?"WS":"WS.ONE_TIME_FEE"},lr,{tenantId:Ka}),{enabled:!!(null!=tr&&null!==(g=tr.WaterConnection)&&void 0!==g&&null!==(N=g[0])&&void 0!==N&&N.applicationNo||null!=tr&&null!==(y=tr.SewerageConnections)&&void 0!==y&&null!==(D=y[0])&&void 0!==D&&D.applicationNo),retry:!1}),{data:ar}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:null==tr||null===(h=tr.WaterConnection)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.propertyId}},{filters:{propertyIds:null==tr||null===(I=tr.WaterConnection)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.propertyId},privacy:Digit.Utils.getPrivacyObject()}),rr=Digit.Hooks.ws.useToCheckPrivacyEnablement({privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(b=tr.WaterConnection)||void 0===b||null===(L=b[0])||void 0===L||null===(R=L.connectionHolders)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.uuid:null==tr||null===(W=tr.SewerageConnections)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.connectionHolders)||void 0===M||null===(x=M[0])||void 0===x?void 0:x.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner"}})||!1,ur="CONNECTION_ACTIVATED"===(null==tr||null===(B=tr.WaterConnection)||void 0===B||null===(F=B[0])||void 0===F?void 0:F.applicationStatus)||"PENDING_FOR_CONNECTION_ACTIVATION"===(null==tr||null===(k=tr.WaterConnection)||void 0===k||null===(H=k[0])||void 0===H?void 0:H.applicationStatus)||"CONNECTION_ACTIVATED"===(null==tr||null===(V=tr.SewerageConnections)||void 0===V||null===(z=V[0])||void 0===z?void 0:z.applicationStatus)||"PENDING_FOR_CONNECTION_ACTIVATION"===(null==tr||null===(Y=tr.SewerageConnections)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.applicationStatus);if(nr)return l.createElement(a.Loader,null);let dr=[];const sr={order:1,label:Ya("WS_ESTIMATION_NOTICE"),onClick:()=>{var e,n,t,l,o,i,a;return null!=tr&&null!==(e=tr.WaterConnection)&&void 0!==e&&e[0]?T([null==tr||null===(n=tr.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.estimationFileStoreId],Ka):T([null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.estimationFileStoreId],Ka)}},cr={order:2,label:Ya("WS_SANCTION_LETTER"),onClick:()=>{var e,n,t,l,o,i,a;return null!=tr&&null!==(e=tr.WaterConnection)&&void 0!==e&&e[0]?T([null==tr||null===(n=tr.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.sanctionFileStoreId],Ka):T([null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.sanctionFileStoreId],Ka)}},vr={order:3,label:Ya("WS_APPLICATION"),onClick:function(){try{var e,n,t,l,o,i,a;const r=(null==tr||null===(e=tr.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==tr||null===(t=tr.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId);let u=(null==tr||null===(o=tr.WaterConnection)||void 0===o?void 0:o[0])||(null==tr||null===(i=tr.SewerageConnections)||void 0===i?void 0:i[0]);return Z(v({},u),v({},null==ar||null===(a=ar.Properties)||void 0===a?void 0:a[0]),r,Ya).then(e=>Digit.Utils.pdf.generatev1(e)),Za(!1),Promise.resolve()}catch(e){return Promise.reject(e)}}},pr={order:4,label:Ya("DOWNLOAD_RECEIPT_HEADER"),onClick:function(){try{var e,n,t,l,o,i;const a=Digit.ULBService.getCurrentTenantId(),r=Digit.ULBService.getStateId();let u=null!=tr&&null!==(e=tr.WaterConnection)&&void 0!==e&&e[0]?"WS.ONE_TIME_FEE":"SW.ONE_TIME_FEE";return Promise.resolve(Digit.PaymentService.getReciept(a,u,{consumerCodes:null!=tr&&null!==(n=tr.WaterConnection)&&void 0!==n&&n[0]?null==tr||null===(t=tr.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo:null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo})).then(function(e){var n;function t(){return Promise.resolve(Digit.PaymentService.printReciept(r,{fileStoreIds:l.filestoreIds[0]})).then(function(e){window.open(e[l.filestoreIds[0]],"_blank")})}let l={filestoreIds:[null===(n=e.Payments[0])||void 0===n?void 0:n.fileStoreId]};const o=function(n){if(null===(n=e.Payments[0])||void 0===n||!n.fileStoreId)return Promise.resolve(Digit.PaymentService.generatePdf(r,{Payments:e.Payments},or)).then(function(e){l=e})}();return o&&o.then?o.then(t):t()})}catch(e){return Promise.reject(e)}}},mr=[{order:1,label:Ya("WS_APPLICATION"),onClick:function(){try{var e,n,t,l,o,i,a;const r=(null==tr||null===(e=tr.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==tr||null===(t=tr.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId);let u=(null==tr||null===(o=tr.WaterConnection)||void 0===o?void 0:o[0])||(null==tr||null===(i=tr.SewerageConnections)||void 0===i?void 0:i[0]);return xi(v({},u),v({},null==ar||null===(a=ar.Properties)||void 0===a?void 0:a[0]),r,Ya).then(e=>Digit.Utils.pdf.generatev1(e)),Za(!1),Promise.resolve()}catch(e){return Promise.reject(e)}}},{order:2,label:Ya("WS_DISCONNECTION_NOTICE_LABEL"),onClick:()=>function(){try{var e,n,t,l;let u="ws-waterdisconnectionnotice",d={};var o,i,a,r;return null!=Qa&&Qa.includes("WS")?d={WaterConnection:[v({},null==tr||null===(o=tr.WaterConnection)||void 0===o?void 0:o[0],{property:null==ar||null===(i=ar.Properties)||void 0===i?void 0:i[0]})]}:(u="ws-seweragedisconnectionnotice",d={SewerageConnection:[v({},null==tr||null===(a=tr.SewerageConnections)||void 0===a?void 0:a[0],{property:null==ar||null===(r=ar.Properties)||void 0===r?void 0:r[0]})]}),Promise.resolve(Digit.WSService.WSDisconnectionNotice((null==tr||null===(e=tr.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==tr||null===(t=tr.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId),d,u)).then(function(e){var n,t,l,o;return Promise.resolve(Digit.PaymentService.printReciept((null==tr||null===(n=tr.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.tenantId)||(null==tr||null===(l=tr.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.tenantId),{fileStoreIds:e.filestoreIds[0]})).then(function(n){window.open(n[null==e?void 0:e.filestoreIds[0]],"_blank")})})}catch(e){return Promise.reject(e)}}()}],Er=(null==tr||null===(q=tr.WaterConnection)||void 0===q||null===(K=q[0].applicationType)||void 0===K?void 0:K.includes("DISCONNECT"))||(null==tr||null===(X=tr.SewerageConnections)||void 0===X||null===($=X[0].applicationType)||void 0===$?void 0:$.includes("DISCONNECT"));switch((null==tr||null===(J=tr.WaterConnection)||void 0===J||null===(Q=J[0])||void 0===Q?void 0:Q.applicationStatus)||(null==tr||null===(ee=tr.SewerageConnections)||void 0===ee||null===(ne=ee[0])||void 0===ne?void 0:ne.applicationStatus)){case"PENDING_FOR_DOCUMENT_VERIFICATION":dr=null!=tr&&null!==(te=tr.WaterConnection)&&void 0!==te&&null!==(le=te[0].applicationType)&&void 0!==le&&le.includes("DISCONNECT")||null!=tr&&null!==(oe=tr.SewerageConnections)&&void 0!==oe&&null!==(ie=oe[0].applicationType)&&void 0!==ie&&ie.includes("DISCONNECT")?mr:dr.concat(vr);break;case"PENDING_FOR_CITIZEN_ACTION":case"PENDING_FOR_FIELD_INSPECTION":dr=dr.concat(vr);break;case"PENDING_APPROVAL_FOR_CONNECTION":case"PENDING_FOR_PAYMENT":dr=dr.concat(vr,sr);break;case"PENDING_FOR_CONNECTION_ACTIVATION":case"CONNECTION_ACTIVATED":dr=dr.concat(cr,sr,vr,pr);break;case"REJECTED":dr=dr.concat(vr);break;case"PENDING_FOR_DISCONNECTION_EXECUTION":case"DISCONNECTION_EXECUTED":case"PENDING_FOR_PAYMENT":dr=null!=tr&&null!==(ae=tr.WaterConnection)&&void 0!==ae&&null!==(re=ae[0].applicationType)&&void 0!==re&&re.includes("DISCONNECT")||null!=tr&&null!==(ue=tr.SewerageConnections)&&void 0!==ue&&null!==(de=ue[0].applicationType)&&void 0!==de&&de.includes("DISCONNECT")?mr:dr.concat(vr);break;default:dr=dr.concat(vr)}dr.sort(function(e,n){return e.order-n.order});let Sr=tr&&null!=tr&&null!==(se=tr.WaterConnection)&&void 0!==se&&se[0]?"WATER":"SEWERAGE";return sessionStorage.setItem("ApplicationNoState",Qa),l.createElement(l.Fragment,null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(a.Header,null,Ya("WS_APPLICATION_DETAILS_HEADER")),l.createElement("div",{style:{zIndex:"10",display:"flex",flexDirection:"row-reverse",alignItems:"center",marginTop:"-25px"}},dr&&dr.length>0&&l.createElement("div",{ref:Ga},l.createElement(a.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>Za(!Xa),displayOptions:Xa,options:dr})),l.createElement(a.LinkButton,{label:Ya("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"}),Ja(!0)}}))),rr&&l.createElement(j,{t:Ya}),l.createElement("div",{className:"hide-seperator"},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_MYCONNECTIONS_APPLICATION_NO"),text:(null==tr||null===(ce=tr.WaterConnection)||void 0===ce||null===(ve=ce[0])||void 0===ve?void 0:ve.applicationNo)||(null==tr||null===(pe=tr.SewerageConnections)||void 0===pe||null===(me=pe[0])||void 0===me?void 0:me.applicationNo),textStyle:{}}),((null==tr||null===(Ee=tr.WaterConnection)||void 0===Ee||null===(Se=Ee[0].applicationType)||void 0===Se?void 0:Se.includes("DISCONNECT"))||(null==tr||null===(_e=tr.SewerageConnections)||void 0===_e||null===(fe=_e[0].applicationType)||void 0===fe?void 0:fe.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_MYCONNECTIONS_CONSUMER_NO"),text:(null==tr||null===(ge=tr.WaterConnection)||void 0===ge||null===(Ce=ge[0])||void 0===Ce?void 0:Ce.connectionNo)||(null==tr||null===(Ne=tr.SewerageConnections)||void 0===Ne||null===(ye=Ne[0])||void 0===ye?void 0:ye.connectionNo),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_SERVICE_NAME_LABEL"),text:Ya("WS_APPLICATION_TYPE_"+((null==tr||null===(De=tr.WaterConnection)||void 0===De||null===(Te=De[0])||void 0===Te?void 0:Te.applicationType)||(null==tr||null===(he=tr.SewerageConnections)||void 0===he||null===(Ae=he[0])||void 0===Ae?void 0:Ae.applicationType))),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),text:null!=ir&&null!==(Ie=ir.data)&&void 0!==Ie&&null!==(Oe=Ie.Bill)&&void 0!==Oe&&null!==(be=Oe[0])&&void 0!==be&&null!==(Le=be.billDetails)&&void 0!==Le&&null!==(Re=Le[0])&&void 0!==Re&&Re.amount?"₹ "+Number(null==ir||null===(we=ir.data)||void 0===we||null===(We=we.Bill)||void 0===We||null===(Pe=We[0])||void 0===Pe||null===(Me=Pe.billDetails)||void 0===Me||null===(xe=Me[0])||void 0===xe?void 0:xe.amount).toFixed(2):Ya("₹0"),textStyle:{whiteSpace:"pre"}}),((null==tr||null===(Be=tr.WaterConnection)||void 0===Be||null===(Fe=Be[0].applicationType)||void 0===Fe?void 0:Fe.includes("DISCONNECT"))||(null==tr||null===(Ue=tr.SewerageConnections)||void 0===Ue||null===(ke=Ue[0].applicationType)||void 0===ke?void 0:ke.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_DISCONNECTION_PROPOSED_DATE"),text:null!=Qa&&Qa.includes("WS")?f(null==tr||null===(He=tr.WaterConnection)||void 0===He||null===(je=He[0])||void 0===je?void 0:je.dateEffectiveFrom):f(null==tr||null===(Ve=tr.SewerageConnections)||void 0===Ve||null===(ze=Ve[0])||void 0===ze?void 0:ze.dateEffectiveFrom),textStyle:{wordBreak:"break-word"}}),((null==tr||null===(Ye=tr.WaterConnection)||void 0===Ye||null===(Ge=Ye[0].applicationType)||void 0===Ge?void 0:Ge.includes("DISCONNECT"))||(null==tr||null===(qe=tr.SewerageConnections)||void 0===qe||null===(Ke=qe[0].applicationType)||void 0===Ke?void 0:Ke.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_DISCONNECTION_EXECUTED_DATE"),text:null!=Qa&&Qa.includes("WS")?f(null==tr||null===(Xe=tr.WaterConnection)||void 0===Xe||null===(Ze=Xe[0])||void 0===Ze?void 0:Ze.disconnectionExecutionDate):f(null==tr||null===($e=tr.SewerageConnections)||void 0===$e||null===(Je=$e[0])||void 0===Je?void 0:Je.disconnectionExecutionDate),textStyle:{wordBreak:"break-word"}}),((null==tr||null===(Qe=tr.WaterConnection)||void 0===Qe||null===(en=Qe[0].applicationType)||void 0===en?void 0:en.includes("DISCONNECT"))||(null==tr||null===(nn=tr.SewerageConnections)||void 0===nn||null===(tn=nn[0].applicationType)||void 0===tn?void 0:tn.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_DISCONNECTION_REASON"),text:null!=(null==tr||null===(ln=tr.WaterConnection)||void 0===ln||null===(on=ln[0])||void 0===on?void 0:on.disconnectionReason)?null==tr||null===(an=tr.WaterConnection)||void 0===an||null===(rn=an[0])||void 0===rn?void 0:rn.disconnectionReason:null!=(null==tr||null===(un=tr.SewerageConnections)||void 0===un||null===(dn=un[0])||void 0===dn?void 0:dn.disconnectionReason)?null==tr||null===(sn=tr.SewerageConnections)||void 0===sn||null===(cn=sn[0])||void 0===cn?void 0:cn.disconnectionReason:Ya("NA"),textStyle:{wordBreak:"break-word"}}))),(null==ir||null===(vn=ir.data)||void 0===vn||null===(pn=vn.Bill)||void 0===pn||null===(mn=pn[0])||void 0===mn||null===(En=mn.billDetails)||void 0===En||null===(Sn=En[0])||void 0===Sn?void 0:Sn.billAccountDetails.length)>0&&l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_FEE_DEATAILS_HEADER")),l.createElement(a.StatusTable,null,null==ir||null===(_n=ir.data)||void 0===_n||null===(fn=_n.Bill)||void 0===fn||null===(gn=fn[0])||void 0===gn||null===(Cn=gn.billDetails)||void 0===Cn||null===(Nn=Cn[0])||void 0===Nn?void 0:Nn.billAccountDetails.map(e=>l.createElement(a.Row,{className:"border-none",label:Ya(null==e?void 0:e.taxHeadCode),text:"₹"+Number(null==e?void 0:e.amount).toFixed(2),textStyle:{textAlign:"right"}})),l.createElement(a.Row,{className:"border-none",label:Ya("WS_TOTAL_AMOUNT_DUE"),text:"₹"+Number(ur?0:null==ir||null===(yn=ir.data)||void 0===yn||null===(Dn=yn.Bill)||void 0===Dn||null===(Tn=Dn[0])||void 0===Tn||null===(hn=Tn.billDetails)||void 0===hn||null===(An=hn[0])||void 0===An?void 0:An.amount).toFixed(2),textStyle:{textAlign:"right",fontSize:"18px",fontWeight:"700"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_COMMON_TABLE_COL_APPLICATION_STATUS"),text:ur||0==Number(null==ir||null===(In=ir.data)||void 0===In||null===(On=In.Bill)||void 0===On||null===(bn=On[0])||void 0===bn||null===(Ln=bn.billDetails)||void 0===Ln||null===(Rn=Ln[0])||void 0===Rn?void 0:Rn.amount).toFixed(2)?Ya("WS_COMMON_PAID_LABEL"):Ya("WS_COMMON_NOT_PAID"),textStyle:ur||0==Number(null==ir||null===(wn=ir.data)||void 0===wn||null===(Wn=wn.Bill)||void 0===Wn||null===(Pn=Wn[0])||void 0===Pn||null===(Mn=Pn.billDetails)||void 0===Mn||null===(xn=Mn[0])||void 0===xn?void 0:xn.amount).toFixed(2)?{textAlign:"right",color:"darkgreen"}:{textAlign:"right",color:"red"}}))),l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_PROPERTY_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_PROPERTY_ID_LABEL"),text:(null==tr||null===(Bn=tr.WaterConnection)||void 0===Bn||null===(Fn=Bn[0])||void 0===Fn?void 0:Fn.propertyId)||(null==tr||null===(Un=tr.SewerageConnections)||void 0===Un||null===(kn=Un[0])||void 0===kn?void 0:kn.propertyId),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:null==ar||null===(Hn=ar.Properties)||void 0===Hn||null===(jn=Hn[0])||void 0===jn||null===(Vn=jn.owners.sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===Vn||null===(zn=Vn[0])||void 0===zn?void 0:zn.name,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_PROPERTY_ADDRESS"),text:C(null==ar||null===(Yn=ar.Properties)||void 0===Yn||null===(Gn=Yn[0])||void 0===Gn?void 0:Gn.address,Ya)||Ya("CS_NA"),textStyle:{wordBreak:"break-word"},privacy:{uuid:null==ar||null===(qn=ar.Properties)||void 0===qn||null===(Kn=qn[0])||void 0===Kn||null===(Xn=Kn.owners)||void 0===Xn||null===(Zn=Xn[0])||void 0===Zn?void 0:Zn.uuid,fieldName:["doorNo","street","landmark"],model:"Property",hide:!(null!=ar&&null!==($n=ar.Properties)&&void 0!==$n&&null!==(Jn=$n[0])&&void 0!==Jn&&Jn.address),showValue:!0,loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:Ka,propertyIds:(null==tr||null===(Qn=tr.WaterConnection)||void 0===Qn||null===(et=Qn[0])||void 0===et?void 0:et.propertyId)||(null==tr||null===(nt=tr.SewerageConnections)||void 0===nt||null===(tt=nt[0])||void 0===tt?void 0:tt.propertyId)},jsonPath:"Properties[0].address.street",isArray:!1,d:e=>(U.get(e,"Properties[0].address.doorNo")?U.get(e,"Properties[0].address.doorNo")+", ":"")+(U.get(e,"Properties[0].address.street")?U.get(e,"Properties[0].address.street")+", ":"")+(U.get(e,"Properties[0].address.landmark")?""+U.get(e,"Properties[0].address.landmark"):"")}}}),l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+((null==tr||null===(lt=tr.WaterConnection)||void 0===lt||null===(ot=lt[0])||void 0===ot?void 0:ot.propertyId)||(null==tr||null===(it=tr.SewerageConnections)||void 0===it||null===(at=it[0])||void 0===at?void 0:at.propertyId))+"&tenantId="+((null==tr||null===(rt=tr.WaterConnection)||void 0===rt||null===(ut=rt[0])||void 0===ut?void 0:ut.tenantId)||(null==tr||null===(dt=tr.SewerageConnections)||void 0===dt||null===(st=dt[0])||void 0===st?void 0:st.tenantId))},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:Ya("WS_VIEW_PROPERTY")})))),(null==tr||null===(ct=tr.WaterConnection)||void 0===ct||null===(vt=ct[0])||void 0===vt||null===(pt=vt.connectionHolders)||void 0===pt?void 0:pt.length)>0||(null==tr||null===(mt=tr.SewerageConnections)||void 0===mt||null===(Et=mt[0])||void 0===Et||null===(St=Et.connectionHolders)||void 0===St?void 0:St.length)>0?l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_MOBILE_NO_LABEL"),text:(null==tr||null===(_t=tr.WaterConnection)||void 0===_t||null===(ft=_t[0])||void 0===ft||null===(gt=ft.connectionHolders)||void 0===gt||null===(Ct=gt[0])||void 0===Ct?void 0:Ct.mobileNumber)||(null==tr||null===(Nt=tr.SewerageConnections)||void 0===Nt||null===(yt=Nt[0])||void 0===yt||null===(Dt=yt.connectionHolders)||void 0===Dt||null===(Tt=Dt[0])||void 0===Tt?void 0:Tt.mobileNumber),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(ht=tr.WaterConnection)||void 0===ht||null===(At=ht[0])||void 0===At||null===(It=At.connectionHolders)||void 0===It||null===(Ot=It[0])||void 0===Ot?void 0:Ot.uuid:null==tr||null===(bt=tr.SewerageConnections)||void 0===bt||null===(Lt=bt[0])||void 0===Lt||null===(Rt=Lt.connectionHolders)||void 0===Rt||null===(wt=Rt[0])||void 0===wt?void 0:wt.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].mobileNumber":"SewerageConnections[0].connectionHolders[0].mobileNumber",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:(null==tr||null===(Wt=tr.WaterConnection)||void 0===Wt||null===(Pt=Wt[0])||void 0===Pt||null===(Mt=Pt.connectionHolders)||void 0===Mt||null===(xt=Mt[0])||void 0===xt?void 0:xt.name)||(null==tr||null===(Bt=tr.SewerageConnections)||void 0===Bt||null===(Ft=Bt[0])||void 0===Ft||null===(Ut=Ft.connectionHolders)||void 0===Ut||null===(kt=Ut[0])||void 0===kt?void 0:kt.name),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_GENDER_LABEL"),text:Ya((null==tr||null===(Ht=tr.WaterConnection)||void 0===Ht||null===(jt=Ht[0])||void 0===jt||null===(Vt=jt.connectionHolders)||void 0===Vt||null===(zt=Vt[0])||void 0===zt?void 0:zt.gender)||(null==tr||null===(Yt=tr.SewerageConnections)||void 0===Yt||null===(Gt=Yt[0])||void 0===Gt||null===(qt=Gt.connectionHolders)||void 0===qt||null===(Kt=qt[0])||void 0===Kt?void 0:Kt.gender)),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(Xt=tr.WaterConnection)||void 0===Xt||null===(Zt=Xt[0])||void 0===Zt||null===($t=Zt.connectionHolders)||void 0===$t||null===(Jt=$t[0])||void 0===Jt?void 0:Jt.uuid:null==tr||null===(Qt=tr.SewerageConnections)||void 0===Qt||null===(el=Qt[0])||void 0===el||null===(nl=el.connectionHolders)||void 0===nl||null===(tl=nl[0])||void 0===tl?void 0:tl.uuid,fieldName:"gender",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].gender":"SewerageConnections[0].connectionHolders[0].gender",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_FATHER_OR_HUSBAND_NAME"),text:(null==tr||null===(ll=tr.WaterConnection)||void 0===ll||null===(ol=ll[0])||void 0===ol||null===(il=ol.connectionHolders)||void 0===il||null===(al=il[0])||void 0===al?void 0:al.fatherOrHusbandName)||(null==tr||null===(rl=tr.SewerageConnections)||void 0===rl||null===(ul=rl[0])||void 0===ul||null===(dl=ul.connectionHolders)||void 0===dl||null===(sl=dl[0])||void 0===sl?void 0:sl.fatherOrHusbandName)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(cl=tr.WaterConnection)||void 0===cl||null===(vl=cl[0])||void 0===vl||null===(pl=vl.connectionHolders)||void 0===pl||null===(ml=pl[0])||void 0===ml?void 0:ml.uuid:null==tr||null===(El=tr.SewerageConnections)||void 0===El||null===(Sl=El[0])||void 0===Sl||null===(_l=Sl.connectionHolders)||void 0===_l||null===(fl=_l[0])||void 0===fl?void 0:fl.uuid,fieldName:"fatherOrHusbandName",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].fatherOrHusbandName":"SewerageConnections[0].connectionHolders[0].fatherOrHusbandName",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_RELATION_LABEL"),text:(null==tr||null===(gl=tr.WaterConnection)||void 0===gl||null===(Cl=gl[0])||void 0===Cl||null===(Nl=Cl.connectionHolders)||void 0===Nl||null===(yl=Nl[0])||void 0===yl?void 0:yl.relationship)||(null==tr||null===(Dl=tr.SewerageConnections)||void 0===Dl||null===(Tl=Dl[0])||void 0===Tl||null===(hl=Tl.connectionHolders)||void 0===hl||null===(Al=hl[0])||void 0===Al?void 0:Al.relationship)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(Il=tr.WaterConnection)||void 0===Il||null===(Ol=Il[0])||void 0===Ol||null===(bl=Ol.connectionHolders)||void 0===bl||null===(Ll=bl[0])||void 0===Ll?void 0:Ll.uuid:null==tr||null===(Rl=tr.SewerageConnections)||void 0===Rl||null===(wl=Rl[0])||void 0===wl||null===(Wl=wl.connectionHolders)||void 0===Wl||null===(Pl=Wl[0])||void 0===Pl?void 0:Pl.uuid,fieldName:"relationship",model:"WnSConnection",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].relationship":"SewerageConnections[0].connectionHolders[0].relationship",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_CROSADD"),text:(null==tr||null===(Ml=tr.WaterConnection)||void 0===Ml||null===(xl=Ml[0])||void 0===xl||null===(Bl=xl.connectionHolders)||void 0===Bl||null===(Fl=Bl[0])||void 0===Fl?void 0:Fl.correspondenceAddress)||(null==tr||null===(Ul=tr.SewerageConnections)||void 0===Ul||null===(kl=Ul[0])||void 0===kl||null===(Hl=kl.connectionHolders)||void 0===Hl||null===(jl=Hl[0])||void 0===jl?void 0:jl.correspondenceAddress)||Ya("CS_NA"),privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(Vl=tr.WaterConnection)||void 0===Vl||null===(zl=Vl[0])||void 0===zl||null===(Yl=zl.connectionHolders)||void 0===Yl||null===(Gl=Yl[0])||void 0===Gl?void 0:Gl.uuid:null==tr||null===(ql=tr.SewerageConnections)||void 0===ql||null===(Kl=ql[0])||void 0===Kl||null===(Xl=Kl.connectionHolders)||void 0===Xl||null===(Zl=Xl[0])||void 0===Zl?void 0:Zl.uuid,fieldName:"correspondenceAddress",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].correspondenceAddress":"SewerageConnections[0].connectionHolders[0].correspondenceAddress",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_SPECIAL_APPLICANT_LABEL"),text:(null!=Qa&&Qa.includes("WS")?null!=tr&&null!==($l=tr.WaterConnection)&&void 0!==$l&&null!==(Jl=$l[0])&&void 0!==Jl&&null!==(Ql=Jl.connectionHolders)&&void 0!==Ql&&null!==(eo=Ql[0])&&void 0!==eo&&null!==(no=eo.ownerType)&&void 0!==no&&no.includes("*"):null!=tr&&null!==(to=tr.SewerageConnections)&&void 0!==to&&null!==(lo=to[0])&&void 0!==lo&&null!==(oo=lo.connectionHolders)&&void 0!==oo&&null!==(io=oo[0])&&void 0!==io&&null!==(ao=io.ownerType)&&void 0!==ao&&ao.includes("*"))?null!=Qa&&Qa.includes("WS")?null==tr||null===(So=tr.WaterConnection)||void 0===So||null===(_o=So[0])||void 0===_o||null===(fo=_o.connectionHolders)||void 0===fo||null===(go=fo[0])||void 0===go?void 0:go.ownerType:null==tr||null===(Co=tr.SewerageConnections)||void 0===Co||null===(No=Co[0])||void 0===No||null===(yo=No.connectionHolders)||void 0===yo||null===(Do=yo[0])||void 0===Do?void 0:Do.ownerType:Ya("COMMON_MASTERS_OWNERTYPE_"+(null!=Qa&&Qa.includes("WS")?null==tr||null===(ro=tr.WaterConnection)||void 0===ro||null===(uo=ro[0])||void 0===uo||null===(so=uo.connectionHolders)||void 0===so||null===(co=so[0])||void 0===co?void 0:co.ownerType:null==tr||null===(vo=tr.SewerageConnections)||void 0===vo||null===(po=vo[0])||void 0===po||null===(mo=po.connectionHolders)||void 0===mo||null===(Eo=mo[0])||void 0===Eo?void 0:Eo.ownerType)),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(To=tr.WaterConnection)||void 0===To||null===(ho=To[0])||void 0===ho||null===(Ao=ho.connectionHolders)||void 0===Ao||null===(Io=Ao[0])||void 0===Io?void 0:Io.uuid:null==tr||null===(Oo=tr.SewerageConnections)||void 0===Oo||null===(bo=Oo[0])||void 0===bo||null===(Lo=bo.connectionHolders)||void 0===Lo||null===(Ro=Lo[0])||void 0===Ro?void 0:Ro.uuid,fieldName:"ownerType",model:"WnSConnection",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].ownerType":"SewerageConnections[0].connectionHolders[0].ownerType",isArray:!1,d:e=>{var n,t,l,o,i,a,r,u,d,s,c;return null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n[0]?Ya("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(t=e.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.connectionHolders)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.ownerType)||void 0===a?void 0:a.toUpperCase())):Ya("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(r=e.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.ownerType)||void 0===c?void 0:c.toUpperCase()))}}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_EMAIL_ID_LABEL"),text:(null==tr||null===(wo=tr.WaterConnection)||void 0===wo||null===(Wo=wo[0])||void 0===Wo||null===(Po=Wo.connectionHolders)||void 0===Po||null===(Mo=Po[0])||void 0===Mo?void 0:Mo.emailId)||(null==tr||null===(xo=tr.SewerageConnections)||void 0===xo||null===(Bo=xo[0])||void 0===Bo||null===(Fo=Bo.connectionHolders)||void 0===Fo||null===(Uo=Fo[0])||void 0===Uo?void 0:Uo.emailId)||"NA",textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(ko=tr.WaterConnection)||void 0===ko||null===(Ho=ko[0])||void 0===Ho||null===(jo=Ho.connectionHolders)||void 0===jo||null===(Vo=jo[0])||void 0===Vo?void 0:Vo.uuid:null==tr||null===(zo=tr.SewerageConnections)||void 0===zo||null===(Yo=zo[0])||void 0===Yo||null===(Go=Yo.connectionHolders)||void 0===Go||null===(qo=Go[0])||void 0===qo?void 0:qo.uuid,fieldName:"connectionHoldersEmailId",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].emailId":"SewerageConnections[0].connectionHolders[0].emailId",isArray:!1}}}))):l.createElement("div",null,l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,Ya("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),l.createElement(a.CardText,null,Ya("WS_SAME_AS_PROPERTY_OWNERS")))),Er?null:l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_CONNECTION_DETAIL")),(null==tr?void 0:tr.WaterConnection)&&(null==tr||null===(Ko=tr.WaterConnection)||void 0===Ko?void 0:Ko.length)>0&&l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_TASK_DETAILS_CONN_DETAIL_NO_OF_TAPS_PROPOSED"),text:(null==tr||null===(Xo=tr.WaterConnection)||void 0===Xo||null===(Zo=Xo[0])||void 0===Zo?void 0:Zo.proposedTaps)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_SERV_DETAIL_PIPE_SIZE"),text:(null==tr||null===($o=tr.WaterConnection)||void 0===$o||null===(Jo=$o[0])||void 0===Jo?void 0:Jo.proposedPipeSize)+" "+Ya("WS_INCHES_LABEL")||Ya("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(i.Link,{to:"/digit-ui/citizen/ws/connection/additional/"+(null==tr||null===(Qo=tr.WaterConnection)||void 0===Qo||null===(ei=Qo[0])||void 0===ei?void 0:ei.applicationNo)},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:Ya("WS_ADDITIONAL_DETAILS")}))),(null==tr?void 0:tr.SewerageConnections)&&(null==tr||null===(ni=tr.SewerageConnections)||void 0===ni?void 0:ni.length)>0&&l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_NO_OF_WATER_CLOSETS_LABEL"),text:null==tr||null===(ti=tr.SewerageConnections)||void 0===ti||null===(li=ti[0])||void 0===li?void 0:li.proposedWaterClosets,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_SERV_DETAIL_NO_OF_TOILETS"),text:(null==tr||null===(oi=tr.SewerageConnections)||void 0===oi||null===(ii=oi[0])||void 0===ii?void 0:ii.proposedToilets)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(i.Link,{to:"/digit-ui/citizen/ws/connection/additional/"+(null==tr||null===(ai=tr.SewerageConnections)||void 0===ai||null===(ri=ai[0])||void 0===ri?void 0:ri.applicationNo)},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:Ya("WS_ADDITIONAL_DETAILS")})))),l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_DOCUMENT_DETAILS")),(null==tr||null===(ui=tr.WaterConnection)||void 0===ui||null===(di=ui[0])||void 0===di?void 0:di.documents)&&(null==tr||null===(si=tr.WaterConnection)||void 0===si||null===(ci=si[0])||void 0===ci?void 0:ci.documents.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:"doc-"+n},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,Ya(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:null==tr||null===(o=tr.WaterConnection)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.documents,Code:null==e?void 0:e.documentType,index:n}),(null==tr||null===(r=tr.WaterConnection)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.documents.length)!=n+1?l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))})),(null==tr||null===(vi=tr.SewerageConnections)||void 0===vi||null===(pi=vi[0])||void 0===pi?void 0:pi.documents)&&(null==tr||null===(mi=tr.SewerageConnections)||void 0===mi||null===(Ei=mi[0])||void 0===Ei?void 0:Ei.documents.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:"doc-"+n},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,Ya(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.documents,Code:null==e?void 0:e.documentType,index:n}),(null==tr||null===(r=tr.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.documents.length)!=n+1?l.createElement("hr",{style:{color:"white",backgroundColor:"white",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))}))),l.createElement(a.Card,null,l.createElement("div",{id:"timeline"},l.createElement(bi,{application:(null==tr||null===(Si=tr.WaterConnection)||void 0===Si?void 0:Si[0])||(null==tr||null===(_i=tr.SewerageConnections)||void 0===_i?void 0:_i[0]),id:(null==tr||null===(fi=tr.WaterConnection)||void 0===fi||null===(gi=fi[0])||void 0===gi?void 0:gi.applicationNo)||(null==tr||null===(Ci=tr.SewerageConnections)||void 0===Ci||null===(Ni=Ci[0])||void 0===Ni?void 0:Ni.applicationNo),paymentbuttonenabled:!1})),"PENDING_FOR_PAYMENT"===(null==tr||null===(yi=tr.WaterConnection)||void 0===yi||null===(Di=yi[0])||void 0===Di?void 0:Di.applicationStatus)||"PENDING_FOR_PAYMENT"===(null==tr||null===(Ti=tr.SewerageConnections)||void 0===Ti||null===(hi=Ti[0])||void 0===hi?void 0:hi.applicationStatus)?l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/payment/my-bills/"+(null==ir||null===(Ai=ir.data)||void 0===Ai||null===(Ii=Ai.Bill)||void 0===Ii||null===(Oi=Ii[0])||void 0===Oi?void 0:Oi.businessService)+"/"+(null!=Qa&&Qa.includes("DC")?m(null==tr||null===(Ri=tr.WaterConnection)||void 0===Ri||null===(wi=Ri[0])||void 0===wi?void 0:wi.connectionNo,"/","+")||m(null==tr||null===(Wi=tr.SewerageConnections)||void 0===Wi||null===(Pi=Wi[0])||void 0===Pi?void 0:Pi.connectionNo,"/","+"):m(null==tr||null===(Mi=tr.WaterConnection)||void 0===Mi||null===(Bi=Mi[0])||void 0===Bi?void 0:Bi.applicationNo,"/","+")||m(null==tr||null===(Fi=tr.SewerageConnections)||void 0===Fi||null===(Ui=Fi[0])||void 0===Ui?void 0:Ui.applicationNo,"/","+"))+"?workflow=WNS&tenantId="+((null==tr||null===(ki=tr.WaterConnection)||void 0===ki||null===(Hi=ki[0])||void 0===Hi?void 0:Hi.tenantId)||(null==tr||null===(ji=tr.SewerageConnections)||void 0===ji||null===(Vi=ji[0])||void 0===Vi?void 0:Vi.tenantId))+"&ConsumerName="+((null==tr||null===(zi=tr.WaterConnection)||void 0===zi||null===(Yi=zi[0])||void 0===Yi||null===(Gi=Yi.connectionHolders)||void 0===Gi?void 0:Gi.map(e=>e.name).join(","))||(null==tr||null===(qi=tr.SewerageConnections)||void 0===qi||null===(Ki=qi[0])||void 0===Ki||null===(Xi=Ki.connectionHolders)||void 0===Xi?void 0:Xi.map(e=>e.name).join(","))||(null==ar||null===(Zi=ar.Properties)||void 0===Zi||null===($i=Zi[0])||void 0===$i||null===(Ji=$i.owners)||void 0===Ji?void 0:Ji.map(e=>e.name).join(",")))+"&isDisoconnectFlow="+!(null==Qa||!Qa.includes("DC")),state:{}}},l.createElement(a.SubmitBar,{label:Ya("MAKE_PAYMENT")})):null,(null==tr||null===(Qi=tr.WaterConnection)||void 0===Qi||null===(ea=Qi[0])||void 0===ea||!ea.applicationType.includes("DISCONNECT"))&&null!=tr&&null!==(na=tr.WaterConnection)&&void 0!==na&&null!==(ta=na[0])&&void 0!==ta&&ta.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")||(null==tr||null===(la=tr.SewerageConnections)||void 0===la||null===(oa=la[0])||void 0===oa||!oa.applicationType.includes("DISCONNECT"))&&null!=tr&&null!==(ia=tr.SewerageConnections)&&void 0!==ia&&null!==(aa=ia[0])&&void 0!==aa&&aa.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")?l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/ws/edit-application/"+((null==tr||null===(ra=tr.WaterConnection)||void 0===ra||null===(ua=ra[0])||void 0===ua?void 0:ua.tenantId)||(null==tr||null===(da=tr.SewerageConnections)||void 0===da||null===(sa=da[0])||void 0===sa?void 0:sa.tenantId)),state:{id:""+((null==tr||null===(ca=tr.WaterConnection)||void 0===ca||null===(va=ca[0])||void 0===va?void 0:va.applicationNo)||(null==tr||null===(pa=tr.SewerageConnections)||void 0===pa||null===(ma=pa[0])||void 0===ma?void 0:ma.applicationNo))}}},l.createElement(a.SubmitBar,{label:Ya("COMMON_EDIT")})):null,null!=tr&&null!==(Ea=tr.WaterConnection)&&void 0!==Ea&&null!==(Sa=Ea[0])&&void 0!==Sa&&Sa.applicationType.includes("DISCONNECT")&&null!=tr&&null!==(_a=tr.WaterConnection)&&void 0!==_a&&null!==(fa=_a[0])&&void 0!==fa&&fa.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")||null!=tr&&null!==(ga=tr.SewerageConnections)&&void 0!==ga&&null!==(Ca=ga[0])&&void 0!==Ca&&Ca.applicationType.includes("DISCONNECT")&&null!=tr&&null!==(Na=tr.SewerageConnections)&&void 0!==Na&&null!==(ya=Na[0])&&void 0!==ya&&ya.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")?l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/ws/resubmit-disconnect-application",state:{id:""+((null==tr||null===(Da=tr.WaterConnection)||void 0===Da||null===(Ta=Da[0])||void 0===Ta?void 0:Ta.applicationNo)||(null==tr||null===(ha=tr.SewerageConnections)||void 0===ha||null===(Aa=ha[0])||void 0===Aa?void 0:Aa.applicationNo))}}},l.createElement(a.SubmitBar,{label:Ya("RESUBMIT_APPLICATION"),onSubmit:Digit.SessionStorage.set("WS_DISCONNECTION",null!=Qa&&Qa.includes("SW")?{applicationData:null==tr||null===(Ia=tr.SewerageConnections)||void 0===Ia?void 0:Ia[0],serviceType:"SEWERAGE",WSDisconnectionForm:{type:null!=tr&&null!==(Oa=tr.SewerageConnections)&&void 0!==Oa&&null!==(ba=Oa[0])&&void 0!==ba&&ba.isDisconnectionTemporary?{code:"type",value:{name:"Temporary",i18nKey:"WS_DISCONNECTIONTYPE_TEMPORARY",active:!0,code:"Temporary"}}:{code:"type",value:{name:"Permanent",i18nKey:"WS_DISCONNECTIONTYPE_PERMANENT",active:!0,code:"Permanent"}},date:S(null==tr||null===(La=tr.SewerageConnections)||void 0===La||null===(Ra=La[0])||void 0===Ra?void 0:Ra.dateEffectiveFrom,!0),reason:{code:"reason",value:null==tr||null===(wa=tr.SewerageConnections)||void 0===wa||null===(Wa=wa[0])||void 0===Wa?void 0:Wa.disconnectionReason},documents:null==tr||null===(Pa=tr.SewerageConnections)||void 0===Pa||null===(Ma=Pa[0])||void 0===Ma?void 0:Ma.documents}}:{applicationData:null==tr||null===(xa=tr.WaterConnection)||void 0===xa?void 0:xa[0],serviceType:"WATER",WSDisconnectionForm:{type:null!=tr&&null!==(Ba=tr.WaterConnection)&&void 0!==Ba&&null!==(Fa=Ba[0])&&void 0!==Fa&&Fa.isDisconnectionTemporary?{code:"type",value:{name:"Temporary",i18nKey:"WS_DISCONNECTIONTYPE_TEMPORARY",active:!0,code:"Temporary"}}:{code:"type",value:{name:"Permanent",i18nKey:"WS_DISCONNECTIONTYPE_PERMANENT",active:!0,code:"Permanent"}},date:S(null==tr||null===(Ua=tr.WaterConnection)||void 0===Ua||null===(ka=Ua[0])||void 0===ka?void 0:ka.dateEffectiveFrom,!0),reason:{code:"reason",value:null==tr||null===(Ha=tr.WaterConnection)||void 0===Ha||null===(ja=Ha[0])||void 0===ja?void 0:ja.disconnectionReason},documents:null==tr||null===(Va=tr.WaterConnection)||void 0===Va||null===(za=Va[0])||void 0===za?void 0:za.documents}})})):null)))},WSAdditionalDetails:()=>{var e,n,t,i,r,u,d,s,c,v,p,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn;const{t:sn}=o.useTranslation(),cn=Digit.UserService.getUser(),vn=Digit.ULBService.getCurrentTenantId()||(null==cn||null===(e=cn.info)||void 0===e?void 0:e.permanentCity),pn=window.location.href.includes("SW_")?window.location.href.substring(window.location.href.indexOf("SW_")):window.location.href.substring(window.location.href.indexOf("WS_"));let mn={tenantId:vn,applicationNumber:pn};const{isLoading:En,data:Sn}=Digit.Hooks.ws.useMyApplicationSearch({filters:mn,BusinessService:null!=pn&&pn.includes("SW")?"SW":"WS"},{filters:mn});return En?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,null,sn("WS_COMMON_ADDN_DETAILS")),l.createElement("div",{className:"hide-seperator"},l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_COMMON_CONNECTION_DETAIL")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_COMMON_TABLE_COL_CONNECTIONTYPE_LABEL"),text:(null==Sn||null===(n=Sn.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.connectionType)||(null==Sn||null===(i=Sn.SewerageConnections)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.connectionType)||sn("NA"),textStyle:{whiteSpace:"pre"}}),(null==Sn?void 0:Sn.WaterConnection)&&(null==Sn||null===(u=Sn.WaterConnection)||void 0===u?void 0:u.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_NO_OF_TAPS"),text:(null==Sn||null===(d=Sn.WaterConnection)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.noOfTaps)||(null==Sn||null===(c=Sn.SewerageConnections)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.noOfTaps)||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_PIPE_SIZE_IN_INCHES_LABEL"),text:(null==Sn||null===(p=Sn.WaterConnection)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.pipeSize)||(null==Sn||null===(S=Sn.SewerageConnections)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.pipeSize)||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_WATER_SOURCE"),text:sn("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==Sn||null===(f=Sn.WaterConnection)||void 0===f||null===(g=f[0])||void 0===g||null===(C=g.waterSource)||void 0===C||null===(N=C.split("."))||void 0===N?void 0:N[0],".","_"))||sn("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==Sn||null===(y=Sn.SewerageConnections)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.waterSource,".","_"))||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_WATER_SUB_SOURCE"),text:sn(null==Sn||null===(T=Sn.WaterConnection)||void 0===T||null===(h=T[0])||void 0===h||null===(A=h.waterSource)||void 0===A||null===(I=A.split("."))||void 0===I?void 0:I[1])||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}))),(null==Sn?void 0:Sn.SewerageConnections)&&(null==Sn||null===(O=Sn.SewerageConnections)||void 0===O?void 0:O.length)>0&&l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_NUMBER_WATER_CLOSETS_LABEL"),text:null==Sn||null===(b=Sn.SewerageConnections)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.proposedWaterClosets,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_NO_OF_TOILETS"),text:(null==Sn||null===(R=Sn.SewerageConnections)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.proposedToilets)||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}))),l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_COMMON_PLUMBER_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY"),text:("ULB"===(null==Sn||null===(W=Sn.WaterConnection)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.additionalDetails)||void 0===M?void 0:M.detailsProvidedBy)?sn("WS_PLUMBER_ULB"):sn("WS_PLUMBER_SELF"))||("ULB"===(null==Sn||null===(x=Sn.SewerageConnections)||void 0===x||null===(B=x[0])||void 0===B||null===(F=B.additionalDetails)||void 0===F?void 0:F.detailsProvidedBy)?sn("WS_PLUMBER_ULB"):sn("WS_PLUMBER_SELF"))||sn("NA"),textStyle:{whiteSpace:"pre"}}),("ULB"===(null==Sn||null===(U=Sn.WaterConnection)||void 0===U||null===(k=U[0])||void 0===k||null===(H=k.additionalDetails)||void 0===H?void 0:H.detailsProvidedBy)||"ULB"===(null==Sn||null===(j=Sn.SewerageConnections)||void 0===j||null===(V=j[0])||void 0===V||null===(z=V.additionalDetails)||void 0===z?void 0:z.detailsProvidedBy))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:sn("WS_PLUMBER_LIC_NO"),text:(null==Sn||null===(Y=Sn.WaterConnection)||void 0===Y||null===(G=Y[0])||void 0===G||null===(q=G.plumberInfo)||void 0===q||null===(K=q[0])||void 0===K?void 0:K.licenseNo)||(null==Sn||null===(X=Sn.SewerageConnections)||void 0===X||null===(Z=X[0])||void 0===Z||null===($=Z.plumberInfo)||void 0===$?void 0:$.licenseNo)||sn("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_PLUMBER_NAME_LABEL"),text:(null==Sn||null===(J=Sn.WaterConnection)||void 0===J||null===(Q=J[0])||void 0===Q||null===(ee=Q.plumberInfo)||void 0===ee||null===(ne=ee[0])||void 0===ne?void 0:ne.name)||(null==Sn||null===(te=Sn.SewerageConnections)||void 0===te||null===(le=te[0])||void 0===le||null===(oe=le.plumberInfo)||void 0===oe?void 0:oe.name)||"NA",textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_PLUMBER_MOB_NO"),text:(null==Sn||null===(ie=Sn.WaterConnection)||void 0===ie||null===(ae=ie[0])||void 0===ae||null===(re=ae.plumberInfo)||void 0===re||null===(ue=re[0])||void 0===ue?void 0:ue.mobileNumber)||(null==Sn||null===(de=Sn.SewerageConnections)||void 0===de||null===(se=de[0])||void 0===se||null===(ce=se.plumberInfo)||void 0===ce?void 0:ce.mobileNumber)||"NA",textStyle:{whiteSpace:"pre"},privacy:{uuid:pn,fieldName:["plumberInfoMobileNumber"],model:"WnSConnectionPlumber",showValue:!1,loadData:{serviceName:null!=pn&&pn.includes("WS")?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:vn,applicationNumber:pn},jsonPath:null!=pn&&pn.includes("WS")?"WaterConnection[0].plumberInfo[0].mobileNumber":"SewerageConnections[0].plumberInfo[0].mobileNumber",isArray:!1}}})))),l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_ROAD_CUTTING_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAIL_ROAD_TYPE"),text:null!=Sn&&null!==(ve=Sn.WaterConnection)&&void 0!==ve&&null!==(pe=ve[0])&&void 0!==pe&&null!==(me=pe.roadCuttingInfo)&&void 0!==me&&null!==(Ee=me[0])&&void 0!==Ee&&Ee.roadType||null!=Sn&&null!==(Se=Sn.SewerageConnections)&&void 0!==Se&&null!==(_e=Se[0])&&void 0!==_e&&null!==(fe=_e.roadCuttingInfo)&&void 0!==fe&&null!==(ge=fe[0])&&void 0!==ge&&ge.roadType?sn("WS_ROADTYPE_"+((null==Sn||null===(Ce=Sn.WaterConnection)||void 0===Ce||null===(Ne=Ce[0])||void 0===Ne||null===(ye=Ne.roadCuttingInfo)||void 0===ye||null===(De=ye[0])||void 0===De?void 0:De.roadType)||(null==Sn||null===(Te=Sn.SewerageConnections)||void 0===Te||null===(he=Te[0])||void 0===he||null===(Ae=he.roadCuttingInfo)||void 0===Ae||null===(Ie=Ae[0])||void 0===Ie?void 0:Ie.roadType))):sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_AREA_LABEL"),text:(null==Sn||null===(Oe=Sn.WaterConnection)||void 0===Oe||null===(be=Oe[0])||void 0===be||null===(Le=be.roadCuttingInfo)||void 0===Le||null===(Re=Le[0])||void 0===Re?void 0:Re.roadCuttingArea)||(null==Sn||null===(we=Sn.SewerageConnections)||void 0===we||null===(We=we[0])||void 0===We||null===(Pe=We.roadCuttingInfo)||void 0===Pe||null===(Me=Pe[0])||void 0===Me?void 0:Me.roadCuttingArea)||sn("NA"),textStyle:{whiteSpace:"pre"}}))),l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_ACTIVATION_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),text:null!=Sn&&null!==(xe=Sn.WaterConnection)&&void 0!==xe&&null!==(Be=xe[0])&&void 0!==Be&&Be.connectionExecutionDate||null!=Sn&&null!==(Fe=Sn.SewerageConnections)&&void 0!==Fe&&null!==(Ue=Fe[0])&&void 0!==Ue&&Ue.connectionExecutionDate?Digit.DateUtils.ConvertEpochToDate((null==Sn||null===(ke=Sn.WaterConnection)||void 0===ke||null===(He=ke[0])||void 0===He?void 0:He.connectionExecutionDate)||(null==Sn||null===(je=Sn.SewerageConnections)||void 0===je||null===(Ve=je[0])||void 0===Ve?void 0:Ve.connectionExecutionDate)):sn("NA"),textStyle:{whiteSpace:"pre"}}),(null==Sn?void 0:Sn.WaterConnection)&&(null==Sn||null===(ze=Sn.WaterConnection)||void 0===ze?void 0:ze.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_METER_ID"),text:(null==Sn||null===(Ye=Sn.WaterConnection)||void 0===Ye||null===(Ge=Ye[0])||void 0===Ge?void 0:Ge.meterId)||(null==Sn||null===(qe=Sn.SewerageConnections)||void 0===qe||null===(Ke=qe[0])||void 0===Ke?void 0:Ke.meterId)||sn("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAIL_METER_INSTALL_DATE"),text:null!=Sn&&null!==(Xe=Sn.WaterConnection)&&void 0!==Xe&&null!==(Ze=Xe[0])&&void 0!==Ze&&Ze.meterInstallationDate||null!=Sn&&null!==($e=Sn.SewerageConnections)&&void 0!==$e&&null!==(Je=$e[0])&&void 0!==Je&&Je.meterInstallationDate?Digit.DateUtils.ConvertEpochToDate((null==Sn||null===(Qe=Sn.WaterConnection)||void 0===Qe||null===(en=Qe[0])||void 0===en?void 0:en.meterInstallationDate)||(null==Sn||null===(nn=Sn.SewerageConnections)||void 0===nn||null===(tn=nn[0])||void 0===tn?void 0:tn.meterInstallationDate)):sn("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_INITIAL_METER_READING"),text:(null==Sn||null===(ln=Sn.WaterConnection)||void 0===ln||null===(on=ln[0])||void 0===on||null===(an=on.additionalDetails)||void 0===an?void 0:an.initialMeterReading)||(null==Sn||null===(rn=Sn.SewerageConnections)||void 0===rn||null===(un=rn[0])||void 0===un||null===(dn=un.additionalDetails)||void 0===dn?void 0:dn.initialMeterReading)||"NA",textStyle:{whiteSpace:"pre"}}))))))},WSMyConnections:e=>{var n,t,i,r,u,d,s,c;const{t:p}=o.useTranslation(),m=Digit.UserService.getUser(),E=(null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code)||(null==m||null===(t=m.info)||void 0===t?void 0:t.permanentCity)||Digit.ULBService.getCurrentTenantId();let S=window.location.href.split("/").pop(),_=isNaN(parseInt(S))?{tenantId:E,mobileNumber:null==m||null===(r=m.info)||void 0===r?void 0:r.mobileNumber,searchType:"CONNECTION"}:{tenantId:E,mobileNumber:null==m||null===(i=m.info)||void 0===i?void 0:i.mobileNumber,searchType:"CONNECTION"};const{isLoading:f,data:g}=Digit.Hooks.ws.useMyApplicationSearch({filters:_},{filters:_}),{isLoading:C,data:N}=Digit.Hooks.ws.useMyApplicationSearch({filters:_,BusinessService:"SW"},{filters:_});let y=null==g?void 0:g.WaterConnection.concat(null==N?void 0:N.SewerageConnections),D=g&&(null==g||null===(u=g.WaterConnection)||void 0===u?void 0:u.map(e=>null==e?void 0:e.propertyId).join(","))||"",T=N&&(null==N||null===(d=N.SewerageConnections)||void 0===d?void 0:d.map(e=>null==e?void 0:e.propertyId).join(","))||"",h=D.concat(T);const{isLoading:A,data:I}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:h}},{filters:{propertyIds:h},enabled:!!h});return y=y&&y.map(e=>{var n;return v({},e,{property:null==I||null===(n=I.Properties)||void 0===n?void 0:n.filter(n=>(null==n?void 0:n.propertyId)===(null==e?void 0:e.propertyId))[0]})}),f||A||C?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,null,p("WS_MYCONNECTIONS_HEADER")+" "+(y?"("+y.length+")":"")),l.createElement(j,{t:p}),l.createElement("div",null,(null===(s=y)||void 0===s?void 0:s.length)>0&&y.map((e,n)=>l.createElement("div",{key:n},l.createElement(Yi,{application:e}))),!(null!==(c=y)&&void 0!==c&&c.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},p("PT_NO_APPLICATION_FOUND_MSG"))))},WSCitizenConnectionDetails:()=>{var e,n,r,u,d,s,c,p,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,k,H,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn,sn,cn,vn,pn,mn,En,Sn,_n,fn,gn,Cn,Nn,yn,Dn,Tn,hn,An,In,On,bn,Ln,Rn,wn,Wn,Pn,Mn,xn,Bn,Fn,Un,kn,Hn,jn,Vn,zn,Yn,Gn,qn,Kn,Xn,Zn,$n,Jn,Qn,et,nt,tt,lt,ot,it,at,rt,ut,dt,st,ct,vt,pt,mt,Et,St,_t,ft,gt,Ct,Nt,yt,Dt,Tt,ht,At,It,Ot,bt,Lt,Rt,wt,Wt,Pt,Mt,xt,Bt,Ft,Ut,kt,Ht,jt,Vt,zt,Yt,Gt,qt,Kt,Xt,Zt,$t,Jt,Qt,el,nl,tl,ll,ol,il,al,rl,ul,dl,sl,cl;const{t:vl}=o.useTranslation(),pl=t.useRef(),ml=Digit.UserService.getUser(),El=i.useHistory(),Sl=(null===(e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===e?void 0:e.code)||(null==ml||null===(n=ml.info)||void 0===n?void 0:n.permanentCity)||Digit.ULBService.getCurrentTenantId(),[_l,fl]=t.useState(!1),gl=window.location.href.includes("SW_")?window.location.href.substring(window.location.href.indexOf("SW_")):window.location.href.substring(window.location.href.indexOf("WS_"));let{state:Cl={}}=i.useLocation();const[Nl,yl]=t.useState(!1),[Dl,Tl]=t.useState(null),hl=Digit.Utils.browser.isMobile();let Al={tenantId:Sl,applicationNumber:gl};var{isLoading:Il,data:Ol}=Digit.Hooks.ws.useMyApplicationSearch({filters:Al,BusinessService:null!=gl&&gl.includes("SW")?"SW":"WS"},{filters:Al,privacy:Digit.Utils.getPrivacyObject()},!0);let bl={tenantId:Sl,connectionNumber:null!=gl&&gl.includes("SW")?null==Ol||null===(r=Ol.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.connectionNo:null==Ol||null===(d=Ol.WaterConnection)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.connectionNo};var{data:Ll}=Digit.Hooks.ws.useMyApplicationSearch({filters:bl,BusinessService:null!=gl&&gl.includes("SW")?"SW":"WS"},{filters:bl,privacy:Digit.Utils.getPrivacyObject(),enabled:!(null==bl||!bl.connectionNumber)},!0);Cl=(null===(c=Object.keys(Cl))||void 0===c?void 0:c.length)>0?Cl:null!=gl&&gl.includes("WS")?null==Ll||null===(p=Ll.WaterConnection)||void 0===p?void 0:p[0]:null==Ll||null===(E=Ll.SewerageConnections)||void 0===E?void 0:E[0],Digit.Hooks.useClickOutside(pl,()=>{fl(!1)},_l);const{isLoading:Rl,data:wl}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:null==Ol||null===(S=Ol.WaterConnection)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.propertyId}},{filters:{propertyIds:null==Ol||null===(f=Ol.WaterConnection)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.propertyId},privacy:Digit.Utils.getPrivacyObject()}),Wl=Digit.Hooks.ws.useToCheckPrivacyEnablement({privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(C=Ol.WaterConnection)||void 0===C||null===(N=C[0])||void 0===N||null===(y=N.connectionHolders)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.uuid:null==Ol||null===(T=Ol.SewerageConnections)||void 0===T||null===(h=T[0])||void 0===h||null===(A=h.connectionHolders)||void 0===A||null===(I=A[0])||void 0===I?void 0:I.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner"}})||!1,Pl=()=>{Tl(null)};let Ml=null!=gl&&gl.includes("WS")?null==Ll?void 0:Ll.WaterConnection:null==Ll?void 0:Ll.SewerageConnections,xl=!1;if((null==Ml?void 0:Ml.length)>0){const e=null==Ml?void 0:Ml.filter(e=>"DISCONNECTION_EXECUTED"==(null==e?void 0:e.applicationStatus)&&(null==e?void 0:e.applicationType.includes("DISCONNECT")));null!=e&&e.length&&(xl=!0)}Digit.Hooks.useCommonMDMS(Sl,"common-masters","ReceiptKey",{select:e=>{var n,t,l;return(null===(n=e["common-masters"])||void 0===n||null===(t=n.uiCommonPay)||void 0===t||null===(l=t.filter(e=>{let{code:n}=e;return"WS".includes(n)})[0])||void 0===l?void 0:l.receiptKey)||"consolidatedreceipt"}});let Bl=[];Bl.push({order:1,label:vl("WS_CONNECTION_DETAILS"),onClick:()=>function(){try{var e,n,t,l,o,i,a;const r=(null==Ol||null===(e=Ol.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==Ol||null===(t=Ol.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId);let u=(null==Ol||null===(o=Ol.WaterConnection)||void 0===o?void 0:o[0])||(null==Ol||null===(i=Ol.SewerageConnections)||void 0===i?void 0:i[0]);return Hi(v({},u),v({},null==wl||null===(a=wl.Properties)||void 0===a?void 0:a[0]),r,vl).then(e=>Digit.Utils.pdf.generatev1(e)),fl(!1),Promise.resolve()}catch(e){return Promise.reject(e)}}()}),vl("WS_APPLICATION"),vl("WS_RECEIPT_APPLICATION_FEE"),Bl.sort(function(e,n){return e.order-n.order});const Fl=null===(O=Cl)||void 0===O||null===(b=O.applicationNo)||void 0===b?void 0:b.includes("SW"),Ul={consumerCode:null===(L=Cl)||void 0===L?void 0:L.connectionNo},kl=Digit.Hooks.useFetchBillsForBuissnessService(v({businessService:Fl?"SW":"WS"},Ul,{tenantId:Sl}),{retry:!1}),Hl=()=>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"})),jl=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Vl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Hl,null));if(Il||Rl)return l.createElement(a.Loader,null);sessionStorage.setItem("ApplicationNoState",null===(R=Cl)||void 0===R?void 0:R.applicationNo);let zl=null!==(w=Cl)&&void 0!==w&&null!==(W=w.applicationType)&&void 0!==W&&W.includes("WATER")?"WATER":"SEWERAGE";return l.createElement(l.Fragment,null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(a.Header,null,vl("WS_COMMON_CONNECTION_DETAIL")),Bl&&Bl.length>0&&l.createElement("div",{ref:pl},l.createElement(a.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>fl(!_l),displayOptions:_l,options:Bl,optionsStyle:{margin:"0px"}}))),Wl&&l.createElement(j,{t:vl}),l.createElement("div",{className:"hide-seperator"},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:vl("WS_MYCONNECTIONS_CONSUMER_NO"),text:null===(P=Cl)||void 0===P?void 0:P.connectionNo}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERVICE_NAME_LABEL"),text:vl("WS_APPLICATION_TYPE_"+(null===(M=Cl)||void 0===M?void 0:M.applicationType)),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_STATUS"),text:(null===(x=Cl)||void 0===x?void 0:x.status)||"NA",textStyle:{whiteSpace:"pre"}})),l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},vl("WS_COMMON_CONNECTION_DETAIL")),l.createElement(a.StatusTable,null,(null===(B=Cl)||void 0===B||null===(F=B.applicationType)||void 0===F?void 0:F.includes("WATER"))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:vl("WS_COMMON_TABLE_COL_CONNECTIONTYPE_LABEL"),text:(null===(k=Cl)||void 0===k?void 0:k.connectionType)||vl("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_NO_OF_TAPS"),text:null===(H=Cl)||void 0===H?void 0:H.noOfTaps,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_PIPE_SIZE_IN_INCHES_LABEL"),text:(null===(V=Cl)||void 0===V?void 0:V.pipeSize)||"NA",textStyle:{whiteSpace:"pre"}})),(null===(z=Cl)||void 0===z||null===(Y=z.applicationType)||void 0===Y?void 0:Y.includes("SEWERAGE"))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:vl("WS_CONN_DETAIL_WATER_CLOSETS"),text:null===(G=Cl)||void 0===G?void 0:G.proposedWaterClosets,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_NO_OF_TOILETS"),text:(null===(q=Cl)||void 0===q?void 0:q.proposedToilets)||vl("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),text:null!==(K=Cl)&&void 0!==K&&K.connectionExecutionDate?Digit.DateUtils.ConvertEpochToDate(null===(X=Cl)||void 0===X?void 0:X.connectionExecutionDate):vl("CS_NA"),textStyle:{whiteSpace:"pre"}})),(null===(Z=Cl)||void 0===Z||null===($=Z.applicationType)||void 0===$?void 0:$.includes("WATER"))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_WATER_SOURCE"),text:vl("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null===(J=Cl)||void 0===J||null===(Q=J.waterSource)||void 0===Q||null===(ee=Q.split("."))||void 0===ee?void 0:ee[0],".","_"))||vl("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null===(ne=Cl)||void 0===ne?void 0:ne.waterSource,".","_"))||vl("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_WATER_SUB_SOURCE"),text:vl(null===(te=Cl)||void 0===te||null===(le=te.waterSource)||void 0===le||null===(oe=le.split("."))||void 0===oe?void 0:oe[1])||vl("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),text:Digit.DateUtils.ConvertEpochToDate(null===(ie=Cl)||void 0===ie?void 0:ie.connectionExecutionDate)||vl("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_METER_ID"),text:null===(ae=Cl)||void 0===ae?void 0:ae.meterId,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_ADDN_DETAIL_METER_INSTALL_DATE"),text:Digit.DateUtils.ConvertEpochToDate(null===(re=Cl)||void 0===re?void 0:re.meterInstallationDate)||"NA",textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_ADDN_DETAILS_INITIAL_METER_READING"),text:(null===(ue=Cl)||void 0===ue||null===(de=ue.additionalDetails)||void 0===de?void 0:de.initialMeterReading)||"NA",textStyle:{whiteSpace:"pre"}})),"Metered"===(null===(se=Cl)||void 0===se?void 0:se.connectionType)&&l.createElement(i.Link,{to:"/digit-ui/citizen/ws/consumption/details?applicationNo="+(null===(ce=Cl)||void 0===ce?void 0:ce.connectionNo)},l.createElement(a.LinkButton,{style:{textAlign:"left",marginBottom:"10px",marginTop:"5px"},label:vl("WS_CONNECTION_DETAILS_VIEW_CONSUMPTION_LABEL")}))),l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},vl("WS_COMMON_PROPERTY_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:vl("WS_PROPERTY_ID_LABEL"),text:null===(ve=Cl)||void 0===ve?void 0:ve.propertyId}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:null===(pe=Cl)||void 0===pe||null===(me=pe.property)||void 0===me||null===(Ee=me.owners)||void 0===Ee?void 0:Ee.map(e=>e.name).join(","),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_PROPADD"),text:(Yl=null==wl||null===(Se=wl.Properties)||void 0===Se||null===(_e=Se[0])||void 0===_e?void 0:_e.address,(null!=Yl&&Yl.doorNo?(null==Yl?void 0:Yl.doorNo)+", ":"")+(null!=Yl&&Yl.street?(null==Yl?void 0:Yl.street)+", ":"")+(null!=Yl&&Yl.landmark?(null==Yl?void 0:Yl.landmark)+", ":"")+(null!=Yl&&null!==(Gl=Yl.locality)&&void 0!==Gl&&Gl.code?vl("TENANTS_MOHALLA_"+(null==Yl||null===(ql=Yl.locality)||void 0===ql?void 0:ql.code)):"")+(null!=Yl&&null!==(Kl=Yl.city)&&void 0!==Kl&&Kl.code||null!=Yl&&Yl.city?", "+vl((null==Yl?void 0:Yl.city.code)||(null==Yl?void 0:Yl.city)):"")+(null!=Yl&&Yl.pincode?", "+Yl.pincode:" ")||vl("CS_NA")),textStyle:{wordBreak:"break-word"},privacy:{uuid:null==wl||null===(fe=wl.Properties)||void 0===fe||null===(ge=fe[0])||void 0===ge||null===(Ce=ge.owners)||void 0===Ce||null===(Ne=Ce[0])||void 0===Ne?void 0:Ne.uuid,fieldName:["doorNo","street","landmark"],model:"Property",hide:!(null!=wl&&null!==(ye=wl.Properties)&&void 0!==ye&&null!==(De=ye[0])&&void 0!==De&&De.address),showValue:!0,loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:Sl,propertyIds:null===(Te=Cl)||void 0===Te?void 0:Te.propertyId},jsonPath:"Properties[0].address.street",isArray:!1,d:e=>(U.get(e,"Properties[0].address.doorNo")?U.get(e,"Properties[0].address.doorNo")+", ":"")+(U.get(e,"Properties[0].address.street")?U.get(e,"Properties[0].address.street")+", ":"")+(U.get(e,"Properties[0].address.landmark")?""+U.get(e,"Properties[0].address.landmark"):"")}}}),l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+(null===(he=Cl)||void 0===he?void 0:he.propertyId)+"&tenantId="+(null===(Ae=Cl)||void 0===Ae?void 0:Ae.tenantId)},l.createElement(a.LinkButton,{style:{textAlign:"left",marginBottom:"10px",marginTop:"5px"},label:vl("WS_VIEW_PROPERTY")}))),l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},vl("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),null!==(Ie=Cl)&&void 0!==Ie&&Ie.connectionHolders?l.createElement("div",null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:null===(Oe=Cl)||void 0===Oe||null===(be=Oe.connectionHolders)||void 0===be||null===(Le=be[0])||void 0===Le?void 0:Le.name,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_GENDER_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(Re=Ol.WaterConnection)||void 0===Re||null===(we=Re[0])||void 0===we||null===(We=we.connectionHolders)||void 0===We||null===(Pe=We[0])||void 0===Pe?void 0:Pe.gender:null==Ol||null===(Me=Ol.SewerageConnections)||void 0===Me||null===(xe=Me[0])||void 0===xe||null===(Be=xe.connectionHolders)||void 0===Be||null===(Fe=Be[0])||void 0===Fe?void 0:Fe.gender,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Ue=Ol.WaterConnection)||void 0===Ue||null===(ke=Ue[0])||void 0===ke||null===(He=ke.connectionHolders)||void 0===He||null===(je=He[0])||void 0===je?void 0:je.uuid:null==Ol||null===(Ve=Ol.SewerageConnections)||void 0===Ve||null===(ze=Ve[0])||void 0===ze||null===(Ye=ze.connectionHolders)||void 0===Ye||null===(Ge=Ye[0])||void 0===Ge?void 0:Ge.uuid,fieldName:"gender",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].gender":"SewerageConnections[0].connectionHolders[0].gender",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_MOBILE_NO_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(qe=Ol.WaterConnection)||void 0===qe||null===(Ke=qe[0])||void 0===Ke||null===(Xe=Ke.connectionHolders)||void 0===Xe||null===(Ze=Xe[0])||void 0===Ze?void 0:Ze.mobileNumber:null==Ol||null===($e=Ol.SewerageConnections)||void 0===$e||null===(Je=$e[0])||void 0===Je||null===(Qe=Je.connectionHolders)||void 0===Qe||null===(en=Qe[0])||void 0===en?void 0:en.mobileNumber,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(nn=Ol.WaterConnection)||void 0===nn||null===(tn=nn[0])||void 0===tn||null===(ln=tn.connectionHolders)||void 0===ln||null===(on=ln[0])||void 0===on?void 0:on.uuid:null==Ol||null===(an=Ol.SewerageConnections)||void 0===an||null===(rn=an[0])||void 0===rn||null===(un=rn.connectionHolders)||void 0===un||null===(dn=un[0])||void 0===dn?void 0:dn.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].mobileNumber":"SewerageConnections[0].connectionHolders[0].mobileNumber",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_FATHER_OR_HUSBAND_NAME"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(sn=Ol.WaterConnection)||void 0===sn||null===(cn=sn[0])||void 0===cn||null===(vn=cn.connectionHolders)||void 0===vn||null===(pn=vn[0])||void 0===pn?void 0:pn.fatherOrHusbandName:null==Ol||null===(mn=Ol.SewerageConnections)||void 0===mn||null===(En=mn[0])||void 0===En||null===(Sn=En.connectionHolders)||void 0===Sn||null===(_n=Sn[0])||void 0===_n?void 0:_n.fatherOrHusbandName,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(fn=Ol.WaterConnection)||void 0===fn||null===(gn=fn[0])||void 0===gn||null===(Cn=gn.connectionHolders)||void 0===Cn||null===(Nn=Cn[0])||void 0===Nn?void 0:Nn.uuid:null==Ol||null===(yn=Ol.SewerageConnections)||void 0===yn||null===(Dn=yn[0])||void 0===Dn||null===(Tn=Dn.connectionHolders)||void 0===Tn||null===(hn=Tn[0])||void 0===hn?void 0:hn.uuid,fieldName:"fatherOrHusbandName",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].fatherOrHusbandName":"SewerageConnections[0].connectionHolders[0].fatherOrHusbandName",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_RELATION_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(An=Ol.WaterConnection)||void 0===An||null===(In=An[0])||void 0===In||null===(On=In.connectionHolders)||void 0===On||null===(bn=On[0])||void 0===bn?void 0:bn.relationship:null==Ol||null===(Ln=Ol.SewerageConnections)||void 0===Ln||null===(Rn=Ln[0])||void 0===Rn||null===(wn=Rn.connectionHolders)||void 0===wn||null===(Wn=wn[0])||void 0===Wn?void 0:Wn.relationship,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Pn=Ol.WaterConnection)||void 0===Pn||null===(Mn=Pn[0])||void 0===Mn||null===(xn=Mn.connectionHolders)||void 0===xn||null===(Bn=xn[0])||void 0===Bn?void 0:Bn.uuid:null==Ol||null===(Fn=Ol.SewerageConnections)||void 0===Fn||null===(Un=Fn[0])||void 0===Un||null===(kn=Un.connectionHolders)||void 0===kn||null===(Hn=kn[0])||void 0===Hn?void 0:Hn.uuid,fieldName:"relationship",model:"WnSConnection",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].relationship":"SewerageConnections[0].connectionHolders[0].relationship",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_CROSADD"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(jn=Ol.WaterConnection)||void 0===jn||null===(Vn=jn[0])||void 0===Vn||null===(zn=Vn.connectionHolders)||void 0===zn||null===(Yn=zn[0])||void 0===Yn?void 0:Yn.correspondenceAddress:null==Ol||null===(Gn=Ol.SewerageConnections)||void 0===Gn||null===(qn=Gn[0])||void 0===qn||null===(Kn=qn.connectionHolders)||void 0===Kn||null===(Xn=Kn[0])||void 0===Xn?void 0:Xn.correspondenceAddress,privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Zn=Ol.WaterConnection)||void 0===Zn||null===($n=Zn[0])||void 0===$n||null===(Jn=$n.connectionHolders)||void 0===Jn||null===(Qn=Jn[0])||void 0===Qn?void 0:Qn.uuid:null==Ol||null===(et=Ol.SewerageConnections)||void 0===et||null===(nt=et[0])||void 0===nt||null===(tt=nt.connectionHolders)||void 0===tt||null===(lt=tt[0])||void 0===lt?void 0:lt.uuid,fieldName:"correspondenceAddress",model:"WnSConnectionOwner",hide:!(null!==(ot=Cl)&&void 0!==ot&&ot.connectionHolders),showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].correspondenceAddress":"SewerageConnections[0].connectionHolders[0].correspondenceAddress",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_SPECIAL_APPLICANT_LABEL"),text:(null!=gl&&gl.includes("WS")?null!=Ol&&null!==(it=Ol.WaterConnection)&&void 0!==it&&null!==(at=it[0])&&void 0!==at&&null!==(rt=at.connectionHolders)&&void 0!==rt&&null!==(ut=rt[0])&&void 0!==ut&&null!==(dt=ut.ownerType)&&void 0!==dt&&dt.includes("*"):null!=Ol&&null!==(st=Ol.SewerageConnections)&&void 0!==st&&null!==(ct=st[0])&&void 0!==ct&&null!==(vt=ct.connectionHolders)&&void 0!==vt&&null!==(pt=vt[0])&&void 0!==pt&&null!==(mt=pt.ownerType)&&void 0!==mt&&mt.includes("*"))?null!=gl&&gl.includes("WS")?null==Ol||null===(Dt=Ol.WaterConnection)||void 0===Dt||null===(Tt=Dt[0])||void 0===Tt||null===(ht=Tt.connectionHolders)||void 0===ht||null===(At=ht[0])||void 0===At?void 0:At.ownerType:null==Ol||null===(It=Ol.SewerageConnections)||void 0===It||null===(Ot=It[0])||void 0===Ot||null===(bt=Ot.connectionHolders)||void 0===bt||null===(Lt=bt[0])||void 0===Lt?void 0:Lt.ownerType:vl("COMMON_MASTERS_OWNERTYPE_"+(null!=gl&&gl.includes("WS")?null==Ol||null===(Et=Ol.WaterConnection)||void 0===Et||null===(St=Et[0])||void 0===St||null===(_t=St.connectionHolders)||void 0===_t||null===(ft=_t[0])||void 0===ft?void 0:ft.ownerType:null==Ol||null===(gt=Ol.SewerageConnections)||void 0===gt||null===(Ct=gt[0])||void 0===Ct||null===(Nt=Ct.connectionHolders)||void 0===Nt||null===(yt=Nt[0])||void 0===yt?void 0:yt.ownerType)),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Rt=Ol.WaterConnection)||void 0===Rt||null===(wt=Rt[0])||void 0===wt||null===(Wt=wt.connectionHolders)||void 0===Wt||null===(Pt=Wt[0])||void 0===Pt?void 0:Pt.uuid:null==Ol||null===(Mt=Ol.SewerageConnections)||void 0===Mt||null===(xt=Mt[0])||void 0===xt||null===(Bt=xt.connectionHolders)||void 0===Bt||null===(Ft=Bt[0])||void 0===Ft?void 0:Ft.uuid,fieldName:"ownerType",model:"WnSConnection",hide:!(null!==(Ut=Cl)&&void 0!==Ut&&null!==(kt=Ut.connectionHolders)&&void 0!==kt&&null!==(Ht=kt[0])&&void 0!==Ht&&Ht.ownerType),showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].ownerType":"SewerageConnections[0].connectionHolders[0].ownerType",isArray:!1,d:e=>{var n,t,l,o,i,a,r,u,d,s,c;return null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n[0]?vl("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(t=e.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.connectionHolders)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.ownerType)||void 0===a?void 0:a.toUpperCase())):vl("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(r=e.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.ownerType)||void 0===c?void 0:c.toUpperCase()))}}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_EMAIL_IDNO_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(jt=Ol.WaterConnection)||void 0===jt||null===(Vt=jt[0])||void 0===Vt||null===(zt=Vt.connectionHolders)||void 0===zt||null===(Yt=zt[0])||void 0===Yt?void 0:Yt.emailId:null==Ol||null===(Gt=Ol.SewerageConnections)||void 0===Gt||null===(qt=Gt[0])||void 0===qt||null===(Kt=qt.connectionHolders)||void 0===Kt||null===(Xt=Kt[0])||void 0===Xt?void 0:Xt.emailId,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Zt=Ol.WaterConnection)||void 0===Zt||null===($t=Zt[0])||void 0===$t||null===(Jt=$t.connectionHolders)||void 0===Jt||null===(Qt=Jt[0])||void 0===Qt?void 0:Qt.uuid:null==Ol||null===(el=Ol.SewerageConnections)||void 0===el||null===(nl=el[0])||void 0===nl||null===(tl=nl.connectionHolders)||void 0===tl||null===(ll=tl[0])||void 0===ll?void 0:ll.uuid,fieldName:"connectionHoldersEmailId",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].emailId":"SewerageConnections[0].connectionHolders[0].emailId",isArray:!1}}}))):l.createElement(a.CardText,null,vl("WS_PROPERTY_OWNER_SAME_AS_CONN_HOLDERS")),"inactive"===(null===(ol=Cl)||void 0===ol?void 0:ol.status)&&"Inactive"===(null===(il=Cl)||void 0===il?void 0:il.applicationStatus)&&"INACTIVE"===(null===(al=Cl)||void 0===al?void 0:al.applicationStatus)||xl?"DISCONNECTION_EXECUTED"==(null===(rl=Cl)||void 0===rl?void 0:rl.applicationStatus)&&"Inactive"==(null===(ul=Cl)||void 0===ul?void 0:ul.status)&&(null===(dl=Cl)||void 0===dl?void 0:dl.isDisconnectionTemporary)&&l.createElement(a.ActionBar,{style:{position:"relative",boxShadow:"none",minWidth:"240px",maxWidth:"310px",padding:"0px",marginTop:"15px"}},l.createElement("div",{style:{width:"100%"}},l.createElement(a.SubmitBar,{style:{width:"100%"},label:vl("WS_RECONNECTION_BUTTON"),onSubmit:function(){(()=>{var e,n,t,l,o,i,a,r,u,d,s;if(console.log("getRestorationButton",Ol,!(null!=Ol&&Ol.checkWorkFlow)),console.log("Payment",kl),null!=Ol&&Ol.checkWorkFlow){if(0===(null==kl||null===(e=kl.data)||void 0===e||null===(n=e.Bill)||void 0===n?void 0:n.length)){console.log("Payment",kl);let e="/digit-ui/citizen/ws/restoration-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else if((null==kl||null===(t=kl.data)||void 0===t||null===(l=t.Bill)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.totalAmount)<0){let e="/digit-ui/citizen/ws/restore-application/restoration-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else if(0!==(null==kl||null===(i=kl.data)||void 0===i||null===(a=i.Bill)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.totalAmount))yl(!0);else if(0==(null==kl||null===(u=kl.data)||void 0===u||null===(d=u.Bill)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.totalAmount)){let e="/digit-ui/citizen/ws/restore-application/restoration-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}}else Tl({key:"error",label:"CONNECTION_INPROGRESS_LABEL"}),setTimeout(()=>{Pl()},5e3)})()}}))):l.createElement(a.ActionBar,{style:{position:"relative",boxShadow:"none",minWidth:"240px",maxWidth:"310px",padding:"0px",marginTop:"15px"}},l.createElement("div",{style:{width:"100%"}},l.createElement(a.SubmitBar,{style:{width:"100%"},label:vl("WS_DISCONNECTION_BUTTON"),onSubmit:function(){(()=>{var e,n,t,l,o,i,a,r;if(null!=Ol&&Ol.checkWorkFlow)if(0===(null==kl||null===(e=kl.data)||void 0===e||null===(n=e.Bill)||void 0===n?void 0:n.length)){let e="/digit-ui/citizen/ws/disconnect-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else if((null==kl||null===(t=kl.data)||void 0===t||null===(l=t.Bill)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.totalAmount)<0){let e="/digit-ui/citizen/ws/disconnect-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else 0!==(null==kl||null===(i=kl.data)||void 0===i||null===(a=i.Bill)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.totalAmount)&&yl(!0);else Tl({key:"error",label:"CONNECTION_INPROGRESS_LABEL"}),setTimeout(()=>{Pl()},5e3)})()}}))),Nl?l.createElement(a.Modal,{open:Nl,headerBarMain:l.createElement(jl,{label:vl("WS_PENDING_DUES_LABEL")}),headerBarEnd:l.createElement(Vl,{onClick:()=>yl(!1)}),center:!0,formId:"modal-action",actionSingleLabel:vl("COMMON_MAKE_PAYMENT"),hideSubmit:!0,actionSingleSubmit:()=>{var e,n;El.push("/digit-ui/citizen/payment/collect/"+(Fl?"SW":"WS")+"/"+encodeURIComponent(null===(e=Cl)||void 0===e?void 0:e.connectionNo)+"/"+Sl+"?consumerCode="+(null===(n=Cl)||void 0===n?void 0:n.connectionNo)+"&&tenantId="+Sl+"&&workflow=WNS"),yl(!1)},popupStyles:hl?{width:"720px"}:{},style:hl?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:hl?{paddingLeft:"5px"}:{}},l.createElement("div",{className:"modal-header-ws"},vl("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL")," "),l.createElement("div",{className:"modal-body-ws"},l.createElement("span",null,vl("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),": ₹",Number(null==kl||null===(sl=kl.data)||void 0===sl||null===(cl=sl.Bill[0])||void 0===cl?void 0:cl.totalAmount).toFixed(2))," ")):null),Dl&&l.createElement(a.Toast,{style:{bottom:"150px"},error:Dl.key,label:vl(""+Dl.label),onClose:Pl})));var Yl,Gl,ql,Kl},WSCitizenConsumptionDetails:e=>{var n,t;const{t:i}=o.useTranslation(),r=Digit.UserService.getUser(),u=(null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code)||(null==r||null===(t=r.info)||void 0===t?void 0:t.permanentCity)||Digit.ULBService.getCurrentTenantId(),{applicationNo:d}=Digit.Hooks.useQueryParams();let s={tenantId:u,connectionNos:d};const{isLoading:c,data:v}=Digit.Hooks.ws.useWSConsumptionSearch({filters:s},{filters:s});if(c)return l.createElement(a.Loader,null);let{meterReadings:p}=v||{};return l.createElement(l.Fragment,null,l.createElement(a.Header,null,""+i("WS_VIEW_CONSUMPTION")),l.createElement("div",null,(null==p?void 0:p.length)>0&&p.map((e,n)=>{return l.createElement("div",{key:n},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:i("WS_MYCONNECTIONS_CONSUMER_NO"),text:(null==e?void 0:e.connectionNo)||i("NA"),textStyle:{}}),l.createElement(a.Row,{className:"border-none",label:i("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),text:(null==e?void 0:e.billingPeriod)||i("NA"),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_METER_STATUS_LABEL"),text:(null==e?void 0:e.meterStatus)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),text:(null==e?void 0:e.lastReading)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),text:Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.lastReadingDate)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_CURRENT_READING_LABEL"),text:(null==e?void 0:e.currentReading)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),text:Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.currentReadingDate)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_CONSUMPTION_LABEL"),text:(t=null==e?void 0:e.currentReading,o=null==e?void 0:e.lastReading,t&&o?Number(t-o):i("NA")),textStyle:{whiteSpace:"pre"}}))));var t,o}),!(null!=p&&p.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},i("WS_NO_CONSUMPTION_FOUND"))))},WSMyPayments:()=>{var e,n,t,i,r,u,d,s,c,p,m,E,S,_,f,g,C;const{t:N}=o.useTranslation(),y=Digit.UserService.getUser(),D=(null===(e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===e?void 0:e.code)||(null==y||null===(n=y.info)||void 0===n?void 0:n.permanentCity)||Digit.ULBService.getCurrentTenantId();let T=window.location.href.split("/").pop(),h=isNaN(parseInt(T))?{tenantId:D,mobileNumber:null==y||null===(i=y.info)||void 0===i?void 0:i.mobileNumber,searchType:"CONNECTION"}:{tenantId:D,mobileNumber:null==y||null===(t=y.info)||void 0===t?void 0:t.mobileNumber,searchType:"CONNECTION"};const{isLoading:A,data:I}=Digit.Hooks.ws.useMyApplicationSearch({filters:h},{filters:h}),{isLoading:O,data:b}=Digit.Hooks.ws.useMyApplicationSearch({filters:h,BusinessService:"SW"},{filters:h});let L=null==I||null===(r=I.WaterConnection)||void 0===r?void 0:r.concat(null==b?void 0:b.SewerageConnections),R=I&&(null==I||null===(u=I.WaterConnection)||void 0===u?void 0:u.length)>0?null==I||null===(d=I.WaterConnection)||void 0===d?void 0:d.map(e=>e.connectionNo).join(","):null,w=b&&(null==b||null===(s=b.SewerageConnections)||void 0===s?void 0:s.length)>0?null==b||null===(c=b.SewerageConnections)||void 0===c?void 0:c.map(e=>e.connectionNo).join(","):null,W=I&&(null==I||null===(p=I.WaterConnection)||void 0===p?void 0:p.length)>0?null==I||null===(m=I.WaterConnection)||void 0===m?void 0:m.map(e=>e.propertyId).join(","):null,P=b&&(null==b||null===(E=b.SewerageConnections)||void 0===E?void 0:E.length)>0?null==b||null===(S=b.SewerageConnections)||void 0===S?void 0:S.map(e=>e.propertyId).join(","):null,M=W?null==W?void 0:W.concat(",",P):null==P?void 0:P.concat(",",W);const{data:x,isLoading:B}=Digit.Hooks.ws.useMypaymentWS({tenantId:D,filters:{consumerCodes:R},BusinessService:"WS"},{enabled:null!==R}),{data:F,isLoading:U}=Digit.Hooks.ws.useMypaymentWS({tenantId:D,filters:{consumerCodes:w},BusinessService:"SW"},{enabled:null!==w}),{data:k,isLoading:H}=Digit.Hooks.ws.useWaterPropertySearch({tenantId:D,filters:{propertyids:M}},{enabled:null!==w});if(A||B||U||O||H)return l.createElement(a.Loader,null);let V=(x&&(null==x?void 0:x.Payments)||[]).concat(F&&(null==F?void 0:F.Payments)||[]);return V=null===(_=V)||void 0===_?void 0:_.map(e=>{var n;return v({},e,{details:null==L||null===(n=L.filter(n=>{var t,l,o;return(null==n?void 0:n.connectionNo)===(null==e||null===(t=e.paymentDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.bill)||void 0===o?void 0:o.consumerCode)}))||void 0===n?void 0:n[0]})}),V=null===(f=V)||void 0===f?void 0:f.map(e=>{var n,t;return v({},e,{property:null==k||null===(n=k.Properties)||void 0===n||null===(t=n.filter(n=>{var t;return(null==n?void 0:n.propertyId)===(null==e||null===(t=e.details)||void 0===t?void 0:t.propertyId)}))||void 0===t?void 0:t[0]})}),l.createElement(l.Fragment,null,l.createElement(a.Header,null,N("WS_MY_PAYMENTS_HEADER")+" "+(V?"("+V.length+")":"")),l.createElement(j,{t:N}),l.createElement("div",null,(null===(g=V)||void 0===g?void 0:g.length)>0&&V.map((e,n)=>l.createElement("div",{key:n},l.createElement(ji,{application:e}))),!(null!==(C=V)&&void 0!==C&&C.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},N("PT_NO_APPLICATION_FOUND_MSG"))))},WSCitizenEditApplication:e=>{var n,r,u,s,c,p,m;const E=d.useQueryClient();let S=i.useRouteMatch();const{t:_}=o.useTranslation();let{tenantId:f}=i.useParams();const{pathname:g,state:C}=i.useLocation(),N=i.useHistory();let y=(null==C?void 0:C.id)||sessionStorage.getItem("ApplicationNoState"),D=[],T={},h={};const[A,I,O]=Digit.Hooks.useSessionStorage("WS_EDIT_APPLICATION",{}),b=Digit.ULBService.getStateId();let{data:L,isLoading:R}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(b,{}),w={};y&&(w.applicationNumber=y),f&&(w.tenantId=f);const{data:W}=Digit.Hooks.ws.useWaterSearch({tenantId:f,filters:v({},w,{isInternalCall:!0}),BusinessService:"WS",t:_},{enabled:!(!y||!y.includes("WS"))}),{data:P}=Digit.Hooks.ws.useSewarageSearch({tenantId:f,filters:v({},w,{isInternalCall:!0}),BusinessService:"SW",t:_},{enabled:!(!y||!y.includes("SW"))});let M=window.location.href.includes("/modify-connection/")||window.location.href.includes("/edit-application/");t.useEffect(()=>{var e,n;if(T=W,h=P,(W&&T||P&&h)&&(!(Object.keys(A).length>0)||T&&(null==A?void 0:A.applicationNo)!==(null===(e=T)||void 0===e?void 0:e.applicationNo)||h&&(null==A?void 0:A.applicationNo)!==(null===(n=h)||void 0===n?void 0:n.applicationNo))){T=W,h=P,window.location.href.includes("edit-application")?(T&&(T.isEditApplication=!0,T.isModifyConnection=!1),h&&(h.isEditApplication=!0,h.isModifyConnection=!1)):window.location.href.includes("modify-connection")&&(T&&(T.isModifyConnection=!0,T.isEditApplication=!1),h&&(h.isModifyConnection=!0,h.isEditApplication=!1)),sessionStorage.setItem("WaterInitialObject",JSON.stringify(v({},T))),sessionStorage.setItem("SewerageInitialObject",JSON.stringify(v({},h)));let e=((e,n,t)=>{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me;if(e)e.ConnectionHolderDetails=null!=e&&e.connectionHolders?v({},null==e||null===(l=e.connectionHolders)||void 0===l?void 0:l[0],{address:null==e||null===(o=e.connectionHolders)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=e&&null!==(a=e.connectionHolders)&&void 0!==a&&null!==(r=a[0])&&void 0!==r&&r.gender?{code:null==e||null===(u=e.connectionHolders)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.gender,i18nKey:"COMMON_GENDER_"+(null==e||null===(s=e.connectionHolders)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.gender)}:null,guardian:null==e||null===(p=e.connectionHolders)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.fatherOrHusbandName,isOwnerSame:!((null==e||null===(E=e.connectionHolders)||void 0===E?void 0:E.length)>0),mobileNumber:null==e||null===(S=e.connectionHolders)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.mobileNumber,name:null==e||null===(f=e.connectionHolders)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.name,relationship:null!=e&&null!==(C=e.connectionHolders)&&void 0!==C&&null!==(N=C[0])&&void 0!==N&&N.relationship?{code:null==e||null===(y=e.connectionHolders)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==e||null===(T=e.connectionHolders)||void 0===T||null===(h=T[0])||void 0===h?void 0:h.relationship)}:null,specialCategoryType:null!=e&&null!==(A=e.connectionHolders)&&void 0!==A&&null!==(I=A[0])&&void 0!==I&&I.ownerType?{code:null==e||null===(O=e.connectionHolders)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==e||null===(L=e.connectionHolders)||void 0===L||null===(R=L[0])||void 0===R?void 0:R.ownerType)}:""}):{address:null==e||null===(w=e.property)||void 0===w||null===(W=w.owners)||void 0===W||null===(P=W[0])||void 0===P?void 0:P.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=e&&null!==(M=e.property)&&void 0!==M&&null!==(x=M.owners)&&void 0!==x&&null!==(B=x[0])&&void 0!==B&&B.gender?{code:null==e||null===(F=e.property)||void 0===F||null===(U=F.owners)||void 0===U||null===(k=U[0])||void 0===k?void 0:k.gender,i18nKey:"COMMON_GENDER_"+(null==e||null===(H=e.property)||void 0===H||null===(j=H.owners)||void 0===j||null===(V=j[0])||void 0===V?void 0:V.gender)}:null,guardian:null==e||null===(z=e.property)||void 0===z||null===(Y=z.owners)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.fatherOrHusbandName,isOwnerSame:null==e||!e.connectionHolders,mobileNumber:null==e||null===(q=e.property)||void 0===q||null===(K=q.owners)||void 0===K||null===(X=K[0])||void 0===X?void 0:X.mobileNumber,name:null==e||null===(Z=e.property)||void 0===Z||null===($=Z.owners)||void 0===$||null===(J=$[0])||void 0===J?void 0:J.name,relationship:null!=e&&null!==(Q=e.property)&&void 0!==Q&&null!==(ee=Q.owners)&&void 0!==ee&&null!==(ne=ee[0])&&void 0!==ne&&ne.relationship?{code:null==e||null===(te=e.property)||void 0===te||null===(le=te.owners)||void 0===le||null===(oe=le[0])||void 0===oe?void 0:oe.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==e||null===(ie=e.property)||void 0===ie||null===(ae=ie.owners)||void 0===ae||null===(re=ae[0])||void 0===re?void 0:re.relationship)}:null,specialCategoryType:null!=e&&null!==(ue=e.connectionHolders)&&void 0!==ue&&null!==(de=ue[0])&&void 0!==de&&de.ownerType?{code:null==e||null===(se=e.connectionHolders)||void 0===se||null===(ce=se[0])||void 0===ce?void 0:ce.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==e||null===(ve=e.connectionHolders)||void 0===ve||null===(pe=ve[0])||void 0===pe?void 0:pe.ownerType)}:""},e.WaterConnectionResult={WaterConnection:[v({},e)]},e.cpt={details:v({},null==e?void 0:e.property)},e.cptId={id:null==e?void 0:e.propertyId},e.documents={documents:null==e?void 0:e.documents},e.plumberPreference={plumberPreference:{code:"ULB",i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE"}},e.serviceName=null!=e&&null!==(me=e.applicationType)&&void 0!==me&&me.includes("WATER")?{code:"WATER",i18nKey:"WS_WATER_CONNECTION_ONLY"}:{code:"SEWERAGE",i18nKey:"WS_SEWERAGE_CONNECTION_ONLY"},e.waterConectionDetails={proposedPipeSize:{code:null==e?void 0:e.proposedPipeSize,i18nKey:(null==e?void 0:e.proposedPipeSize)+" "+t("WS_INCHES_LABEL"),size:null==e?void 0:e.proposedPipeSize},proposedTaps:null==e?void 0:e.proposedTaps};else if(n){var Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn,sn,cn,vn,pn,mn,En,Sn,_n,fn,gn,Cn,Nn,yn,Dn,Tn,hn;n.ConnectionHolderDetails=null!=n&&n.connectionHolders?v({},null==n||null===(Ee=n.connectionHolders)||void 0===Ee?void 0:Ee[0],{address:null==n||null===(Se=n.connectionHolders)||void 0===Se||null===(_e=Se[0])||void 0===_e?void 0:_e.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=n&&null!==(fe=n.connectionHolders)&&void 0!==fe&&null!==(ge=fe[0])&&void 0!==ge&&ge.gender?{code:null==n||null===(Ce=n.connectionHolders)||void 0===Ce||null===(Ne=Ce[0])||void 0===Ne?void 0:Ne.gender,i18nKey:"COMMON_GENDER_"+(null==n||null===(ye=n.connectionHolders)||void 0===ye||null===(De=ye[0])||void 0===De?void 0:De.gender)}:null,guardian:null==n||null===(Te=n.connectionHolders)||void 0===Te||null===(he=Te[0])||void 0===he?void 0:he.fatherOrHusbandName,isOwnerSame:!((null==n||null===(Ae=n.connectionHolders)||void 0===Ae?void 0:Ae.length)>0),mobileNumber:null==n||null===(Ie=n.connectionHolders)||void 0===Ie||null===(Oe=Ie[0])||void 0===Oe?void 0:Oe.mobileNumber,name:null==n||null===(be=n.connectionHolders)||void 0===be||null===(Le=be[0])||void 0===Le?void 0:Le.name,relationship:null!=n&&null!==(Re=n.connectionHolders)&&void 0!==Re&&null!==(we=Re[0])&&void 0!==we&&we.relationship?{code:null==n||null===(We=n.connectionHolders)||void 0===We||null===(Pe=We[0])||void 0===Pe?void 0:Pe.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==n||null===(Me=n.connectionHolders)||void 0===Me||null===(xe=Me[0])||void 0===xe?void 0:xe.relationship)}:null,specialCategoryType:null!=n&&null!==(Be=n.connectionHolders)&&void 0!==Be&&null!==(Fe=Be[0])&&void 0!==Fe&&Fe.ownerType?{code:null==n||null===(Ue=n.connectionHolders)||void 0===Ue||null===(ke=Ue[0])||void 0===ke?void 0:ke.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==n||null===(He=n.connectionHolders)||void 0===He||null===(je=He[0])||void 0===je?void 0:je.ownerType)}:""}):{address:null==n||null===(Ve=n.property)||void 0===Ve||null===(ze=Ve.owners)||void 0===ze||null===(Ye=ze[0])||void 0===Ye?void 0:Ye.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=n&&null!==(Ge=n.property)&&void 0!==Ge&&null!==(qe=Ge.owners)&&void 0!==qe&&null!==(Ke=qe[0])&&void 0!==Ke&&Ke.gender?{code:null==n||null===(Xe=n.property)||void 0===Xe||null===(Ze=Xe.owners)||void 0===Ze||null===($e=Ze[0])||void 0===$e?void 0:$e.gender,i18nKey:"COMMON_GENDER_"+(null==n||null===(Je=n.property)||void 0===Je||null===(Qe=Je.owners)||void 0===Qe||null===(en=Qe[0])||void 0===en?void 0:en.gender)}:null,guardian:null==n||null===(nn=n.property)||void 0===nn||null===(tn=nn.owners)||void 0===tn||null===(ln=tn[0])||void 0===ln?void 0:ln.fatherOrHusbandName,isOwnerSame:null==n||!n.connectionHolders,mobileNumber:null==n||null===(on=n.property)||void 0===on||null===(an=on.owners)||void 0===an||null===(rn=an[0])||void 0===rn?void 0:rn.mobileNumber,name:null==n||null===(un=n.property)||void 0===un||null===(dn=un.owners)||void 0===dn||null===(sn=dn[0])||void 0===sn?void 0:sn.name,relationship:null!=n&&null!==(cn=n.property)&&void 0!==cn&&null!==(vn=cn.owners)&&void 0!==vn&&null!==(pn=vn[0])&&void 0!==pn&&pn.relationship?{code:null==n||null===(mn=n.property)||void 0===mn||null===(En=mn.owners)||void 0===En||null===(Sn=En[0])||void 0===Sn?void 0:Sn.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==n||null===(_n=n.property)||void 0===_n||null===(fn=_n.owners)||void 0===fn||null===(gn=fn[0])||void 0===gn?void 0:gn.relationship)}:null,specialCategoryType:null!=n&&null!==(Cn=n.connectionHolders)&&void 0!==Cn&&null!==(Nn=Cn[0])&&void 0!==Nn&&Nn.ownerType?{code:null==n||null===(yn=n.connectionHolders)||void 0===yn||null===(Dn=yn[0])||void 0===Dn?void 0:Dn.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==n||null===(Tn=n.connectionHolders)||void 0===Tn||null===(hn=Tn[0])||void 0===hn?void 0:hn.ownerType)}:""},n.SewerageConnectionResult={SewerageConnections:[v({},n)]},n.cpt={details:v({},null==n?void 0:n.property)},n.cptId={id:null==n?void 0:n.propertyId},n.documents={documents:[...null==n?void 0:n.documents]},n.plumberPreference={plumberPreference:{code:"ULB",i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE"}},n.serviceName=null!=n&&n.applicationType.includes("WATER")?{code:"WATER",i18nKey:"WS_WATER_CONNECTION_ONLY"}:{code:"SEWERAGE",i18nKey:"WS_SEWERAGE_CONNECTION_ONLY"},n.sewerageConnectionDetails={proposedToilets:null==n?void 0:n.proposedToilets,proposedWaterClosets:null==n?void 0:n.proposedWaterClosets}}return v({},e||n)})(T,h,_);I(v({},A,e))}},[W,P]);const x=(e,n,t,l)=>{I(l?n:""===e?v({},n):v({},A,{[e]:v({},A[e],n)})),(e=>{var n,t,l,o,i;const a=g.split("/").pop();let{nextStep:r}=D.find(e=>e.route===a),u=D.find(e=>e.route===a&&e);"object"==typeof r&&null!=r&&(!r[sessionStorage.getItem("KnowProperty")]||"search-property"!==r[sessionStorage.getItem("KnowProperty")]&&"create-property"!==r[sessionStorage.getItem("KnowProperty")]||(r=""+r[sessionStorage.getItem("KnowProperty")])),u[sessionStorage.getItem("serviceName")]&&(r=u[sessionStorage.getItem("serviceName")]),(null!=A&&null!==(n=A.cptId)&&void 0!==n&&n.id||null!=A&&null!==(t=A.cpt)&&void 0!==t&&null!==(l=t.details)&&void 0!==l&&l.propertyId||M&&null!=A&&null!==(o=A.cpt)&&void 0!==o&&null!==(i=o.details)&&void 0!==i&&i.propertyId)&&"know-your-property"===r&&(r="property-details"),"docsrequired"===r&&"yes"===sessionStorage.getItem("changePropertySelected")&&(r="property-details");let d=N.push;if(null===r)return d(Vi(S.path,S.params)+"/check");d(Vi(S.path,S.params)+"/"+r)})()},B=()=>{};if(L=null!==(n=L)&&void 0!==n&&n.WSCreateConfig?null===(r=L)||void 0===r?void 0:r.WSCreateConfig:Kl,null===(u=L)||void 0===u||u.forEach(e=>{D=D.concat(e.body.filter(e=>!e.hideInCitizen))}),D.indexRoute="property-details",(W&&Object.keys(W).length>0||!P)&&null!=W&&W.isLoading||null!=P&&P.isLoading||R)return l.createElement(a.Loader,null);const F=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("WSCheckPage"),U=null===(p=Digit)||void 0===p||null===(m=p.ComponentRegistryService)||void 0===m?void 0:m.getComponent("WSAcknowledgement");return l.createElement(i.Switch,null,D.map((e,n)=>{const{component:t,texts:o,inputs:a,key:r,isSkipEnabled:u}=e,d="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:Vi(S.path,S.params)+"/"+e.route,key:n},l.createElement(d,{config:{texts:o,inputs:a,key:r,isSkipEnabled:u},onSelect:x,onSkip:B,t:_,formData:A,userType:"citizen"}))}),l.createElement(i.Route,{path:Vi(S.path,S.params)+"/check"},l.createElement(F,{onSubmit:function(){try{return N.push(Vi(S.path,S.params)+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:A})),l.createElement(i.Route,{path:Vi(S.path,S.params)+"/acknowledgement"},l.createElement(U,{data:A,onSuccess:()=>{E.invalidateQueries("WS_CREATE")},clearParams:O})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Vi(S.path,S.params)+"/"+D.indexRoute})))},WSReSubmitDisconnectionApplication:()=>{var e,n,t;d.useQueryClient();const{t:a}=o.useTranslation(),r=i.useRouteMatch(),u=Digit.ULBService.getStateId();let s=[],{data:c}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(u,{});return c=null!==(e=c)&&void 0!==e&&e.WSDisconnectionConfig?null===(n=c)||void 0===n?void 0:n.WSDisconnectionConfig:Zl,null===(t=c.filter(e=>"RE_SUBMIT_DISCONNECTION_APPLICATION"===e.head))||void 0===t||t.forEach(e=>{s=s.concat(e.body.filter(e=>!e.hideInCitizen))}),s.indexRoute="application-form",l.createElement(i.Switch,null,s.map((e,n)=>{const{component:t,texts:o,inputs:u,key:d,isSkipEnabled:s}=e,c="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:zi(r.path,r.params)+"/"+e.route,key:n},l.createElement(c,{config:{texts:o,inputs:u,key:d,isSkipEnabled:s},t:a,userType:"citizen"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:zi(r.path,r.params)+"/"+s.indexRoute})))},WNSMyBillsComponent:()=>{const{t:e}=o.useTranslation(),{path:n}=i.useRouteMatch(),a=t.useMemo(()=>Ki.map(n=>{const t={};for(const l in n.texts)t[l]=e(n.texts[l]);return v({},n,{texts:t})},[Ki]));return l.createElement(i.Switch,null,l.createElement(i.Route,{path:""+n,exact:!0},l.createElement(Xi,{template:a[0].labels,header:a[0].texts.header,actionButtonLabel:a[0].texts.actionButtonLabel,t:e})))},WSCheckPage:e=>{var n,t,r,u,d,s,c,v,p,m,E,S,_;let{onSubmit:f,value:g}=e;const{t:C}=o.useTranslation();i.useHistory(),i.useRouteMatch();let N=window.Digit.Utils.browser.isMobile();const{ConnectionHolderDetails:y,serviceName:D,waterConectionDetails:T,sewerageConnectionDetails:h,documents:A,cpt:I}=g;let O="/digit-ui/citizen/ws/create-application";function b(e){location.href=e}window.location.href.includes("/edit-application/")&&(O="/digit-ui/citizen/ws/edit-application/"+(null==g?void 0:g.tenantId));let L=[];var R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne;I&&null!=I&&I.details&&Object.keys(null==I?void 0:I.details).length>0&&(null!=I&&null!==(R=I.details)&&void 0!==R&&null!==(w=R.address)&&void 0!==w&&w.doorNo&&L.push(null==I||null===(V=I.details)||void 0===V||null===(z=V.address)||void 0===z?void 0:z.doorNo),null!=I&&null!==(W=I.details)&&void 0!==W&&null!==(P=W.address)&&void 0!==P&&P.street&&L.push(null==I||null===(Y=I.details)||void 0===Y||null===(G=Y.address)||void 0===G?void 0:G.street),null!=I&&null!==(M=I.details)&&void 0!==M&&null!==(x=M.address)&&void 0!==x&&x.landmark&&L.push(null==I||null===(q=I.details)||void 0===q||null===(K=q.address)||void 0===K?void 0:K.landmark),null!=I&&null!==(B=I.details)&&void 0!==B&&null!==(F=B.address)&&void 0!==F&&null!==(U=F.locality)&&void 0!==U&&U.code&&L.push(C(Digit.Utils.pt.getMohallaLocale(null==I||null===(X=I.details)||void 0===X||null===(Z=X.address)||void 0===Z||null===($=Z.locality)||void 0===$?void 0:$.code,null==I||null===(J=I.details)||void 0===J?void 0:J.tenantId))),null!=I&&null!==(k=I.details)&&void 0!==k&&k.tenantId&&L.push(C(Digit.Utils.pt.getCityLocale(null==I||null===(Q=I.details)||void 0===Q?void 0:Q.tenantId))),null!=I&&null!==(H=I.details)&&void 0!==H&&null!==(j=H.address)&&void 0!==j&&j.pincode&&L.push(null==I||null===(ee=I.details)||void 0===ee||null===(ne=ee.address)||void 0===ne?void 0:ne.pincode));const te=Array.isArray(null==I||null===(n=I.details)||void 0===n?void 0:n.owners)?null==I||null===(t=I.details)||void 0===t?void 0:t.owners.slice().reverse():[];return l.createElement(l.Fragment,null,l.createElement(Te,{currentStep:4}),l.createElement(a.Header,{styles:{fontSize:"32px"}},C("WS_COMMON_SUMMARY")),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_BASIC_DETAILS_HEADER")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:C("WS_PROPERTY_ID_LABEL"),text:null==I||null===(r=I.details)||void 0===r?void 0:r.propertyId}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWNERS_NAME_LABEL"),text:C(null===(u=te[0])||void 0===u?void 0:u.name)}),l.createElement(a.Row,{className:"border-none",label:C("WS_COMMON_TABLE_COL_ADDRESS"),text:L.join(", ")}),l.createElement(a.Row,{className:"border-none",label:C("WS_CONNECTION_DETAILS_STATUS_LABEL"),text:C(null==I||null===(d=I.details)||void 0===d?void 0:d.status)})),l.createElement("div",{style:{textAlign:"left"}},l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+(null==I||null===(s=I.details)||void 0===s?void 0:s.propertyId)+"&tenantId="+(null==I||null===(c=I.details)||void 0===c?void 0:c.tenantId)},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:C("PT_VIEW_PROPERTY")})))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{position:"relative"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-10px",float:"right",position:"relative",bottom:"32px",marginRight:"-10px"}}),style:{width:"100px",display:"inline"},onClick:()=>b(O+"/connection-holder")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:N?{marginRight:"-5px"}:{},label:C("WS_OWN_MOBILE_NO"),text:null==y?void 0:y.mobileNumber}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_NAME"),text:null==y?void 0:y.name}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_GENDER_LABEL"),text:C(null==y||null===(v=y.gender)||void 0===v?void 0:v.i18nKey)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_FATHERS_HUSBAND_NAME"),text:(null==y?void 0:y.guardian)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL"),text:C(null==y||null===(p=y.relationship)||void 0===p?void 0:p.i18nKey)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_CROSADD"),text:(null==y?void 0:y.address)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_SPECIAL_APPLICANT_LABEL"),text:C(null==y||null===(m=y.specialCategoryType)||void 0===m?void 0:m.i18nKey)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_EMAIL_ID"),text:(null==y?void 0:y.emailId)||C("CS_NA")}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{position:"relative"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_COMMON_CONNECTION_DETAIL")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-10px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>b(O+"/service-name")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:N?{marginRight:"-10px"}:{},label:C("WS_SERVICE_NAME_LABEL"),text:C(null==D?void 0:D.i18nKey)}),T&&(null===(E=Object.keys(T))||void 0===E?void 0:E.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:C("WS_NO_OF_TAPS_PROPOSED"),text:null==T?void 0:T.proposedTaps}),l.createElement(a.Row,{className:"border-none",label:C("WS_SERV_DETAIL_PIPE_SIZE"),text:C(null==T||null===(S=T.proposedPipeSize)||void 0===S?void 0:S.i18nKey)})),h&&(null===(_=Object.keys(h))||void 0===_?void 0:_.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:C("WS_NO_OF_WATER_CLOSETS"),text:null==h?void 0:h.proposedWaterClosets}),l.createElement(a.Row,{className:"border-none",label:C("WS_SERV_DETAIL_NO_OF_TOILETS"),text:null==h?void 0:h.proposedToilets})))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{position:"relative"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_COMMON_DOCUMENT_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-10px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>b(O+"/document-details")})),A&&(null==A?void 0:A.documents.map((e,n)=>{var t;return l.createElement("div",{key:"doc-"+n},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,C(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:g,Code:null==e?void 0:e.documentType,index:n}),(null==A?void 0:A.documents.length)!=n+1?l.createElement("hr",{style:{color:"white",backgroundColor:"white",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))}))),l.createElement(a.SubmitBar,{label:C("CS_COMMON_SUBMIT"),onSubmit:f,style:{marginLeft:"10px",maxWidth:"95%"}}))},WSAcknowledgement:e=>{var n,r,u,d,s,c,p,m,E,S;let{data:_,onSuccess:f,clearParams:g}=e;const{t:C}=o.useTranslation(),[y,D,T]=Digit.Hooks.useSessionStorage("CITIZEN_TL_MUTATION_HAPPENED",!1),h=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.ws.useWSUpdateAPI("WATER")),A=Digit.Hooks.ws.useWSUpdateAPI("SEWERAGE");let I=window.location.href.includes("/edit-application/")||window.location.href.includes("/modify-connection/");const{data:O}=Digit.Hooks.useStore.getInitData(),{tenants:b}=O||{};return Digit.ULBService.getStateId(),t.useEffect(()=>{"true"!==sessionStorage.getItem("isCreateEnabled")?window.history.forward():sessionStorage.removeItem("isCreateEnabled")}),t.useEffect(()=>{try{var e,n;let o;if("WATER"===(null==_||null===(e=_.serviceName)||void 0===e?void 0:e.code)||"BOTH"===(null==_||null===(n=_.serviceName)||void 0===n?void 0:n.code)){var t,l;o=(null==_||null===(t=_.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.tenantId)||o;let e=I?(e=>{var n,t,l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P;let M=null==e||null===(n=e.WaterConnectionResult)||void 0===n||null===(t=n.WaterConnection)||void 0===t?void 0:t[0],x={WaterConnection:{id:null!=e&&e.isEditApplication?null==e?void 0:e.id:null==M?void 0:M.id,tenantId:null!=e&&e.isEditApplication?null==e?void 0:e.tenantId:null==M?void 0:M.tenantId,propertyId:null!=e&&e.isEditApplication?null==e?void 0:e.propertyId:null==M?void 0:M.propertyId,applicationNo:null!=e&&e.isEditApplication?null==e?void 0:e.applicationNo:null==M?void 0:M.applicationNo,applicationStatus:null!=e&&e.isEditApplication?null==e?void 0:e.applicationStatus:null==M?void 0:M.applicationStatus,status:null!=e&&e.isEditApplication?null==e?void 0:e.status:null==M?void 0:M.status,connectionNo:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionNo:null==M?void 0:M.connectionNo)||null,oldConnectionNo:null,documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],plumberInfo:null!=e&&e.isEditApplication?null==e?void 0:e.plumberInfo:(null==M?void 0:M.plumberInfo)||[],roadType:null,roadCuttingArea:null,roadCuttingInfo:[],connectionExecutionDate:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionExecutionDate:null==M?void 0:M.connectionExecutionDate)||null,connectionCategory:null,connectionType:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionType:null==M?void 0:M.connectionType)||null,additionalDetails:v({},null!=e&&e.isEditApplication?null==e?void 0:e.additionalDetails:null==M?void 0:M.additionalDetails),auditDetails:null!=e&&e.isEditApplication?null==e?void 0:e.auditDetails:null==M?void 0:M.auditDetails,processInstance:null!=e&&e.isEditApplication?v({},null==e?void 0:e.processInstance,{action:"RESUBMIT_APPLICATION"}):v({},null==M?void 0:M.processInstance,{action:"SUBMIT_APPLICATION"}),applicationType:null!=e&&e.isEditApplication?null==e?void 0:e.applicationType:"MODIFY_WATER_CONNECTION",dateEffectiveFrom:N(Date.now()+864e5),connectionHolders:null!=e&&e.isEditApplication?null!=e&&null!==(o=e.ConnectionHolderDetails)&&void 0!==o&&o.isOwnerSame?null:[{correspondenceAddress:(null==e||null===(i=e.ConnectionHolderDetails)||void 0===i?void 0:i.address)||"",fatherOrHusbandName:(null==e||null===(a=e.ConnectionHolderDetails)||void 0===a?void 0:a.guardian)||"",gender:(null==e||null===(r=e.ConnectionHolderDetails)||void 0===r||null===(u=r.gender)||void 0===u?void 0:u.code)||"",mobileNumber:(null==e||null===(d=e.ConnectionHolderDetails)||void 0===d?void 0:d.mobileNumber)||"",name:(null==e||null===(s=e.ConnectionHolderDetails)||void 0===s?void 0:s.name)||"",emailId:(null==e||null===(c=e.ConnectionHolderDetails)||void 0===c?void 0:c.emailId)||"",ownerType:(null==e||null===(p=e.ConnectionHolderDetails)||void 0===p||null===(m=p.specialCategoryType)||void 0===m?void 0:m.code)||"",relationship:(null==e||null===(E=e.ConnectionHolderDetails)||void 0===E||null===(S=E.relationship)||void 0===S?void 0:S.code)||"",sameAsPropertyAddress:null==e||null===(_=e.ConnectionHolderDetails)||void 0===_?void 0:_.sameAsOwnerDetails}]:null==M?void 0:M.connectionHolders,oldApplication:!1,channel:"CITIZEN",waterSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSource:null==M?void 0:M.waterSource)||null,meterId:(null!=e&&e.isEditApplication?null==e?void 0:e.meterId:null==M?void 0:M.meterId)||null,meterInstallationDate:(null!=e&&e.isEditApplication?null==e?void 0:e.meterInstallationDate:null==M?void 0:M.meterInstallationDate)||null,proposedPipeSize:null==e||null===(f=e.waterConectionDetails)||void 0===f||null===(g=f.proposedPipeSize)||void 0===g?void 0:g.code,proposedTaps:null==e||null===(C=e.waterConectionDetails)||void 0===C?void 0:C.proposedTaps,pipeSize:(null!=e&&e.isEditApplication?null==e?void 0:e.pipeSize:null==M?void 0:M.pipeSize)||null,noOfTaps:(null!=e&&e.isEditApplication?null==e?void 0:e.noOfTaps:null==M?void 0:M.noOfTaps)||null,waterSourceSubSource:null,waterSubSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSubSource:null==M?void 0:M.waterSubSource)||null,property:v({},null!=e&&e.isEditApplication?null==e?void 0:e.property:null==M?void 0:M.property),water:!(null==e||null===(y=e.applicationType)||void 0===y||!y.includes("WATER")),sewerage:!(null==e||null===(D=e.applicationType)||void 0===D||!D.includes("WATER")),service:null!=e&&e.isEditApplication?null==e||null===(T=e.serviceName)||void 0===T?void 0:T.code:null==M||null===(h=M.serviceName)||void 0===h?void 0:h.code,reviewDocData:[...null==e||null===(A=e.documents)||void 0===A?void 0:A.documents],proposedWaterClosets:null==e||null===(I=e.sewerageConnectionDetails)||void 0===I?void 0:I.proposedWaterClosets,proposedToilets:null==e||null===(O=e.sewerageConnectionDetails)||void 0===O?void 0:O.proposedToilets,comment:"",wfDocuments:[],assignee:[],action:null!=e&&e.isEditApplication?"RESUBMIT_APPLICATION":"SUBMIT_APPLICATION",assignes:[]}};return x=null!==(b=Digit)&&void 0!==b&&null!==(L=b.Customizations)&&void 0!==L&&null!==(R=L.WS)&&void 0!==R&&R.customiseEditWSUpdate?null===(w=Digit)||void 0===w||null===(W=w.Customizations)||void 0===W||null===(P=W.WS)||void 0===P?void 0:P.customiseEditWSUpdate(e,x):x,x})(_):(e=>{var n,t,l,o,i,a,r,u,d;let s={WaterConnection:v({},null==e||null===(n=e.WaterConnectionResult)||void 0===n||null===(t=n.WaterConnection)||void 0===t?void 0:t[0],{documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],processInstance:{action:"SUBMIT_APPLICATION"}})};return s=null!==(o=Digit)&&void 0!==o&&null!==(i=o.Customizations)&&void 0!==i&&null!==(a=i.WS)&&void 0!==a&&a.customiseWSUpdate?null===(r=Digit)||void 0===r||null===(u=r.Customizations)||void 0===u||null===(d=u.WS)||void 0===d?void 0:d.customiseWSUpdate(e,s):s,s})(_);const n=v({},e,{disconnectRequest:!1,reconnectRequest:!1});h.mutate(n,{onSuccess:f})}}catch(e){}},[_]),t.useEffect(()=>{var e,n;if("SEWERAGE"===(null==_||null===(e=_.serviceName)||void 0===e?void 0:e.code)||"BOTH"===(null==_||null===(n=_.serviceName)||void 0===n?void 0:n.code)&&h.isSuccess){let e=I?(e=>{var n,t,l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P;let M=null==e||null===(n=e.SewerageConnectionResult)||void 0===n||null===(t=n.SewerageConnections)||void 0===t?void 0:t[0],x={SewerageConnection:{id:null!=e&&e.isEditApplication?null==e?void 0:e.id:null==M?void 0:M.id,tenantId:null!=e&&e.isEditApplication?null==e?void 0:e.tenantId:null==M?void 0:M.tenantId,propertyId:null!=e&&e.isEditApplication?null==e?void 0:e.propertyId:null==M?void 0:M.propertyId,applicationNo:null!=e&&e.isEditApplication?null==e?void 0:e.applicationNo:null==M?void 0:M.applicationNo,applicationStatus:null!=e&&e.isEditApplication?null==e?void 0:e.applicationStatus:null==M?void 0:M.applicationStatus,status:null!=e&&e.isEditApplication?null==e?void 0:e.status:null==M?void 0:M.status,connectionNo:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionNo:null==M?void 0:M.connectionNo)||null,oldConnectionNo:null,documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],plumberInfo:null!=e&&e.isEditApplication?null==e?void 0:e.plumberInfo:(null==M?void 0:M.plumberInfo)||[],roadType:null,roadCuttingArea:null,roadCuttingInfo:[],connectionExecutionDate:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionExecutionDate:null==M?void 0:M.connectionExecutionDate)||null,connectionCategory:null,connectionType:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionType:null==M?void 0:M.connectionType)||null,additionalDetails:v({},null!=e&&e.isEditApplication?null==e?void 0:e.additionalDetails:null==M?void 0:M.additionalDetails),auditDetails:null!=e&&e.isEditApplication?null==e?void 0:e.auditDetails:null==M?void 0:M.auditDetails,processInstance:null!=e&&e.isEditApplication?v({},null==e?void 0:e.processInstance,{action:"RESUBMIT_APPLICATION"}):v({},null==M?void 0:M.processInstance,{action:"SUBMIT_APPLICATION"}),applicationType:null!=e&&e.isEditApplication?null==e?void 0:e.applicationType:"MODIFY_WATER_CONNECTION",dateEffectiveFrom:N(Date.now()+864e5),connectionHolders:null!=e&&e.isEditApplication?null!=e&&null!==(o=e.ConnectionHolderDetails)&&void 0!==o&&o.isOwnerSame?null:[{correspondenceAddress:(null==e||null===(i=e.ConnectionHolderDetails)||void 0===i?void 0:i.address)||"",fatherOrHusbandName:(null==e||null===(a=e.ConnectionHolderDetails)||void 0===a?void 0:a.guardian)||"",gender:(null==e||null===(r=e.ConnectionHolderDetails)||void 0===r||null===(u=r.gender)||void 0===u?void 0:u.code)||"",mobileNumber:(null==e||null===(d=e.ConnectionHolderDetails)||void 0===d?void 0:d.mobileNumber)||"",name:(null==e||null===(s=e.ConnectionHolderDetails)||void 0===s?void 0:s.name)||"",emailId:(null==e||null===(c=e.ConnectionHolderDetails)||void 0===c?void 0:c.emailId)||"",ownerType:(null==e||null===(p=e.ConnectionHolderDetails)||void 0===p||null===(m=p.specialCategoryType)||void 0===m?void 0:m.code)||"",relationship:(null==e||null===(E=e.ConnectionHolderDetails)||void 0===E||null===(S=E.relationship)||void 0===S?void 0:S.code)||"",sameAsPropertyAddress:null==e||null===(_=e.ConnectionHolderDetails)||void 0===_?void 0:_.sameAsOwnerDetails}]:null==M?void 0:M.connectionHolders,oldApplication:!1,channel:"CITIZEN",waterSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSource:null==M?void 0:M.waterSource)||null,meterId:(null!=e&&e.isEditApplication?null==e?void 0:e.meterId:null==M?void 0:M.meterId)||null,meterInstallationDate:(null!=e&&e.isEditApplication?null==e?void 0:e.meterInstallationDate:null==M?void 0:M.meterInstallationDate)||null,proposedPipeSize:null==e||null===(f=e.waterConectionDetails)||void 0===f||null===(g=f.proposedPipeSize)||void 0===g?void 0:g.code,proposedTaps:null==e||null===(C=e.waterConectionDetails)||void 0===C?void 0:C.proposedTaps,pipeSize:(null!=e&&e.isEditApplication?null==e?void 0:e.pipeSize:null==M?void 0:M.pipeSize)||null,noOfTaps:(null!=e&&e.isEditApplication?null==e?void 0:e.noOfTaps:null==M?void 0:M.noOfTaps)||null,waterSourceSubSource:null,waterSubSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSubSource:null==M?void 0:M.waterSubSource)||null,property:v({},null!=e&&e.isEditApplication?null==e?void 0:e.property:null==M?void 0:M.property),water:!(null==e||null===(y=e.applicationType)||void 0===y||!y.includes("WATER")),sewerage:!(null==e||null===(D=e.applicationType)||void 0===D||!D.includes("WATER")),service:null!=e&&e.isEditApplication?null==e||null===(T=e.serviceName)||void 0===T?void 0:T.code:null==M||null===(h=M.serviceName)||void 0===h?void 0:h.code,reviewDocData:[...null==e||null===(A=e.documents)||void 0===A?void 0:A.documents],proposedWaterClosets:null==e||null===(I=e.sewerageConnectionDetails)||void 0===I?void 0:I.proposedWaterClosets,proposedToilets:null==e||null===(O=e.sewerageConnectionDetails)||void 0===O?void 0:O.proposedToilets,comment:"",wfDocuments:[],assignee:[],action:null!=e&&e.isEditApplication?"RESUBMIT_APPLICATION":"SUBMIT_APPLICATION",assignes:[]}};return x=null!==(b=Digit)&&void 0!==b&&null!==(L=b.Customizations)&&void 0!==L&&null!==(R=L.WS)&&void 0!==R&&R.customiseEditSWUpdate?null===(w=Digit)||void 0===w||null===(W=w.Customizations)||void 0===W||null===(P=W.WS)||void 0===P?void 0:P.customiseEditSWUpdate(e,x):x,x})(_):(e=>{var n,t,l,o,i,a,r,u,d;let s={SewerageConnection:v({},null==e||null===(n=e.SewerageConnectionResult)||void 0===n||null===(t=n.SewerageConnections)||void 0===t?void 0:t[0],{connectionType:"Non Metered",documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],processInstance:{action:"SUBMIT_APPLICATION"}})};return s=null!==(o=Digit)&&void 0!==o&&null!==(i=o.Customizations)&&void 0!==i&&null!==(a=i.WS)&&void 0!==a&&a.customiseSWUpdate?null===(r=Digit)||void 0===r||null===(u=r.Customizations)||void 0===u||null===(d=u.WS)||void 0===d?void 0:d.customiseSWUpdate(e,s):s,s})(_);const n=v({},e,{disconnectRequest:!1,reconnectRequest:!1});A.mutate(n,{onSuccess:f})}},[_,h.isSuccess]),("WATER"===(null==_||null===(n=_.serviceName)||void 0===n?void 0:n.code)?h.isLoading||h.isIdle:"SEWERAGE"===(null==_||null===(r=_.serviceName)||void 0===r?void 0:r.code)?A.isLoading||A.isIdle:h.isLoading||h.isIdle||A.isLoading||A.isIdle)?l.createElement(a.Loader,null):l.createElement(a.Card,null,l.createElement(qi,{t:C,clearParams:g,Waterdata:h.data,Seweragedata:A.data,isSuccess:"WATER"===(null==_||null===(u=_.serviceName)||void 0===u?void 0:u.code)?h.isSuccess:A.isSuccess,isLoading:"WATER"===(null==_||null===(d=_.serviceName)||void 0===d?void 0:d.code)?h.isLoading||h.isIdle:"SEWERAGE"===(null==_||null===(s=_.serviceName)||void 0===s?void 0:s.code)?A.isLoading||A.isIdle:h.isLoading||h.isIdle||A.isLoading||A.isIdle}),("WATER"===(null==_||null===(c=_.serviceName)||void 0===c?void 0:c.code)?h.isSuccess:A.isSuccess)&&l.createElement(a.CardText,null,C("WS_FILE_RESPONSE")),("WATER"===(null==_||null===(p=_.serviceName)||void 0===p?void 0:p.code)||"BOTH"===(null==_||null===(m=_.serviceName)||void 0===m?void 0:m.code))&&h.isSuccess&&l.createElement(a.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},C("WS_PRINT_WATER_APPLICATION_LABEL"))),onClick:()=>{var e,n,t;const l=null==h||null===(e=h.data)||void 0===e||null===(n=e.WaterConnection)||void 0===n?void 0:n[0],o=b.find(e=>{var n,t;return e.code===(null==_||null===(n=_.cpt)||void 0===n||null===(t=n.details)||void 0===t?void 0:t.tenantId)});Z(v({},l),v({},null==_||null===(t=_.cpt)||void 0===t?void 0:t.details),null==o?void 0:o.code,C).then(e=>Digit.Utils.pdf.generatev1(e))}}),("SEWERAGE"===(null==_||null===(E=_.serviceName)||void 0===E?void 0:E.code)||"BOTH"===(null==_||null===(S=_.serviceName)||void 0===S?void 0:S.code))&&A.isSuccess&&l.createElement(a.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},C("WS_PRINT_SEWERAGE_APPLICATION_LABEL"))),onClick:()=>{var e,n,t;const l=null==A||null===(e=A.data)||void 0===e||null===(n=e.SewerageConnections)||void 0===n?void 0:n[0],o=b.find(e=>{var n,t;return e.code===(null==_||null===(n=_.cpt)||void 0===n||null===(t=n.details)||void 0===t?void 0:t.tenantId)});Z(v({},l),v({},null==_||null===(t=_.cpt)||void 0===t?void 0:t.details),null==o?void 0:o.code,C).then(e=>Digit.Utils.pdf.generatev1(e))}}),l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen"}},l.createElement(a.SubmitBar,{label:C("CORE_COMMON_GO_TO_HOME")})))},WSDisconnectionCheckPage:()=>{const{t:e}=o.useTranslation(),n=i.useHistory(),r=(i.useRouteMatch(),Digit.SessionStorage.get("WS_DISCONNECTION")),[u,d]=t.useState(r.WSDisconnectionForm.documents||[]);let s="/digit-ui/citizen/ws/disconnect-application";function c(e){location.href=e}window.location.href.includes("/edit-application/")&&(s="/digit-ui/citizen/ws/edit-disconnect-application");const[p,m]=t.useState(!1),{mutate:E}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:S}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:_}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:g}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),C=()=>{setShowToast(null)};return p?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},e("WS_COMMON_SUMMARY")),l.createElement(Ft,{currentStep:3}),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},e("WS_DISCONNECTION_APPLICATION_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>c(s+"/application-form")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_CONSUMER_NUMBER"),text:r.connectionNo}),l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_TYPE"),text:e(r.WSDisconnectionForm.type.value.i18nKey)}),l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_PROPOSED_DATE"),text:f(N(r.WSDisconnectionForm.date))}),"Temporary"==r.WSDisconnectionForm.type.value.code?l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_PROPOSED_END_DATE"),text:f(N(r.WSDisconnectionForm.endDate))}):"",l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_REASON"),text:e(r.WSDisconnectionForm.reason.value.i18nKey)}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},e("WS_COMMON_DOCUMENT_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>c(s+"/documents-upload")})),u&&(null==u?void 0:u.map((n,t)=>{var o;return l.createElement("div",{key:"doc-"+t},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,e(null==n||null===(o=n.documentType)||void 0===o?void 0:o.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:{documents:r.WSDisconnectionForm},Code:null==n?void 0:n.documentType,index:t,showFileName:!0}),(null==u?void 0:u.length)!=t+1?l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))})),l.createElement(a.SubmitBar,{label:e("CS_COMMON_SUBMIT"),onSubmit:()=>function(e){try{return Promise.resolve(A(e,{applicationData:r},r.serviceType)).then(function(e){const t=function(t){if(null!=e&&null!==(t=e.WaterConnection)&&void 0!==t&&t.water){var l;null!==(l=e.WaterConnection)&&void 0!==l&&l.isDisconnectionTemporary&&(e.WaterConnection.endDate=N(r.WSDisconnectionForm.endDate)||"");const t=function(){if(E)return m(!0),Promise.resolve(E(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(I(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){let t={WaterConnection:e};return t=v({},t,{disconnectRequest:!0}),Promise.resolve(S(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/disconnect-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}else{const t=function(t){if(null!=e&&null!==(t=e.SewerageConnection)&&void 0!==t&&t.sewerage){e.SewerageConnection.isDisconnectionTemporary&&(e.SewerageConnection.endDate=N(r.WSDisconnectionForm.endDate)||"");const t=function(){if(_)return m(!0),Promise.resolve(_(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(I(null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0],"SEWERAGE")).then(function(e){let t={SewerageConnection:e};return t=v({},t,{disconnectRequest:!0}),Promise.resolve(g(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/disconnect-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}}(null==r?void 0:r.WSDisconnectionForm)})))},WSRestorationCheckPage:()=>{const{t:e}=o.useTranslation(),n=i.useHistory(),r=(i.useRouteMatch(),Digit.SessionStorage.get("WS_DISCONNECTION")),[u,d]=t.useState(r.WSDisconnectionForm.documents||[]),[s,c]=t.useState(null),[p,m]=t.useState(!1),{mutate:E}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:S}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:_}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:g}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),C=()=>{setShowToast(null)};return p?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},e("WS_COMMON_SUMMARY")),l.createElement(Ft,{currentStep:3}),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},e("WS_RESTORATION_APPLICATION_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>{location.href="/digit-ui/citizen/ws/restoration-application/application-form"}})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:e("WS_RESTORATION_CONSUMER_NUMBER"),text:r.connectionNo}),l.createElement(a.Row,{className:"border-none",label:e("WS_RESTORATION_PROPOSED_DATE"),text:f(N(r.WSDisconnectionForm.date))}),l.createElement(a.Row,{className:"border-none",label:e("WS_RESTORATION_REASON"),text:r.WSDisconnectionForm.reason.value}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement(a.SubmitBar,{label:e("CS_COMMON_SUBMIT"),onSubmit:()=>function(e){try{return Promise.resolve(A(e,{applicationData:r},r.serviceType)).then(function(e){const t=function(t){if(null!=e&&null!==(t=e.WaterConnection)&&void 0!==t&&t.water){e.WaterConnection.isdisconnection=!1,e.WaterConnection.reconnectionReason=e.WaterConnection.disconnectionReason,e.WaterConnection.disconnectionReason="",e.WaterConnection.isDisconnectionTemporary=!0,e.reconnectRequest=!0,e.disconnectRequest=!1;const t=function(){if(E)return m(!0),Promise.resolve(E(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(O(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){let t={WaterConnection:e};return t=v({},t,{disconnectRequest:!1,reconnectRequest:!0}),Promise.resolve(S(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/restoration-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}else{const t=function(t){if(null!=e&&null!==(t=e.SewerageConnection)&&void 0!==t&&t.sewerage){e.SewerageConnection.isdisconnection=!1,e.SewerageConnection.reconnectionReason=e.SewerageConnection.disconnectionReason,e.SewerageConnection.disconnectionReason="",e.SewerageConnection.isDisconnectionTemporary=!0,e.reconnectRequest=!0,e.disconnectRequest=!1;const t=function(){if(_)return m(!0),Promise.resolve(_(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(O(null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0],"SEWERAGE")).then(function(e){let t={SewerageConnection:e};return t=v({},t,{disconnectRequest:!1,reconnectRequest:!0}),Promise.resolve(g(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/restoration-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}}(null==r?void 0:r.WSDisconnectionForm)})),s&&l.createElement(a.Toast,{error:"error"===(null==s?void 0:s.key),label:e(null==s?void 0:s.message),onClose:()=>c(null)}))},WSReSubmitDisconnectionCheckPage:()=>{var e;const{t:n}=o.useTranslation(),r=i.useHistory(),u=(i.useRouteMatch(),Digit.SessionStorage.get("WS_DISCONNECTION")),[d,s]=t.useState(u.WSDisconnectionForm.documents||[]);let c="/digit-ui/citizen/ws/resubmit-disconnect-application";function p(e){location.href=e}window.location.href.includes("/resubmit")&&(c="/digit-ui/citizen/ws/resubmit-disconnect-application");const[m,E]=t.useState(!1),{mutate:S}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:_}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),g=()=>{setShowToast(null)};return m?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},n("WS_COMMON_SUMMARY")),l.createElement(Ft,{currentStep:3}),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},n("WS_DISCONNECTION_APPLICATION_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>p(c+"/application-form")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_CONSUMER_NUMBER"),text:u.connectionNo||(null==u||null===(e=u.applicationData)||void 0===e?void 0:e.connectionNo)}),l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_TYPE"),text:n(u.WSDisconnectionForm.type.value.i18nKey)}),l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_PROPOSED_DATE"),text:f(N(u.WSDisconnectionForm.date))}),l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_REASON"),text:u.WSDisconnectionForm.reason.value}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},n("WS_COMMON_DOCUMENT_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>p(c+"/documents-upload")})),d&&(null==d?void 0:d.map((e,t)=>{var o;return l.createElement("div",{key:"doc-"+t},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,n(null==e||null===(o=e.documentType)||void 0===o?void 0:o.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:{documents:u.WSDisconnectionForm},Code:null==e?void 0:e.documentType,index:t,showFileName:!0}),(null==d?void 0:d.length)!=t+1?l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))})),l.createElement(a.SubmitBar,{label:n("CS_COMMON_SUBMIT"),onSubmit:()=>function(e){try{return Promise.resolve(function(e,n,t){try{var l,o,i,a,r,u,d,s,c,p,m,E,S,_;Digit.UserService.getType();let f={WaterConnection:v({},null==n?void 0:n.applicationData,{dateEffectiveFrom:N(null==e?void 0:e.date),isDisconnectionTemporary:"Temporary"===(null==e||null===(l=e.type)||void 0===l||null===(o=l.value)||void 0===o?void 0:o.code),disconnectionReason:null==e||null===(i=e.reason.value)||void 0===i?void 0:i.code,documents:null==e?void 0:e.documents,water:!0,sewerage:!1,service:"Water",processInstance:v({},null==n||null===(a=n.applicationData)||void 0===a?void 0:a.processInstance,{action:"RESUBMIT_APPLICATION"}),channel:"CITIZEN"}),disconnectRequest:!0};n.applicationData.connectionType&&(n.applicationData.meterInstallationDate&&(f.WaterConnection.meterInstallationDate=n.applicationData.meterInstallationDate),n.applicationData.meterId&&(f.WaterConnection.meterId=n.applicationData.meterId));let g={SewerageConnection:v({},null==n?void 0:n.applicationData,{dateEffectiveFrom:N(null==e?void 0:e.date),isdisconnection:!0,isDisconnectionTemporary:"Temporary"===(null==e||null===(r=e.type)||void 0===r||null===(u=r.value)||void 0===u?void 0:u.code),disconnectionReason:null==e||null===(d=e.reason.value)||void 0===d?void 0:d.code,documents:null==e?void 0:e.documents,water:!1,sewerage:!0,service:"Sewerage",processInstance:v({},null==n||null===(s=n.applicationData)||void 0===s?void 0:s.processInstance,{action:"RESUBMIT_APPLICATION"}),channel:"CITIZEN"}),disconnectRequest:!0},C="WATER"===t?f:g;return C=null!==(c=Digit)&&void 0!==c&&null!==(p=c.Customizations)&&void 0!==p&&null!==(m=p.WS)&&void 0!==m&&m.customiseCreatePayloadOfWSReSubmitDisconnection?null===(E=Digit)||void 0===E||null===(S=E.Customizations)||void 0===S||null===(_=S.WS)||void 0===_?void 0:_.customiseCreatePayloadOfWSReSubmitDisconnection(e,C,t):C,Promise.resolve(C)}catch(e){return Promise.reject(e)}}(e,u,u.serviceType)).then(function(e){const n=function(n){if(null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n.water){const n=function(){if(S)return E(!0),Promise.resolve(S(e,{onError:(e,n)=>{var t,l,o,i,a,r;E(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(g,5e3)},onSuccess:function(e,n){try{var t,l,o;return Digit.SessionStorage.set("WS_DISCONNECTION",v({},null==u?void 0:u.applicationData,null==u?void 0:u.WSDisconnectionForm,{DisconnectionResponse:null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]})),r.push("/digit-ui/citizen/ws/disconnect-acknowledge?applicationNumber="+(null==e||null===(l=e.WaterConnection)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo)),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}else{const n=function(n){if(null!=e&&null!==(n=e.SewerageConnection)&&void 0!==n&&n.sewerage){const n=function(){if(_)return E(!0),Promise.resolve(_(e,{onError:(e,n)=>{var t,l,o,i,a,r;E(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(g,5e3)},onSuccess:function(e,n){try{var t,l,o;return Digit.SessionStorage.set("WS_DISCONNECTION",v({},null==u?void 0:u.applicationData,null==u?void 0:u.WSDisconnectionForm,{DisconnectionResponse:null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0]})),r.push("/digit-ui/citizen/ws/disconnect-acknowledge?applicationNumber="+(null==e||null===(l=e.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo)),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}(null==u?void 0:u.WSDisconnectionForm)})))},WSApplicationBillAmendment:()=>{var e,n,u,d,s,c,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O;const[b,L]=t.useState(null),{t:R}=o.useTranslation(),{connectionNumber:w,tenantId:W,isEdit:P}=Digit.Hooks.useQueryParams(),M=Digit.ULBService.getStateId();let{state:x}=i.useLocation();x=x?"string"==typeof x?JSON.parse(x):x:{};const[B,F]=t.useState(""),[U,k]=t.useState(!1),[H,j]=t.useState(!1);let V=window.Digit.Utils.browser.isMobile(),z=window.location.href.includes("/employee");const{isLoading:Y,data:G}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSMDMSBillAmendment({tenantId:M}),q=w.includes("WS")?"WS":"SW",K={tenantId:W,consumerCode:w,service:q},{data:X,isLoading:Z}=Digit.Hooks.usePaymentSearch(W,K),{data:$}=Digit.Hooks.fsm.useMDMS(M,"DIGIT-UI","WSTaxHeadMaster"),J=null==$||null===(e=$.BillingService)||void 0===e||null===(n=e.TaxHeadMaster)||void 0===n?void 0:n.filter(e=>e.IsBillamend);let Q=null==X?void 0:X.filter(e=>null==J?void 0:J.find(n=>n.code===e.taxHeadCode));null==$||null===(u=$.BillingService)||void 0===u||null===(d=u.TaxHeadMaster)||void 0===d||d.filter(e=>e.code.includes("ADHOC")&&e.IsBillamend&&e.service===q);const ee=r.useForm({defaultValues:v({},null===(s=x)||void 0===s||null===(c=s.data)||void 0===c||null===(m=c.applicationDetails)||void 0===m||null===(E=m.amendment)||void 0===E||null===(S=E.additionalDetails)||void 0===S?void 0:S.editForm)}),{register:ne,control:te,watch:le,setValue:oe,handleSubmit:ie,formState:{errors:ae},getValues:re}=ee,{mutate:ue}=(p(ee.formState,$i),p(ee,Zi),Digit.Hooks.ws.useApplicationActionsBillAmendUpdate()),[de,se]=t.useState(!1),ce=le("effectivefrom"),ve=le("amendmentReason"),pe=le("WS_REDUCED_AMOUNT"),me=le("WS_ADDITIONAL_AMOUNT"),Ee=le("SW_REDUCED_AMOUNT"),Se=le("SW_ADDITIONAL_AMOUNT"),_e=i.useHistory();t.useEffect(()=>ge({type:"updateAmendmentReason",payload:ve}),[ve]);const[fe,ge]=t.useReducer(function(e,n){var t,l;switch(n.type){case"upload":return e.map(e=>e.documentType===n.payload.id?v({},e,{url:n.payload.url}):e);case"remove":return e.map(e=>{let t=e;return e.documentType===n.payload.id&&(delete t.url,delete t.loader),t});case"addLoader":return e.map(e=>e.documentType===n.payload.id?v({},e,{loader:!0}):e);case"removeLoader":return e.map(e=>e.documentType===n.payload.id?v({},e,{loader:!1}):e);case"updateAmendmentReason":return null===(t=n.payload)||void 0===t||null===(l=t.allowedDocuments)||void 0===l?void 0:l.allowedDocs;default:return e}},[]),Ce=e=>{oe(e,{VALUE:!1})},Ne=e=>{var n,t,l,o,i,a,r,u;let d;const s=void 0!==(null==e||null===(n=e[q+"_REDUCED_AMOUNT"])||void 0===n?void 0:n.VALUE)&&null!=e&&null!==(t=e[q+"_REDUCED_AMOUNT"])&&void 0!==t&&t.VALUE||void 0!==(null==e||null===(l=e[q+"_ADDITIONAL_AMOUNT"])||void 0===l?void 0:l.VALUE)&&(null==e||null===(o=e[q+"_ADDITIONAL_AMOUNT"])||void 0===o||!o.VALUE)?"rebate":"penalty";d="WS"===q?JSON.parse(JSON.stringify(null!=e&&null!==(i=e.WS_REDUCED_AMOUNT)&&void 0!==i&&i.VALUE?null==e?void 0:e.WS_REDUCED_AMOUNT:null==e?void 0:e.WS_ADDITIONAL_AMOUNT)):JSON.parse(JSON.stringify(null!=e&&null!==(a=e.SW_REDUCED_AMOUNT)&&void 0!==a&&a.VALUE?null==e?void 0:e.SW_REDUCED_AMOUNT:null==e?void 0:e.SW_ADDITIONAL_AMOUNT)),null===(r=d)||void 0===r||delete r.VALUE;const c=Object.entries(d);return null!=e&&e[q+"_REBATE"]?c.push([q+"_TIME_ADHOC_REBATE",null==e?void 0:e[q+"_REBATE"]]):null!=e&&e[q+"_PENALTY"]&&c.push([q+"_TIME_ADHOC_PENALTY",null==e?void 0:e[q+"_PENALTY"]]),null===(u=c.filter(e=>""!==(null==e?void 0:e[1])))||void 0===u?void 0:u.map(e=>(Q.find(n=>n.taxHeadCode===e[0]),{taxHeadMasterCode:e[0],taxAmount:e[1]?"penalty"!==s?-parseInt(e[1]):parseInt(e[1]):0}))},ye=e=>{var n,t,l,o;const i=null!=e&&null!==(n=e[q+"_REDUCED_AMOUNT"])&&void 0!==n&&n.VALUE?"REBATE":"PENALTY",a={};let r;return Q.map(e=>{a[e.taxHeadCode]=e.amount}),r="WS"===q?JSON.parse(JSON.stringify(null!=e&&null!==(t=e.WS_REDUCED_AMOUNT)&&void 0!==t&&t.VALUE?null==e?void 0:e.WS_REDUCED_AMOUNT:null==e?void 0:e.WS_ADDITIONAL_AMOUNT)):JSON.parse(JSON.stringify(null!=e&&null!==(l=e.SW_REDUCED_AMOUNT)&&void 0!==l&&l.VALUE?null==e?void 0:e.SW_REDUCED_AMOUNT:null==e?void 0:e.SW_ADDITIONAL_AMOUNT)),null===(o=r)||void 0===o||delete o.VALUE,r[q+"_"+i]=null!=e&&e[q+"_"+i]?null==e?void 0:e[q+"_"+i]:0,v({},r,{actionPerformed:r,TOTAL:Object.values(r).reduce((e,n)=>parseInt(e)+parseInt(n),0),originalDemand:a,action:i})},De=()=>{L(null)};t.useEffect(()=>{const e=setTimeout(()=>{var e;de&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/generate-note-bill-amendment?applicationNumber="+(null===(e=x)||void 0===e?void 0:e.data.applicationDetails.amendment.amendmentId))},5e3);return()=>clearTimeout(e)},[de]);let Te=0;return null===(_=Q)||void 0===_||null===(f=_.filter(e=>{var n;return null==e||null===(n=e.taxHeadCode)||void 0===n?void 0:n.includes("ADHOC")}))||void 0===f||f.map(e=>{Te+=null==e?void 0:e.amount}),Q=null===(g=Q)||void 0===g?void 0:g.filter(e=>{var n;return!(null!=e&&null!==(n=e.taxHeadCode)&&void 0!==n&&n.includes("ADHOC"))}),l.createElement("form",{onSubmit:ie(e=>{var n,t;const l={Amendment:{consumerCode:w,tenantId:W,businessService:q,amendmentReason:null==ve?void 0:ve.code,reasonDocumentNumber:null==e?void 0:e.reasonDocumentNumber,effectiveFrom:new Date(null==e?void 0:e.effectiveFrom).getTime(),effectiveTill:new Date(null==e?void 0:e.effectiveTill).getTime(),documents:Object.values(null==e?void 0:e.DOCUMENTS).map(e=>{const n=v({},e,{documentType:null==e?void 0:e.id,fileUrl:null==e?void 0:e.url});return delete n.id,delete n.url,n}),demandDetails:Ne(e),additionalDetails:{searchBillDetails:ye(e),editForm:e}}};if("RE-SUBMIT-APPLICATION"!==(null===(n=x)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.action))_e.push("/digit-ui/employee/ws/response",l);else{var o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C;const e={businessId:null===(o=x)||void 0===o||null===(i=o.data)||void 0===i||null===(a=i.applicationDetails)||void 0===a||null===(r=a.amendment)||void 0===r?void 0:r.amendmentId,action:"RE-SUBMIT",tenantId:W,businessService:"WATER"===(null===(u=x)||void 0===u||null===(d=u.data)||void 0===d||null===(s=d.applicationDetails)||void 0===s||null===(c=s.applicationData)||void 0===c?void 0:c.serviceType)?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:"WATER"===(null===(p=x)||void 0===p||null===(m=p.data)||void 0===m||null===(E=m.applicationDetails)||void 0===E||null===(S=E.applicationData)||void 0===S?void 0:S.serviceType)?"WS":"SW"},n=v({},null===(_=x)||void 0===_||null===(f=_.data)||void 0===f||null===(g=f.applicationDetails)||void 0===g||null===(C=g.applicationData)||void 0===C?void 0:C.billAmendmentDetails,{workflow:e},null==l?void 0:l.Amendment);ue({AmendmentUpdate:n},{onError:(e,n)=>{L({key:"error",error:e,label:R("CS_WATER_UPDATE_APPLICATION_FAILED")}),setTimeout(De,5e3)},onSuccess:(e,n)=>{var t,l,o;if((null==e||null===(t=e.Amendments)||void 0===t?void 0:t.length)>0)return null!=n&&null!==(l=n.AmendmentUpdate)&&void 0!==l&&null!==(o=l.workflow)&&void 0!==o&&o.action.includes("RE-SUBMIT")&&L({key:"success",label:R("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}),void se(!0)}})}})},l.createElement("div",{style:{marginLeft:"20px"}},l.createElement(a.Header,null,null!==(C=x)&&void 0!==C&&null!==(N=C.data)&&void 0!==N&&N.action?R("WS_APP_FOR_WATER_AND_SEWERAGE_EDIT_LABEL"):R("WS_BILL_AMENDMENT_BUTTON"))),l.createElement(a.Card,null,l.createElement(a.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_ACKNO_CONNECTION_NO_LABEL")),l.createElement(a.CardText,{style:{marginBottom:"0px"}},w)),l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},R("WS_ADJUSTMENT_AMOUNT")),l.createElement(a.CardSectionSubText,{style:{marginBottom:"16px"}},R("WS_ADJUSTMENT_AMOUNT_ADDITION_TEXT")),Z?l.createElement(a.Loader,null):l.createElement("table",{cellPadding:"8px",cellSpacing:"10px"},l.createElement("div",{style:V&&z?{overflow:"scroll",maxWidth:"50%"}:{}},l.createElement("tbody",null,l.createElement("tr",{style:{textAlign:"left"}},l.createElement("th",null,R("WS_TAX_HEADS")),l.createElement("th",{style:{textAlign:"right"}},R("WS_CURRENT_AMOUNT")),l.createElement("th",{style:{paddingLeft:"150px"}},l.createElement(t.Fragment,null,l.createElement(r.Controller,{name:q+"_REDUCED_AMOUNT.VALUE",key:q+"_REDUCED_AMOUNT.VALUE",control:te,rules:{validate:e=>!(!e&&("WS"===q?null==me||!me.VALUE:null==Se||!Se.VALUE))},render:e=>{var n,t,o,i,r,u,d,s,c,v,p,m,E,S;return l.createElement("div",{style:{paddingTop:"20px"}},l.createElement(a.CheckBox,{style:{marginLeft:"35px"},label:R(q+"_REDUCED_AMOUNT"),onChange:n=>{n.target.checked?(e.onChange(!0),k(!0),j(!1),Ce(q+"_ADDITIONAL_AMOUNT")):(k(!1),e.onChange(!1))},disable:!(!P||0!=(null===(n=x)||void 0===n||null===(t=n.data)||void 0===t||null===(o=t.applicationDetails)||void 0===o||null===(i=o.amendment)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(u=r.editForm)||void 0===u||null===(d=u.WS_REDUCED_AMOUNT)||void 0===d?void 0:d.VALUE)&&0!=(null===(s=x)||void 0===s||null===(c=s.data)||void 0===c||null===(v=c.applicationDetails)||void 0===v||null===(p=v.amendment)||void 0===p||null===(m=p.additionalDetails)||void 0===m||null===(E=m.editForm)||void 0===E||null===(S=E.SW_REDUCED_AMOUNT)||void 0===S?void 0:S.VALUE)),checked:null==e?void 0:e.value}))}}),null!=ae&&null!==(y=ae.WS_REDUCED_AMOUNT)&&void 0!==y&&y.VALUE&&1==U?l.createElement(a.CardLabelError,null,R("WS_REQUIRED_FIELD")):null)),l.createElement("th",null,l.createElement(t.Fragment,null,l.createElement(r.Controller,{name:q+"_ADDITIONAL_AMOUNT.VALUE",key:q+"_ADDITIONAL_AMOUNT.VALUE",control:te,rules:{validate:e=>!(!e&&("WS"===q?null==pe||!pe.VALUE:null==Ee||!Ee.VALUE))},render:e=>{var n,t,o,i,r,u,d,s,c,v,p,m,E,S;return l.createElement("div",{style:{paddingTop:"17px"}},l.createElement(a.CheckBox,{style:{marginLeft:"35px"},label:R(q+"_ADDITIONAL_AMOUNT"),onChange:n=>{n.target.checked?(e.onChange(!0),j(!0),k(!1),Ce(q+"_REDUCED_AMOUNT")):(j(!1),e.onChange(!1))},disable:!(!P||0!=(null===(n=x)||void 0===n||null===(t=n.data)||void 0===t||null===(o=t.applicationDetails)||void 0===o||null===(i=o.amendment)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(u=r.editForm)||void 0===u||null===(d=u.WS_ADDITIONAL_AMOUNT)||void 0===d?void 0:d.VALUE)&&0!=(null===(s=x)||void 0===s||null===(c=s.data)||void 0===c||null===(v=c.applicationDetails)||void 0===v||null===(p=v.amendment)||void 0===p||null===(m=p.additionalDetails)||void 0===m||null===(E=m.editForm)||void 0===E||null===(S=E.WS_ADDITIONAL_AMOUNT)||void 0===S?void 0:S.VALUE)),checked:null==e?void 0:e.value}))}}),null!=ae&&null!==(D=ae.WS_ADDITIONAL_AMOUNT)&&void 0!==D&&D.VALUE&&1==H?l.createElement(a.CardLabelError,null,R("WS_REQUIRED_FIELD")):null))),null===(T=Q)||void 0===T?void 0:T.map(e=>{var n,o,i,r,u,d,s,c,v,p,m;return l.createElement("tr",null,l.createElement("td",{style:{paddingRight:"60px",fontWeight:"700"}},R(""+e.taxHeadCode)),l.createElement("td",{style:{textAlign:"end"}},"₹ ",e.amount),l.createElement("div",null,l.createElement("td",{style:{paddingRight:"60px",paddingLeft:"150px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=pe&&pe.VALUE):!(null!=Ee&&Ee.VALUE),type:"number",name:q+"_REDUCED_AMOUNT."+e.taxHeadCode,inputRef:ne({max:{value:e.amount,message:R(q+"_ERROR_ENTER_LESS_THAN_MAX_VALUE")},pattern:{value:/^[+]?[1-9]\d*$/,message:R("CS_INVALID_INPUT")}})}))),"WS"===q?(null==ae||null===(n=ae.WS_REDUCED_AMOUNT)||void 0===n?void 0:n[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginBottom:"-20px",marginTop:"-30px",marginLeft:"150px"}},null==ae||null===(o=ae.WS_REDUCED_AMOUNT)||void 0===o||null===(i=o[e.taxHeadCode])||void 0===i?void 0:i.message):(null==ae||null===(r=ae.SW_REDUCED_AMOUNT)||void 0===r?void 0:r[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginBottom:"-20px",marginTop:"-30px",marginLeft:"150px"}},null==ae||null===(u=ae.SW_REDUCED_AMOUNT)||void 0===u?void 0:u[e.taxHeadCode].message)),l.createElement("td",{style:{paddingRight:"60px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=me&&me.VALUE):!(null!=Se&&Se.VALUE),type:"number",name:q+"_ADDITIONAL_AMOUNT."+e.taxHeadCode,inputRef:ne({pattern:{value:/^[+]?[1-9]\d*$/,message:R("CS_INVALID_INPUT")}})})),"WS"===q?(null==ae||null===(d=ae.WS_ADDITIONAL_AMOUNT)||void 0===d?void 0:d[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginTop:"-19px"}},null==ae||null===(s=ae.WS_ADDITIONAL_AMOUNT)||void 0===s||null===(c=s[e.taxHeadCode])||void 0===c?void 0:c.message):(null==ae||null===(v=ae.SW_ADDITIONAL_AMOUNT)||void 0===v?void 0:v[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginTop:"-19px"}},null==ae||null===(p=ae.SW_ADDITIONAL_AMOUNT)||void 0===p||null===(m=p[e.taxHeadCode])||void 0===m?void 0:m.message)))}),l.createElement("tr",null,l.createElement("td",{style:{paddingRight:"60px",fontWeight:"700"}},R("WS_REBATE_PENALTY"),l.createElement("div",{className:"tooltip",style:{marginLeft:"10px",marginBottom:"-4px"}},l.createElement(a.InfoBannerIcon,{fill:"#0b0c0c",style:!0}),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"nowrap",fontSize:"medium"}},"1. "+R("WS_ADHOC_REBATE_TOOLTIP"),l.createElement("br",null),l.createElement("br",null),"2. "+R("WS_ADHOC_PENALTY_TOOLTIP")))),l.createElement("td",{style:{textAlign:"end"}},"₹ ",Te||0),l.createElement("td",{style:{paddingRight:"60px",paddingLeft:"150px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=pe&&pe.VALUE):!(null!=Ee&&Ee.VALUE),name:q+"_REBATE",inputRef:ne()}))),l.createElement("td",{style:{paddingRight:"60px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=me&&me.VALUE):!(null!=Se&&Se.VALUE),name:q+"_PENALTY",inputRef:ne()}))))))),Y?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},R("WS_ADD_DEMAND_REVISION_BASIS")),l.createElement(a.CardSectionSubText,{style:{marginBottom:"16px"}},R("WS_SELECT_DEMAND_REVISION")),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_DEMAND_REVISION_BASIS")+" *"),l.createElement(r.Controller,{name:"amendmentReason",control:te,rules:{required:!0},render:e=>l.createElement(a.Dropdown,{style:V&&z?{}:{width:"640px"},option:G,selected:null==e?void 0:e.value,optionKey:"code",t:R,select:null==e?void 0:e.onChange})})),null!=ae&&ae.amendmentReason?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")):null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("COURT_CASE_SETTLEMENT"===(null==ve?void 0:ve.code)?"WS_COURT_ORDER_NO":"ARREAR_WRITE_OFF"===(null==ve?void 0:ve.code)||"ONE_TIME_SETTLEMENT"===(null==ve?void 0:ve.code)?"WS_GOVERNMENT_NOTIFICATION_NUMBER":"WS_DOCUMENT_NO")+" *"),l.createElement("div",{className:"reasonDocumentNumber"},l.createElement(a.TextInput,{style:V&&z?{}:{width:"640px"},name:"reasonDocumentNumber",inputRef:ne({required:!0})}))),null!=ae&&ae.reasonDocumentNumber?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")):null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_BILL_AMEND_EFFECTIVE_FROM")+" *"),l.createElement(r.Controller,{render:e=>l.createElement(a.DatePicker,{style:V&&z?{}:{width:"640px"},date:e.value,disabled:!1,onChange:e.onChange}),name:"effectiveFrom",rules:{required:!0},control:te})),null!=ae&&ae.effectiveFrom?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")):null,"COURT_CASE_SETTLEMENT"!==(null==ve?void 0:ve.code)&&l.createElement("div",null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_BILL_AMEND_EFFECTIVE_TILL")+" *"),l.createElement(r.Controller,{render:e=>l.createElement(a.DatePicker,{style:V&&z?{}:{width:"640px"},date:e.value,disabled:!1,onChange:e.onChange}),name:"effectiveTill",rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>(ce?new Date(ce).getTime():(new Date).getTime())||"Invalid format"}},control:te})),"required"===(null==ae||null===(h=ae.effectiveTill)||void 0===h?void 0:h.type)&&l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")),"Invalid format"===(null==ae||null===(A=ae.effectiveTill)||void 0===A?void 0:A.message)&&l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("ERR_DEFAULT_INPUT_FIELD_MSG")))),ve?l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},R("WS_DOCUMENT_REQUIRED")):null,null==fe?void 0:fe.map(e=>{var n;return l.createElement("div",{style:{marginBottom:"25px"}},l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R(""+(null==e?void 0:e.documentType)),null!=e&&e.required?"*":null),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:"DOCUMENTS."+(null==e?void 0:e.documentType),control:te,rules:null!=e&&e.required?{required:!0}:{},render:n=>l.createElement(a.UploadFile,{id:"ws-doc-"+e.documentType,onUpload:t=>function(e,n,t){return Promise.resolve(function(e,n,t){try{return F(""),Promise.resolve(function(l,o){try{var i=he(function(){const l=function(l,o,i,a,r,u){var d,s,c,v;if((null==e||null===(l=e.target)||void 0===l||null===(o=l.files)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.size)<5242880&&/(.*?)(jpg|jpeg|png|pdf)$/i.test(null==e||null===(a=e.target)||void 0===a||null===(r=a.files)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.type))return ge({type:"addLoader",payload:{id:n}}),Promise.resolve(Digit.UploadServices.Filestorage("WS",null==e||null===(d=e.target)||void 0===d?void 0:d.files[0],W)).then(function(l){var o,i,a;const r=null==l||null===(o=l.data)||void 0===o||null===(i=o.files)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.fileStoreId,u=function(){if(r)return Promise.resolve(Digit.UploadServices.Filefetch([r],W)).then(function(l){var o,i,a,u;let{data:d}=l;const s=null==d||null===(o=d.fileStoreIds)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.url;ge({type:"upload",payload:{id:n,url:s}}),t.onChange({id:n,url:s,fileName:null==e||null===(a=e.target)||void 0===a||null===(u=a.files[0])||void 0===u?void 0:u.name,fileStoreId:r,fileStore:r})});alert(R("CS_FILE_UPLOAD_ERROR"))}();if(u&&u.then)return u.then(function(){})});(null==e||null===(s=e.target)||void 0===s||null===(c=s.files)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.size)>5242880?F({message:"FILE_SIZE_EXCEEDED",documentType:n}):F({message:"FILE_TYPE_MISMATCHED",documentType:n})}();if(l&&l.then)return l.then(function(){})},function(){})}catch(e){return o(!0,e)}return i&&i.then?i.then(o.bind(null,!1),o.bind(null,!0)):o(!1,i)}(0,function(e,t){if(ge({type:"removeLoader",payload:{id:n}}),e)throw t;return t}))}catch(e){return Promise.reject(e)}}(e,n,t)).then(function(){})}(t,null==e?void 0:e.documentType,n),onDelete:()=>ge({type:"remove",payload:{id:null==e?void 0:e.documentType}}),style:V&&z?{}:{width:"640px"},message:null!=e&&e.url?"1 "+R("CS_ACTION_FILEUPLOADED"):R("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",textStyles:{width:"100%"},inputStyles:{width:"280px"},error:null==B?void 0:B.message})}))),null!=ae&&null!==(n=ae.DOCUMENTS)&&void 0!==n&&n[null==e?void 0:e.documentType]||B&&(null==B?void 0:B.documentType)===e.documentType?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px"}},R(B&&(null==B?void 0:B.documentType)===e.documentType?null==B?void 0:B.message:"WS_NO_FILE_SELECTED")):null)})),b?l.createElement(a.Toast,{isDleteBtn:!0,error:null==b?void 0:b.error,label:null==b?void 0:b.label,onClose:De}):null,l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{submit:!0,label:null!==(I=x)&&void 0!==I&&null!==(O=I.data)&&void 0!==O&&O.action?R("WF_CITIZEN_NEWSW1_RESUBMIT_APPLICATION"):R("WS_COMMON_BUTTON_SUBMIT"),disabled:"WS"==q&&U&&(""==re().WS_REDUCED_AMOUNT.WS_CHARGE||null==re().WS_REDUCED_AMOUNT.WS_CHARGE)&&(""==re().WS_REDUCED_AMOUNT.WS_TIME_PENALTY||null==re().WS_REDUCED_AMOUNT.WS_TIME_PENALTY)&&(""==re().WS_REDUCED_AMOUNT.WS_TIME_INTEREST||null==re().WS_REDUCED_AMOUNT.WS_TIME_INTEREST)&&(""==re().WS_REDUCED_AMOUNT.WS_WATER_CESS||null==re().WS_REDUCED_AMOUNT.WS_WATER_CESS)||"SW"==q&&U&&(""==re().SW_REDUCED_AMOUNT.SW_CHARGE||null==re().SW_REDUCED_AMOUNT.SW_CHARGE)&&(""==re().SW_REDUCED_AMOUNT.SW_TIME_PENALTY||null==re().SW_REDUCED_AMOUNT.SW_TIME_PENALTY)&&(""==re().SW_REDUCED_AMOUNT.SW_TIME_INTEREST||null==re().SW_REDUCED_AMOUNT.SW_TIME_INTEREST)&&(""==re().SW_REDUCED_AMOUNT.SW_SEWERAGE_CESS||null==re().SW_REDUCED_AMOUNT.SW_SEWERAGE_CESS)||"WS"==q&&H&&(""==re().WS_ADDITIONAL_AMOUNT.WS_CHARGE||null==re().WS_ADDITIONAL_AMOUNT.WS_CHARGE)&&(""==re().WS_ADDITIONAL_AMOUNT.WS_TIME_PENALTY||null==re().WS_ADDITIONAL_AMOUNT.WS_TIME_PENALTY)&&(""==re().WS_ADDITIONAL_AMOUNT.WS_TIME_INTEREST||null==re().WS_ADDITIONAL_AMOUNT.WS_TIME_INTEREST)&&(""==re().WS_ADDITIONAL_AMOUNT.WS_WATER_CESS||null==re().WS_ADDITIONAL_AMOUNT.WS_WATER_CESS)||"SW"==q&&H&&(""==re().SW_ADDITIONAL_AMOUNT.SW_CHARGE||null==re().SW_ADDITIONAL_AMOUNT.SW_CHARGE)&&(""==re().SW_ADDITIONAL_AMOUNT.SW_TIME_PENALTY||null==re().SW_ADDITIONAL_AMOUNT.SW_TIME_PENALTY)&&(""==re().SW_ADDITIONAL_AMOUNT.SW_TIME_INTEREST||null==re().SW_ADDITIONAL_AMOUNT.SW_TIME_INTEREST)&&(""==re().SW_ADDITIONAL_AMOUNT.SW_SEWERAGE_CESS||null==re().SW_ADDITIONAL_AMOUNT.SW_SEWERAGE_CESS)})))},WSRequiredDocuments:e=>{let{path:n}=e;const{search:r}=i.useLocation();let{state:u}=i.useLocation();u=u?"string"==typeof u?JSON.parse(u):u:{};const d=i.useHistory(),{t:s}=o.useTranslation(),c=Digit.ULBService.getStateId(),v=t.useRef(),{isLoading:p,data:m}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSMDMSBillAmendment({tenantId:c});return l.createElement(t.Fragment,null,l.createElement("div",{ref:v},l.createElement("div",{className:"options"},l.createElement(a.Header,null,s("ES_COMMON_WS_DOCUMENTS_REQUIRED")),l.createElement("div",{className:"mrsm",style:{marginRight:"35px"},onClick:()=>Digit.Download.PDF(v,s("ES_COMMON_WS_DOCUMENTS_REQUIRED"))},l.createElement(a.DownloadIcon,{className:"mrsm"}),s("ES_WS_REQUIRED_DOCS_DOWNLOAD"))),l.createElement(a.Card,{style:{position:"relative"},className:"employeeCard-override"},p?l.createElement(a.Loader,null):null==m?void 0:m.map(e=>l.createElement(t.Fragment,null,l.createElement(a.CardHeader,null,s(e.code).replaceAll("_"," ")),l.createElement(a.CardLabel,null,s("WS_DOCS_REQ_INFO")),e.allowedDocuments.allowedDocs.map((e,n)=>l.createElement(a.CardLabelDesc,null,n+1,". ",s(""+e.documentType))))))),l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{label:s("WS_COMMON_BUTTON_APPLY"),onSubmit:()=>{var e;d.push(n+"/bill-amendment"+r,JSON.stringify({data:null===(e=u)||void 0===e?void 0:e.data}))}})))},WSNewApplication:()=>{const{t:e}=o.useTranslation(),n=(i.useLocation(),i.useHistory());g(location.search);const[r,u]=t.useState(!1),[d,s]=t.useState(!1),[c,p]=t.useState(null),[m,E]=t.useState({}),[S,_]=t.useState(null),[f,C]=t.useState({head:"",body:[]});let N=Digit.ULBService.getCurrentTenantId();N||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const y=Digit.ULBService.getStateId();let{data:D,isLoading:T}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(y,{});const[A,I]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[O,b,L]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:R}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:A},tenantId:N},{filters:{propertyIds:A},tenantId:N,enabled:!(!A||""==A)});t.useEffect(()=>{if(!T){var e;const n=D.find(e=>e.hideInCitizen&&e.isCreate);n.head="WS_APP_FOR_WATER_AND_SEWERAGE_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isCreateConnection&&t.push(e)}),n.body=t,C(n)}},[D]),t.useEffect(()=>{var e,n,t,l;!A&&(null==O||null===(e=O.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&I(null==O||null===(t=O.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==O?void 0:O.cpt]),t.useEffect(()=>{var e;b(v({},O,{cpt:{details:null==R||null===(e=R.Properties)||void 0===e?void 0:e[0]}}))},[R]);const{mutate:w}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:W}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:P}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:M}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),x=()=>{p(null)};return d||T?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,e(f.head))),l.createElement(a.FormComposer,{config:f.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o,i,a,r;U.isEqual(O,n)||(b(v({},O,n)),sessionStorage.setItem("FORMSTATE_ERRORS",JSON.stringify(null==t?void 0:t.errors))),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&null!=t&&null!==(l=t.errors)&&void 0!==l&&null!==(o=l.ConnectionHolderDetails)&&void 0!==o&&o.type&&1==(null===(i=Object.keys(null==t||null===(a=t.errors)||void 0===a||null===(r=a.ConnectionHolderDetails)||void 0===r?void 0:r.type))||void 0===i?void 0:i.length)&&t.errors.ConnectionHolderDetails&&Object.values(t.errors.ConnectionHolderDetails.type).filter(e=>{var n;return"required"===e.type&&""!==(null==e||null===(n=e.ref)||void 0===n?void 0:n.value)}).length>0?u(!0):u(!Object.keys(t.errors).length)},label:e("CS_COMMON_SUBMIT"),onSubmit:function(e){try{var t,l,o;if(!(null!=e&&null!==(t=e.cpt)&&void 0!==t&&t.id||null!=R&&null!==(l=R.Properties)&&void 0!==l&&l[0]||null!=e&&null!==(o=e.cpt)&&void 0!==o&&o.details&&R))return p({key:"error",message:"ERR_INVALID_PROPERTY_ID"}),Promise.resolve();const i=sessionStorage.getItem("FORMSTATE_ERRORS"),a="string"==typeof i?JSON.parse(i):{};return Promise.resolve(function(t,l,o){var i,r;if(!(Object.keys(a).length>0)||1==Object.keys(a).length&&null!=a&&null!==(t=a.ConnectionHolderDetails)&&void 0!==t&&t.type&&1==(null===(l=Object.keys(null==a||null===(o=a.ConnectionHolderDetails)||void 0===o?void 0:o.type))||void 0===l?void 0:l.length)&&a.ConnectionHolderDetails&&Object.values(a.ConnectionHolderDetails.type).filter(e=>{var n;return"required"===e.type&&""!==(null==e||null===(n=e.ref)||void 0===n?void 0:n.value)}).length>0)return null!=e&&null!==(i=e.cpt)&&void 0!==i&&i.details||(e.cpt={details:null==R||null===(r=R.Properties)||void 0===r?void 0:r[0]}),Lt(e),Promise.resolve(function(e){try{var n,t,l,o,i,a,r,u,d,s,c,v,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge;null==e||null===(n=e.cpt)||void 0===n||null===(t=n.details)||void 0===t||null===(l=t.owners)||void 0===l||l.forEach(e=>{null!=e&&e.permanentAddress&&(e.correspondenceAddress=null==e?void 0:e.permanentAddress)});let Ce={water:null==e||null===(o=e.ConnectionDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.water,sewerage:null==e||null===(a=e.ConnectionDetails)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.sewerage,proposedTaps:(null==e||null===(u=e.ConnectionDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.proposedTaps)&&Number(null==e||null===(s=e.ConnectionDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.proposedTaps),proposedPipeSize:(null==e||null===(v=e.ConnectionDetails)||void 0===v||null===(p=v[0])||void 0===p||null===(m=p.proposedPipeSize)||void 0===m?void 0:m.size)&&Number(null==e||null===(E=e.ConnectionDetails)||void 0===E||null===(S=E[0])||void 0===S||null===(_=S.proposedPipeSize)||void 0===_?void 0:_.size),proposedWaterClosets:(null==e||null===(f=e.ConnectionDetails)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.proposedWaterClosets)&&Number(null==e||null===(C=e.ConnectionDetails)||void 0===C||null===(N=C[0])||void 0===N?void 0:N.proposedWaterClosets),proposedToilets:(null==e||null===(y=e.ConnectionDetails)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.proposedToilets)&&Number(null==e||null===(T=e.ConnectionDetails)||void 0===T||null===(h=T[0])||void 0===h?void 0:h.proposedToilets),connectionHolders:null!=e&&null!==(A=e.ConnectionHolderDetails)&&void 0!==A&&null!==(I=A[0])&&void 0!==I&&I.sameAsOwnerDetails?null:[{correspondenceAddress:(null==e||null===(O=e.ConnectionHolderDetails)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.address)||"",fatherOrHusbandName:(null==e||null===(L=e.ConnectionHolderDetails)||void 0===L||null===(R=L[0])||void 0===R?void 0:R.guardian)||"",gender:(null==e||null===(w=e.ConnectionHolderDetails)||void 0===w||null===(W=w[0])||void 0===W||null===(P=W.gender)||void 0===P?void 0:P.code)||"",mobileNumber:(null==e||null===(M=e.ConnectionHolderDetails)||void 0===M||null===(x=M[0])||void 0===x?void 0:x.mobileNumber)||"",name:(null==e||null===(B=e.ConnectionHolderDetails)||void 0===B||null===(F=B[0])||void 0===F?void 0:F.name)||"",ownerType:(null==e||null===(U=e.ConnectionHolderDetails)||void 0===U||null===(k=U[0])||void 0===k||null===(H=k.ownerType)||void 0===H?void 0:H.code)||"",relationship:(null==e||null===(j=e.ConnectionHolderDetails)||void 0===j||null===(V=j[0])||void 0===V||null===(z=V.relationship)||void 0===z?void 0:z.code)||"",sameAsPropertyAddress:null==e||null===(Y=e.ConnectionHolderDetails)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.sameAsOwnerDetails,emailId:(null==e||null===(q=e.ConnectionHolderDetails)||void 0===q?void 0:q[0].emailId)||""}],service:null==e||null===(K=e.ConnectionDetails)||void 0===K||null===(X=K[0])||void 0===X||!X.water||null!=e&&null!==(Z=e.ConnectionDetails)&&void 0!==Z&&null!==($=Z[0])&&void 0!==$&&$.sewerage?null!=e&&null!==(J=e.ConnectionDetails)&&void 0!==J&&null!==(Q=J[0])&&void 0!==Q&&Q.water||null==e||null===(ee=e.ConnectionDetails)||void 0===ee||null===(ne=ee[0])||void 0===ne||!ne.sewerage?"Water And Sewerage":"Sewerage":"Water",property:null==e||null===(te=e.cpt)||void 0===te?void 0:te.details,propertyId:null==e||null===(le=e.cpt)||void 0===le||null===(oe=le.details)||void 0===oe?void 0:oe.propertyId,roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==e||null===(ie=e.cpt)||void 0===ie||null===(ae=ie.details)||void 0===ae||null===(re=ae.address)||void 0===re||null===(ue=re.locality)||void 0===ue?void 0:ue.code},tenantId:null==e||null===(de=e.cpt)||void 0===de||null===(se=de.details)||void 0===se||null===(ce=se.address)||void 0===ce?void 0:ce.tenantId,processInstance:{action:"INITIATE"},channel:"CFC_COUNTER"};return sessionStorage.setItem("WS_DOCUMENTS_INOF",JSON.stringify(null==e||null===(ve=e.DocumentsRequired)||void 0===ve?void 0:ve.documents)),sessionStorage.setItem("WS_PROPERTY_INOF",JSON.stringify(null==e||null===(pe=e.cpt)||void 0===pe?void 0:pe.details)),Ce=null!==(me=Digit)&&void 0!==me&&null!==(Ee=me.Customizations)&&void 0!==Ee&&null!==(Se=Ee.WS)&&void 0!==Se&&Se.customiseCreatePayloadOfWS?null===(_e=Digit)||void 0===_e||null===(fe=_e.Customizations)||void 0===fe||null===(ge=fe.WS)||void 0===ge?void 0:ge.customiseCreatePayloadOfWS(e,Ce):Ce,Promise.resolve(Ce)}catch(e){return Promise.reject(e)}}(e)).then(function(e){let t=!1;null!=e&&e.water&&null!=e&&e.sewerage&&(t=!0);let l={WaterConnection:e,disconnectRequest:!1,reconnectRequest:!1},o={SewerageConnection:e,disconnectRequest:!1,reconnectRequest:!1};t?(_(!0),sessionStorage.setItem("setWaterAndSewerageBoth",JSON.stringify(!0))):sessionStorage.setItem("setWaterAndSewerageBoth",JSON.stringify(!1));const i=function(){if(null!=e&&e.water&&null!=e&&e.sewerage){const e=function(){if(w&&P)return s(!0),Promise.resolve(w(l,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(h(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){W({WaterConnection:e,disconnectRequest:!1,reconnectRequest:!1},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return E(v({},m,{waterConnection:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),Promise.resolve(P(o,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(t,l){try{var o;return Promise.resolve(h(null==t||null===(o=t.SewerageConnections)||void 0===o?void 0:o[0],"SEWERAGE")).then(function(t){return Promise.resolve(M({SewerageConnection:t,disconnectRequest:!1,reconnectRequest:!1},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(t,l){try{var o,i,a,r,u;return E(v({},m,{sewerageConnection:null==t||null===(o=t.SewerageConnections)||void 0===o?void 0:o[0]})),L(),n.push("/digit-ui/employee/ws/ws-response?applicationNumber="+(null==e||null===(i=e.WaterConnection)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.applicationNo)+"&applicationNumber1="+(null==t||null===(r=t.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.applicationNo)),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}catch(e){return Promise.reject(e)}}})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}else{const t=function(){if(null==e||!e.water||null!=e&&e.sewerage){const t=function(){if(null!=e&&e.sewerage&&(null==e||!e.water)){const e=function(){if(P)return s(!0),Promise.resolve(P(o,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(h(null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0],"SEWERAGE")).then(function(e){return Promise.resolve(M({SewerageConnection:e},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{var l,o,i;E(v({},m,{sewerageConnection:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0]})),L(),n.push("/digit-ui/employee/ws/ws-response?applicationNumber1="+(null==e||null===(o=e.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}else{const e=function(){if(w)return s(!0),Promise.resolve(w(l,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(h(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){W({WaterConnection:e},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{var l,o,i;E(v({},m,{waterConnection:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),L(),n.push("/digit-ui/employee/ws/ws-response?applicationNumber="+(null==e||null===(o=e.WaterConnection)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo))}})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(i&&i.then)return i.then(function(){})});p({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"})}())}catch(e){return Promise.reject(e)}},defaultValues:O}),c&&l.createElement(a.Toast,{isDleteBtn:!0,error:"error"===(null==c?void 0:c.key),warning:null==c?void 0:c.warning,label:e(null==c?void 0:c.message),onClose:()=>{p(null)},isWarning:null==c?void 0:c.isWarning}))},WSApplicationDetails:()=>{var e,n,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,h,A,I,O,b,R,w,W,P,M,B,F,U,k,H,j,V,z,Y,G,q,K,X,$,J,Q,ee,ne,te,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e;i.useParams();const{t:fe}=o.useTranslation(),ge=Digit.UserService.getUser(),Ce=Digit.ULBService.getCurrentTenantId(),Ne=Digit.ULBService.getStateId(),[ye,De]=t.useState(null),[Te,he]=t.useState(null),[Ae,Ie]=t.useState(!1),[Oe,be]=(i.useHistory(),Digit.ULBService.getStateId(),window.Digit.Utils.browser.isMobile(),t.useState(!1)),[Le,Re]=t.useState(!1);let we=g(location.search);const We=null==we?void 0:we.applicationNumber,Pe=null==we?void 0:we.service,Me=t.useRef();sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const[xe,Be,Fe]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[Ue,ke,He]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),{isBillingServiceLoading:je}=Digit.Hooks.obps.useMDMS(Ne,"BillingService",["BusinessService"]),{isCommonmastersLoading:Ve,data:ze}=Digit.Hooks.obps.useMDMS(Ne,"common-masters",["uiCommonPay"]),{isServicesMasterLoading:Ye,data:Ge}=Digit.Hooks.ws.useMDMS(Ne,"ws-services-masters",["WSEditApplicationByConfigUser"]),qe=(null==ze||null===(e=ze["common-masters"])||void 0===e?void 0:e.uiCommonPay)||[],Ke=qe&&qe.findIndex(e=>"WS.ONE_TIME_FEE"==e.code);let Xe="";Xe=Ke>-1?qe[Ke]:qe&&qe.filter(e=>"DEFAULT"===e.code);const Ze=(null===(n=Xe)||void 0===n?void 0:n.receiptKey)||"consolidatedreceipt",{data:$e}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"DataSecurity",[{name:"SecurityPolicy"}],{select:e=>{var n,t;return(null==e||null===(n=e.DataSecurity)||void 0===n||null===(t=n.SecurityPolicy)||void 0===t?void 0:t.find(e=>"User"==(null==e?void 0:e.model)))||{}}});let{isLoading:Je,data:Qe}=Digit.Hooks.ws.useWSDetailsPage(fe,Ce,We,Pe,ge,{privacy:Digit.Utils.getPrivacyObject()}),en=Digit.Hooks.useWorkflowDetails({tenantId:Ce,id:We,moduleCode:null==Qe||null===(r=Qe.processInstancesDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.businessService,config:{enabled:!(null==Qe||null===(d=Qe.processInstancesDetails)||void 0===d||null===(s=d[0])||void 0===s||!s.businessService),privacy:Digit.Utils.getPrivacyObject()}});const{data:nn}=Digit.Hooks.useRecieptSearch({tenantId:Ce,businessService:"WATER"==Pe?"WS.ONE_TIME_FEE":"SW.ONE_TIME_FEE",consumerCodes:null==Qe||null===(c=Qe.applicationData)||void 0===c?void 0:c.applicationNo},{enabled:!(null==Qe||null===(p=Qe.applicationData)||void 0===p||null===(m=p.applicationType)||void 0===m||!m.includes("NEW_")),privacy:Digit.Utils.getPrivacyObject()}),{data:tn}=Digit.Hooks.ws.useOldValue({tenantId:Ce,filters:{connectionNumber:null==Qe||null===(E=Qe.applicationData)||void 0===E?void 0:E.connectionNo,isConnectionSearch:!0},businessService:Pe},{enabled:!(null==Qe||null===(S=Qe.applicationData)||void 0===S||null===(_=S.applicationType)||void 0===_||!_.includes("MODIFY_")),privacy:Digit.Utils.getPrivacyObject()});sessionStorage.removeItem("eyeIconClicked");const ln=[null==tn?void 0:tn.WaterConnection,null==tn?void 0:tn.SewerageConnections],on=null==ln?void 0:ln.filter(e=>e),an=null==Qe?void 0:Qe.applicationData,rn=null===(f=on[0])||void 0===f?void 0:f.flatMap(e=>{const n=Object.entries(e).filter(e=>{let[n,t]=e;return(null==an?void 0:an[n])!==t});return null!=n&&n.length?Object.fromEntries(n):[]}),{mutate:un}=Digit.Hooks.ws.useWSApplicationActions(Pe),dn=()=>{var e,n,t,l;if("WSReconnection"==(null==Qe||null===(e=Qe.processInstancesDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.businessService)||"SWReconnection"==(null==Qe||null===(t=Qe.processInstancesDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.businessService))return!0;{var o,i,a,r,u,d,s,c,v,p,m,E,S;const e=null==Qe||null===(o=Qe.applicationData)||void 0===o?void 0:o.connectionType,n=0===(null==Qe||null===(i=Qe.applicationData)||void 0===i?void 0:i.noOfTaps)?null:null==Qe||null===(a=Qe.applicationData)||void 0===a?void 0:a.noOfTaps,t=0===(null==Qe||null===(r=Qe.applicationData)||void 0===r?void 0:r.pipeSize)?null:null==Qe||null===(u=Qe.applicationData)||void 0===u?void 0:u.pipeSize,l=null==Qe||null===(d=Qe.applicationData)||void 0===d?void 0:d.waterSource,_=0===(null==Qe||null===(s=Qe.applicationData)||void 0===s?void 0:s.noOfWaterClosets)?null:null==Qe||null===(c=Qe.applicationData)||void 0===c?void 0:c.noOfWaterClosets,f=0===(null==Qe||null===(v=Qe.applicationData)||void 0===v?void 0:v.noOfToilets)?null:null==Qe||null===(p=Qe.applicationData)||void 0===p?void 0:p.noOfToilets,g=null==Qe||null===(m=Qe.applicationData)||void 0===m||null===(E=m.additionalDetails)||void 0===E?void 0:E.detailsProvidedBy,C=null==Qe||null===(S=Qe.applicationData)||void 0===S?void 0:S.roadCuttingInfo;return!!(e&&(n&&t&&l||_&&f)&&g&&C)}};let sn=[],cn=(null==Qe||null===(C=Qe.applicationData)||void 0===C?void 0:C.applicationStatus)||"";var vn,pn;null==en||null===(N=en.data)||void 0===N||null===(y=N.actionState)||void 0===y||null===(D=y.nextActions)||void 0===D||D.forEach(e=>{if("ACTIVATE_CONNECTION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/activate-connection?applicationNumber="+We+"&service="+Pe+"&action=ACTIVATE_CONNECTION",state:null==Qe?void 0:Qe.applicationData}),"RESUBMIT_APPLICATION"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(n=Qe.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==Ge||null===(t=Ge["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&cn===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(i=Qe.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:Qe,action:"RESUBMIT_APPLICATION"}}}var a;"SUBMIT_APPLICATION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/modify-application-edit?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(a=Qe.propertyDetails)||void 0===a?void 0:a.propertyId),state:Qe})}),!((null==en||null===(h=en.data)||void 0===h||null===(A=h.nextActions)||void 0===A?void 0:A.length)>0&&(null==en||null===(I=en.data)||void 0===I||null===(O=I.actionState)||void 0===O||null===(b=O.nextActions)||void 0===b?void 0:b.length)>0)||null!=en&&null!==(R=en.data)&&void 0!==R&&null!==(w=R.actionState)&&void 0!==w&&null!==(W=w.nextActions)&&void 0!==W&&W.find(e=>"EDIT"===e.action)||null!=en&&null!==(P=en.data)&&void 0!==P&&null!==(M=P.actionState)&&void 0!==M&&null!==(B=M.nextActions)&&void 0!==B&&B.find(e=>"RESUBMIT_APPLICATION"===e.action)||null!=en&&null!==(F=en.data)&&void 0!==F&&null!==(U=F.actionState)&&void 0!==U&&null!==(k=U.nextActions)&&void 0!==k&&k.find(e=>"ACTIVATE_CONNECTION"===e.action)||null!=en&&null!==(H=en.data)&&void 0!==H&&null!==(j=H.actionState)&&void 0!==j&&null!==(V=j.nextActions)&&void 0!==V&&V.find(e=>"SUBMIT_APPLICATION"===e.action)||null==en||null===(vn=en.data)||void 0===vn||null===(pn=vn.nextActions)||void 0===pn||pn.forEach(e=>{"EDIT"==e.action&&en.data.actionState.nextActions.push(e)}),null==en||null===(z=en.data)||void 0===z||null===(Y=z.actionState)||void 0===Y||null===(G=Y.nextActions)||void 0===G||G.forEach(e=>{if("EDIT"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(n=Qe.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==Ge||null===(t=Ge["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&cn===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(i=Qe.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:Qe,action:"VERIFY_AND_FORWARD"}}}}),null==en||null===(q=en.data)||void 0===q||null===(K=q.nextActions)||void 0===K||K.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==cn||dn()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==en||null===(X=en.data)||void 0===X||null===($=X.actionState)||void 0===$||null===(J=$.nextActions)||void 0===J||J.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==cn||dn()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==en||null===(Q=en.data)||void 0===Q||null===(ee=Q.nextActions)||void 0===ee||ee.forEach(e=>{var n,t,l,o,i,a;"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll="WSReconnection"==(null==en||null===(n=en.data)||void 0===n||null===(t=n.processInstances)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.businessService)?{pathname:"WSReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:"SWReconnection"==(null==en||null===(o=en.data)||void 0===o||null===(i=o.processInstances)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.businessService)?{pathname:"SWReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:{pathname:L(we)+"/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId})}),null==en||null===(ne=en.data)||void 0===ne||null===(te=ne.actionState)||void 0===te||null===(oe=te.nextActions)||void 0===oe||oe.forEach(e=>{var n,t,l,o,i,a;console.log("workflowDetails",en),"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll="WSReconnection"==(null==en||null===(n=en.data)||void 0===n||null===(t=n.processInstances)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.businessService)?{pathname:"WSReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:"SWReconnection"==(null==en||null===(o=en.data)||void 0===o||null===(i=o.processInstances)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.businessService)?{pathname:"SWReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:{pathname:L(we)+"/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId})});const mn="WATER"===Pe?null==tn||null===(ie=tn.WaterConnection)||void 0===ie?void 0:ie[(null==tn||null===(ae=tn.WaterConnection)||void 0===ae?void 0:ae.length)-1]:null==tn||null===(re=tn.SewerageConnections)||void 0===re?void 0:re[(null==tn||null===(ue=tn.SewerageConnections)||void 0===ue?void 0:ue.length)-1],En={order:1,label:fe("WS_ESTIMATION_NOTICE"),onClick:function(){try{const e=function(e,n){if(null!=Qe&&null!==(e=Qe.applicationData)&&void 0!==e&&null!==(n=e.additionalDetails)&&void 0!==n&&n.estimationFileStoreId){var t,l;T([null==Qe||null===(t=Qe.applicationData)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.estimationFileStoreId],null==Qe?void 0:Qe.tenantId)}else{const e=sessionStorage.getItem("WARINIG_COUNT")||"0",n=JSON.parse(e),t=function(){if(0==n){const e={applicationNumber:We};return console.log(e,"filters"),Promise.resolve(Digit.WSService.search({tenantId:null==Qe?void 0:Qe.tenantId,filters:v({},e),businessService:"WATER"==Pe?"WS":"SW"})).then(function(e){var t,l,o;let i="WATER"==Pe?null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0];var a;null!=i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.estimationFileStoreId?T([null==i||null===(a=i.additionalDetails)||void 0===a?void 0:a.estimationFileStoreId],Ce):(sessionStorage.setItem("WARINIG_COUNT",n?n+1:1),setTimeout(()=>{sessionStorage.setItem("WARINIG_COUNT","0")},6e4),he({isError:!1,isWarning:!0,key:"warning",message:fe("WS_WARNING_FILESTOREID_PLEASE_TRY_AGAIN_SOMETIME_LABEL")}))})}Te||he({isError:!1,isWarning:!0,key:"warning",message:fe("WS_WARNING_FILESTOREID_PLEASE_TRY_AGAIN_SOMETIME_LABEL")})}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},Sn={order:2,label:fe("WS_SANCTION_LETTER"),onClick:()=>{var e,n;return T([null==Qe||null===(e=Qe.applicationData)||void 0===e||null===(n=e.additionalDetails)||void 0===n?void 0:n.sanctionFileStoreId],null==Qe?void 0:Qe.tenantId)}},_n={order:3,label:fe("WS_APPLICATION"),onClick:function(){try{var e,n,t;const l=null==Qe||null===(e=Qe.applicationData)||void 0===e?void 0:e.tenantId;let o=null==Qe?void 0:Qe.applicationData;return null!=Qe&&null!==(n=Qe.applicationData)&&void 0!==n&&null!==(t=n.applicationType)&&void 0!==t&&t.includes("MODIFY_")?(le(v({},o),v({},null==Qe?void 0:Qe.propertyDetails),l,fe,mn).then(e=>Digit.Utils.pdf.generateModifyPdf(e)),Promise.resolve()):(Z(v({},o),v({},null==Qe?void 0:Qe.propertyDetails),l,fe).then(e=>Digit.Utils.pdf.generatev1(e)),Promise.resolve())}catch(e){return Promise.reject(e)}}},fn={order:4,label:fe("DOWNLOAD_RECEIPT_HEADER"),onClick:()=>{var e;return function(e,n,t,l){try{let t=null;const o=null!=n&&n.fileStoreId?(t={filestoreIds:[null==n?void 0:n.fileStoreId]},Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})):Promise.resolve(Digit.PaymentService.generatePdf(e,{Payments:[v({},n)]},l)).then(function(n){return t=n,Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){var n;window.open(e[null===(n=t)||void 0===n?void 0:n.filestoreIds[0]],"_blank")})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(Digit.ULBService.getStateId(),null==nn||null===(e=nn.Payments)||void 0===e?void 0:e[0],0,Ze)}};switch(fe("WS_APLICATION_RECEIPT"),cn){case"PENDING_FOR_DOCUMENT_VERIFICATION":case"PENDING_FOR_CITIZEN_ACTION":case"PENDING_FOR_FIELD_INSPECTION":sn=[_n];break;case"PENDING_APPROVAL_FOR_CONNECTION":case"PENDING_FOR_PAYMENT":sn=[_n,En];break;case"PENDING_FOR_CONNECTION_ACTIVATION":case"CONNECTION_ACTIVATED":sn=null!=Qe&&null!==(de=Qe.applicationData)&&void 0!==de&&null!==(se=de.applicationType)&&void 0!==se&&se.includes("NEW_")&&(null==nn||null===(ce=nn.Payments)||void 0===ce?void 0:ce.length)>0?[Sn,En,_n,fn]:[Sn,En,_n];break;case"REJECTED":default:sn=[_n]}return Digit.Hooks.useClickOutside(Me,()=>{be(!1)},Oe),sn.sort(function(e,n){return e.order-n.order}),l.createElement(t.Fragment,null,l.createElement("div",{className:"employee-main-application-details"},l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},fe("CS_TITLE_APPLICATION_DETAILS")),l.createElement("div",{style:{zIndex:"10",display:"flex",flexDirection:"row-reverse",alignItems:"center",marginTop:"-25px"}},l.createElement("div",{style:{zIndex:"10",position:"relative",maxWidth:"100% !important"}},sn&&sn.length>0&&l.createElement(a.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>be(!Oe),displayOptions:Oe,options:sn,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:Me})),l.createElement(a.LinkButton,{label:fe("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{Re(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}))),l.createElement(Wr,{applicationDetails:Qe,isLoading:Je||je||Ve||Ye,isDataLoading:Je||je||Ve||Ye,applicationData:null==Qe?void 0:Qe.applicationData,mutate:un,id:"timeline",workflowDetails:en,businessService:null==Qe||null===(ve=Qe.processInstancesDetails)||void 0===ve||null===(pe=ve[0])||void 0===pe||null===(me=pe.businessService)||void 0===me?void 0:me.toUpperCase(),moduleCode:"WS",showToast:ye,setShowToast:De,closeToast:()=>{De(null)},timelineStatusPrefix:"WF_"+(null==Qe||null===(Ee=Qe.processInstancesDetails)||void 0===Ee||null===(Se=Ee[0])||void 0===Se||null===(_e=Se.businessService)||void 0===_e?void 0:_e.toUpperCase())+"_",oldValue:rn,isInfoLabel:!(Je||!Digit.Utils.checkPrivacy($e,{uuid:(null==Qe||null===(gn=Qe.applicationData)||void 0===gn||null===(Cn=gn.connectionHolders)||void 0===Cn?void 0:Cn.uuid)||(null==Qe||null===(Nn=Qe.propertyDetails)||void 0===Nn||null===(yn=Nn.owners)||void 0===yn||null===(Dn=yn[0])||void 0===Dn?void 0:Dn.uuid),fieldName:"mobileNumber",model:"User"})),clearDataDetails:()=>{Fe(),Be({}),ke({}),He()}}),Te&&l.createElement(a.Toast,{style:{zIndex:"10000"},warning:null==Te?void 0:Te.isWarning,error:null==Te||!Te.isWarning,label:fe(null==Te?void 0:Te.message),onClose:()=>{he(null)},isDleteBtn:!0})));var gn,Cn,Nn,yn,Dn},WSGetConnectionDetails:()=>{var e,n,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,T,h,A,I,O,b,L,R;const{t:w}=o.useTranslation(),W=Digit.ULBService.getCurrentTenantId(),P=i.useHistory(),[M,B]=t.useState(!1),[F,U]=t.useState(null);let k=g(location.search);const H=null==k?void 0:k.applicationNumber,V=null==k?void 0:k.service,z=null==k?void 0:k.due,Y=null==k?void 0:k.tenantId,[G,q]=t.useState(!1),K=Digit.ULBService.getStateId(),X=["MODIFY_CONNECTION_BUTTON","BILL_AMENDMENT_BUTTON","DISCONNECTION_BUTTON"],{isLoading:Z,data:$}=Digit.Hooks.ws.useConnectionDetail(w,W,H,V,{privacy:Digit.Utils.getPrivacyObject()}),J=t.useRef(),Q=t.useRef();sessionStorage.removeItem("IsDetailsExists"),Digit.SessionStorage.del("PT_CREATE_EMP_WS_NEW_FORM");const{data:ee}=Digit.Hooks.useDemandSearch({consumerCode:null==$||null===(e=$.applicationData)||void 0===e?void 0:e.connectionNo,businessService:"WATER"===V?"WS":"SW",tenantId:W},{enabled:!(null==$||null===(n=$.applicationData)||void 0===n||!n.applicationNo)}),[ne,te]=t.useState(!1),[le,oe]=t.useState([]),[ie,ae]=t.useState(null),re=Digit.Hooks.ws.useToCheckPrivacyEnablement({privacy:{uuid:null!=$&&null!==(r=$.applicationData)&&void 0!==r&&null!==(u=r.applicationNo)&&void 0!==u&&u.includes("WS")?null==$||null===(d=$.applicationData)||void 0===d||null===(s=d.WaterConnection)||void 0===s||null===(c=s[0])||void 0===c||null===(p=c.connectionHolders)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.uuid:null==$||null===(E=$.applicationData)||void 0===E||null===(S=E.SewerageConnections)||void 0===S||null===(_=S[0])||void 0===_||null===(f=_.connectionHolders)||void 0===f||null===(C=f[0])||void 0===C?void 0:C.uuid,fieldName:["connectionHoldersMobileNumber"],model:"WnSConnectionOwner"}})||!1,{mutate:ue}=Digit.Hooks.ws.useWSApplicationActions(V),de=Digit.Utils.browser.isMobile(),{data:se}=Digit.Hooks.obps.useMDMS(K,"common-masters",["uiCommonPay"]),ce=(null==se||null===(N=se["common-masters"])||void 0===N?void 0:N.uiCommonPay)||[],ve=ce&&ce.findIndex(e=>"WS.ONE_TIME_FEE"==e.code);let pe="";pe=ve>-1?ce[ve]:ce&&ce.filter(e=>"DEFAULT"===e.code),t.useEffect(function(){try{return Promise.resolve(Digit.PaymentService.searchAmendment(W,{consumerCode:H,businessService:"WATER"===V?"WS":"SW"})).then(function(e){oe(e.Amendments)})}catch(e){return Promise.reject(e)}},[]);const me=()=>{ae(null)};setTimeout(()=>{me()},1e4);const Ee="Active"===(null==$||null===(y=$.applicationData)||void 0===y?void 0:y.status),Se=null==$?void 0:$.isApplicationApproved;function _e(e){var n,t,l,o;"MODIFY_CONNECTION_BUTTON"===e?(()=>{var e,n,t;if(!Ee)return void ae({key:"error",label:"CONN_NOT_ACTIVE"});if((null==$||null===(e=$.fetchBillsData[0])||void 0===e?void 0:e.totalAmount)>0)return void ae({key:"error",label:"WS_DUE_AMOUNT_SHOULD_BE_ZERO"});let l="/digit-ui/employee/ws/modify-application?applicationNumber="+(null==$||null===(n=$.applicationData)||void 0===n?void 0:n.connectionNo)+"&service="+V+"&propertyId="+(null==$||null===(t=$.propertyDetails)||void 0===t?void 0:t.propertyId)+"&from=WS_COMMON_CONNECTION_DETAIL";P.push(""+l,JSON.stringify({data:$}))})():"BILL_AMENDMENT_BUTTON"===e?(()=>{var e,n;let t=!1;null==le||le.map(e=>{"INWORKFLOW"!==(null==e?void 0:e.status)||(t=!0)}),0!==(null==ee||null===(e=ee.Demands)||void 0===e?void 0:e.length)?t?ae({key:"error",label:"WORKFLOW_IN_PROGRESS"}):P.push("/digit-ui/employee/ws/required-documents?connectionNumber="+(null==$||null===(n=$.applicationData)||void 0===n?void 0:n.connectionNo)+"&tenantId="+Y+"&service="+V,JSON.stringify({data:$})):ae({key:"error",label:"No_Bills_Found"})})():"DISCONNECTION_BUTTON"===e?Se?(console.log("due",z,$),"ACTIVE"===(null===(l=le[0])||void 0===l?void 0:l.status)||(null==$||null===(o=$.fetchBillsData)||void 0===o?void 0:o.length)<=0||"0"==z||z<0?(Digit.SessionStorage.set("WS_DISCONNECTION",$),P.push("/digit-ui/employee/ws/new-disconnection")):te(!0)):ae({key:"error",label:"WORKFLOW_IN_PROGRESS"}):"RESTORATION_BUTTON"===e&&(Se?"ACTIVE"===(null===(n=le[0])||void 0===n?void 0:n.status)||(null==$||null===(t=$.fetchBillsData)||void 0===t?void 0:t.length)<=0||"0"===z?(Digit.SessionStorage.set("WS_DISCONNECTION",$),P.push("/digit-ui/employee/ws/new-restoration")):te(!0):ae({key:"error",label:"WORKFLOW_IN_PROGRESS"}))}Digit.Hooks.useClickOutside(J,()=>{q(!1)},G),Digit.Hooks.useClickOutside(Q,()=>{B(!1)},M);const fe="Active"===(null==$||null===(D=$.applicationData)||void 0===D?void 0:D.status)?X:X.filter(e=>"DISCONNECTION_BUTTON"!==e);let ge=[];const Ce={order:1,label:w("WS_COMMON_DOWNLOAD_BILL"),onClick:()=>function(){try{const e=function(e){if((null==$||null===(e=$.fetchBillsData)||void 0===e?void 0:e.length)>0){var n;const e="WATER"===V?"WS":"SW";let t={isConnectionSearch:!0,connectionNumber:null==$||null===(n=$.applicationData)||void 0===n?void 0:n.connectionNo};return Promise.resolve(Digit.WSService.search({tenantId:W,filters:t,businessService:e})).then(function(n){var t,l,o,i,a,r;let u={applicationNumber:"WATER"===V?null==n||null===(t=n.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo:null==n||null===(o=n.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo,bussinessService:e};var d;((null==n||null===(a=n.WaterConnection)||void 0===a?void 0:a.length)>0||(null==n||null===(r=n.SewerageConnections)||void 0===r?void 0:r.length)>0)&&function(e,n){try{const t=Digit.ULBService.getCurrentTenantId();Promise.resolve(Digit.WSService.generateBillPdf({tenantId:t,filters:n})).then(function(n){const t=parseInt(n.status,10);201!==t&&200!==t||((e,n)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var t=new FileReader;t.readAsDataURL(e),t.onloadend=function(){window.mSewaApp.downloadBase64File(t.result,n)}}else{const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=n,document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(t.href),7e3)}})(new Blob([n.data],{type:"application/pdf"}),"BILL-"+e+".pdf")})}catch(e){return Promise.reject(e)}}(null==$||null===(d=$.applicationData)||void 0===d?void 0:d.connectionNo,u)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},Ne={order:2,label:w("WS_CONNECTION_DETAILS"),onClick:()=>function(){try{var e;const n=null==$||null===(e=$.applicationData)||void 0===e?void 0:e.tenantId;return Hi(v({},null==$?void 0:$.applicationData),v({},null==$?void 0:$.propertyDetails),n,w).then(e=>Digit.Utils.pdf.generatev1(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}()};ge=(null==$||null===(T=$.fetchBillsData)||void 0===T?void 0:T.length)>0?[Ce,Ne]:[Ne];const ye=()=>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"})),De=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Te=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ye,null));return l.createElement(t.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement("style",null,"\n .multilinkWrapper employee-mulitlink-main-divNew {\n max-width:100%;\n maegin-top:-20px\n }"),l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"80%"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},w("WS_CONNECTION_DETAILS"))),ge&&ge.length>0&&l.createElement("div",{style:{maxWidth:"100% !imnportant",zIndex:"10"}},l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-divNew",onHeadClick:()=>q(!G),displayOptions:G,options:ge,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:J,style:{maxWidth:"100%"}})))),l.createElement(Wr,{applicationDetails:$,isLoading:Z,isDataLoading:Z,applicationData:null==$?void 0:$.applicationData,mutate:ue,businessService:null==$||null===(h=$.processInstancesDetails)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.businessService,moduleCode:"WS",showToast:F,setShowToast:U,closeToast:()=>{U(null)},isInfoLabel:re,labelComponent:l.createElement(j,{t:w})}),(!x("WS_CEMP")||!Ee||null!=$&&$.isDisconnectionDone)&&null!=$&&null!==(I=$.applicationData)&&void 0!==I&&I.isDisconnectionTemporary&&"Active"!==(null==$||null===(O=$.applicationData)||void 0===O?void 0:O.status)&&"DISCONNECTION_EXECUTED"==(null==$||null===(b=$.applicationData)||void 0===b?void 0:b.applicationStatus)?l.createElement(a.ActionBar,null,M?l.createElement(a.Menu,{options:["RESTORATION_BUTTON"],localeKeyPrefix:"WS",t:w,onSelect:_e}):null,l.createElement(a.SubmitBar,{ref:Q,label:w("WF_TAKE_ACTION"),onSubmit:()=>B(!M)})):l.createElement(a.ActionBar,null,M?l.createElement(a.Menu,{options:fe,localeKeyPrefix:"WS",t:w,onSelect:_e}):null,l.createElement(a.SubmitBar,{ref:Q,label:w("WF_TAKE_ACTION"),onSubmit:()=>B(!M)})),ne?l.createElement(a.Modal,{open:ne,headerBarMain:l.createElement(De,{label:w("WS_PENDING_DUES_LABEL")}),headerBarEnd:l.createElement(Te,{onClick:()=>te(!1)}),center:!0,formId:"modal-action",actionCancelOnSubmit:()=>te(!1),actionCancelLabel:w("CS_COMMON_CANCEL"),actionSaveLabel:w("WS_COMMON_COLLECT_LABEL"),actionSaveOnSubmit:()=>{P.push("/digit-ui/employee/payment/collect/"+("WATER"===V?"WS":"SW")+"/"+encodeURIComponent(H)+"/"+Y+"?tenantId="+Y+"&ISWSCON"),te(!1)},popupStyles:de?{width:"720px"}:{},style:de?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:de?{paddingLeft:"5px"}:{}},l.createElement("div",{className:"modal-header-ws"},w("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL")," "),l.createElement("div",{className:"modal-body-ws"},l.createElement("span",null,w("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),": ₹",z||(null==$||null===(L=$.fetchBillsData)||void 0===L||null===(R=L[0])||void 0===R?void 0:R.totalAmount)))):null,ie&&l.createElement(a.Toast,{error:ie.key,label:w(""+ie.label),onClose:me})))},WSActivateConnection:()=>{var e,n,r,u,d,s,c,p,E,S,_,f,C,N,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe;const{t:Ue}=o.useTranslation();let{state:ke}=i.useLocation();ke=ke?JSON.parse(ke):{},i.useHistory();let He=g(location.search);const[je,Ve]=t.useState(!1),[ze,Ye]=t.useState(!1),[Ge,qe]=t.useState(null),[Ke,Xe]=t.useState({}),[Ze,$e]=t.useState(!1),[Je,Qe]=l.useState({head:"",body:[]}),en=Digit.ULBService.getStateId();let nn=Digit.ULBService.getCurrentTenantId();nn||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");let{data:tn,isLoading:ln}=Digit.Hooks.ws.useWSConfigMDMS.WSActivationConfig(en,{}),on=Lt(null===(e=ke)||void 0===e?void 0:e.data),{isLoading:an,data:rn}=Digit.Hooks.ws.useWSDetailsPage(Ue,nn,null===(n=on)||void 0===n?void 0:n.applicationNo,null===(r=on)||void 0===r?void 0:r.serviceType,{privacy:Digit.Utils.getPrivacyObject()});on=Lt(rn),ke={data:v({},null==rn?void 0:rn.applicationData)};const{mutate:un}=Digit.Hooks.ws.useWSApplicationActions(null==He?void 0:He.service),dn=null!==(u=ke)&&void 0!==u&&null!==(d=u.data)&&void 0!==d&&d.waterSource?Lt(null===(s=ke)||void 0===s||null===(c=s.data)||void 0===c?void 0:c.waterSource):"",sn=dn?m(null==dn?void 0:dn.toUpperCase()," ","_"):"",cn=sn?m(null==sn?void 0:sn.toUpperCase(),".","_"):"",vn="WATER"===(null==He?void 0:He.service)?{connectionType:null!==(p=ke)&&void 0!==p&&null!==(E=p.data)&&void 0!==E&&E.connectionType?{code:null===(S=ke)||void 0===S||null===(_=S.data)||void 0===_?void 0:_.connectionType,i18nKey:"WS_CONNECTIONTYPE_"+m(null===(f=ke)||void 0===f||null===(C=f.data)||void 0===C||null===(N=C.connectionType)||void 0===N?void 0:N.toUpperCase()," ","_")}:"",waterSource:null!==(D=ke)&&void 0!==D&&null!==(T=D.data)&&void 0!==T&&T.waterSource?{code:null===(h=ke)||void 0===h||null===(A=h.data)||void 0===A?void 0:A.waterSource,i18nKey:"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null===(I=ke)||void 0===I||null===(O=I.data)||void 0===O||null===(b=O.waterSource)||void 0===b||null===(L=b.split(".")[0])||void 0===L?void 0:L.toUpperCase()," ","_")}:"",sourceSubData:null!==(R=ke)&&void 0!==R&&null!==(w=R.data)&&void 0!==w&&w.waterSource?{code:null===(W=ke)||void 0===W||null===(P=W.data)||void 0===P?void 0:P.waterSource,i18nKey:"WS_SERVICES_MASTERS_WATERSOURCE_"+cn}:"",pipeSize:null!==(M=ke)&&void 0!==M&&null!==(x=M.data)&&void 0!==x&&x.pipeSize?{code:null===(B=ke)||void 0===B||null===(F=B.data)||void 0===F?void 0:F.pipeSize,i18nKey:null===(U=ke)||void 0===U||null===(k=U.data)||void 0===k?void 0:k.pipeSize}:"",noOfTaps:(null===(H=ke)||void 0===H||null===(j=H.data)||void 0===j?void 0:j.noOfTaps)||"",formDetails:on}:{noOfWaterClosets:(null===(V=ke)||void 0===V||null===(z=V.data)||void 0===z?void 0:z.noOfWaterClosets)||"",noOfToilets:(null===(Y=ke)||void 0===Y||null===(G=Y.data)||void 0===G?void 0:G.noOfToilets)||"",formDetails:on},pn=[{plumberName:(null===(q=ke)||void 0===q||null===(K=q.data)||void 0===K||null===(X=K.plumberInfo)||void 0===X||null===(Z=X[0])||void 0===Z?void 0:Z.name)||"",plumberMobileNo:(null===($=ke)||void 0===$||null===(J=$.data)||void 0===J||null===(Q=J.plumberInfo)||void 0===Q||null===(ee=Q[0])||void 0===ee?void 0:ee.mobileNumber)||"",plumberLicenseNo:(null===(ne=ke)||void 0===ne||null===(te=ne.data)||void 0===te||null===(le=te.plumberInfo)||void 0===le||null===(oe=le[0])||void 0===oe?void 0:oe.licenseNo)||"",detailsProvidedBy:null!==(ie=ke)&&void 0!==ie&&null!==(ae=ie.data)&&void 0!==ae&&null!==(re=ae.additionalDetails)&&void 0!==re&&re.detailsProvidedBy?{i18nKey:"WS_PLUMBER_"+(null===(ue=ke)||void 0===ue||null===(de=ue.data)||void 0===de||null===(se=de.additionalDetails)||void 0===se||null===(ce=se.detailsProvidedBy)||void 0===ce?void 0:ce.toUpperCase()),code:null===(ve=ke)||void 0===ve||null===(pe=ve.data)||void 0===pe||null===(me=pe.additionalDetails)||void 0===me?void 0:me.detailsProvidedBy}:"",applicationNo:null===(Ee=ke)||void 0===Ee||null===(Se=Ee.data)||void 0===Se?void 0:Se.applicationNo,key:Date.now()}],mn="METERED"===(null===(_e=ke)||void 0===_e||null===(fe=_e.data)||void 0===fe||null===(ge=fe.connectionType)||void 0===ge?void 0:ge.toUpperCase())&&"WATER_RECONNECTION"!==(null===(Ce=ke)||void 0===Ce||null===(Ne=Ce.data)||void 0===Ne?void 0:Ne.applicationType)?[{meterId:(null===(ye=ke)||void 0===ye||null===(De=ye.data)||void 0===De?void 0:De.meterId)||"",meterInstallationDate:null!==(Te=ke)&&void 0!==Te&&null!==(he=Te.data)&&void 0!==he&&he.meterInstallationDate?y(null===(Ae=ke)||void 0===Ae||null===(Ie=Ae.data)||void 0===Ie?void 0:Ie.meterInstallationDate):null,meterInitialReading:(null===(Oe=ke)||void 0===Oe||null===(be=Oe.data)||void 0===be||null===(Le=be.additionalDetails)||void 0===Le?void 0:Le.initialMeterReading)||"",connectionExecutionDate:null!==(Re=ke)&&void 0!==Re&&null!==(we=Re.data)&&void 0!==we&&we.connectionExecutionDate?y(null===(We=ke)||void 0===We||null===(Pe=We.data)||void 0===Pe?void 0:Pe.connectionExecutionDate):null}]:[{connectionExecutionDate:null!==(Me=ke)&&void 0!==Me&&null!==(xe=Me.data)&&void 0!==xe&&xe.connectionExecutionDate?y(null===(Be=ke)||void 0===Be||null===(Fe=Be.data)||void 0===Fe?void 0:Fe.connectionExecutionDate):null}],En={formDetails:on,connectionDetails:[vn],plumberDetails:pn,activationDetails:mn};t.useEffect(()=>{an||Xe(on)},[]),t.useEffect(()=>{if(!ln){const e=tn.find(e=>e.hideInCitizen);Qe(e)}},[tn]),t.useEffect(()=>{const e=setTimeout(()=>{Ze&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==He?void 0:He.applicationNumber)+"&service="+(null==He?void 0:He.service))},3e3);return()=>clearTimeout(e)},[Ze]);const Sn=function(e){try{let n=m(e,"/","-"),t="";return t=n.split("-")[2]>1900?n.split("-")[2]+"-"+n.split("-")[1]+"-"+n.split("-")[0]:n.split("-")[0]+"-"+n.split("-")[2]+"-"+n.split("-")[1],Promise.resolve(function(e,n){void 0===n&&(n="dayend");try{const t=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(t[1],t[3]-1,t[2]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===n&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(n){return e}}(t))}catch(e){return Promise.reject(e)}},_n=()=>{qe(null)};return ze||ln||an?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,Ue(Je.head))),l.createElement(a.FormComposer,{config:Je.body,userType:"employee",defaultValues:En,onSubmit:function(e){try{const n=function(){if(je){var n,t,l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe;function ie(){var n,t,l,o;function i(){var n,t,l,o,i,a,r,u,d,s;re.comment=(null==ae||null===(n=ae.comments)||void 0===n?void 0:n.comments)||"",re.action=null==He?void 0:He.action,re.wfDocuments=null!=e&&null!==(t=e.supportingDocuments)&&void 0!==t&&null!==(l=t[0])&&void 0!==l&&l.fileStoreId?[{documentType:"Document - 1",fileStoreId:null==e||null===(o=e.supportingDocuments)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fileStoreId}]:[],re.processInstance={action:null==He?void 0:He.action,comment:(null==ae||null===(a=ae.comments)||void 0===a?void 0:a.comments)||"",documents:null!=e&&null!==(r=e.supportingDocuments)&&void 0!==r&&null!==(u=r[0])&&void 0!==u&&u.fileStoreId?[{documentType:"Document - 1",fileStoreId:null==e||null===(d=e.supportingDocuments)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.fileStoreId}]:[]},un&&un("WATER"==(null==He?void 0:He.service)?"WATER_RECONNECTION"===(null==re?void 0:re.applicationType)?{WaterConnection:re,reconnectRequest:!0,disconnectRequest:!1}:{WaterConnection:re}:"SEWERAGE_RECONNECTION"===(null==re?void 0:re.applicationType)?{SewerageConnection:re,reconnectRequest:!0,disconnectRequest:!1}:{SewerageConnection:re},{onError:(e,n)=>{qe({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(_n,5e3)},onSuccess:(e,n)=>{qe({key:!1,message:"WS_ACTIVATE_SUCCESS_MESSAGE_MAIN"}),$e(!0)}})}null!=ae&&null!==(n=ae.activationDetails)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&t.meterInitialReading&&(re.additionalDetails.initialMeterReading=null==ae||null===(l=ae.activationDetails)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.meterInitialReading);const a=function(e,n,t,l){if(null!=ae&&null!==(e=ae.activationDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.connectionExecutionDate)return Promise.resolve(Sn(null==ae||null===(t=ae.activationDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.connectionExecutionDate)).then(function(e){re.connectionExecutionDate=e})}();return a&&a.then?a.then(i):i()}const ae=Lt(e),re=(null===(n=Object.keys(Ke))||void 0===n?void 0:n.length)>0?v({},Ke):v({},null===(t=on)||void 0===t?void 0:t.applicationData);null!=ae&&null!==(l=ae.connectionDetails)&&void 0!==l&&null!==(o=l[0])&&void 0!==o&&null!==(i=o.connectionType)&&void 0!==i&&i.code&&(re.connectionType=null==ae||null===(a=ae.connectionDetails)||void 0===a||null===(r=a[0])||void 0===r||null===(u=r.connectionType)||void 0===u?void 0:u.code),null!=ae&&null!==(d=ae.connectionDetails)&&void 0!==d&&null!==(s=d[0])&&void 0!==s&&null!==(c=s.waterSource)&&void 0!==c&&c.code&&(re.waterSource=null==ae||null===(p=ae.connectionDetails)||void 0===p||null===(m=p[0])||void 0===m||null===(E=m.sourceSubData)||void 0===E?void 0:E.code),null!=ae&&null!==(S=ae.connectionDetails)&&void 0!==S&&null!==(_=S[0])&&void 0!==_&&null!==(f=_.pipeSize)&&void 0!==f&&f.size&&(re.pipeSize=null==ae||null===(g=ae.connectionDetails)||void 0===g||null===(C=g[0])||void 0===C||null===(N=C.pipeSize)||void 0===N?void 0:N.size),null!=ae&&null!==(y=ae.connectionDetails)&&void 0!==y&&null!==(D=y[0])&&void 0!==D&&D.noOfTaps&&(re.noOfTaps=null==ae||null===(T=ae.connectionDetails)||void 0===T||null===(h=T[0])||void 0===h?void 0:h.noOfTaps),null!=ae&&null!==(A=ae.connectionDetails)&&void 0!==A&&null!==(I=A[0])&&void 0!==I&&I.noOfWaterClosets&&(re.noOfWaterClosets=null==ae||null===(O=ae.connectionDetails)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.noOfWaterClosets),null!=ae&&null!==(L=ae.connectionDetails)&&void 0!==L&&null!==(R=L[0])&&void 0!==R&&R.noOfToilets&&(re.noOfToilets=null==ae||null===(w=ae.connectionDetails)||void 0===w||null===(W=w[0])||void 0===W?void 0:W.noOfToilets),null!=ae&&null!==(P=ae.plumberDetails)&&void 0!==P&&null!==(M=P[0])&&void 0!==M&&null!==(x=M.detailsProvidedBy)&&void 0!==x&&x.code&&(re.additionalDetails.detailsProvidedBy=null==ae||null===(B=ae.plumberDetails)||void 0===B||null===(F=B[0])||void 0===F||null===(U=F.detailsProvidedBy)||void 0===U?void 0:U.code),null!=re&&null!==(k=re.plumberInfo)&&void 0!==k&&k[0]||"ULB"!=(null==ae||null===(H=ae.plumberDetails)||void 0===H||null===(j=H.detailsProvidedBy)||void 0===j?void 0:j.code)||(re.plumberInfo=[{}]),null!=ae&&null!==(V=ae.plumberDetails)&&void 0!==V&&null!==(z=V[0])&&void 0!==z&&z.plumberName&&(re.plumberInfo[0].name=null==ae||null===(Y=ae.plumberDetails)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.plumberName),null!=ae&&null!==(q=ae.plumberDetails)&&void 0!==q&&null!==(K=q[0])&&void 0!==K&&K.plumberLicenseNo&&(re.plumberInfo[0].licenseNo=null==ae||null===(X=ae.plumberDetails)||void 0===X||null===(Z=X[0])||void 0===Z?void 0:Z.plumberLicenseNo),null!=ae&&null!==($=ae.plumberDetails)&&void 0!==$&&null!==(J=$[0])&&void 0!==J&&J.plumberMobileNo&&(re.plumberInfo[0].mobileNumber=null==ae||null===(Q=ae.plumberDetails)||void 0===Q||null===(ee=Q[0])||void 0===ee?void 0:ee.plumberMobileNo),null!=ae&&null!==(ne=ae.activationDetails)&&void 0!==ne&&null!==(te=ne[0])&&void 0!==te&&te.meterId&&(re.meterId=null==ae||null===(le=ae.activationDetails)||void 0===le||null===(oe=le[0])||void 0===oe?void 0:oe.meterId);const ue=function(e,n,t,l){if(null!=ae&&null!==(e=ae.activationDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.meterInstallationDate)return Promise.resolve(Sn(null==ae||null===(t=ae.activationDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.meterInstallationDate)).then(function(e){re.meterInstallationDate=e})}();return ue&&ue.then?ue.then(ie):ie()}qe({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{qe(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},label:Ue("WF_EMPLOYEE_NEWSW1_ACTIVATE_CONNECTION"),onFormValueChange:(e,n,t)=>{Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&Object.getPrototypeOf(t.errors)===Object.prototype?Ve(!0):Ve(!Object.keys(t.errors).length)}}),Ge&&l.createElement(a.Toast,{error:Ge.key,label:Ue(null==Ge?void 0:Ge.message),warning:null==Ge?void 0:Ge.warning,onClose:()=>{qe(null)}}))},WSApplicationDetailsBillAmendment:()=>{var e,n,i,r,u,d,s,c,v,p,m,E;const{applicationNumber:S}=Digit.Hooks.useQueryParams(),_=Digit.ULBService.getCurrentTenantId(),{t:f}=o.useTranslation();let g="WATER";S.includes("SW")&&(g="SEWERAGE");const[C,N]=t.useState(!1),{isLoading:y,data:D}=Digit.Hooks.ws.useWSApplicationDetailsBillAmendment(f,_,S,g),T=Digit.Hooks.useWorkflowDetails({tenantId:_,id:S,moduleCode:null==D||null===(e=D.processInstancesDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.businessService,config:{enabled:!(null==D||null===(i=D.processInstancesDetails)||void 0===i||null===(r=i[0])||void 0===r||!r.businessService)}});null==T||null===(u=T.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s||s.forEach(e=>{if("RE-SUBMIT"===(null==e?void 0:e.action)){var n;let t="/digit-ui/employee/ws/bill-amendment?connectionNumber="+(null==D||null===(n=D.applicationData)||void 0===n?void 0:n.connectionNo)+"&tenantId="+_+"&isEdit=true";e.redirectionUrll={action:"RE-SUBMIT-APPLICATION",pathname:t,state:{applicationDetails:D,action:"RE-SUBMIT-APPLICATION"}}}});const{isError:h,error:A,isSuccess:I,mutate:O}=Digit.Hooks.ws.useApplicationActionsBillAmendUpdate();t.useEffect(()=>{C&&setTimeout(()=>N(!1),5e3)},[C]);const[b,L]=t.useState(!1),R=[{order:1,label:f("WS_ACK_PDF"),onClick:()=>function(e,n,t,l,o){try{return ie(e,n,t,l).then(e=>Digit.Utils.pdf.generateBillAmendPDF(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}(null==D?void 0:D.amendment,_,f,null==D?void 0:D.applicationDetails)}];return l.createElement(t.Fragment,null,l.createElement("div",{className:"employee-main-application-details"},l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},f("CS_TITLE_GENERATE_NOTE")),R&&R.length>0&&l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-div",onHeadClick:()=>L(!b),displayOptions:b,options:R,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className"})),l.createElement(Wr,{applicationDetails:D,isLoading:y,isDataLoading:y,applicationData:null==D?void 0:D.applicationData,mutate:O,workflowDetails:T,businessService:null==D||null===(c=D.processInstancesDetails)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.businessService,moduleCode:"WS",showToast:C,setShowToast:N,closeToast:()=>N(null),timelineStatusPrefix:"WF_"+(null==D||null===(p=D.processInstancesDetails)||void 0===p||null===(m=p[0])||void 0===m||null===(E=m.businessService)||void 0===E?void 0:E.toUpperCase())+"_"})),C?l.createElement(a.Toast,{isDleteBtn:!0,error:h?"WS_APPLICATION_UPDATE_ERROR":null,label:I?null==C?void 0:C.label:null==A?void 0:A.Error}):null)},WSSearch:e=>{const[n,i]=t.useState(!0),{t:r}=o.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[d,s]=t.useState({}),c=Digit.ComponentRegistryService.getComponent("WSSearchApplication"),p=window.location.pathname.includes("water/search-application")?"WS":"SW",[m,E]=t.useState(null),S={enabled:!!(d&&Object.keys(d).length>0)},_=Digit.Hooks.ws.useSearchWS({tenantId:u,filters:d,config:S,bussinessService:p,t:r,shortAddress:!0}),f=window.Digit.Utils.browser.isMobile();return null!=_&&_.isLoading&&f?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,l.createElement(c,{t:r,tenantId:u,onSubmit:function(e){if(!(""!==e.applicationNumber||""!==e.connectionNumber||""!==e.mobileNumber||e.applicationType||e.applicationStatus||e.fromDate||e.toDate))return E({warning:!0,label:"ERR_PT_FILL_VALID_FIELDS"}),void setTimeout(()=>{E(!1)},3e3);var n=new Date(null==e?void 0:e.fromDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())-19800);var t=new Date(null==e?void 0:e.toDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())+86399-19800);const l=v({},e,e.toDate?{toDate:null==t?void 0:t.getTime()}:{},e.fromDate?{fromDate:null==n?void 0:n.getTime()}:{});s(Object.keys(l).filter(e=>l[e]).reduce((e,n)=>v({},e,{[n]:"object"==typeof l[n]?l[n].code:l[n]}),{}))},data:0==(null==_||null===(C=_.data)||void 0===C?void 0:C.length)?{display:"ES_COMMON_NO_DATA"}:(null==_||null===(N=_.data)||void 0===N?void 0:N.length)>0?null==_?void 0:_.data:[],count:null==_?void 0:_.count,resultOk:(null==_||null===(g=_.data)||void 0===g?void 0:g.length)>0,businessService:p,isLoading:null==_?void 0:_.isLoading}),m&&l.createElement(a.Toast,{error:m.error,warning:m.warning,label:r(m.label),onClose:()=>{E(null)}}));var g,C,N},WSSearchWater:e=>{var n;const[i,r]=t.useState(!0),{t:u}=o.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),[s,c]=t.useState({}),[p,m]=t.useState(!1),E=Digit.ComponentRegistryService.getComponent("WSSearchWaterConnection"),S=window.location.pathname.includes("water/search-connection")?"WS":"SW",[_,f]=t.useState(null),g=t.useCallback(e=>{const{connectionNumber:n,oldConnectionNumber:t,mobileNumber:l,propertyId:o}=e;n||t||l||o?c(Object.keys(e).filter(n=>e[n]).reduce((n,t)=>v({},n,{[t]:"object"==typeof e[t]?e[t].code:e[t]}),{})):(f({error:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"}),setTimeout(()=>{f(!1)},3e3))}),C={enabled:!!(s&&Object.keys(s).length>0)};let N=Digit.Hooks.ws.useSearchWS({tenantId:d,filters:s,config:C,bussinessService:S,t:u,shortAddress:!0});const y=window.Digit.Utils.browser.isMobile();return null!=N&&N.isLoading&&y?l.createElement(a.Loader,null):(null!=N&&N.isLoading||(N.data=null==N||null===(n=N.data)||void 0===n?void 0:n.map(e=>{var n,t;return null!=e&&null!==(n=e.connectionNo)&&void 0!==n&&n.includes("WS")?e.service="WATER":null!=e&&null!==(t=e.connectionNo)&&void 0!==t&&t.includes("SW")&&(e.service="SEWERAGE"),e})),l.createElement(t.Fragment,null,l.createElement(E,{t:u,tenantId:d,onSubmit:g,data:0==(null==N||null===(T=N.data)||void 0===T?void 0:T.length)?{display:"ES_COMMON_NO_DATA"}:(null==N||null===(h=N.data)||void 0===h?void 0:h.length)>0?null==N?void 0:N.data:[],count:null==N?void 0:N.count,resultOk:(null==N||null===(D=N.data)||void 0===D?void 0:D.length)>0,businessService:S,isLoading:null==N?void 0:N.isLoading}),_&&l.createElement(a.Toast,{error:_.error,warning:_.warning,label:u(_.label),onClose:()=>{f(null)}})));var D,T,h},WSEditApplication:()=>{var e,n,r,u,d,s,c,p;const{t:m}=o.useTranslation();let{state:E}=i.useLocation();E=E?"string"==typeof E?JSON.parse(E):E:{},i.useHistory();let S=g(location.search);const[_,f]=t.useState(!1),[C,N]=t.useState(null),[y,D]=t.useState({}),[T,h]=t.useState({head:"",body:[]}),[A,I]=t.useState(!0),[O,b]=t.useState(!1);let L=Digit.ULBService.getCurrentTenantId();L||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const w=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")),W=(null==S?void 0:S.service)||(null==w||null===(e=w.applicationData)||void 0===e?void 0:e.serviceType);let P=Lt(null===(n=E)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.applicationDetails);const M=Lt(null===(u=E)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.action),x=Digit.ULBService.getStateId();let{data:B,isLoading:F}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(x,{}),{isLoading:k,data:H}=Digit.Hooks.ws.useWSDetailsPage(m,L,null===(s=P)||void 0===s?void 0:s.applicationNo,null===(c=P)||void 0===c||null===(p=c.applicationData)||void 0===p?void 0:p.serviceType,{privacy:Digit.Utils.getPrivacyObject()});P=H;const[j,V]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[z,Y,G]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:q}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:j},tenantId:L},{filters:{propertyIds:j},tenantId:L,enabled:!(!j||""==j),privacy:Digit.Utils.getPrivacyObject()});t.useEffect(()=>{if(!F){var e;const n=B.find(e=>e.hideInCitizen&&e.isEdit);n.head="WS_APP_FOR_WATER_AND_SEWERAGE_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isEditConnection&&t.push(e)}),n.body=t,h(n)}},[B]),t.useEffect(()=>{var e,n,t,l;!j&&(null==z||null===(e=z.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&V(null==z||null===(t=z.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==z?void 0:z.cpt]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=P)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return sessionStorage.setItem("appData",JSON.stringify(y)),Promise.resolve(R(P,W,!1,!1,m)).then(function(e){Y(v({},z,e)),D(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[P,H,null==z?void 0:z.cpt,z,q]),t.useEffect(()=>{var e;Y(v({},z,{cpt:{details:null==q||null===(e=q.Properties)||void 0===e?void 0:e[0]}}))},[q]),t.useEffect(()=>{var e,n,t,l,o,i,a;((null==z||null===(e=z.DocumentsRequired)||void 0===e||null===(n=e.documents)||void 0===n?void 0:n.length)>0||null!=z&&null!==(t=z.ConnectionDetails)&&void 0!==t&&null!==(l=t[0])&&void 0!==l&&l.water||null!=z&&null!==(o=z.ConnectionDetails)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.sewerage||null!=z&&null!==(a=z.cpt)&&void 0!==a&&a.details&&!k)&&I(!1)},[q,z,null==z?void 0:z.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;O&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==z||null===(e=z.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==z||null===(t=z.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase()))},5e3);return()=>clearTimeout(e)},[O]);const{mutate:K}=Digit.Hooks.ws.useWSApplicationActions(W);return A||F?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,m(T.head))),l.createElement(a.FormComposer,{config:T.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(z,n)||Y(v({},z,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?f(!0):f(!Object.keys(t.errors).length)},label:m("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(_){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(function(e,n,t){try{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q;null==e||null===(l=e.cpt)||void 0===l||null===(o=l.details)||void 0===o||null===(i=o.owners)||void 0===i||i.forEach(e=>{null!=e&&e.permanentAddress&&(e.correspondenceAddress=null==e?void 0:e.permanentAddress)});let ee=v({},n.applicationData,{propertyId:null==e||null===(a=e.cpt)||void 0===a||null===(r=a.details)||void 0===r?void 0:r.propertyId,proposedTaps:(null==e||null===(u=e.ConnectionDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.proposedTaps)&&Number(null==e||null===(s=e.ConnectionDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.proposedTaps),proposedPipeSize:(null==e||null===(p=e.ConnectionDetails)||void 0===p||null===(m=p[0])||void 0===m||null===(E=m.proposedPipeSize)||void 0===E?void 0:E.size)&&Number(null==e||null===(S=e.ConnectionDetails)||void 0===S||null===(_=S[0])||void 0===_||null===(f=_.proposedPipeSize)||void 0===f?void 0:f.size),proposedWaterClosets:(null==e||null===(g=e.ConnectionDetails)||void 0===g||null===(C=g[0])||void 0===C?void 0:C.proposedWaterClosets)&&Number(null==e||null===(N=e.ConnectionDetails)||void 0===N||null===(y=N[0])||void 0===y?void 0:y.proposedWaterClosets),proposedToilets:(null==e||null===(D=e.ConnectionDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.proposedToilets)&&Number(null==e||null===(h=e.ConnectionDetails)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.proposedToilets),connectionHolders:null!=e&&null!==(I=e.ConnectionHolderDetails)&&void 0!==I&&null!==(O=I[0])&&void 0!==O&&O.sameAsOwnerDetails?null:[v({},null==n||null===(b=n.applicationData)||void 0===b||null===(L=b.connectionHolders)||void 0===L?void 0:L[0],{correspondenceAddress:(null==e||null===(R=e.ConnectionHolderDetails)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.address)||"",fatherOrHusbandName:(null==e||null===(W=e.ConnectionHolderDetails)||void 0===W||null===(P=W[0])||void 0===P?void 0:P.guardian)||"",gender:(null==e||null===(M=e.ConnectionHolderDetails)||void 0===M||null===(x=M[0])||void 0===x||null===(B=x.gender)||void 0===B?void 0:B.code)||"",mobileNumber:(null==e||null===(F=e.ConnectionHolderDetails)||void 0===F||null===(U=F[0])||void 0===U?void 0:U.mobileNumber)||"",name:(null==e||null===(k=e.ConnectionHolderDetails)||void 0===k||null===(H=k[0])||void 0===H?void 0:H.name)||"",emailId:(null==e||null===(j=e.ConnectionHolderDetails)||void 0===j||null===(V=j[0])||void 0===V?void 0:V.emailId)||"",ownerType:(null==e||null===(z=e.ConnectionHolderDetails)||void 0===z||null===(Y=z[0])||void 0===Y||null===(G=Y.ownerType)||void 0===G?void 0:G.code)||"",relationship:(null==e||null===(q=e.ConnectionHolderDetails)||void 0===q||null===(K=q[0])||void 0===K||null===(X=K.relationship)||void 0===X?void 0:X.code)||"",sameAsPropertyAddress:null==e||null===(Z=e.ConnectionHolderDetails)||void 0===Z||null===($=Z[0])||void 0===$?void 0:$.sameAsOwnerDetails})],property:null==e||null===(J=e.cpt)||void 0===J?void 0:J.details,processInstance:{action:t||"RESUBMIT_APPLICATION"},action:t||"RESUBMIT_APPLICATION",documents:null==e||null===(Q=e.DocumentsRequired)||void 0===Q?void 0:Q.documents});return Promise.resolve(ee)}catch(e){return Promise.reject(e)}}(e,n,M)).then(function(t){var l,o,i,a,r,u;const d="WATER"==(null==e||null===(l=e.ConnectionDetails)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.serviceName)?{WaterConnection:t}:{SewerageConnection:t};var s;f(!1),null!=n&&null!==(i=n.processInstancesDetails)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&null!==(r=a.state)&&void 0!==r&&null!==(u=r.applicationStatus)&&void 0!==u&&u.includes("CITIZEN_ACTION")?K&&K(d,{onError:(e,n)=>{N({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(closeToastOfError,5e3),f(!0)},onSuccess:(e,n)=>{N({key:!1,message:"WS_APPLICATION_SUBMITTED_SUCCESSFULLY_LABEL"}),b(!0)}}):(sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(t)),window.location.assign(""+window.location.origin+(null===(s=E)||void 0===s?void 0:s.url)))})}N({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{N(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:z,appData:y}),C&&l.createElement(a.Toast,{error:C.key,label:m(null==C?void 0:C.message),warning:null==C?void 0:C.warning,onClose:()=>{N(null)}}))},WSConsumptionDetails:e=>{var n,i,r,u,d,s,c;const{t:p}=o.useTranslation(),m=Digit.UserService.getUser(),E=(null==m||null===(n=m.info)||void 0===n?void 0:n.tenantId)||Digit.ULBService.getCurrentTenantId();let S=g(location.search);const{applicationNo:_}=Digit.Hooks.useQueryParams(),f=null==S?void 0:S.service;let C={tenantId:E,connectionNos:_};const[N,y]=t.useState(!1),[D,T]=t.useState({}),[h,A]=t.useState({}),I="WATER"===f?"WS":"SW",O=!!Digit.Utils.browser.isMobile(),[b,L]=t.useState(""),[R,w]=t.useState(null),[W,P]=t.useState(null),[M,x]=t.useState(!1),[B,F]=t.useState(""),[U,k]=t.useState(""),[H,j]=t.useState(""),[V,z]=t.useState(!1),Y=Digit.UserService.getUser().info.roles.map(e=>e.code).filter(e=>"WS_CEMP"===e||"SW_CEMP"===e).length>0,{isLoading:G,data:q}=Digit.Hooks.ws.useWSConsumptionSearch({filters:C},{filters:C}),{isLoading:K,data:X}=Digit.Hooks.ws.useGetMeterStatusList(E),{isLoading:Z,data:$}=Digit.Hooks.ws.useGetBillingPeriodValidation(E);let J={connectionNumber:_};const{isLoading:Q,data:ee}=Digit.Hooks.ws.useOldValue({tenantId:E,filters:v({},J),businessService:"WS"===I?"WATER":"SEWERAGE"}),{mutate:ne}=Digit.Hooks.ws.useMeterReadingCreateAPI(I);t.useEffect(()=>{if(!Q){let e="WS"==I?null==ee?void 0:ee.WaterConnection:null==ee?void 0:ee.SewerageConnections,n=null==e?void 0:e.filter(e=>{var n;return null==e||null===(n=e.applicationType)||void 0===n?void 0:n.includes("DISCONNECT")});0==(null==n?void 0:n.length)&&z(!0),null==n||n.map(e=>{z("DISCONNECTION_EXECUTED"!==(null==e?void 0:e.applicationStatus)&&"PENDING_FOR_DISCONNECTION_EXECUTION"!==(null==e?void 0:e.applicationStatus))})}},[ee]);const te=function(e,n){void 0===n&&(n="dayend");try{const t=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(t[1],t[2]-1,t[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===n&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(n){return e}},le=(null==$||null===(i=$.MdmsRes)||void 0===i||null===(r=i["ws-services-masters"])||void 0===r||r.billingPeriod.filter(e=>"Metered"===e.connectionType),()=>{y(!1)}),oe=()=>{w(!1),P(null)};let ie=null==X||null===(u=X.MdmsRes)||void 0===u||null===(d=u["ws-services-calculation"])||void 0===d?void 0:d.MeterStatus.map(e=>({code:e,i18nKey:"WS_SERVICES_CALCULATION_METERSTATUS_"+Digit.Utils.locale.getTransformedLocale(e)})),ae={},re={};const ue=e=>e?new Date(e).getDate()+"/"+(new Date(e).getMonth()+1)+"/"+new Date(e).getFullYear().toString():"NA",de=null==q?void 0:q.meterReadings,se={label:{heading:"WS_CONSUMPTION_BUTTON_METER_READING_LABEL",submit:"CORE_COMMON_SAVE",cancel:"CORE_CHANGE_TENANT_CANCEL"},form:[{body:[{populators:l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),label:""+p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),text:H,className:"border-none"}))},{label:""+p("WS_SERV_DETAIL_METER_STAT"),isMandatory:!0,type:"dropdown",populators:l.createElement(a.Dropdown,{option:ie,autoComplete:"off",optionKey:"i18nKey",id:"meterStatus",select:e=>{L(e),k("")},selected:b,t:p})},{populators:l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),text:null==de||null===(s=de[0])||void 0===s?void 0:s.currentReading,className:"border-none"}))},{populators:l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),text:ue(null==de||null===(c=de[0])||void 0===c?void 0:c.currentReadingDate),className:"border-none"}))},{label:p("WS_CONSUMPTION_DETAILS_CURRENT_READING_LABEL"),isMandatory:"Working"===b.code,disable:"Working"!==b.code,type:"number",populators:v({name:"currentReading"},ae="Working"===b.code?{}:{value:""})},{label:p("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),isMandatory:"Working"===b.code,disable:"Working"!==b.code,type:"custom",populators:{name:"currentReadingDate",validation:{required:"Working"===b.code},customProps:{},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(a.DatePicker,v({onChange:e.onChange,date:e.value},n,{disabled:"Working"!==b.code}))}},{label:p("WS_SERV_DETAIL_CONSUMP"),isMandatory:!1,type:"number",disable:"Working"===b.code,populators:v({},re="Working"===b.code?{name:"consumption",value:U}:{name:"consumption"})}]}]},ce=e=>l.createElement("h1",{className:"heading-m"},e.label),ve=()=>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"})),pe=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ve,null));if(G||Q)return l.createElement(a.Loader,null);let{meterReadings:me}=q||{};return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(a.Header,{styles:{marginLeft:"15px"}},""+p("WS_VIEW_CONSUMPTION")),l.createElement("div",null,(null==me?void 0:me.length)>0&&me.map((e,n)=>{return l.createElement("div",{key:n},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_MYCONNECTIONS_CONSUMER_NO"),label:""+p("WS_MYCONNECTIONS_CONSUMER_NO"),text:(null==e?void 0:e.connectionNo)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),label:""+p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),text:(null==e?void 0:e.billingPeriod)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_METER_STATUS_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_METER_STATUS_LABEL"),text:(null==e?void 0:e.meterStatus)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),text:(null==e?void 0:e.lastReading)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),text:null!=e&&e.lastReadingDate?Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.lastReadingDate):p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_SERV_DETAIL_CUR_METER_READ"),label:""+p("WS_SERV_DETAIL_CUR_METER_READ"),text:(null==e?void 0:e.currentReading)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),text:null!=e&&e.currentReadingDate?Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.currentReadingDate):p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_CONSUMPTION_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_CONSUMPTION_LABEL"),text:(t=null==e?void 0:e.currentReading,o=null==e?void 0:e.lastReading,t&&o?Number(t-o):p("NA")),className:"border-none"}))));var t,o}),!(null!=me&&me.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},p("WS_NO_CONSUMPTION_FOUND"))),G||K||Z||!Y?null:l.createElement("div",null,V&&l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{label:p("WS_CONSUMPTION_BUTTON_METER_READING_LABEL"),onSubmit:()=>{var e,n;y(!0),T(null==q?void 0:q.meterReadings[0]),L({code:null==q||null===(e=q.meterReadings[0])||void 0===e?void 0:e.meterStatus,i18nKey:"WS_SERVICES_CALCULATION_METERSTATUS_"+Digit.Utils.locale.getTransformedLocale(null==q||null===(n=q.meterReadings[0])||void 0===n?void 0:n.meterStatus)}),j(ue(null==D?void 0:D.currentReadingDate)+" - "+ue(te(Digit.Utils.date.getDate())))}})))),N&&l.createElement(a.Modal,{headerBarMain:l.createElement(ce,{label:p(se.label.heading)}),headerBarEnd:l.createElement(pe,{onClick:le}),actionCancelLabel:p(se.label.cancel),actionCancelOnSubmit:le,actionSaveLabel:p(se.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",popupStyles:O?{width:"720px"}:{},popupModuleMianStyles:O?{paddingLeft:"5px"}:{}},M?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:se.form,onFormValueChange:(e,n,t)=>{var l,o;"Working"===(null==b?void 0:b.code)?(F(null==n?void 0:n.currentReading),j(ue(null==D?void 0:D.currentReadingDate)+" - "+ue(null==n?void 0:n.currentReadingDate)),parseInt(B)<parseInt(null==de||null===(l=de[0])||void 0===l?void 0:l.lastReading)?(n.consumption="0",k("0")):(n.consumption=""+(parseInt(B)-parseInt(null==de||null===(o=de[0])||void 0===o?void 0:o.currentReading)),k(n.consumption))):k(n.consumption)},cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{let t=parseInt(null==D?void 0:D.currentReadingDate),l=parseInt(te(null==e?void 0:e.currentReadingDate)),o=parseInt(te(Digit.Utils.date.getDate()));if("Working"===(null==b?void 0:b.code)){var n;if(null==e||!e.currentReading||null==(null==e?void 0:e.currentReading)||""===(null==e?void 0:e.currentReading))return w({key:"error",message:p("ERR_CURRENT_READING_REQUIRED")}),P(p("ERR_CURRENT_READING_REQUIRED")),setTimeout(oe,5e3),Promise.resolve();if(l<t||l>o)return w({key:"error",message:p("ERR_CURRENT_READING_DATE_SHOULD_NOT_BE_LESS_THAN_FROM_DATE_AND_NOT_GREATER_THAN_TO_DATE")}),P(p("ERR_CURRENT_READING_DATE_SHOULD_NOT_BE_LESS_THAN_FROM_DATE_AND_NOT_GREATER_THAN_TO_DATE")),setTimeout(oe,5e3),Promise.resolve();if((null==e?void 0:e.currentReading)<=(null==de||null===(n=de[0])||void 0===n?void 0:n.currentReading))return w({key:"error",message:p("CURRENT_READING_ERROR")}),P(p("CURRENT_READING_ERROR")),setTimeout(oe,5e3),Promise.resolve()}else e.currentReading=parseInt(null==D?void 0:D.currentReading)+parseInt(null==e?void 0:e.consumption);let i={meterReadings:{billingPeriod:ue(null==D?void 0:D.currentReadingDate)+" - "+ue(null==e?void 0:e.currentReadingDate),connectionNo:null==D?void 0:D.connectionNo,currentReading:null==e?void 0:e.currentReading,currentReadingDate:te(null==e?void 0:e.currentReadingDate),lastReading:null==D?void 0:D.currentReading,lastReadingDate:null==D?void 0:D.currentReadingDate,meterStatus:null==b?void 0:b.code,tenantId:null==D?void 0:D.tenantId}};const a=function(){if(ne)return x(!0),Promise.resolve(ne(i,{onError:(e,n)=>{x(!1),y(!1),w({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(oe,5e3)},onSuccess:function(e,n){try{return x(!1),y(!1),w({key:"success",message:"WS_METER_READING_ADDED_SUCCESFULLY"}),setTimeout(oe,3e3),setTimeout(()=>{window.location.reload()},4e3),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:h,formId:"modal-action"})),R&&l.createElement(a.Toast,{style:{zIndex:"10000"},error:"error"===(null==R?void 0:R.key),label:p(null==R?void 0:R.message),onClose:oe}))},WSModifyApplication:()=>{var e,n,r,u;const{t:d}=o.useTranslation();let{state:s}=i.useLocation();s=s?"string"==typeof s?JSON.parse(s):s:{};const c=i.useHistory();let p=g(location.search);const[m,E]=t.useState(!1),[S,_]=t.useState(null),[f,C]=t.useState({}),[N,y]=t.useState({head:"",body:[]}),[D,T]=t.useState(!0),[A,I]=t.useState(!1),[O,b]=t.useState(!1);let L=Digit.ULBService.getCurrentTenantId();const w=null==p?void 0:p.service,W=Digit.ULBService.getStateId();let{data:P,isLoading:x}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(W,{}),B=Lt(null===(e=s)||void 0===e?void 0:e.data),{data:F}=Digit.Hooks.ws.useWSDetailsPage(d,L,null===(n=B)||void 0===n?void 0:n.applicationNo,null===(r=B)||void 0===r||null===(u=r.applicationData)||void 0===u?void 0:u.serviceType,{privacy:Digit.Utils.getPrivacyObject()});B=F;const[k,H]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[j,V,z]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:Y}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:k},tenantId:L},{filters:{propertyIds:k},tenantId:L,enabled:!(!k||""==k),privacy:Digit.Utils.getPrivacyObject()});t.useEffect(()=>{if(!x){var e;const n=P.find(e=>e.hideInCitizen&&e.isModify);n.head="WS_WATER_AND_SEWERAGE_MODIFY_CONNECTION_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isModifyConnection&&t.push(e)}),t.forEach(e=>{"WS_COMMON_PROPERTY_DETAILS"==(null==e?void 0:e.head)&&(e.head="")}),n.body=t,y(n)}},[P]),t.useEffect(()=>{var e,n,t,l;!k&&(null==j||null===(e=j.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&H(null==j||null===(t=j.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==j?void 0:j.cpt]),t.useEffect(function(){try{sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));const e=function(e,n){if(null!==(e=B)&&void 0!==e&&null!==(n=e.applicationData)&&void 0!==n&&n.id)return Promise.resolve(R(B,w,!0,void 0,d)).then(function(e){V(v({},j,e)),C(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[B,F]),t.useEffect(()=>{var e;V(v({},j,{cpt:{details:null==Y||null===(e=Y.Properties)||void 0===e?void 0:e[0]}}))},[Y]),t.useEffect(()=>{var e,n;null!=j&&null!==(e=j.ConnectionDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.applicationNo&&T(!1)},[Y,j,null==j?void 0:j.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;A&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==j||null===(e=j.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==j||null===(t=j.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase()))},3e3);return()=>clearTimeout(e)},[A]);const{mutate:G}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:q}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:K}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:X}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");return D||O||x?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,d(N.head))),l.createElement(a.FormComposer,{config:N.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(j,n)||V(v({},j,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?E(!0):E(!Object.keys(t.errors).length)},label:d("CS_COMMON_SUBMIT"),onSubmit:function(e){try{var n,t,l;if(!(null!=e&&null!==(n=e.cpt)&&void 0!==n&&n.id||null!=Y&&null!==(t=Y.Properties)&&void 0!==t&&t[0]||null!=e&&null!==(l=e.cpt)&&void 0!==l&&l.details&&Y))return _({key:"error",message:"ERR_INVALID_PROPERTY_ID"}),Promise.resolve();const o=function(){if(m){var n,t;null!=e&&null!==(n=e.cpt)&&void 0!==n&&n.details||(e.cpt={details:null==Y||null===(t=Y.Properties)||void 0===t?void 0:t[0]});const l=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(M(e,l)).then(function(n){var t,l,o,i,a;function r(){const e=function(){if("WATER"!==w){const e=function(){if(K)return b(!0),Promise.resolve(K(u,{onError:(e,n)=>{var t,l,o,i,a,r,u,d;b(!1),_({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.message?null==e||null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(h(null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0],"SEWERAGE")).then(function(e){return Promise.resolve(X({SewerageConnection:e,reconnectRequest:!1,disconnectRequest:!1},{onError:(e,n)=>{b(!1),_({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:(e,n)=>{var t,l;z(),c.push("/digit-ui/employee/ws/ws-response?applicationNumber1="+(null==e||null===(t=e.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}const u="WATER"==(null==e||null===(t=e.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.serviceName)?"WATER_RECONNECTION"===(null==e||null===(o=e.ConnectionDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationType)?{WaterConnection:n,reconnectRequest:!0,disconnectRequest:!1}:{WaterConnection:n,reconnectRequest:!1,disconnectRequest:!1}:"SEWERAGE_RECONNECTION"===(null===(a=formData)||void 0===a?void 0:a.applicationType)?{SewerageConnection:n,reconnectRequest:!0,disconnectRequest:!1}:{SewerageConnection:n,reconnectRequest:!1,disconnectRequest:!1},d=function(){if("WATER"==w){const e=function(){if(G)return b(!0),Promise.resolve(G(u,{onError:(e,n)=>{var t,l,o,i,a,r;b(!1),_({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(h(null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0],"WATER")).then(function(e){q({WaterConnection:e,reconnectRequest:!1,disconnectRequest:!1},{onError:(e,n)=>{var t,l,o,i,a,r;b(!1),_({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:(e,n)=>{var t,l;z(),c.push("/digit-ui/employee/ws/ws-response?applicationNumber="+(null==e||null===(t=e.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo))}})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();return d&&d.then?d.then(r):r()})}_({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{_(!1)},3e3)}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:j,appData:f}),S&&l.createElement(a.Toast,{isDleteBtn:!0,error:"error"===(null==S?void 0:S.key),label:d(null==S?void 0:S.message),onClose:()=>{_(null)}}))},WSEditModifyApplication:()=>{var e;const{t:n}=o.useTranslation();let{state:r}=i.useLocation();r=r?"string"==typeof r?JSON.parse(r):r:{},i.useHistory();let u=g(location.search);const[d,s]=t.useState(!1),[c,p]=t.useState(null),[m,E]=t.useState({}),[S,_]=t.useState({head:"",body:[]}),[f,C]=t.useState(!0),[N,y]=t.useState(!1),D=Digit.ULBService.getCurrentTenantId(),T=null==u?void 0:u.service,h=Lt(null===(e=r)||void 0===e?void 0:e.data),A=Digit.ULBService.getStateId();let{data:I,isLoading:O}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(A,{});const[b,L]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[w,W,P]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:x}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:b},tenantId:D},{filters:{propertyIds:b},tenantId:D,enabled:!(!b||""==b)});t.useEffect(()=>{if(!O){var e;const n=I.find(e=>e.hideInCitizen&&e.isModify);n.head="WS_WATER_AND_SEWERAGE_MODIFY_CONNECTION_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isModifyConnection&&t.push(e)}),t.forEach(e=>{"WS_COMMON_PROPERTY_DETAILS"==(null==e?void 0:e.head)&&(e.head="")}),n.body=t,_(n)}},[I]),t.useEffect(()=>{var e,n,t,l;!b&&(null==w||null===(e=w.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&L(null==w||null===(t=w.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==w?void 0:w.cpt]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),t=function(t){if(null!=h&&null!==(t=h.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(R(h,T,!0,!1,n)).then(function(e){W(v({},w,e)),E(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[x,w,null==w?void 0:w.cpt]),t.useEffect(()=>{var e;W(v({},w,{cpt:{details:null==x||null===(e=x.Properties)||void 0===e?void 0:e[0]}}))},[x]),t.useEffect(()=>{var e,n;null!=w&&null!==(e=w.ConnectionDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.applicationNo&&C(!1)},[x,w,null==w?void 0:w.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;N&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==w||null===(e=w.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==w||null===(t=w.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase())+"&mode=MODIFY")},3e3);return()=>clearTimeout(e)},[N]);const{mutate:B}=Digit.Hooks.ws.useWSApplicationActions(null==u?void 0:u.service);return f||O?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,n(S.head))),l.createElement(a.FormComposer,{config:S.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(w,n)||W(v({},w,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?s(!0):s(!Object.keys(t.errors).length)},label:n("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(d){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(M(e,n,"SUBMIT_APPLICATION")).then(function(n){var t,l;const o="WATER"==(null==e||null===(t=e.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.serviceName)?{WaterConnection:n}:{SewerageConnection:n};B&&B(o,{onError:(e,n)=>{p({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:(e,n)=>{p({key:!1,message:"WS_APPLICATION_SUBMITTED_SUCCESSFULLY_LABEL"}),y(!0)}})})}p({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{p(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:w}),c&&l.createElement(a.Toast,{error:c.key,label:n(null==c?void 0:c.message),onClose:()=>{p(null)},isDleteBtn:!0}))},WSDisconnectionApplication:()=>{const{t:e}=o.useTranslation(),n=i.useRouteMatch(),t=Digit.ULBService.getStateId();let{data:r,isLoading:u}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(t,{}),d=[];return!u&&r.length>0?(r.forEach(e=>{d=d.concat(e.body.filter(e=>!e.hideInCitizen))}),d.indexRoute="docsrequired",l.createElement(i.Switch,null,d.map((t,o)=>{const{component:a,texts:r,inputs:u,key:d,isSkipEnabled:s}=t,c="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;return l.createElement(i.Route,{path:Fr(n.path,n.params)+"/"+t.route,key:o},l.createElement(c,{config:{texts:r,inputs:u,key:d,isSkipEnabled:s},t:e,userType:"employee"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Fr(n.path,n.params)+"/"+d.indexRoute})))):l.createElement(a.Loader,null)},WSRestorationApplication:()=>{const{t:e}=o.useTranslation(),n=i.useRouteMatch(),t=Digit.ULBService.getStateId();let{data:r,isLoading:u}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(t,{}),d=[];return u?l.createElement(a.Loader,null):(r.forEach(e=>{d=d.concat(e.body.filter(e=>!e.hideInCitizen))}),d.indexRoute="new-restoration",console.log("configconfig",d),l.createElement(i.Switch,null,d.map((t,o)=>{const{texts:a,inputs:r,key:u,isSkipEnabled:d}=t,s=Digit.ComponentRegistryService.getComponent("WSRestorationForm");return l.createElement(i.Route,{path:Ur(n.path,n.params)+"/new-restoration",key:o},l.createElement(s,{config:{texts:a,inputs:r,key:u,isSkipEnabled:d},t:e,userType:"employee"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Ur(n.path,n.params)+"/"+d.indexRoute}))))},WSEditApplicationByConfig:()=>{var e,n,r,u,d,s,c,p;const{t:m}=o.useTranslation();let{state:E}=i.useLocation();E=E?"string"==typeof E?JSON.parse(E):E:{},i.useHistory();let S=g(location.search);const[_,f]=t.useState(!1),[C,N]=t.useState(null),[y,D]=t.useState({}),[T,h]=t.useState({head:"",body:[]}),[A,I]=t.useState(!0),[O,b]=t.useState(!1);let L=Digit.ULBService.getCurrentTenantId();L||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const w=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")),W=(null==S?void 0:S.service)||(null==w||null===(e=w.applicationData)||void 0===e?void 0:e.serviceType),P=Digit.ULBService.getStateId();let{data:M,isLoading:x}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(P,{}),B=Lt(null===(n=E)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.applicationDetails);Lt(null===(u=E)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.action);let{isLoading:F,data:k}=Digit.Hooks.ws.useWSDetailsPage(m,L,null===(s=B)||void 0===s?void 0:s.applicationNo,null===(c=B)||void 0===c||null===(p=c.applicationData)||void 0===p?void 0:p.serviceType,{privacy:Digit.Utils.getPrivacyObject()});B=k;const[H,j]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[V,z,Y]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),[G,q,K]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),{data:X}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:H},tenantId:L},{filters:{propertyIds:H},tenantId:L,enabled:!(!H||""==H),privacy:Digit.Utils.getPrivacyObject()});return t.useEffect(()=>{if(!x){var e;const n=M.find(e=>e.hideInCitizen&&e.isEditByConfig);n.head="WS_APP_FOR_WATER_AND_SEWERAGE_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isEditByConfigConnection&&t.push(e)}),n.body=t,h(n)}},[M]),t.useEffect(()=>{var e,n,t,l;!H&&(null==V||null===(e=V.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&j(null==V||null===(t=V.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==V?void 0:V.cpt]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=B)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return sessionStorage.setItem("appData",JSON.stringify(y)),Promise.resolve(R(B,W,!1,!1,m)).then(function(e){z(v({},V,e)),D(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[B,k,null==V?void 0:V.cpt,V,X]),t.useEffect(()=>{var e;z(v({},V,{cpt:{details:null==X||null===(e=X.Properties)||void 0===e?void 0:e[0]}}))},[X]),t.useEffect(()=>{var e,n,t,l,o,i,a;((null==V||null===(e=V.DocumentsRequired)||void 0===e||null===(n=e.documents)||void 0===n?void 0:n.length)>0||null!=V&&null!==(t=V.ConnectionDetails)&&void 0!==t&&null!==(l=t[0])&&void 0!==l&&l.water||null!=V&&null!==(o=V.ConnectionDetails)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.sewerage||null!=V&&null!==(a=V.cpt)&&void 0!==a&&a.details&&!F)&&I(!1)},[X,V,null==V?void 0:V.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;O&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==V||null===(e=V.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==V||null===(t=V.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase()))},5e3);return()=>clearTimeout(e)},[O]),Digit.Hooks.ws.useWSApplicationActions(W),A||x?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,m(T.head))),l.createElement(a.FormComposer,{config:T.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P;U.isEqual(V,n)||z(v({},V,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?f(!0):null!==(i=n.ConnectionDetails)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&a.water&&(""==(null===(r=n.roadCuttingDetails)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.roadType)||void 0===d?void 0:d.code)||""==(null===(s=n.roadCuttingDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.area)||""==(null===(p=n.plumberDetails)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.detailsProvidedBy)||""==(null===(E=n.connectionDetails)||void 0===E||null===(S=E[0])||void 0===S?void 0:S.connectionType)||""==(null===(_=n.connectionDetails)||void 0===_||null===(g=_[0])||void 0===g?void 0:g.waterSource)||""==(null===(C=n.connectionDetails)||void 0===C||null===(N=C[0])||void 0===N?void 0:N.sourceSubData))||null!==(y=n.ConnectionDetails)&&void 0!==y&&null!==(D=y[0])&&void 0!==D&&D.sewerage&&(""==(null===(T=n.roadCuttingDetails)||void 0===T||null===(h=T[0])||void 0===h||null===(A=h.roadType)||void 0===A?void 0:A.code)||""==(null===(I=n.roadCuttingDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.area)||""==(null===(b=n.plumberDetails)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.detailsProvidedBy)||""==(null===(R=n.connectionDetails)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.noOfWaterClosets)||""==(null===(W=n.connectionDetails)||void 0===W||null===(P=W[0])||void 0===P?void 0:P.noOfToilets))?f(!1):f(!Object.keys(t.errors).length)},label:m("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(_){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(((e,n,t)=>{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe;null==e||null===(l=e.cpt)||void 0===l||null===(o=l.details)||void 0===o||null===(i=o.owners)||void 0===i||i.forEach(e=>{null!=e&&e.permanentAddress&&(e.correspondenceAddress=null==e?void 0:e.permanentAddress)});let Me=v({},n.applicationData,{proposedTaps:(null==e||null===(a=e.ConnectionDetails)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.proposedTaps)&&Number(null==e||null===(u=e.ConnectionDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.proposedTaps),proposedPipeSize:(null==e||null===(s=e.ConnectionDetails)||void 0===s||null===(c=s[0])||void 0===c||null===(p=c.proposedPipeSize)||void 0===p?void 0:p.size)&&Number(null==e||null===(m=e.ConnectionDetails)||void 0===m||null===(E=m[0])||void 0===E||null===(S=E.proposedPipeSize)||void 0===S?void 0:S.size),proposedWaterClosets:(null==e||null===(_=e.ConnectionDetails)||void 0===_||null===(f=_[0])||void 0===f?void 0:f.proposedWaterClosets)&&Number(null==e||null===(g=e.ConnectionDetails)||void 0===g||null===(C=g[0])||void 0===C?void 0:C.proposedWaterClosets),proposedToilets:(null==e||null===(N=e.ConnectionDetails)||void 0===N||null===(y=N[0])||void 0===y?void 0:y.proposedToilets)&&Number(null==e||null===(D=e.ConnectionDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.proposedToilets),connectionHolders:null!=e&&null!==(h=e.ConnectionHolderDetails)&&void 0!==h&&null!==(A=h[0])&&void 0!==A&&A.sameAsOwnerDetails?null:[v({},null==n||null===(I=n.applicationData)||void 0===I||null===(O=I.connectionHolders)||void 0===O?void 0:O[0],{correspondenceAddress:(null==e||null===(b=e.ConnectionHolderDetails)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.address)||"",fatherOrHusbandName:(null==e||null===(R=e.ConnectionHolderDetails)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.guardian)||"",gender:(null==e||null===(W=e.ConnectionHolderDetails)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.gender)||void 0===M?void 0:M.code)||"",mobileNumber:(null==e||null===(x=e.ConnectionHolderDetails)||void 0===x||null===(B=x[0])||void 0===B?void 0:B.mobileNumber)||"",name:(null==e||null===(F=e.ConnectionHolderDetails)||void 0===F||null===(U=F[0])||void 0===U?void 0:U.name)||"",ownerType:(null==e||null===(k=e.ConnectionHolderDetails)||void 0===k||null===(H=k[0])||void 0===H||null===(j=H.ownerType)||void 0===j?void 0:j.code)||"",relationship:(null==e||null===(V=e.ConnectionHolderDetails)||void 0===V||null===(z=V[0])||void 0===z||null===(Y=z.relationship)||void 0===Y?void 0:Y.code)||"",sameAsPropertyAddress:null==e||null===(G=e.ConnectionHolderDetails)||void 0===G||null===(q=G[0])||void 0===q?void 0:q.sameAsOwnerDetails})],property:null==e||null===(K=e.cpt)||void 0===K?void 0:K.details,propertyId:null==e||null===(X=e.cpt)||void 0===X||null===(Z=X.details)||void 0===Z?void 0:Z.propertyId,processInstance:v({},null==n?void 0:n.processInstance,{action:"VERIFY_AND_FORWARD"}),action:"VERIFY_AND_FORWARD",documents:null==e||null===($=e.DocumentsRequired)||void 0===$?void 0:$.documents,plumberInfo:[{licenseNo:(null==e||null===(J=e.plumberDetails)||void 0===J||null===(Q=J[0])||void 0===Q?void 0:Q.plumberLicenseNo)||(null==n?void 0:n.plumberLicenseNo),name:(null==e||null===(ee=e.plumberDetails)||void 0===ee||null===(ne=ee[0])||void 0===ne?void 0:ne.plumberName)||(null==n?void 0:n.plumberName),mobileNumber:(null==e||null===(te=e.plumberDetails)||void 0===te||null===(le=te[0])||void 0===le?void 0:le.plumberMobileNo)||(null==n?void 0:n.plumberMobileNo)}],roadCuttingInfo:null==e||null===(oe=e.roadCuttingDetails)||void 0===oe?void 0:oe.filter(e=>""!=e.roadType.code).map(e=>{var n,t;return null!=e&&e.id&&null!==(null==e?void 0:e.id)?{id:null==e?void 0:e.id,roadType:null==e||null===(n=e.roadType)||void 0===n?void 0:n.code,roadCuttingArea:null==e?void 0:e.area,status:null==e?void 0:e.status}:{roadType:null==e||null===(t=e.roadType)||void 0===t?void 0:t.code,roadCuttingArea:null==e?void 0:e.area}}),connectionNo:null},"WATER"===t?{connectionType:(null==e||null===(ie=e.connectionDetails)||void 0===ie||null===(ae=ie[0])||void 0===ae||null===(re=ae.connectionType)||void 0===re?void 0:re.code)||(null==n?void 0:n.connectionType),waterSource:(null==e||null===(ue=e.connectionDetails)||void 0===ue||null===(de=ue[0])||void 0===de||null===(se=de.sourceSubData)||void 0===se?void 0:se.code)||(null==n?void 0:n.waterSource),pipeSize:(null==e||null===(ce=e.connectionDetails)||void 0===ce||null===(ve=ce[0])||void 0===ve||null===(pe=ve.pipeSize)||void 0===pe?void 0:pe.size)||(null==n?void 0:n.pipeSize),noOfTaps:(null==e||null===(me=e.connectionDetails)||void 0===me||null===(Ee=me[0])||void 0===Ee?void 0:Ee.noOfTaps)||(null==n?void 0:n.noOfTaps),sourceSubData:(null==e||null===(Se=e.connectionDetails)||void 0===Se||null===(_e=Se[0])||void 0===_e||null===(fe=_e.sourceSubData)||void 0===fe?void 0:fe.code)||(null==n?void 0:n.sourceSubData)}:{connectionType:"Non Metered",noOfWaterClosets:(null==e||null===(ge=e.connectionDetails)||void 0===ge||null===(Ce=ge[0])||void 0===Ce?void 0:Ce.noOfWaterClosets)||(null==n?void 0:n.noOfWaterClosets)||"",noOfToilets:(null==e||null===(Ne=e.connectionDetails)||void 0===Ne||null===(ye=Ne[0])||void 0===ye?void 0:ye.noOfToilets)||(null==n?void 0:n.noOfToilets)||""},{tenantId:null==e||null===(De=e.cpt)||void 0===De||null===(Te=De.details)||void 0===Te?void 0:Te.tenantId});var xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke;return(null!=e&&null!==(he=e.plumberDetails)&&void 0!==he&&null!==(Ae=he[0])&&void 0!==Ae&&null!==(Ie=Ae.detailsProvidedBy)&&void 0!==Ie&&Ie.code||null!=n&&n.detailsProvidedBy)&&(Me.additionalDetails.detailsProvidedBy=(null==e||null===(xe=e.plumberDetails)||void 0===xe||null===(Be=xe[0])||void 0===Be||null===(Fe=Be.detailsProvidedBy)||void 0===Fe?void 0:Fe.code)||(null==n?void 0:n.detailsProvidedBy),Me.additionalDetails.initialMeterReading=null),null!=e&&null!==(Oe=e.cpt)&&void 0!==Oe&&null!==(be=Oe.details)&&void 0!==be&&null!==(Le=be.address)&&void 0!==Le&&null!==(Re=Le.locality)&&void 0!==Re&&Re.code&&(Me.additionalDetails.locality=null==e||null===(Ue=e.cpt)||void 0===Ue||null===(ke=Ue.details)||void 0===ke||null===(He=ke.address)||void 0===He||null===(je=He.locality)||void 0===je?void 0:je.code),"ULB"==(null==e||null===(we=e.plumberDetails)||void 0===we||null===(We=we[0])||void 0===We||null===(Pe=We.detailsProvidedBy)||void 0===Pe?void 0:Pe.code)&&(Me.plumberInfo=[{licenseNo:(null==e||null===(Ve=e.plumberDetails)||void 0===Ve||null===(ze=Ve[0])||void 0===ze?void 0:ze.plumberLicenseNo)||(null==n?void 0:n.plumberLicenseNo),name:(null==e||null===(Ye=e.plumberDetails)||void 0===Ye||null===(Ge=Ye[0])||void 0===Ge?void 0:Ge.plumberName)||(null==n?void 0:n.plumberName),mobileNumber:(null==e||null===(qe=e.plumberDetails)||void 0===qe||null===(Ke=qe[0])||void 0===Ke?void 0:Ke.plumberMobileNo)||(null==n?void 0:n.plumberMobileNo)}]),Me})(e,n,W)).then(function(e){var n;null!=G&&G.adhocPenalty&&(e.additionalDetails.adhocPenalty=parseInt(null==G?void 0:G.adhocPenalty)),null!=G&&G.adhocPenaltyComment&&(e.additionalDetails.adhocPenaltyComment=(null==G?void 0:G.adhocPenaltyComment)||""),null!=G&&G.adhocPenaltyReason&&(e.additionalDetails.adhocPenaltyReason=(null==G?void 0:G.adhocPenaltyReason)||""),null!=G&&G.adhocRebate&&(e.additionalDetails.adhocRebate=parseInt(null==G?void 0:G.adhocRebate)),null!=G&&G.adhocRebateComment&&(e.additionalDetails.adhocRebateComment=(null==G?void 0:G.adhocRebateComment)||""),null!=G&&G.adhocRebateReason&&(e.additionalDetails.adhocRebateReason=(null==G?void 0:G.adhocRebateReason)||""),f(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),window.location.assign(""+window.location.origin+(null===(n=E)||void 0===n?void 0:n.url))})}N({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{N(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:V,appData:y}),C&&l.createElement(a.Toast,{error:C.key,label:m(null==C?void 0:C.message),warning:null==C?void 0:C.warning,onClose:()=>{N(null)}}))},WSGetDisconnectionDetails:()=>{var e,n,i,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,B,F,U,k,H,j,V,z,Y,G,q;const{t:K}=o.useTranslation(),X=t.useRef();let Z=g(location.search);const[$,J]=t.useState(!1),[Q,ee]=t.useState(null),ne=Digit.ULBService.getCurrentTenantId(),te=null==Z?void 0:Z.applicationNumber,le=null==Z?void 0:Z.service,oe=Digit.ULBService.getStateId();sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists"),sessionStorage.setItem("disconnectionURL",JSON.stringify({url:""+(null===(e=location)||void 0===e?void 0:e.pathname)+location.search}));let{isLoading:ie,data:ae}=Digit.Hooks.ws.useDisConnectionDetails(K,ne,te,le,{privacy:Digit.Utils.getPrivacyObject()});const{isServicesMasterLoading:re,data:ue}=Digit.Hooks.ws.useMDMS(oe,"ws-services-masters",["WSEditApplicationByConfigUser"]),de=(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.applicationStatus)||"";let se=Digit.Hooks.useWorkflowDetails({tenantId:ne,id:te,moduleCode:null==ae||null===(i=ae.processInstancesDetails)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.businessService},{enabled:!(null==ae||null===(u=ae.processInstancesDetails)||void 0===u||null===(d=u[0])||void 0===d||!d.businessService)});const{mutate:ce}=Digit.Hooks.ws.useWSApplicationActions(le);var ve,pe,me,Ee,Se;Digit.Hooks.useClickOutside(X,()=>{J(!1)},$),Digit.Utils.browser.isMobile(),!((null==se||null===(s=se.data)||void 0===s||null===(c=s.nextActions)||void 0===c?void 0:c.length)>0&&(null==se||null===(p=se.data)||void 0===p||null===(m=p.actionState)||void 0===m||null===(E=m.nextActions)||void 0===E?void 0:E.length)>0)||null!=se&&null!==(S=se.data)&&void 0!==S&&null!==(_=S.actionState)&&void 0!==_&&null!==(f=_.nextActions)&&void 0!==f&&f.find(e=>"EDIT"===e.action)||null!=se&&null!==(C=se.data)&&void 0!==C&&null!==(N=C.actionState)&&void 0!==N&&null!==(y=N.nextActions)&&void 0!==y&&y.find(e=>"RESUBMIT_APPLICATION"===e.action)||null!=se&&null!==(D=se.data)&&void 0!==D&&null!==(T=D.actionState)&&void 0!==T&&null!==(h=T.nextActions)&&void 0!==h&&h.find(e=>"EXECUTE_DISCONNECTION"===e.action)||null!=se&&null!==(A=se.data)&&void 0!==A&&null!==(I=A.actionState)&&void 0!==I&&null!==(O=I.nextActions)&&void 0!==O&&O.find(e=>"SUBMIT_APPLICATION"===e.action)||null!=se&&null!==(b=se.data)&&void 0!==b&&null!==(L=b.actionState)&&void 0!==L&&null!==(R=L.nextActions)&&void 0!==R&&R.find(e=>"DISCONNECTION_EXECUTED"===e.action)||null==se||null===(ve=se.data)||void 0===ve||null===(pe=ve.nextActions)||void 0===pe||pe.forEach(e=>{"EDIT"==e.action&&se.data.actionState.nextActions.push(e)}),"DISCONNECTION_EXECUTED"==(null==ae||null===(w=ae.applicationData)||void 0===w?void 0:w.applicationStatus)&&(null!=se&&null!==(me=se.data)&&void 0!==me&&null!==(Ee=me.actionState)&&void 0!==Ee&&Ee.nextActions&&(se.data.actionState.nextActions=[]),null!=se&&null!==(Se=se.data)&&void 0!==Se&&Se.nextActions&&(se.data.nextActions=[])),null==se||null===(W=se.data)||void 0===W||null===(P=W.nextActions)||void 0===P||P.forEach(e=>{var n,t;"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:("WATER"==le?"WS":"SW")+"/"+(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.connectionNo)+"/"+(null==ae?void 0:ae.tenantId)+"?tenantId="+(null==ae?void 0:ae.tenantId)+"&ISWSAPP&applicationNumber="+(null==ae||null===(t=ae.applicationData)||void 0===t?void 0:t.connectionNo)+"&IsDisconnectionFlow="+!0,state:null==ae?void 0:ae.tenantId})}),null==se||null===(M=se.data)||void 0===M||null===(B=M.actionState)||void 0===B||null===(F=B.nextActions)||void 0===F||F.forEach(e=>{var n,t;"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:("WATER"==le?"WS":"SW")+"/"+(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.connectionNo)+"/"+(null==ae?void 0:ae.tenantId)+"?tenantId="+(null==ae?void 0:ae.tenantId)+"&ISWSAPP&applicationNumber="+(null==ae||null===(t=ae.applicationData)||void 0===t?void 0:t.connectionNo)+"&IsDisconnectionFlow="+!0,state:null==ae?void 0:ae.tenantId})}),null==se||null===(U=se.data)||void 0===U||null===(k=U.actionState)||void 0===k||null===(H=k.nextActions)||void 0===H||H.forEach(e=>{if("EDIT"===(null==e?void 0:e.action)){var n,t,l;let o="/digit-ui/employee/ws/edit-disconnection-application?applicationNumber="+te+"&service="+le;const i=(null==ue||null===(n=ue["ws-services-masters"])||void 0===n?void 0:n.WSEditApplicationByConfigUser)||[],a=(null==i||null===(t=i[0])||void 0===t?void 0:t.roles)||[],r=null==i||null===(l=i[0])||void 0===l?void 0:l.status;let u=!1;a.every((e,n)=>(u=x(e),!u)),u&&de===r&&(o="/digit-ui/employee/ws/config-by-disconnection-application?applicationNumber="+te+"&service="+le),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:o,state:{applicationDetails:ae,action:"VERIFY_AND_FORWARD"}}}"RESUBMIT_APPLICATION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/resubmit-disconnection-application?applicationNumber="+te+"&service="+le,state:{applicationDetails:ae,action:"VERIFY_AND_FORWARD"}})});const _e={order:1,label:K("WS_APPLICATION"),onClick:function(){try{var e;const n=null==ae||null===(e=ae.applicationData)||void 0===e?void 0:e.tenantId;return xi(v({},null==ae?void 0:ae.applicationData),v({},null==ae?void 0:ae.propertyDetails),n,K).then(e=>Digit.Utils.pdf.generatev1(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}},fe={order:2,label:K("WS_DISCONNECTION_NOTICE_LABEL"),onClick:()=>function(){try{var e,n,t;let l="ws-waterdisconnectionnotice",o={WaterConnection:[v({},null==ae?void 0:ae.applicationData,{property:ae.propertyDetails})]};return null!=ae&&null!==(e=ae.applicationData)&&void 0!==e&&null!==(n=e.applicationType)&&void 0!==n&&n.includes("WATER")||(l="ws-seweragedisconnectionnotice",o={SewerageConnection:[v({},null==ae?void 0:ae.applicationData,{property:ae.propertyDetails})]}),Promise.resolve(Digit.WSService.WSDisconnectionNotice(null==ae||null===(t=ae.applicationData)||void 0===t?void 0:t.tenantId,o,l)).then(function(e){var n;return Promise.resolve(Digit.PaymentService.printReciept(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.tenantId,{fileStoreIds:e.filestoreIds[0]})).then(function(n){window.open(n[null==e?void 0:e.filestoreIds[0]],"_blank")})})}catch(e){return Promise.reject(e)}}()};let ge=[];switch(de){case"DISCONNECTION_EXECUTED":case"PENDING_FOR_PAYMENT":case"PENDING_FOR_DISCONNECTION_EXECUTION":ge=[_e,fe];break;default:ge=[_e]}return ge.sort(function(e,n){return e.order-n.order}),l.createElement(t.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"70%"}},l.createElement(a.Header,null,K("WS_APPLICATION_DETAILS")," ")),l.createElement("div",{style:{width:"30%",zIndex:"10"}},l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-divNew",onHeadClick:()=>J(!$),displayOptions:$,options:ge,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:X})))),l.createElement(Wr,{applicationDetails:ae,isLoading:ie||re,isDataLoading:ie||re,applicationData:null==ae?void 0:ae.applicationData,mutate:ce,workflowDetails:se,businessService:null==ae||null===(j=ae.processInstancesDetails)||void 0===j||null===(V=j[0])||void 0===V||null===(z=V.businessService)||void 0===z?void 0:z.toUpperCase(),moduleCode:"WS",showToast:Q,setShowToast:ee,closeToast:()=>{ee(null)},timelineStatusPrefix:"WF_"+(null==ae||null===(Y=ae.processInstancesDetails)||void 0===Y||null===(G=Y[0])||void 0===G||null===(q=G.businessService)||void 0===q?void 0:q.toUpperCase())+"_",isInfoLabel:"true"===sessionStorage.getItem("isPrivacyEnabled")})))},WSModifyApplicationDetails:()=>{var e,n,i,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,T,h,A,I,O,b,R,w,W,P,M,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$;const{t:J}=o.useTranslation(),Q=Digit.UserService.getUser(),ee=Digit.ULBService.getCurrentTenantId(),[ne,te]=t.useState(null),[oe,ie]=t.useState(!1);let ae=g(location.search);const re=null==ae?void 0:ae.applicationNumber,ue=null==ae?void 0:ae.service,de=Digit.ULBService.getStateId(),se=t.useRef();let{isLoading:ce,data:ve}=Digit.Hooks.ws.useWSModifyDetailsPage(J,ee,re,ue,Q,{privacy:Digit.Utils.getPrivacyObject()});const{isServicesMasterLoading:pe,data:me}=Digit.Hooks.ws.useMDMS(de,"ws-services-masters",["WSEditApplicationByConfigUser"]);let Ee=Digit.Hooks.useWorkflowDetails({tenantId:ee,id:re,moduleCode:null==ve||null===(e=ve.processInstancesDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.businessService,config:{enabled:!(null==ve||null===(i=ve.processInstancesDetails)||void 0===i||null===(r=i[0])||void 0===r||!r.businessService),privacy:Digit.Utils.getPrivacyObject()}});const{mutate:Se}=Digit.Hooks.ws.useWSApplicationActions(ue),_e=()=>{var e,n,t,l,o,i,a,r,u,d,s,c,v;const p=null==ve||null===(e=ve.applicationData)||void 0===e?void 0:e.connectionType,m=0===(null==ve||null===(n=ve.applicationData)||void 0===n?void 0:n.noOfTaps)?null:null==ve||null===(t=ve.applicationData)||void 0===t?void 0:t.noOfTaps,E=0===(null==ve||null===(l=ve.applicationData)||void 0===l?void 0:l.pipeSize)?null:null==ve||null===(o=ve.applicationData)||void 0===o?void 0:o.pipeSize,S=null==ve||null===(i=ve.applicationData)||void 0===i?void 0:i.waterSource,_=0===(null==ve||null===(a=ve.applicationData)||void 0===a?void 0:a.noOfWaterClosets)?null:null==ve||null===(r=ve.applicationData)||void 0===r?void 0:r.noOfWaterClosets,f=0===(null==ve||null===(u=ve.applicationData)||void 0===u?void 0:u.noOfToilets)?null:null==ve||null===(d=ve.applicationData)||void 0===d?void 0:d.noOfToilets,g=null==ve||null===(s=ve.applicationData)||void 0===s||null===(c=s.additionalDetails)||void 0===c?void 0:c.detailsProvidedBy,C=null==ve||null===(v=ve.applicationData)||void 0===v?void 0:v.roadCuttingInfo;return!!(p&&(m&&E&&S||_&&f)&&g&&C)};let fe=[],ge=(null==ve||null===(u=ve.applicationData)||void 0===u?void 0:u.applicationStatus)||"";var Ce,Ne;null==Ee||null===(d=Ee.data)||void 0===d||null===(s=d.actionState)||void 0===s||null===(c=s.nextActions)||void 0===c||c.forEach(e=>{if("ACTIVATE_CONNECTION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/activate-connection?applicationNumber="+re+"&service="+ue+"&action=ACTIVATE_CONNECTION",state:null==ve?void 0:ve.applicationData}),"RESUBMIT_APPLICATION"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(n=ve.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==me||null===(t=me["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&ge===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(i=ve.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:ve,action:"RESUBMIT_APPLICATION"}}}var a;"SUBMIT_APPLICATION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/modify-application-edit?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(a=ve.propertyDetails)||void 0===a?void 0:a.propertyId),state:ve})}),!((null==Ee||null===(p=Ee.data)||void 0===p||null===(m=p.nextActions)||void 0===m?void 0:m.length)>0&&(null==Ee||null===(E=Ee.data)||void 0===E||null===(S=E.actionState)||void 0===S||null===(_=S.nextActions)||void 0===_?void 0:_.length)>0)||null!=Ee&&null!==(f=Ee.data)&&void 0!==f&&null!==(C=f.actionState)&&void 0!==C&&null!==(N=C.nextActions)&&void 0!==N&&N.find(e=>"EDIT"===e.action)||null!=Ee&&null!==(y=Ee.data)&&void 0!==y&&null!==(D=y.actionState)&&void 0!==D&&null!==(T=D.nextActions)&&void 0!==T&&T.find(e=>"RESUBMIT_APPLICATION"===e.action)||null!=Ee&&null!==(h=Ee.data)&&void 0!==h&&null!==(A=h.actionState)&&void 0!==A&&null!==(I=A.nextActions)&&void 0!==I&&I.find(e=>"ACTIVATE_CONNECTION"===e.action)||null!=Ee&&null!==(O=Ee.data)&&void 0!==O&&null!==(b=O.actionState)&&void 0!==b&&null!==(R=b.nextActions)&&void 0!==R&&R.find(e=>"SUBMIT_APPLICATION"===e.action)||null==Ee||null===(Ce=Ee.data)||void 0===Ce||null===(Ne=Ce.nextActions)||void 0===Ne||Ne.forEach(e=>{"EDIT"==e.action&&Ee.data.actionState.nextActions.push(e)}),null==Ee||null===(w=Ee.data)||void 0===w||null===(W=w.actionState)||void 0===W||null===(P=W.nextActions)||void 0===P||P.forEach(e=>{if("EDIT"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(n=ve.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==me||null===(t=me["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&ge===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(i=ve.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:ve,action:"VERIFY_AND_FORWARD"}}}}),null==Ee||null===(M=Ee.data)||void 0===M||null===(B=M.nextActions)||void 0===B||B.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==ge||_e()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==Ee||null===(F=Ee.data)||void 0===F||null===(U=F.actionState)||void 0===U||null===(k=U.nextActions)||void 0===k||k.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==ge||_e()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==Ee||null===(H=Ee.data)||void 0===H||null===(j=H.nextActions)||void 0===j||j.forEach(e=>{"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:L(ae)+"/"+(null==ve?void 0:ve.applicationNo)+"/"+(null==ve?void 0:ve.tenantId)+"?tenantId="+(null==ve?void 0:ve.tenantId)+"&ISWSAPP&applicationNumber="+(null==ve?void 0:ve.applicationNo),state:null==ve?void 0:ve.tenantId})}),null==Ee||null===(V=Ee.data)||void 0===V||null===(z=V.actionState)||void 0===z||null===(Y=z.nextActions)||void 0===Y||Y.forEach(e=>{"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:L(ae)+"/"+(null==ve?void 0:ve.applicationNo)+"/"+(null==ve?void 0:ve.tenantId)+"?tenantId="+(null==ve?void 0:ve.tenantId)+"&ISWSAPP&applicationNumber="+(null==ve?void 0:ve.applicationNo),state:null==ve?void 0:ve.tenantId})});const ye={order:3,label:J("WS_APPLICATION"),onClick:function(){try{var e;const n=null==ve||null===(e=ve.applicationData)||void 0===e?void 0:e.tenantId;let t=null==ve?void 0:ve.oldApplication;return le(v({},null==ve?void 0:ve.applicationData),v({},null==ve?void 0:ve.propertyDetails),n,J,t).then(e=>Digit.Utils.pdf.generateModifyPdf(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}};switch(ge){case"REJECTED":default:fe=[ye]}return Digit.Hooks.useClickOutside(se,()=>{ie(!1)},oe),fe.sort(function(e,n){return e.order-n.order}),l.createElement(t.Fragment,null,l.createElement("div",{className:"employee-main-application-details"},l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},J("CS_TITLE_APPLICATION_DETAILS")),fe&&fe.length>0&&l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-div",onHeadClick:()=>ie(!oe),displayOptions:oe,options:fe,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:se})),l.createElement(Wr,{applicationDetails:ve,isLoading:ce||pe,isDataLoading:ce||pe,applicationData:null==ve?void 0:ve.applicationData,mutate:Se,workflowDetails:Ee,businessService:null==ve||null===(G=ve.processInstancesDetails)||void 0===G||null===(q=G[0])||void 0===q||null===(K=q.businessService)||void 0===K?void 0:K.toUpperCase(),moduleCode:"WS",showToast:ne,setShowToast:te,closeToast:()=>{te(null)},timelineStatusPrefix:"WF_"+(null==ve||null===(X=ve.processInstancesDetails)||void 0===X||null===(Z=X[0])||void 0===Z||null===($=Z.businessService)||void 0===$?void 0:$.toUpperCase())+"_",isInfoLabel:"true"===sessionStorage.getItem("isPrivacyEnabled")})))},WSEditDisconnectionApplication:()=>{var e,n,r,u,d,s,c;const{t:p}=o.useTranslation();let{state:m}=i.useLocation();m=m?"string"==typeof m?JSON.parse(m):m:{},g(location.search);const[E,S]=t.useState(!1),[_,f]=t.useState(null),[C,N]=t.useState({}),[y,D]=t.useState({head:"",body:[]});let T=Digit.ULBService.getCurrentTenantId();T||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"),JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS"));const h=Digit.ULBService.getStateId();let{data:A,isLoading:I}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(h,{}),O=Lt(null===(e=m)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.applicationDetails);const b=Lt(null===(r=m)||void 0===r||null===(u=r.data)||void 0===u?void 0:u.action);let{isLoading:L,data:R}=Digit.Hooks.ws.useDisConnectionDetails(p,T,null===(d=O)||void 0===d?void 0:d.applicationNo,null===(s=O)||void 0===s||null===(c=s.applicationData)||void 0===c?void 0:c.serviceType,{privacy:Digit.Utils.getPrivacyObject()});O=R;const[P,M,x]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{});t.useEffect(()=>{if(!L&&!I){var e;const n=A.find(e=>e.isDisonnectionEdit);n.head="WS_WATER_SEWERAGE_DISCONNECTION_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isDisonnectionEdit&&t.push(e)}),n.body=t,D(n)}},[R,L,A]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=O)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(w(O,0,!1)).then(function(e){M(v({},P,e)),N(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[O,R,P]);const B=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));return L||!B||I?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,p(y.head))),l.createElement(a.FormComposer,{config:y.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(P,n)||M(v({},P,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?S(!0):S(!Object.keys(t.errors).length)},label:p("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(E){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(W(e,n,b)).then(function(e){var n;S(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),window.location.assign(""+window.location.origin+(null===(n=m)||void 0===n?void 0:n.url))})}f({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{f(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:P,appData:C,noBreakLine:!0}),_&&l.createElement(a.Toast,{error:_.key,label:p(null==_?void 0:_.message),warning:null==_?void 0:_.warning,onClose:()=>{f(null)}}))},WSEditDisconnectionByConfig:()=>{var e,n,r,u,d,s,c;const{t:p}=o.useTranslation();let{state:m}=i.useLocation();m=m?"string"==typeof m?JSON.parse(m):m:{},g(location.search);const[E,S]=t.useState(!1),[_,f]=t.useState(null),[C,N]=t.useState({}),[y,D]=t.useState({head:"",body:[]});let T=Digit.ULBService.getCurrentTenantId();T||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"),JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS"));const h=Digit.ULBService.getStateId();let{data:A,isLoading:I}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(h,{}),O=Lt(null===(e=m)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.applicationDetails);const b=Lt(null===(r=m)||void 0===r||null===(u=r.data)||void 0===u?void 0:u.action);let{isLoading:L,data:R}=Digit.Hooks.ws.useDisConnectionDetails(p,T,null===(d=O)||void 0===d?void 0:d.applicationNo,null===(s=O)||void 0===s||null===(c=s.applicationData)||void 0===c?void 0:c.serviceType,{privacy:Digit.Utils.getPrivacyObject()});O=R;const[P,M,x]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{});t.useEffect(()=>{if(!L&&!I){var e;const n=A.find(e=>e.isDisonnectionEdit);n.head="WS_WATER_SEWERAGE_DISCONNECTION_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isDisonnectionEditByConfig&&t.push(e)}),n.body=t,D(n)}},[R,L,A]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=O)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(w(O,0,!0)).then(function(e){M(v({},P,e)),N(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[O,R,P]);const B=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));return L||!B||I?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,p(y.head))),l.createElement(a.FormComposer,{config:y.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(P,n)||M(v({},P,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?S(!0):S(!Object.keys(t.errors).length)},label:p("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(E){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(W(e,n,b)).then(function(e){var n;S(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),window.location.assign(""+window.location.origin+(null===(n=m)||void 0===n?void 0:n.url))})}f({warning:!0,message:"Please fill mandatory details"}),setTimeout(()=>{f(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:P,appData:C,noBreakLine:!0}),_&&l.createElement(a.Toast,{error:_.key,label:p(null==_?void 0:_.message),warning:null==_?void 0:_.warning,onClose:()=>{f(null)}}))},WSResubmitDisconnection:()=>{var e,n,r,u,d,s,c,p;const{t:m}=o.useTranslation();let{state:E}=i.useLocation();E=E?"string"==typeof E?JSON.parse(E):E:{};let S=g(location.search);const[_,f]=t.useState(!1),[C,N]=t.useState(null),[y,D]=t.useState({}),[T,h]=t.useState({head:"",body:[]}),[A,I]=t.useState(!1);let O=Digit.ULBService.getCurrentTenantId();O||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const b=Digit.ULBService.getStateId();let{data:L,isLoading:R}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(b,{});const P=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")),M=(null==S?void 0:S.service)||(null==P||null===(e=P.applicationData)||void 0===e?void 0:e.serviceType);let x=Lt(null===(n=E)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.applicationDetails);const B=Lt(null===(u=E)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.action);let{isLoading:F,data:k}=Digit.Hooks.ws.useDisConnectionDetails(m,O,null===(s=x)||void 0===s?void 0:s.applicationNo,null===(c=x)||void 0===c||null===(p=c.applicationData)||void 0===p?void 0:p.serviceType,{privacy:Digit.Utils.getPrivacyObject()});x=k;const[H,j,V]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{mutate:z}=Digit.Hooks.ws.useWSApplicationActions(M);t.useEffect(()=>{if(!F&&!R){var e;const n=L.find(e=>e.isDisonnectionEdit);n.head="WS_WATER_SEWERAGE_DISCONNECTION_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isDisonnectionEdit&&t.push(e)}),n.body=t,h(n)}},[k,F,L]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=x)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(w(x,0,!1)).then(function(e){j(v({},H,e)),D(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[x,k,H]),t.useEffect(()=>{const e=setTimeout(()=>{const e=sessionStorage.getItem("disconnectionURL"),n=e?JSON.parse(e):{};A&&window.location.assign(""+window.location.origin+(null==n?void 0:n.url))},5e3);return()=>clearTimeout(e)},[A]);const Y=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));return F||!Y||R?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,m(T.head))),l.createElement(a.FormComposer,{config:T.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(H,n)||j(v({},H,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?f(!0):f(!Object.keys(t.errors).length)},label:m("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(_){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(W(e,n,B)).then(function(e){f(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),e.processInstance.action="RESUBMIT_APPLICATION";let n="WATER"==e.serviceType?{WaterConnection:e}:{SewerageConnection:e};n.disconnectRequest=!0,z&&z(n,{onError:(e,n)=>{N({key:"error",message:null!=e&&e.message?e.message:e}),f(!0)},onSuccess:(e,n)=>{N({key:!1,message:"WS_APPLICATION_SUBMITTED_SUCCESSFULLY_LABEL"}),I(!0)}})})}N({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{N(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:H,appData:y,noBreakLine:!0}),C&&l.createElement(a.Toast,{error:C.key,label:m(null==C?void 0:C.message),warning:null==C?void 0:C.warning,onClose:()=>{N(null)}}))},WSSearchWaterConnectionIntegrated:Hr,WSSearchIntegrated:e=>{const[n,i]=t.useState(!0),{t:r}=o.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[d,s]=t.useState({}),[c,p]=t.useState(!1),m=Digit.ComponentRegistryService.getComponent("WSSearchWaterConnectionIntegrated"),E=window.location.pathname.includes("water/search")?"WS":"SW",[S,_]=t.useState(null),f=t.useCallback(e=>{const{connectionNumber:n,oldConnectionNumber:t,mobileNumber:l,propertyId:o}=e;n||t||l||o?s(Object.keys(e).filter(n=>e[n]).reduce((n,t)=>v({},n,{[t]:"object"==typeof e[t]?e[t].code:e[t]}),{})):(_({error:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"}),setTimeout(()=>{_(!1)},3e3))}),g={enabled:!!(d&&Object.keys(d).length>0)};let C=Digit.Hooks.ws.useSearchWS({tenantId:u,filters:d,config:g,bussinessService:"WS",t:r,shortAddress:!0}),N=Digit.Hooks.ws.useSearchWS({tenantId:u,filters:d,config:g,bussinessService:"SW",t:r,shortAddress:!0});return window.Digit.Utils.browser.isMobile(),l.createElement(t.Fragment,null,l.createElement(m,{t:r,tenantId:u,onSubmit:f,data:0==(null==N||null===(T=N.data)||void 0===T?void 0:T.length)&&0==(null==C||null===(h=C.data)||void 0===h?void 0:h.length)?{display:"ES_COMMON_NO_CONNECTION"}:(null==C||null===(A=C.data)||void 0===A?void 0:A.length)>0&&0==(null==N||null===(I=N.data)||void 0===I?void 0:I.length)?null==C?void 0:C.data:(null==N||null===(O=N.data)||void 0===O?void 0:O.length)>0&&0==(null==C||null===(b=C.data)||void 0===b?void 0:b.length)?null==N?void 0:N.data:(null==N||null===(L=N.data)||void 0===L?void 0:L.length)>0&&(null==C||null===(R=C.data)||void 0===R?void 0:R.length)>0?[...N.data,...C.data]:[],count:10,resultOk:(null==C||null===(y=C.data)||void 0===y?void 0:y.length)>0||(null==N||null===(D=N.data)||void 0===D?void 0:D.length)>0,businessService:E}),S&&l.createElement(a.Toast,{error:S.error,warning:S.warning,label:r(S.label),onClose:()=>{_(null)}}));var y,D,T,h,A,I,O,b,L,R},WSSearchWaterConnectionViewIntegrated:e=>{let{data:n,onSubmit:o,count:i,resultOk:a}=e;return l.createElement(t.Fragment,null,l.createElement(Hr,{onSubmit:o,data:n,count:i,resultOk:a}))},WSBulkBillGeneration:e=>{const[n,i]=t.useState(!0),{t:r}=o.useTranslation(),[u,d]=t.useState({}),[s,c]=t.useState(!1),v=Digit.ComponentRegistryService.getComponent("WSBulkBillSearch"),p=Digit.ULBService.getCurrentTenantId(),m=window.location.pathname.includes("water/search-connection")?"WS":"SW",[E,S]=t.useState(null),_={enabled:!!(u&&Object.keys(u).length>0)};let f=Digit.Hooks.ws.useBulkSearchWS({tenantId:p,filters:u,config:_});const g=window.Digit.Utils.browser.isMobile();return null!=f&&f.isLoading&&g?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,l.createElement(v,{t:r,tenantId:p,onSubmit:e=>{var n;d({locality:null==e||null===(n=e.locality)||void 0===n?void 0:n.code})},data:(console.log("result",f),0==(null==f?void 0:f.meterReadings.length)?{display:"ES_COMMON_NO_DATA"}:(null==f?void 0:f.meterReadings.length)>0?null==f?void 0:f.meterReadings.map(e=>({billingPeriod:e.billingPeriod,connectionNo:e.connectionNo,lastReading:e.lastReading,lastReadingDate:e.lastReadingDate,meterStatus:e.meterStatus,currentReadingDate:"",currentReading:""})):[]),count:null==f?void 0:f.count,resultOk:(null==f||null===(C=f.meterReadings)||void 0===C?void 0:C.length)>0,businessService:m,isLoading:null==f?void 0:f.isLoading}),E&&l.createElement(a.Toast,{error:E.error,warning:E.warning,label:r(E.label),onClose:()=>{S(null)}}));var C}};exports.initWSComponents=()=>{Object.entries(jr).forEach(e=>{let[n,t]=e;Digit.ComponentRegistryService.setComponent(n,t)})};
|
|
10
|
+
var eo="function"==typeof Symbol&&Symbol.for,no=eo?Symbol.for("react.element"):60103,to=eo?Symbol.for("react.portal"):60106,lo=eo?Symbol.for("react.fragment"):60107,oo=eo?Symbol.for("react.strict_mode"):60108,io=eo?Symbol.for("react.profiler"):60114,ao=eo?Symbol.for("react.provider"):60109,ro=eo?Symbol.for("react.context"):60110,uo=eo?Symbol.for("react.async_mode"):60111,so=eo?Symbol.for("react.concurrent_mode"):60111,co=eo?Symbol.for("react.forward_ref"):60112,vo=eo?Symbol.for("react.suspense"):60113,po=eo?Symbol.for("react.suspense_list"):60120,mo=eo?Symbol.for("react.memo"):60115,Eo=eo?Symbol.for("react.lazy"):60116,So=eo?Symbol.for("react.block"):60121,_o=eo?Symbol.for("react.fundamental"):60117,fo=eo?Symbol.for("react.responder"):60118,go=eo?Symbol.for("react.scope"):60119;function Co(e){if("object"==typeof e&&null!==e){var n=e.$$typeof;switch(n){case no:switch(e=e.type){case uo:case so:case lo:case io:case oo:case vo:return e;default:switch(e=e&&e.$$typeof){case ro:case co:case Eo:case mo:case ao:return e;default:return n}}case to:return n}}}function No(e){return Co(e)===so}var yo={AsyncMode:uo,ConcurrentMode:so,ContextConsumer:ro,ContextProvider:ao,Element:no,ForwardRef:co,Fragment:lo,Lazy:Eo,Memo:mo,Portal:to,Profiler:io,StrictMode:oo,Suspense:vo,isAsyncMode:function(e){return No(e)||Co(e)===uo},isConcurrentMode:No,isContextConsumer:function(e){return Co(e)===ro},isContextProvider:function(e){return Co(e)===ao},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===no},isForwardRef:function(e){return Co(e)===co},isFragment:function(e){return Co(e)===lo},isLazy:function(e){return Co(e)===Eo},isMemo:function(e){return Co(e)===mo},isPortal:function(e){return Co(e)===to},isProfiler:function(e){return Co(e)===io},isStrictMode:function(e){return Co(e)===oo},isSuspense:function(e){return Co(e)===vo},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===lo||e===so||e===io||e===oo||e===vo||e===po||"object"==typeof e&&null!==e&&(e.$$typeof===Eo||e.$$typeof===mo||e.$$typeof===ao||e.$$typeof===ro||e.$$typeof===co||e.$$typeof===_o||e.$$typeof===fo||e.$$typeof===go||e.$$typeof===So)},typeOf:Co},Do=F(function(e,n){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,l=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,r=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,d=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,v=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,S=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,f=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function C(e){if("object"==typeof e&&null!==e){var n=e.$$typeof;switch(n){case t:var p=e.type;switch(p){case d:case s:case o:case a:case i:case v:return p;default:var S=p&&p.$$typeof;switch(S){case u:case c:case E:case m:case r:return S;default:return n}}case l:return n}}}var N=s,y=u,D=r,T=t,h=c,A=o,I=E,O=m,b=l,L=a,R=i,w=v,W=!1;function P(e){return C(e)===s}n.AsyncMode=d,n.ConcurrentMode=N,n.ContextConsumer=y,n.ContextProvider=D,n.Element=T,n.ForwardRef=h,n.Fragment=A,n.Lazy=I,n.Memo=O,n.Portal=b,n.Profiler=L,n.StrictMode=R,n.Suspense=w,n.isAsyncMode=function(e){return W||(W=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(e)||C(e)===d},n.isConcurrentMode=P,n.isContextConsumer=function(e){return C(e)===u},n.isContextProvider=function(e){return C(e)===r},n.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},n.isForwardRef=function(e){return C(e)===c},n.isFragment=function(e){return C(e)===o},n.isLazy=function(e){return C(e)===E},n.isMemo=function(e){return C(e)===m},n.isPortal=function(e){return C(e)===l},n.isProfiler=function(e){return C(e)===a},n.isStrictMode=function(e){return C(e)===i},n.isSuspense=function(e){return C(e)===v},n.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===s||e===a||e===i||e===v||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===E||e.$$typeof===m||e.$$typeof===r||e.$$typeof===u||e.$$typeof===c||e.$$typeof===_||e.$$typeof===f||e.$$typeof===g||e.$$typeof===S)},n.typeOf=C}()}),To=F(function(e){e.exports="production"===process.env.NODE_ENV?yo:Do}),ho=Object.getOwnPropertySymbols,Ao=Object.prototype.hasOwnProperty,Io=Object.prototype.propertyIsEnumerable;function Oo(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var bo=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(e){l[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},l)).join("")}catch(e){return!1}}()?Object.assign:function(e,n){for(var t,l,o=Oo(e),i=1;i<arguments.length;i++){for(var a in t=Object(arguments[i]))Ao.call(t,a)&&(o[a]=t[a]);if(ho){l=ho(t);for(var r=0;r<l.length;r++)Io.call(t,l[r])&&(o[l[r]]=t[l[r]])}}return o},Lo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Ro=Function.call.bind(Object.prototype.hasOwnProperty),wo=function(){};if("production"!==process.env.NODE_ENV){var Wo=Lo,Po={},Mo=Ro;wo=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}}function xo(e,n,t,l,o){if("production"!==process.env.NODE_ENV)for(var i in e)if(Mo(e,i)){var a;try{if("function"!=typeof e[i]){var r=Error((l||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw r.name="Invariant Violation",r}a=e[i](n,i,l,t,null,Wo)}catch(e){a=e}if(!a||a instanceof Error||wo((l||"React class")+": type specification of "+t+" `"+i+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in Po)){Po[a.message]=!0;var u=o?o():"";wo("Failed "+t+" type: "+a.message+(null!=u?u:""))}}}xo.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(Po={})};var Bo=xo,Fo=function(){};function Uo(){return null}function ko(){}function Ho(){}"production"!==process.env.NODE_ENV&&(Fo=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}),Ho.resetWarningCache=ko;var jo=F(function(e){e.exports="production"!==process.env.NODE_ENV?function(e,n){var t="function"==typeof Symbol&&Symbol.iterator,l={array:r("array"),bigint:r("bigint"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),symbol:r("symbol"),any:a(Uo),arrayOf:function(e){return a(function(n,t,l,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+l+"` has invalid PropType notation inside arrayOf.");var r=n[t];if(!Array.isArray(r))return new i("Invalid "+o+" `"+a+"` of type `"+s(r)+"` supplied to `"+l+"`, expected an array.");for(var u=0;u<r.length;u++){var d=e(r,u,l,o,a+"["+u+"]",Lo);if(d instanceof Error)return d}return null})},element:a(function(n,t,l,o,a){var r=n[t];return e(r)?null:new i("Invalid "+o+" `"+a+"` of type `"+s(r)+"` supplied to `"+l+"`, expected a single ReactElement.")}),elementType:a(function(e,n,t,l,o){var a=e[n];return To.isValidElementType(a)?null:new i("Invalid "+l+" `"+o+"` of type `"+s(a)+"` supplied to `"+t+"`, expected a single ReactElement type.")}),instanceOf:function(e){return a(function(n,t,l,o,a){var r;return n[t]instanceof e?null:new i("Invalid "+o+" `"+a+"` of type `"+((r=n[t]).constructor&&r.constructor.name?r.constructor.name:"<<anonymous>>")+"` supplied to `"+l+"`, expected instance of `"+(e.name||"<<anonymous>>")+"`.")})},node:a(function(e,n,t,l,o){return d(e[n])?null:new i("Invalid "+l+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}),objectOf:function(e){return a(function(n,t,l,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+l+"` has invalid PropType notation inside objectOf.");var r=n[t],u=s(r);if("object"!==u)return new i("Invalid "+o+" `"+a+"` of type `"+u+"` supplied to `"+l+"`, expected an object.");for(var d in r)if(Ro(r,d)){var c=e(r,d,l,o,a+"."+d,Lo);if(c instanceof Error)return c}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Fo(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),Uo;function n(n,t,l,a,r){for(var u=n[t],d=0;d<e.length;d++)if(o(u,e[d]))return null;var s=JSON.stringify(e,function(e,n){return"symbol"===c(n)?String(n):n});return new i("Invalid "+a+" `"+r+"` of value `"+String(u)+"` supplied to `"+l+"`, expected one of "+s+".")}return a(n)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Fo("Invalid argument supplied to oneOfType, expected an instance of array."),Uo;for(var n=0;n<e.length;n++){var t=e[n];if("function"!=typeof t)return Fo("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+v(t)+" at index "+n+"."),Uo}return a(function(n,t,l,o,a){for(var r=[],u=0;u<e.length;u++){var d=(0,e[u])(n,t,l,o,a,Lo);if(null==d)return null;d.data&&Ro(d.data,"expectedType")&&r.push(d.data.expectedType)}return new i("Invalid "+o+" `"+a+"` supplied to `"+l+"`"+(r.length>0?", expected one of type ["+r.join(", ")+"]":"")+".")})},shape:function(e){return a(function(n,t,l,o,a){var r=n[t],d=s(r);if("object"!==d)return new i("Invalid "+o+" `"+a+"` of type `"+d+"` supplied to `"+l+"`, expected `object`.");for(var v in e){var p=e[v];if("function"!=typeof p)return u(l,o,a,v,c(p));var m=p(r,v,l,o,a+"."+v,Lo);if(m)return m}return null})},exact:function(e){return a(function(n,t,l,o,a){var r=n[t],d=s(r);if("object"!==d)return new i("Invalid "+o+" `"+a+"` of type `"+d+"` supplied to `"+l+"`, expected `object`.");var v=bo({},n[t],e);for(var p in v){var m=e[p];if(Ro(e,p)&&"function"!=typeof m)return u(l,o,a,p,c(m));if(!m)return new i("Invalid "+o+" `"+a+"` key `"+p+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(n[t],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var E=m(r,p,l,o,a+"."+p,Lo);if(E)return E}return null})}};function o(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}function i(e,n){this.message=e,this.data=n&&"object"==typeof n?n:{},this.stack=""}function a(e){function n(n,t,l,o,a,r,u){if(o=o||"<<anonymous>>",r=r||l,u!==Lo){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}return null==t[l]?n?new i(null===t[l]?"The "+a+" `"+r+"` is marked as required in `"+o+"`, but its value is `null`.":"The "+a+" `"+r+"` is marked as required in `"+o+"`, but its value is `undefined`."):null:e(t,l,o,a,r)}process;var t=n.bind(null,!1);return t.isRequired=n.bind(null,!0),t}function r(e){return a(function(n,t,l,o,a,r){var u=n[t];return s(u)!==e?new i("Invalid "+o+" `"+a+"` of type `"+c(u)+"` supplied to `"+l+"`, expected `"+e+"`.",{expectedType:e}):null})}function u(e,n,t,l,o){return new i((e||"React class")+": "+n+" type `"+t+"."+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function d(n){switch(typeof n){case"number":case"string":case"undefined":return!0;case"boolean":return!n;case"object":if(Array.isArray(n))return n.every(d);if(null===n||e(n))return!0;var l=function(e){var n=e&&(t&&e[t]||e["@@iterator"]);if("function"==typeof n)return n}(n);if(!l)return!1;var o,i=l.call(n);if(l!==n.entries){for(;!(o=i.next()).done;)if(!d(o.value))return!1}else for(;!(o=i.next()).done;){var a=o.value;if(a&&!d(a[1]))return!1}return!0;default:return!1}}function s(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,n){return"symbol"===e||!!n&&("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}(n,e)?"symbol":n}function c(e){if(null==e)return""+e;var n=s(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function v(e){var n=c(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}return i.prototype=Error.prototype,l.checkPropTypes=Bo,l.resetWarningCache=Bo.resetWarningCache,l.PropTypes=l,l}(To.isElement):function(){function e(e,n,t,l,o,i){if(i!==Lo){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function n(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:Ho,resetWarningCache:ko};return t.PropTypes=t,t}()});const Vo=e=>{var n;let{config:r,formData:u}=e;const{t:d}=o.useTranslation();let s={};const c=i.useHistory(),p=Digit.ULBService.getCurrentTenantId(),m=Digit.UserService.getUser(),[E,S]=t.useState((null==u?void 0:u.mobileNumber)||""),[_,f]=t.useState((null==u?void 0:u.consumerNumber)||""),[g,C]=t.useState((null==u?void 0:u.oldconsumerNumber)||""),[N,y]=t.useState((null==u?void 0:u.doorNumber)||""),[D,T]=t.useState((null==u?void 0:u.propertyId)||""),[h,A]=t.useState((null==u?void 0:u.consumerName)||""),[I,O]=t.useState((null==u?void 0:u.Servicecateogry)||""),[b,L]=t.useState((null==u?void 0:u.city)||""),[R,w]=t.useState(null),[W,P]=t.useState((null==u?void 0:u.locality)||""),[M,x]=t.useState((null==u?void 0:u.searchType)||{code:"CONSUMER_NUMBER",i18nKey:"WS_CONSUMER_NUMBER_SEARCH"}),B=null===(n=Digit.Hooks.ws.usewsTenants())||void 0===n?void 0:n.sort((e,n)=>{var t,l;return null==e||null===(t=e.i18nKey)||void 0===t||null===(l=t.localeCompare)||void 0===l?void 0:l.call(t,null==n?void 0:n.i18nKey)}),[F,U]=t.useState(null);let k={};const{isLoading:H}=Digit.Hooks.mcollect.useMCollectMDMS(p,"BillingService","BusinessService"),{data:j}=Digit.Hooks.pt.useMDMS(Digit.ULBService.getStateId(),"DIGIT-UI","HelpText",{select:e=>{var n,t,l;return null==e||null===(n=e["DIGIT-UI"])||void 0===n||null===(t=n.HelpText)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.PT}});return H?l.createElement(a.Loader,null):l.createElement("div",{style:{marginTop:"16px"}},l.createElement(a.FormStep,{config:r,label:r.texts.submitButtonLabel,heading:r.texts.header,text:r.texts.text,cardStyle:{margin:"auto",maxWidth:"960px"},headingStyle:{fontSize:"32px",marginBottom:"16px"},onSelect:function(e){try{const e=function(){if("CONSUMER_NUMBER"===M.code)b.code?E||_||g||D?c.push("/digit-ui/citizen/ws/search-results?mobileNumber="+E+"&consumerNumber="+_+"&oldconsumerNumber="+g+"&propertyId="+D+"&tenantId="+b.code+"&locality="+void 0):w({key:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"}):w({key:!0,label:"WS_PLEASE_PROVIDE_CITY"});else{const e=function(){if(b.code){const e=function(){if(null!=m||W){const e=function(){if(N||h)return"undefined"!==W&&(k.locality=null==W?void 0:W.code),N&&(k.doorNo=N),h&&(k.ownerName=h),k=v({},k,{searchType:"CONNECTION"}),Promise.resolve(Digit.WSService.search({tenantId:null==b?void 0:b.code,filters:v({},k),businessService:"WS"})).then(function(e){return Promise.resolve(Digit.WSService.search({tenantId:null==b?void 0:b.code,filters:v({},k),businessService:"SW"})).then(function(n){null!=j&&j.maxResultValidation&&(null==e?void 0:e.TotalCount)+(null==n?void 0:n.TotalCount)>(null==j?void 0:j.maxPropertyResult)?w({key:!0,label:"Refine your search"}):c.push("/digit-ui/citizen/ws/search-results?doorNumber="+N+"&consumerName="+h+"&tenantId="+b.code+"&locality="+W.code)})});w({key:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"})}();if(e&&e.then)return e.then(function(){})}else w({key:!0,label:"WS_PLEASE_PROVIDE_LOCALITY"})}();if(e&&e.then)return e.then(function(){})}else w({key:!0,label:"WS_PLEASE_PROVIDE_CITY"})}();if(e&&e.then)return e.then(function(){})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},componentInFront:l.createElement("div",{className:"employee-card-input employee-card-input--front"},"+91"),isDisabled:!1,forcedError:d(F),t:d},l.createElement(a.RadioOrSelect,v({className:"form-field",isMandatory:!0,t:d,optionKey:"code",name:"SearchType",options:[{code:"CONSUMER_NUMBER",i18nKey:"WS_CONSUMER_NUMBER_SEARCH"},{code:"CONNECTION_DETAILS",i18nKey:"WS_CONNECTION_DETAILS_SEARCH"}],value:M,selectedOption:M,onSelect:function(e){x(e)}},s={isRequired:!0,title:d("WS_SEARCH_TYPE_MANDATORY")})),l.createElement(a.CardLabel,null,d("WS_PROP_DETAIL_CITY")+"*"),l.createElement(a.RadioOrSelect,v({className:"form-field",isMandatory:!0,t:d,optionKey:"code",name:"City",options:B,value:b,selectedOption:b,onSelect:function(e){L(e),P("")}},s={isRequired:!0,title:d("UC_CITY_MANDATORY")})),b&&M&&"CONNECTION_DETAILS"==(null==M?void 0:M.code)&&l.createElement(a.CardLabel,null,d("WS_PROP_DETAIL_LOCALITY_LABEL")+"*"),b&&M&&"CONNECTION_DETAILS"==(null==M?void 0:M.code)&&l.createElement(a.Localities,{selectLocality:function(e){P(e)},tenantId:null==b?void 0:b.code,boundaryType:"revenue",keepNull:!1,optionCardStyles:{height:"600px",overflow:"auto",zIndex:"10"},selected:W,disableLoader:!1}),M&&"CONSUMER_NUMBER"==(null==M?void 0:M.code)&&l.createElement("div",{style:{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"}},l.createElement(a.CardText,null,d("WS_SEARCH_TEXT")),l.createElement(a.CardLabel,null,""+d("WS_CONSUMER_NUMBER_LABEL")),l.createElement("div",{className:"field-container"},l.createElement("span",{className:"employee-card-input employee-card-input--front",style:{marginTop:"-1px"}},"+91"),l.createElement(a.TextInput,v({type:"mobileNumber",style:{background:"#FAFAFA",maxWidth:"500px"},t:d,isMandatory:!1,optionKey:"i18nKey",name:"mobileNumber",value:E,onChange:function(e){U(null),e.target.value.match("^\\d{10}$")||U("CORE_COMMON_PHONENO_INVALIDMSG"),S(e.target.value)}},s={isRequired:!1,pattern:"[6-9]{1}[0-9]{9}",type:"tel",title:d("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID")}))),l.createElement(a.CardLabel,{style:{textAlign:"center",color:"#505A5F"}},""+d("(or)")),l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(a.CardLabel,null,""+d("WS_MYCONNECTIONS_CONSUMER_NO")),l.createElement(a.InfoBannerIcon,{fill:"#0b0c0c"}),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"70%",marginLeft:"50%",fontSize:"medium"}},d("WS_CONSUMER_NO_DESCRIPTION")+" "+d("WS_CONSUMER_NO_FORMAT")))),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"consumerNumber",value:_,onChange:function(e){f(e.target.value)}},s={isRequired:!1,pattern:"[A-Za-z]{2}/[0-9]{3,4}/[0-9]{4}-[0-9]{2}/[0-9]{6}",type:"text",title:d("ERR_INVALID_CONSUMER_NO")})),l.createElement(a.CardLabel,{style:{textAlign:"center",color:"#505A5F"}},""+d("(or)")),l.createElement("div",{className:"tooltip"},l.createElement("div",{style:{display:"flex",gap:"0 4px"}},l.createElement(a.CardLabel,null,""+d("WS_SEARCH_CONNNECTION_OLD_CONSUMER_LABEL")),l.createElement(a.InfoBannerIcon,{fill:"#0b0c0c"}),l.createElement("span",{className:"tooltiptext",style:{position:"absolute",width:"55%",marginLeft:"50%",fontSize:"medium"}},d("WS_CONSUMER_NO_DESCRIPTION")+" "+d("WS_CONSUMER_NO_FORMAT")))),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"oldconsumerNumber",value:g,onChange:function(e){C(e.target.value)}},s={isRequired:!1,pattern:"[A-Za-z]{2}/[0-9]{3}/[0-9]{4}-[0-9]{2}/[0-9]{6}",type:"text",title:d("ERR_INVALID_CONSUMER_NO")})),l.createElement(a.CardLabel,{style:{textAlign:"center",color:"#505A5F"}},""+d("(or)")),l.createElement(a.CardLabel,null,""+d("WS_PROPERTY_ID_LABEL")),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"propertyId",value:D,onChange:function(e){T(e.target.value)}},s={isRequired:!1,pattern:"[A-Za-z]{2}-[A-Za-z]{2}-[0-9]{4}-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}|[A-Za-z]{2}-[A-Za-z]{2}-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}",type:"text",title:d("ERR_INVALID_PROPERTY_ID")}))),M&&"CONNECTION_DETAILS"==(null==M?void 0:M.code)&&l.createElement("div",{style:{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA",marginBottom:"20px"}},l.createElement(a.CardText,null,d("WS_SEARCH_TEXT")),l.createElement(a.CardLabel,null,""+d("WS_DOOR_NO_LABEL")),l.createElement(a.TextInput,v({t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"doorNumber",value:N,onChange:function(e){y(e.target.value)}},s={isRequired:!1,pattern:"^([1-9][0-9]*)$",type:"text",title:d("ERR_INVALID_DOOR_NO")})),l.createElement(a.CardLabel,null,""+d("WS_CONSUMER_NAME_LABEL")),l.createElement(a.TextInput,{t:d,type:"any",isMandatory:!1,style:{background:"#FAFAFA"},name:"consumerName",value:h,onChange:function(e){A(e.target.value)}}))),R&&l.createElement(a.Toast,{isDleteBtn:!0,error:R.key,label:d(R.label),onClose:()=>{w(null)}}))};Vo.propTypes={loginParams:jo.any},Vo.defaultProps={loginParams:null};const zo=[{texts:{header:"CS_SEARCH_RESULTS",actionButtonLabel:"WS_VIEW_DETAILS_AND_PAY"},labels:[{label:"WS_COMMON_TABLE_COL_AMT_DUE_LABEL",key:"AmountDue",noteStyle:{fontSize:"24px",fontWeight:"bold"},notePrefix:"₹ "},{label:"WS_MYCONNECTIONS_CONSUMER_NO",key:"ConsumerNumber"},{label:"WS_CONSUMER_NAME_LABEL",key:"ConsumerName"},{label:"WS_MYCONNECTION_ADDRESS",key:"Address"},{label:"WS_VIEW_BILL_DUE_DATE_LABEL",key:"DueDate"}]}];var Yo=function(e,n){return function(){for(var t=new Array(arguments.length),l=0;l<t.length;l++)t[l]=arguments[l];return e.apply(n,t)}},Go=Object.prototype.toString;function qo(e){return"[object Array]"===Go.call(e)}function Ko(e){return void 0===e}function Xo(e){return null!==e&&"object"==typeof e}function Zo(e){if("[object Object]"!==Go.call(e))return!1;var n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}function $o(e){return"[object Function]"===Go.call(e)}function Jo(e,n){if(null!=e)if("object"!=typeof e&&(e=[e]),qo(e))for(var t=0,l=e.length;t<l;t++)n.call(null,e[t],t,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.call(null,e[o],o,e)}var Qo={isArray:qo,isArrayBuffer:function(e){return"[object ArrayBuffer]"===Go.call(e)},isBuffer:function(e){return null!==e&&!Ko(e)&&null!==e.constructor&&!Ko(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Xo,isPlainObject:Zo,isUndefined:Ko,isDate:function(e){return"[object Date]"===Go.call(e)},isFile:function(e){return"[object File]"===Go.call(e)},isBlob:function(e){return"[object Blob]"===Go.call(e)},isFunction:$o,isStream:function(e){return Xo(e)&&$o(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:Jo,merge:function e(){var n={};function t(t,l){n[l]=Zo(n[l])&&Zo(t)?e(n[l],t):Zo(t)?e({},t):qo(t)?t.slice():t}for(var l=0,o=arguments.length;l<o;l++)Jo(arguments[l],t);return n},extend:function(e,n,t){return Jo(n,function(n,l){e[l]=t&&"function"==typeof n?Yo(n,t):n}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function ei(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ni=function(e,n,t){if(!n)return e;var l;if(t)l=t(n);else if(Qo.isURLSearchParams(n))l=n.toString();else{var o=[];Qo.forEach(n,function(e,n){null!=e&&(Qo.isArray(e)?n+="[]":e=[e],Qo.forEach(e,function(e){Qo.isDate(e)?e=e.toISOString():Qo.isObject(e)&&(e=JSON.stringify(e)),o.push(ei(n)+"="+ei(e))}))}),l=o.join("&")}if(l){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+l}return e};function ti(){this.handlers=[]}ti.prototype.use=function(e,n){return this.handlers.push({fulfilled:e,rejected:n}),this.handlers.length-1},ti.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ti.prototype.forEach=function(e){Qo.forEach(this.handlers,function(n){null!==n&&e(n)})};var li=ti,oi=function(e,n,t){return Qo.forEach(t,function(t){e=t(e,n)}),e},ii=function(e){return!(!e||!e.__CANCEL__)},ai=function(e,n){Qo.forEach(e,function(t,l){l!==n&&l.toUpperCase()===n.toUpperCase()&&(e[n]=t,delete e[l])})},ri=function(e,n,t,l,o){return function(e,n,t,l,o){return e.config=n,t&&(e.code=t),e.request=l,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),n,t,l,o)},ui=Qo.isStandardBrowserEnv()?{write:function(e,n,t,l,o,i){var a=[];a.push(e+"="+encodeURIComponent(n)),Qo.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),Qo.isString(l)&&a.push("path="+l),Qo.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},di=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],si=Qo.isStandardBrowserEnv()?function(){var e,n=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");function l(e){var l=e;return n&&(t.setAttribute("href",l),l=t.href),t.setAttribute("href",l),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return e=l(window.location.href),function(n){var t=Qo.isString(n)?l(n):n;return t.protocol===e.protocol&&t.host===e.host}}():function(){return!0},ci={"Content-Type":"application/x-www-form-urlencoded"};function vi(e,n){!Qo.isUndefined(e)&&Qo.isUndefined(e["Content-Type"])&&(e["Content-Type"]=n)}var pi,mi={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(pi=function(e){return new Promise(function(n,t){var l=e.data,o=e.headers;Qo.isFormData(l)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+r)}var u,d,s=(d=e.url,(u=e.baseURL)&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(d)?function(e,n){return n?e.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):e}(u,d):d);if(i.open(e.method.toUpperCase(),ni(s,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var l,o,a,r,u,d="getAllResponseHeaders"in i?(l=i.getAllResponseHeaders(),u={},l?(Qo.forEach(l.split("\n"),function(e){if(r=e.indexOf(":"),o=Qo.trim(e.substr(0,r)).toLowerCase(),a=Qo.trim(e.substr(r+1)),o){if(u[o]&&di.indexOf(o)>=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([a]):u[o]?u[o]+", "+a:a}}),u):u):null;!function(e,n,t){var l=t.config.validateStatus;t.status&&l&&!l(t.status)?n(ri("Request failed with status code "+t.status,t.config,null,t.request,t)):e(t)}(n,t,{data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:d,config:e,request:i}),i=null}},i.onabort=function(){i&&(t(ri("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){t(ri("Network Error",e,null,i)),i=null},i.ontimeout=function(){var n="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(n=e.timeoutErrorMessage),t(ri(n,e,"ECONNABORTED",i)),i=null},Qo.isStandardBrowserEnv()){var c=(e.withCredentials||si(s))&&e.xsrfCookieName?ui.read(e.xsrfCookieName):void 0;c&&(o[e.xsrfHeaderName]=c)}if("setRequestHeader"in i&&Qo.forEach(o,function(e,n){void 0===l&&"content-type"===n.toLowerCase()?delete o[n]:i.setRequestHeader(n,e)}),Qo.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(n){if("json"!==e.responseType)throw n}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){i&&(i.abort(),t(e),i=null)}),l||(l=null),i.send(l)})}),pi),transformRequest:[function(e,n){return ai(n,"Accept"),ai(n,"Content-Type"),Qo.isFormData(e)||Qo.isArrayBuffer(e)||Qo.isBuffer(e)||Qo.isStream(e)||Qo.isFile(e)||Qo.isBlob(e)?e:Qo.isArrayBufferView(e)?e.buffer:Qo.isURLSearchParams(e)?(vi(n,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Qo.isObject(e)?(vi(n,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Qo.forEach(["delete","get","head"],function(e){mi.headers[e]={}}),Qo.forEach(["post","put","patch"],function(e){mi.headers[e]=Qo.merge(ci)});var Ei=mi;function Si(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var _i=function(e){return Si(e),e.headers=e.headers||{},e.data=oi(e.data,e.headers,e.transformRequest),e.headers=Qo.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Qo.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]}),(e.adapter||Ei.adapter)(e).then(function(n){return Si(e),n.data=oi(n.data,n.headers,e.transformResponse),n},function(n){return ii(n)||(Si(e),n&&n.response&&(n.response.data=oi(n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})},fi=function(e,n){n=n||{};var t={},l=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function r(e,n){return Qo.isPlainObject(e)&&Qo.isPlainObject(n)?Qo.merge(e,n):Qo.isPlainObject(n)?Qo.merge({},n):Qo.isArray(n)?n.slice():n}function u(l){Qo.isUndefined(n[l])?Qo.isUndefined(e[l])||(t[l]=r(void 0,e[l])):t[l]=r(e[l],n[l])}Qo.forEach(l,function(e){Qo.isUndefined(n[e])||(t[e]=r(void 0,n[e]))}),Qo.forEach(o,u),Qo.forEach(i,function(l){Qo.isUndefined(n[l])?Qo.isUndefined(e[l])||(t[l]=r(void 0,e[l])):t[l]=r(void 0,n[l])}),Qo.forEach(a,function(l){l in n?t[l]=r(e[l],n[l]):l in e&&(t[l]=r(void 0,e[l]))});var d=l.concat(o).concat(i).concat(a),s=Object.keys(e).concat(Object.keys(n)).filter(function(e){return-1===d.indexOf(e)});return Qo.forEach(s,u),t};function gi(e){this.defaults=e,this.interceptors={request:new li,response:new li}}gi.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=fi(this.defaults,e)).method=e.method?e.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var n=[_i,void 0],t=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){n.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){n.push(e.fulfilled,e.rejected)});n.length;)t=t.then(n.shift(),n.shift());return t},gi.prototype.getUri=function(e){return e=fi(this.defaults,e),ni(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Qo.forEach(["delete","get","head","options"],function(e){gi.prototype[e]=function(n,t){return this.request(fi(t||{},{method:e,url:n,data:(t||{}).data}))}}),Qo.forEach(["post","put","patch"],function(e){gi.prototype[e]=function(n,t,l){return this.request(fi(l||{},{method:e,url:n,data:t}))}});var Ci=gi;function Ni(e){this.message=e}Ni.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ni.prototype.__CANCEL__=!0;var yi=Ni;function Di(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(e){n=e});var t=this;e(function(e){t.reason||(t.reason=new yi(e),n(t.reason))})}Di.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Di.source=function(){var e;return{token:new Di(function(n){e=n}),cancel:e}};var Ti=Di;function hi(e){var n=new Ci(e),t=Yo(Ci.prototype.request,n);return Qo.extend(t,Ci.prototype,n),Qo.extend(t,n),t}var Ai=hi(Ei);Ai.Axios=Ci,Ai.create=function(e){return hi(fi(Ai.defaults,e))},Ai.Cancel=yi,Ai.CancelToken=Ti,Ai.isCancel=ii,Ai.all=function(e){return Promise.all(e)},Ai.spread=function(e){return function(n){return e.apply(null,n)}},Ai.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},Ai.default=Ai;const Ii=e=>{let{template:n,header:t,actionButtonLabel:r}=e;const{t:u}=o.useTranslation(),d=i.useHistory(),{mobileNumber:s,consumerNumber:c,oldconsumerNumber:p,tenantId:E,propertyId:S,locality:_,doorNumber:f,consumerName:g,PToffset:C}=Digit.Hooks.useQueryParams();let N,y,D={},T=C;isNaN(parseInt(T))?N=5:(y=T,N=parseInt(T)+5);let h=isNaN(parseInt(T))?{limit:"5",sortOrder:"ASC",sortBy:"createdTime",offset:"0"}:{limit:"5",sortOrder:"ASC",sortBy:"createdTime",offset:y};s&&(D.mobileNumber=s),c&&(D.connectionNumber=c),p&&(D.oldConnectionNumber=p),S&&(D.propertyId=S),"undefined"!==_&&(D.locality=_),f&&(D.doorNo=f),g&&(D.ownerName=g),(_||searchQuery&&searchQuery.locality)&&(D.limit=h.limit,D.sortOrder=h.sortOrder,D.sortBy=h.sortBy,D.offset=h.offset),D=v({},D,{searchType:"CONNECTION"});const{isLoading:A,data:I}=Digit.Hooks.ws.useWaterSearch({tenantId:E,filters:v({},D),BusinessService:"WS",t:u},{privacy:Digit.Utils.getPrivacyObject()}),{isLoading:O,data:b}=Digit.Hooks.ws.useSewarageSearch({tenantId:E,filters:v({},D),BusinessService:"SW",t:u},{privacy:Digit.Utils.getPrivacyObject()});if(A||O)return l.createElement(a.Loader,null);const L=I&&b?I.concat(b):I||b||[];return l.createElement("div",{style:{marginTop:"16px"}},l.createElement("div",null,t&&l.createElement(a.Header,{style:{marginLeft:"8px"}},u(t)," (",null==L?void 0:L.length,")"),l.createElement(a.ResponseComposer,{data:L,template:n,actionButtonLabel:r,onSubmit:e=>{d.push("/digit-ui/citizen/payment/my-bills/"+(null==e?void 0:e.ConsumerNumber.split("/")[0])+"/"+m(null==e?void 0:e.ConsumerNumber,"/","+")+"?workflow=WNS&tenantId="+E+"&ConsumerName="+(null==e?void 0:e.ConsumerName))}}),!(null!=L&&L.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("WS_NO_APP_FOUND_MSG")),0!==(null==L?void 0:L.length)&&(5==(null==L?void 0:L.length)||50==(null==L?void 0:L.length))&&(_||searchQuery&&searchQuery.locality)&&l.createElement("div",null,l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("WS_LOAD_MORE_MSG")," ",l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/citizen/ws/search-results?doorNumber="+f+"&consumerName="+g+"&tenantId="+(null==E?void 0:E.split(".")[0])+"&locality="+_.code+"&PToffset="+N},u("PT_COMMON_CLICK_HERE"))))),l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},u("WS_WANT_TO_ADD_NEW_CONNECTION")," ",l.createElement("span",{className:"link",style:{display:"block"}},l.createElement(i.Link,{to:"/digit-ui/citizen/ws/create-application/search-property"},u("WS_CLICK_HERE_TO_APPLY"))))))};Ii.propTypes={template:jo.any,header:jo.string,actionButtonLabel:jo.string},Ii.defaultProps={template:[],header:null,actionButtonLabel:null};const Oi=e=>{var n,t,i;let{data:r,OpenImage:u}=e;const{t:d}=o.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement(a.TelePhone,{mobile:r.mobileNumber}),r.source&&l.createElement("p",null,d("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(Reason,{otherComment:null==r?void 0:r.otherComment,headComment:null==r?void 0:r.comment}),null!=r&&r.wfComment?l.createElement("div",null,null==r||null===(n=r.wfComment)||void 0===n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(t=r.thumbnailsToShow)||void 0===t||null===(i=t.thumbs)||void 0===i?void 0:i.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,d("CS_COMMON_ATTACHMENTS")),l.createElement(a.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,n)=>{u(e,n,null==r?void 0:r.thumbnailsToShow)}})):null)},bi=e=>{var n,r,u,d,s,c;const{t:v}=o.useTranslation(),p=null===(n=e.application)||void 0===n?void 0:n.applicationNo.split("_")[0],{isLoading:m,data:E}=Digit.Hooks.useWorkflowDetails({tenantId:null===(r=e.application)||void 0===r?void 0:r.tenantId,id:e.id,moduleCode:p}),[S,_]=t.useState(!1);function f(e,n,t){var l;window.open(null==t||null===(l=t.fullImage)||void 0===l?void 0:l[0],"_blank")}const g=n=>{if("OPEN"===n.state){var t,o,r;const n={date:Digit.DateUtils.ConvertTimestampToDate(null===(t=e.application)||void 0===t||null===(o=t.auditDetails)||void 0===o?void 0:o.createdTime),source:(null===(r=e.application)||void 0===r?void 0:r.channel)||""};return l.createElement(Oi,{data:n})}var u,d;if("ACTIVE"===n.status)return l.createElement("div",null,l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+(null==e||null===(u=e.application)||void 0===u?void 0:u.propertyId)+"&tenantId="+(null==e||null===(d=e.application)||void 0===d?void 0:d.tenantId)},l.createElement(a.ActionLinks,null,v("PT_VIEW_PROPERTY_DETAILS"))));{var s,c,p,m,E,S;const t={source:(null===(s=e.application)||void 0===s?void 0:s.channel)||"",date:null==n||null===(c=n.auditDetails)||void 0===c?void 0:c.lastModified,name:null==n||null===(p=n.assignes)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.name,mobileNumber:null==n||null===(E=n.assignes)||void 0===E||null===(S=E[0])||void 0===S?void 0:S.mobileNumber,comment:v(null==n?void 0:n.comment),wfComment:n.wfComment,thumbnailsToShow:null==n?void 0:n.thumbnailsToShow};return l.createElement(Oi,{data:t,OpenImage:f})}};return m?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,!m&&l.createElement(t.Fragment,null,(null==E||null===(u=E.timeline)||void 0===u?void 0:u.length)>0&&l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},v("CS_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=E&&E.timeline&&1===(null==E||null===(d=E.timeline)||void 0===d?void 0:d.length)?l.createElement(a.CheckPoint,{isCompleted:!0,label:v((null==E||null===(s=E.timeline[0])||void 0===s?void 0:s.state)&&"CS_"+E.timeline[0].state||"NA"),customChild:g(null==E?void 0:E.timeline[0])}):l.createElement(a.ConnectingCheckPoints,null,(null==E?void 0:E.timeline)&&(null==E?void 0:E.timeline.slice(0,S?E.timeline.length:2).map((e,n,t)=>l.createElement(l.Fragment,{key:n},l.createElement(a.CheckPoint,{keyValue:n,isCompleted:0===n,label:e.state?v("CS_"+e.state):"NA",customChild:g(e)}))))),(null==E||null===(c=E.timeline)||void 0===c?void 0:c.length)>2&&l.createElement(a.LinkButton,{label:v(S?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{_(e=>!e)}})),E&&(n=>{var t;let o=n[0];const r=n.map(e=>e.action);if(r.includes("PAY")||r.includes("EDIT")){let e=r.indexOf("EDIT")||r.indexOf("PAY");e=-1!=e?e:r.indexOf("PAY"),o=n[e]}switch(null===(t=o)||void 0===t?void 0:t.action){case"PAY":if(!1!==(null==e?void 0:e.paymentbuttonenabled))return l.createElement("div",{style:{marginTop:"1em",bottom:"0px",width:"100%",marginBottom:"1.2em"}},l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/payment/collect/"+p+"/"+e.id+"?consumerCode="+e.id+"&&workflow=WNS",state:{tenantId:e.application.tenantId}}},l.createElement(a.SubmitBar,{label:v("CS_APPLICATION_DETAILS_MAKE_PAYMENT")})));break;case"EDIT":return l.createElement("div",{style:{marginTop:"1em",bottom:"0px",width:"100%",marginBottom:"1.2em"}},"PT.MUTATION"!=p&&l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/pt/property/edit-application/action=edit-"+p+"/"+e.id,state:{tenantId:e.application.tenantId}}},l.createElement(a.SubmitBar,{label:v("CS_APPLICATION_DETAILS_EDIT")})));case"SUBMIT_FEEDBACK":return l.createElement("div",{style:{marginTop:"24px"}},l.createElement(i.Link,{to:"/digit-ui/citizen/fsm/rate/"+e.id},l.createElement(a.SubmitBar,{label:v("CS_APPLICATION_DETAILS_RATE")})))}})(null==E?void 0:E.nextActions))};function Li(e){var n;let{value:t={},Code:i,index:r,showFileName:u=!1}=e;const{t:d}=o.useTranslation(),{isLoading:s,data:c}=Digit.Hooks.ws.useWSDocumentSearch({value:t},{value:t},i,r),v=[];return null!=t&&t.documents?null==t||null===(n=t.documents)||void 0===n||n.documents.filter(e=>(null==e?void 0:e.documentType)===i).map(e=>{v.push(e)}):t.filter(e=>(null==e?void 0:e.documentType)===i).map(e=>{v.push(e)}),s?l.createElement(a.Loader,null):l.createElement("div",{style:{marginTop:"19px"}},l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},null==v?void 0:v.map((e,n)=>{let t=function(e,n,t){void 0===e&&(e={}),void 0===n&&(n="");let l=e[n]||"",o=(null==l?void 0:l.split(","))||[],i="";return o.length>0&&o.map(e=>{e.includes("large")||e.includes("medium")||e.includes("small")||(i=e)}),i}(c.pdfFiles,null==e?void 0:e.fileStoreId);return l.createElement("a",{target:"_",href:t,style:{minWidth:"160px"},key:n},l.createElement(a.PDFSvg,null),u?l.createElement("p",{style:{marginTop:"8px"}},d(null==i?void 0:i.split(".").slice(0,3).join("_"))):null)}))))}const Ri=e=>{var n;const t=null==e?void 0:e.doorNo,l=null==e?void 0:e.street,o=null==e?void 0:e.landmark,i=null==e||null===(n=e.locality)||void 0===n?void 0:n.name,a=null==e?void 0:e.pincode;return(t?t+", ":"")+(l?l+", ":"")+(o?o+", ":"")+(i?i+", ":"")+((null==e?void 0:e.city)||"")+(a?", "+a:"")},wi=(e,n)=>{var t,l,o;const i=null===(l=((null==e||null===(t=e.owners)||void 0===t?void 0:t.filter(e=>1==e.active))||[]).sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===l||null===(o=l.map(e=>e.name))||void 0===o?void 0:o.join(",");return{title:n("WS_COMMON_PROPERTY_DETAILS"),values:[{title:n("WS_PROPERTY_ID_LABEL"),value:n(""+(null==e?void 0:e.propertyId))||n("CS_NA")},{title:n("WS_OWN_DETAIL_NAME"),value:i||n("CS_NA")},{title:n("WS_PROPERTY_ADDRESS_LABEL"),value:Ri(null==e?void 0:e.address)||n("CS_NA")}]}},Wi=(e,n)=>({title:n("WS_COMMON_CONNECTION_DETAILS"),values:[{title:n("WS_DISCONNECTION_TYPE"),value:!0===(null==e?void 0:e.isDisconnectionTemporary)?n("WS_DISCONNECTIONTYPE_TEMPORARY"):n("WS_DISCONNECTIONTYPE_PERMANENT")||n("CS_NA")},{title:n("WS_DISCONNECTION_PROPOSED_DATE"),value:null!=e&&e.dateEffectiveFrom?Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.dateEffectiveFrom):n("CS_NA")},{title:n("WS_DISCONNECTION_REASON"),value:(null==e?void 0:e.disconnectionReason)||n("CS_NA")}]}),Pi=(e,n)=>{var t,l,o,i,a,r,u,d,s,c,v;return{title:n("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER"),values:(null==e||null===(t=e.connectionHolders)||void 0===t?void 0:t.length)>0?[{title:n("WS_OWN_DETAIL_NAME"),value:(null==e||null===(l=e.connectionHolders)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.name)||n("CS_NA")},{title:n("CORE_COMMON_MOBILE_NUMBER"),value:(null==e||null===(i=e.connectionHolders)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.mobileNumber)||n("CS_NA")},{title:n("WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME"),value:(null==e||null===(r=e.connectionHolders)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fatherOrHusbandName)||n("CS_NA")},{title:n("WS_CORRESPONDANCE_ADDRESS_LABEL"),value:(null==e||null===(d=e.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.correspondenceAddress)||n("CS_NA")},{title:n("CORE_COMMON_EMAIL_ID"),value:(null==e||null===(c=e.connectionHolders)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.emailId)||n("CS_NA")}]:[{title:n("WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS"),value:n("SCORE_YES")||n("CS_NA")}]}},Mi=(e,n)=>{const t=null==e?void 0:e.documents;return{title:n("WS_COMMON_DOCUMENTS_DETAILS"),isAttachments:!0,values:null==t?void 0:t.map(e=>n(null==e?void 0:e.documentType))}},xi=function(e,n,t,l){try{var o,i;function a(){return Promise.resolve(function(e,n,t){try{return Promise.resolve(E(t,n)).then(function(t){var l,o;let i=[];return null!=e&&e.applicationNo&&i.push({title:n("PDF_STATIC_LABEL_APPLICATION_NUMBER_LABEL")+":",value:null==e?void 0:e.applicationNo}),null!=e&&e.applicationType&&i.push({title:n("WS_SERVICE_NAME")+":",value:n("WS_APPLICATION_TYPE_"+(null==e?void 0:e.applicationType))}),v({title:"",isHeader:!0,typeOfApplication:null!=e&&null!==(l=e.applicationNo)&&void 0!==l&&l.includes("SW")?n("WS_NEW_SEWERAGE_DISCONNECTION"):n("WS_NEW_WATER_DISCONNECTION"),date:Digit.DateUtils.ConvertEpochToDate(null==e||null===(o=e.auditDetails)||void 0===o?void 0:o.createdTime)||"NA",values:i},t)})}catch(e){return Promise.reject(e)}}(e,l,t)).then(function(o){return{t:l,tenantId:t,title:"PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER",name:""+l("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER"),email:"",phoneNumber:"",headerDetails:[o],details:[wi(n,l),Pi(e,l),Wi(e,l),Mi(e,l)]}})}const r=null==e||null===(o=e.tradeLicenseDetail)||void 0===o||null===(i=o.applicationDocuments)||void 0===i?void 0:i.map(e=>null==e?void 0:e.fileStoreId);let u;const d=function(){if(r)return Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(function(e){u=e})}();return Promise.resolve(d&&d.then?d.then(a):a())}catch(e){return Promise.reject(e)}},Bi=e=>{var n;const t=null==e?void 0:e.doorNo,l=null==e?void 0:e.street,o=null==e?void 0:e.landmark,i=null==e||null===(n=e.locality)||void 0===n?void 0:n.name,a=null==e?void 0:e.pincode;return(t?t+", ":"")+(l?l+", ":"")+(o?o+", ":"")+(i?i+", ":"")+((null==e?void 0:e.city)||"")+(a?", "+a:"")},Fi=(e,n)=>{var t,l,o;const i=null===(l=((null==e||null===(t=e.owners)||void 0===t?void 0:t.filter(e=>1==e.active))||[]).sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===l||null===(o=l.map(e=>e.name))||void 0===o?void 0:o.join(",");return{title:n("WS_COMMON_PROPERTY_DETAILS"),values:[{title:n("WS_PROPERTY_ID_LABEL"),value:n(""+(null==e?void 0:e.propertyId))||n("CS_NA")},{title:n("WS_OWN_DETAIL_NAME"),value:i||n("CS_NA")},{title:n("WS_PROPERTY_ADDRESS_LABEL"),value:Bi(null==e?void 0:e.address)||n("CS_NA")}]}},Ui=(e,n)=>{var t,l,o,i,a,r,u,d,s,c,v,p,E,_;return{title:n("WS_COMMON_CONNECTION_DETAILS"),values:null!=e&&null!==(t=e.applicationNo)&&void 0!==t&&t.includes("WS")&&"Metered"==(null==e?void 0:e.connectionType)?[{title:n("WS_SERV_DETAIL_CONN_TYPE"),value:n(null!=e&&e.connectionType?"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(l=e.connectionType)||void 0===l?void 0:l.toUpperCase()," ","_"):"CS_NA")},{title:n("WS_SERV_DETAIL_NO_OF_TAPS"),value:(null==e?void 0:e.noOfTaps)||n("CS_NA")},{title:n("WS_PIPE_SIZE_IN_INCHES_LABEL"),value:(null==e?void 0:e.pipeSize)||n("CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SOURCE"),value:n(null!=e&&e.waterSource?"WS_SERVICES_MASTERS_WATERSOURCE_"+(null==e||null===(o=e.waterSource)||void 0===o||null===(i=o.toUpperCase())||void 0===i?void 0:i.split(".")[0]):"CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SUB_SOURCE"),value:n(null!=e&&e.waterSource?""+(null==e||null===(a=e.waterSource)||void 0===a||null===(r=a.toUpperCase())||void 0===r?void 0:r.split(".")[1]):"CS_NA")},{title:n("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),value:null!=e&&e.connectionExecutionDate?S(null==e?void 0:e.connectionExecutionDate):n("CS_NA")},{title:n("WS_SERV_DETAIL_METER_ID"),value:(null==e?void 0:e.meterId)||n("CS_NA")},{title:n("WS_INITIAL_METER_READING_LABEL"),value:(null==e||null===(u=e.additionalDetails)||void 0===u?void 0:u.initialMeterReading)||n("CS_NA")},{title:n("WS_INSTALLATION_DATE_LABEL"),value:null!=e&&e.meterInstallationDate?S(null==e?void 0:e.meterInstallationDate):n("CS_NA")}]:null!=e&&null!==(d=e.applicationNo)&&void 0!==d&&d.includes("WS")&&"Metered"!==(null==e?void 0:e.connectionType)?[{title:n("WS_SERV_DETAIL_CONN_TYPE"),value:n(null!=e&&e.connectionType?"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(s=e.connectionType)||void 0===s?void 0:s.toUpperCase()," ","_"):"CS_NA")},{title:n("WS_SERV_DETAIL_NO_OF_TAPS"),value:(null==e?void 0:e.noOfTaps)||n("CS_NA")},{title:n("WS_PIPE_SIZE_IN_INCHES_LABEL"),value:(null==e?void 0:e.pipeSize)||n("CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SOURCE"),value:n(null!=e&&e.waterSource?"WS_SERVICES_MASTERS_WATERSOURCE_"+(null==e||null===(c=e.waterSource)||void 0===c||null===(v=c.toUpperCase())||void 0===v?void 0:v.split(".")[0]):"CS_NA")},{title:n("WS_SERV_DETAIL_WATER_SUB_SOURCE"),value:n(null!=e&&e.waterSource?""+(null==e||null===(p=e.waterSource)||void 0===p||null===(E=p.toUpperCase())||void 0===E?void 0:E.split(".")[1]):"CS_NA")},{title:n("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),value:null!=e&&e.connectionExecutionDate?S(null==e?void 0:e.connectionExecutionDate):n("CS_NA")}]:[{title:n("WS_SERV_DETAIL_CONN_TYPE"),value:n(null!=e&&e.connectionType?"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(_=e.connectionType)||void 0===_?void 0:_.toUpperCase()," ","_"):"CS_NA")},{title:n("WS_NUMBER_WATER_CLOSETS_LABEL"),value:(null==e?void 0:e.noOfWaterClosets)||n("CS_NA")},{title:n("WS_SERV_DETAIL_NO_OF_TOILETS"),value:(null==e?void 0:e.noOfToilets)||n("CS_NA")},{title:n("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),value:null!=e&&e.connectionExecutionDate?S(null==e?void 0:e.connectionExecutionDate):n("CS_NA")}]}},ki=(e,n)=>{var t,l,o,i,a,r,u,d,s,c,v;return{title:n("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER"),values:(null==e||null===(t=e.connectionHolders)||void 0===t?void 0:t.length)>0?[{title:n("WS_OWN_DETAIL_NAME"),value:(null==e||null===(l=e.connectionHolders)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.name)||n("CS_NA")},{title:n("CORE_COMMON_MOBILE_NUMBER"),value:(null==e||null===(i=e.connectionHolders)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.mobileNumber)||n("CS_NA")},{title:n("WS_CONN_HOLDER_COMMON_FATHER_OR_HUSBAND_NAME"),value:(null==e||null===(r=e.connectionHolders)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fatherOrHusbandName)||n("CS_NA")},{title:n("WS_CORRESPONDANCE_ADDRESS_LABEL"),value:(null==e||null===(d=e.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.correspondenceAddress)||n("CS_NA")},{title:n("CORE_COMMON_EMAIL_ID"),value:(null==e||null===(c=e.connectionHolders)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.emailId)||n("CS_NA")}]:[{title:n("WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS"),value:n("SCORE_YES")||n("CS_NA")}]}},Hi=function(e,n,t,l){try{var o,i;function a(){return Promise.resolve(function(e,n,t){try{return Promise.resolve(E(t,n)).then(function(t){var l,o,i,a;let r=[];return null!=e&&e.connectionNo&&r.push({title:n("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL")+":",value:null==e?void 0:e.connectionNo}),v({title:"",isHeader:!0,typeOfApplication:null!=e&&null!==(l=e.connectionNo)&&void 0!==l&&l.includes("SW")?n("PDF_STATIC_LABEL_SW_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER"):n("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_WATER_CONNECTIONDETAIL"),date:(null!=e&&null!==(o=e.auditDetails)&&void 0!==o&&o.createdTime?Digit.DateUtils.ConvertEpochToDate(null==e||null===(i=e.auditDetails)||void 0===i?void 0:i.createdTime):Digit.DateUtils.ConvertEpochToDate(null==e||null===(a=e.additionalDetails)||void 0===a?void 0:a.appCreatedDate))||"NA",values:r},t)})}catch(e){return Promise.reject(e)}}(e,l,t)).then(function(o){return{t:l,tenantId:t,title:"PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER",name:""+l("PDF_STATIC_LABEL_WS_CONSOLIDATED_ACKNOWELDGMENT_LOGO_SUB_HEADER"),email:"",phoneNumber:"",headerDetails:[o],details:[Ui(e,l),Fi(n,l),ki(e,l)]}})}const r=null==e||null===(o=e.tradeLicenseDetail)||void 0===o||null===(i=o.applicationDocuments)||void 0===i?void 0:i.map(e=>null==e?void 0:e.fileStoreId);let u;const d=function(){if(r)return Promise.resolve(Digit.UploadServices.Filefetch(r,Digit.ULBService.getStateId())).then(function(e){u=e})}();return Promise.resolve(d&&d.then?d.then(a):a())}catch(e){return Promise.reject(e)}},ji=e=>{var n,t,i,r,u,d,s,c,p,m,E,S,_,g,C;let{application:N}=e;const{t:y}=o.useTranslation();return l.createElement(a.Card,null,l.createElement(a.KeyNote,{noteStyle:{fontSize:"24px",fontWeight:"700"},keyValue:y("CS_PAYMENT_AMOUNT_DUE_WITHOUT_SYMBOL"),note:"₹ "+(null==N||null===(n=N.paymentDetails)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.totalAmountPaid)}),l.createElement(a.KeyNote,{keyValue:y("WS_SERVICE_NAME_LABEL"),note:y("WS_SERVICE_TYPE_"+(null==N||null===(i=N.paymentDetails)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.businessService))}),l.createElement(a.KeyNote,{keyValue:y("WS_CONSUMER_CODE"),note:y(null==N||null===(u=N.paymentDetails)||void 0===u||null===(d=u[0])||void 0===d||null===(s=d.bill)||void 0===s?void 0:s.consumerCode)}),l.createElement(a.KeyNote,{keyValue:y("WS_CONSUMER_NAME"),note:(null==N||null===(c=N.property)||void 0===c||null===(p=c.connectionHolders)||void 0===p?void 0:p.map(e=>null==e?void 0:e.name).join(","))||(null==N||null===(m=N.property)||void 0===m||null===(E=m.owners)||void 0===E?void 0:E.map(e=>null==e?void 0:e.name).join(","))||(null==N?void 0:N.payerName)}),l.createElement(a.KeyNote,{keyValue:y("WS_RECEIPT_NO_LABEL"),note:y(null==N||null===(S=N.paymentDetails)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.receiptNumber)}),l.createElement(a.KeyNote,{keyValue:y("WS_RECEIPT_DATE_LABEL"),note:f(null==N||null===(g=N.paymentDetails)||void 0===g||null===(C=g[0])||void 0===C?void 0:C.receiptDate)||y("CS_NA")}),l.createElement(a.KeyNote,{keyValue:y("WS_PAYMENT_STATUS"),note:y(null==N?void 0:N.paymentStatus)}),l.createElement(a.SubmitBar,{label:y("WS_DOWNLOAD_RECEIPT"),onSubmit:e=>{var n,t,l,o;return function(e,n,t,l){try{function o(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:n.filestoreIds[0]})).then(function(e){var t;window.open(e[null===(t=n)||void 0===t?void 0:t.filestoreIds[0]],"_blank")})}let n=null;const l=function(){if(null==e||!e.fileStoreId)return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[v({},e)]},"ws-onetime-receipt")).then(function(e){n=e});n={filestoreIds:[null==e?void 0:e.fileStoreId]}}();return Promise.resolve(l&&l.then?l.then(o):o())}catch(e){return Promise.reject(e)}}(N,0,null==N?void 0:N.tenantId,null!=N&&null!==(n=N.paymentDetails)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&null!==(l=t.bill)&&void 0!==l&&null!==(o=l.consumerCode)&&void 0!==o&&o.includes("SW"))}}))},Vi=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),zi=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),Yi=e=>{var n,t,r,u,d,s,c,p;let{application:m}=e;const{t:E}=o.useTranslation();let S=encodeURI(m.applicationNo);return l.createElement(a.Card,null,l.createElement(a.KeyNote,{keyValue:E("WS_MYCONNECTIONS_CONSUMER_NO"),note:null==m?void 0:m.connectionNo}),l.createElement(a.KeyNote,{keyValue:E("WS_SERVICE_NAME_LABEL"),note:E("WS_APPLICATION_TYPE_"+(null==m?void 0:m.applicationType))}),l.createElement(a.KeyNote,{keyValue:E("WS_CONSUMER_NAME"),note:(null==m||null===(n=m.connectionHolders)||void 0===n?void 0:n.map(e=>e.name).join(","))||(null==m||null===(t=m.property)||void 0===t||null===(r=t.owners.sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===r?void 0:r.map(e=>e.name).join(","))}),l.createElement(a.KeyNote,{keyValue:E("WS_MYCONNECTION_ADDRESS"),note:C(null==m||null===(u=m.property)||void 0===u?void 0:u.address,E),privacy:{uuid:null==m||null===(d=m.property)||void 0===d||null===(s=d.owners)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.uuid,fieldName:["doorNo","street","landmark"],model:"Property",showValue:!0,loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:null==m?void 0:m.tenantId,propertyIds:null==m||null===(p=m.property)||void 0===p?void 0:p.propertyId},jsonPath:"Properties[0].address.street",isArray:!1,d:e=>(U.get(e,"Properties[0].address.doorNo")?U.get(e,"Properties[0].address.doorNo")+", ":"")+(U.get(e,"Properties[0].address.street")?U.get(e,"Properties[0].address.street")+", ":"")+(U.get(e,"Properties[0].address.landmark")?""+U.get(e,"Properties[0].address.landmark"):"")}}}),l.createElement(a.KeyNote,{keyValue:E("WS_MYCONNECTIONS_STATUS"),note:E(null==m?void 0:m.status)}),l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/ws/connection/details/"+S,state:v({},m)}},l.createElement(a.SubmitBar,{label:E("WS_VIEW_DETAILS_LABEL")})))},Gi=e=>{const{t:n}=o.useTranslation();return e.isSuccess?n("CS_WATER_UPDATE_APPLICATION_SUCCESS"):e.isLoading?n("CS_WATER_UPDATE_APPLICATION_PENDING"):e.isSuccess?void 0:n("CS_WATER_UPDATE_APPLICATION_FAILED")},qi=e=>{var n,t,o,i,r,u;return l.createElement(a.Banner,{message:Gi(e),info:e.isSuccess&&null!=e&&e.Waterdata?e.t("WS_ACKNO_APP_NO_LABEL"):"",applicationNumber:null!=e&&e.Waterdata?null==e||null===(n=e.Waterdata)||void 0===n||null===(t=n.WaterConnection)||void 0===t||null===(o=t[0])||void 0===o?void 0:o.applicationNo:"",infoOne:e.isSuccess&&null!=e&&e.Seweragedata?e.t("WS_ACKNO_SEW_APP_NO_LABEL"):"",applicationNumberOne:null!=e&&e.Seweragedata?null==e||null===(i=e.Seweragedata)||void 0===i||null===(r=i.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.applicationNo:"",successful:e.isSuccess})},Ki=[{texts:{header:"CS_TITLE_MY_BILLS",actionButtonLabel:"WS_VIEW_DETAILS_AND_PAY"},labels:[{label:"WNS_COMMON_TABLE_COL_AMT_DUE_LABEL",key:"AmountDue",noteStyle:{fontSize:"24px",fontWeight:"bold"},notePrefix:"₹ "},{label:"WNS_MYCONNECTIONS_SERVICE",key:"ServiceName"},{label:"WNS_MYCONNECTIONS_CONSUMER_NO",key:"ConsumerNumber"},{label:"WNS_BILLING_PERIOD",key:"BillingPeriod"},{label:"WNS_CONSUMER_NAME_LABEL",key:"ConsumerName"},{label:"WNS_MYCONNECTION_ADDRESS",key:"Address"},{label:"WNS_VIEW_BILL_DUE_DATE_LABEL",key:"DueDate"}]}],Xi=e=>{var n,t,r,u,d,s,c,p,E;let{template:S,header:_,actionButtonLabel:f}=e;const{t:g}=o.useTranslation(),C=i.useHistory(),N=i.useLocation(),{tenantId:y}=Digit.Hooks.useQueryParams();let{tenantId:D}=(null===(n=Digit.UserService.getUser())||void 0===n?void 0:n.info)||(null==N?void 0:N.state)||{tenantId:y}||{};D=(null===(t=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===t?void 0:t.code)||(null===(r=Digit.UserService.getUser())||void 0===r||null===(u=r.info)||void 0===u?void 0:u.permanentCity)||D,D||null!=N&&null!==(d=N.state)&&void 0!==d&&d.fromSearchResults||C.replace("/digit-ui/citizen/login",{from:url});let T={};const{mobileNumber:h}=(null===(s=Digit.UserService.getUser())||void 0===s?void 0:s.info)||{};T=v({},T,{searchType:"CONNECTION"});const A=v({mobileNumber:h},T),I=Digit.Hooks.ws.useMyBillsWaterSearch({tenantId:D,filters:v({},A),BusinessService:"WS",t:g},{privacy:Digit.Utils.getPrivacyObject()}),O=Digit.Hooks.ws.useMyBillsSewarageSearch({tenantId:D,filters:v({},A),BusinessService:"SW",t:g},{privacy:Digit.Utils.getPrivacyObject()});if(null!=I&&I.isLoading||null!=O&&O.isLoading||null==I||null==O)return l.createElement(a.Loader,null);let b=I&&O?I.concat(O):[];return b=null===(c=b)||void 0===c?void 0:c.filter(e=>(null==e?void 0:e.AmountDue)&&"0"!==(null==e?void 0:e.AmountDue)),l.createElement("div",{style:{marginTop:"16px"}},l.createElement("div",null,_&&l.createElement(a.Header,{style:{marginLeft:10,marginTop:10}},g(_)," (",null===(p=b)||void 0===p?void 0:p.length,")"),l.createElement(j,{t:g}),l.createElement(a.ResponseComposer,{data:b,template:S,actionButtonLabel:f,onSubmit:e=>{C.push("/digit-ui/citizen/payment/my-bills/"+(null==e?void 0:e.ConsumerNumber.split("/")[0])+"/"+m(null==e?void 0:e.ConsumerNumber,"/","+")+"?workflow=WNS&tenantId="+D+"&ConsumerName="+(null==e?void 0:e.ConsumerName))}})),!(null!==(E=b)&&void 0!==E&&E.length)>0&&l.createElement("p",{style:{paddingLeft:"16px"}},g("CS_BILLS_TEXT_NO_BILLS_FOUND")))};Xi.propTypes={template:jo.any,header:jo.string,actionButtonLabel:jo.string},Xi.defaultProps={template:[],header:null,actionButtonLabel:null};const Zi=["register","control","watch","setValue","unregister","handleSubmit","formState","getValues","reset"],$i=["errors"];function Ji(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const Qi=e=>l.createElement("h1",{className:"heading-m"},e.label),ea=()=>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"})),na=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ea,null)),ta=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;const{data:E,isLoading:S}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:_,data:f}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'PT')]"}]}]}}),[g,C]=t.useState({}),[N,y]=t.useState({}),[D,T]=t.useState([]),[h,A]=t.useState(null),[I,O]=t.useState(null),[b,L]=t.useState(null),[R,w]=t.useState(null),[W,P]=t.useState([]),[M,x]=t.useState(null),[B,F]=t.useState(!1);function U(e){O(e.target.files[0])}return t.useEffect(()=>{var e;f&&f["egf-master"]&&P(null===(e=f["egf-master"])||void 0===e?void 0:e.FinancialYear)},[f]),t.useEffect(()=>{var e;T(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{w(null);const e=function(){if(I){const e=function(){if(I.size>=5242880)w(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",I,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?L(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):w(i("CS_FILE_UPLOAD_ERROR"))})},function(){w(i("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)}}()},[I]),t.useEffect(()=>{r&&C(null!=r&&r.showFinancialYearsModal?(e=>{let{t:n,action:t,financialYears:o,selectedFinancialYear:i,setSelectedFinancialYear:r}=e;return{label:{heading:"WF_"+t.action+"_APPLICATION",submit:"WF_PT.CREATE_"+t.action,cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:n("ES_PT_FINANCIAL_YEARS"),isMandatory:!0,type:"radio",populators:l.createElement(a.RadioButtons,{options:o,optionsKey:"name",onSelect:r,selectedOption:i})}]}]}})({t:i,action:r,financialYears:W,selectedFinancialYear:M,setSelectedFinancialYear:x}):(e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:v,businessService:p}=e;return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"ES_PT_COMMON_CANCEL"},form:[{body:[{label:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:t(v||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?null:l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:t("ES_PT_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("ES_PT_ATTACH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,hintText:t("PT_ATTACH_RESTRICTIONS_SIZE"),message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("ES_PT_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:D,selectedApprover:h,setSelectedApprover:A,selectFile:U,uploadedFile:b,setUploadedFile:L,businessService:p}))},[r,D,W,M,b]),r&&g.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Qi,{label:i(g.label.heading)}),headerBarEnd:l.createElement(na,{onClick:d}),actionCancelLabel:i(g.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(g.label.submit),actionSaveOnSubmit:()=>{},isDisabled:r.showFinancialYearsModal?!M:S||(null==r?void 0:r.docUploadRequired)&&!b,formId:"modal-action"},_?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){if("INACTIVE_PROPERTY"==(null==r?void 0:r.action)){let n={action:"OPEN",comment:null==e?void 0:e.comments,businessService:"PT.CREATE",moduleName:"PT"};c.creationReason="STATUS",s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Property:v({},c,{workflow:n})})}else if(null!=r&&r.showFinancialYearsModal)s({customFunctionToExecute:null==r?void 0:r.customFunctionToExecute,Assessment:{financialYear:null==M?void 0:M.name,propertyId:null==c?void 0:c.propertyId,tenantId:u,source:null==c?void 0:c.source,channel:null==c?void 0:c.channel,assessmentDate:Date.now()}});else{let n={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:m};n.assignes=null!=r&&r.isTerminateState||!h?[]:[h],b&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==I?void 0:I.name,fileStoreId:b}]),s({Property:v({},c,{workflow:n})})}},defaultValues:N,formId:"modal-action"})):l.createElement(a.Loader,null)},la=e=>l.createElement("h1",{className:"heading-m"},e.label),oa=()=>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"})),ia=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(oa,null)),aa=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:m}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),{isLoading:E,data:S}=Digit.Hooks.pt.useMDMS(u,p,"FINANCIAL_YEARLS",{},{details:{tenantId:Digit.ULBService.getStateId(),moduleDetails:[{moduleName:"egf-master",masterDetails:[{name:"FinancialYear",filter:"[?(@.module == 'TL')]"}]}]}}),[_,f]=t.useState({}),[g,C]=t.useState({}),[N,y]=t.useState([]),[D,T]=t.useState({}),[h,A]=t.useState(null),[I,O]=t.useState(null),[b,L]=t.useState(null),[R,w]=t.useState([]),[W,P]=t.useState(null);function M(e){A(e.target.files[0])}return t.useEffect(()=>{var e;S&&S["egf-master"]&&w(null===(e=S["egf-master"])||void 0===e?void 0:e.FinancialYear)},[S]),t.useEffect(()=>{var e;y(null==m||null===(e=m.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[m]),t.useEffect(()=>{!function(){try{L(null);const e=function(){if(h){const e=function(){if(h.size>=5242880)L(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PT",h,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?O(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):L(i("CS_FILE_UPLOAD_ERROR"))})},function(){L(i("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)}}()},[h]),t.useEffect(()=>{r&&f((e=>{let{t:n,action:t,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c}=e,v=!0;return"SENDBACKTOCITIZEN"!=(null==t?void 0:t.action)&&"APPROVE"!=(null==t?void 0:t.action)||(v=!1),t.isTerminateState&&(v=!1),{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==t?void 0:t.action),cancel:"WF_EMPLOYEE_NEWTL_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(a.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:N,selectedApprover:D,setSelectedApprover:T,selectFile:M,uploadedFile:I,setUploadedFile:O,businessService:p}))},[r,N,R,W,I]),r&&_.form?l.createElement(a.Modal,{headerBarMain:l.createElement(la,{label:i(_.label.heading)}),headerBarEnd:l.createElement(ia,{onClick:d}),actionCancelLabel:i(_.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(_.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},E?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:_.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:I?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==h?void 0:h.name,fileStoreId:I}]:null}),s({Licenses:[c]})},defaultValues:g,formId:"modal-action"})):l.createElement(a.Loader,null)},ra=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),ua=()=>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"})),da=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ua,null)),sa=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:m,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState({}),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),L=!!Digit.Utils.browser.isMobile();function R(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==m||null===(e=m.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[m]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))b(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",T,Digit.ULBService.getStateId()||(null==u?void 0:u.split(".")[0]))).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(){b(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,approvers:o,selectedApprover:i,setSelectedApprover:r,selectFile:u,uploadedFile:d,setUploadedFile:s,businessService:c,error:v}=e,p=!0;return"SENDBACKTOCITIZEN"==(null==t?void 0:t.action)&&(p=!1),t.isTerminateState&&(p=!1),{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+(null==c?void 0:c.toUpperCase())+"_"+(null==t?void 0:t.action),cancel:"WF_EMPLOYEE_BPAREG_CANCEL"},form:[{body:[{label:p?n("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:p?n("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:p?l.createElement(a.Dropdown,{option:o,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:r,selected:i}):null},{label:n("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("BPA_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:u,onDelete:()=>{s(null)},message:d?"1 "+n("ES_PT_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:v})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:R,uploadedFile:A,setUploadedFile:I,businessService:p,error:O}))},[r,C,A,O]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(ra,{label:i(S.label.heading)}),headerBarEnd:l.createElement(da,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:L?{width:"720px"}:{},style:L?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:L?{paddingLeft:"5px"}:{}},E?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:S.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!=y&&y.uuid?[null==y?void 0:y.uuid]:null,wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:null}),s({Licenses:[c]},!1,{isStakeholder:!0,bpa:!1})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},ca=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),va=()=>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"})),pa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(va,null)),ma=e=>{var n,o,i,r,u,s,c,p,m,E,S,_;let{t:f,action:g,tenantId:C,closeModal:N,submitAction:y,applicationDetails:D,applicationData:T,businessService:h,workflowDetails:A}=e;Digit.Hooks.obps.useObpsAPI(null!==(n=T)&&void 0!==n&&null!==(o=n.landInfo)&&void 0!==o&&null!==(i=o.address)&&void 0!==i&&i.city?null===(r=T)||void 0===r||null===(u=r.landInfo)||void 0===u||null===(s=u.address)||void 0===s?void 0:s.city:C,!1);const{data:I,isLoading:O}=Digit.Hooks.useEmployeeSearch(C,{roles:null==A||null===(c=A.data)||void 0===c||null===(p=c.initialActionState)||void 0===p||null===(m=p.nextActions)||void 0===m||null===(E=m.filter(e=>(null==e?void 0:e.action)==(null==g?void 0:g.action)))||void 0===E||null===(S=E[0])||void 0===S||null===(_=S.assigneeRoles)||void 0===_?void 0:_.map(e=>({code:e})),isActive:!0},{enabled:!(null!=g&&g.isTerminateState)}),[b,L]=(d.useQueryClient(),t.useState({})),[R,w]=t.useState({}),[W,P]=t.useState([]),[M,x]=t.useState({}),[B,F]=t.useState(null),[U,k]=t.useState(null),[H,j]=t.useState(null),[V,z]=t.useState(null),Y=!!Digit.Utils.browser.isMobile();function G(e){F(e.target.files[0])}t.useEffect(()=>{var e;P(null==I||null===(e=I.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[I]),t.useEffect(()=>{!function(){try{j(null);const e=function(){if(B){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(B.size>=5242880)j(f("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=B&&B.type&&!e.test(null==B?void 0:B.type))j(f("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("OBPS",B,Digit.ULBService.getStateId()||(null==C?void 0:C.split(".")[0]))).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?k(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):j(f("CS_FILE_UPLOAD_ERROR"))})},function(){j(f("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[B]);const q=e=>{let n=[];return e&&e.map((e,t)=>{n.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("_",".")}})}),n},K=e=>{let n=[];var t;for(t=0;t<(null==e?void 0:e.questionLength);t++){var l;n.push({remarks:e["Remarks_"+t],question:null==e?void 0:e.questionList[t].question,value:null==e||null===(l=e["question_"+t])||void 0===l?void 0:l.code})}return n},X=e=>{var n,t;let l=[],o=[];var i,a;return(null==e||null===(n=e.additionalDetails)||void 0===n||null===(t=n.fieldinspection_pending)||void 0===t?void 0:t.length)>0&&(o=null==e||null===(i=e.additionalDetails)||void 0===i?void 0:i.fieldinspection_pending),"FIELDINSPECTION_INPROGRESS"==e.status?(l=JSON.parse(sessionStorage.getItem("INSPECTION_DATA")),(null===(a=l)||void 0===a?void 0:a.length)>0&&l.map((e,n)=>{o.push({docs:q(e.Documents),date:e.InspectionDate,questions:K(e),time:null==e?void 0:e.InspectionTime})}),o=o.filter(e=>e.docs&&e.docs.length>0)):sessionStorage.removeItem("INSPECTION_DATA"),[...o]},Z=e=>{let n=JSON.parse(sessionStorage.getItem("BPA_DOCUMENTS")),t=[];return n.map(e=>{var n,l,o,i,a,r;(null==e||null===(n=e.uploadedDocuments)||void 0===n||null===(l=n[0])||void 0===l||null===(o=l.values)||void 0===o?void 0:o.length)>0&&(t=[...t,...null==e||null===(i=e.uploadedDocuments)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.values]),(null==e||null===(r=e.newUploadedDocs)||void 0===r?void 0:r.length)>0&&(t=[...t,...null==e?void 0:e.newUploadedDocs])}),t},$=()=>{var e;const n=Digit.SessionStorage.get("OBPS_APPROVAL_CHECKS"),t=Digit.SessionStorage.get("OBPS_NEW_APPROVALS");let l=null==n?void 0:n.reduce((e,n)=>null!=n&&n.checked?e.push(null==n?void 0:n.label)&&e:e,[]);return l=null===(e=l)||void 0===e?void 0:e.concat(null!==t?t.filter(e=>""!==e.label).map(e=>null==e?void 0:e.label):[]),l};return t.useEffect(()=>{g&&L((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:v,businessService:p,error:m}=e,E=!1;return"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"SKIP_PAYMENT"!=o.action&&"SEND_BACK_TO_CITIZEN"!=(null==o?void 0:o.action)&&"APPROVE"!=(null==o?void 0:o.action)||(E=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"BPA_CITIZEN_CANCEL_BUTTON"},form:[{body:[{label:o.isTerminateState||E?null:t(v||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||E?null:l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:t("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:!0,populators:{name:"comments"}},{label:""+t("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:f,action:g,approvers:W,selectedApprover:M,setSelectedApprover:x,selectFile:G,uploadedFile:U,setUploadedFile:k,businessService:h,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:H}))},[g,W,V,U,H]),g&&b.form?l.createElement(a.Modal,{headerBarMain:l.createElement(ca,{label:f(b.label.heading)}),headerBarEnd:l.createElement(pa,{onClick:N}),actionCancelLabel:f(b.label.cancel),actionCancelOnSubmit:N,actionSaveLabel:f(b.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:Y?{width:"720px"}:{},style:Y?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:Y?{paddingLeft:"5px"}:{}},O?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:b.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{var n,t,l,o,i,a;T=v({},T,{documents:Z(),additionalDetails:v({},null===(n=T)||void 0===n?void 0:n.additionalDetails,{fieldinspection_pending:X(T),pendingapproval:$()}),workflow:{action:null==g?void 0:g.action,comment:(null==e||null===(t=e.comments)||void 0===t?void 0:t.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:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,assignes:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,varificationDocuments:U?[{documentType:(null==g?void 0:g.action)+" DOC",fileName:null==B?void 0:B.name,fileStoreId:U}]:null},action:null==g?void 0:g.action,comment:null==e?void 0:e.comments,assignee:null!=M&&M.uuid?[null==M?void 0:M.uuid]:null,wfDocuments:U?[{documentType:(null==g?void 0:g.action)+" DOC",fileName:null==B?void 0:B.name,fileStoreId:U}]:null});const r=null==D||null===(o=D.nocData)||void 0===o?void 0:o.map(e=>{const n=Digit.SessionStorage.get(null==e?void 0:e.nocType)||[];return{Noc:v({},e,{documents:[...null!=e&&e.documents?null==e?void 0:e.documents:[],...n||[]]})}});let u={sourceRefId:null==r||null===(i=r[0])||void 0===i||null===(a=i.Noc)||void 0===a?void 0:a.sourceRefId};return Promise.resolve(Digit.NOCSearch.all(C,u)).then(function(e){var n;let t=!0,l=!0;null==e||null===(n=e.Noc)||void 0===n||n.map(e=>{var n,o,i,a,r;"APPROVED"!==(null==e||null===(n=e.applicationStatus)||void 0===n?void 0:n.toUpperCase())&&"AUTO_APPROVED"!==(null==e||null===(o=e.applicationStatus)||void 0===o?void 0:o.toUpperCase())&&"REJECTED"!==(null==e||null===(i=e.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_REJECTED"!==(null==e||null===(a=e.applicationStatus)||void 0===a?void 0:a.toUpperCase())&&"VOIDED"!==(null==e||null===(r=e.applicationStatus)||void 0===r?void 0:r.toUpperCase())||1!=t&&1!=l||("AIRPORT_AUTHORITY"===(null==e?void 0:e.nocType)?t=!1:"FIRE_NOC"===(null==e?void 0:e.nocType)&&(l=!1))});let o=[];r&&r.map(e=>{var n,i,a,r,u,d,s,c,v,p,m,E;("APPROVED"!=(null==e||null===(n=e.Noc)||void 0===n||null===(i=n.applicationStatus)||void 0===i?void 0:i.toUpperCase())&&"AUTO_APPROVED"!=(null==e||null===(a=e.Noc)||void 0===a||null===(r=a.applicationStatus)||void 0===r?void 0:r.toUpperCase())&&"REJECTED"!=(null==e||null===(u=e.Noc)||void 0===u||null===(d=u.applicationStatus)||void 0===d?void 0:d.toUpperCase())&&"AUTO_REJECTED"!=(null==e||null===(s=e.Noc)||void 0===s||null===(c=s.applicationStatus)||void 0===c?void 0:c.toUpperCase())&&"VOIDED"!=(null==e||null===(v=e.Noc)||void 0===v||null===(p=v.applicationStatus)||void 0===p?void 0:p.toUpperCase())&&"AIRPORT_AUTHORITY"===(null==e||null===(m=e.Noc)||void 0===m?void 0:m.nocType)&&t||"FIRE_NOC"===(null==e||null===(E=e.Noc)||void 0===E?void 0:E.nocType)&&l)&&o.push(e)}),y({BPA:T},(null==o?void 0:o.length)>0&&o,{isStakeholder:!1,bpa:!0})})}catch(e){return Promise.reject(e)}},defaultValues:R,formId:"modal-action"})):l.createElement(a.Loader,null)},Ea=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Sa=()=>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"})),_a=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Sa,null)),fa=e=>{var n,o;let{t:r,action:u,tenantId:s,closeModal:c,submitAction:p,applicationData:m,businessService:E}=e;const{data:S,isLoading:_}=Digit.Hooks.useEmployeeSearch(s,{roles:null==u||null===(n=u.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=u&&u.isTerminateState)}),[f,g]=(d.useQueryClient(),t.useState({})),[C,N]=t.useState({}),[y,D]=t.useState([]),[T,h]=t.useState({}),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(null),w=!!Digit.Utils.browser.isMobile();function W(e){I(e.target.files[0])}return i.useHistory(),t.useEffect(()=>{var e;D(null==S||null===(e=S.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[S]),t.useEffect(()=>{!function(){try{R(null);const e=function(){if(A){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(A.size>=5242880)R(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=A&&A.type&&!e.test(null==A?void 0:A.type))R(r("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("NOC",A,Digit.ULBService.getStateId()||(null==s?void 0:s.split(".")[0]))).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):R(r("CS_FILE_UPLOAD_ERROR"))})},function(){R(r("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[A]),t.useEffect(()=>{u&&g((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,assigneeLabel:v,businessService:p,error:m}=e,E=!1;"REVOCATE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)||(E=!0);let S=!1;return"APPROVE"!=(null==o?void 0:o.action)&&"REJECT"!=(null==o?void 0:o.action)&&"AUTO_APPROVE"!=o.action&&"AUTO_REJECT"!=o.action||(S=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+p+"_"+(null==o?void 0:o.action),cancel:"CORE_LOGOUTPOPUP_CANCEL"},form:[{body:[{label:o.isTerminateState||S?null:t(v||"WF_ROLE_"+(null===(n=o.assigneeRoles)||void 0===n?void 0:n[0])),type:"dropdown",populators:o.isTerminateState||S?null:l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r})},{label:t("WF_COMMON_COMMENTS"),type:"textarea",isMandatory:E,populators:{name:"comments"}},{label:""+t("WF_APPROVAL_UPLOAD_HEAD"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:d,onDelete:()=>{c(null)},showHint:!0,message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:m})}]}]}})({t:r,action:u,approvers:y,selectedApprover:T,setSelectedApprover:h,selectFile:W,uploadedFile:O,setUploadedFile:b,businessService:E,assigneeLabel:"WF_ASSIGNEE_NAME_LABEL",error:L}))},[u,y,O,L]),u&&f.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Ea,{label:r(f.label.heading)}),headerBarEnd:l.createElement(_a,{onClick:c}),actionCancelLabel:r(f.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:r(f.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isOBPSFlow:!0,popupStyles:w?{width:"720px"}:{},style:w?{height:"45px",width:"44%"}:{height:"45px",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:w?{paddingLeft:"5px"}:{}},_?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:f.form,cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var n,t,l;let o=JSON.parse(sessionStorage.getItem("NewNOCDocs")),i=(null===(n=m)||void 0===n||null===(t=n.documents)||void 0===t?void 0:t.length)>0?[...null===(l=m)||void 0===l?void 0:l.documents]:[];o.map((e,n)=>{i.push(e)}),m=v({},m,{workflow:{action:null==u?void 0:u.action,comment:null!=e&&e.comments?null==e?void 0:e.comments:null,assignee:null!=T&&T.uuid?[null==T?void 0:T.uuid]:null,documents:O?[{documentType:(null==u?void 0:u.action)+" DOC",fileName:null==A?void 0:A.name,fileStoreId:O}]:null},documents:i}),p({Noc:m},!1,{isNoc:!0})},defaultValues:C,formId:"modal-action"})):l.createElement(a.Loader,null)},ga=e=>l.createElement("h1",{className:"heading-m"},e.label),Ca=()=>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"})),Na=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ca,null)),ya=function(e,n){void 0===n&&(n="dayend");try{const t=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(t[1],t[2]-1,t[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===n&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(n){return e}},Da=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p}=e;const{data:m,isLoading:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState({}),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),L=window.Digit.Utils.browser.isMobile(),R=window.location.href.includes("/employee");function w(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==m||null===(e=m.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[m]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=T&&T.type&&!e.test(null==T?void 0:T.type))b(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",T,Digit.ULBService.getCurrentTenantId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(e){console.error("Modal -> err ",e),b(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[T]),t.useEffect(()=>{var e,n,t,o;"DisconnectWSConnection"==(null===(e=c)||void 0===e||null===(n=e.processInstance)||void 0===n?void 0:n.businessService)||"DisconnectSWConnection"==(null===(t=c)||void 0===t||null===(o=t.processInstance)||void 0===o?void 0:o.businessService)?r&&_((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:p,error:m}=e,E=!0,S=!1;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_DISCONNECTION"==(null==o?void 0:o.action)||"RESUBMIT_APPLICATION"==(null==o?void 0:o.action))&&(E=!1),o.isTerminateState&&(E=!1),"EXECUTE_DISCONNECTION"!=(null==o?void 0:o.action)&&"DISCONNECTION_EXECUTED"!=(null==o?void 0:o.action)||(S=!0),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==p?void 0:p.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:E?t("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:E?t("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:E?l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},S&&{label:t("ES_FSM_ACTION_SERVICE_DATE"),isMandatory:!!S,type:"custom",populators:S?{name:"date",validation:{required:!0},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(a.DatePicker,v({onChange:e.onChange,date:e.value},n))}:null},{label:t("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),error:m,iserror:m,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p,error:O})):r&&_((e=>{var n;let{t:t,action:o,approvers:i,selectedApprover:r,setSelectedApprover:u,selectFile:d,uploadedFile:s,setUploadedFile:c,businessService:v,error:p}=e,m=!0;return(null!=o&&null!==(n=o.action)&&void 0!==n&&n.includes("SEND_BACK")||"APPROVE_FOR_CONNECTION"==(null==o?void 0:o.action))&&(m=!1),o.isTerminateState&&(m=!1),{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"WF_"+(null==v?void 0:v.toUpperCase())+"_"+(null==o?void 0:o.action),cancel:"CS_COMMON_CANCEL"},form:[{body:[{label:m?t("WF_ASSIGNEE_NAME_LABEL"):null,placeholder:m?t("WF_ASSIGNEE_NAME_PLACEHOLDER"):null,type:"dropdown",populators:m?l.createElement(a.Dropdown,{option:i,autoComplete:"off",optionKey:"name",id:"fieldInspector",select:u,selected:r}):null},{label:t("WF_COMMON_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:t("WS_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),populators:l.createElement(a.UploadFile,{id:"workflow-doc",accept:".jpg,.pdf,.png,.jpeg",onUpload:d,onDelete:()=>{c(null)},message:s?"1 "+t("ES_PT_ACTION_FILEUPLOADED"):t("CS_ACTION_NO_FILEUPLOADED"),error:p,iserror:p,showHintBelow:!0,hintText:"WS_HINT_TEXT_LABEL"})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p,error:O}))},[r,C,A,O]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(ga,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Na,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",style:L&&R?{width:"100%",height:"auto"}:{}},E?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var n,t,l,o,i,a,d,p,m,E;if(null!==(n=c)&&void 0!==n&&n.isBillAmend){var S,_,f,g,C,N,D,h,I;const n=v({},null===(S=c)||void 0===S||null===(_=S.billAmendmentDetails)||void 0===_?void 0:_.additionalDetails,{comments:null!=e&&e.comments?e.comments:null}),t=v({},null===(f=c)||void 0===f?void 0:f.billAmendmentDetails,{workflow:{businessId:null===(g=c)||void 0===g||null===(C=g.billAmendmentDetails)||void 0===C?void 0:C.amendmentId,action:null==r?void 0:r.action,tenantId:u,businessService:null!==(N=c)&&void 0!==N&&null!==(D=N.applicationType)&&void 0!==D&&D.includes("WATER")?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:null!==(h=c)&&void 0!==h&&null!==(I=h.applicationType)&&void 0!==I&&I.includes("WATER")?"WS":"SW",assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:[]},additionalDetails:n,comment:(null==e?void 0:e.comments)||"",wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:null,processInstance:{action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:[]}});s({AmendmentUpdate:t})}else{if(c=v({},c,{action:null==r?void 0:r.action,comment:(null==e?void 0:e.comments)||"",assignee:null!=y&&y.uuid?[null==y?void 0:y.uuid]:[],assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],wfDocuments:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:null,processInstance:v({},null===(t=c)||void 0===t?void 0:t.processInstance,{action:null==r?void 0:r.action,assignes:null!=y&&y.uuid?[{uuid:null==y?void 0:y.uuid}]:[],comment:(null==e?void 0:e.comments)||"",documents:A?[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]:[]})}),null!=e&&e.date&&null!==(l=c)&&void 0!==l&&null!==(o=l.applicationType)&&void 0!==o&&o.includes("DISCONNECT")){const n=Lt(null==e?void 0:e.date);c.disconnectionExecutionDate=ya(n)}else if(null!=e&&e.date){const n=Lt(null==e?void 0:e.date);c.connectionExecutionDate=ya(n)}var O;if("DisconnectWSConnection"==(null===(i=c)||void 0===i||null===(a=i.processInstance)||void 0===a?void 0:a.businessService)||"DisconnectSWConnection"==(null===(d=c)||void 0===d||null===(p=d.processInstance)||void 0===p?void 0:p.businessService)||window.location.href.includes("disconnection"))"WATER"==(null===(O=c)||void 0===O?void 0:O.serviceType)?s({WaterConnection:c,disconnectRequest:!0}):s({SewerageConnection:c,disconnectRequest:!0});else if("SEWERAGE_RECONNECTION"==(null===(m=c)||void 0===m?void 0:m.applicationType))s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!0});else if("WATER_RECONNECTION"==(null===(E=c)||void 0===E?void 0:E.applicationType))s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!0});else{var b,L,R,w,W,P,M,x,B,F,U,k,H;const e=sessionStorage.getItem("Digit.ADHOC_ADD_REBATE_DATA"),n=e?JSON.parse(e):"";null!=n&&null!==(b=n.value)&&void 0!==b&&b.adhocPenalty&&(c.additionalDetails.adhocPenalty=parseInt(null==n||null===(L=n.value)||void 0===L?void 0:L.adhocPenalty)||""),null!=n&&null!==(R=n.value)&&void 0!==R&&R.adhocPenaltyComment&&(c.additionalDetails.adhocPenaltyComment=(null==n||null===(w=n.value)||void 0===w?void 0:w.adhocPenaltyComment)||""),null!=n&&null!==(W=n.value)&&void 0!==W&&W.adhocPenaltyReason&&(c.additionalDetails.adhocPenaltyReason=(null==n||null===(P=n.value)||void 0===P?void 0:P.adhocPenaltyReason)||""),null!=n&&null!==(M=n.value)&&void 0!==M&&M.adhocRebate&&(c.additionalDetails.adhocRebate=parseInt(null==n||null===(x=n.value)||void 0===x?void 0:x.adhocRebate)||""),null!=n&&null!==(B=n.value)&&void 0!==B&&B.adhocRebateComment&&(c.additionalDetails.adhocRebateComment=(null==n||null===(F=n.value)||void 0===F?void 0:F.adhocRebateComment)||""),null!=n&&null!==(U=n.value)&&void 0!==U&&U.adhocRebateReason&&(c.additionalDetails.adhocRebateReason=(null==n||null===(k=n.value)||void 0===k?void 0:k.adhocRebateReason)||""),"WATER"==(null===(H=c)||void 0===H?void 0:H.serviceType)?s({WaterConnection:c,disconnectRequest:!1,reconnectRequest:!1}):s({SewerageConnection:c,disconnectRequest:!1,reconnectRequest:!1})}}},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},Ta=e=>l.createElement("h1",{className:"heading-m"},e.label),ha=()=>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"})),Aa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ha,null)),Ia=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;console.log("applicationData",c);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState(null),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(!1);function w(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",T,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(){b(i("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]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==t?void 0:t.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:[{label:n("ES_PTR_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_PTR_ATTACH_FILE")+(t.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("PTR_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_PTR_ACTION_FILEUPLOADED"):n("ES_PTR_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p}))},[r,C,A]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Ta,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Aa,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:m};A&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,filestoreId:A}]),s({PetRegistrationApplications:[v({},c,{workflow:n})]})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},Oa=e=>l.createElement("h1",{className:"heading-m"},e.label),ba=()=>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"})),La=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ba,null)),Ra=e=>{var n,o,r;let{t:u,action:d,tenantId:s,closeModal:c,submitAction:p,applicationData:m,businessService:E,moduleCode:S}=e;const{data:_}=Digit.Hooks.useEmployeeSearch(s,{roles:null==d||null===(n=d.roles)||void 0===n||null===(o=n[0])||void 0===o||null===(r=o.map)||void 0===r?void 0:r.call(o,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),f=i.useHistory(),[g,C]=t.useState({}),[N,y]=t.useState({}),[D,T]=t.useState([]),[h,A]=t.useState(null),[I,O]=t.useState(null);return t.useEffect(()=>{var e;T(null==_||null===(e=_.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[_]),t.useEffect(()=>{"INITIATED"===(null==d?void 0:d.state)?f.push("/digit-ui/employee/asset/assetservice/edit/"+(null==m?void 0:m.applicationNo)):C((e=>{let{t:n,action:t,businessService:l}=e;return{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+l+"_"+(null==t?void 0:t.action),cancel:"ES_AST_COMMON_CANCEL"},form:[{body:[{label:n("AST_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}}]}]}})({t:u,action:d,approvers:D,selectedApprover:h,setSelectedApprover:A,uploadedFile:I,setUploadedFile:O,businessService:E}))},[d,D,I]),d&&g.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Oa,{label:u(g.label.heading)}),headerBarEnd:l.createElement(La,{onClick:c}),actionCancelLabel:u(g.label.cancel),actionCancelOnSubmit:c,actionSaveLabel:u(g.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:g.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==d?void 0:d.action,comment:null==e?void 0:e.comments,businessService:E,moduleName:S};I&&(n.documents=[]),p({Asset:v({},m,{workflow:n})})},defaultValues:N,formId:"modal-action"})):l.createElement(a.Loader,null)},wa=e=>l.createElement("h1",{className:"heading-m"},e.label),Wa=()=>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"})),Pa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Wa,null)),Ma=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState(null),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(!1);function w(e){h(e.target.files[0])}return t.useEffect(()=>{var e;N(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{b(null);const e=function(){if(T){const e=function(){if(T.size>=5242880)b(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("CHB",T,u)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?I(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):b(i("CS_FILE_UPLOAD_ERROR"))})},function(){b(i("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]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:r}=e;return{label:{heading:"CHB_"+(null==t?void 0:t.action),submit:"CHB_"+(null==t?void 0:t.action),cancel:"CS_COMMON_BACK"},form:[{body:[{label:n("ES_CHB_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("ES_CHB_ATTACH_FILE")+(t.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},message:i?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:w,uploadedFile:A,setUploadedFile:I,businessService:p}))},[r,C,A]),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(wa,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Pa,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==r?void 0:r.action,comment:null==e?void 0:e.comments,businessService:p,moduleName:m};A&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==T?void 0:T.name,fileStoreId:A}]),s({hallsBookingApplication:v({},c,{workflow:n})})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)},xa=e=>l.createElement("h1",{className:"heading-m"},e.label),Ba=()=>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"})),Fa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ba,null)),Ua=e=>{var n,o;let{t:i,action:r,tenantId:u,closeModal:d,submitAction:s,applicationData:c,businessService:p,moduleCode:m}=e;console.log("snjdskbjdfbjskfjkbs",r);const{data:E}=Digit.Hooks.useEmployeeSearch(u,{roles:null==r||null===(n=r.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=r&&r.isTerminateState)}),[S,_]=t.useState({}),[f,g]=t.useState({}),[C,N]=t.useState([]),[y,D]=t.useState(null),[T,h]=t.useState(null),[A,I]=t.useState(null),[O,b]=t.useState(null),[L,R]=t.useState(null),[w,W]=t.useState(!1);function P(e){I(e.target.files[0])}return t.useEffect(()=>{var e;N(null==E||null===(e=E.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[E]),t.useEffect(()=>{!function(){try{R(null);const e=function(){if(A){const e=function(){if(A.size>=5242880)R(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("PTR",A,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?b(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):R(i("CS_FILE_UPLOAD_ERROR"))})},function(){R(i("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]),t.useEffect(()=>{r&&_((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:r,businessService:u}=e;console.log("action",t);const d=(new Date).toISOString().split("T")[0];return console.log("todayedsta ::",d),{label:{heading:"WF_"+(null==t?void 0:t.action)+"_APPLICATION",submit:"WF_"+u+"_"+(null==t?void 0:t.action),cancel:"ES_PTR_COMMON_CANCEL"},form:[{body:["COMPLETIONPENDING"===(null==t?void 0:t.state)?{label:n("EW_PICKUP_DATE"),type:"date",isMandatory:!0,populators:{name:"date",min:(new Date).toISOString().split("T")[0],max:new Date(Date.now()+6048e5).toISOString().split("T")[0]}}:"null","REQUESTCOMPLETED"===(null==t?void 0:t.state)?{label:n("ES_EW_ACTION_TRANSACTION_ID"),type:"text",isMandatory:!0,populators:{name:"transactionId"}}:"null","REQUESTCOMPLETED"===(null==t?void 0:t.state)?{label:n("ES_EW_ACTION_FINALAMOUNT"),type:"text",isMandatory:!0,populators:{name:"finalAmount"}}:"null",{label:n("ES_EW_ACTION_COMMENTS"),type:"textarea",populators:{name:"comments"}},{label:n("ES_EW_PHOTO")+(t.docUploadRequired?" *":""),populators:l.createElement(a.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{r(null)},showHint:!0,hintText:n("EW_ATTACH_RESTRICTIONS_SIZE"),message:i?"1 "+n("ES_EW_ACTION_FILEUPLOADED"):n("ES_EW_ACTION_NO_FILEUPLOADED")})}]}]}})({t:i,action:r,approvers:C,selectedApprover:y,setSelectedApprover:D,selectFile:P,uploadedFile:O,setUploadedFile:b,businessService:p}))},[r,C,O]),console.log("conggg",S),r&&S.form?l.createElement(a.Modal,{headerBarMain:l.createElement(xa,{label:i(S.label.heading)}),headerBarEnd:l.createElement(Fa,{onClick:d}),actionCancelLabel:i(S.label.cancel),actionCancelOnSubmit:d,actionSaveLabel:i(S.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action"},l.createElement(a.FormComposer,{config:S.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n={action:null==r?void 0:r.action,comments:null==e?void 0:e.comments,businessService:p,moduleName:m};console.log("applicationData",e),O&&(n.documents=[{documentType:(null==r?void 0:r.action)+" DOC",fileName:null==A?void 0:A.name,filestoreId:O},{}]),c.pickUpDate=null==e?void 0:e.date,c.transactionId=null==e?void 0:e.transactionId,c.finalAmount=null==e?void 0:e.finalAmount,s({EwasteApplication:[v({},c,{workflow:n})]})},defaultValues:f,formId:"modal-action"})):l.createElement(a.Loader,null)};var ka=F(function(e,t){(function(){var l=function(e){return e instanceof l?e:this instanceof l?void(this.EXIFwrapped=e):new l(e)};e.exports&&(t=e.exports=l),t.EXIF=l;var o=l.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},i=l.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},a=l.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},r=l.IFD1Tags={256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",296:"ResolutionUnit",513:"JpegIFOffset",514:"JpegIFByteCount",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite"},u=l.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};function d(e){return!!e.exifdata}function s(e){var n=new DataView(e);if(255!=n.getUint8(0)||216!=n.getUint8(1))return!1;for(var t=2,l=e.byteLength;t<l;){if(255!=n.getUint8(t))return!1;if(225==n.getUint8(t+1))return S(n,t+4,n.getUint16(t+2));t+=2+n.getUint16(t+2)}}var c={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};function v(e,n,t){for(var l,o,i,a,r=new DataView(e),u={},d=n;d<n+t;)28===r.getUint8(d)&&2===r.getUint8(d+1)&&(a=r.getUint8(d+2))in c&&(i=r.getInt16(d+3),o=c[a],l=E(r,d+5,i),u.hasOwnProperty(o)?u[o]instanceof Array?u[o].push(l):u[o]=[u[o],l]:u[o]=l),d++;return u}function p(e,n,t,l,o){var i,a,r=e.getUint16(t,!o),u={};for(a=0;a<r;a++)u[l[e.getUint16(i=t+12*a+2,!o)]]=m(e,i,n,0,o);return u}function m(e,n,t,l,o){var i,a,r,u,d,s,c=e.getUint16(n+2,!o),v=e.getUint32(n+4,!o),p=e.getUint32(n+8,!o)+t;switch(c){case 1:case 7:if(1==v)return e.getUint8(n+8,!o);for(i=v>4?p:n+8,a=[],u=0;u<v;u++)a[u]=e.getUint8(i+u);return a;case 2:return E(e,i=v>4?p:n+8,v-1);case 3:if(1==v)return e.getUint16(n+8,!o);for(i=v>2?p:n+8,a=[],u=0;u<v;u++)a[u]=e.getUint16(i+2*u,!o);return a;case 4:if(1==v)return e.getUint32(n+8,!o);for(a=[],u=0;u<v;u++)a[u]=e.getUint32(p+4*u,!o);return a;case 5:if(1==v)return d=e.getUint32(p,!o),s=e.getUint32(p+4,!o),(r=new Number(d/s)).numerator=d,r.denominator=s,r;for(a=[],u=0;u<v;u++)d=e.getUint32(p+8*u,!o),s=e.getUint32(p+4+8*u,!o),a[u]=new Number(d/s),a[u].numerator=d,a[u].denominator=s;return a;case 9:if(1==v)return e.getInt32(n+8,!o);for(a=[],u=0;u<v;u++)a[u]=e.getInt32(p+4*u,!o);return a;case 10:if(1==v)return e.getInt32(p,!o)/e.getInt32(p+4,!o);for(a=[],u=0;u<v;u++)a[u]=e.getInt32(p+8*u,!o)/e.getInt32(p+4+8*u,!o);return a}}function E(e,t,l){var o="";for(n=t;n<t+l;n++)o+=String.fromCharCode(e.getUint8(n));return o}function S(e,n){if("Exif"!=E(e,n,4))return!1;var t,l,d,s,c,v=n+6;if(18761==e.getUint16(v))t=!1;else{if(19789!=e.getUint16(v))return!1;t=!0}if(42!=e.getUint16(v+2,!t))return!1;var m=e.getUint32(v+4,!t);if(m<8)return!1;if((l=p(e,v,v+m,i,t)).ExifIFDPointer)for(d in s=p(e,v,v+l.ExifIFDPointer,o,t)){switch(d){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":s[d]=u[d][s[d]];break;case"ExifVersion":case"FlashpixVersion":s[d]=String.fromCharCode(s[d][0],s[d][1],s[d][2],s[d][3]);break;case"ComponentsConfiguration":s[d]=u.Components[s[d][0]]+u.Components[s[d][1]]+u.Components[s[d][2]]+u.Components[s[d][3]]}l[d]=s[d]}if(l.GPSInfoIFDPointer)for(d in c=p(e,v,v+l.GPSInfoIFDPointer,a,t)){switch(d){case"GPSVersionID":c[d]=c[d][0]+"."+c[d][1]+"."+c[d][2]+"."+c[d][3]}l[d]=c[d]}return l.thumbnail=function(e,n,t,l){var o=function(e,n,t){var l=e.getUint16(n,!t);return e.getUint32(n+2+12*l,!t)}(e,n+t,l);if(!o)return{};if(o>e.byteLength)return{};var i=p(e,n,n+o,r,l);if(i.Compression)switch(i.Compression){case 6:i.JpegIFOffset&&i.JpegIFByteCount&&(i.blob=new Blob([new Uint8Array(e.buffer,n+i.JpegIFOffset,i.JpegIFByteCount)],{type:"image/jpeg"}));break;case 1:console.log("Thumbnail image format is TIFF, which is not implemented.");break;default:console.log("Unknown thumbnail image format '%s'",i.Compression)}else 2==i.PhotometricInterpretation&&console.log("Thumbnail image format is RGB, which is not implemented.");return i}(e,v,m,t),l}function _(e){var n={};if(1==e.nodeType){if(e.attributes.length>0){n["@attributes"]={};for(var t=0;t<e.attributes.length;t++){var l=e.attributes.item(t);n["@attributes"][l.nodeName]=l.nodeValue}}}else if(3==e.nodeType)return e.nodeValue;if(e.hasChildNodes())for(var o=0;o<e.childNodes.length;o++){var i=e.childNodes.item(o),a=i.nodeName;if(null==n[a])n[a]=_(i);else{if(null==n[a].push){var r=n[a];n[a]=[],n[a].push(r)}n[a].push(_(i))}}return n}function f(e){try{var n={};if(e.children.length>0)for(var t=0;t<e.children.length;t++){var l=e.children.item(t),o=l.attributes;for(var i in o){var a=o[i],r=a.nodeName;void 0!==r&&(n[r]=a.nodeValue)}var u=l.nodeName;if(void 0===n[u])n[u]=_(l);else{if(void 0===n[u].push){var d=n[u];n[u]=[],n[u].push(d)}n[u].push(_(l))}}else n=e.textContent;return n}catch(e){console.log(e.message)}}l.enableXmp=function(){l.isXmpEnabled=!0},l.disableXmp=function(){l.isXmpEnabled=!1},l.getData=function(e,n){return!((self.Image&&e instanceof self.Image||self.HTMLImageElement&&e instanceof self.HTMLImageElement)&&!e.complete||(d(e)?n&&n.call(e):function(e,n){function t(t){var o=s(t);e.exifdata=o||{};var i=function(e){var n=new DataView(e);if(255!=n.getUint8(0)||216!=n.getUint8(1))return!1;for(var t=2,l=e.byteLength,o=function(e,n){return 56===e.getUint8(n)&&66===e.getUint8(n+1)&&73===e.getUint8(n+2)&&77===e.getUint8(n+3)&&4===e.getUint8(n+4)&&4===e.getUint8(n+5)};t<l;){if(o(n,t)){var i=n.getUint8(t+7);return i%2!=0&&(i+=1),0===i&&(i=4),v(e,t+8+i,n.getUint16(t+6+i))}t++}}(t);if(e.iptcdata=i||{},l.isXmpEnabled){var a=function(e){if("DOMParser"in self){var n=new DataView(e);if(255!=n.getUint8(0)||216!=n.getUint8(1))return!1;for(var t=2,l=e.byteLength,o=new DOMParser;t<l-4;){if("http"==E(n,t,4)){var i=t-1,a=n.getUint16(t-2)-1,r=E(n,i,a),u=r.indexOf("xmpmeta>")+8,d=(r=r.substring(r.indexOf("<x:xmpmeta"),u)).indexOf("x:xmpmeta")+10;return r=r.slice(0,d)+'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tiff="http://ns.adobe.com/tiff/1.0/" xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '+r.slice(d),f(o.parseFromString(r,"text/xml"))}t++}}}(t);e.xmpdata=a||{}}n&&n.call(e)}if(e.src)if(/^data\:/i.test(e.src))t(function(e,n){n=n||e.match(/^data\:([^\;]+)\;base64,/im)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var t=atob(e),l=t.length,o=new ArrayBuffer(l),i=new Uint8Array(o),a=0;a<l;a++)i[a]=t.charCodeAt(a);return o}(e.src));else if(/^blob\:/i.test(e.src))(i=new FileReader).onload=function(e){t(e.target.result)},function(e,n){var t=new XMLHttpRequest;t.open("GET",e,!0),t.responseType="blob",t.onload=function(e){200!=this.status&&0!==this.status||i.readAsArrayBuffer(this.response)},t.send()}(e.src);else{var o=new XMLHttpRequest;o.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";t(o.response),o=null},o.open("GET",e.src,!0),o.responseType="arraybuffer",o.send(null)}else if(self.FileReader&&(e instanceof self.Blob||e instanceof self.File)){var i;(i=new FileReader).onload=function(e){t(e.target.result)},i.readAsArrayBuffer(e)}}(e,n),0))},l.getTag=function(e,n){if(d(e))return e.exifdata[n]},l.getIptcTag=function(e,n){if(d(e))return e.iptcdata[n]},l.getAllTags=function(e){if(!d(e))return{};var n,t=e.exifdata,l={};for(n in t)t.hasOwnProperty(n)&&(l[n]=t[n]);return l},l.getAllIptcTags=function(e){if(!d(e))return{};var n,t=e.iptcdata,l={};for(n in t)t.hasOwnProperty(n)&&(l[n]=t[n]);return l},l.pretty=function(e){if(!d(e))return"";var n,t=e.exifdata,l="";for(n in t)t.hasOwnProperty(n)&&(l+="object"==typeof t[n]?t[n]instanceof Number?n+" : "+t[n]+" ["+t[n].numerator+"/"+t[n].denominator+"]\r\n":n+" : ["+t[n].length+" values]\r\n":n+" : "+t[n]+"\r\n");return l},l.readFromBinaryFile=function(e){return s(e)}}).call(B)});const Ha=e=>l.createElement("h1",{className:"heading-m"},e.label),ja=()=>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"})),Va=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ja,null)),za=e=>{var n,o;let{t:r,action:u,tenantId:d,closeModal:s,submitAction:c,applicationData:p,businessService:m,moduleCode:E,vending_Zone:S,UserVendingZone:_,UserVendingZoneCode:f}=e;i.useHistory();const g=Digit.UserService.getUser().info,C=null==g?void 0:g.roles,{data:N}=Digit.Hooks.useEmployeeSearch(d,{roles:null==u||null===(n=u.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:null==u?void 0:u.isTerminateState}),[y,D]=t.useState({}),[T,h]=t.useState({}),[A,I]=t.useState([]),[O,b]=t.useState(null),[L,R]=t.useState(null),[w,W]=t.useState(null),[P,M]=t.useState(null),[x,B]=t.useState(!1),[F,U]=t.useState(),[k,H]=t.useState(),[j,V]=t.useState("");function z(e){B(!0),R(e.target.files[0])}function Y(e){return e[0]+e[1]/60+e[2]/3600}return t.useEffect(()=>{var e;I(null==N||null===(e=N.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[N]),t.useEffect(()=>{!function(){try{M(null);const e=function(){if(L){(function(e){return new Promise(n=>{ka.getData(e,function(){const e=ka.getTag(this,"GPSLatitude"),t=ka.getTag(this,"GPSLongitude");if(e&&t){const l=Y(e),o=Y(t);n({latitude:l,longitude:o})}else n({latitude:null,longitude:null})})})})(L).then(e=>{let{latitude:n,longitude:t}=e;n&&t?function(e,n){try{Promise.resolve(Ji(function(){return Promise.resolve(fetch(((e,n)=>"https://nominatim.openstreetmap.org/reverse?format=json&lat="+e+"&lon="+n+"&zoom=18&addressdetails=1")(e,n))).then(function(e){if(!e.ok)throw new Error("Failed to fetch address");return Promise.resolve(e.json()).then(function(e){if(e&&e.address){var n,t,l,o,i,a,r,u;const d=[null===(n=e.address)||void 0===n?void 0:n.amenity,null===(t=e.address)||void 0===t?void 0:t.road,null===(l=e.address)||void 0===l?void 0:l.neighbourhood,null===(o=e.address)||void 0===o?void 0:o.suburb,null===(i=e.address)||void 0===i?void 0:i.city,null===(a=e.address)||void 0===a?void 0:a.state,null===(r=e.address)||void 0===r?void 0:r.postcode,null===(u=e.address)||void 0===u?void 0:u.country].filter(Boolean).join(", ");U(d)}})})},function(e){console.error("Error fetching address:",e)}))}catch(e){return Promise.reject(e)}}(n,t):console.log("No geolocation data found in the image.")});const e=function(){if(L.size>=5242880)M(r("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=function(e,n){try{var t=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("StreetVending",L,d)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?W(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):M(r("CS_FILE_UPLOAD_ERROR"))})},function(){M(r("CS_FILE_UPLOAD_ERROR"))})}catch(e){return n(!0,e)}return t&&t.then?t.then(n.bind(null,!1),n.bind(null,!0)):n(!1,t)}(0,function(e,n){if(B(!1),e)throw n;return n});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)}}()},[L]),t.useEffect(()=>{D((e=>{let{t:n,action:o,selectFile:i,uploadedFile:r,setUploadedFile:u,approvers:d,selectedApprover:s,setSelectedApprover:c,isUploading:v,geoLocationData:p,vending_Zone:m,vendingZones:E,setvendingZones:S,UserVendingZone:_,selectApprover:f}=e;const g=()=>l.createElement("div",{className:"loading-spinner"});return{label:{heading:"WF_"+(null==o?void 0:o.action)+"_APPLICATION",submit:"SV_"+(null==o?void 0:o.action),cancel:"SV_COMMON_CANCEL"},form:[{body:["APPROVE"===(null==o?void 0:o.action)||"REJECT"===(null==o?void 0:o.action)||"SENDBACKTOCITIZEN"===(null==o?void 0:o.action)?"":{label:n("SV_ASSIGNEE"),type:"dropdown",populators:l.createElement(a.Dropdown,{option:d,t:n,optionKey:"name",select:c,selected:s})},(f||[]).some(e=>"TVCEMPLOYEE"===e.code||"SVCEMP"===e.code)&&{label:n("SV_CONFIRM_VENDING_ZONE"),type:"dropdown",populators:l.createElement(a.Dropdown,{option:m,t:n,optionKey:"i18nKey",select:S,selected:(e=>e?{i18nKey:e,code:e,value:e}:null)(_)||E})},{label:n("SV_ACTION_COMMENTS"),isMandatory:!0,type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("SV_ATTATCH_FILE")+(o.docUploadRequired?" *":""),populators:l.createElement(t.Fragment,null,l.createElement(a.UploadFile,{id:"workflow-doc-sv",onUpload:i,onDelete:()=>{u(null)},message:v?l.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l.createElement(g,null),l.createElement("span",null,"Uploading...")):r?"1 "+n("SV_FILE_UPLOADED"):n("SV_NO_FILE")}),(f||[]).some(e=>"INSPECTIONOFFICER"===e.code)&&p&&l.createElement("div",null,l.createElement("strong",null," Location: ",p," ")))}]}]}})({t:r,action:u,approvers:A,selectedApprover:O,setSelectedApprover:b,selectFile:z,uploadedFile:w,setUploadedFile:W,businessService:m,isUploading:x,geoLocationData:F,vending_Zone:S,vendingZones:k,setvendingZones:H,UserVendingZone:_,selectApprover:C}))},[u,A,w]),u&&y.form?l.createElement(a.Modal,{headerBarMain:l.createElement(Ha,{label:r(y.label.heading)}),headerBarEnd:l.createElement(Va,{onClick:s}),actionCancelLabel:r(y.label.cancel),actionCancelOnSubmit:s,actionSaveLabel:r(y.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:(null==u?void 0:u.docUploadRequired)&&!w&&!j||!j},l.createElement(a.FormComposer,{config:y.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){var n;let t={action:null==u?void 0:u.action,comments:null==e?void 0:e.comments,businessService:m,moduleName:E,assignes:"SENDBACKTOCITIZEN"===(null==u?void 0:u.action)?[null==p||null===(n=p.auditDetails)||void 0===n?void 0:n.createdBy]:null!=O&&O.uuid?[null==O?void 0:O.uuid]:null};w&&(t.documents=[{documentType:(null==u?void 0:u.action)+" DOC",fileName:null==L?void 0:L.name,fileStoreId:w}]),c({streetVendingDetail:v({},p,{vendingZone:(null==k?void 0:k.code)||f,workflow:t})})},defaultValues:T,formId:"modal-action",onFormValueChange:(e,n)=>{V(null==n?void 0:n.comments)}})):l.createElement(a.Loader,null)},Ya=e=>l.createElement("h1",{className:"heading-m"},e.label),Ga=()=>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"})),qa=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Ga,null)),Ka=e=>{var n,o,a,r;let{t:u,action:d,tenantId:c,closeModal:p,submitAction:m,applicationData:E,businessService:S,moduleCode:_}=e;const{data:f}=Digit.Hooks.useEmployeeSearch(c,{roles:null==d||null===(n=d.assigneeRoles)||void 0===n||null===(o=n.map)||void 0===o?void 0:o.call(n,e=>({code:e})),isActive:!0},{enabled:!(null!=d&&d.isTerminateState)}),{data:g}=Digit.Hooks.fsm.useVendorSearch({tenantId:c,config:{enabled:"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==d?void 0:d.state)}});let C=[];null==g||null===(a=g.vendor)||void 0===a||a.map(e=>{var n,t;(null==e||null===(n=e.additionalDetails)||void 0===n?void 0:n.serviceType)===(null==E?void 0:E.bookingNo.split("-")[0])&&C.push({code:null==e?void 0:e.name,name:null==e?void 0:e.name,i18nKey:null==e?void 0:e.name,vendorId:null==e?void 0:e.id,uuid:null==e||null===(t=e.owner)||void 0===t?void 0:t.uuid})});const{data:N}=Digit.Hooks.fsm.useVehiclesSearch({tenantId:c,config:{enabled:"DELIVERY_PENDING"===(null==d?void 0:d.state)}});let y=[];null==N||null===(r=N.vehicle)||void 0===r||r.map(e=>{var n;y.push({code:null==e?void 0:e.registrationNumber,name:null==e?void 0:e.registrationNumber,i18nKey:null==e?void 0:e.registrationNumber,tankerCapacity:null==e?void 0:e.tankCapacity,vehicleId:null==e?void 0:e.id,uuid:null==e||null===(n=e.owner)||void 0===n?void 0:n.uuid})});const[D,T]=t.useState({}),[h,A]=t.useState({}),[I,O]=t.useState([]),[b,L]=t.useState(null),[R,w]=t.useState(null),[W,P]=t.useState(null),[M,x]=t.useState(null),[B,F]=t.useState(null),[U,k]=t.useState(""),H=i.useHistory();function j(e){L(e.target.files[0])}return t.useEffect(()=>{var e;O(null==f||null===(e=f.Employees)||void 0===e?void 0:e.map(e=>{var n;return{uuid:null==e?void 0:e.uuid,name:null==e||null===(n=e.user)||void 0===n?void 0:n.name}}))},[f]),t.useEffect(()=>{!function(){try{P(null);const e=function(){if(b){const e=function(){if(b.size>=5242880)P(u("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=Ji(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WT",b,c)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?w(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):P(u("CS_FILE_UPLOAD_ERROR"))})},function(){P(u("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]),t.useEffect(()=>{if(d){if("PAY"===d.action){var e;const n=null===(e=E.bookingNo)||void 0===e?void 0:e.split("-")[0];let t="";switch(n){case"WT":t="request-service.water_tanker";break;case"MT":t="request-service.mobile_toilet";break;case"TP":t="request-service.tree_pruning";break;default:return void console.error("Unknown booking prefix:",n)}return H.push("/digit-ui/employee/payment/collect/"+t+"/"+E.bookingNo)}T((e=>{let{t:n,action:t,selectFile:o,uploadedFile:i,setUploadedFile:a,selectedVendor:r,setSelectedVendor:u,vendorDescription:d,vehicleDescription:c,selectVehicle:v,setSelectVehicle:p}=e;return{label:{heading:"RS_"+(null==t?void 0:t.action),submit:"RS_"+(null==t?void 0:t.action),cancel:"CS_COMMON_BACK"},form:[{body:["PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==t?void 0:t.state)?{label:n("RS_ASSIGN"),type:"dropdown",isMandatory:!0,populators:l.createElement(s.Dropdown,{option:d,t:n,optionKey:"i18nKey",select:u,selected:r})}:"null","DELIVERY_PENDING"===(null==t?void 0:t.state)?{label:n("RS_REGISTRATION_NUMBER"),isMandatory:!0,type:"dropdown",populators:l.createElement(s.Dropdown,{option:c,t:n,optionKey:"i18nKey",select:p,selected:v})}:"null",{label:n("ES_RS_ACTION_COMMENTS")+" *",type:"textarea",populators:{name:"comments",validation:{required:!0}}},{label:n("ES_RS_ATTACH_FILE")+(t.docUploadRequired?" *":""),populators:l.createElement(s.UploadFile,{id:"workflow-doc",onUpload:o,onDelete:()=>{a(null)},message:i?"1 "+n("CS_ACTION_FILEUPLOADED"):n("CS_ACTION_NO_FILEUPLOADED")})}]}]}})({t:u,action:d,selectFile:j,uploadedFile:R,setUploadedFile:w,selectedVendor:M,setSelectedVendor:x,vendorDescription:g?C:void 0,vehicleDescription:N?y:void 0,selectVehicle:B,setSelectVehicle:F}))}},[d,I,R,g,B,N]),d&&D.form?l.createElement(s.Modal,{headerBarMain:l.createElement(Ya,{label:u(D.label.heading)}),headerBarEnd:l.createElement(qa,{onClick:p}),actionCancelLabel:u(D.label.cancel),actionCancelOnSubmit:p,actionSaveLabel:u(D.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",isDisabled:(null==d?void 0:d.docUploadRequired)&&!R&&!U||"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==d?void 0:d.state)&&!M&&!U||"DELIVERY_PENDING"===(null==d?void 0:d.state)&&!B&&!U||!U},l.createElement(s.FormComposer,{config:D.form,noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){let n,t={action:null==d?void 0:d.action,comments:null==e?void 0:e.comments,businessService:S,moduleName:_};R&&(t.documents=[{documentType:(null==d?void 0:d.action)+" DOC",fileName:null==b?void 0:b.name,fileStoreId:R}]),"PENDING_FOR_VEHICLE_DRIVER_ASSIGN"===(null==d?void 0:d.state)&&(t.assignes=[null==M?void 0:M.uuid],E.vendorId=null==M?void 0:M.vendorId),"DELIVERY_PENDING"===(null==d?void 0:d.state)&&(E.vehicleId=null==B?void 0:B.vehicleId),n="watertanker"===S?{waterTankerBookingDetail:v({},E,{workflow:t})}:"treePruning"===S?{treePruningBookingDetail:v({},E,{workflow:t})}:{mobileToiletBookingDetail:v({},E,{workflow:t})},m(n)},defaultValues:h,formId:"modal-action",onFormValueChange:(e,n)=>{k(null==n?void 0:n.comments)}})):l.createElement(s.Loader,null)},Xa=e=>null!=e&&e.businessService.includes("PT")?l.createElement(ta,e):null!=e&&e.businessService.includes("ptr")?l.createElement(Ia,e):null!=e&&e.businessService.includes("NewTL")||null!=e&&e.businessService.includes("TL")||null!=e&&e.businessService.includes("EDITRENEWAL")||null!=e&&e.businessService.includes("DIRECTRENEWAL")?l.createElement(aa,e):null!=e&&e.moduleCode.includes("BPAREG")?l.createElement(sa,e):null!=e&&e.moduleCode.includes("BPA")?l.createElement(ma,e):null!=e&&e.moduleCode.includes("NOC")?l.createElement(fa,e):null!=e&&e.moduleCode.includes("WS")?l.createElement(Da,e):null!=e&&e.businessService.includes("asset-create")?l.createElement(Ra,e):null!=e&&e.businessService.includes("ewst")?l.createElement(Ua,e):null!=e&&e.businessService.includes("booking-refund")?l.createElement(Ma,e):null!=e&&e.businessService.includes("street-vending")?l.createElement(za,e):null!=e&&e.businessService.includes("watertanker")||null!=e&&e.businessService.includes("mobileToilet")||null!=e&&e.businessService.includes("treePruning")?l.createElement(Ka,e):void 0;function Za(e){let{documents:n,svgStyles:t={},isSendBackFlow:i=!1,isHrLine:r=!1,titleStyles:u}=e;const{t:d}=o.useTranslation(),s=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!s&&(null==n?void 0:n.map((e,t)=>{var o;return l.createElement(l.Fragment,{key:t},null!=e&&e.title?l.createElement(a.CardSubHeader,{style:u||{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var t;return l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto",minWidth:"100px"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(a.PDFSvg,null)),l.createElement("p",{style:{marginTop:"8px",fontWeight:"bold",textAlign:"center",color:"#505A5F"}},d(null==e?void 0:e.title)),i?null!=e&&null!==(t=e.documentType)&&void 0!==t&&t.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},d(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))),r&&(null==n?void 0:n.length)!=t+1?l.createElement("hr",{style:{color:"#D6D5D4",backgroundColor:"#D6D5D4",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)})),s&&(null==n?void 0:n.map((e,n)=>{var o;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(a.CardSubHeader,{style:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},d(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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>l.createElement("a",{target:"_",href:null==e?void 0:e.url,style:{minWidth:null!=t&&t.minWidth?null==t?void 0:t.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"}},d(null==e?void 0:e.title)),null!=e&&e.docInfo?l.createElement("div",{style:{fontSize:"12px",color:"#505A5F",fontWeight:400,lineHeight:"15px",marginBottom:"10px"}},""+d(null==e?void 0:e.docInfo)):null,l.createElement(a.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400",textAlign:"center",color:"#505A5F"}},""+d(null==e?void 0:e.title))))):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,d("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})))}const $a=e=>{var n,o;let{t:i,formData:a,applicationData:r,docs:u,bpaActionsDetails:d}=e;const s=(null==r?void 0:r.status)||"",c=(null==d||null===(n=d.data)||void 0===n?void 0:n.nextActions)||[],v=Digit.ULBService.getStateId(),[p,m]=t.useState((null==a||null===(o=a.documents)||void 0===o?void 0:o.documents)||[]),[E,S]=t.useState(null),[_,f]=t.useState([]),[g,C]=t.useState(!0),[N,y]=t.useState(!1),[D,T]=t.useState(!1),{isLoading:h,data:A}=Digit.Hooks.obps.useMDMS(v,"BPA",["DocTypeMapping"]),{isLoading:I,data:O}=Digit.Hooks.obps.useMDMS(v,"common-masters",["DocumentType"]);return t.useEffect(()=>{var e,n,t,l;let o=[];var i,a;null!=A&&null!==(e=A.BPA)&&void 0!==e&&e.DocTypeMapping&&(o=null==A||null===(i=A.BPA)||void 0===i||null===(a=i.DocTypeMapping)||void 0===a?void 0:a.filter(e=>{var n,t;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===(n=r.additionalDetails)||void 0===n?void 0:n.serviceType)&&e.applicationType==(null==r||null===(t=r.additionalDetails)||void 0===t?void 0:t.applicationType)}));let d=[];null===(n=o)||void 0===n||null===(t=n[0])||void 0===t||null===(l=t.docTypes)||void 0===l||l.forEach(e=>{var n,t,l,o;let i=e.code;e.dropdownData=[],e.uploadedDocuments=[],null==O||null===(n=O["common-masters"])||void 0===n||null===(t=n.DocumentType)||void 0===t||t.forEach(n=>{let t=n.code.slice(0,i.length);i===t&&(e.hasDropdown=!0,n.i18nKey=n.code,e.dropdownData.push(n))}),e.uploadedDocuments[0]={},e.uploadedDocuments[0].values=[],null==u||null===(l=u[0])||void 0===l||null===(o=l.values)||void 0===o||o.map(n=>{var t,l;i===(null==n||null===(t=n.documentType)||void 0===t?void 0:t.split(".")[0])+"."+(null==n||null===(l=n.documentType)||void 0===l?void 0:l.split(".")[1])&&e.uploadedDocuments[0].values.push(n)}),d.push(e)}),sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(d)),f(d)},[!h,!I]),t.useEffect(()=>{let e=0;_.map(n=>{let t=!1;p.map(e=>{n.required&&n.code==e.documentType.split(".")[0]+"."+e.documentType.split(".")[1]&&(t=!0)}),!t&&n.required&&(e+=1)}),C("0"!=e&&0!=e||!(p.length>0))},[p,N]),t.useEffect(()=>{T("DOC_VERIFICATION_INPROGRESS"===s&&(null==c?void 0:c.length)>0)},[r,d]),l.createElement("div",null,null==_?void 0:_.map((e,n)=>l.createElement("div",null,l.createElement(Ja,{key:n,index:n,document:e,t:i,error:E,setError:S,setDocuments:m,documents:p,setCheckRequiredFields:y,applicationStatus:s,actions:c,bpaTaxDocuments:_,checkEnablingDocs:D}))))};function Ja(e){var n,o;let{t:i,document:r,setDocuments:u,documents:d,index:s,bpaTaxDocuments:c,checkEnablingDocs:p}=e;const m=null==d?void 0:d.filter(e=>{var n;return null==e||null===(n=e.documentType)||void 0===n?void 0:n.includes(null==r?void 0:r.code)})[0],E=Digit.ULBService.getStateId(),[S,_]=t.useState(m?v({},m,{active:!0,code:null==m?void 0:m.documentType,i18nKey:null==m?void 0:m.documentType}):1===(null==r||null===(n=r.dropdownData)||void 0===n?void 0:n.length)?null==r?void 0:r.dropdownData[0]:{}),[f,g]=t.useState(null),[C,N]=t.useState(()=>(null==m?void 0:m.fileStoreId)||null),[y,D]=t.useState([]);return t.useEffect(()=>{null!=S&&S.code&&u(e=>{var n;const t=null==e?void 0:e.filter(e=>(null==e?void 0:e.documentType)!==(null==S?void 0:S.code));return 0===(null==C?void 0:C.length)||null===C?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==C),{documentType:null==S?void 0:S.code,fileStoreId:C,documentUid:C,fileName:(null==f?void 0:f.name)||"",id:d?null===(n=d.find(e=>e.documentType===(null==S?void 0:S.code)))||void 0===n?void 0:n.id:void 0}]})},[C,S]),t.useEffect(()=>{try{y.length>0&&(sessionStorage.removeItem("BPA_DOCUMENTS"),r.newUploadedDocs=[],y.map(e=>{var n,t,l;null!=S&&S.code&&r.newUploadedDocs.push({documentType:null==S?void 0:S.code,fileStoreId:null==e||null===(n=e.fileStoreId)||void 0===n?void 0:n.fileStoreId,documentUid:null==e||null===(t=e.fileStoreId)||void 0===t?void 0:t.fileStoreId,tenantId:null==e||null===(l=e.fileStoreId)||void 0===l?void 0:l.tenantId})}),c[s]=r,sessionStorage.setItem("BPA_DOCUMENTS",JSON.stringify(c)))}catch(e){Promise.reject(e)}},[y,S]),t.useEffect(()=>{},[f]),l.createElement("div",{style:{marginBottom:"24px",maxWidth:"950px",minWidth:"280px",background:"#FAFAFA",borderRadius:"4px",border:"1px solid #D6D5D4",padding:"8px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},""+i(null==r?void 0:r.code)),(null==r||null===(o=r.uploadedDocuments)||void 0===o?void 0:o.length)&&l.createElement(Za,{documents:null==r?void 0:r.uploadedDocuments,svgStyles:{width:"100px",height:"100px",viewBox:"0 0 25 25",minWidth:"100px"}}),p?l.createElement("div",{style:{marginTop:"20px"}},l.createElement(a.LabelFieldPair,{style:{width:"100%"}},l.createElement(a.CardLabel,{style:{marginTop:"-10px",width:"100%"}},null!=r&&r.required?i(null==r?void 0:r.code)+"* ":""+i(null==r?void 0:r.code)),l.createElement(a.Dropdown,{className:"form-field",t:i,isMandatory:!1,option:null==r?void 0:r.dropdownData,selected:S,optionKey:"i18nKey",select:e=>_(e),style:{width:"100%"}})),l.createElement(a.LabelFieldPair,{style:{width:"100%"}},l.createElement(a.CardLabel,{className:"card-label-smaller",style:{width:"100%"}}),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(a.MultiUploadWrapper,{module:"BPA",tenantId:E,getFormState:e=>((e,n)=>{let t=Object.fromEntries(n),l=Object.values(t);0!==Object.keys(t).length&&D(l),function(e){e&&g(e.file)}(l[l.length-1])})(0,e),t:i,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"})))):null)}function Qa(e){let{fiReport:n,isCitizen:t=!1}=e;const{t:i}=o.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:{marginTop:"10px"}},l.createElement(t?a.CardHeader:a.CardSectionHeader,{style:{fontSize:"24px"}},""+i("BPA_FI_REPORT")),n.map((e,t)=>{var o,r,u,d,s,c;return l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px",marginBottom:"24px"}},l.createElement(a.StatusTable,null,l.createElement(a.CardSectionHeader,{style:{fontSize:"20px"}},1==(null==n?void 0:n.length)?""+i("BPA_FI_REPORT"):i("BPA_FI_REPORT")+" - "+(t+1)),l.createElement(a.Row,{className:"border-none",label:""+i("BPA_FI_DATE_LABEL"),text:null!=e&&e.date?e.date.includes("-")?(null===(o=e.date)||void 0===o?void 0:o.split("-")[2])+"/"+(null===(r=e.date)||void 0===r?void 0:r.split("-")[1])+"/"+(null===(u=e.date)||void 0===u?void 0:u.split("-")[0]):null==e?void 0:e.date:"NA"}),l.createElement(a.Row,{className:"border-none",label:""+i("BPA_FI_TIME_LABEL"),text:null!=e&&e.time?null==e?void 0:e.time:"NA"}),(null==e||null===(d=e.questions)||void 0===d?void 0:d.length)&&(null==e||null===(s=e.questions)||void 0===s?void 0:s.map(e=>l.createElement("div",{style:{background:"white",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",marginTop:"10px"}},l.createElement(a.Row,{className:"border-none",label:""+i(""+e.question),text:null!=e&&e.value?null==e?void 0:e.value:"NA"}),l.createElement(a.Row,{className:"border-none",label:""+i("BPA_ENTER_REMARKS"),text:e.remarks?e.remarks:"NA"})))),l.createElement(Za,{documents:(c=null==e?void 0:e.docs,[{title:"BPA_DOCUMENT_DETAILS_LABEL",values:null==c?void 0:c.map(e=>{var n;return{title:null==e||null===(n=e.documentType)||void 0===n?void 0:n.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 er(e){let{t:n,document:o,setNocDocuments:i,setError:r,nocDocuments:u}=e;const d=null==u?void 0:u.filter(e=>{var n;return null==e||null===(n=e.documentType)||void 0===n?void 0:n.includes(null==o?void 0:o.code)})[0],s=Digit.ULBService.getStateId(),[c,v]=t.useState(),[p,m]=t.useState(null),[E,S]=t.useState(()=>(null==d?void 0:d.fileStoreId)||null);return t.useEffect(()=>{var e,n;null!=o&&null!==(e=o.dropdownData)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.code&&i(e=>{var n;const t=null==e?void 0:e.filter(e=>{var n,t;return(null==e?void 0:e.documentType)!==(null==o||null===(n=o.dropdownData)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.code)});return 0===(null==E?void 0:E.length)||null===E?t:[...null==t?void 0:t.filter(e=>(null==e?void 0:e.fileStoreId)!==E),{documentType:null==o||null===(n=o.dropdownData)||void 0===n?void 0:n[0].code,fileStoreId:E,documentUid:E,fileName:(null==p?void 0:p.name)||""}]})},[E]),t.useEffect(()=>{!function(){try{r(null);const e=function(){if(p){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,t=function(){if(p.size>=5242880)r(n("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const t=function(){if(null!=p&&p.type&&!e.test(null==p?void 0:p.type))r(n("NOT_SUPPORTED_FILE_TYPE"));else{const e=Ji(function(){return S(null),Promise.resolve(Digit.UploadServices.Filestorage("PT",p,Digit.ULBService.getStateId())).then(function(e){var t,l,o,i;(null==e||null===(t=e.data)||void 0===t||null===(l=t.files)||void 0===l?void 0:l.length)>0?S(null==e||null===(o=e.data)||void 0===o||null===(i=o.files[0])||void 0===i?void 0:i.fileStoreId):r(n("CS_FILE_UPLOAD_ERROR"))})},function(){r(n("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)}}()},[p]),l.createElement("div",{style:{}},l.createElement(a.LabelFieldPair,{style:{width:"98%",marginRight:"10px"}},l.createElement(a.CardLabel,{style:{width:"100%"}},null!=o&&o.required?n("TL_BUTTON_UPLOAD FILE")+"*":""+n("TL_BUTTON_UPLOAD FILE")),l.createElement("div",{className:"field",style:{width:"100%"}},l.createElement(a.MultiUploadWrapper,{module:"NOC",tenantId:s,getFormState:e=>(e=>{let n=Object.fromEntries(e),t=Object.values(n);!function(e){e&&m(e.file)}(t[t.length-1])})(e),t:n,allowedFileTypesRegex:/(.*?)(jpg|jpeg|png|image|pdf)$/i,allowedMaxSizeInMB:5,acceptFiles:"image/*, .pdf, .png, .jpeg, .jpg"}))))}const nr=e=>{var n;let{t:o,noc:i,docs:r,isNoc:u,applicationData:d,NOCdata:s,bpaActionsDetails:c}=e;Digit.ULBService.getStateId();const v=Digit.ULBService.getStateId(),p=(null==d?void 0:d.status)||"",m=(null==c||null===(n=c.data)||void 0===n?void 0:n.nextActions)||[],{data:E}=Digit.Hooks.obps.useMDMS(v,"NOC",["DocumentTypeMapping"],{enabled:u}),{data:S}=Digit.Hooks.obps.useMDMS(v,"BPA",["DocTypeMapping"],{enabled:!u}),{data:_}=Digit.Hooks.obps.useMDMS(v,"common-masters",["DocumentType"]),[f,g]=t.useState([]),[C,N]=t.useState([]),[y,D]=t.useState(!1),[T,h]=Digit.Hooks.useSessionStorage(null==i?void 0:i.nocType,[]),[A,I]=t.useState(null),O=window.location.href.includes("/employee/");return t.useEffect(()=>{var e;g(null==_||null===(e=_["common-masters"])||void 0===e?void 0:e.DocumentType)},[_]),t.useEffect(()=>{var e,n,t;let l,o=[];var a,r,s,c;l=u?null==E||null===(a=E.NOC)||void 0===a||null===(r=a.DocumentTypeMapping)||void 0===r?void 0:r.filter(e=>(null==e?void 0:e.applicationType)===(null==i?void 0:i.applicationType)&&(null==e?void 0:e.nocType)===(null==i?void 0:i.nocType)):null==S||null===(s=S.BPA)||void 0===s||null===(c=s.DocTypeMapping)||void 0===c?void 0:c.filter(e=>{var n,t;return e.WFState==(null==d?void 0:d.status)&&e.RiskType==(null==d?void 0:d.riskType)&&e.ServiceType==(null==d||null===(n=d.additionalDetails)||void 0===n?void 0:n.serviceType)&&e.applicationType==(null==d||null===(t=d.additionalDetails)||void 0===t?void 0:t.applicationType)}),null!==(e=l)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&null!==(t=n.docTypes)&&void 0!==t&&t[0]&&(l[0].docTypes[0].nocType=l[0].nocType,l[0].docTypes[0].additionalDetails={submissionDetails:null==i?void 0:i.additionalDetails,applicationStatus:null==i?void 0:i.applicationStatus,appNumberLink:null==i?void 0:i.applicationNo,nocNo:null==i?void 0:i.nocNo},o.push(l[0].docTypes[0]));let v=[];o&&o.length>0&&(o.map(e=>{let n=e.documentType;e.dropdownData=[],null==f||f.forEach(t=>{let l=t.code.slice(0,null==n?void 0:n.length);n===l&&(e.hasDropdown=!0,e.dropdownData.push(t))}),v.push(e)}),N(v))},[E,f]),t.useEffect(()=>{D("NOC_VERIFICATION_INPROGRESS"===p&&(null==m?void 0:m.length)>0)},[d,c]),l.createElement("div",{style:{border:"1px solid #D6D5D4",padding:"16px 0px 16px 8px",background:"#FAFAFA",borderRadius:"5px",marginBottom:"24px",maxWidth:"950px"}},l.createElement(a.StatusTable,null,l.createElement(a.Row,{label:O?""+o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"):o("BPA_"+(null==i?void 0:i.nocType)+"_HEADER"),labelStyle:{fontSize:"20px",width:"150%"}}),s&&s.map((e,n)=>{if(null!=e&&e.value)return l.createElement(a.Row,"STATUS"==(null==e?void 0:e.field)?{className:"border-none",label:O?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(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?""+o(null==e?void 0:e.title):o(null==e?void 0:e.title),text:o(null!=e&&e.value?null==e?void 0:e.value:"CS_NA")})})),l.createElement(Za,{documents:r,svgStyles:{width:"80px",height:"100px",viewBox:"0 0 25 25",minWidth:"80px"}}),y&&(null==C?void 0:C.map((e,n)=>l.createElement(er,{key:n,document:e,t:o,error:A,setError:I,setNocDocuments:h,nocDocuments:T,checkEnablingDocs:y}))))},tr=e=>{let{permissions:n,t:o}=e;const[i,r,u]=Digit.Hooks.useSessionStorage("OBPS_APPROVAL_CHECKS",null==n?void 0:n.map(e=>({label:e,checked:!1}))),[d,s,c]=Digit.Hooks.useSessionStorage("OBPS_NEW_APPROVALS",[]);t.useEffect(()=>()=>{Digit.SessionStorage.del("OBPS_NEW_APPROVALS"),Digit.SessionStorage.del("OBPS_APPROVAL_CHECKS")},[]);const p=window.Digit.Utils.browser.isMobile();return l.createElement("div",null,l.createElement(a.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},o("BPA_PERMIT_CONDITIONS")),null==i?void 0:i.map((e,n)=>l.createElement(a.CheckBox,{key:n,styles:{margin:"20px 0 40px",maxWidth:p?"100%":"70%"},label:null==e?void 0:e.label,checked:null==e?void 0:e.checked,onChange:e=>((e,n,t)=>{const l=e.target.checked;r(()=>null==i?void 0:i.map((e,n)=>t===n?v({},e,{checked:l}):e))})(e,0,n),isLabelFirst:!0,index:n})),null==d?void 0:d.map((e,n)=>l.createElement("div",null,l.createElement(a.TextInput,{key:n,value:null==e?void 0:e.label,onChange:e=>((e,n)=>{s(()=>null==d?void 0:d.map((t,l)=>{var o;return n===l?{label:null==e||null===(o=e.target)||void 0===o?void 0:o.value}:t}))})(e,n),textInputStyle:{maxWidth:p?"96%":"830px",width:p?"96%":"830px"},style:p?{paddingRight:"10%"}:{},placeholder:o("BPA_ENTER_PERMIT_CONDITIONS_LABEL")}),l.createElement(a.LinkButton,{label:l.createElement("div",null,l.createElement("span",null,l.createElement(a.Close,{style:{float:"right",position:"relative",bottom:"32px",marginTop:"-22px",marginRight:p?"5%":"35%"}}))),style:{},onClick:e=>(e=>{const n=[...d];n.splice(e,1),s([...n])})(n)}))),l.createElement(a.LinkButton,{style:{color:"#a82227",maxWidth:p?"fit-content":"10%",marginRight:"3%"},label:o("BPA_ADD_MORE"),onClick:()=>{s([...d,{label:""}])}}))};function lr(e){let{documents:n,svgStyles:i={},isSendBackFlow:r=!1}=e;const{t:u}=o.useTranslation(),[d,s]=t.useState(()=>[]),[c,v]=(Digit.ULBService.getCurrentTenantId(),t.useState({}));t.useEffect(()=>{var e;let t=[];null==n||n.forEach((e,n,l)=>{t=[...t,...e.values?e.values:[]]}),s(null===(e=t)||void 0===e?void 0:e.map(e=>null==e?void 0:e.fileStoreId))},[n]),t.useEffect(()=>{var e;null!=d&&d.length&&"BillAmend"===(null==n||null===(e=n[0])||void 0===e?void 0:e.BS)?Digit.UploadServices.Filefetch(d,Digit.ULBService.getCurrentTenantId()).then(e=>{v(null==e?void 0:e.data)}):null!=d&&d.length&&Digit.UploadServices.Filefetch(d,Digit.ULBService.getStateId()).then(e=>{v(null==e?void 0:e.data)})},[d]);const p=window.location.href.includes("employee/tl")||window.location.href.includes("/obps")||window.location.href.includes("employee/ws"),m=window.location.href.includes("stakeholder");return l.createElement("div",{style:{marginTop:"19px"}},!m&&(null==n?void 0:n.map((e,n)=>{var t;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(a.CardSubHeader,{style:p?{marginTop:"32px",marginBottom:"18px",color:"#0B0C0C, 100%",fontSize:"24px",lineHeight:"30px"}:{marginTop:"32px",marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},u(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===(t=e.values)||void 0===t?void 0:t.map((e,n)=>{var t,o;return l.createElement("a",{target:"_",href:null===(t=c[e.fileStoreId])||void 0===t?void 0:t.split(",")[0],style:{minWidth:"80px",marginRight:"10px",maxWidth:"100px",height:"auto"},key:n},l.createElement("div",{style:{display:"flex",justifyContent:"center"}},l.createElement(a.PDFSvg,null)),l.createElement("p",{style:p?{marginTop:"8px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F",textAlign:"center"}:{marginTop:"8px",fontWeight:"bold"}},u(null==e?void 0:e.title)),r?null!=e&&null!==(o=e.documentType)&&void 0!==o&&o.includes("NOC")?l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType.split(".")[1])):l.createElement("p",{style:{textAlign:"center"}},u(null==e?void 0:e.documentType)):"")}):!window.location.href.includes("citizen")&&l.createElement("div",null,l.createElement("p",null,u("BPA_NO_DOCUMENTS_UPLOADED_LABEL")))))})),m&&(null==n?void 0:n.map((e,n)=>{var t;return l.createElement(l.Fragment,{key:n},null!=e&&e.title?l.createElement(a.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===(t=e.values)||void 0===t?void 0:t.map((e,n)=>{var t;return l.createElement("a",{target:"_",href:null===(t=c[e.fileStoreId])||void 0===t?void 0:t.split(",")[0],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(a.PDFSvg,null),l.createElement("p",{style:{marginTop:"8px",fontSize:"16px",lineHeight:"19px",color:"#505A5F",fontWeight:"400"}},""+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")))))})))}function or(e){let{taxHeadEstimatesCalculation:n}=e;const{taxHeadEstimates:t}=n,{t:i}=o.useTranslation();return l.createElement("div",{style:{marginTop:"40px"}},l.createElement(a.StatusTable,null,l.createElement(a.Row,{label:i("ES_PT_TITLE_TAX_HEADS"),text:i("ES_PT_TITLE_AMOUNT"),className:"border-none",textStyle:{fontWeight:"bold"}}),l.createElement(a.BreakLine,{style:{margin:"16px 0",width:"40%"}}),null==t?void 0:t.map((e,n)=>l.createElement(a.Row,{key:i(e.taxHeadCode),label:i(e.taxHeadCode),text:"₹ "+e.estimateAmount||"N/A",last:n===(null==t?void 0:t.length)-1,className:"border-none",textStyle:{color:"#505A5F"},labelStyle:{color:"#505A5F"}})),l.createElement(a.BreakLine,{style:{margin:"16px 0",width:"40%"}}),l.createElement(a.Row,{label:i("ES_PT_TITLE_TOTAL_DUE_AMOUNT"),text:"₹ "+(null==n?void 0:n.totalAmount)||"N/A",className:"border-none",textStyle:{fontSize:"24px",fontWeight:"bold"}})))}function ir(e){let{floors:n}=e;const{t:t}=o.useTranslation();return l.createElement(l.Fragment,null,n.map(e=>{var n;return l.createElement("div",{key:t(null==e?void 0:e.title),style:{marginTop:"19px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},t(null==e?void 0:e.title)),null==e||null===(n=e.values)||void 0===n?void 0:n.map((e,n)=>{var o;return l.createElement(l.Fragment,{key:n},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",color:"#505A5F",fontSize:"16px",marginTop:0!==n?"16px":"revert"}},t(e.title)),l.createElement(a.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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var o;return l.createElement(a.Row,!0===e.map&&"N/A"!==e.value?{key:t(e.title),label:t(e.title),text:l.createElement("img",{src:t(e.value),alt:""})}:{key:t(e.title),label:t(e.title),text:t(e.value)||"N/A",last:n===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none"})}))))}))}))}function ar(e){let{owners:n}=e,t={};t=window.location.href.includes("/employee/pt/")?n.slice().reverse():n;const{t:i}=o.useTranslation(),r=(null==n?void 0:n.length)||1;let u={marginTop:"19px"},d={position:"relative",padding:"8px"},s={justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"};return Number(r)>1?u={marginTop:"19px",background:"#FAFAFA",border:"1px solid #D6D5D4",borderRadius:"4px",padding:"8px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:Number(r)>1||(u={marginTop:"19px",lineHeight:"19px",maxWidth:"600px",minWidth:"280px"},d={position:"relative",marginTop:"19px"}),window.location.href.includes("obps")&&(u=v({},u,{maxWidth:"950px"}),u=v({},u,{maxWidth:"950px"}),s={}),n.sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}),l.createElement(l.Fragment,null,l.createElement("div",{className:"owner-details"},t.map((e,n)=>{var t;return l.createElement("div",{key:i(null==e?void 0:e.title),style:u,className:"owner-details-child"},l.createElement(a.CardSubHeader,{style:Number(r)>1?{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}:{marginBottom:"8px",color:"#505A5F",fontSize:"24px"}},Number(r)>1?i(null==e?void 0:e.title)+" "+(n+1):i(null==e?void 0:e.title)),l.createElement(l.Fragment,{key:n},l.createElement(a.StatusTable,{style:d},l.createElement("div",{style:{maxWidth:"640px",top:0,left:0,bottom:0,right:0,width:"auto"}}),null==e||null===(t=e.values)||void 0===t?void 0:t.map((e,n)=>{var t;return!0===e.map&&"N/A"!==e.value?l.createElement(a.Row,{key:i(e.title),label:i(e.title),text:l.createElement("img",{src:i(e.value),alt:"",privacy:null==e?void 0:e.privacy})}):l.createElement("span",null,l.createElement(a.Row,{key:i(e.title),label:""+i(e.title),text:i(e.value)||"N/A",last:n===(null==e||null===(t=e.values)||void 0===t?void 0:t.length)-1,caption:e.caption,className:"border-none",textStyle:e.textStyle,privacy:null==e?void 0:e.privacy,rowContainerStyle:s}))}))))})))}const rr=e=>{var n,i,r;let{scrutinyDetails:u,paymentsList:d=[]}=e;const{t:s}=o.useTranslation(),c=e=>null!=e&&e.value&&null!=e&&e.isTransLate?l.createElement("span",{style:{color:"#00703C"}},s(null==e?void 0:e.value)):null!=e&&e.value&&null!=e&&e.isTransLate?s(null==e?void 0:e.value):null!=e&&e.value?null==e?void 0:e.value:void s("NA");return l.createElement(t.Fragment,null,!(null!=u&&u.isChecklist)&&l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px"}},l.createElement(a.StatusTable,null,l.createElement("div",null,null==u||null===(n=u.values)||void 0===n?void 0:n.map((e,n)=>null!=e&&e.isUnit?l.createElement(a.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:""+s(""+e.title),text:null!=e&&e.value?c(e)+" "+s(null==e?void 0:e.isUnit):s("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(a.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:""+s(""+e.title),text:c(e),labelStyle:null!=e&&e.isHeader?{fontSize:"20px"}:{}}):l.createElement(a.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px",margin:"0px"}},s(null==e?void 0:e.title)):l.createElement(a.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},s(null==e?void 0:e.title))),null==u||null===(i=u.permit)||void 0===i?void 0:i.map((e,n)=>l.createElement(a.CardLabel,{style:{fontWeight:"400"}},null==e?void 0:e.title))),l.createElement("div",null,null==u||null===(r=u.scruntinyDetails)||void 0===r?void 0:r.map((e,n)=>l.createElement(t.Fragment,null,l.createElement(a.Row,{className:"border-none",label:""+s(null==e?void 0:e.title),labelStyle:{width:"150%"}}),l.createElement("a",{href:null==e?void 0:e.value}," ",l.createElement(a.PDFSvg,null)," "),l.createElement("p",{style:{margin:"8px 0px",fontWeight:"bold",fontSize:"16px",lineHeight:"19px",color:"#505A5F"}},s(null==e?void 0:e.text))))))))},ur=e=>{var n,i,r,u,d,s,c,v,p;let{edcrDetails:m,applicationData:E}=e;const{t:S}=o.useTranslation(),_=window.Digit.Utils.browser.isMobile(),f=[{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"},{name:"BPA_TABLE_COL_CARPETAREA",id:"CarpetArea"}],g=e=>{const n=e;return(e,t,l)=>e[n]},C=t.useMemo(()=>f.map(e=>({Header:S(""+e.name),accessor:g(e.id),id:e.id})));function N(e){var n;let t=[];return null==e||null===(n=e.building)||void 0===n||n.floors.map(e=>{var n,l,o,i,a,r,u,d;t.push({Floor:(null==e?void 0:e.floorName)||S("BPA_FLOOR_NAME_"+e.number),Level:(null==e?void 0:e.number)||(null==e?void 0:e.floorNo),Occupancy:S(""+("BPA-PAP"===(null==E?void 0:E.businessService)?"Residential":null===(n=e.occupancies)||void 0===n||null===(l=n[0])||void 0===l?void 0:l.type))||"NA",BuildupArea:(null==e||null===(o=e.occupancies)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.builtUpArea)||(null==e?void 0:e.builtUpArea),FloorArea:(null==e||null===(a=e.occupancies)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.floorArea)||(null==e?void 0:e.builtUpArea),CarpetArea:(null==e||null===(u=e.occupancies)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.carpetArea)||0,key:(null==e?void 0:e.floorName)||S("BPA_FLOOR_NAME_"+e.number)})}),t}function y(e){var n;let t=null==E||null===(n=E.landInfo)||void 0===n?void 0:n.unit,l="";if((null==t?void 0:t.length)>0){var o,i;let n=null===(o=t[e])||void 0===o||null===(i=o.usageCategory)||void 0===i?void 0:i.split(",");null!=n&&n.length&&(l=n.map(e=>e?""+S("BPA_SUBOCCUPANCYTYPE_"+function(e,n,t){if(void 0===e&&(e=""),void 0===n&&(n=""),void 0===t&&(t=""),""==n)return e;for(;e.includes(n);)e=e.replace(n,t);return e}(null==e?void 0:e.toUpperCase(),"-","_")):"NA").join(", "))}return l||"NA"}return l.createElement(t.Fragment,null,l.createElement("div",{style:{background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}},l.createElement(a.StatusTable,null,null==m||null===(n=m.values)||void 0===n?void 0:n.map((e,n)=>null!=e&&e.isHeader?l.createElement(a.CardSubHeader,{style:{fontSize:"20px",paddingBottom:"10px"}},S(null==e?void 0:e.title)):l.createElement(a.Row,{className:"border-none",labelStyle:{width:"100%",fontSize:"20px"},key:""+e.title,label:""+S(""+e.title),text:null!=e&&e.value?null==e?void 0:e.value:""}))),null==m||null===(i=m.subOccupancyTableDetails)||void 0===i||null===(r=i[0])||void 0===r||null===(u=r.value)||void 0===u||null===(d=u.planDetail)||void 0===d?void 0:d.blocks.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:n,style:(null==m||null===(t=m.subOccupancyTableDetails)||void 0===t||null===(o=t[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.planDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},S("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+S("BPA_SUB_OCCUPANCY_LABEL"),text:y(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||_?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(a.Table,{className:"customTable table-fixed-first-column table-border-style",t:S,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:N(e),columns:C,getCellProps:e=>({style:{}})})))}),null==m||null===(s=m.subOccupancyTableDetails)||void 0===s||null===(c=s[0])||void 0===c||null===(v=c.value)||void 0===v||null===(p=v.drawingDetail)||void 0===p?void 0:p.blocks.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:n,style:(null==m||null===(t=m.subOccupancyTableDetails)||void 0===t||null===(o=t[0])||void 0===o||null===(i=o.value)||void 0===i||null===(r=i.drawingDetail)||void 0===r||null===(u=r.blocks)||void 0===u?void 0:u.length)>0?{marginBottom:"30px",background:"#FAFAFA",border:"1px solid #D6D5D4",padding:"8px",borderRadius:"4px",maxWidth:"950px",minWidth:"280px"}:{marginBottom:"30px"}},l.createElement(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"18px",lineHeight:"19px"}},S("BPA_BLOCK_SUBHEADER")," ",n+1),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:{wordBreak:"break-word"},label:""+S("BPA_SUB_OCCUPANCY_LABEL"),text:y(n)})),l.createElement("div",{style:window.location.href.includes("citizen")||_?{overflow:"scroll"}:{maxWidth:"950px",maxHeight:"280px"}},l.createElement(a.Table,{className:"customTable table-fixed-first-column table-border-style",t:S,disableSort:!1,autoSort:!0,manualPagination:!1,isPaginationRequired:!1,initSortId:"S N ",data:N(e),columns:C,getCellProps:e=>({style:{}})})))})))},dr=e=>{let{headComment:n,otherComment:t}=e;return l.createElement("div",{className:"checkpoint-comments-wrap"},l.createElement("h4",null,n),l.createElement("p",null,t))},sr=e=>{var n,t,i;let{data:r,OpenImage:u,privacy:d={}}=e;const{t:s}=o.useTranslation();return l.createElement("div",null,r.date&&l.createElement("p",null,r.date),l.createElement("p",null,r.name),r.mobileNumber&&l.createElement("span",{style:{display:"inline-flex",width:"fit-content",marginLeft:"10px"}},l.createElement(a.TelePhone,{mobile:r.mobileNumber,privacy:d}),l.createElement("p",null," ")),r.source&&l.createElement("p",null,s("ES_APPLICATION_DETAILS_APPLICATION_CHANNEL_"+r.source.toUpperCase())),r.comment&&l.createElement(dr,{otherComment:null==r?void 0:r.otherComment,headComment:null==r?void 0:r.comment}),null!=r&&r.wfComment?l.createElement("div",null,null==r||null===(n=r.wfComment)||void 0===n?void 0:n.map(e=>l.createElement("div",{className:"TLComments"},l.createElement("h3",null,s("WF_COMMON_COMMENTS")),l.createElement("p",{style:{overflowX:"scroll"}},e)))):null,(null==r||null===(t=r.thumbnailsToShow)||void 0===t||null===(i=t.thumbs)||void 0===i?void 0:i.length)>0?l.createElement("div",{className:"TLComments"},l.createElement("h3",null,s("CS_COMMON_ATTACHMENTS")),l.createElement(a.DisplayPhotos,{srcs:null==r?void 0:r.thumbnailsToShow.thumbs,onClick:(e,n)=>{u(e,n,null==r?void 0:r.thumbnailsToShow)}})):null)};function cr(e){let{units:n}=e;const{t:t}=o.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var o;return l.createElement("div",{key:t(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(a.CardSubHeader,{style:{marginBottom:"8px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},t(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(a.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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var o;return l.createElement(a.Row,!0===e.map&&"N/A"!==e.value?{key:t(e.title),label:t(e.title),text:l.createElement("img",{src:t(e.value),alt:""})}:{key:t(e.title),label:t(e.title)+":",text:t(e.value)||"N/A",last:n===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}function vr(e){let{units:n}=e;const{t:t}=o.useTranslation();return l.createElement(l.Fragment,null,n.map((e,n)=>{var o;return l.createElement("div",{key:t(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(a.CardSubHeader,{style:{marginBottom:"9px",paddingBottom:"9px",color:"#0B0C0C",fontSize:"16px",lineHeight:"19px"}},t(null==e?void 0:e.title)+" "+(n+1)),l.createElement(l.Fragment,{key:n},l.createElement(a.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===(o=e.values)||void 0===o?void 0:o.map((e,n)=>{var o;return l.createElement(a.Row,!0===e.map&&"N/A"!==e.value?{key:t(e.title),label:t(e.title),text:l.createElement("img",{src:t(e.value),alt:""})}:{key:t(e.title),label:t(e.title)+":",text:t(e.value)||"NA",last:n===(null==e||null===(o=e.values)||void 0===o?void 0:o.length)-1,caption:e.caption,className:"border-none",rowContainerStyle:{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}})}))))}))}const pr=e=>{var n,i,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=o.useTranslation();let c=g(location.search);const v=null==c?void 0:c.mode;var{connectionDetails:p,plumberDetails:m,roadCuttingDetails:E,activationDetails:S}=(null==d?void 0:d.additionalDetails)||{connectionDetails:[],plumberDetails:[]};return l.createElement(t.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},(null==d||null===(n=d.additionalDetails)||void 0===n?void 0:n.connectionDetails)&&l.createElement(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_COMMON_CONNECTION_DETAIL")),l.createElement("div",null,l.createElement("div",{className:"connection-details-new-value-wrapper"},null==p?void 0:p.map((e,n)=>l.createElement("div",null,l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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===(i=d.additionalDetails)||void 0===i?void 0:i.plumberDetails)&&"MODIFY"!=v&&l.createElement(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_COMMON_PLUMBER_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==m?void 0:m.map((e,n)=>l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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"!=v&&l.createElement(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_ROAD_CUTTING_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==E?void 0:E.map(e=>{var n;return l.createElement("div",{style:(null==E?void 0:E.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(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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(a.StatusTable,null,l.createElement(a.CardSubHeader,{style:{fontSize:"24px",marginBottom:"16px",marginTop:"32px"}},s("WS_ACTIVATION_DETAILS")),l.createElement("div",null,l.createElement("div",{className:"plumber-details-new-value-wrapper"},null==S?void 0:S.map((e,n)=>l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+e.title),text:null!=e&&e.oldValue?null==e?void 0:e.oldValue:null!=e&&e.value?null==e?void 0:e.value:""})))))))},mr=[{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"}],Er=[{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"}],Sr=e=>{var n,i,r,u;let{wsAdditionalDetails:d}=e;const{t:s}=o.useTranslation(),[c,p,m]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[E,S,f]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),g=!(null==d||null===(n=d.additionalDetails)||void 0===n||!n.isPaid),[C,N]=t.useState(!1),[y,D]=t.useState(c||{}),[T,h]=t.useState(null),[A,I]=t.useState(d.additionalDetails.data?d.additionalDetails.data:{}),[O,b]=t.useState(d.additionalDetails.values?d.additionalDetails.values:[]),L=Digit.ULBService.getStateId();Digit.Hooks.ws.useMDMS(L,"BillingService",["TaxHeadMaster"]),t.useEffect(()=>{var e,n,t;const o=v({},null==d||null===(e=d.additionalDetails)||void 0===e||null===(n=e.appDetails)||void 0===n?void 0:n.additionalDetails);if((null==c||null===(t=c.billDetails)||void 0===t?void 0:t.length)>0){var i,a,r,u,s,m,E;const e=[{title:"WS_APPLICATION_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(i=c.billDetails)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.fee)},{title:"WS_SERVICE_FEE_HEADER",value:l.createElement("span",null,"₹",null==c||null===(r=c.billDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.charge)},{title:"WS_TAX_HEADER",value:l.createElement("span",null,"₹",null==c||null===(s=c.billDetails)||void 0===s||null===(m=s[0])||void 0===m?void 0:m.taxAmount)}];b(e),I(null==c||null===(E=c.billDetails)||void 0===E?void 0:E[0])}else p(o),D(o)},[]);let R={};const w=e=>l.createElement("h1",{className:"heading-m"},e.label),W=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#FFFFFF"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})),P=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(W,null)),M=function(e,n,t){void 0===n&&(n=!1);let l=v({},y);if("adhocPenalty"!=e&&"adhocRebate"!=e||!t.target.value)n?(l[e+"_data"]=t,l[e]=t.title,"PT_OTHERS"==t.title&&"adhocPenaltyReason"==e&&(l.adhocPenaltyComment=""),"PT_OTHERS"==t.title&&"adhocRebateReason"==e&&(l.adhocRebateComment="")):l[e]=t.target.value;else{var o,i;const n=0==(null==t||null===(o=t.target)||void 0===o?void 0:o.value)?1:Math.sign(null==t||null===(i=t.target)||void 0===i?void 0:i.value)||-1;l[e]=1==n?t.target.value:""}D(l)};return l.createElement(t.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},O&&l.createElement(a.StatusTable,null,l.createElement("div",null,null==O?void 0:O.map((e,n)=>l.createElement(a.Row,{className:"border-none",key:""+e.title,label:""+s(""+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(a.Row,{className:"border-none",key:"WS_COMMON_TOTAL_AMT",label:""+s("WS_COMMON_TOTAL_AMT"),text:l.createElement("span",null,"₹",(null==A?void 0:A.totalAmount)||0),textStyle:{fontSize:"24px",fontWeight:"700"}}),l.createElement(a.Row,{className:"border-none",key:"CS_INBOX_STATUS_FILTER",label:""+s("CS_INBOX_STATUS_FILTER"),text:s(g?"WS_COMMON_PAID_LABEL":"WS_COMMON_NOT_PAID"),textStyle:g?{color:"#00703C"}:{color:"#D4351C"}}))),null!=d&&null!==(i=d.additionalDetails)&&void 0!==i&&i.isAdhocRebate?l.createElement("div",{onClick:e=>{N(!0)}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},s("WS_PAYMENT_ADD_REBATE_PENALTY"))):null,C&&l.createElement(a.Modal,{headerBarMain:l.createElement(w,{label:s("PT_ADD_REBATE_PENALITY")}),headerBarEnd:l.createElement(P,{onClick:()=>{D(c),N(!1)}}),actionCancelLabel:s("PT_CANCEL"),actionCancelOnSubmit:()=>{D(c),N(!1)},actionSaveLabel:s("PT_ADD"),actionSaveOnSubmit:e=>(e=>{const n=null!=y&&y.adhocPenalty?Number(null==y?void 0:y.adhocPenalty):0,t=null!=y&&y.adhocRebate?Number(null==y?void 0:y.adhocRebate):0;var l,o;if(n||t)if(t>(null==d||null===(l=d.additionalDetails)||void 0===l||null===(o=l.data)||void 0===o?void 0:o.totalAmount))h({isError:!1,isWarning:!0,key:"error",message:s("ERR_WS_REBATE_GREATER_THAN_AMOUNT")});else{var i,a,r,u,c,m,E,f,g,C;const e=null==d||null===(i=d.additionalDetails)||void 0===i||null===(a=i.appDetails)||void 0===a?void 0:a.applicationNo,n=null==d||null===(r=d.additionalDetails)||void 0===r||null===(u=r.appDetails)||void 0===u?void 0:u.tenantId,t=v({},null==d||null===(c=d.additionalDetails)||void 0===c||null===(m=c.appDetails)||void 0===m?void 0:m.additionalDetails,y);d.additionalDetails.appDetails.additionalDetails=t;const l={CalculationCriteria:"WATER"==(null==d||null===(E=d.additionalDetails)||void 0===E||null===(f=E.appDetails)||void 0===f?void 0:f.service)?[{applicationNo:e,tenantId:n,waterConnection:d.additionalDetails.appDetails}]:[{applicationNo:e,tenantId:n,sewerageConnection:d.additionalDetails.appDetails}],isconnectionCalculation:!1};let o="WATER"==(null==d||null===(g=d.additionalDetails)||void 0===g||null===(C=g.appDetails)||void 0===C?void 0:C.service)?"WS":"SW";Digit.WSService.wsCalculationEstimate(l,o).then((e,n)=>{var t,l,o,i,a,r,u,d,s,c,v,m,E,f,g;(null==e||null===(t=e.Calculation)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.taxHeadEstimates)||void 0===o?void 0:o.length)>0&&(null==e||null===(E=e.Calculation)||void 0===E||null===(f=E[0])||void 0===f||null===(g=f.taxHeadEstimates)||void 0===g||g.forEach(e=>e.amount=e.estimateAmount)),e.Calculation[0].billSlabData=_.groupBy(null==e||null===(i=e.Calculation)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.taxHeadEstimates,"category");const C=[{title:"WS_APPLICATION_FEE_HEADER",value:null===(r=e.Calculation)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.fee},{title:"WS_SERVICE_FEE_HEADER",value:null===(d=e.Calculation)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.charge},{title:"WS_TAX_HEADER",value:null===(c=e.Calculation)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.taxAmount}];S(Lt(e.Calculation[0])),I(null==e||null===(m=e.Calculation)||void 0===m?void 0:m[0]),b(C),y.billDetails=null==e?void 0:e.Calculation,p(y),N(!1)}).catch(e=>{var n,t,l,o,i,a;h({isError:!0,isWarning:!1,key:"error",message:null!=e&&null!==(n=e.response)&&void 0!==n&&null!==(t=n.data)&&void 0!==t&&null!==(l=t.Errors[0])&&void 0!==l&&l.message?s(""+(null==e||null===(o=e.response)||void 0===o||null===(i=o.data)||void 0===i||null===(a=i.Errors[0])||void 0===a?void 0:a.code)):s("PT_COMMON_ADD_REBATE_PENALITY")})})}else h({isError:!1,isWarning:!0,key:"warning",message:s("ERR_WS_ENTER_ATLEAST_ONE_FIELD")})})(),hideSubmit:!1,popupStyles:{overflowY:"auto"}},l.createElement("div",null,l.createElement(a.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(a.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_PENALTY")),l.createElement(a.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{isMandatory:!0,option:mr,optionKey:"title",select:e=>M("adhocPenaltyReason",!0,e),selected:(null==y?void 0:y.adhocPenaltyReason_data)||"",isPropertyAssess:!0,name:"adhocPenaltyReason_data",t:s})),"PT_OTHERS"===(null==y||null===(r=y.adhocPenaltyReason_data)||void 0===r?void 0:r.title)&&l.createElement("div",{className:"field"},l.createElement(a.CardLabel,null,s("PT_REASON")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocPenaltyComment",value:(null==y?void 0:y.adhocPenaltyComment)||"",onChange:e=>M("adhocPenaltyComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")})))),l.createElement(a.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocPenalty",value:(null==y?void 0:y.adhocPenalty)||"",onChange:e=>M("adhocPenalty",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))),l.createElement(a.Card,{style:{padding:"10px 10px 1px 10px",margin:"0px 0px 15px 0px"}},l.createElement(a.CardSectionHeader,{style:{fontSize:"16px",fontWeight:"700",lineHeight:"18px",padding:"0px",margin:"0px 0px 10px 0px"}},s("PT_AD_REBATE")),l.createElement(a.CardLabel,null,s("PT_TX_HEADS")),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{isMandatory:!0,option:Er,optionKey:"title",select:e=>M("adhocRebateReason",!0,e),selected:(null==y?void 0:y.adhocRebateReason_data)||"",name:"adhocRebateReason_data",isPropertyAssess:!0,t:s})),"PT_OTHERS"===(null==y||null===(u=y.adhocRebateReason_data)||void 0===u?void 0:u.title)&&l.createElement("div",{className:"field"},l.createElement(a.CardLabel,null,s("PT_REASON")),l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"text",isMandatory:!1,name:"adhocRebateComment",value:(null==y?void 0:y.adhocRebateComment)||"",onChange:e=>M("adhocRebateComment",!1,e)},R={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:s("TL_NAME_ERROR_MESSAGE")}))),l.createElement(a.CardLabel,null,s("PT_HEAD_AMT")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,v({style:{background:"#FAFAFA"},t:s,type:"number",isMandatory:!1,name:"adhocRebate",value:(null==y?void 0:y.adhocRebate)||"",onChange:e=>M("adhocRebate",!1,e)},R={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:s("ERR_DEFAULT_INPUT_FIELD_MSG")})))))," "),T&&l.createElement(a.Toast,{style:{zIndex:"10000"},warning:null==T?void 0:T.isWarning,error:null==T||!T.isWarning,label:s(null==T?void 0:T.message),onClose:()=>{h(!1)},isDleteBtn:!0})))},_r=e=>{let{style:n}=e;return l.createElement("span",null,l.createElement("svg",{style:v({},n),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"})))},fr=e=>{let{t:n,userType:t=!1,infoBannerLabel:o="",infoClickLable:i="",infoClickInfoLabel:r="",infoClickInfoLabel1:u=""}=e;t=t||Digit.SessionStorage.get("userType");const d=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement("div",{style:d?{}:{width:"80%"}},l.createElement("div",{className:"info-banner-wrap",style:{color:"#3498DB",margin:"0px"}},l.createElement("div",null,l.createElement(a.InfoBannerIcon,null),l.createElement("h2",{style:{color:"#3498DB"}},n(o))),n(i)+" ",l.createElement(_r,{style:{display:"inline",marginBottom:"5px"}})," "+n(r),l.createElement("div",null," "+n(u)))))},gr=e=>{var n,i,r,u,d,s,c;let{wsAdditionalDetails:v}=e;const{t:p}=o.useTranslation(),[m,E]=t.useState(!1),[S,_]=t.useState({}),f=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"})),C=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(g,null));return l.createElement(t.Fragment,null,l.createElement("div",{style:{lineHeight:"19px",maxWidth:"950px",minWidth:"280px"}},null!=v&&null!==(n=v.additionalDetails)&&void 0!==n&&n.isViewBreakup?l.createElement("div",{onClick:e=>(()=>{var e;let n=v.additionalDetails.data||{};const t=sessionStorage.getItem("Digit.ADHOC_BILL_ADD_REBATE_DATA"),l=t?JSON.parse(t):{};null!=l&&null!==(e=l.value)&&void 0!==e&&e.totalAmount&&(n=null==l?void 0:l.value),_(n),E(!0)})(),style:{marginTop:"12px"}},l.createElement("span",{style:{cursor:"pointer",color:"#a82227"}},p("WS_PAYMENT_VIEW_BREAKUP"))):null,m&&l.createElement(a.Modal,{headerBarMain:l.createElement(f,{label:p("WS_CALCULATION_BREAKUP")}),headerBarEnd:l.createElement(C,{onClick:()=>{E(!1)}}),hideSubmit:!0,popupStyles:{overflowY:"auto"},headerBarMainStyle:{marginBottom:"0px"},popupModuleMianStyles:{paddingTop:"0px"}},l.createElement(a.StatusTable,{style:{padding:"10px",paddingTop:"0px"}},l.createElement(a.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_APPLICATION_FEE_HEADER")),null==S||null===(i=S.billSlabData)||void 0===i||null===(r=i.FEE)||void 0===r?void 0:r.map(e=>l.createElement(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(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(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT1",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==S?void 0:S.fee)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),l.createElement(a.CardSectionHeader,{style:{margin:"10px 0px"}},p("WS_SERVICE_FEE_HEADER")),null==S||null===(u=S.billSlabData)||void 0===u||null===(d=u.CHARGES)||void 0===d?void 0:d.map(e=>l.createElement(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(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(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT2",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==S?void 0:S.charge)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}}),null==S||null===(s=S.billSlabData)||void 0===s||null===(c=s.TAX)||void 0===c?void 0:c.map(e=>l.createElement(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:""+(null==e?void 0:e.taxHeadCode),label:""+p(""+(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(a.Row,{className:"border-none",rowContainerStyle:{margin:"0px"},labelStyle:{width:"50%"},key:"PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT3",label:""+p("PDF_STATIC_LABEL_CONSOLIDATED_TLAPP_TOTAL_AMOUNT"),text:l.createElement("span",null,"₹",Number(null==S?void 0:S.totalAmount)||0),textStyle:{textAlign:"right",fontWeight:"700",fontSize:"24px"}})))))},Cr={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:{}},Nr=e=>{let{className:n="table",headers:t=[],values:i=[],arrears:a=0}=e;const{t:r}=o.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:Cr.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:Cr.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:v({},Cr.cell,Cr.cellLeft,Cr.cellHeader)},r("CS_BILL_PERIOD")),t.map((e,n)=>l.createElement("th",{style:v({},Cr.cell,t.length==n+1?Cr.cellRight:{},Cr.cellHeader),key:n},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,n)=>l.createElement("tr",{key:n},l.createElement("td",{style:v({},Cr.cell,Cr.cellLeft),component:"th",scope:"row"},Object.keys(i)[n]),t.map((n,o)=>l.createElement("td",{style:v({},Cr.cell,{textAlign:"left"},t.length==o+1?Cr.cellRight:{},{whiteSpace:"pre"}),key:o,numeric:!0},o>1&&"₹",e[n]&&e[n].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:v({},Cr.cell,Cr.cellLeft)}),t.map((e,n)=>n==t.length-1?l.createElement("td",{style:v({},Cr.cell,Cr.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:n,numeric:!0},a):n==t.length-2?l.createElement("td",{style:v({},Cr.cell,{textAlign:"left"}),key:n,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:Cr.cell,key:n,numeric:!0})))))))},yr={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))"}},Dr=e=>{var n,i,a;let{bill:r={}}=e;const{t:u}=o.useTranslation();let d={},s=(null==r||null===(n=r.billDetails)||void 0===n?void 0:n.sort((e,n)=>n.fromPeriod-e.fromPeriod))||[];s=[...s];const c=(null===(i=s)||void 0===i?void 0:i.reduce((e,n,t)=>0===t?e:e+n.amount,0))||0;let v="₹ "+((null==c||null===(a=c.toFixed)||void 0===a?void 0:a.call(c,0))||Number(0).toFixed(0));s.shift(),s.map(e=>{let n=function(e){var n,t,l;void 0===e&&(e={});let o={};const{billAccountDetails:i=[]}=e;return i.map(e=>{o[e.taxHeadCode]={value:e.amount,order:e.order}}),o.CS_BILL_NO={value:(null===(n=e)||void 0===n?void 0:n.billNumber)||"NA",order:-2},o.CS_BILL_DUEDATE={value:(null===(t=e)||void 0===t?void 0:t.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},o.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},o}(e);d[((e,n)=>{const t=new Date(e),l=new Date(n);return l.getYear()-t.getYear()!=0?"FY"+(t.getYear()+1900)+"-"+(l.getYear()-100):t.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=n});let p={};!d||Object.keys(d).map((e,n)=>{Object.keys(d[e]).map(n=>{p[n]=d[e]&&d[e][n]&&d[e][n].order||0})});let m=[];m=Object.keys(p),m.sort((e,n)=>p[e]-p[n]);const[E,S]=t.useState(!1);return 0==c||c<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:yr.headerStyle},u("CS_ARREARS_DETAILS")),E&&l.createElement(Nr,{headers:[...m],values:d,arrears:v}),!E&&l.createElement("div",{style:yr.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{S(!0)}},u("CS_SHOW_CARD"))),E&&l.createElement("div",{style:yr.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{S(!1)}},u("CS_HIDE_CARD"))))},Tr=()=>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"})),hr=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Tr,null)),Ar=e=>{let{t:n,closeModal:t}=e;console.log(" ----- Renew POP coming "),Digit.Hooks.sv.useCreateDemand();const o=i.useHistory();return l.createElement(l.Fragment,null,l.createElement(s.Modal,{headerBarMain:l.createElement(e=>l.createElement("h1",{className:"heading-m"},e.label),{label:"SV_WANT_TO_EDIT"}),headerBarEnd:l.createElement(hr,{onClick:t}),actionCancelLabel:n("CS_COMMON_BACK"),actionCancelOnSubmit:t,hideSubmit:!0,formId:"modal-action"},l.createElement(s.Card,{style:{boxShadow:"none"}},l.createElement("div",{style:{display:"flex",justifyContent:"center",gap:"20px",flexDirection:"column",alignItems:"center"}},l.createElement(s.SubmitBar,{label:n("SV_YES_PROCEED_WITH_APPLICATION"),onSubmit:()=>{o.push("renew-application/info")}}),l.createElement(s.SubmitBar,{label:n("SV_NO_PROCEED_PAYEMNT"),onSubmit:()=>{console.log(" testing coming compilter"),o.push("renew-application/check/makePayment")}})))))};function Ir(e){var n,r,u,d,s,c,v,p,m,E,S,f,g,C,N;let{applicationDetails:y,workflowDetails:D,isDataLoading:T,applicationData:h,timelineStatusPrefix:A,showTimeLine:I=!0,statusAttribute:O="status",paymentsList:b,oldValue:L,isInfoLabel:R=!1}=e;const{t:w}=o.useTranslation(),W=(i.useHistory(),i.useLocation()),[P,M]=t.useState(!1),[x,B]=t.useState(null);new URLSearchParams(W.search);let{id:F}=i.useParams();const U=null==y||null===(n=y.applicationData)||void 0===n?void 0:n.owners;function k(e,n,t){var l;window.open(null==t||null===(l=t.fullImage)||void 0===l?void 0:l[0],"_blank")}console.log("ownersSequences:- ",U);const[H,j]=t.useState({}),[V,z]=t.useState({loading:!1,loaded:!1,canLoad:!1});"ACTIVE"!=(null==h?void 0:h.status)||V.loading||V.loaded||V.canLoad||z({loading:!1,loaded:!1,canLoad:!0}),null==V||!V.canLoad||V.loading||V.loaded||(z({loading:!0,loaded:!1,canLoad:!0}),function(e,n,t,l){try{Promise.resolve(Digit.PTService.assessmentSearch({tenantId:e,filters:{propertyIds:n}})).then(function(o){function i(){t(a),l({loading:!1,loaded:!0,canLoad:!0})}let a={};const r=function(t){if((null==o||null===(t=o.Assessments)||void 0===t?void 0:t.length)>0)return Promise.resolve(Digit.PaymentService.fetchBill(e,{businessService:"PT",consumerCode:n})).then(function(e){a=e})}();return r&&r.then?r.then(i):i()})}catch(e){return Promise.reject(e)}}((null==h?void 0:h.tenantId)||tenantId,null==h?void 0:h.propertyId,j,z));const Y=e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()},G=function(e,n,t){if(void 0===n&&(n=0),"OPEN"===e.state||"INITIATED"===e.status&&!window.location.href.includes("/obps/")){var o;const e={date:Y(null==h||null===(o=h.auditDetails)||void 0===o?void 0:o.createdTime),source:(null==h?void 0:h.channel)||""};return l.createElement(sr,{data:e})}if(window.location.href.includes("/obps/")||window.location.href.includes("/noc/")||window.location.href.includes("/ws/")){var i,a,r,u,d,s,c,v,p,m,E,S,f,g,C,N,D,T;const o={uuid:null==e||null===(i=e.assignes)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.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 t="";return t="+91 "+_.get(e,"ProcessInstances["+n+"].assignes[0].mobileNumber"),t}}},A=t&&t[n-1]&&(null==t?void 0:t[n-1]),I={date:null==e||null===(r=e.auditDetails)||void 0===r?void 0:r.lastModified,name:null==e||null===(u=e.assignes)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.name,mobileNumber:(null==h||null===(s=h.processInstance)||void 0===s||null===(c=s.assignes)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.uuid)===(null==e||null===(p=e.assignes)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.uuid)&&null!=h&&null!==(E=h.processInstance)&&void 0!==E&&null!==(S=E.assignes)&&void 0!==S&&null!==(f=S[0])&&void 0!==f&&f.mobileNumber?null==h||null===(g=h.processInstance)||void 0===g||null===(C=g.assignes)||void 0===C||null===(N=C[0])||void 0===N?void 0:N.mobileNumber:null==e||null===(D=e.assignes)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.mobileNumber,comment:w(e&&(null==e?void 0:e.comment)),wfComment:A?A&&A.wfComment:[],thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(sr,{data:I,OpenImage:k,privacy:o})}{var A,I,O,b,L;const n={date:Y(null==h||null===(A=h.auditDetails)||void 0===A?void 0:A.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===(b=e.assignes)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.mobileNumber,thumbnailsToShow:null==e?void 0:e.thumbnailsToShow};return l.createElement(sr,{data:n,OpenImage:k})}},q=(e,n)=>e?n?e:w(e):w("NA"),K=window.location.href.includes("employee/tl")||window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc"),X=window.location.href.includes("employee/noc"),Z=window.location.href.includes("employee/obps"),$=(window.location.href.includes("employee/ws"),()=>window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||K?{justifyContent:"space-between",fontSize:"16px",lineHeight:"19px",color:"#0B0C0C"}:{}),J=e=>{if(null!=e&&e.isTimeValue&&null!=e&&e.value){const n=e.value,[t,l]=n.split(":").map(e=>parseInt(e,10));if(!isNaN(t)&&!isNaN(l)){const e=t>=12?"PM":"AM";return(t%12||12)+":"+String(l).padStart(2,"0")+" "+e}return e.value}return null!=e&&e.skip?e.value:null!=e&&e.isUnit?null!=e&&e.value?q(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated)+" "+w(null==e?void 0:e.isUnit):w("N/A"):null!=e&&e.value?q(null==e?void 0:e.value,null==e?void 0:e.isNotTranslated):w("N/A")},[Q,ee]=t.useState(!1);return l.createElement(a.Card,{style:{position:"relative"},className:"employeeCard-override"},R?l.createElement(fr,{t:w,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===(r=y.applicationDetails)||void 0===r?void 0:r.map((e,n)=>{var t,o,r,u,d,s,c,v,p,m,E,S,_,f,g,C,N,T,h,A,I,O,R,W,P,x,U,k,j,V,z,Y,G,q,Q,ee,ne,te,le;return l.createElement(l.Fragment,{key:n},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"}:K?{lineHeight:"19px",maxWidth:"600px",minWidth:"280px"}:{}},0!==n||e.asSectionHeader?l.createElement(l.Fragment,null,l.createElement(a.CardSectionHeader,{style:0==n&&K?{marginBottom:"16px",fontSize:"24px"}:{marginBottom:"16px",marginTop:"32px",fontSize:"24px"}},X?""+w(e.title):w(e.title),null!=e&&e.Component?l.createElement(e.Component,null):null)):l.createElement(a.CardSubHeader,{style:{marginBottom:"16px",fontSize:"24px"}},w(e.title)),(null==e?void 0:e.isTable)&&l.createElement("table",{style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse",borderCollapse:"collapse",border:"1px solid black"}},l.createElement("tr",{style:{textAlign:"left"}},null==e?void 0:e.headers.map(e=>l.createElement("th",{style:{padding:"10px",paddingLeft:"5px",border:"1px solid black"}},w(e)))),null==e?void 0:e.tableRows.map((n,t)=>l.createElement("tr",null,n.map((n,o)=>Array.isArray(n)&&n.length>1&&!0===e.isMaintenance?l.createElement("td",{style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"},key:o},l.createElement("div",{style:{display:"flex",flexWrap:"nowrap",gap:"5px"}},n.map((e,n)=>l.createElement("a",{key:n,onClick:()=>{Digit.UploadServices.Filefetch([e.fileStoreId],Digit.ULBService.getStateId()).then(e=>{var n,t,l;console.log("Response of file:",e);const o=null==e||null===(n=e.data)||void 0===n||null===(t=n.fileStoreIds)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.url;if(o){const e=o.split(",")[0];e?window.open(e,"_blank"):console.error("No valid URL found to open!")}else console.error("URL is missing in the response!")}).catch(e=>{console.error("Error fetching file:",e)})},rel:"noopener noreferrer",style:{marginRight:"5px",display:"inline-block",cursor:"pointer"}},l.createElement(a.PDFSvg,{style:{width:"25px",height:"25px"}}))))):l.createElement("td",{key:o,style:{paddingTop:"20px",textAlign:"left",border:"1px solid black",verticalAlign:"middle"}},console.log("Comming Maintainaince data row:- ",n.data),n&&!0===n.editButton?l.createElement("span",{style:{display:"inline-flex",gap:"10px",alignItems:"center"}},l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/asset/assetservice/maintenance-edit/"+F,state:{data:n.data}}},l.createElement("button",null," ",l.createElement(a.EditIcon,null)," ")),l.createElement("div",{key:t,onClick:()=>(B(n.data),void M(!0)),style:{cursor:"pointer"}},l.createElement(a.ViewsIcon,null))):w(n)))))),l.createElement(a.StatusTable,{style:window.location.href.includes("employee/obps")||window.location.href.includes("employee/noc")||K?{position:"relative",marginTop:"19px"}:{}},(null==e?void 0:e.title)&&!(null!=e&&e.title.includes("NOC"))&&(null==e||null===(t=e.values)||void 0===t?void 0:t.map((n,t)=>{var o,r,u;return!0===n.map&&"N/A"!==n.value?l.createElement(a.Row,{labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"},key:w(n.title),label:w(n.title),text:l.createElement("img",{src:w(n.value),alt:"",privacy:null==n?void 0:n.privacy})}):1==(null==n?void 0:n.isLink)?l.createElement(a.Row,{key:w(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"}},w(null==n?void 0:n.title)))):X||Z?""+w(n.title):w(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:t===(null==e||null===(u=e.values)||void 0===u?void 0:u.length)-1,caption:n.caption,className:"border-none",rowContainerStyle:$(),labelStyle:{wordBreak:"break-all"},textStyle:{wordBreak:"break-all"}}):l.createElement("div",null,window.location.href.includes("modify")?l.createElement(a.Row,{className:"border-none",key:""+n.title,label:""+w(""+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(a.Row,{key:w(n.title),label:w(n.title),text:J(n),last:t===(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:$(),labelStyle:{wordBreak:"break-all",fontWeight:n.isBold?"bold":"normal",fontStyle:n.isBold?"italic":"normal"},textStyle:{wordBreak:"break-all",fontWeight:n.isBold?"bold":"normal",fontStyle:n.isBold?"italic":"normal"}}),"PT_TOTAL_DUES"===n.title?l.createElement(Dr,{bill:null===(r=H.Bill)||void 0===r?void 0:r[0]}):"")})))),(null==e?void 0:e.belowComponent)&&l.createElement(e.belowComponent,null),(null==e||null===(o=e.additionalDetails)||void 0===o?void 0:o.inspectionReport)&&l.createElement(rr,{scrutinyDetails:null==e?void 0:e.additionalDetails,paymentsList:b}),(null==y||null===(r=y.applicationData)||void 0===r||null===(u=r.additionalDetails)||void 0===u||null===(d=u.fieldinspection_pending)||void 0===d?void 0:d.length)>0&&(null==e||null===(s=e.additionalDetails)||void 0===s?void 0:s.fiReport)&&l.createElement(Qa,{fiReport:null==y||null===(c=y.applicationData)||void 0===c||null===(v=c.additionalDetails)||void 0===v?void 0:v.fieldinspection_pending}),(null==e||null===(p=e.additionalDetails)||void 0===p?void 0:p.floors)&&l.createElement(ir,{floors:null==e||null===(m=e.additionalDetails)||void 0===m?void 0:m.floors}),(null==e||null===(E=e.additionalDetails)||void 0===E?void 0:E.owners)&&l.createElement(ar,{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(vr,{units:null==e||null===(f=e.additionalDetails)||void 0===f?void 0:f.units}),(null==e||null===(g=e.additionalDetails)||void 0===g?void 0:g.accessories)&&l.createElement(cr,{units:null==e||null===(C=e.additionalDetails)||void 0===C?void 0:C.accessories}),(null==e||null===(N=e.additionalDetails)||void 0===N?void 0:N.permissions)&&(null==D||null===(T=D.data)||void 0===T||null===(h=T.nextActions)||void 0===h?void 0:h.length)>0&&l.createElement(tr,{applicationData:null==y?void 0:y.applicationData,t:w,permissions:null==e||null===(A=e.additionalDetails)||void 0===A?void 0:A.permissions}),(null==e||null===(I=e.additionalDetails)||void 0===I?void 0:I.obpsDocuments)&&l.createElement($a,{t:w,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.obpsDocuments,bpaActionsDetails:D}),(null==e||null===(O=e.additionalDetails)||void 0===O?void 0:O.noc)&&l.createElement(nr,{t:w,isNoc:!0,NOCdata:e.values,applicationData:null==y?void 0:y.applicationData,docs:e.additionalDetails.noc,noc:null===(R=e.additionalDetails)||void 0===R?void 0:R.data,bpaActionsDetails:D}),(null==e||null===(W=e.additionalDetails)||void 0===W?void 0:W.scruntinyDetails)&&l.createElement(rr,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(P=e.additionalDetails)||void 0===P?void 0:P.buildingExtractionDetails)&&l.createElement(rr,{scrutinyDetails:null==e?void 0:e.additionalDetails}),(null==e||null===(x=e.additionalDetails)||void 0===x?void 0:x.subOccupancyTableDetails)&&l.createElement(ur,{edcrDetails:null==e?void 0:e.additionalDetails,applicationData:null==y?void 0:y.applicationData}),(null==e||null===(U=e.additionalDetails)||void 0===U?void 0:U.documentsWithUrl)&&l.createElement(Za,{documents:null==e||null===(k=e.additionalDetails)||void 0===k?void 0:k.documentsWithUrl}),(null==e||null===(j=e.additionalDetails)||void 0===j?void 0:j.documents)&&l.createElement(lr,{documents:null==e||null===(V=e.additionalDetails)||void 0===V?void 0:V.documents}),(null==e||null===(z=e.additionalDetails)||void 0===z?void 0:z.taxHeadEstimatesCalculation)&&l.createElement(or,{taxHeadEstimatesCalculation:null==e||null===(Y=e.additionalDetails)||void 0===Y?void 0:Y.taxHeadEstimatesCalculation}),(null==e?void 0:e.isWaterConnectionDetails)&&l.createElement(pr,{wsAdditionalDetails:e,oldValue:L}),(null==e||null===(G=e.additionalDetails)||void 0===G?void 0:G.redirectUrl)&&l.createElement("div",{style:{fontSize:"16px",lineHeight:"24px",fontWeight:"400",padding:"10px 0px"}},l.createElement(i.Link,{to:null==e||null===(q=e.additionalDetails)||void 0===q||null===(Q=q.redirectUrl)||void 0===Q?void 0:Q.url},l.createElement("span",{className:"link",style:{color:"#a82227"}},null==e||null===(ee=e.additionalDetails)||void 0===ee||null===(ne=ee.redirectUrl)||void 0===ne?void 0:ne.title))),(null==e||null===(te=e.additionalDetails)||void 0===te?void 0:te.estimationDetails)&&l.createElement(Sr,{wsAdditionalDetails:e,workflowDetails:D}),(null==e||null===(le=e.additionalDetails)||void 0===le?void 0:le.estimationDetails)&&l.createElement(gr,{wsAdditionalDetails:e,workflowDetails:D}))}),I&&(null==D||null===(u=D.data)||void 0===u||null===(d=u.timeline)||void 0===d?void 0:d.length)>0&&l.createElement(l.Fragment,null,l.createElement(a.BreakLine,null),((null==D?void 0:D.isLoading)||T)&&l.createElement(a.Loader,null),!(null!=D&&D.isLoading)&&!T&&l.createElement(t.Fragment,null,l.createElement("div",{id:"timeline"},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",marginTop:"32px"}},w("ES_APPLICATION_DETAILS_APPLICATION_TIMELINE")),null!=D&&null!==(s=D.data)&&void 0!==s&&s.timeline&&1===(null==D||null===(c=D.data)||void 0===c||null===(v=c.timeline)||void 0===v?void 0:v.length)?l.createElement(a.CheckPoint,{isCompleted:!0,label:w(""+A+(null==D||null===(p=D.data)||void 0===p||null===(m=p.timeline[0])||void 0===m?void 0:m.state)),customChild:G(null==D||null===(E=D.data)||void 0===E?void 0:E.timeline[0],null==D||null===(S=D.data)||void 0===S?void 0:S.timeline)}):l.createElement(a.ConnectingCheckPoints,null,(null==D||null===(f=D.data)||void 0===f?void 0:f.timeline)&&(null==D||null===(g=D.data)||void 0===g?void 0:g.timeline.slice(0,Q?null==D?void 0:D.data.timeline.length:2).map((e,n,t)=>{var o;let i="";var r,u,d,s,c,v;return window.location.href.includes("/obps/")&&(i=null!=D&&null!==(r=D.data)&&void 0!==r&&null!==(u=r.timeline[n-1])&&void 0!==u&&null!==(d=u.state)&&void 0!==d&&d.includes("BACK_FROM")||null!=D&&null!==(s=D.data)&&void 0!==s&&null!==(c=s.timeline[n-1])&&void 0!==c&&null!==(v=c.state)&&void 0!==v&&v.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(a.CheckPoint,{keyValue:n,isCompleted:0===n,info:e.comment,label:w(""+A+("REOPEN"===(null==e?void 0:e.performedAction)?null==e?void 0:e.performedAction:null==e?void 0:e[O])+i),customChild:G(e,n,null==D||null===(o=D.data)||void 0===o?void 0:o.timeline)}))}))),(null==D||null===(C=D.data)||void 0===C||null===(N=C.timeline)||void 0===N?void 0:N.length)>2&&l.createElement(a.LinkButton,{label:w(Q?"COLLAPSE":"VIEW_TIMELINE"),onClick:()=>{ee(e=>!e)}})))),l.createElement("div",null,P&&l.createElement(Ar,{t:w,closeModal:()=>setRnewButton(!1),actionCancelOnSubmit:()=>setRnewButton(!1),application:application})))}function Or(e){var n,t,o,i,r,u,d,s,c,v,p,m,E,S,_,f,g,C;let{t:N,showToast:y,closeToast:D,businessService:T}=e;if(null!=T&&T.includes("NewTL")||null!=T&&T.includes("TL")||null!=T&&T.includes("EDITRENEWAL")){var h;let e="";switch(null==y||null===(h=y.action)||void 0===h?void 0:h.action){case"SENDBACK":e="error"===(null==y?void 0:y.key)?null==y||null===(n=y.error)||void 0===n?void 0:n.message:N("TL_SENDBACK_CHECKLIST_MESSAGE_HEAD");break;case"FORWARD":e="error"===(null==y?void 0:y.key)?null==y||null===(t=y.error)||void 0===t?void 0:t.message:N("TL_FORWARD_SUCCESS_MESSAGE_MAIN");break;case"APPROVE":e="error"===(null==y?void 0:y.key)?null==y||null===(o=y.error)||void 0===o?void 0:o.message:N("TL_APPROVAL_CHECKLIST_MESSAGE_HEAD");break;case"SENDBACKTOCITIZEN":e="error"===(null==y?void 0:y.key)?null==y||null===(i=y.error)||void 0===i?void 0:i.message:N("TL_SENDBACK_TOCITIZEN_CHECKLIST_MESSAGE_HEAD");break;case"REJECT":e="error"===(null==y?void 0:y.key)?null==y||null===(r=y.error)||void 0===r?void 0:r.message:N("TL_APPROVAL_REJ_MESSAGE_HEAD");break;case"RESUBMIT":e="error"===(null==y?void 0:y.key)?null==y||null===(u=y.error)||void 0===u?void 0:u.message:N("TL_APPLICATION_RESUBMIT_SUCCESS_MESSAGE_MAIN");break;case"CANCEL":e="error"===(null==y?void 0:y.key)?null==y||null===(d=y.error)||void 0===d?void 0:d.message:N("TL_TL_CANCELLED_MESSAGE_HEAD");break;default:e="error"===(null==y?void 0:y.key)?null==y||null===(s=y.error)||void 0===s?void 0:s.message:N("ES_"+T+"_"+(null==y||null===(c=y.action)||void 0===c?void 0:c.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,y&&l.createElement(a.Toast,{error:"error"===y.key,label:e,onClose:D}))}if(null!=T&&T.includes("BPA")||null!=T&&T.includes("BPA_LOW")||null!=T&&T.includes("BPA_OC")){var A;const e=function(e){var n;void 0===e&&(e=[]);let t=e[0];return t=2==(null===(n=e)||void 0===n?void 0:n.length)&&null!=T&&T.includes("BPA_OC")?N(e[1]):N(e[0]),t};let n="";switch(null==y||null===(A=y.action)||void 0===A?void 0:A.action){case"REVOCATE":n="error"===(null==y?void 0:y.key)?null==y||null===(v=y.error)||void 0===v?void 0:v.message:e(["BPA_APPROVAL_REVOCATED_MESSAGE_HEAD","BPA_APPROVAL_OC_REVOCATED_MESSAGE_HEAD"]);break;case"VERIFY_AND_FORWARD":n="error"===(null==y?void 0:y.key)?null==y||null===(p=y.error)||void 0===p?void 0:p.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_TO_CITIZEN":n="error"===(null==y?void 0:y.key)?null==y||null===(m=y.error)||void 0===m?void 0:m.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;case"APPROVE":n="error"===(null==y?void 0:y.key)?null==y||null===(E=y.error)||void 0===E?void 0:E.message:e(["BPA_APPROVAL_CHECKLIST_MESSAGE_HEAD"]);break;case"REJECT":n="error"===(null==y?void 0:y.key)?null==y||null===(S=y.error)||void 0===S?void 0:S.message:e(["BPA_APPROVAL_REJECTED_MESSAGE_HEAD","BPA_OC_APPROVAL_REJECTED_MESSAGE_HEAD"]);break;case"FORWARD":n="error"===(null==y?void 0:y.key)?null==y||null===(_=y.error)||void 0===_?void 0:_.message:e(["BPA_FORWARD_SUCCESS_MESSAGE_MAIN"]);break;case"SEND_BACK_FOR_DOCUMENT_VERIFICATION":case"SEND_BACK_FOR_FIELD_INSPECTION":n="error"===(null==y?void 0:y.key)?null==y||null===(f=y.error)||void 0===f?void 0:f.message:e(["BPA_SENDBACK_SUCCESS_MESSAGE_MAIN"]);break;default:n="error"===(null==y?void 0:y.key)?null==y||null===(g=y.error)||void 0===g?void 0:g.message:N("ES_"+T+"_"+(null==y||null===(C=y.action)||void 0===C?void 0:C.action)+"_UPDATE_SUCCESS")}return l.createElement(l.Fragment,null,y&&l.createElement(a.Toast,{error:"error"===y.key,label:n,onClose:D}))}{var I,O;const e="error"===(null==y?void 0:y.key)?null==y||null===(I=y.error)||void 0===I?void 0:I.message:"ES_"+T+"_"+(null==y||null===(O=y.action)||void 0===O?void 0:O.action)+"_UPDATE_SUCCESS";return l.createElement(l.Fragment,null,y&&l.createElement(a.Toast,{error:"error"===y.key,label:N(e),onClose:D}))}}function br(e){var n,i,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T;let{workflowDetails:h,displayMenu:A,onActionSelect:I,setDisplayMenu:O,businessService:b,forcedActionPrefix:L,ActionBarStyle:R={},MenuStyle:w={},isAction:W,applicationDetails:P}=e;const{t:M}=o.useTranslation();let x=Digit.UserService.getUser();const B=t.useRef();if(window.location.href.includes("/obps")||window.location.href.includes("/noc")){const e=sessionStorage.getItem("Digit.citizen.userRequestObject"),n=e?JSON.parse(e):{};x=null==n?void 0:n.value}const F=null===(n=x)||void 0===n||null===(i=n.info)||void 0===i||null===(r=i.roles)||void 0===r?void 0:r.map(e=>e.code);let U=!1,k=!1,H=(null==h||null===(u=h.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s?void 0:s.filter(e=>(null==F?void 0:F.some(n=>{var t;return null===(t=e.roles)||void 0===t?void 0:t.includes(n)}))||!e.roles))||(null==h||null===(c=h.data)||void 0===c||null===(p=c.nextActions)||void 0===p?void 0:p.filter(e=>(null==F?void 0:F.some(n=>{var t;return null===(t=e.roles)||void 0===t?void 0:t.includes(n)}))||!e.roles));Digit.Hooks.useClickOutside(B,()=>{O(!1)},A),(window.location.href.includes("/obps")||window.location.href.includes("/noc"))&&1==(null==H?void 0:H.length)||null!=H&&null!==(m=H[0])&&void 0!==m&&null!==(E=m.redirectionUrl)&&void 0!==E&&E.pathname.includes("/pt/property-details/")&&1==(null==H?void 0:H.length)?(k=!1,U=!0):(null==H?void 0:H.length)>0&&(k=!0,U=!1);const j=Digit.SessionStorage.get("User"),V=null==j||null===(S=j.info)||void 0===S?void 0:S.uuid,z=null==P||null===(_=P.applicationData)||void 0===_||null===(f=_.auditDetails)||void 0===f?void 0:f.lastModifiedBy;return l.createElement(l.Fragment,null,!(null!=h&&h.isLoading)&&k&&!U&&!W&&l.createElement(a.ActionBar,{style:v({},R)},A&&(null!=h&&null!==(g=h.data)&&void 0!==g&&null!==(C=g.actionState)&&void 0!==C&&C.nextActions||null!=h&&null!==(N=h.data)&&void 0!==N&&N.nextActions)?l.createElement(a.Menu,{localeKeyPrefix:L||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()),options:H,optionKey:"action",t:M,onSelect:I,style:w}):null,"ewst"===b?z===V||null==z?l.createElement(a.SubmitBar,{ref:B,label:M("WF_TAKE_ACTION"),onSubmit:()=>O(!A)}):l.createElement(a.CardLabel,{style:{color:"red",font:"30px",fontWeight:"bold"}},""+M("EW_ALERT_ANOTHER_VENDOR")):l.createElement(a.SubmitBar,{ref:B,label:M("WF_TAKE_ACTION"),onSubmit:()=>O(!A)})),!(null!=h&&h.isLoading)&&!k&&U&&!W&&l.createElement(a.ActionBar,{style:v({},R)},l.createElement("button",{style:{color:"#FFFFFF",fontSize:"18px"},className:"submit-bar",name:null==H||null===(y=H[0])||void 0===y?void 0:y.action,value:null==H||null===(D=H[0])||void 0===D?void 0:D.action,onClick:e=>{I((null==H?void 0:H[0])||{})}},M((L||"WF_EMPLOYEE_"+(null==b?void 0:b.toUpperCase()))+"_"+(null==H||null===(T=H[0])||void 0===T?void 0:T.action)))))}const Lr=()=>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"})),Rr=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Lr,null));function wr(e){let{action:n,closeWarningPopup:t}=e;const{t:i}=o.useTranslation(),r=window.Digit.Utils.browser.isMobile();return l.createElement(l.Fragment,null,l.createElement(a.Modal,{headerBarMain:l.createElement("h1",{className:"heading-m"},i("PT_DUES_ARE_PENDING")),headerBarEnd:l.createElement(Rr,{onClick:()=>{t()}}),hideSubmit:!0,isDisabled:!1,popupStyles:r?{}:{width:"29%",marginTop:"auto"}},l.createElement(a.Card,null,l.createElement("div",{style:{marginBottom:"30px"}},l.createElement("h1",null,i("PT_YOU_HAVE")," ₹",null==n?void 0:n.AmountDueForPay," ",i("PT_DUE_WARNING_MSG2"))),l.createElement(a.Row,{rowContainerStyle:{display:"flex"},labelStyle:{fontSize:"24px",fontWeight:"700",marginRight:"10%"},textStyle:{fontSize:"24px",fontWeight:"700",marginBottom:"20px"},label:""+i("PT_AMOUNT_DUE"),text:"₹"+i(null==n?void 0:n.AmountDueForPay)}),l.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},l.createElement(a.ButtonSelector,{theme:"border",label:i("ES_PT_COMMON_CANCEL"),onSubmit:t,style:{marginLeft:"10px"}}),l.createElement(a.ButtonSelector,{label:i("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 Wr=e=>{var n;const r=Digit.ULBService.getCurrentTenantId(),u=Digit.ULBService.getStateId(),{t:s}=o.useTranslation(),c=i.useHistory();let{id:p}=i.useParams();const[m,E]=t.useState(!1),[S,_]=t.useState(null),[f,g]=t.useState(!1),[C,N]=t.useState(!1),[y,D]=t.useState(!1),{applicationDetails:T,showToast:h,setShowToast:A,isLoading:I,isDataLoading:O,applicationData:b,mutate:L,nocMutation:R,workflowDetails:w,id:W,businessService:P,closeToast:M,moduleCode:x,timelineStatusPrefix:B,forcedActionPrefix:F,statusAttribute:U,ActionBarStyle:k,MenuStyle:H,paymentsList:j,showTimeLine:V=!0,oldValue:z,isInfoLabel:Y=!1,clearDataDetails:G,isAction:q=!1}=e;t.useEffect(()=>{h&&w.revalidate()},[h]);const K=d.useQueryClient(),X=()=>{_(null),g(!1)};return I||C?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,I?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(Ir,{applicationDetails:T,id:W,workflowDetails:w,isDataLoading:O,applicationData:b,businessService:P,timelineStatusPrefix:B,statusAttribute:U,paymentsList:j,showTimeLine:V,oldValue:z,isInfoLabel:Y}),f?l.createElement(Xa,{t:s,vending_Zone:(null==e?void 0:e.vending_Zone)||[],UserVendingZone:(null==e?void 0:e.UserVendingZone)||"",UserVendingZoneCode:(null==e?void 0:e.UserVendingZoneCode)||"",action:S,tenantId:r,state:u,id:p,applicationDetails:T,applicationData:null==T?void 0:T.applicationData,closeModal:X,submitAction:function(e,n,t){void 0===n&&(n=!1),void 0===t&&(t={});try{let l=!1;const o=function(o,i,a,r,u,d,p,m,E,S,_,f){if(0!=(null==e||null===(o=e.Property)||void 0===o||null===(i=o.workflow)||void 0===i||null===(a=i.comment)||void 0===a?void 0:a.length)&&0!=(null==e||null===(r=e.Licenses)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.comment)||void 0===d?void 0:d.length)&&0!=(null==e||null===(p=e.WaterConnection)||void 0===p||null===(m=p.comment)||void 0===m?void 0:m.length)&&0!=(null==e||null===(E=e.SewerageConnection)||void 0===E||null===(S=E.comment)||void 0===S?void 0:S.length)&&0!=(null==e||null===(_=e.BPA)||void 0===_||null===(f=_.comment)||void 0===f?void 0:f.length)){function g(n){if(l)return n;sessionStorage.setItem("updateData",JSON.stringify(e)),L&&(N(!0),L(e,{onError:(e,n)=>{N(!1),A({key:"error",error:e}),setTimeout(M,5e3)},onSuccess:(e,n)=>{var l,o,i,a,r,u,d,v,p,m,E,S;sessionStorage.removeItem("WS_SESSION_APPLICATION_DETAILS"),N(!1),null!==(l=t)&&void 0!==l&&l.bpa&&c.replace("/digit-ui/employee/obps/response",{data:e}),null!==(o=t)&&void 0!==o&&o.isStakeholder&&c.push("/digit-ui/employee/obps/stakeholder-response",{data:e}),null!==(i=t)&&void 0!==i&&i.isNoc&&c.push("/digit-ui/employee/noc/response",{data:e}),(null==e||null===(a=e.Amendments)||void 0===a?void 0:a.length)>0?null!=n&&null!==(r=n.AmendmentUpdate)&&void 0!==r&&null!==(u=r.workflow)&&void 0!==u&&u.action.includes("SEND_BACK")?A({key:"success",label:s("ES_MODIFYSWCONNECTION_SEND_BACK_UPDATE_SUCCESS")}):null!=n&&null!==(d=n.AmendmentUpdate)&&void 0!==d&&null!==(v=d.workflow)&&void 0!==v&&v.action.includes("RE-SUBMIT")?A({key:"success",label:s("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}):null!=n&&null!==(p=n.AmendmentUpdate)&&void 0!==p&&null!==(m=p.workflow)&&void 0!==m&&m.action.includes("APPROVE")?A({key:"success",label:s("ES_MODIFYSWCONNECTION_APPROVE_UPDATE_SUCCESS")}):null!=n&&null!==(E=n.AmendmentUpdate)&&void 0!==E&&null!==(S=E.workflow)&&void 0!==S&&S.action.includes("REJECT")&&A({key:"success",label:s("ES_MODIFYWSCONNECTION_REJECT_UPDATE_SUCCESS")}):(G&&setTimeout(G,3e3),setTimeout(M,5e3),K.clear(),K.refetchQueries("APPLICATION_SEARCH"))}})),X()}N(!0),"function"==typeof(null==e?void 0:e.customFunctionToExecute)&&(null==e||e.customFunctionToExecute(v({},e)));const o=function(){if(!1!==n&&R){var e;const t=null===(e=n)||void 0===e?void 0:e.map(e=>null==R?void 0:R.mutateAsync(e)),o=Ji(function(){return N(!0),Promise.resolve(Promise.all(t)).then(function(e){e&&e.map(e=>{var n,t;Digit.SessionStorage.del(null==e||null===(n=e.Noc)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.nocType)})})},function(e){var n,t,o,i,a,r,u,d,c,v,p,m;N(!1);let E=null!=e&&null!==(n=e.response)&&void 0!==n&&null!==(t=n.data)&&void 0!==t&&null!==(o=t.Errors)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.code?s(null==e||null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.code):(null==e||null===(c=e.response)||void 0===c||null===(v=c.data)||void 0===v||null===(p=v.Errors)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.message)||e;X(),A({key:"error",error:{message:E}}),setTimeout(M,5e3),l=!0});if(o&&o.then)return o.then(function(){})}}();return o&&o.then?o.then(g):g(o)}alert("Please fill in the comments before submitting")}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},actionData:null==w||null===(n=w.data)||void 0===n?void 0:n.timeline,businessService:P,workflowDetails:w,moduleCode:x}):null,y?l.createElement(wr,{action:S,workflowDetails:w,businessService:P,isWarningPop:y,closeWarningPopup:()=>{D(!1)}}):null,l.createElement(Or,{t:s,showToast:h,closeToast:M,businessService:P}),l.createElement(br,{isAction:q,workflowDetails:w,displayMenu:m,onActionSelect:function(e){if(sessionStorage.setItem("SELECTED_ACTION",null==e?void 0:e.action),e)if(null!=e&&e.isToast)A({key:"error",error:{message:null==e?void 0:e.toastMessage}}),setTimeout(M,5e3);else if(null!=e&&e.isWarningPopUp)D(!0);else if(null!=e&&e.redirectionUrll){var n,t,l,o,i;if("ACTIVATE_CONNECTION"===(null==e||null===(n=e.redirectionUrll)||void 0===n?void 0:n.action))c.push(""+(null==e||null===(l=e.redirectionUrll)||void 0===l?void 0:l.pathname),JSON.stringify({data:null==e||null===(o=e.redirectionUrll)||void 0===o?void 0:o.state,url:""+(null===(i=location)||void 0===i?void 0:i.pathname)+location.search}));else if("RE-SUBMIT-APPLICATION"===(null==e||null===(t=e.redirectionUrll)||void 0===t?void 0:t.action)){var a,r;c.push(""+(null==e||null===(a=e.redirectionUrll)||void 0===a?void 0:a.pathname),{data:null==e||null===(r=e.redirectionUrll)||void 0===r?void 0:r.state})}else{var u;window.location.assign(window.location.origin+"/digit-ui/employee/payment/collect/"+(null==e||null===(u=e.redirectionUrll)||void 0===u?void 0:u.pathname))}}else if(null!=e&&e.redirectionUrl){var d,s;c.push({pathname:null===(d=e.redirectionUrl)||void 0===d?void 0:d.pathname,state:v({},null===(s=e.redirectionUrl)||void 0===s?void 0:s.state)})}else g(!0);_(e),E(!1)},setDisplayMenu:E,businessService:P,forcedActionPrefix:F,ActionBarStyle:k,MenuStyle:H,applicationDetails:T})))};function Pr(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var t=function(){var l=arguments,o=n?n.apply(this,l):l[0],i=t.cache;if(i.has(o))return i.get(o);var a=e.apply(this,l);return t.cache=i.set(o,a)||i,a};return t.cache=new(Pr.Cache||vn),t}Pr.Cache=vn;var Mr,xr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Br=/\\(\\)?/g;Mr=Pr(function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(xr,function(e,t,l,o){n.push(l?o.replace(Br,"$1"):t||e)}),n},function(e){return 500===Mr.size&&Mr.clear(),e}).cache;const Fr=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),Ur=(e,n)=>(n&&Object.keys(n).map(t=>{e=e.replace(":"+t,n[t])}),e),kr=e=>{let{register:n,reset:o,t:i}=e;return i("ES_SEARCH_APPLICATION_MOBILE_INVALID"),i("ERR_DEFAULT_INPUT_FIELD_MSG"),l.createElement(t.Fragment,null,l.createElement(a.SearchField,{style:{width:"100%"}},l.createElement("label",null,i("WS_PROPERTY_ID_LABEL")),l.createElement(a.TextInput,{name:"propertyId",inputRef:n({})})),l.createElement(a.SearchField,{className:"submit"},l.createElement(a.SubmitBar,{label:i("WS_SEARCH_CONNECTION_SEARCH_INTEGRATED_BUTTON"),submit:!0}),l.createElement("p",{onClick:()=>{o({searchType:"CONNECTION",mobileNumber:"",offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",propertyId:"",connectionNumber:"",oldConnectionNumber:""})}},i("WS_SEARCH_CONNECTION_RESET_BUTTON"))))},Hr=e=>{let{tenantId:n,onSubmit:u,data:d,count:s,resultOk:c,isLoading:v}=e;console.log("dafff",d);const{t:p}=o.useTranslation(),{register:m,control:E,handleSubmit:S,setValue:_,getValues:f,reset:g}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",searchType:"CONNECTION"}});t.useEffect(()=>{m("offset",0),m("limit",10),m("sortBy","commencementDate"),m("searchType","CONNECTION"),m("sortOrder","DESC"),m("propertyId","")},[m]);const C=t.useCallback(e=>{0!==e.length&&(_("sortBy",e.id),_("sortOrder",e.desc?"DESC":"ASC"))},[]),N=e=>l.createElement("span",{className:"cell-text"},e),y=t.useMemo(()=>[{Header:p("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a;let{row:r}=e;return l.createElement("div",null,r.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+r.original.connectionNo+"&tenantId="+n+"&service="+(null===(t=r.original)||void 0===t?void 0:t.service)+"&connectionType="+(null===(o=r.original)||void 0===o?void 0:o.connectionType)+"&due="+((null===(a=r.original)||void 0===a?void 0:a.due)||0)+"&from=WS_SEWERAGE_CONNECTION_SEARCH_LABEL"},r.original.connectionNo||"NA")):l.createElement("span",null,p("NA")))}},{Header:p("WS_COMMON_TABLE_COL_SERVICE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return N(null!=t&&null!==(n=t.original)&&void 0!==n&&n.applicationNo.includes("WS")?"Water Service":"Sewerage Service")}},{Header:p("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o,i;let{row:a}=e;return N(null!=a&&null!==(n=a.original)&&void 0!==n&&null!==(t=n.connectionHolders)&&void 0!==t&&t.map(e=>null==e?void 0:e.name).join(",")?null==a||null===(l=a.original)||void 0===l||null===(o=l.connectionHolders)||void 0===o?void 0:o.map(e=>null==e?void 0:e.name).join(","):""+((null===(i=a.original)||void 0===i?void 0:i.owner)||"NA"))}},{Header:p("WS_COMMON_TABLE_COL_STATUS_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return N(p("WS_"+(null===(n=l.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())))}},{Header:p("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return N(""+((null===(n=t.original)||void 0===n?void 0:n.due)||"NA"))}},{Header:p("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return N(""+((null===(n=t.original)||void 0===n?void 0:n.address)||"NA"))}},{Header:p("WS_COMMON_TABLE_COL_DUE_DATE_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o;let{row:i}=e;const a=(null===(n=i.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())||"",r="NA"===(null===(l=i.original)||void 0===l?void 0:l.dueDate)?p("WS_NA"):(e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()})(null===(o=i.original)||void 0===o?void 0:o.dueDate);return N(p("INACTIVE"===a?"WS_NA":""+r))}}],[]);return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},p("WS_WATER_SEWERAGE_INTEGRATED_BILL_SUB_HEADER")),l.createElement(a.SearchForm,{className:"ws-custom-wrapper",onSubmit:u,handleSubmit:S},l.createElement(kr,{register:m,control:E,reset:g,tenantId:n,t:p})),v?l.createElement(a.Loader,null):null,null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},p(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement("div",null,l.createElement(a.Table,{t:p,data:d,totalRecords:s,columns:y,getCellProps:e=>({style:{minWidth:e.column.Header===p("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){_("limit",Number(e.target.value)),S(u)()},currentPage:f("offset")/f("limit"),onNextPage:function(){_("offset",f("offset")+f("limit")),S(u)()},onPrevPage:function(){_("offset",f("offset")-f("limit")),S(u)()},pageSizeLimit:f("limit"),onSort:C,disableSort:!1,sortParams:[{id:f("sortBy"),desc:"DESC"===f("sortOrder")}]}),l.createElement("button",{className:"submit-bar",type:"button",onClick:function(){try{console.log("integrated",d);const e=function(){if((null==d?void 0:d.length)>0){const e=he(function(){return Promise.resolve(Digit.WSService.wnsGroupBill({propertyId:d[0].propertyId,tenantId:n})).then(function(e){((e,n)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var t=new FileReader;t.readAsDataURL(e),t.onloadend=function(){window.mSewaApp.downloadBase64File(t.result,"IntegratedBill.pdf")}}else{const n=document.createElement("a");n.href=URL.createObjectURL(e),n.download="IntegratedBill.pdf",document.body.append(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(n.href),7e3)}})(new Blob([e.data],{type:"application/pdf"}))})},function(e){console.log("errorrrrrr",e)});if(e&&e.then)return e.then(function(){})}else alert("NO Pdf")}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},style:{fontFamily:"sans-serif",color:"white",fontSize:"19px",marginTop:"10px",float:"right"}},p("WS_DOWNLOAD_BILL"))):null)},jr=e=>{var n;let{stateCode:t,userType:o,tenants:r}=e;(null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code)||Digit.ULBService.getCurrentTenantId();const{path:u}=i.useRouteMatch(),d=Digit.StoreData.getCurrentLanguage(),{isLoading:s}=Digit.Services.useStore({stateCode:t,moduleCode:"WS",language:d});return Digit.SessionStorage.set("WS_TENANTS",r),Digit.SessionStorage.set("PT_TENANTS",r),s?l.createElement(a.Loader,null):l.createElement("citizen"===o?z:ye,{path:u,stateCode:t})},Vr=e=>{let{matchPath:n}=e;const{t:t}=o.useTranslation(),i=[{link:n+"/my-bills",i18nKey:t("ACTION_TEST_WNS_MY_BILLS")},{link:n+"/my-payments",i18nKey:t("ACTION_TEST_MY_PAYMENTS")},{link:n+"/create-application",i18nKey:t("ACTION_TEST_APPLY_NEW_CONNECTION")},{link:n+"/search",i18nKey:t("ACTION_TEXT_WS_SEARCH_AND_PAY")},{link:n+"/my-applications",i18nKey:t("ACTION_TEXT_WS_MY_APPLICATION")},{link:n+"/my-connections",i18nKey:t("ACTION_TEXT_WS_MY_CONNECTION")}];return l.createElement(a.CitizenHomeCard,{header:t("ACTION_TEST_WATER_AND_SEWERAGE"),links:i,Icon:()=>l.createElement(a.WSICon,null)})},zr={WSModule:jr,WSLinks:Vr,WSServiceName:e=>{let{t:n,config:o,onSelect:i,userType:r,formData:u}=e;const[d,s]=t.useState((null==u?void 0:u.serviceName)||""),[c,v]=t.useState(u||{}),p=window.location.href.includes("/ws/edit-application/");return l.createElement("div",null,"citizen"===r&&l.createElement(Te,{currentStep:2}),l.createElement(a.FormStep,{t:n,config:o,onSelect:()=>{var e;if("WATER"==(null==d?void 0:d.code)?sessionStorage.setItem("serviceName","WATER"):"SEWERAGE"==(null==d?void 0:d.code)?sessionStorage.setItem("serviceName","SEWERAGE"):sessionStorage.setItem("serviceName",""),"BOTH"!=(null==d?void 0:d.code)&&(null==c||null===(e=c.serviceName)||void 0===e?void 0:e.code)!=(null==d?void 0:d.code)){let e=c;e.waterConectionDetails={},e.sewerageConnectionDetails={},e.serviceName=d,i("",e)}else i(o.key,d)},onSkip:()=>i(),isDisabled:!d,onAdd:function(){}},l.createElement(a.CardLabel,null,n("WS_SELECT_SERVICE_TYPE_WANT_TO_APPLY")),l.createElement(a.RadioOrSelect,{name:"gender",options:[{i18nKey:"WS_WATER_CONNECTION_ONLY",code:"WATER"},{i18nKey:"WS_SEWERAGE_CONNECTION_ONLY",code:"SEWERAGE"},{i18nKey:"WS_BOTH_WATER_AND_SEWERAGE",code:"BOTH"}],selectedOption:d,optionKey:"i18nKey",onSelect:function(e){s(e)},t:n,disabled:p})))},WSWaterConnectionDetails:e=>{var n,o;let{t:i,config:r,userType:u,onSelect:d,formData:s}=e;const c=Digit.ULBService.getStateId(),[p,m]=t.useState((null==s||null===(n=s.waterConectionDetails)||void 0===n?void 0:n.proposedTaps)||""),[E,S]=t.useState((null==s||null===(o=s.waterConectionDetails)||void 0===o?void 0:o.proposedPipeSize)||""),[_,f]=t.useState(!1),[g,C]=t.useState(null),[N,y]=t.useState(null),[D,T]=t.useState([]),{isLoading:h,data:A}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesCalculation(c);return t.useEffect(()=>{var e;if((null==A||null===(e=A.PipeSize)||void 0===e?void 0:e.length)>0){var n;let e=[];null==A||null===(n=A.PipeSize)||void 0===n||n.forEach(n=>{e.push({i18nKey:n.size+" "+i("WS_INCHES_LABEL"),code:n.size,id:n.id,size:n.size})}),T(e)}},[A]),l.createElement("div",null,"citizen"===u&&l.createElement(Te,{currentStep:2}),h?l.createElement(a.Loader,null):l.createElement(a.FormStep,{t:i,config:r,onSelect:()=>{var e,n,t,l;if((null==s||!s.WaterConnectionResult||null==s||null===(e=s.WaterConnectionResult)||void 0===e||null===(n=e.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t||!t.id)&&"WATER"===(null==s||null===(l=s.serviceName)||void 0===l?void 0:l.code)||null!=s&&s.isModifyConnection){f(!0);let e={};var o,i,a,u,c,m,S,_,g,N,D,T,h,A,I,O,b,L,R,w,W,P,M,x;e=null!=s&&s.isModifyConnection?{WaterConnection:v({},null==s||null===(o=s.WaterConnectionResult)||void 0===o||null===(i=o.WaterConnection)||void 0===i?void 0:i[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:{WaterConnection:{water:!0,sewerage:!1,property:v({},null==s||null===(a=s.cpt)||void 0===a?void 0:a.details),proposedTaps:p,proposedPipeSize:null==E?void 0:E.code,proposedWaterClosets:null,proposedToilets:null,connectionHolders:null!=s&&null!==(u=s.ConnectionHolderDetails)&&void 0!==u&&u.isOwnerSame?null:[{correspondenceAddress:null==s||null===(c=s.ConnectionHolderDetails)||void 0===c?void 0:c.address,fatherOrHusbandName:null==s||null===(m=s.ConnectionHolderDetails)||void 0===m?void 0:m.guardian,gender:null==s||null===(S=s.ConnectionHolderDetails)||void 0===S||null===(_=S.gender)||void 0===_?void 0:_.code,mobileNumber:null==s||null===(g=s.ConnectionHolderDetails)||void 0===g?void 0:g.mobileNumber,name:null==s||null===(N=s.ConnectionHolderDetails)||void 0===N?void 0:N.name,emailId:null==s||null===(D=s.ConnectionHolderDetails)||void 0===D?void 0:D.emailId,ownerType:(null==s||null===(T=s.ConnectionHolderDetails)||void 0===T||null===(h=T.specialCategoryType)||void 0===h?void 0:h.code)||"NONE",relationship:null==s||null===(A=s.ConnectionHolderDetails)||void 0===A||null===(I=A.relationship)||void 0===I?void 0:I.code,sameAsPropertyAddress:!1}],service:"Water",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(O=s.cptId)||void 0===O?void 0:O.id)||(null==s||null===(b=s.cpt)||void 0===b||null===(L=b.details)||void 0===L?void 0:L.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(R=s.cpt)||void 0===R||null===(w=R.details)||void 0===w||null===(W=w.address)||void 0===W||null===(P=W.locality)||void 0===P?void 0:P.code},tenantId:null==s||null===(M=s.cpt)||void 0===M||null===(x=M.details)||void 0===x?void 0:x.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1},Digit.WSService.create(e,"WATER").then((e,n)=>{f(!1);let t=v({},s,{WaterConnectionResult:e,waterConectionDetails:{proposedTaps:p,proposedPipeSize:E}});d("",t,"",!0)}).catch(e=>{var n,t,l;f(!1),C({key:"error"}),y((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}else{let e={};e.proposedTaps=p,e.proposedPipeSize=E,d(r.key,e)}},onSkip:()=>d(),isDisabled:!p||!E||_,onAdd:function(){}},l.createElement(a.CardLabel,null,i("WS_NO_OF_TAPS_PROPOSED"),"*"),l.createElement(a.TextInput,v({isMandatory:!1,optionKey:"i18nKey",t:i,name:"proposedTaps",onChange:function(e){m(e.target.value)},value:p},{isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:i("ERR_DEFAULT_INPUT_FIELD_MSG"),type:"text"})),l.createElement(a.CardLabel,null,i("WS_PROPOSED_PIPE_SIZE"),"*"),l.createElement(a.RadioOrSelect,{name:"proposedPipeSize",options:D,selectedOption:E,optionKey:"i18nKey",onSelect:function(e){S(e)},t:i})),g&&l.createElement(a.Toast,{error:"error"===(null==g?void 0:g.key),label:N,isDleteBtn:!0,onClose:()=>{C(null),y(null)}}))},WSDocsRequired:e=>{var n;let{onSelect:r,userType:u}=e;const{t:d}=o.useTranslation(),s=i.useHistory(),c=i.useRouteMatch(),v=Digit.ULBService.getStateId();sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists"),sessionStorage.removeItem("FORMSTATE_ERRORS");const{isLoading:p,data:m}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(v);var E;return"citizen"===u?l.createElement(t.Fragment,null,l.createElement(a.Card,null,l.createElement(a.CardHeader,null,d("WS_COMMON_APPL_NEW_CONNECTION")),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px",textAlign:"center"},textStyle:{color:"#0B0C0C"},text:d("WS_DOCS_REQUIRED_TIME"),showInfo:!1}),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},d("WS_NEW_CONNECTION_TEST_1")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},d("WS_NEW_CONNECTION_TEST_2")),l.createElement(a.CardSubHeader,null,d("WS_DOC_REQ_SCREEN_LABEL")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},d("WS_NEW_CONNECTION_TEST_3")),p?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,null==m||null===(E=m.Documents)||void 0===E?void 0:E.map((e,n)=>{var t;return l.createElement("div",null,l.createElement("div",{style:{fontWeight:700,marginBottom:"8px"},key:n},l.createElement("div",{style:{display:"flex"}},l.createElement("div",null,n+1+"."," "),l.createElement("div",null," "+d(null==e?void 0:e.code.replace(".","_"))))),l.createElement("div",{style:{marginBottom:"16px",marginLeft:"18px"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((n,t)=>{var o;return(null==e||null===(o=e.dropdownData)||void 0===o?void 0:o.length)!==t+1?l.createElement("span",null,d(null==n?void 0:n.i18nKey)+", "):l.createElement("span",null,""+d(null==n?void 0:n.i18nKey))})))})),l.createElement(a.SubmitBar,{label:d("CS_COMMON_NEXT"),onSubmit:()=>{r("DocsReq","")}}))):l.createElement("div",{style:{margin:"16px"}},l.createElement("div",null,l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px",display:"flex",justifyContent:"space-between",marginRight:"12px"}},l.createElement("div",null,d("WS_WATER_AND_SEWERAGE_NEW_CONNECTION_LABEL")),l.createElement("div",{onClick:()=>{let e=document.getElementById("documents-div").innerHTML;if(window.mSewaApp&&window.mSewaApp.isMsewaApp())window.mSewaApp.downloadBase64File(window.btoa(e),d("WS_REQ_DOCS"));else{let n=window.open("","");n.document.write("<html><body>"+e+"</body></html>"),n.document.close(),n.focus(),n.print()}},style:{cursor:"pointer",display:"flex"}},l.createElement(a.PrintBtnCommon,null),l.createElement("div",{style:{fontSize:"24px",fontWeight:"400",color:"#0B0C0C"}},"Print")))),l.createElement(a.Card,null,p?l.createElement(a.Loader,null):l.createElement("div",{id:"documents-div"},null==m||null===(n=m.Documents)||void 0===n?void 0:n.map((e,n)=>{var t;return l.createElement("div",{key:n,style:{marginTop:"16px"}},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",lineHeight:"28px",fontSize:"24px"}},d(null==e?void 0:e.code.replace(".","_"))),e.dropdownData&&e.dropdownData.length>1&&l.createElement("p",{style:{lineHeight:"24px",fontSize:"16px"}},d((null==e?void 0:e.code.replace(".","_"))+"_DESCRIPTION")),l.createElement("div",{style:{margin:"16px 0",lineHeight:"18px",fontSize:"16px"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((e,n)=>l.createElement("p",{style:{fontWeight:"bold",lineHeight:"32px"}},n+1+". "+d(null==e?void 0:e.i18nKey)))),l.createElement("p",{style:{fontSize:"16px"}},d((null==e?void 0:e.code.replace(".","_"))+"_BELOW_DESCRIPTION")))})),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:d("ACTION_TEST_APPLY"),onSubmit:()=>{s.push(c.path.replace("create-application","new-application"))},style:{margin:"10px 10px 0px 0px"},disabled:!!p}))))},WSDocumentDetails:e=>{var n,o;let{t:i,config:r,onSelect:u,userType:d,formData:s}=e;const c=Digit.ULBService.getStateId(),[p,m]=t.useState((null==s||null===(n=s.documents)||void 0===n?void 0:n.documents)||[]),[E,S]=t.useState(null),[_,f]=t.useState(!0),[g,C]=t.useState(!1),{isLoading:N,data:y}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(c);return t.useEffect(()=>{let e=0;null==y||y.Documents.map(n=>{let t=!1;p.map(e=>{n.required&&null!=e&&e.documentType.includes(n.code)&&(t=!0)}),!t&&n.required&&(e+=1)}),f("0"!=e&&0!=e||!(p.length>0))},[p,g]),l.createElement("div",null,"citizen"===d&&l.createElement(Te,{currentStep:3}),N?l.createElement(a.Loader,null):l.createElement(a.FormStep,{t:i,config:r,onSelect:()=>{let e;e=v({},s.documents,{documents:p}),u(r.key,e)},onSkip:()=>u(),isDisabled:_,onAdd:function(){}},null==y||null===(o=y.Documents)||void 0===o?void 0:o.map((e,n)=>l.createElement(Ae,{key:n,document:e,t:i,error:E,setError:S,setDocuments:m,documents:p,setCheckRequiredFields:C})),E&&l.createElement(a.Toast,{label:E,onClose:()=>S(null),error:!0})))},WSSewerageConnectionDetails:e=>{var n,o;let{t:i,config:r,userType:u,onSelect:d,formData:s}=e;const[c,p]=t.useState((null==s||null===(n=s.sewerageConnectionDetails)||void 0===n?void 0:n.proposedWaterClosets)||""),[m,E]=t.useState((null==s||null===(o=s.sewerageConnectionDetails)||void 0===o?void 0:o.proposedToilets)||""),[S,_]=t.useState(!1),[f,g]=t.useState(null),[C,N]=t.useState(null);let y={};return l.createElement("div",null,"citizen"===u&&l.createElement(Te,{currentStep:2}),l.createElement(a.FormStep,{t:i,config:r,onSelect:()=>{var e,n,t,l,o,i,a,u,p;if(null!=s&&s.SewerageConnectionResult&&null!=s&&null!==(e=s.SewerageConnectionResult)&&void 0!==e&&null!==(n=e.SewerageConnections)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&t.id&&(null==s||!s.isModifyConnection)||"SEWERAGE"!==(null==s||null===(l=s.serviceName)||void 0===l?void 0:l.code))if((null!=s&&s.SewerageConnectionResult&&null!=s&&null!==(o=s.SewerageConnectionResult)&&void 0!==o&&null!==(i=o.SewerageConnection)&&void 0!==i&&i.id||null!=s&&s.WaterConnectionResult&&null!=s&&null!==(a=s.WaterConnectionResult)&&void 0!==a&&null!==(u=a.WaterConnection)&&void 0!==u&&u.id)&&(null==s||!s.isModifyConnection)||"BOTH"!==(null==s||null===(p=s.serviceName)||void 0===p?void 0:p.code)){let e={};e.proposedWaterClosets=c,e.proposedToilets=m,d(r.key,e)}else{_(!0);let e={};var E,S,f,C,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z;null!=s&&s.isModifyConnection?payload={WaterConnection:v({},null==s||null===(E=s.WaterConnectionResult)||void 0===E||null===(S=E.WaterConnection)||void 0===S?void 0:S[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:e={WaterConnection:{water:!0,sewerage:!0,property:v({},null==s||null===(f=s.cpt)||void 0===f?void 0:f.details),proposedTaps:null==s||null===(C=s.waterConectionDetails)||void 0===C?void 0:C.proposedTaps,proposedPipeSize:null==s||null===(y=s.waterConectionDetails)||void 0===y||null===(D=y.proposedPipeSize)||void 0===D?void 0:D.code,proposedWaterClosets:parseInt(c),proposedToilets:parseInt(m),connectionHolders:null!=s&&null!==(T=s.ConnectionHolderDetails)&&void 0!==T&&T.isOwnerSame?null:[{correspondenceAddress:null==s||null===(h=s.ConnectionHolderDetails)||void 0===h?void 0:h.address,fatherOrHusbandName:null==s||null===(A=s.ConnectionHolderDetails)||void 0===A?void 0:A.guardian,gender:null==s||null===(I=s.ConnectionHolderDetails)||void 0===I||null===(O=I.gender)||void 0===O?void 0:O.code,mobileNumber:null==s||null===(b=s.ConnectionHolderDetails)||void 0===b?void 0:b.mobileNumber,name:null==s||null===(L=s.ConnectionHolderDetails)||void 0===L?void 0:L.name,emailId:null==s||null===(R=s.ConnectionHolderDetails)||void 0===R?void 0:R.emailId,ownerType:(null==s||null===(w=s.ConnectionHolderDetails)||void 0===w||null===(W=w.specialCategoryType)||void 0===W?void 0:W.code)||"NONE",relationship:null==s||null===(P=s.ConnectionHolderDetails)||void 0===P||null===(M=P.relationship)||void 0===M?void 0:M.code,sameAsPropertyAddress:!1}],service:"Water and Sewerage",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(x=s.cptId)||void 0===x?void 0:x.id)||(null==s||null===(B=s.cpt)||void 0===B||null===(F=B.details)||void 0===F?void 0:F.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(U=s.cpt)||void 0===U||null===(k=U.details)||void 0===k||null===(H=k.address)||void 0===H||null===(j=H.locality)||void 0===j?void 0:j.code},tenantId:null==s||null===(V=s.cpt)||void 0===V||null===(z=V.details)||void 0===z?void 0:z.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1};let n={};var Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e;n=null!=s&&s.isModifyConnection?{SewerageConnection:v({},null==s||null===(Y=s.SewerageConnectionResult)||void 0===Y||null===(G=Y.SewerageConnections)||void 0===G?void 0:G[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:{SewerageConnection:{water:!0,sewerage:!0,property:v({},null==s||null===(q=s.cpt)||void 0===q?void 0:q.details),proposedTaps:null==s||null===(K=s.waterConectionDetails)||void 0===K?void 0:K.proposedTaps,proposedPipeSize:null==s||null===(X=s.waterConectionDetails)||void 0===X||null===(Z=X.proposedPipeSize)||void 0===Z?void 0:Z.code,proposedWaterClosets:parseInt(c),proposedToilets:parseInt(m),connectionHolders:null!=s&&null!==($=s.ConnectionHolderDetails)&&void 0!==$&&$.isOwnerSame?null:[{correspondenceAddress:null==s||null===(J=s.ConnectionHolderDetails)||void 0===J?void 0:J.address,fatherOrHusbandName:null==s||null===(Q=s.ConnectionHolderDetails)||void 0===Q?void 0:Q.guardian,gender:null==s||null===(ee=s.ConnectionHolderDetails)||void 0===ee||null===(ne=ee.gender)||void 0===ne?void 0:ne.code,mobileNumber:null==s||null===(te=s.ConnectionHolderDetails)||void 0===te?void 0:te.mobileNumber,name:null==s||null===(le=s.ConnectionHolderDetails)||void 0===le?void 0:le.name,emailId:null==s||null===(oe=s.ConnectionHolderDetails)||void 0===oe?void 0:oe.emailId,ownerType:(null==s||null===(ie=s.ConnectionHolderDetails)||void 0===ie||null===(ae=ie.specialCategoryType)||void 0===ae?void 0:ae.code)||"NONE",relationship:null==s||null===(re=s.ConnectionHolderDetails)||void 0===re||null===(ue=re.relationship)||void 0===ue?void 0:ue.code,sameAsPropertyAddress:!1}],service:"Water and Sewerage",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(de=s.cptId)||void 0===de?void 0:de.id)||(null==s||null===(se=s.cpt)||void 0===se||null===(ce=se.details)||void 0===ce?void 0:ce.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(ve=s.cpt)||void 0===ve||null===(pe=ve.details)||void 0===pe||null===(me=pe.address)||void 0===me||null===(Ee=me.locality)||void 0===Ee?void 0:Ee.code},tenantId:null==s||null===(Se=s.cpt)||void 0===Se||null===(_e=Se.details)||void 0===_e?void 0:_e.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1},Digit.WSService.create(e,"WATER").then((e,t)=>{Digit.WSService.create(n,"SEWERAGE").then((n,t)=>{_(!1);let l=v({},s,{WaterConnectionResult:e,SewerageConnectionResult:n,sewerageConnectionDetails:{proposedWaterClosets:c,proposedToilets:m}});d("",l,"",!0)}).catch(e=>{var n,t,l;_(!1),g({key:"error"}),N((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}).catch(e=>{var n,t,l;_(!1),g({key:"error"}),N((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}else{_(!0);let e={};var fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He;e=null!=s&&s.isModifyConnection?{SewerageConnection:v({},null==s||null===(fe=s.SewerageConnectionResult)||void 0===fe||null===(ge=fe.SewerageConnections)||void 0===ge?void 0:ge[0],{processInstance:{action:"INITIATE"},channel:"CITIZEN"}),reconnectRequest:!1,disconnectRequest:!1}:{SewerageConnection:{water:!1,sewerage:!0,property:v({},null==s||null===(Ce=s.cpt)||void 0===Ce?void 0:Ce.details),proposedTaps:null,proposedPipeSize:null,proposedWaterClosets:parseInt(c),proposedToilets:parseInt(m),connectionHolders:null!=s&&null!==(Ne=s.ConnectionHolderDetails)&&void 0!==Ne&&Ne.isOwnerSame?null:[{correspondenceAddress:null==s||null===(ye=s.ConnectionHolderDetails)||void 0===ye?void 0:ye.address,fatherOrHusbandName:null==s||null===(De=s.ConnectionHolderDetails)||void 0===De?void 0:De.guardian,gender:null==s||null===(Te=s.ConnectionHolderDetails)||void 0===Te||null===(he=Te.gender)||void 0===he?void 0:he.code,mobileNumber:null==s||null===(Ae=s.ConnectionHolderDetails)||void 0===Ae?void 0:Ae.mobileNumber,name:null==s||null===(Ie=s.ConnectionHolderDetails)||void 0===Ie?void 0:Ie.name,emailId:null==s||null===(Oe=s.ConnectionHolderDetails)||void 0===Oe?void 0:Oe.emailId,ownerType:(null==s||null===(be=s.ConnectionHolderDetails)||void 0===be||null===(Le=be.specialCategoryType)||void 0===Le?void 0:Le.code)||"NONE",relationship:null==s||null===(Re=s.ConnectionHolderDetails)||void 0===Re||null===(we=Re.relationship)||void 0===we?void 0:we.code,sameAsPropertyAddress:!1}],service:"Sewerage",roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,propertyId:(null==s||null===(We=s.cptId)||void 0===We?void 0:We.id)||(null==s||null===(Pe=s.cpt)||void 0===Pe||null===(Me=Pe.details)||void 0===Me?void 0:Me.propertyId),additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==s||null===(xe=s.cpt)||void 0===xe||null===(Be=xe.details)||void 0===Be||null===(Fe=Be.address)||void 0===Fe||null===(Ue=Fe.locality)||void 0===Ue?void 0:Ue.code},tenantId:null==s||null===(ke=s.cpt)||void 0===ke||null===(He=ke.details)||void 0===He?void 0:He.tenantId,processInstance:{action:"INITIATE"},channel:"CITIZEN"},reconnectRequest:!1,disconnectRequest:!1},Digit.WSService.create(e,"SEWERAGE").then((e,n)=>{_(!1);let t=v({},s,{SewerageConnectionResult:e,sewerageConnectionDetails:{proposedWaterClosets:c,proposedToilets:m}});d("",t,"",!0)}).catch(e=>{var n,t,l;_(!1),g({key:"error"}),N((null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t||null===(l=t.Errors[0])||void 0===l?void 0:l.message)||null)})}},onSkip:()=>d(),isDisabled:!c||!m||S,onAdd:function(){}},l.createElement(a.CardLabel,null,i("WS_NO_OF_WATER_CLOSETS"),"*"),l.createElement(a.TextInput,v({type:"number",isMandatory:!1,optionKey:"i18nKey",t:i,name:"proposedWaterClosets",onChange:function(e){p(e.target.value)},value:c},y={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:i("ERR_DEFAULT_INPUT_FIELD_MSG")})),l.createElement(a.CardLabel,null,i("WS_SERV_DETAIL_NO_OF_TOILETS"),"*"),l.createElement(a.TextInput,v({type:"number",isMandatory:!1,optionKey:"i18nKey",t:i,name:"proposedToilets",onChange:function(e){E(e.target.value)},value:m},y={isRequired:!0,pattern:"^[1-9]+[0-9]*$",title:i("ERR_DEFAULT_INPUT_FIELD_MSG")}))),f&&l.createElement(a.Toast,{error:"error"===(null==f?void 0:f.key),label:C,isDleteBtn:!0,onClose:()=>{g(null),N(null)}}))},WSPlumberPreference:e=>{var n;let{t:o,config:i,onSelect:r,userType:u,formData:d}=e;const[s,c]=t.useState((null==d||null===(n=d.plumberPreference)||void 0===n?void 0:n.plumberPreference)||{i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE",code:"ULB"});return l.createElement("div",null,"citizen"===u&&l.createElement(Te,{currentStep:2}),l.createElement(a.FormStep,{t:o,config:i,onSelect:()=>{r(i.key,{plumberPreference:s})},onSkip:()=>r(),isDisabled:!s,onAdd:function(){}},l.createElement(a.RadioOrSelect,{name:"plumberPreference",options:[{i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE",code:"ULB"},{i18nKey:"WS_I_WILL_ARRAGE_THE_PLUMBER_MYSELF",code:"Self"}],selectedOption:s,optionKey:"i18nKey",onSelect:function(e){c(e)},t:o,innerStyles:{display:"flex"},inputStyle:{marginTop:"10px"}})))},WSConnectionHolder:e=>{var n,o,i,r,u,d,s,c,p,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k;let{t:H,config:j,onSelect:V,userType:z,formData:Y}=e,G={};const[q,K]=t.useState((null==Y||null===(n=Y.ConnectionHolderDetails)||void 0===n?void 0:n.name)||(null==Y||null===(o=Y.formData)||void 0===o||null===(i=o.ConnectionHolderDetails)||void 0===i?void 0:i.name)||""),[X,Z]=t.useState((null==Y||null===(r=Y.ConnectionHolderDetails)||void 0===r?void 0:r.guardian)||(null==Y||null===(u=Y.formData)||void 0===u||null===(d=u.ConnectionHolderDetails)||void 0===d?void 0:d.guardian)||""),[$,J]=t.useState((null==Y||null===(s=Y.ConnectionHolderDetails)||void 0===s?void 0:s.gender)||(null==Y||null===(c=Y.formData)||void 0===c||null===(p=c.ConnectionHolderDetails)||void 0===p?void 0:p.gender)),[Q,ee]=t.useState((null==Y||null===(E=Y.ConnectionHolderDetails)||void 0===E?void 0:E.relationship)||(null==Y||null===(S=Y.formData)||void 0===S||null===(_=S.ConnectionHolderDetails)||void 0===_?void 0:_.relationship)),[ne,te]=t.useState((null==Y||null===(f=Y.ConnectionHolderDetails)||void 0===f?void 0:f.mobileNumber)||(null==Y||null===(g=Y.formData)||void 0===g||null===(C=g.ConnectionHolderDetails)||void 0===C?void 0:C.mobileNumber)||""),[le,oe]=t.useState((null==Y||null===(N=Y.ConnectionHolderDetails)||void 0===N?void 0:N.address)||(null==Y||null===(y=Y.formData)||void 0===y||null===(D=y.ConnectionHolderDetails)||void 0===D?void 0:D.address)||""),[ie,ae]=t.useState((null==Y||null===(T=Y.ConnectionHolderDetails)||void 0===T?void 0:T.documentId)||(null==Y||null===(h=Y.formData)||void 0===h||null===(A=h.ConnectionHolderDetails)||void 0===A?void 0:A.documentId)||""),[re,ue]=t.useState(0!=(null==Y||null===(I=Y.ConnectionHolderDetails)||void 0===I?void 0:I.isOwnerSame)&&0!=(null==Y||null===(O=Y.formData)||void 0===O||null===(b=O.ConnectionHolderDetails)||void 0===b?void 0:b.isOwnerSame)),[de,se]=t.useState((null==Y||null===(L=Y[j.key])||void 0===L?void 0:L.fileStoreId)||null),[ce,ve]=t.useState(null),[pe,me]=t.useState(null),[Ee,Se]=t.useState((null==Y||null===(R=Y.ConnectionHolderDetails)||void 0===R?void 0:R.documentType)||""),[_e,fe]=t.useState((null==Y||null===(w=Y.ConnectionHolderDetails)||void 0===w?void 0:w.specialCategoryType)||{});let ge=window.Digit.Utils.browser.isMobile();const[Ce,Ne]=t.useState((null==Y||null===(W=Y.ConnectionHolderDetails)||void 0===W?void 0:W.emailId)||(null==Y||null===(P=Y.formData)||void 0===P||null===(M=P.ConnectionHolderDetails)||void 0===M?void 0:M.emailId)||""),ye=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId());let De=[];const{data:Ae={}}=Digit.Hooks.pt.usePropertyMDMS(ye,"PropertyTax","Documents"),Ie=null==Ae||null===(x=Ae.PropertyTax)||void 0===x?void 0:x.Documents,Oe=Array.isArray(Ie)&&Ie.filter(e=>e.code.includes("SPECIALCATEGORYPROOF"));var be,Le;Oe.length>0&&(De=null===(be=Oe[0])||void 0===be?void 0:be.dropdownData,De.forEach(e=>{e.i18nKey=m(e.code,".","_")}),De=null===(Le=De)||void 0===Le?void 0:Le.filter(e=>e.parentValue.includes(null==_e?void 0:_e.code)),1==De.length&&Ee!=De[0]&&function(e){Se(e)}(De[0]));const{isLoading:Re,data:we}=Digit.Hooks.obps.useMDMS(ye,"common-masters",["GenderType"]),{data:We}=Digit.Hooks.pt.usePropertyMDMS(ye,"PropertyTax","OwnerType");We&&We.sort((e,n)=>e.name.localeCompare(n.name));let Pe=[];we&&we["common-masters"].GenderType.filter(e=>e.active).map(e=>{Pe.push({i18nKey:"COMMON_GENDER_"+e.code,code:""+e.code,value:""+e.code})});const Me=e=>{""===e||/^[a-zA-Z0-9._%+-]+@[a-z.-]+\.(com|org|in)$/.test(e)?me(""):me(H("CORE_INVALID_EMAIL_ID_PATTERN"))};t.useEffect(()=>{!function(){try{me(null);const e=function(){if(ce){const e=function(){if(ce.size>=2e6)me(H("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const e=he(function(){return Promise.resolve(Digit.UploadServices.Filestorage("property-upload",ce,Digit.ULBService.getStateId())).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?se(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):me(H("PT_FILE_UPLOAD_ERROR"))})},function(){me(H("PT_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)}}()},[ce]),t.useEffect(()=>{Ce&&Me(Ce)},[Ce]);const xe=Array.isArray(null==Y||null===(B=Y.cpt)||void 0===B||null===(F=B.details)||void 0===F?void 0:F.owners)?null==Y||null===(U=Y.cpt)||void 0===U||null===(k=U.details)||void 0===k?void 0:k.owners.slice().reverse():[];return l.createElement("div",null,"citizen"===z&&l.createElement(Te,{currentStep:2}),Re?l.createElement(a.Loader,null):l.createElement(a.FormStep,{config:j,onSelect:()=>{if(!pe)if(1==re){var e,n,t,l,o,i,a,r,u,d,s;let c={isOwnerSame:re,name:null==xe||null===(e=xe[0])||void 0===e?void 0:e.name,mobileNumber:null==xe||null===(n=xe[0])||void 0===n?void 0:n.mobileNumber,gender:null!=xe&&null!==(t=xe[0])&&void 0!==t&&t.gender?{code:null==xe||null===(l=xe[0])||void 0===l?void 0:l.gender,i18nKey:"COMMON_GENDER_"+(null==xe||null===(o=xe[0])||void 0===o?void 0:o.gender)}:null,guardian:null==xe||null===(i=xe[0])||void 0===i?void 0:i.fatherOrHusbandName,address:null==xe||null===(a=xe[0])||void 0===a?void 0:a.permanentAddress,emailId:null==xe||null===(r=xe[0])||void 0===r?void 0:r.emailId,relationship:null!=xe&&null!==(u=xe[0])&&void 0!==u&&u.relationship?{code:null==xe||null===(d=xe[0])||void 0===d?void 0:d.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==xe||null===(s=xe[0])||void 0===s?void 0:s.relationship)}:null,specialCategoryType:_e,documentId:ie,fileStoreId:de,documentType:Ee};V(j.key,c)}else V(j.key,{isOwnerSame:re,name:q,mobileNumber:ne,gender:$,guardian:X,address:le,relationship:Q,specialCategoryType:_e,emailId:Ce,documentId:ie,fileStoreId:de,documentType:Ee})},onSkip:()=>V(),t:H,isDisabled:!(re||q&&ne&&$&&X&&Q&&null!=_e&&_e.code&&le)},l.createElement("div",null,l.createElement(a.CheckBox,{label:H("WS_CONN_HOLDER_SAME_AS_OWNER_DETAILS"),onChange:e=>{ue(!re)},checked:re,style:{paddingBottom:"10px",paddingTop:"3px"}})),!re&&l.createElement("div",{style:{border:"solid",borderRadius:"5px",padding:"10px",paddingTop:"20px",marginTop:"10px",borderColor:"#f3f3f3",background:"#FAFAFA"}},l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_NAME")+"*"),l.createElement(a.TextInput,v({t:H,type:"text",style:{background:"#FAFAFA"},isMandatory:!1,optionKey:"i18nKey",name:"name",value:q,onChange:function(e){K(e.target.value)}},G={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:H("WS_NAME_ERROR_MESSAGE")})),l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_GENDER_LABEL")+"*"),l.createElement(a.RadioButtons,{t:H,options:Pe,optionsKey:"code",name:"gender",value:$,selectedOption:$,onSelect:function(e){J(e)},isDependent:!0,labelKey:"COMMON_GENDER"}),l.createElement(a.CardLabel,null,H("WS_OWN_MOBILE_NO")+"*"),l.createElement(a.MobileNumber,{value:ne,name:"mobileNumber",onChange:e=>function(e){te(e.target.value)}({target:{value:e}}),style:{background:"#FAFAFA"},required:!0,pattern:"[6-9]{1}[0-9]{9}",type:"tel",title:H("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID")}),l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_GUARDIAN_LABEL")+"*"),l.createElement(a.TextInput,v({t:H,type:"text",isMandatory:!1,optionKey:"i18nKey",name:"guardian",value:X,style:{background:"#FAFAFA"},onChange:function(e){Z(e.target.value)}},G={isRequired:!0,pattern:"^[a-zA-Z ]*$",type:"text",title:H("WS_NAME_ERROR_MESSAGE")})),l.createElement(a.CardLabel,null,H("WS_OWN_DETAIL_RELATIONSHIP_LABEL")+"*"),l.createElement(a.RadioButtons,{t:H,optionsKey:"i18nKey",name:"relationship",options:[{name:"Father",code:"FATHER",i18nKey:"COMMON_MASTERS_OWNERTYPE_FATHER"},{name:"HUSBAND",code:"HUSBAND",i18nKey:"COMMON_MASTERS_OWNERTYPE_HUSBAND"}],value:Q,selectedOption:Q,onSelect:function(e){ee(e)},isDependent:!0,labelKey:"COMMON_MASTERS_OWNERTYPE"}),l.createElement(a.CardLabel,null,H("WS_COMMON_TABLE_COL_ADDRESS")+"*"),l.createElement(a.TextInput,v({t:H,type:"text",style:{background:"#FAFAFA"},isMandatory:!1,optionKey:"i18nKey",name:"address",value:le,onChange:function(e){oe(e.target.value)}},G={isRequired:!0,title:H("WS_ADDR_ERROR_MESSAGE")})),l.createElement(a.CardLabel,null,H("WS_OWN_SPECIAL_CAT_LABEL")+"*"),l.createElement(a.Dropdown,{className:"form-field",selected:_e,style:ge?{}:{width:"540px"},isMandatory:!0,option:We,select:function(e){fe(e)},optionKey:"i18nKey",t:H}),l.createElement("div",null,l.createElement(a.CardLabel,null,""+H("WS_EMAIL_ID")),l.createElement(a.TextInput,v({t:H,isMandatory:!1,name:"emailId",value:Ce,onChange:e=>{const n=e.target.value;Ne(n),Me(n)}},G={pattern:"[A-Za-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$",type:"Email",title:H("CORE_COMMON_APPLICANT_EMAILI_ID_INVALID")})),pe&&l.createElement("span",{style:{color:"red"}},pe)))))},WSInfoLabel:j,WSActivationDetails:e=>{let{t:n}=e;const[t,o]=l.useState({meterId:"",meterInstallationDate:"",meterInitialReading:"",connectionExecutionDate:""});return l.useEffect(()=>{}),l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_METER_ID")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{t:n,type:"text",optionKey:"i18nKey",name:"meterId",value:t.meterId,onChange:e=>{o(v({},t,{meterId:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_METER_INSTALLATION_DATE")),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:t.meterInstallationDate,onChange:e=>{o(v({},t,{meterInstallationDate:e}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_INIT_METER_READING")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{value:t.meterInitialReading,onChange:e=>{o(v({},t,{meterInitialReading:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},""+n("WS_CONN_EXEC_DATE")),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:t.connectionExecutionDate,onChange:e=>{o(v({},t,{connectionExecutionDate:e}))}}))))},WSConnectionDetails:e=>{var n;let{config:r,onSelect:u,userType:d,formData:s,setError:c,formState:p,clearErrors:m}=e;const{t:E}=o.useTranslation(),[S,_]=(i.useLocation(),t.useState(null!=s&&s.ConnectionDetails?[null==s||null===(n=s.ConnectionDetails)||void 0===n?void 0:n[0]]:[{water:!0,sewerage:!1,proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])),[f,g]=t.useState({index:-1,type:""}),C=Digit.ULBService.getStateId(),[N,y]=t.useState(!1),[D,T]=t.useState({water:!0,sewerage:!1}),[h,A]=t.useState([]),{isWSServicesCalculationLoading:I,data:O}=Digit.Hooks.ws.useMDMS(C,"ws-services-calculation",["PipeSize"]);if(t.useEffect(()=>{const e=S.map(e=>e);u(null==r?void 0:r.key,e)},[S]),t.useEffect(()=>{var e;const n=(null==O||null===(e=O["ws-services-calculation"])||void 0===e?void 0:e.PipeSize)||[];null==n||n.forEach(e=>e.i18nKey=e.size),A(n)},[O]),t.useEffect(()=>{var e,n;"employee"===d&&u(r.key,v({},s[r.key],S)),null!=S&&null!==(e=S[0])&&void 0!==e&&e.water&&T({water:!0,sewerage:!1}),null!=S&&null!==(n=S[0])&&void 0!==n&&n.sewerage&&T({water:!1,sewerage:!0})},[S]),t.useEffect(()=>{null!=s&&s.ConnectionDetails||_([{water:!0,sewerage:!1,proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])},[null==s?void 0:s.ConnectionDetails]),I)return l.createElement(a.Loader,null);const b={focusIndex:f,connectionDetails:S,setFocusIndex:g,formData:s,formState:p,t:E,setError:c,clearErrors:m,config:r,setConnectionDetails:_,setIsErrors:y,isErrors:N,pipeSizeList:h,wsServicesCalculationData:O,waterSewarageSelection:D,formData:s};return l.createElement(l.Fragment,null,S.map((e,n)=>l.createElement(Ie,v({key:e.key,index:n,connectionDetail:e},b))))},WSDocumentsRequired:()=>l.createElement("div",null,"WSDocumentsRequired"),WSPlumberDetails:e=>{let{t:n,config:t}=e;const[o,i]=l.useState({plumberName:"",plumberMobileNo:"",plumberLicenseNo:"",plumberProvideBy:{code:"",value:"",i18nKey:""}});return l.useEffect(()=>{}),l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_PROVIDED_BY")),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{t:n,key:null==t?void 0:t.key,selected:o.plumberProvideBy,select:e=>{i(v({},o,{plumberProvideBy:e}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_LICENSE_NUMBER")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:t.key,value:o.plumberLicenseNo,onChange:e=>{i(v({},o,{plumberLicenseNo:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_NAME")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:t.key,value:o.plumberName,onChange:e=>{i(v({},o,{plumberName:e.target.value}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},n("WS_PLUMBER_MOB_NUMBER")),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:t.key,value:o.plumberMobileNo,onChange:e=>{i(v({},o,{plumberMobileNo:e.target.value}))}}))))},WSRoadCuttingDetails:e=>{let{config:n,onSelect:r,formData:u,setError:d,formState:s,clearErrors:c}=e;const{t:p}=o.useTranslation(),{pathname:m}=i.useLocation(),E=m.includes("/modify-application/"),S=Digit.ULBService.getStateId(),{isMdmsLoading:_,data:f}=Digit.Hooks.ws.useMDMS(S,window.location.href.includes("sewerage")?"sw-services-calculation":"ws-services-calculation",["RoadType"]),[g,C]=t.useState((null==u?void 0:u.roadCuttingDetails)||[Oe()]),[N,y]=t.useState({index:-1,type:""});t.useEffect(()=>{r(null==n?void 0:n.key,g)},[g]);const D={focusIndex:N,allRoadCuttingDetails:g,setFocusIndex:y,removeroadCutt:e=>{C(null!==(null==e?void 0:e.id)?n=>n.map(n=>n.key==e.key&&null!==n.id?v({},e,{id:n.id,status:"INACTIVE"}):v({},n)):n=>n.filter(n=>n.key!=e.key))},formData:u,formState:s,setRoadCuttingDetails:C,mdmsData:f,t:p,setError:d,clearErrors:c,config:n,isEditScreen:E};return _?l.createElement(Loader,null):l.createElement(l.Fragment,null,g.filter(e=>"INACTIVE"!==e.status).map((e,n)=>l.createElement(be,v({key:e.key,index:n,roadCutt:e},D))),l.createElement(a.LinkButton,{label:p("WS_ADD_ROAD_TYPE"),onClick:()=>{const e=Oe();C(n=>[...n,e])},style:{color:"orange",display:"inline-block"}}))},WSPropertyDetails:e=>{var n,t,o,r,u,d;let{t:s,config:c,onSelect:v,formData:p}=e;const[m,E]=l.useState(""),S=null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code,{isLoading:_,data:f}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:null==p||null===(t=p.cptId)||void 0===t?void 0:t.id},tenantId:S},{filters:{propertyIds:null==p||null===(o=p.cptId)||void 0===o?void 0:o.id},tenantId:S});return _?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("PROPERTY_ID")),l.createElement("div",{className:"field",style:{marginTop:"20px"}},l.createElement(a.TextInput,{key:c.key,value:m,onChange:e=>{E(e.target.value),v(c.key,{id:e.target.value})},style:{width:"65%",float:"left",marginRight:"20px"}}),l.createElement("button",{className:"submit-bar",type:"button",onClick:()=>E(m)},""+s("PT_SEARCH")))),l.createElement(i.Link,{to:"/digit-ui/employee/pt/search"},l.createElement(a.LinkButton,{label:s("CPT_SEARCH_PROPERTY"),style:{color:"#a82227",display:"inline-block"}}))," | ",l.createElement(i.Link,{to:"/digit-ui/employee/pt/new-application"},l.createElement(a.LinkButton,{label:s("CPT_CREATE_PROPERTY"),style:{color:"#a82227",display:"inline-block"}})),f&&(null==f?void 0:f.Properties.length)&&l.createElement(l.Fragment,null,l.createElement("header",{className:"card-section-header",style:{marginBottom:0,marginTop:"20px"}},s("PT_DETAILS")),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("PROPERTY_ID")),l.createElement("div",{className:"field"},l.createElement("p",null,null==f||null===(r=f.Properties[0])||void 0===r?void 0:r.propertyId))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("OWNER_NAME")),l.createElement("div",{className:"field"},l.createElement("p",null,null==f||null===(u=f.Properties[0])||void 0===u||null===(d=u.owners[0])||void 0===d?void 0:d.name))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller"},""+s("PROPERTY_ADDRESS")),l.createElement("div",{className:"field"},l.createElement("p",null,(()=>{var e,n,t,l,o,i,a;const r=null==f||null===(e=f.Properties)||void 0===e?void 0:e.at(0),u=null==r?void 0:r.doorNo,d=null==r||null===(n=r.address)||void 0===n?void 0:n.street,s=null==r||null===(t=r.address)||void 0===t?void 0:t.landmark,c=null==r||null===(l=r.address)||void 0===l||null===(o=l.locality)||void 0===o?void 0:o.name,v=null==r||null===(i=r.address)||void 0===i?void 0:i.city,p=null==r||null===(a=r.address)||void 0===a?void 0:a.pincode;return(u?u+", ":"")+"\n "+(d?d+", ":"")+"\n "+(s?s+", ":"")+"\n "+(c?c+", ":"")+"\n "+(v||"")+"\n "+(p?", "+p:"")})()))),l.createElement(i.Link,{to:"/digit-ui/employee/commonpt/view-property?propertyId="+m+"&tenantId="+S},l.createElement(a.LinkButton,{label:s("CPT_COMPLETE_PROPERTY_DETAILS"),style:{color:"#a82227"}}))))},WSConnectionHolderDetails:e=>{var n,a,r,u;let{config:d,onSelect:s,userType:c,formData:p,setError:E,formState:S,clearErrors:_}=e;const{t:f}=o.useTranslation(),C=(i.useLocation(),g(location.search)),[N,y]=t.useState(null!=p&&p.ConnectionHolderDetails?[v({},null==p||null===(n=p.ConnectionHolderDetails)||void 0===n?void 0:n[0])]:[{sameAsOwnerDetails:!0,name:"",gender:"",mobileNumber:"",guardian:"",relationship:"",address:"",ownerType:"",documentId:"",documentType:"",file:"",emailId:""}]),[D,T]=t.useState({index:-1,type:""}),h=Digit.ULBService.getStateId(),[A,I]=t.useState(!1),[O,b]=t.useState((null==p||null===(a=p[d.key])||void 0===a?void 0:a.fileStoreId)||null),[L,R]=t.useState(null),{data:w}=Digit.Hooks.obps.useMDMS(h,"common-masters",["GenderType"]);let W=[];w&&w["common-masters"].GenderType.filter(e=>e.active).map(e=>{W.push({i18nKey:"COMMON_GENDER_"+e.code,code:""+e.code,value:""+e.code})});let P=[];const{data:M={}}=Digit.Hooks.pt.usePropertyMDMS(h,"PropertyTax","Documents"),x=null==M||null===(r=M.PropertyTax)||void 0===r?void 0:r.Documents,B=Array.isArray(x)&&x.filter(e=>e.code.includes("SPECIALCATEGORYPROOF"));var F,U;B.length>0&&(P=null===(F=B[0])||void 0===F?void 0:F.dropdownData,P.forEach(e=>{e.i18nKey=m(e.code,".","_")}),P=null===(U=P)||void 0===U?void 0:U.filter(e=>{var n;return e.parentValue.includes(null==N||null===(n=N[0])||void 0===n?void 0:n.ownerType)}),1==P.length&&dropdownValue!=P[0]&&setTypeOfDropdownValue(P[0]));const{data:k}=Digit.Hooks.pt.usePropertyMDMS(h,"PropertyTax","OwnerType");k&&k.sort((e,n)=>e.name.localeCompare(n.name)),t.useEffect(()=>{const e=N.map(e=>e);s(null==d?void 0:d.key,e)},[N]),t.useEffect(()=>{var e;"employee"===c&&s(d.key,[v({},null===(e=p[d.key])||void 0===e?void 0:e[0],null==N?void 0:N[0])])},[N]),t.useEffect(()=>{var e,n,t,l,o,i,a,r,u,d,s,c,v,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B;e=sessionStorage.getItem("eyeIconClicked"),(window.location.href.includes("edit")||window.location.href.includes("modify"))&&null!=p&&p.ConnectionHolderDetails&&(null===(n=Object.values(null==p||null===(t=p.ConnectionHolderDetails)||void 0===t?void 0:t[0]))||void 0===n?void 0:n.length)>1&&("gender"===e&&null!=N&&null!==(l=N[0])&&void 0!==l&&null!==(o=l.gender)&&void 0!==o&&o.code&&(null==p||null===(i=p.ConnectionHolderDetails)||void 0===i||null===(a=i[0])||void 0===a||null===(r=a.gender)||void 0===r?void 0:r.code)!==(null==N||null===(u=N[0])||void 0===u||null===(d=u.gender)||void 0===d?void 0:d.code)||"connectionHoldersMobileNumber"===e&&null!=N&&null!==(s=N[0])&&void 0!==s&&s.mobileNumber&&(null==p||null===(c=p.ConnectionHolderDetails)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.mobileNumber)!==(null==N||null===(m=N[0])||void 0===m?void 0:m.mobileNumber)||"fatherOrHusbandName"===e&&null!=N&&null!==(E=N[0])&&void 0!==E&&E.guardian&&(null==p||null===(S=p.ConnectionHolderDetails)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.guardian)!==(null==N||null===(f=N[0])||void 0===f?void 0:f.guardian)||"relationship"===e&&null!=N&&null!==(g=N[0])&&void 0!==g&&null!==(C=g.relationship)&&void 0!==C&&C.code&&(null==p||null===(y=p.ConnectionHolderDetails)||void 0===y||null===(D=y[0])||void 0===D||null===(T=D.relationship)||void 0===T?void 0:T.code)!==(null==N||null===(h=N[0])||void 0===h||null===(A=h.relationship)||void 0===A?void 0:A.code)||"correspondenceAddress"===e&&null!=N&&null!==(I=N[0])&&void 0!==I&&I.address&&(null==p||null===(O=p.ConnectionHolderDetails)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.address)!==(null==N||null===(L=N[0])||void 0===L?void 0:L.address)||"ownerType"===e&&null!=N&&null!==(R=N[0])&&void 0!==R&&null!==(w=R.ownerType)&&void 0!==w&&w.code&&(null==p||null===(W=p.ConnectionHolderDetails)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.ownerType)||void 0===M?void 0:M.code)!==(null==N||null===(x=N[0])||void 0===x||null===(B=x.ownerType)||void 0===B?void 0:B.code))&&(sessionStorage.removeItem("eyeIconClicked"),window.location.reload())},[null==p||null===(u=p.ConnectionHolderDetails)||void 0===u?void 0:u[0],N,p]),t.useEffect(()=>{null!=p&&p.ConnectionHolderDetails||y([{sameAsOwnerDetails:!0,name:"",gender:"",mobileNumber:"",guardian:"",relationship:"",address:"",ownerType:"",documentId:"",documentType:"",file:"",emailId:""}])},[null==p?void 0:p.ConnectionHolderDetails]);const H={focusIndex:D,connectionHolderDetails:N,setFocusIndex:T,formData:p,formState:S,t:f,setError:E,clearErrors:_,config:d,setConnectionHolderDetails:y,setIsErrors:I,isErrors:A,connectionHolderDetails:N,filters:C,menu:W,uploadedFile:O,setUploadedFile:b,file:L,setFile:R,dropdownData:P,GuardianOptions:[{name:"HUSBAND",code:"HUSBAND",i18nKey:"COMMON_MASTERS_OWNERTYPE_HUSBAND"},{name:"Father",code:"FATHER",i18nKey:"COMMON_MASTERS_OWNERTYPE_FATHER"}],Menu:k};return l.createElement(l.Fragment,null,N.map((e,n)=>l.createElement(Le,v({key:e.key,index:n,connectionHolderDetail:e},H))))},WSActivationConnectionDetails:e=>{var n,r,u;let{config:d,onSelect:s,userType:c,formData:p,setError:E,formState:S,clearErrors:_}=e;const{t:f}=o.useTranslation(),C=(i.useLocation(),g(location.search)),[N,y]=window.location.href.includes("modify")?t.useState(null!=p&&p.connectionDetails?[null==p||null===(n=p.connectionDetails)||void 0===n?void 0:n[0]]:[Rt(null==C||null===(r=C.service)||void 0===r?void 0:r.toUpperCase())]):t.useState((null==p?void 0:p.connectionDetails)||[Rt(null==C||null===(u=C.service)||void 0===u?void 0:u.toUpperCase())]),[D,T]=t.useState({index:-1,type:""}),h=(Digit.ULBService.getCurrentTenantId(),Digit.ULBService.getStateId()),[A,I]=t.useState(!1),[O,b]=t.useState([]),[L,R]=t.useState([]),[w,W]=t.useState([]),[P,M]=t.useState([]),{isMdmsLoading:x,data:B}=Digit.Hooks.ws.useMDMS(h,"ws-services-masters",["connectionType","waterSource"]),{isWSServicesCalculationLoading:F,data:U}=Digit.Hooks.ws.useMDMS(h,"ws-services-calculation",["PipeSize"]);if(t.useEffect(()=>{const e=N.map(e=>e);s(null==d?void 0:d.key,e)},[N]),t.useEffect(()=>{var e,n,t,l,o,i;const a=(null==U||null===(e=U["ws-services-calculation"])||void 0===e?void 0:e.PipeSize)||[];null==a||a.forEach(e=>e.i18nKey=e.size);const r=(null==B||null===(n=B["ws-services-masters"])||void 0===n?void 0:n.connectionType)||[];null==r||r.forEach(e=>{var n;return e.i18nKey="WS_CONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")});const u=(null==B||null===(t=B["ws-services-masters"])||void 0===t?void 0:t.waterSource)&&Lt(null==B||null===(l=B["ws-services-masters"])||void 0===l?void 0:l.waterSource)||[];null==u||u.forEach(e=>{var n,t;return e.i18nKey="WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(n=e.code)||void 0===n||null===(t=n.split(".")[0])||void 0===t?void 0:t.toUpperCase()," ","_")});var d,s=[],c=[],v=u.length;for(d=0;d<v;d++){var p,E;s[u[d].i18nKey]||(s[u[d].i18nKey]=!0,c.push({i18nKey:null==u||null===(p=u[d])||void 0===p?void 0:p.i18nKey,code:null==u||null===(E=u[d])||void 0===E?void 0:E.code}))}if(b(a),R(r),W(c),null!=N&&null!==(o=N[0])&&void 0!==o&&null!==(i=o.waterSource)&&void 0!==i&&i.code){var S,_;const e=(null==B||null===(S=B["ws-services-masters"])||void 0===S?void 0:S.waterSource)&&Lt(null==B||null===(_=B["ws-services-masters"])||void 0===_?void 0:_.waterSource)||[];null==e||e.forEach(e=>{var n;return e.i18nKey="WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase(),".","_")});const n=null==e?void 0:e.filter(e=>{var n,t,l,o;return(null==N||null===(n=N[0])||void 0===n||null===(t=n.waterSource)||void 0===t||null===(l=t.code)||void 0===l?void 0:l.split(".")[0])==(null==e||null===(o=e.code)||void 0===o?void 0:o.split(".")[0])});M(n)}},[B,U]),t.useEffect(()=>{"employee"===c&&s(d.key,v({},p[d.key],N))},[N]),x||F)return l.createElement(a.Loader,null);const k={focusIndex:D,allOwners:N,setFocusIndex:T,formData:p,formState:S,t:f,setError:E,clearErrors:_,config:d,setConnectionDetails:y,setIsErrors:I,isErrors:A,connectionDetails:N,connectionTypeList:L,waterSourceList:w,waterSubSourceList:P,pipeSizeList:O,filters:C,setWaterSubSourceList:M,mdmsData:B};return l.createElement(l.Fragment,null,N.map((e,n)=>l.createElement(wt,v({key:e.key,index:n,connectionDetail:e},k))))},WSActivationPlumberDetails:e=>{var n,i;let{config:a,onSelect:r,formData:u,setError:d,formState:s,clearErrors:c}=e;const{t:p}=o.useTranslation(),m=g(location.search),[E,S]=t.useState((null==u?void 0:u.plumberDetails)||[[{plumberName:"",plumberMobileNo:"",plumberLicenseNo:"",detailsProvidedBy:""}]]),[_,f]=t.useState({index:-1,type:""}),[C,N]=t.useState(!1);t.useEffect(()=>{const e=E.map(e=>e);r(null==a?void 0:a.key,e)},[E,null==u||null===(n=u.connectionDetails)||void 0===n||null===(i=n[0])||void 0===i?void 0:i.connectionType]);const y={focusIndex:_,allOwners:E,setFocusIndex:f,formData:u,formState:s,t:p,setError:d,clearErrors:c,config:a,setPlumberDetails:S,setIsErrors:N,isErrors:C,plumberDetails:E,filters:m,options:[{i18nKey:"WS_PLUMBER_ULB",code:"ULB"},{i18nKey:"WS_PLUMBER_SELF",code:"Self"}],setPlumberDetails:S};return l.createElement(l.Fragment,null,E.map((e,n)=>l.createElement(Wt,v({key:e.key,index:n,plumberDetail:e},y))))},WSActivationPageDetails:e=>{var n;let{config:i,onSelect:a,userType:r,formData:u,setError:d,formState:s,clearErrors:c}=e;const{t:p}=o.useTranslation(),m=g(location.search),[E,S]=window.location.href.includes("modify")?t.useState(null!=u&&u.activationDetails?[null==u||null===(n=u.activationDetails)||void 0===n?void 0:n[0]]:[{meterId:"",meterInstallationDate:null,meterInitialReading:"",connectionExecutionDate:null}]):t.useState((null==u?void 0:u.activationDetails)||[{meterId:"",meterInstallationDate:null,meterInitialReading:"",connectionExecutionDate:null}]),[_,f]=t.useState({index:-1,type:""}),[C,N]=t.useState(!1);t.useEffect(()=>{const e=E.map(e=>e);a(null==i?void 0:i.key,e)},[E]),t.useEffect(()=>{"employee"===r&&a(i.key,v({},u[i.key],E))},[E]);const y={focusIndex:_,allOwners:E,setFocusIndex:f,formData:u,formData2:u,formState:s,t:p,setError:d,clearErrors:c,config:i,setActivationDetails:S,setIsErrors:N,isErrors:C,activationDetails:E,filters:m};return l.createElement(l.Fragment,null,E.map((e,n)=>l.createElement(Pt,v({key:e.key,index:n,activationDetail:e},y))))},WSActivationCommentsDetails:e=>{var n;let{t:o,config:i,userType:r,formData:u,onSelect:d}=e;const[s,c]=t.useState({comments:(null==u||null===(n=u.comments)||void 0===n?void 0:n.comments)||""});return t.useEffect(()=>{}),t.useEffect(()=>{"employee"===r&&d(i.key,v({},u[i.key],s))},[s]),l.createElement(l.Fragment,null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"700"},className:"card-label-smaller"},o("WF_COMMON_COMMENTS"),":"),l.createElement("div",{className:"field"},l.createElement(a.TextInput,{key:i.key,value:s.comments,onChange:e=>{c(v({},s,{comments:e.target.value}))}}))))},WSActivationSupportingDocuments:e=>{var n,o;let{t:i,config:r,userType:u,formData:d,onSelect:s}=e;Digit.ULBService.getStateId();const c=Digit.ULBService.getCurrentTenantId(),[p,m]=t.useState(null!=d&&null!==(n=d.supportingDocuments)&&void 0!==n&&n[0]?[null==d||null===(o=d.supportingDocuments)||void 0===o?void 0:o[0]]:[]),[E,S]=t.useState(null),[_,f]=t.useState(null),[g,C]=t.useState(null);return t.useEffect(()=>{s(r.key,{documents:p})},[p]),t.useEffect(()=>{"employee"===u&&s(r.key,v({},d[r.key],p))},[p]),t.useEffect(()=>{!function(){try{S(null);const e=function(){if(g){const e=/(.*?)(jpg|jpeg|png|image|pdf)$/i,n=function(){if(g.size>=5242880)S(i("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));else{const n=function(){if(null!=g&&g.type&&!e.test(null==g?void 0:g.type))S(i("NOT_SUPPORTED_FILE_TYPE"));else{const e=he(function(){return Promise.resolve(Digit.UploadServices.Filestorage("WS",g,c)).then(function(e){var n,t,l,o;(null==e||null===(n=e.data)||void 0===n||null===(t=n.files)||void 0===t?void 0:t.length)>0?f(null==e||null===(l=e.data)||void 0===l||null===(o=l.files[0])||void 0===o?void 0:o.fileStoreId):S(i("CS_FILE_UPLOAD_ERROR"))})},function(){S(i("CS_FILE_UPLOAD_ERROR"))});if(e&&e.then)return e.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();e&&e.then&&e.then(function(){})}catch(e){Promise.reject(e)}}()},[g]),t.useEffect(()=>{_&&m(e=>[{fileStoreId:_,documentUid:_}])},[_]),l.createElement("div",null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{fontWeight:"700"}},i("WF_APPROVAL_UPLOAD_HEAD"),":"),l.createElement("div",{className:"field"},l.createElement(a.UploadFile,{onUpload:e=>{!function(e){C(e.target.files[0])}(e)},onDelete:()=>{f(null)},message:_?"1 "+i("CS_ACTION_FILEUPLOADED"):i("CS_ACTION_NO_FILEUPLOADED"),textStyles:{width:"100%"},inputStyles:{width:"280px"},buttonType:"button",accept:"image/*, .pdf, .png, .jpeg, .jpg",iserror:E}))))},WSDocumentsEmployee:e=>{var n,o,r,u;let{t:d,config:s,onSelect:c,formData:v,setError:p,clearErrors:m,formState:E}=e;Digit.ULBService.getCurrentTenantId();const S=Digit.ULBService.getStateId(),[_,f]=t.useState((null==v||null===(n=v.DocumentsRequired)||void 0===n?void 0:n.documents)||[]),[g,C]=t.useState(null),N=window.location.href.includes("modify")?"ModifyConnectionDocuments":window.location.href.includes("disconnection")?"DisconnectionDocuments":"Documents";let y="create";const{pathname:D}=i.useLocation(),T=D.includes("/modify-application/");D.includes("/property-mutate/"),T&&(y="update");const{isLoading:h,data:A}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(S,N);if(t.useEffect(()=>{c(s.key,{documents:_})},[_]),h)return l.createElement(a.Loader,null);const I=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS"));if(window.location.href.includes("edit")&&(null==I||null===(o=I.applicationData)||void 0===o||null===(r=o.documents)||void 0===r?void 0:r.length)>0){var O;const e=(null==I||null===(O=I.applicationData)||void 0===O?void 0:O.documents)||[];null==e||e.map(e=>{var n;null==A||null===(n=A[N])||void 0===n||n.forEach(n=>{var t,l,o,i,a,r,u,d;(null!=n&&null!==(t=n.code)&&void 0!==t&&t.split(".")[1]?(null==n||null===(l=n.code)||void 0===l?void 0:l.split(".")[0])+"."+(null==n||null===(o=n.code)||void 0===o?void 0:o.split(".")[1]):null==n||null===(i=n.code)||void 0===i?void 0:i.split(".")[0])==(null!=e&&null!==(a=e.documentType)&&void 0!==a&&a.split(".")[1]?(null==e||null===(r=e.documentType)||void 0===r?void 0:r.split(".")[0])+"."+(null==e||null===(u=e.documentType)||void 0===u?void 0:u.split(".")[1]):null==e||null===(d=e.documentType)||void 0===d?void 0:d.split(".")[0])&&(n.auditDetails=e.auditDetails,n.documentType=n.documentType,n.documentUid=e.documentUid,n.fileStoreId=e.fileStoreId,n.id=e.id,n.status="ACTIVE")})})}return l.createElement("div",null,null==A||null===(u=A[N])||void 0===u?void 0:u.map((e,n)=>l.createElement(Mt,{key:n,document:e,action:y,t:d,id:"pt-document-"+n,error:g,setError:C,setDocuments:f,documents:_,formData:v,setFormError:p,clearFormErrors:m,config:s,formState:E})),g&&l.createElement(a.Toast,{label:g,onClose:()=>C(null),error:!0}))},WSEditConnectionDetails:e=>{var n;let{config:r,onSelect:u,userType:d,formData:s,setError:c,formState:p,clearErrors:m}=e,E=g(location.search);const S=null==E?void 0:E.applicationNumber,{t:_}=o.useTranslation(),[f,C]=(i.useLocation(),t.useState(null!=s&&s.ConnectionDetails?[null==s||null===(n=s.ConnectionDetails)||void 0===n?void 0:n[0]]:[{water:!0,sewerage:!1,applicationNo:"",serviceName:"",proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])),[N,y]=t.useState({index:-1,type:""}),D=Digit.ULBService.getStateId(),[T,h]=t.useState(!1),[A,I]=t.useState({water:!0,sewerage:!1}),[O,b]=t.useState([]),{isWSServicesCalculationLoading:L,data:R}=Digit.Hooks.ws.useMDMS(D,"ws-services-calculation",["PipeSize"]);if(t.useEffect(()=>{const e=f.map(e=>e);u(null==r?void 0:r.key,e)},[f]),t.useEffect(()=>{var e;const n=(null==R||null===(e=R["ws-services-calculation"])||void 0===e?void 0:e.PipeSize)||[];null==n||n.forEach(e=>e.i18nKey=e.size),b(n)},[R]),t.useEffect(()=>{var e,n;"employee"===d&&u(r.key,v({},s[r.key],f)),null!=f&&null!==(e=f[0])&&void 0!==e&&e.water&&I({water:!0,sewerage:!1}),null!=f&&null!==(n=f[0])&&void 0!==n&&n.sewerage&&I({water:!1,sewerage:!0})},[f]),t.useEffect(()=>{null!=s&&s.ConnectionDetails||C([{water:!0,sewerage:!1,applicationNo:"",serviceName:"",proposedPipeSize:"",proposedTaps:"",proposedToilets:"",proposedWaterClosets:""}])},[null==s?void 0:s.ConnectionDetails]),L)return l.createElement(a.Loader,null);const w={focusIndex:N,connectionDetails:f,setFocusIndex:y,formData:s,formState:p,t:_,setError:c,clearErrors:m,config:r,setConnectionDetails:C,setIsErrors:h,isErrors:T,pipeSizeList:O,wsServicesCalculationData:R,waterSewarageSelection:A,applicationNumber:S};return l.createElement(l.Fragment,null,f.map((e,n)=>l.createElement(xt,v({key:e.key,index:n,connectionDetail:e},w))))},WSDisconnectionDocsRequired:e=>{var n;let{userType:r}=e;const{t:u}=o.useTranslation(),d=i.useHistory(),s=i.useRouteMatch(),c=Digit.ULBService.getStateId(),{isLoading:v,data:p}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(c,"DisconnectionDocuments");var m;return"citizen"===r?l.createElement(t.Fragment,null,l.createElement(a.Card,null,l.createElement(a.CardHeader,null,u("WS_COMMON_APPLICATION_DISCONNECTION")),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px"},textStyle:{color:"#0B0C0C",paddingLeft:"40px",paddingRight:"40px"},text:u("WS_DOCS_REQUIRED_TIME"),showInfo:!1}),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},u("WS_NEW_CONNECTION_TEST_1")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},u("WS_NEW_CONNECTION_TEST_2")),l.createElement(a.CardSubHeader,null,u("WS_DOC_REQ_SCREEN_LABEL")),l.createElement(a.CardText,{style:{color:"#0B0C0C",marginTop:"12px"}},u("WS_NEW_CONNECTION_TEST_3")),v?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,null==p||null===(m=p.DisconnectionDocuments)||void 0===m?void 0:m.map((e,n)=>{var t;return l.createElement("div",null,l.createElement("div",{style:{fontWeight:700,marginBottom:"8px"},key:n},l.createElement("div",{style:{display:"flex"}},l.createElement("div",null,n+1+"."," "),l.createElement("div",null," "+u(null==e?void 0:e.code.replace(".","_"))))),l.createElement("div",{style:{marginBottom:"16px",marginLeft:"18px",color:"gray"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((n,t)=>{var o;return(null==e||null===(o=e.dropdownData)||void 0===o?void 0:o.length)!==t+1?l.createElement("span",{style:{color:"gray"}},u(null==n?void 0:n.i18nKey)+", "):l.createElement("span",{style:{color:"gray"}},""+u(null==n?void 0:n.i18nKey))})))})),l.createElement(a.SubmitBar,{label:u("CS_COMMON_NEXT"),onSubmit:()=>{d.push(s.path.replace("docsrequired","application-form"))}}))):l.createElement("div",{style:{margin:"16px"}},l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px"}},u("WS_WATER_AND_SEWERAGE_DISCONNECTION")),l.createElement(a.Card,null,v?l.createElement(a.Loader,null):l.createElement("div",{id:"documents-div"},null==p||null===(n=p.DisconnectionDocuments)||void 0===n?void 0:n.map((e,n)=>{var t;return l.createElement("div",{key:n,style:{marginTop:"16px"}},l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px",lineHeight:"28px",fontSize:"24px"}},u(null==e?void 0:e.code.replace(".","_"))),e.dropdownData&&e.dropdownData.length>1&&l.createElement("p",{style:{lineHeight:"24px",fontSize:"16px"}},u((null==e?void 0:e.code.replace(".","_"))+"_DESCRIPTION")),l.createElement("div",{style:{margin:"16px 0",lineHeight:"18px",fontSize:"16px"}},null==e||null===(t=e.dropdownData)||void 0===t?void 0:t.map((e,n)=>l.createElement("p",{style:{fontWeight:"bold",lineHeight:"32px"}},n+1+". "+u(null==e?void 0:e.i18nKey)))),l.createElement("p",{style:{fontSize:"16px"}},u((null==e?void 0:e.code.replace(".","_"))+"_BELOW_DESCRIPTION")))})),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:u("ACTION_TEST_APPLY"),onSubmit:()=>{d.push(s.path.replace("docsrequired","application-form"))},style:{margin:"10px 10px 0px 0px"},disabled:!!v}))))},WSDisconnectionForm:e=>{var n,o,r,u,d,s,c,p,E,S,_;let{t:f,config:g,onSelect:C,userType:y}=e;const D=Digit.ULBService.getStateId(),T=Digit.ULBService.getCurrentTenantId(),h=window.Digit.Utils.browser.isMobile(),O=Digit.SessionStorage.get("WS_DISCONNECTION"),b=i.useHistory(),L=i.useRouteMatch(),[R,w]=t.useState({type:O.WSDisconnectionForm?O.WSDisconnectionForm.type:"",date:O.WSDisconnectionForm?O.WSDisconnectionForm.date:"",endDate:O.WSDisconnectionForm&&(null==O||null===(n=O.WSDisconnectionForm)||void 0===n?void 0:n.endDate)||"",reason:O.WSDisconnectionForm?O.WSDisconnectionForm.reason:"",documents:O.WSDisconnectionForm?O.WSDisconnectionForm.documents:[]}),[W,P]=t.useState(O.WSDisconnectionForm?O.WSDisconnectionForm.documents:[]),[M,x]=t.useState(null),[B,F]=t.useState([]),[U,k]=t.useState([]),[H,j]=t.useState(!1),[V,z]=t.useState(!1),{isMdmsLoading:Y,data:G}=Digit.Hooks.ws.useMDMS(D,"ws-services-masters",["disconnectionType"]),{data:q}=Digit.Hooks.ws.useMDMS(D,"ws-services-masters",["DisconnectionReason"]),{isLoading:K,data:X}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(D,"DisconnectionDocuments"),{isLoading:Z,data:$}=Digit.Hooks.ws.useDisconnectionWorkflow({tenantId:T}),J=window.location.href.includes("resubmit"),{mutate:Q}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:ee}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:ne}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:te}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),le=()=>{x(null)};t.useEffect(()=>{const e=v({},R);e.documents=W,w(e)},[W]),t.useEffect(()=>{var e;const n=(null==G||null===(e=G["ws-services-masters"])||void 0===e?void 0:e.disconnectionType)||[];null==n||n.forEach(e=>{var n;return e.i18nKey="WS_DISCONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")}),F(n)},[G]),t.useEffect(()=>{var e;const n=(null==q||null===(e=q["ws-services-masters"])||void 0===e?void 0:e.DisconnectionReason)||[];null==n||n.forEach(e=>{var n;return e.i18nKey="WS_DISCONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")}),k(n)},[q]),t.useEffect(()=>{Digit.SessionStorage.set("WS_DISCONNECTION",v({},O,{WSDisconnectionForm:R}))},[R]);const oe=()=>C(),ie=e=>{const n=v({},R);n[e.code]=e,w(n)};return Y||K||V||Z?l.createElement(a.Loader,null):"citizen"===y?l.createElement("div",null,"citizen"===y&&l.createElement(Ft,{currentStep:1}),l.createElement(a.FormStep,{config:g,onSelect:()=>C(g.key,{WSDisConnectionForm:R}),onSkip:oe,t:f},l.createElement("div",{style:{padding:"0px 10px 10px 10px"}},l.createElement(a.CardHeader,null,f(J?"RESUBMIT_DISCONNECTION_FORM":"WS_APPLICATION_FORM")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==O?void 0:O.connectionNo,className:"border-none"})),l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_TYPE")+"*"),l.createElement(a.RadioButtons,{t:f,options:B,optionsKey:"i18nKey",value:null===(ae=R.type)||void 0===ae||null===(re=ae.value)||void 0===re?void 0:re.code,selectedOption:null===(ue=R.type)||void 0===ue?void 0:ue.value,isMandatory:!1,onSelect:e=>ie({code:"type",value:e}),labelKey:"WS_DISCONNECTION_TYPE",inputStyle:h?{marginLeft:"unset"}:{}}),l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_PROPOSED_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium",width:Digit.Utils.browser.isMobile()?"150px":"unset"}},f("SHOULD_BE_DATE")+" "+(null==$?void 0:$.slaDays)+" "+f("DAYS_OF_APPLICATION_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.date,onChange:e=>{w(v({},R,{date:e}))}})),"Temporary"===(null===(de=R.type)||void 0===de||null===(se=de.value)||void 0===se?void 0:se.code)?l.createElement("div",null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_PROPOSED_END_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium",width:Digit.Utils.browser.isMobile()?"150px":"unset"}},f("SHOULD_BE_DATE")+" "+f("DAYS_OF_PROPOSED_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.endDate,onChange:e=>{w(v({},R,{endDate:e}))}}))):"",l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},f("WS_DISCONNECTION_REASON")+"*"),l.createElement(a.Dropdown,{option:U,isMandatory:!1,optionKey:"i18nKey",t:f,name:"reason",value:null===(ce=R.reason)||void 0===ce||null===(ve=ce.value)||void 0===ve?void 0:ve.code,selectedOption:null===(pe=R.reason)||void 0===pe?void 0:pe.value,labelKey:"WS_DISCONNECTION_REASON",select:e=>ie({code:"reason",value:e})})),l.createElement(a.SubmitBar,{label:f("CS_COMMON_NEXT"),onSubmit:()=>{var e,n;const t=Ol(jt(new Date,null==$?void 0:$.slaDays),"yyyy-MM-dd").toString();N(null==R?void 0:R.date)<=N(t)?(x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_DATE"}),setTimeout(()=>{x(!1)},3e3)):"Temporary"==(null==R||null===(e=R.type)||void 0===e||null===(n=e.value)||void 0===n?void 0:n.code)&&parseInt(N(R.endDate))<=parseInt(N(null==R?void 0:R.date))?(console.log("Temporary connection"),x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_END_DATE"}),setTimeout(()=>{x(!1)},3e3)):b.push(L.path.replace("application-form","documents-upload"))},disabled:""===(null==R||null===(me=R.reason)||void 0===me?void 0:me.value)||""===(null==R?void 0:R.reason)||""===(null==R?void 0:R.date)||""===(null==R?void 0:R.type)}),M&&l.createElement(a.Toast,{error:"error"===(null==M?void 0:M.key),label:f(null==M?void 0:M.message),onClose:()=>x(null)}))),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px"},textStyle:{color:"#0B0C0C"},text:f("WS_DISONNECT_APPL_INFO"),info:f("CS_COMMON_INFO")})):l.createElement("div",{style:{margin:"16px"}},l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px"}},f("WS_WATER_AND_SEWERAGE_DISCONNECTION")),l.createElement(a.FormStep,{config:g,onSelect:()=>{C(g.key,{WSDisConnectionForm:v({},R,{documents:W})})},onSkip:oe,t:f},l.createElement("div",{style:{padding:"10px",paddingTop:"20px",marginTop:"10px"}},l.createElement(a.CardSectionHeader,null,f("CS_TITLE_APPLICATION_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+f("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==O||null===(o=O.applicationData)||void 0===o?void 0:o.connectionNo,className:"border-none"})),l.createElement(a.CardSectionHeader,null,f("WS_DISCONNECTION_TYPE")+"*",l.createElement("div",{className:"tooltip",style:{marginLeft:"8px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium",width:Digit.Utils.browser.isMobile()&&window.location.href.includes("/employee")?"200px":""}},""+f("WS_DISCONNECTION_PERMANENT_TOOLTIP"),l.createElement("br",null),l.createElement("br",null),""+f("WS_DISCONNECTION_TEMPORARY_TOOLTIP")))),l.createElement(a.RadioButtons,{t:f,options:B,optionsKey:"i18nKey",value:null===(r=R.type)||void 0===r||null===(u=r.value)||void 0===u?void 0:u.code,selectedOption:null===(d=R.type)||void 0===d?void 0:d.value,isMandatory:!1,onSelect:e=>ie({code:"type",value:e}),labelKey:"WS_DISCONNECTION_TYPE",style:{display:"flex",gap:"0px 3rem"},inputStyle:h?{marginLeft:"unset"}:{}}),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},f("WS_DISCONNECTION_PROPOSED_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute",marginLeft:"4px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium"}},f("SHOULD_BE_DATE")+" "+(null==$?void 0:$.slaDays)+" "+f("DAYS_OF_APPLICATION_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.date,onChange:e=>{w(v({},R,{date:e}))}}))),"Temporary"===(null===(s=R.type)||void 0===s||null===(c=s.value)||void 0===c?void 0:c.code)?l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},f("WS_DISCONNECTION_PROPOSED_END_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute",marginLeft:"4px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium"}},f("SHOULD_BE_DATE")+" "+f("DAYS_OF_APPLICATION_END_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==R?void 0:R.endDate,onChange:e=>{w(v({},R,{endDate:e}))}}))):"",l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},f("WS_DISCONNECTION_REASON")+"*"),l.createElement("div",{className:"field"},l.createElement(a.Dropdown,{option:U,isMandatory:!1,optionKey:"i18nKey",t:f,name:"reason",value:null===(p=R.reason)||void 0===p||null===(E=p.value)||void 0===E?void 0:E.code,selectedOption:null===(S=R.reason)||void 0===S?void 0:S.value,select:e=>ie({code:"reason",value:e}),labelKey:"WS_DISCONNECTION_REASON"}))),l.createElement(a.CardSectionHeader,{style:{marginBottom:"8px"}},f("WS_DISCONNECTION_DOCUMENTS")+"*"),null==X||null===(_=X.DisconnectionDocuments)||void 0===_?void 0:_.map((e,n)=>l.createElement(Ll,{key:n,document:e,t:f,error:M,setError:x,setDocuments:P,documents:W,setCheckRequiredFields:j})),M&&l.createElement(a.Toast,{error:"error"===(null==M?void 0:M.key),label:f(null==M?void 0:M.message),warning:null==M?void 0:M.warning,onClose:()=>x(null)}))),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:f("ACTION_TEST_SUBMIT"),onSubmit:()=>function(e){try{const n=Ol(jt(new Date,null==$?void 0:$.slaDays),"yyyy-MM-dd").toString(),t=function(){if(N(null==e?void 0:e.date)<=N(n))x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_DATE"}),setTimeout(()=>{x(!1)},3e3);else{const n=function(n,t){if("Temporary"==(null==e||null===(n=e.type)||void 0===n||null===(t=n.value)||void 0===t?void 0:t.name)&&N(null==e?void 0:e.endDate)<=N(null==e?void 0:e.date))x({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_END_DATE"}),setTimeout(()=>{x(!1)},3e3);else{const n=function(n){var t;if(!(K||W.length<2||""===(null==R||null===(n=R.reason)||void 0===n?void 0:n.value)||""===(null==R?void 0:R.reason)||""===(null==R?void 0:R.date)||""===(null==R?void 0:R.type)))return Promise.resolve(A(e,O,null==O||null===(t=O.applicationData)||void 0===t?void 0:t.serviceType)).then(function(e){const n=function(n){if(null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n.water){const n=function(){if(Q)return z(!0),Promise.resolve(Q(e,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(I(null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0],"WATER")).then(function(e){let n={WaterConnection:e};return n=v({},n,{disconnectRequest:!0}),Promise.resolve(ee(n,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},O,{DisconnectionResponse:null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]})),b.push("/digit-ui/employee/ws/ws-disconnection-response?applicationNumber="+(null==e||null===(l=e.WaterConnection)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}else{const n=function(n){if(null!=e&&null!==(n=e.SewerageConnection)&&void 0!==n&&n.sewerage){const n=function(){if(ne)return z(!0),Promise.resolve(ne(e,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(I(null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0],"SEWERAGE")).then(function(e){let n={SewerageConnection:e};return n=v({},n,{disconnectRequest:!0}),Promise.resolve(te(n,{onError:(e,n)=>{var t,l,o,i,a,r;z(!1),x({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(le,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},O,{DisconnectionResponse:null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0]})),b.push("/digit-ui/employee/ws/ws-disconnection-response?applicationNumber="+(null==e||null===(l=e.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})});x({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{x(!1)},3e3)}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(R),style:{margin:"10px 10px 0px 0px"}})));var ae,re,ue,de,se,ce,ve,pe,me},WSRestorationForm:e=>{var n,o,r,u;let{t:d,config:s,onSelect:c,userType:p}=e;const E=Digit.ULBService.getStateId(),S=Digit.ULBService.getCurrentTenantId(),_=(window.Digit.Utils.browser.isMobile(),Digit.SessionStorage.get("WS_DISCONNECTION")),f=i.useHistory(),g=i.useRouteMatch(),[C,y]=t.useState({type:_.WSDisconnectionForm?_.WSDisconnectionForm.type:"",date:_.WSDisconnectionForm?_.WSDisconnectionForm.date:"",reason:_.WSDisconnectionForm?_.WSDisconnectionForm.reason:"",documents:_.WSDisconnectionForm?_.WSDisconnectionForm.documents:[]}),[D,T]=t.useState(_.WSDisconnectionForm?_.WSDisconnectionForm.documents:[]),[h,A]=t.useState(null),[I,b]=t.useState([]),[L,R]=t.useState(!1),[w,W]=t.useState(!1),{isMdmsLoading:P,data:M}=Digit.Hooks.ws.useMDMS(E,"ws-services-masters",["disconnectionType"]),{isLoading:x}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(E,"DisconnectionDocuments"),{isLoading:B,data:F}=Digit.Hooks.ws.useDisconnectionWorkflow({tenantId:S}),U=window.location.href.includes("resubmit"),{mutate:k}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:H}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:j}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:V}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),z=()=>{A(null)};t.useEffect(()=>{const e=v({},C);e.documents=D,y(e)},[D]),t.useEffect(()=>{var e;const n=(null==M||null===(e=M["ws-services-masters"])||void 0===e?void 0:e.disconnectionType)||[];null==n||n.forEach(e=>{var n;return e.i18nKey="WS_DISCONNECTIONTYPE_"+m(null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase()," ","_")}),console.log("disconnectionTypes",n),b(n)},[M]),t.useEffect(()=>{Digit.SessionStorage.set("WS_DISCONNECTION",v({},_,{WSDisconnectionForm:C}))},[C]);const Y=()=>c(),G=e=>{const n=v({},C);n[e.code]=e,y(n)};return P||x||w||B?l.createElement(a.Loader,null):"citizen"===p?l.createElement("div",null,"citizen"===p&&l.createElement(Ft,{currentStep:1}),l.createElement(a.FormStep,{config:s,onSelect:()=>c(s.key,{WSDisConnectionForm:C}),onSkip:Y,t:d},l.createElement("div",{style:{padding:"0px 10px 10px 10px"}},l.createElement(a.CardHeader,null,d(U?"RESUBMIT_RESTORATION_FORM":"WS_APPLICATION_FORM")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==_?void 0:_.connectionNo,className:"border-none"})),l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},d("WS_RESTORATION_PROPOSED_DATE")+"*"),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==C?void 0:C.date,onChange:e=>{y(v({},C,{date:e}))}})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{className:"card-label-smaller",style:{display:"inline"}},d("WS_DISCONNECTION_REASON")+"*"),l.createElement(a.TextArea,{isMandatory:!1,optionKey:"i18nKey",t:d,name:"reason",value:null===(q=C.reason)||void 0===q?void 0:q.value,onChange:e=>G({code:"reason",value:e.target.value})})),l.createElement(a.SubmitBar,{label:d("CS_COMMON_NEXT"),onSubmit:()=>{Ol(jt(new Date,null==F?void 0:F.slaDays),"yyyy-MM-dd").toString(),f.push(g.path.replace("restoration-application","check"))},disabled:""===(null==C||null===(K=C.reason)||void 0===K?void 0:K.value)||""===(null==C?void 0:C.reason)||""===(null==C?void 0:C.date)}),h&&l.createElement(a.Toast,{error:"error"===(null==h?void 0:h.key),label:d(null==h?void 0:h.message),onClose:()=>A(null)}))),l.createElement(a.CitizenInfoLabel,{style:{margin:"0px"},textStyle:{color:"#0B0C0C"},text:d("WS_DISONNECT_APPL_INFO"),info:d("CS_COMMON_INFO")})):(console.log("applicationData",_),l.createElement("div",{style:{margin:"16px"}},l.createElement(a.Header,{styles:{fontSize:"32px",marginLeft:"18px"}},d("WS_WATER_AND_SEWERAGE_RESTORATION")),l.createElement(a.FormStep,{config:s,onSelect:()=>{c(s.key,{WSDisConnectionForm:v({},C,{documents:D})})},onSkip:Y,t:d},l.createElement("div",{style:{padding:"10px",paddingTop:"20px",marginTop:"10px"}},l.createElement(a.CardSectionHeader,null,d("CS_TITLE_APPLICATION_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),label:""+d("PDF_STATIC_LABEL_CONSUMER_NUMBER_LABEL"),text:null==_||null===(n=_.applicationData)||void 0===n?void 0:n.connectionNo,className:"border-none"}),l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_TYPE_OF_SERVICE_LABEL"),label:""+d("PDF_STATIC_LABEL_TYPE_OF_SERVICE_LABEL"),text:null==_||null===(o=_.applicationData)||void 0===o?void 0:o.serviceType,className:"border-none"}),l.createElement(a.Row,{key:d("PDF_STATIC_LABEL_PROPERTY_ID_LABEL"),label:""+d("PDF_STATIC_LABEL_PROPERTY_ID_LABEL"),text:null==_||null===(r=_.applicationData)||void 0===r?void 0:r.propertyId,className:"border-none"})),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},d("WS_RESTORATION_PROPOSED_DATE")+"*",l.createElement("div",{className:"tooltip",style:{position:"absolute",marginLeft:"4px"}},l.createElement(a.InfoIcon,null),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:Digit.Utils.browser.isMobile()?"unset":"nowrap",fontSize:"medium"}},d("SHOULD_BE_DATE")+" "+(null==F?void 0:F.slaDays)+" "+d("DAYS_OF_APPLICATION_DATE")))),l.createElement("div",{className:"field"},l.createElement(a.DatePicker,{date:null==C?void 0:C.date,onChange:e=>{y(v({},C,{date:e}))}}))),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{marginTop:"-5px",fontWeight:"700",display:"inline"},className:"card-label-smaller"},d("WS_RESTORATION_REASON")+"*"),l.createElement("div",{className:"field"},l.createElement(a.TextArea,{isMandatory:!1,optionKey:"i18nKey",t:d,name:"reason",value:null===(u=C.reason)||void 0===u?void 0:u.value,onChange:e=>G({code:"reason",value:e.target.value})}))),h&&l.createElement(a.Toast,{error:"error"===(null==h?void 0:h.key),label:d(null==h?void 0:h.message),warning:null==h?void 0:h.warning,onClose:()=>A(null)}))),l.createElement(a.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(a.SubmitBar,{label:d("ACTION_TEST_SUBMIT"),onSubmit:()=>function(e){try{const n=Ol(jt(new Date,null==F?void 0:F.slaDays),"yyyy-MM-dd").toString(),t=function(){if(N(null==e?void 0:e.date)<=N(n))A({key:"error",message:"PROPOSED_DISCONNECTION_INVALID_DATE"}),setTimeout(()=>{A(!1)},3e3);else{const n=function(n){var t;if(""!==(null==C||null===(n=C.reason)||void 0===n?void 0:n.value)&&""!==(null==C?void 0:C.reason)&&""!==(null==C?void 0:C.date))return Promise.resolve(function(e,n,t){try{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne;const Ae=Digit.UserService.getType();let Ie=[];if((null==n||null===(l=n.applicationData)||void 0===l||null===(o=l.plumberInfo)||void 0===o?void 0:o.length)>0){var te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he;let e={};null!=n&&null!==(te=n.applicationData)&&void 0!==te&&null!==(le=te.plumberInfo)&&void 0!==le&&null!==(oe=le[0])&&void 0!==oe&&oe.licenseNo&&(e.licenseNo=null==n||null===(ie=n.applicationData)||void 0===ie||null===(ae=ie.plumberInfo)||void 0===ae||null===(re=ae[0])||void 0===re?void 0:re.licenseNo),null!=n&&null!==(ue=n.applicationData)&&void 0!==ue&&null!==(de=ue.plumberInfo)&&void 0!==de&&null!==(se=de[0])&&void 0!==se&&se.mobileNumber&&(e.mobileNumber=null==n||null===(ce=n.applicationData)||void 0===ce||null===(ve=ce.plumberInfo)||void 0===ve||null===(pe=ve[0])||void 0===pe?void 0:pe.mobileNumber),null!=n&&null!==(me=n.applicationData)&&void 0!==me&&null!==(Ee=me.plumberInfo)&&void 0!==Ee&&null!==(Se=Ee[0])&&void 0!==Se&&Se.id&&(e.id=null==n||null===(_e=n.applicationData)||void 0===_e||null===(fe=_e.plumberInfo)||void 0===fe||null===(ge=fe[0])||void 0===ge?void 0:ge.id),null!=n&&null!==(Ce=n.applicationData)&&void 0!==Ce&&null!==(Ne=Ce.plumberInfo)&&void 0!==Ne&&null!==(ye=Ne[0])&&void 0!==ye&&ye.name&&(e.name=null==n||null===(De=n.applicationData)||void 0===De||null===(Te=De.plumberInfo)||void 0===Te||null===(he=Te[0])||void 0===he?void 0:he.name),Ie=[e]}let Oe={WaterConnection:{id:null==n||null===(i=n.applicationData)||void 0===i?void 0:i.id,applicationNo:null==n||null===(a=n.applicationData)||void 0===a?void 0:a.applicationNo,applicationStatus:null==n||null===(r=n.applicationData)||void 0===r?void 0:r.applicationStatus,status:null==n||null===(u=n.applicationData)||void 0===u?void 0:u.status,connectionNo:null==n||null===(d=n.applicationData)||void 0===d?void 0:d.connectionNo,connectionHolders:null==n||null===(s=n.applicationData)||void 0===s?void 0:s.connectionHolders,applicationType:"WATER_RECONNECTION",dateEffectiveFrom:N(null==e?void 0:e.date),isdisconnection:!0,isDisconnectionTemporary:"Temporary"===(null==e||null===(c=e.type)||void 0===c||null===(p=c.value)||void 0===p?void 0:p.code)||"TEMPORARY"===(null==e||null===(m=e.type)||void 0===m||null===(E=m.value)||void 0===E?void 0:E.code),disconnectionReason:null==e||null===(S=e.reason.value)||void 0===S?void 0:S.code,documents:null==e?void 0:e.documents,water:!0,sewerage:!1,proposedTaps:(null==n||null===(_=n.applicationData)||void 0===_?void 0:_.proposedTaps)&&Number(null==n||null===(f=n.applicationData)||void 0===f?void 0:f.proposedTaps),proposedPipeSize:(null==n||null===(g=n.applicationData)||void 0===g||null===(C=g.proposedPipeSize)||void 0===C?void 0:C.size)&&Number(null==n||null===(y=n.applicationData)||void 0===y||null===(D=y.proposedPipeSize)||void 0===D?void 0:D.size),service:"Water",property:null==n||null===(T=n.applicationData)||void 0===T?void 0:T.property,propertyId:null==n||null===(h=n.applicationData)||void 0===h?void 0:h.propertyId,oldConnectionNo:null,plumberInfo:(null===(A=Ie)||void 0===A?void 0:A.length)>0?Ie:null,roadCuttingInfo:null==n||null===(I=n.applicationData)||void 0===I?void 0:I.roadCuttingInfo,roadCuttingArea:null,roadType:null,connectionExecutionDate:null==n||null===(O=n.applicationData)||void 0===O?void 0:O.connectionExecutionDate,noOfTaps:null==n||null===(b=n.applicationData)||void 0===b?void 0:b.noOfTaps,additionalDetails:null==n||null===(L=n.applicationData)||void 0===L?void 0:L.additionalDetails,tenantId:null==n||null===(R=n.applicationData)||void 0===R?void 0:R.tenantId,connectionType:n.applicationData.connectionType||null,waterSource:n.applicationData.waterSource||null,processInstance:v({},null==n||null===(w=n.applicationData)||void 0===w?void 0:w.processInstance,{action:"INITIATE",businessService:"WSReconnection"}),channel:"citizen"===Ae?"CITIZEN":"CFC_COUNTER"},disconnectRequest:!1};n.applicationData.connectionType&&(n.applicationData.meterInstallationDate&&(Oe.WaterConnection.meterInstallationDate=n.applicationData.meterInstallationDate),n.applicationData.meterId&&(Oe.WaterConnection.meterId=n.applicationData.meterId));let be={SewerageConnection:{id:null==n||null===(W=n.applicationData)||void 0===W?void 0:W.id,applicationNo:null==n||null===(P=n.applicationData)||void 0===P?void 0:P.applicationNo,applicationStatus:null==n||null===(M=n.applicationData)||void 0===M?void 0:M.applicationStatus,status:null==n||null===(x=n.applicationData)||void 0===x?void 0:x.status,connectionNo:null==n||null===(B=n.applicationData)||void 0===B?void 0:B.connectionNo,connectionHolders:null==n||null===(F=n.applicationData)||void 0===F?void 0:F.connectionHolders,applicationType:"WATER_RECONNECTION",dateEffectiveFrom:N(null==e?void 0:e.date),isdisconnection:!0,isDisconnectionTemporary:"Temporary"===(null==e||null===(U=e.type)||void 0===U||null===(k=U.value)||void 0===k?void 0:k.code),disconnectionReason:null==e||null===(H=e.reason.value)||void 0===H?void 0:H.code,documents:null==e?void 0:e.documents,water:!1,sewerage:!0,proposedWaterClosets:(null==n||null===(j=n.applicationData)||void 0===j?void 0:j.proposedWaterClosets)&&Number(null==n||null===(V=n.applicationData)||void 0===V?void 0:V.proposedWaterClosets),proposedToilets:(null==n||null===(z=n.applicationData)||void 0===z?void 0:z.proposedToilets)&&Number(null==n||null===(Y=n.applicationData)||void 0===Y?void 0:Y.proposedToilets),service:"Sewerage",property:null==n||null===(G=n.applicationData)||void 0===G?void 0:G.property,propertyId:null==n||null===(q=n.applicationData)||void 0===q?void 0:q.propertyId,oldConnectionNo:null,plumberInfo:(null===(K=Ie)||void 0===K?void 0:K.length)>0?Ie:null,roadCuttingInfo:null==n||null===(X=n.applicationData)||void 0===X?void 0:X.roadCuttingInfo,roadCuttingArea:null,roadType:null,connectionExecutionDate:null==n||null===(Z=n.applicationData)||void 0===Z?void 0:Z.connectionExecutionDate,noOfWaterClosets:null==n||null===($=n.applicationData)||void 0===$?void 0:$.noOfWaterClosets,noOfToilets:null==n||null===(J=n.applicationData)||void 0===J?void 0:J.noOfToilets,additionalDetails:null==n||null===(Q=n.applicationData)||void 0===Q?void 0:Q.additionalDetails,tenantId:null==n||null===(ee=n.applicationData)||void 0===ee?void 0:ee.tenantId,connectionType:"Non Metered",waterSource:n.applicationData.waterSource||null,processInstance:v({},null==n||null===(ne=n.applicationData)||void 0===ne?void 0:ne.processInstance,{action:"INITIATE",businessService:"SWReconnection"}),channel:"citizen"===Ae?"CITIZEN":"CFC_COUNTER"},disconnectRequest:!1};return Promise.resolve("WATER"===t?Oe:be)}catch(e){return Promise.reject(e)}}(e,_,null==_||null===(t=_.applicationData)||void 0===t?void 0:t.serviceType)).then(function(e){const n=function(n){if(null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n.water){e.WaterConnection.isdisconnection=!1,e.WaterConnection.isDisconnectionTemporary=!0,e.WaterConnection.reconnectionReason=e.WaterConnection.disconnectionReason,e.WaterConnection.disconnectionReason="",e.reconnectRequest=!0,e.disconnectRequest=!1;const n=function(){if(k)return W(!0),Promise.resolve(k(e,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(O(null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0],"WATER")).then(function(e){let n={WaterConnection:e};return n=v({},n,{disconnectRequest:!1,reconnectRequest:!0}),console.log("response"),Promise.resolve(H(n,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},_,{DisconnectionResponse:null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]})),f.push("/digit-ui/employee/ws/ws-restoration-response?applicationNumber="+(null==e||null===(l=e.WaterConnection)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}else{const n=function(n){if(null!=e&&null!==(n=e.SewerageConnection)&&void 0!==n&&n.sewerage){e.SewerageConnection.isdisconnection=!1,e.SewerageConnection.reconnectionReason=e.SewerageConnection.disconnectionReason,e.SewerageConnection.disconnectionReason="",e.SewerageConnection.isDisconnectionTemporary=!0,e.reconnectRequest=!0,e.disconnectRequest=!1;const n=function(){if(j)return W(!0),Promise.resolve(j(e,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(O(null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0],"SEWERAGE")).then(function(e){let n={SewerageConnection:e};return n=v({},n,{disconnectRequest:!1,reconnectRequest:!0}),Promise.resolve(V(n,{onError:(e,n)=>{var t,l,o,i,a,r;W(!1),A({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(z,5e3)},onSuccess:(e,n)=>{var t,l,o;Digit.SessionStorage.set("WS_DISCONNECTION",v({},_,{DisconnectionResponse:null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0]})),f.push("/digit-ui/employee/ws/ws-restoration-response?applicationNumber="+(null==e||null===(l=e.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})});A({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{A(!1)},3e3)}();if(n&&n.then)return n.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(C),style:{margin:"10px 10px 0px 0px"}}))));var q,K},WSDisconnectionDocumentsForm:function(e){var n;let{t:o,config:r,onSelect:u,userType:d}=e;const s=Digit.ULBService.getStateId(),c=Digit.SessionStorage.get("WS_DISCONNECTION"),[p,m]=t.useState(c.WSDisconnectionForm.documents?c.WSDisconnectionForm.documents:[]),[E,S]=t.useState(null),[_,f]=t.useState(!1),g=i.useHistory(),C=i.useRouteMatch();t.useEffect(()=>{Digit.SessionStorage.set("WS_DISCONNECTION",v({},c,{WSDisconnectionForm:v({},c.WSDisconnectionForm,{documents:p})}))},[p]);const{isLoading:N,data:y}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSServicesMasters(s,"DisconnectionDocuments");return N?l.createElement(a.Loader,null):l.createElement("div",{style:{marginTop:"19px"}},"citizen"===d&&l.createElement(Ft,{currentStep:2}),l.createElement(a.FormStep,{t:o,config:r,onSelect:()=>{u(r.key,{WSDisconnectionDocumentsForm:p})}},l.createElement(a.CardHeader,null,o("WS_DISCONNECTION_UPLOAD_DOCUMENTS")),null==y||null===(n=y.DisconnectionDocuments)||void 0===n?void 0:n.map((e,n)=>l.createElement(Rl,{key:n,document:e,t:o,error:E,setError:S,setDocuments:m,documents:p,setCheckRequiredFields:f})),l.createElement(a.SubmitBar,{label:o("CS_COMMON_NEXT"),onSubmit:()=>{g.push(C.path.replace("documents-upload","check"))},disabled:p.length<2}),E&&l.createElement(a.Toast,{error:"error"===(null==E?void 0:E.key),label:o(null==E?void 0:E.message),onClose:()=>S(null)})))},WSDisconnectAcknowledgement:()=>{var e;const{t:n}=o.useTranslation(),t=Digit.SessionStorage.get("WS_DISCONNECTION");return l.createElement(a.Card,{style:{padding:"10px"}},l.createElement(a.CardSectionHeader,null,l.createElement(wl,{isSuccess:!0,message:n("WS_APPLICATION_COMPLETED_SUCCESSFULLY_LABEL"),applicationNumber:null==t||null===(e=t.DisconnectionResponse)||void 0===e?void 0:e.applicationNo})," ",l.createElement("successSvg",null)),l.createElement(a.CardText,null,n("WS_DISCONNECTION_APPLICATION_SUCC_MSG")),l.createElement(a.SubmitBar,{label:n("WS_DOWNLOAD_ACK_FORM"),onSubmit:()=>{const e=null==t?void 0:t.DisconnectionResponse;pe(e,null==t?void 0:t.property,null==e?void 0:e.tenantId,n).then(e=>Digit.Utils.pdf.generatev1(e))}}),l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(a.LinkButton,{label:n("CORE_COMMON_GO_TO_HOME"),onClick:()=>Digit.SessionStorage.del("WS_DISCONNECTION")})))},WSRestorationAcknowledgement:()=>{var e;const{t:n}=o.useTranslation(),t=Digit.SessionStorage.get("WS_DISCONNECTION");return l.createElement(a.Card,{style:{padding:"10px"}},l.createElement(a.CardSectionHeader,null,l.createElement(Wl,{isSuccess:!0,message:n("WS_APPLICATION_COMPLETED_SUCCESSFULLY_LABEL"),applicationNumber:null==t||null===(e=t.DisconnectionResponse)||void 0===e?void 0:e.applicationNo})," ",l.createElement("successSvg",null)),l.createElement(a.CardText,null,n("WS_RESTORATION_APPLICATION_SUCC_MSG")),l.createElement(a.SubmitBar,{label:n("WS_DOWNLOAD_ACK_FORM"),onSubmit:()=>{const e=null==t?void 0:t.DisconnectionResponse;ge(e,null==t?void 0:t.property,null==e?void 0:e.tenantId,n).then(e=>Digit.Utils.pdf.generatev1(e))}}),l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(a.LinkButton,{label:n("CORE_COMMON_GO_TO_HOME"),onClick:()=>Digit.SessionStorage.del("WS_DISCONNECTION")})))},WSDisconnectionAppDetails:e=>{let{config:n,onSelect:i,formData:a,setError:r,formState:u,clearErrors:d}=e;const{t:s}=o.useTranslation(),[c,p]=t.useState((null==a?void 0:a.disConnectionDetails)||[[{consumerNumber:"",disConnectionType:"",disConnectionProposeDate:"",disConnectionReason:""}]]),[m,E]=t.useState({index:-1,type:""}),[S,_]=t.useState(!1),[f,g]=t.useState([]),C=Digit.ULBService.getStateId(),N=Digit.ULBService.getCurrentTenantId(),{data:y}=Digit.Hooks.ws.useMDMS(C,"ws-services-masters",["disconnectionType"]);Digit.Hooks.ws.useDisconnectionWorkflow({tenantId:N}),t.useEffect(()=>{var e;const n=(null==y||null===(e=y["ws-services-masters"])||void 0===e?void 0:e.disconnectionType)||[];null==n||n.forEach(e=>{var n,t,l,o;e.code=null==e||null===(n=e.code)||void 0===n?void 0:n.toUpperCase(),e.i18nKey="WS_DISCONNECTIONTYPE_"+(null==e||null===(t=e.code)||void 0===t?void 0:t.toUpperCase()),e.value=null==e||null===(l=e.code)||void 0===l?void 0:l.toUpperCase(),e.name=null==e||null===(o=e.code)||void 0===o?void 0:o.toUpperCase()}),g(n)},[y]),t.useEffect(()=>{const e=c.map(e=>e);i(null==n?void 0:n.key,e)},[c]);const D={focusIndex:m,setFocusIndex:E,t:s,config:n,setError:r,clearErrors:d,formState:u,disConnectionDetails:c,setIsErrors:_,setDisConnectionDetails:p,disconnectionTypeList:f};return l.createElement(l.Fragment,null,c.map((e,n)=>l.createElement(Pl,v({key:e.key,index:n,disConnectionDetail:e},D))))},WSInbox:e=>{let{parentRoute:n}=e;const{t:u}=o.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),s=window.location.pathname.includes("water/inbox"),c={mobileNumber:"",applicationNumber:"",consumerNo:""},p={businessService:s?["NewWS1","ModifyWSConnection","DisconnectWSConnection"]:["NewSW1","ModifySWConnection","DisconnectSWConnection"],moduleName:s?"ws-services":"sw-services",locality:[],assignee:"ASSIGNED_TO_ALL",applicationStatus:[],applicationType:[]},m={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"DESC"};sessionStorage.removeItem("Digit.BILL.INBOX"),sessionStorage.removeItem("Digit.SW.INBOX");const E=Digit.SessionStorage.get("BILL.INBOX"),S=t.useMemo(()=>E||{filterForm:p,searchForm:c,tableForm:m},[Object.values((null==E?void 0:E.filterForm)||{}),Object.values((null==E?void 0:E.searchForm)||{}),Object.values((null==E?void 0:E.tableForm)||{})]),[_,f]=t.useReducer(function(e,n){if(s)switch(n.action){case"mutateSearchForm":return Digit.SessionStorage.set("BILL.INBOX",v({},e,{searchForm:n.data})),v({},e,{searchForm:n.data});case"mutateFilterForm":return Digit.SessionStorage.set("BILL.INBOX",v({},e,{filterForm:n.data})),v({},e,{filterForm:n.data});case"mutateTableForm":return Digit.SessionStorage.set("BILL.INBOX",v({},e,{tableForm:n.data})),v({},e,{tableForm:n.data})}else switch(n.action){case"mutateSearchForm":return Digit.SessionStorage.set("BILL.SW.INBOX",v({},e,{searchForm:n.data})),v({},e,{searchForm:n.data});case"mutateFilterForm":return Digit.SessionStorage.set("BILL.SW.INBOX",v({},e,{filterForm:n.data})),v({},e,{filterForm:n.data});case"mutateTableForm":return Digit.SessionStorage.set("BILL.SW.INBOX",v({},e,{tableForm:n.data})),v({},e,{tableForm:n.data})}},S),{data:g,isLoading:C}=Digit.Hooks.useBoundaryLocalities(d,"revenue",{},u),{isLoading:N,data:{table:y,statuses:D,totalCount:T}={}}=Digit.Hooks.ws.useInbox({tenantId:d,filters:v({},_)});let h=[{text:u("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"),link:"/digit-ui/employee/ws/create-application",roles:["WS_CEMP","SW_CEMP"]}];h=h.filter(e=>!e.roles||b(e.roles));const A={logoIcon:l.createElement(a.DropIcon,null),headerText:s?"MODULE_WATER":"MODULE_SW",links:[...h,{text:u("WS_SEWERAGE_CONNECTION_SEARCH_LABEL"),link:s?"/digit-ui/employee/ws/water/search-connection?from=WS_SEWERAGE_INBOX":"/digit-ui/employee/ws/sewerage/search-connection?from=WS_SEWERAGE_INBOX",roles:s?["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]},{text:u("WS_SEWERAGE_APPLICATION_SEARCH"),link:s?"/digit-ui/employee/ws/water/search-application?from=WS_SEWERAGE_INBOX":"/digit-ui/employee/ws/sewerage/search-application?from=WS_SEWERAGE_INBOX",roles:s?["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]}]},I=t.useCallback(e=>{let{registerRef:n,searchFormState:t}=e;return l.createElement(Ml,{registerRef:n,searchFormState:t,className:"search"})},[]),O=t.useCallback(e=>{let{registerRef:n,controlFilterForm:t,setFilterFormValue:o,getFilterFormValue:i}=e;return l.createElement(xl,{statuses:D,isInboxLoading:N,registerRef:n,controlFilterForm:t,setFilterFormValue:o,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:i,localitiesForEmployeesCurrentTenant:g,loadingLocalitiesForEmployeesCurrentTenant:C,checkPathName:s})},[D,N,g,C]),L={SearchFormFields:I,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:c,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNumber",null),e("consumerNo",null),f({action:"mutateSearchForm",data:c})},className:"search-form-wns-inbox"},R={FilterFormFields:O,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:p,onFilterFormReset:e=>{e("moduleName",s?"ws-services":"sw-services"),e("applicationStatus",[]),e("applicationType",[]),e("locality",[]),e("assignee","ASSIGNED_TO_ALL"),f({action:"mutateFilterForm",data:p})}},w=(e=>{var n,a,r,u;let{onPageSizeChange:d,formState:s,totalCount:c,table:p,dispatch:m,onSortingByData:E,tenantId:S,inboxStyles:_={},tableStyle:f={}}=e;const{t:g}=o.useTranslation(),C=e=>l.createElement("span",{className:"cell-text styled-cell"},e),N=t.useMemo(()=>[{Header:g("WS_ACK_COMMON_APP_NO_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var n,t,o,a,r,u;let{row:d}=e,s="WATER";d.original.applicationNo.includes("SW")&&(s="SEWERAGE");let c="application";return null!=d&&null!==(n=d.original)&&void 0!==n&&null!==(t=n.applicationType)&&void 0!==t&&null!==(o=t.toUpperCase())&&void 0!==o&&o.includes("DISCONNECT")?c="disconnection":null!=d&&null!==(a=d.original)&&void 0!==a&&null!==(r=a.applicationType)&&void 0!==r&&null!==(u=r.toUpperCase())&&void 0!==u&&u.includes("MODIFY")&&(c="modify"),l.createElement("div",null,l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+c+"-details?applicationNumber="+d.original.applicationNo+"&tenantId="+S+"&service="+s+"&from=WS_SEWERAGE_INBOX"}," ",l.createElement("span",{className:"link"},d.original.applicationNo)))}},{Header:g("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),accessor:"connectionNo",disableSortBy:!0},{Header:g("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),accessor:"owner",disableSortBy:!0},{Header:g("WS_COMMON_TABLE_COL_APP_TYPE_LABEL"),accessor:e=>{var n;return C(g("CS_COMMON_INBOX_"+(null==e||null===(n=e.applicationType)||void 0===n?void 0:n.toUpperCase())))},disableSortBy:!0},{Header:g("WS_COMMON_TABLE_COL_APPLICATION_STATUS"),accessor:e=>C(g("CS_"+(null==e?void 0:e.status))),disableSortBy:!0},{Header:g("ES_INBOX_SLA_DAYS_REMAINING"),accessor:e=>{return l.createElement("span","Active"===(n=null==e?void 0:e.sla)||n>0?{className:"sla-cell-success"}:{className:"sla-cell-error"},n);var n}}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:d,currentPage:(null===(n=s.tableForm)||void 0===n?void 0:n.offset)/(null===(a=s.tableForm)||void 0===a?void 0:a.limit),onNextPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},onPrevPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},pageSizeLimit:null===(r=s.tableForm)||void 0===r?void 0:r.limit,onSort:E,totalRecords:c,onSearch:null==s||null===(u=s.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:10*Math.ceil(c/10)-parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>m({action:"mutateTableForm",data:v({},s.tableForm,{offset:0})}),data:p,columns:N,inboxStyles:v({},_),tableStyle:v({},f)}})(v({},{parentRoute:n,onPageSizeChange:e=>{f({action:"mutateTableForm",data:v({},_.tableForm,{limit:e.target.value})})},formState:_,totalCount:T,table:y,dispatch:f,onSortingByData:e=>{if(e.length>0){const[{id:n,desc:t}]=e,l=t?"DESC":"ASC";_.tableForm.sortBy===n&&_.tableForm.sortOrder===l||f({action:"mutateTableForm",data:v({},_.tableForm,{sortBy:n,sortOrder:t?"DESC":"ASC"})})}},tenantId:d,inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}})),W=(e=>{let{table:n}=e;const{t:t}=o.useTranslation(),u=(e,n,t)=>{var o,a;let r=null!=e&&e.includes("WS")?"WATER":"SEWERAGE",u="application";return null!=t&&null!==(o=t.toUpperCase())&&void 0!==o&&o.includes("DISCONNECT")?u="disconnection":null!=t&&null!==(a=t.toUpperCase())&&void 0!==a&&a.includes("MODIFY")&&(u="modify"),l.createElement("div",null,l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+u+"-details?applicationNumber="+e+"&tenantId="+n+"&service="+r}," ",l.createElement("span",{className:"link"},e)))};return{data:null==n?void 0:n.map(e=>{let{applicationNo:n,status:o,owner:i,sla:a,businessService:r,connectionNo:d,applicationType:s,tenantId:c}=e;return{[t("WS_ACK_COMMON_APP_NO_LABEL")]:u(n,c,s),[t("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL")]:d,[t("WS_COMMON_TABLE_COL_OWN_NAME_LABEL")]:i,[t("WS_COMMON_TABLE_COL_APP_TYPE_LABEL")]:t("WS_"+(null==s?void 0:s.toUpperCase())),[t("WS_COMMON_TABLE_COL_SERVICE_LABEL")]:r?t("WS_COMMON_INBOX_"+(null==r?void 0:r.toUpperCase())):"NA",[t("WS_COMMON_TABLE_COL_APPLICATION_STATUS")]:t("CS_"+o),[t("ES_INBOX_SLA_DAYS_REMAINING")]:(v=a,l.createElement("span","Active"===v||v>0?{className:"sla-cell-success"}:{className:"sla-cell-error"},v))};var v}),serviceRequestIdKey:t("NOC_APP_NO_LABEL"),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(a.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:t,value:o}=n;return l.createElement(a.RadioButtons,{onSelect:e=>{t(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:n,table:y}),P={onMobileSortOrderData:e=>{const{sortOrder:n}=e;f({action:"mutateTableForm",data:v({},_.tableForm,{sortOrder:n})})},sortFormDefaultValues:null==_?void 0:_.tableForm,onSortFormReset:e=>{e("sortOrder","DESC"),f({action:"mutateTableForm",data:m})}};return l.createElement(t.Fragment,null,l.createElement(a.Header,null,u("ES_COMMON_INBOX"),T?l.createElement("p",{className:"inbox-count"},T):null),l.createElement(a.InboxComposer,v({isInboxLoading:N,PropsForInboxLinks:A},L,R,P,{propsForInboxTable:w,propsForInboxMobileCards:W,formState:_})))},BillAmendmentCard:()=>{if(!Digit.Utils.wsAccess())return null;const{t:e}=o.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),[i,r]=t.useState(0);sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const u={sortBy:"",limit:10,offset:0,sortOrder:"DESC"},d={},s={applicationStatus:[],businessService:["WS.AMENDMENT"],moduleName:"bsWs-service",locality:[],assignee:"ASSIGNED_TO_ALL"},c={filterForm:s,searchForm:d,tableForm:u},p={filterForm:v({},s,{businessService:["SW.AMENDMENT"],moduleName:"bsSw-service"}),searchForm:d,tableForm:u},{isLoading:m,data:E}=Digit.Hooks.useBillAmendmentInbox({tenantId:n,filters:v({},c)}),{isLoading:S,data:_}=Digit.Hooks.useBillAmendmentInbox({tenantId:n,filters:v({},p)});t.useEffect(()=>{m&&S||r(null!=E&&E.totalCount&&null!=_&&_.totalCount?(null==E?void 0:E.totalCount)+(null==_?void 0:_.totalCount):null!=E&&E.totalCount?null==E?void 0:E.totalCount:null!=_&&_.totalCount?null==_?void 0:_.totalCount:0)},[E,_]);const f=t.useMemo(()=>({Icon:l.createElement(a.WSICon,null),moduleName:e("WS_BILL_AMENDMENT_BUTTON"),kpis:[{count:m?"-":i,label:e("TOTAL_WS"),link:"/digit-ui/employee/ws/water/bill-amendment/inbox"},{count:m?"-":null==E?void 0:E.slaCount,label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/ws/water/bill-amendment/inbox"}],links:[{count:m?"-":null==E?void 0:E.totalCount,label:e("WS_WATER_INBOX"),link:"/digit-ui/employee/ws/water/bill-amendment/inbox",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]},{count:m?"-":null==_?void 0:_.totalCount,label:e("SW_WATER_INBOX"),link:"/digit-ui/employee/ws/sewerage/bill-amendment/inbox",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]}]}),[m,E,i]);return l.createElement(a.EmployeeModuleCard,f)},WSSearchApplication:e=>{let{tenantId:n,onSubmit:u,data:d,count:s,resultOk:c,businessService:v,isLoading:p}=e;const[m,E,S]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[_,f,g]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),{t:C}=o.useTranslation(),{register:N,control:y,handleSubmit:D,setValue:T,getValues:h,reset:A}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",isConnectionSearch:!0}});t.useEffect(()=>{N("offset",0),N("limit",10),N("sortBy","commencementDate"),N("sortOrder","DESC"),N("sortOrder","DESC"),N("isConnectionSearch",!0)},[N]),t.useEffect(()=>{S(),E({}),f({}),g()},[]);const I=t.useCallback(e=>{0!==e.length&&(T("sortBy",e.id),T("sortOrder",e.desc?"DESC":"ASC"))},[]);function O(){T("offset",h("offset")-h("limit")),D(u)()}if(window.Digit.Utils.browser.isMobile())return l.createElement(kl,{Controller:r.Controller,register:N,control:y,t:C,reset:A,previousPage:O,handleSubmit:D,tenantId:n,data:d,onSubmit:u,businessService:v});const b=e=>l.createElement("span",{className:"cell-text"},e),L=t.useMemo(()=>[{Header:C("WS_MYCONNECTIONS_CONSUMER_NO"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a,r,u,d,s,c,v;let{row:p}=e,m="WATER";return"NEW_WATER_CONNECTION"==(null==p||null===(t=p.original)||void 0===t?void 0:t.applicationType)||"MODIFY_WATER_CONNECTION"==(null==p||null===(o=p.original)||void 0===o?void 0:o.applicationType)||"DISCONNECT_WATER_CONNECTION"==(null==p||null===(a=p.original)||void 0===a?void 0:a.applicationType)||"WATER_RECONNECTION"==(null==p||null===(r=p.original)||void 0===r?void 0:r.applicationType)?m="WATER":"NEW_SEWERAGE_CONNECTION"!=(null==p||null===(u=p.original)||void 0===u?void 0:u.applicationType)&&"MODIFY_SEWERAGE_CONNECTION"!=(null==p||null===(d=p.original)||void 0===d?void 0:d.applicationType)&&"DISCONNECT_SEWERAGE_CONNECTION"!=(null==p||null===(s=p.original)||void 0===s?void 0:s.applicationType)&&"SEWERAGE_RECONNECTION"!=(null==p||null===(c=p.original)||void 0===c?void 0:c.applicationType)||(m="SEWERAGE"),l.createElement("div",null,p.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+p.original.connectionNo+"&tenantId="+n+"&service="+m+"&due="+((null===(v=p.original)||void 0===v?void 0:v.due)||0)+"&from=WS_SEWERAGE_APPLICATION_SEARCH"},p.original.connectionNo||"NA")):l.createElement("span",null,C("NA")))}},{Header:C("WS_ACK_COMMON_APP_NO_LABEL"),accessor:"applicationNo",disableSortBy:!0,Cell:e=>{var t,o,a,r,u,d,s,c;let{row:v}=e,p="WATER";if("NEW_WATER_CONNECTION"==(null==v||null===(t=v.original)||void 0===t?void 0:t.applicationType)||"MODIFY_WATER_CONNECTION"==(null==v||null===(o=v.original)||void 0===o?void 0:o.applicationType)||"DISCONNECT_WATER_CONNECTION"==(null==v||null===(a=v.original)||void 0===a?void 0:a.applicationType)||"WATER_RECONNECTION"==(null==v||null===(r=v.original)||void 0===r?void 0:r.applicationType)?p="WATER":"NEW_SEWERAGE_CONNECTION"!=(null==v||null===(u=v.original)||void 0===u?void 0:u.applicationType)&&"MODIFY_SEWERAGE_CONNECTION"!=(null==v||null===(d=v.original)||void 0===d?void 0:d.applicationType)&&"DISCONNECT_SEWERAGE_CONNECTION"!=(null==v||null===(s=v.original)||void 0===s?void 0:s.applicationType)&&"SEWERAGE_RECONNECTION"!=(null==v||null===(c=v.original)||void 0===c?void 0:c.applicationType)||(p="SEWERAGE"),"MODIFY_SEWERAGE_CONNECTION"===v.original.applicationType||"MODIFY_WATER_CONNECTION"===v.original.applicationType){var m,E,S,_,f,g;let e="application";return null!=v&&null!==(m=v.original)&&void 0!==m&&null!==(E=m.applicationType)&&void 0!==E&&null!==(S=E.toUpperCase())&&void 0!==S&&S.includes("DISCONNECT")?e="disconnection":null!=v&&null!==(_=v.original)&&void 0!==_&&null!==(f=_.applicationType)&&void 0!==f&&null!==(g=f.toUpperCase())&&void 0!==g&&g.includes("MODIFY")&&(e="modify"),l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+e+"-details?applicationNumber="+v.original.applicationNo+"&tenantId="+n+"&service="+p+"&mode=MODIFY&from=WS_SEWERAGE_APPLICATION_SEARCH"},v.original.applicationNo)))}{var C,N,y,D;let e="application";return null!=v&&null!==(C=v.original)&&void 0!==C&&null!==(N=C.applicationType)&&void 0!==N&&N.includes("DISCONNECT")?e="disconnection":null!=v&&null!==(y=v.original)&&void 0!==y&&null!==(D=y.applicationType)&&void 0!==D&&D.includes("MODIFY")&&(e="modify"),l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/"+e+"-details?applicationNumber="+v.original.applicationNo+"&tenantId="+n+"&service="+p+"&from=WS_SEWERAGE_APPLICATION_SEARCH"},v.original.applicationNo)))}}},{Header:C("WS_APPLICATION_TYPE_LABEL"),disableSortBy:!0,accessor:e=>b(C("WS_"+e.applicationType))},{Header:C("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),disableSortBy:!0,accessor:e=>{var n,t,l,o;return b(null!=e&&null!==(n=e.connectionHolders)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&t.name?null==e||null===(l=e.connectionHolders)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.name:(null==e?void 0:e.ownerNames)||"-")}},{Header:C("WS_COMMON_TABLE_COL_APPLICATION_STATUS_LABEL"),accessor:e=>b(C((null==e?void 0:e.applicationStatus)||"NA")),disableSortBy:!0},{Header:C("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,accessor:e=>b((null==e?void 0:e.address)||"-")}],[]);return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},C("WS"===v?"WS_WATER_SEARCH_APPLICATION_SUB_HEADER":"WS_SEWERAGE_SEARCH_APPLICATION_SUB_HEADER")),l.createElement(a.Card,{className:"card-search-heading"},l.createElement("span",{style:{color:"#505A5F"}},C("WS_INFO_VALIDATION"))),l.createElement(a.SearchForm,{onSubmit:u,handleSubmit:D},l.createElement(Bl,{register:N,control:y,reset:A,tenantId:n,t:C,businessService:v})),p?l.createElement(a.Loader,null):null,null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},C(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement(a.Table,{t:C,data:d,totalRecords:s,columns:L,getCellProps:e=>({style:{minWidth:e.column.Header===C("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:function(e){T("limit",Number(e.target.value)),D(u)()},currentPage:h("offset")/h("limit"),onNextPage:function(){T("offset",h("offset")+h("limit")),D(u)()},onPrevPage:O,pageSizeLimit:h("limit"),onSort:I,disableSort:!1,sortParams:[{id:h("sortBy"),desc:"DESC"===h("sortOrder")}]}):null)},WSSearchWaterConnection:e=>{let{tenantId:n,onSubmit:u,data:d,count:s,resultOk:c,isLoading:v}=e;const p=i.useHistory(),[m,E]=t.useState([]),[S,_]=t.useState(null);t.useEffect(function(){try{return Promise.resolve(Digit.WSService.WSSewsearchDemand({BulkBillCriteria:{tenantId:"pg.citya"}},window.location.href.includes("ws/sewerage/search-demand")?"sw":"ws")).then(function(e){E(e.connection)})}catch(e){return Promise.reject(e)}},[]);const{t:f}=o.useTranslation(),{register:g,control:C,handleSubmit:N,setValue:y,getValues:D,reset:T}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"commencementDate",sortOrder:"DESC",searchType:"CONNECTION"}});t.useEffect(()=>{g("offset",0),g("limit",10),g("sortBy","commencementDate"),g("searchType","CONNECTION"),g("sortOrder","DESC"),g("propertyId","")},[g]);const h=t.useCallback(e=>{0!==e.length&&(y("sortBy",e.id),y("sortOrder",e.desc?"DESC":"ASC"))},[]);function A(e){y("limit",Number(e.target.value)),N(u)()}function I(){y("offset",D("offset")+D("limit")),N(u)()}function O(){y("offset",D("offset")-D("limit")),N(u)()}if(window.Digit.Utils.browser.isMobile())return l.createElement(zl,{Controller:r.Controller,register:g,control:C,t:f,reset:T,previousPage:O,handleSubmit:N,tenantId:n,data:d,onSubmit:u});const b=e=>l.createElement("span",{className:"cell-text"},e),L=t.useMemo(()=>[{Header:f("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a;let{row:r}=e;return l.createElement("div",null,r.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+r.original.connectionNo+"&tenantId="+n+"&service="+(null===(t=r.original)||void 0===t?void 0:t.service)+"&connectionType="+(null===(o=r.original)||void 0===o?void 0:o.connectionType)+"&due="+((null===(a=r.original)||void 0===a?void 0:a.due)||0)+"&from=WS_SEWERAGE_CONNECTION_SEARCH_LABEL"},r.original.connectionNo||"NA")):l.createElement("span",null,f("NA")))}},{Header:f("WS_COMMON_TABLE_COL_SERVICE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return b(f("WS_"+(null===(n=t.original)||void 0===n?void 0:n.service)))}},{Header:f("WS_COMMON_TABLE_COL_OWN_NAME_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o,i;let{row:a}=e;return b(null!=a&&null!==(n=a.original)&&void 0!==n&&null!==(t=n.connectionHolders)&&void 0!==t&&t.map(e=>null==e?void 0:e.name).join(",")?null==a||null===(l=a.original)||void 0===l||null===(o=l.connectionHolders)||void 0===o?void 0:o.map(e=>null==e?void 0:e.name).join(","):""+((null===(i=a.original)||void 0===i?void 0:i.ownerNames)||"NA"))}},{Header:f("WS_COMMON_TABLE_COL_STATUS_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return b(f("WS_"+(null===(n=l.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())))}},{Header:f("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;var l,o;return(null==t||null===(n=t.original)||void 0===n?void 0:n.due)<=0?b(""+(null===(l=t.original)||void 0===l?void 0:l.due)):b(""+((null===(o=t.original)||void 0===o?void 0:o.due)||"NA"))}},{Header:f("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return b(""+((null===(n=t.original)||void 0===n?void 0:n.address)||"NA"))}},{Header:f("WS_COMMON_TABLE_COL_DUE_DATE_LABEL"),disableSortBy:!0,Cell:e=>{var n,t,l,o;let{row:i}=e;const a=(null===(n=i.original)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.toUpperCase())||"",r="NA"===(null===(l=i.original)||void 0===l?void 0:l.dueDate)?f("WS_NA"):(e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()})(null===(o=i.original)||void 0===o?void 0:o.dueDate);return b(f("INACTIVE"===a?"WS_NA":""+r))}},{Header:f("WS_COMMON_TABLE_COL_ACTION_LABEL"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;const l=null===(n=t.original)||void 0===n?void 0:n.due;var o;return b(l||0==l?P(null===(o=t.original)||void 0===o?void 0:o.status,t):f("WS_NA"))}}],[]),R=t.useMemo(()=>[{Header:f("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{var t,o,a;let{row:r}=e;return l.createElement("div",null,r.original.connectionNo?l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/employee/ws/connection-details?applicationNumber="+r.original.connectionNo+"&tenantId="+n+"&service="+(null===(t=r.original)||void 0===t?void 0:t.service)+"&connectionType="+(null===(o=r.original)||void 0===o?void 0:o.connectionType)+"&due="+((null===(a=r.original)||void 0===a?void 0:a.due)||0)+"&from=WS_SEWERAGE_CONNECTION_SEARCH_LABEL"},r.original.connectionNo||"NA")):l.createElement("span",null,f("NA")))}},{Header:f("WS_COMMON_TABLE_COL_applicationNo_LABEL"),disableSortBy:!0,Cell:e=>{let{row:n}=e;return l.createElement("div",null,n.original.applicationNo)}},{Header:f("WS_COMMON_TABLE_COL_propertyId_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return b(f("WS_"+(null===(n=l.original)||void 0===n||null===(t=n.propertyId)||void 0===t?void 0:t.toUpperCase())))}},{Header:f("WS_COMMON_TABLE_COL_ACTION_LABEL"),disableSortBy:!0,Cell:e=>{let{row:n}=e;return b(w(n))}}],[]),w=e=>l.createElement("div",null,l.createElement("span",{className:"link"},l.createElement("button",{onClick:()=>{W(e)}},f("WS_COMMON_COLLECT_DEMAND")," "))),W=function(e){try{return Promise.resolve(Digit.WSService.WSSewsearchDemandGen({BulkBillCriteria:{tenantId:"pg.citya",consumerCode:e.original.connectionNo}},window.location.href.includes("ws/sewerage/search-demand")?"sw":"ws")).then(function(n){var t,l,o;_({label:""+n}),p.push("/digit-ui/employee/payment/collect/SW/"+encodeURIComponent(null===(t=e.original)||void 0===t?void 0:t.connectionNo)+"/"+(null===(l=e.original)||void 0===l?void 0:l.tenantId)+"?tenantId="+(null===(o=e.original)||void 0===o?void 0:o.tenantId)+"?workflow=WS&ISWSCON")})}catch(e){return Promise.reject(e)}},P=(e,n)=>{var t,o,a,r,u,d,s,c,v;if(!(Digit.UserService.getUser().info.roles.map(e=>e.code).filter(e=>"WS_CEMP"===e||"SW_CEMP"===e).length>0))return null;switch(e){case"Active":return l.createElement("div",null,l.createElement("span",{className:"link"},"WATER"===(null===(t=n.original)||void 0===t?void 0:t.service)?l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/payment/collect/"+("WATER"===(null===(o=n.original)||void 0===o?void 0:o.service)?"WS":"SW")+"/"+encodeURIComponent(null===(a=n.original)||void 0===a?void 0:a.connectionNo)+"/"+(null===(r=n.original)||void 0===r?void 0:r.tenantId)+"?tenantId="+(null===(u=n.original)||void 0===u?void 0:u.tenantId)+"?workflow=WS&ISWSCON"}},f("WS_COMMON_COLLECT_LABEL")," "):l.createElement(i.Link,{to:{pathname:"/digit-ui/employee/payment/collect/"+("WATER"===(null===(d=n.original)||void 0===d?void 0:d.service)?"WS":"SW")+"/"+encodeURIComponent(null===(s=n.original)||void 0===s?void 0:s.connectionNo)+"/"+(null===(c=n.original)||void 0===c?void 0:c.tenantId)+"?tenantId="+(null===(v=n.original)||void 0===v?void 0:v.tenantId)+"?workflow=SW&ISWSCON"}},f("WS_COMMON_COLLECT_LABEL")," ")))}};return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},window.location.href.includes("water")?f("WS_WATER_SEARCH_CONNECTION_SUB_HEADER"):f("WS_SEWERAGE_SEARCH_CONNECTION_SUB_HEADER")),window.location.href.includes("search-demand")?"":l.createElement(a.SearchForm,{className:"ws-custom-wrapper",onSubmit:u,handleSubmit:N},l.createElement(Hl,{register:g,control:C,reset:T,tenantId:n,t:f})),v?l.createElement(a.Loader,null):null,null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},f(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement(a.Table,{t:f,data:d,totalRecords:s,columns:L,getCellProps:e=>({style:{minWidth:e.column.Header===f("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:A,currentPage:D("offset")/D("limit"),onNextPage:I,onPrevPage:O,pageSizeLimit:D("limit"),onSort:h,disableSort:!1,sortParams:[{id:D("sortBy"),desc:"DESC"===D("sortOrder")}]}):null,window.location.href.includes("search-demand")?(null==m?void 0:m.length)>0?l.createElement(a.Table,{t:f,data:m,totalRecords:s,columns:R,getCellProps:e=>({style:{minWidth:e.column.Header===f("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:A,currentPage:D("offset")/D("limit"),onNextPage:I,onPrevPage:O,pageSizeLimit:D("limit"),onSort:h,disableSort:!1,sortParams:[{id:D("sortBy"),desc:"DESC"===D("sortOrder")}]}):l.createElement(a.Card,{style:{marginTop:20}},l.createElement("p",{style:{textAlign:"center"}},"No Data Found")):"",(null==S?void 0:S.label)&&l.createElement(a.Toast,{label:null==S?void 0:S.label,onClose:e=>{_(e=>null)}}))},WSBulkBillSearch:e=>{let{tenantId:n,onSubmit:i,data:d,count:s,resultOk:c,businessService:v,isLoading:p}=e;const[m,E]=t.useState(null),[S,_]=t.useState(null),[f,g]=t.useState(null),[C,N]=t.useState(()=>null),[y,D]=t.useState(""),[T,h]=t.useState([]),[A,I]=t.useState([]),[O,b]=t.useState([]),[L,R]=t.useState(!1),{mutate:w}=Digit.Hooks.ws.useBulkMeterReadingCreateAPI(v),W=e=>{if(null==e||null==e||""==e)return"NA";const n=new Date(e);let t=n.getMonth()+1,l=n.getDate();return t=(t>9?"":"0")+t,l=(l>9?"":"0")+l,l+"/"+t+"/"+n.getFullYear()},P=()=>{_(!1)},M=e=>l.createElement("h1",{className:"heading-m"},e.label),x=()=>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"})),B=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(x,null)),{t:F}=o.useTranslation(),{register:U,control:k,handleSubmit:H,setValue:j,getValues:V,reset:z}=r.useForm({defaultValues:{offset:0,limit:10,sortBy:"consumerNo",sortOrder:"DESC",searchType:"CONNECTION",locality:"",tenantId:""}}),Y=e=>l.createElement("div",{onClick:e.onClick},l.createElement(a.DownloadBtnCommon,null));t.useEffect(()=>{U("offset",0),U("limit",10),U("sortBy","commencementDate"),U("searchType","CONNECTION"),U("sortOrder","DESC"),U("locality",""),U("tenantId","")},[U]);const G=t.useCallback(e=>{0!==e.length&&(j("sortBy",e.id),j("sortOrder",e.desc?"DESC":"ASC"))},[]);function q(e){j("limit",Number(e.target.value)),H(i)()}function K(){j("offset",V("offset")+V("limit")),H(i)()}function X(){j("offset",V("offset")-V("limit")),H(i)()}const Z=()=>{E(null)};if(window.Digit.Utils.browser.isMobile())return l.createElement(zl,{Controller:r.Controller,register:U,control:k,t:F,reset:z,previousPage:X,handleSubmit:H,tenantId:n,data:d,onSubmit:i,setValue:j});const $=e=>l.createElement("span",{className:"cell-text"},e),J=(e,n)=>{if(e.preventDefault(),void 0!==(null==n?void 0:n[0]))return Digit.Download.Excel(n,"Bulk-Bill")},Q=t.useMemo(()=>[{Header:F("BILLING_CYCLE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.billingPeriod)}},{Header:F("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,n.original.connectionNo?n.original.connectionNo||"NA":F("NA")))}},{Header:F("LAST_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.lastReading)}},{Header:F("METER_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.lastReadingDate))}},{Header:F("METER_STATUS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.meterStatus)}},{Header:F("CURRECT_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.currentReading)}},{Header:F("CURRECT_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.currentReadingDate))}}]),ee=t.useMemo(()=>[{Header:F("BILLING_CYCLE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.billingPeriod)}},{Header:F("WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL"),disableSortBy:!0,accessor:"connectionNo",Cell:e=>{let{row:n}=e;return l.createElement("div",null,l.createElement("span",null,n.original.connectionNo?n.original.connectionNo||"NA":F("NA")))}},{Header:F("LAST_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.lastReading)}},{Header:F("METER_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.lastReadingDate))}},{Header:F("METER_STATUS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.meterStatus)}},{Header:F("CURRECT_READING"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.currentReading)}},{Header:F("CURRECT_READING_DATE"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(W(null===(n=t.original)||void 0===n?void 0:n.currentReadingDate))}},{Header:F("CURRECT_STATUS"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return $(null===(n=t.original)||void 0===n?void 0:n.status)}}]);return l.createElement(t.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},F("WS_WATER_SEARCH_BULK_CONNECTION_SUB_HEADER")),l.createElement(a.SearchForm,{className:"ws-custom-wrapper",onSubmit:i,handleSubmit:H},l.createElement(Yl,{register:U,control:k,reset:z,tenantId:n,t:F,setValue:j})),p?l.createElement(a.Loader,null):null,L&&l.createElement(a.Loader,null),null!=d&&d.display&&!c?l.createElement(a.Card,{style:{marginTop:20}},F(null==d?void 0:d.display).split("\\n").map((e,n)=>l.createElement("p",{key:n,style:{textAlign:"center"}},e))):c?l.createElement("div",{style:{backgroundColor:"white"}},l.createElement("div",{className:"sideContent",style:{float:"right",padding:"10px 30px"}},l.createElement("span",{className:"table-search-wrapper",style:{cursor:"pointer"}},l.createElement(Y,{className:"mrlg cursorPointer",onClick:e=>J(e,d)}))),l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"70%"}},l.createElement(a.UploadFile,{id:"Bulk-Bill",extraStyleName:"propertyCreate",message:C?"1 "+F("CS_WS_ACTION_FILEUPLOADED"):F("CS_WS_ACTION_NO_FILEUPLOADED"),accept:".xlsx",onUpload:e=>function(e){e.preventDefault(),D(e.target.files[0]),function(e){try{new Promise((n,t)=>{const l=new FileReader;l.readAsArrayBuffer(e),l.onload=e=>{const t=u.read(e.target.result,{type:"buffer"}),l=u.utils.sheet_to_json(t.Sheets[t.SheetNames[0]]).map(e=>({billingPeriod:e.billingPeriod,currentReading:e.currentReading,currentReadingDate:e.currentReadingDate,lastReading:e.lastReading,lastReadingDate:e.lastReadingDate,connectionNo:e.connectionNo,meterStatus:e.meterStatus,tenantId:"pg.citya"})),o=l.filter(e=>e.currentReading>=e.lastReading&&(e=>{var n;const t=new Date(0).getTimezoneOffset(),l=new Date(0,0,e-1,0,-t,0);return Digit.Utils.pt.convertDateToEpoch(null==l||null===(n=l.toJSON())||void 0===n?void 0:n.split("T")[0])})(null==e?void 0:e.currentReadingDate)>e.lastReadingDate),i=l.filter(e=>!o.includes(e));console.log("reading list",o,i),I(i),n(o,i)},l.onerror=e=>{t(e)}}).then(function(e,n){try{return h(e),Promise.resolve()}catch(e){return Promise.reject(e)}}),Promise.resolve()}catch(e){return Promise.reject(e)}}(e.target.files[0]),N("bulk")}(e),onDelete:e=>{N(null),h([])}})),(null==T?void 0:T.length)>0?l.createElement("div",{style:{top:"5px",left:"10px",position:"relative"}},l.createElement("span",null,l.createElement(a.SubmitBar,{label:F("WS_COMMON_SUBMIT_READING"),onSubmit:()=>{(null==A?void 0:A.length)>0&&_(!0)}}))):""),l.createElement(a.Table,{t:F,data:d,totalRecords:s,columns:Q,getCellProps:e=>({style:{minWidth:e.column.Header===F("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onSort:G,disableSort:!1,sortParams:[{id:V("sortBy"),desc:"DESC"===V("sortOrder")}]})):null,l.createElement("div",null,S&&l.createElement(a.Modal,{headerBarMain:l.createElement(M,{label:F("WS_BULK_READING_REJECT")}),headerBarEnd:l.createElement(B,{onClick:P}),actionCancelLabel:"Cancel",actionCancelOnSubmit:P,actionSaveLabel:"Proceed",actionSaveOnSubmit:()=>{_(!1),function(){try{const e=function(){if(w)return R(!0),Promise.resolve(w({meterReadingList:T},{onError:(e,n)=>{R(!1),E({error:!0,label:null!=e&&e.message?e.message:e}),setTimeout(Z,5e3)},onSuccess:function(e,n){try{return R(!1),console.log("data",e),g(!0),b(e.meterReadings),E({key:"success",label:"WS_METER_READING_ADDED_SUCCESFULLY"}),setTimeout(Z,3e3),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},formId:"modal-action",popupStyles:{width:"auto"}}," ",l.createElement("div",{style:{width:"100%"}},l.createElement(a.Card,null,l.createElement("div",null,l.createElement(a.CardText,null,F("WS_REASON_FOR_REJECT"))),l.createElement("div",null,l.createElement(a.CardText,null,F("WS_SUCCESS_DATA_COUNT")," - ",null==T?void 0:T.length)),l.createElement("div",null,l.createElement(a.CardText,null,F("WS_REJECT_DATA_COUNT")," - ",null==A?void 0:A.length)),l.createElement(a.Table,{t:F,data:A,totalRecords:null==A?void 0:A.length,columns:Q,getCellProps:e=>({style:{minWidth:e.column.Header===F("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:q,currentPage:V("offset")/V("limit"),onNextPage:K,onPrevPage:X,pageSizeLimit:V("limit"),onSort:G,disableSort:!0,sortParams:[{id:V("sortBy"),desc:"DESC"===V("sortOrder")}]})))),f&&l.createElement(a.Modal,{headerBarMain:l.createElement(M,{label:F("WS_BULK_READING_STATUS")}),headerBarEnd:l.createElement(B,{onClick:()=>{g(!1)}}),formId:"modal-action",popupStyles:{width:"auto"}}," ",l.createElement("div",{style:{width:"100%"}},l.createElement(a.Card,null,l.createElement("div",null,l.createElement(a.CardText,null,F("Bulk Meter Reading Status"))),l.createElement("div",{className:"sideContent",style:{float:"right",padding:"10px 30px"}},l.createElement("span",{className:"table-search-wrapper",style:{cursor:"pointer"}},l.createElement(Y,{className:"mrlg cursorPointer",onClick:e=>J(e,O)}))),l.createElement(a.Table,{t:F,data:O,totalRecords:null==O?void 0:O.length,columns:ee,getCellProps:e=>({style:{minWidth:e.column.Header===F("ES_INBOX_APPLICATION_NO")?"240px":"",padding:"20px 18px",fontSize:"16px"}}),onPageSizeChange:q,currentPage:V("offset")/V("limit"),onNextPage:K,onPrevPage:X,pageSizeLimit:V("limit"),onSort:G,disableSort:!0,sortParams:[{id:V("sortBy"),desc:"DESC"===V("sortOrder")}]}))))),(null==m?void 0:m.label)&&l.createElement(a.Toast,{label:null==m?void 0:m.label,onClose:e=>{E(e=>null)}}))},WSCard:()=>{const{t:e}=o.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),[i,r]=t.useState(0);sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const{isLoading:u,data:d}=Digit.Hooks.ws.useInbox({tenantId:n,filters:v({},{filterForm:{businessService:["NewWS1","ModifyWSConnection","DisconnectWSConnection"],moduleName:"ws-services",locality:[],applicationStatus:[],applicationType:[]},searchForm:{},tableForm:{sortBy:"auditDetails.lastModifiedTime",sortOrder:"DESC"}})});t.useEffect(()=>{u||r(null!=d&&d.totalCount?null==d?void 0:d.totalCount:0)},[d]);let s=[{label:e("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"),link:"/digit-ui/employee/ws/create-application",roles:["WS_CEMP","SW_CEMP"]}];s=s.filter(e=>!e.roles||b(e.roles));const c={Icon:l.createElement(a.WSICon,null),moduleName:e("ACTION_TEST_WATER"),kpis:[{count:u?"-":i,label:e("TOTAL_WS"),link:"/digit-ui/employee/ws/water/inbox"},{count:u?"-":null==d?void 0:d.slaCount,label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/ws/water/inbox"}],links:[{count:u?"-":null==d?void 0:d.totalCount,label:e("WS_INBOX_HEADER"),link:"/digit-ui/employee/ws/water/inbox",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]},...s,{label:e("WS_WATER_CONNECTION_SEARCH_LABEL"),link:"/digit-ui/employee/ws/water/search-connection",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]},{label:e("WS_WATER_APPLICATION_SEARCH"),link:"/digit-ui/employee/ws/water/search-application",roles:["WS_CEMP","WS_APPROVER","WS_FIELD_INSPECTOR","WS_DOC_VERIFIER","WS_CLERK"]}]};return l.createElement(a.EmployeeModuleCard,c)},SWCard:()=>{const{t:e}=o.useTranslation(),n=Digit.ULBService.getCurrentTenantId(),[i,r]=t.useState(0);sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const{isLoading:u,data:d}=Digit.Hooks.ws.useInbox({tenantId:n,filters:v({},{filterForm:{businessService:["NewSW1","ModifySWConnection","DisconnectSWConnection"],moduleName:"sw-services",locality:[],applicationStatus:[],applicationType:[]},searchForm:{},tableForm:{sortBy:"auditDetails.lastModifiedTime",sortOrder:"DESC"}})});t.useEffect(()=>{u||r(null!=d&&d.totalCount?null==d?void 0:d.totalCount:0)},[d]);let s=[{label:e("WS_APPLY_NEW_CONNECTION_HOME_CARD_LABEL"),link:"/digit-ui/employee/ws/create-application",roles:["WS_CEMP","SW_CEMP"]}];s=s.filter(e=>!e.roles||b(e.roles));const c={Icon:l.createElement(a.WSICon,null),moduleName:e("ACTION_TEST_SEWERAGE"),kpis:[{count:u?"-":i,label:e("TOTAL_SW"),link:"/digit-ui/employee/ws/sewerage/inbox"},{count:u?"-":null==d?void 0:d.slaCount,label:e("TOTAL_NEARING_SLA"),link:"/digit-ui/employee/ws/sewerage/inbox"}],links:[{count:u?"-":null==d?void 0:d.totalCount,label:e("WS_SEWERAGE_INBOX"),link:"/digit-ui/employee/ws/sewerage/inbox",roles:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]},...s,{label:e("WS_SEWERAGE_CONNECTION_SEARCH_LABEL"),link:"/digit-ui/employee/ws/sewerage/search-connection",roles:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]},{label:e("WS_SEWERAGE_APPLICATION_SEARCH"),link:"/digit-ui/employee/ws/sewerage/search-application",roles:["SW_CEMP","SW_APPROVER","SW_FIELD_INSPECTOR","SW_DOC_VERIFIER","SW_CLERK"]}]};return l.createElement(a.EmployeeModuleCard,c)},WSBillIAmendMentInbox:e=>{let{parentRoute:n}=e;const{t:u}=o.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),s=window.location.href.includes("/ws/water/bill-amendment/inbox"),c={mobileNumber:"",applicationNumber:"",consumerCode:""},p={applicationStatus:[],businessService:s?["WS.AMENDMENT"]:["SW.AMENDMENT"],moduleName:s?"bsWs-service":"bsSw-service",locality:[],assignee:"ASSIGNED_TO_ALL"},m={sortBy:"createdTime",limit:window.Digit.Utils.browser.isMobile()?50:10,offset:0,sortOrder:"ASC"};sessionStorage.removeItem("Digit.BILL.AMENDMENT.INBOX");const E=Digit.SessionStorage.get("BILL.AMENDMENT.INBOX"),S=t.useMemo(()=>E||{filterForm:p,searchForm:c,tableForm:m},[Object.values((null==E?void 0:E.filterForm)||{}),Object.values((null==E?void 0:E.searchForm)||{}),Object.values((null==E?void 0:E.tableForm)||{})]),[_,f]=t.useReducer(function(e,n){switch(n.action){case"mutateSearchForm":return Digit.SessionStorage.set("BILL.AMENDMENT.INBOX",v({},e,{searchForm:n.data})),v({},e,{searchForm:n.data});case"mutateFilterForm":return Digit.SessionStorage.set("BILL.AMENDMENT.INBOX",v({},e,{filterForm:n.data})),v({},e,{filterForm:n.data});case"mutateTableForm":return Digit.SessionStorage.set("BILL.AMENDMENT.INBOX",v({},e,{tableForm:n.data})),v({},e,{tableForm:n.data})}},S),{data:g,isLoading:C}=Digit.Hooks.useBoundaryLocalities(d,"revenue",{},u),{isLoading:N,data:{table:y,statuses:D,totalCount:T}={}}=Digit.Hooks.useBillAmendmentInbox({tenantId:d,filters:v({},_),config:{cacheTime:0}}),{data:h}=Digit.Hooks.useApplicationStatusGeneral({businessServices:["WS.AMENDMENT","SW.AMENDMENT"],tenantId:d},{enabled:(null==D?void 0:D.length)>0});null==D||D.map(e=>{var n,t;null==h||null===(n=h.otherRoleStates)||void 0===n||n.map(n=>{(null==n?void 0:n.uuid)===(null==e?void 0:e.statusid)&&(e.applicationstatus=u(null==n?void 0:n.state))}),null==h||null===(t=h.userRoleStates)||void 0===t||t.map(n=>{(null==n?void 0:n.uuid)===(null==e?void 0:e.statusid)&&(e.applicationstatus=u(null==n?void 0:n.state))})});const A={logoIcon:l.createElement(a.CollectionIcon,null),headerText:"ACTION_TEST_BILLAMENDMENT",links:[]},I=t.useCallback(e=>{let{registerRef:n,searchFormState:t}=e;return l.createElement(Gl,{registerRef:n,searchFormState:t,className:"search"})},[]),O=t.useCallback(e=>{let{registerRef:n,controlFilterForm:t,setFilterFormValue:o,getFilterFormValue:i}=e;return l.createElement(ql,{statuses:D,isInboxLoading:N,registerRef:n,controlFilterForm:t,setFilterFormValue:o,filterFormState:null==_?void 0:_.filterForm,getFilterFormValue:i,localitiesForEmployeesCurrentTenant:g,loadingLocalitiesForEmployeesCurrentTenant:C})},[D,N,g,C,h]),b={SearchFormFields:I,onSearchFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateSearchForm",data:e})},searchFormDefaultValues:null==_?void 0:_.searchForm,resetSearchFormDefaultValues:c,onSearchFormReset:e=>{e("mobileNumber",null),e("applicationNo",null),e("consumerCode",null),f({action:"mutateSearchForm",data:c})},className:"search-form-wns-inbox"},L={FilterFormFields:O,onFilterFormSubmit:e=>{e.hasOwnProperty("")&&(null==e||delete e[""]),f({action:"mutateTableForm",data:v({},m)}),f({action:"mutateFilterForm",data:e})},filterFormDefaultValues:null==_?void 0:_.filterForm,resetFilterFormDefaultValues:p,onFilterFormReset:e=>{e("moduleName",s?"bsWs-service":"bsSw-service"),e("locality",[]),e("assignee","ASSIGNED_TO_ALL"),e("applicationStatus",[]),f({action:"mutateFilterForm",data:p})}},R=(e=>{var n,a,r,u;let{onPageSizeChange:d,formState:s,totalCount:c,table:p,dispatch:m,onSortingByData:E,inboxStyles:S={},tableStyle:_={}}=e;const{t:f}=o.useTranslation(),g=Digit.ULBService.getCurrentTenantId(),C=e=>l.createElement("span",{className:"cell-text styled-cell"},e),N=t.useMemo(()=>[{Header:f("WS_COMMON_TABLE_COL_SERVICE_LABEL"),disableSortBy:!0,Cell:e=>{var n,t;let{row:l}=e;return C(f("ACTION_TEST_"+(null!=l&&null!==(n=l.original)&&void 0!==n&&null!==(t=n.service)&&void 0!==t&&t.includes("WS")?"WATER":"SEWERAGE")))}},{Header:f("WS_MYCONNECTIONS_APPLICATION_NO"),disableSortBy:!0,Cell:e=>{var n;let{row:t}=e;return l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(i.Link,{to:"/digit-ui/employee/ws/generate-note-bill-amendment?applicationNumber="+t.original.applicationNo},l.createElement("span",{className:"link"},t.original.applicationNo)),C(f("BILLAMENDMENT_"+(null==t||null===(n=t.original)||void 0===n?void 0:n.amendmentReason)+"_HEADING")))}},,{Header:f("CORE_COMMON_NAME"),disableSortBy:!0,accessor:"owner"},{Header:f("WS_COMMON_TABLE_COL_ADDRESS"),disableSortBy:!0,accessor:e=>C(f(Digit.Utils.locale.getRevenueLocalityCode(e.address,g)))},{Header:f("WS_COMMON_TABLE_COL_APPLICATION_STATUS"),disableSortBy:!0,accessor:e=>{return"Approved"===(n=f(null==e?void 0:e.status))?l.createElement("span",{style:{color:"#00703C"}},n):"Rejected"===n?l.createElement("span",{style:{color:"#0B0C0C"}},n):"Inworkflow"===n?l.createElement("span",{style:{color:"#E50000"}},n):void 0;var n}},{Header:f("WS_COMMON_TABLE_COL_TASK_OWNER"),disableSortBy:!0,accessor:"taskOwner"}]);return{getCellProps:e=>({style:{padding:"20px 18px",fontSize:"16px"}}),disableSort:!1,autoSort:!1,manualPagination:!0,initSortId:"applicationDate",onPageSizeChange:d,currentPage:(null===(n=s.tableForm)||void 0===n?void 0:n.offset)/(null===(a=s.tableForm)||void 0===a?void 0:a.limit),onNextPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)+parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},onPrevPage:()=>{var e,n;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.offset)-parseInt(null===(n=s.tableForm)||void 0===n?void 0:n.limit)})})},pageSizeLimit:null===(r=s.tableForm)||void 0===r?void 0:r.limit,onSort:E,totalRecords:c,onSearch:null==s||null===(u=s.searchForm)||void 0===u?void 0:u.message,onLastPage:()=>{var e;return m({action:"mutateTableForm",data:v({},s.tableForm,{offset:10*Math.ceil(c/10)-parseInt(null===(e=s.tableForm)||void 0===e?void 0:e.limit)})})},onFirstPage:()=>m({action:"mutateTableForm",data:v({},s.tableForm,{offset:0})}),data:p,columns:N,inboxStyles:v({},S),tableStyle:v({},_)}})(v({},{parentRoute:n,onPageSizeChange:e=>{f({action:"mutateTableForm",data:v({},_.tableForm,{limit:e.target.value})})},formState:_,totalCount:T,table:y,dispatch:f,onSortingByData:e=>{if(e.length>0){const[{id:n,desc:t}]=e,l=t?"DESC":"ASC";_.tableForm.sortBy===n&&_.tableForm.sortOrder===l||f({action:"mutateTableForm",data:v({},_.tableForm,{sortBy:n,sortOrder:t?"DESC":"ASC"})})}},inboxStyles:{overflowX:"scroll",overflowY:"hidden"},tableStyle:{width:"70%"}})),w=(e=>{let{table:n}=e;const{t:t}=o.useTranslation(),u=(e,n)=>l.createElement("div",{style:{display:"flex",flexDirection:"column"}},l.createElement(i.Link,{to:"/digit-ui/employee/ws/generate-note-bill-amendment?applicationNumber="+e},l.createElement("span",{className:"link"},e)),(e=>l.createElement("span",{className:"cell-text styled-cell"},e))(t("BILLAMENDMENT_"+n+"_HEADING")));return{data:null==n?void 0:n.map(e=>{let{applicationNo:n,address:l,status:o,owner:i,service:a,tenantId:r,amendmentReason:d,taskOwner:s}=e;return{[t("WS_COMMON_TABLE_COL_SERVICE_LABEL")]:t("ACTION_TEST_"+a),[t("WS_MYCONNECTIONS_APPLICATION_NO")]:u(n,d),[t("CORE_COMMON_NAME")]:i,[t("WS_COMMON_TABLE_COL_ADDRESS")]:t(Digit.Utils.locale.getRevenueLocalityCode(l,r)),[t("WS_COMMON_TABLE_COL_APPLICATION_STATUS")]:t(o),[t("WS_COMMON_TABLE_COL_TASK_OWNER")]:s}}),serviceRequestIdKey:t("NOC_APP_NO_LABEL"),MobileSortFormValues:()=>{const e=[{code:"DESC",i18nKey:"ES_COMMON_SORT_BY_DESC"},{code:"ASC",i18nKey:"ES_COMMON_SORT_BY_ASC"}],{control:n}=r.useFormContext();return l.createElement(a.SearchField,null,l.createElement(r.Controller,{name:"sortOrder",control:n,render:n=>{let{onChange:t,value:o}=n;return l.createElement(a.RadioButtons,{onSelect:e=>{t(e.code)},selectedOption:e.filter(e=>e.code===o)[0],optionsKey:"i18nKey",name:"sortOrder",options:e})}}))}}})({parentRoute:n,table:y}),W={onMobileSortOrderData:e=>{const{sortOrder:n}=e;f({action:"mutateTableForm",data:v({},_.tableForm,{sortOrder:n})})},sortFormDefaultValues:null==_?void 0:_.tableForm,onSortFormReset:e=>{e("sortOrder","DESC"),f({action:"mutateTableForm",data:m})}};return l.createElement(t.Fragment,null,l.createElement(a.Header,null,u("ES_COMMON_INBOX"),T?l.createElement("p",{className:"inbox-count"},T):null),l.createElement(a.InboxComposer,v({isInboxLoading:N,PropsForInboxLinks:A},b,L,W,{propsForInboxTable:R,propsForInboxMobileCards:w,formState:_})))},WSCreate:()=>{var e,n,t,a,r,u;const s=d.useQueryClient(),{t:c}=o.useTranslation(),{pathname:p,state:m}=(i.useRouteMatch(),i.useLocation()),E=i.useRouteMatch(),S=i.useHistory(),[_,f,g]=(i.useLocation(),Digit.ULBService.getCurrentTenantId(),Digit.Hooks.useSessionStorage("WS_CREATE",null!=m&&m.edcrNumber?{data:{scrutinyNumber:{edcrNumber:null==m?void 0:m.edcrNumber}}}:{})),C=null===(e=Digit)||void 0===e||null===(n=e.ComponentRegistryService)||void 0===n?void 0:n.getComponent("WSCheckPage"),N=null===(t=Digit)||void 0===t||null===(a=t.ComponentRegistryService)||void 0===a?void 0:a.getComponent("WSAcknowledgement"),y=Digit.ULBService.getStateId();let{data:D}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(y,[]),T=window.location.href.includes("/modify-connection/")||window.location.href.includes("/edit-application/");_&&Object.keys(_).length>0&&window.location.href.includes("/citizen/ws/create-application/search-property")&&(g(),s.invalidateQueries("WS_CREATE"));const h=(e,n,t,l)=>{f(l?n:""===e?v({},n):v({},_,{[e]:v({},_[e],n)})),(e=>{var n,t,l,o,i;const a=p.split("/").pop();let{nextStep:r}=I.find(e=>e.route===a),u=I.find(e=>e.route===a&&e);"object"==typeof r&&null!=r&&(!r[sessionStorage.getItem("KnowProperty")]||"search-property"!==r[sessionStorage.getItem("KnowProperty")]&&"create-property"!==r[sessionStorage.getItem("KnowProperty")]||(r=""+r[sessionStorage.getItem("KnowProperty")])),u[sessionStorage.getItem("serviceName")]&&(r=u[sessionStorage.getItem("serviceName")]),(null!=_&&null!==(n=_.cptId)&&void 0!==n&&n.id||null!=_&&null!==(t=_.cpt)&&void 0!==t&&null!==(l=t.details)&&void 0!==l&&l.propertyId||T&&null!=_&&null!==(o=_.cpt)&&void 0!==o&&null!==(i=o.details)&&void 0!==i&&i.propertyId)&&"know-your-property"===r&&(r="property-details"),"docsrequired"===r&&"yes"===sessionStorage.getItem("changePropertySelected")&&(r="property-details");let d=S.push;if(null===r)return d(Xl(E.path,E.params)+"/check");d(Xl(E.path,E.params)+"/"+r)})()},A=()=>{};let I=[];return D=null!==(r=D)&&void 0!==r&&r.WSCreateConfig?null===(u=D)||void 0===u?void 0:u.WSCreateConfig:Kl,D.forEach(e=>{I=I.concat(e.body.filter(e=>!e.hideInCitizen))}),I.indexRoute="search-property",l.createElement(i.Switch,null,I.map((e,n)=>{const{component:t,texts:o,inputs:a,key:r,isSkipEnabled:u}=e,d="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:Xl(E.path,E.params)+"/"+e.route,key:n},l.createElement(d,{config:{texts:o,inputs:a,key:r,isSkipEnabled:u},onSelect:h,onSkip:A,t:c,formData:_,userType:"citizen"}))}),l.createElement(i.Route,{path:Xl(E.path,E.params)+"/check"},l.createElement(C,{onSubmit:function(){try{return sessionStorage.setItem("isCreateEnabled","true"),S.push(Xl(E.path,E.params)+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:_})),l.createElement(i.Route,{path:Xl(E.path,E.params)+"/acknowledgement"},l.createElement(N,{data:_,onSuccess:()=>{s.invalidateQueries("WS_CREATE")},clearParams:g})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Xl(E.path,E.params)+"/"+I.indexRoute})))},WSDisconnection:()=>{var e,n,t;d.useQueryClient();const{t:a}=o.useTranslation(),r=i.useRouteMatch(),u=Digit.ULBService.getStateId();let s=[],{data:c}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(u,{});return c=null!==(e=c)&&void 0!==e&&e.WSDisconnectionConfig?null===(n=c)||void 0===n?void 0:n.WSDisconnectionConfig:Zl,c=Zl,null===(t=c.filter(e=>"NEW_DISCONNECTION"===e.head))||void 0===t||t.forEach(e=>{s=s.concat(e.body.filter(e=>!e.hideInCitizen))}),s.indexRoute="docsrequired",l.createElement(i.Switch,null,s.map((e,n)=>{const{component:t,texts:o,inputs:u,key:d,isSkipEnabled:s}=e,c="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:$l(r.path,r.params)+"/"+e.route,key:n},l.createElement(c,{config:{texts:o,inputs:u,key:d,isSkipEnabled:s},t:a,userType:"citizen"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:$l(r.path,r.params)+"/"+s.indexRoute})))},WSRestoration:()=>{var e,n,t;d.useQueryClient();const{t:a}=o.useTranslation(),r=i.useRouteMatch(),u=Digit.ULBService.getStateId();let s=[],{data:c}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(u,{});c=null!==(e=c)&&void 0!==e&&e.WSDisconnectionConfig?null===(n=c)||void 0===n?void 0:n.WSDisconnectionConfig:Zl,c=Zl,null===(t=c.filter(e=>"NEW_DISCONNECTION"===e.head))||void 0===t||t.forEach(e=>{s=s.concat(e.body.filter(e=>!e.hideInCitizen))}),s.indexRoute="restoration-application";let v=[{route:"restoration-application",component:"WSRestorationForm",key:"WSRestorationForm",type:"component",withoutLabel:!0,nextStep:"check"},{route:"check",component:"WSRestorationCheckPage",key:"WSRestorationCheckPage",type:"component",isMandatory:!0,withoutLabel:!0,nextStep:"restoration-acknowledge",hideInEmployee:!0},{route:"restoration-acknowledge",component:"WSRestorationAcknowledgement",key:"WSRestorationAcknowledgement",type:"component",isMandatory:!0,withoutLabel:!0,hideInEmployee:!0}];return console.log(v,s),l.createElement(i.Switch,null,v.map((e,n)=>{const{component:t,texts:o,inputs:u,key:d,isSkipEnabled:s}=e,c="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:Jl(r.path,r.params)+"/"+e.route,key:n},l.createElement(c,{config:{texts:o,inputs:u,key:d,isSkipEnabled:s},t:a,userType:"citizen"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Jl(r.path,r.params)+"/"+s.indexRoute})))},WSSearchConnectionComponent:()=>{const{t:e}=o.useTranslation(),{path:n}=i.useRouteMatch(),a=t.useMemo(()=>Ql.map(n=>{const t={};for(const l in n.texts)t[l]=e(n.texts[l]);return v({},n,{texts:t})},[Ql]));return l.createElement(i.Switch,null,l.createElement(i.Route,{path:""+n,exact:!0},l.createElement(Vo,{config:a[0]})))},WSSearchResultsComponent:()=>{const{t:e}=o.useTranslation(),{path:n}=i.useRouteMatch(),a=t.useMemo(()=>zo.map(n=>{const t={};for(const l in n.texts)t[l]=e(n.texts[l]);return v({},n,{texts:t})},[zo]));return l.createElement(i.Switch,null,l.createElement(i.Route,{path:""+n,exact:!0},l.createElement(Ii,{template:a[0].labels,header:a[0].texts.header,actionButtonLabel:a[0].texts.actionButtonLabel,t:e})))},WSCitizenApplicationDetails:()=>{var e,n,r,u,d,s,c,p,E,_,g,N,y,D,h,A,I,O,b,L,R,w,W,P,M,x,B,F,k,H,V,z,Y,G,q,K,X,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn,sn,cn,vn,pn,mn,En,Sn,_n,fn,gn,Cn,Nn,yn,Dn,Tn,hn,An,In,On,bn,Ln,Rn,wn,Wn,Pn,Mn,xn,Bn,Fn,Un,kn,Hn,jn,Vn,zn,Yn,Gn,qn,Kn,Xn,Zn,$n,Jn,Qn,et,nt,tt,lt,ot,it,at,rt,ut,dt,st,ct,vt,pt,mt,Et,St,_t,ft,gt,Ct,Nt,yt,Dt,Tt,ht,At,It,Ot,bt,Lt,Rt,wt,Wt,Pt,Mt,xt,Bt,Ft,Ut,kt,Ht,jt,Vt,zt,Yt,Gt,qt,Kt,Xt,Zt,$t,Jt,Qt,el,nl,tl,ll,ol,il,al,rl,ul,dl,sl,cl,vl,pl,ml,El,Sl,_l,fl,gl,Cl,Nl,yl,Dl,Tl,hl,Al,Il,Ol,bl,Ll,Rl,wl,Wl,Pl,Ml,xl,Bl,Fl,Ul,kl,Hl,jl,Vl,zl,Yl,Gl,ql,Kl,Xl,Zl,$l,Jl,Ql,eo,no,to,lo,oo,io,ao,ro,uo,so,co,vo,po,mo,Eo,So,_o,fo,go,Co,No,yo,Do,To,ho,Ao,Io,Oo,bo,Lo,Ro,wo,Wo,Po,Mo,xo,Bo,Fo,Uo,ko,Ho,jo,Vo,zo,Yo,Go,qo,Ko,Xo,Zo,$o,Jo,Qo,ei,ni,ti,li,oi,ii,ai,ri,ui,di,si,ci,vi,pi,mi,Ei,Si,_i,fi,gi,Ci,Ni,yi,Di,Ti,hi,Ai,Ii,Oi,Ri,wi,Wi,Pi,Mi,Bi,Fi,Ui,ki,Hi,ji,Vi,zi,Yi,Gi,qi,Ki,Xi,Zi,$i,Ji,Qi,ea,na,ta,la,oa,ia,aa,ra,ua,da,sa,ca,va,pa,ma,Ea,Sa,_a,fa,ga,Ca,Na,ya,Da,Ta,ha,Aa,Ia,Oa,ba,La,Ra,wa,Wa,Pa,Ma,xa,Ba,Fa,Ua,ka,Ha,ja,Va,za;const{t:Ya}=o.useTranslation(),Ga=t.useRef(),qa=Digit.UserService.getUser(),Ka=(null===(e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===e?void 0:e.code)||(null==qa||null===(n=qa.info)||void 0===n?void 0:n.permanentCity)||Digit.ULBService.getCurrentTenantId(),[Xa,Za]=(Digit.ULBService.getStateId(),t.useState(!1)),[$a,Ja]=t.useState(!1),Qa=window.location.href.includes("SW_")?window.location.href.substring(window.location.href.indexOf("SW_")):window.location.href.substring(window.location.href.indexOf("WS_"));let er={tenantId:Ka,applicationNumber:Qa};const{isLoading:nr,data:tr}=Digit.Hooks.ws.useMyApplicationSearch({filters:er,BusinessService:null!=Qa&&Qa.includes("SW")?"SW":"WS"},{filters:er,privacy:Digit.Utils.getPrivacyObject()});Digit.Hooks.useClickOutside(Ga,()=>{Za(!1)},Xa);const lr={consumerCode:null!=Qa&&Qa.includes("DC")?(null==tr||null===(r=tr.WaterConnection)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.connectionNo)||(null==tr||null===(d=tr.SewerageConnections)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.connectionNo):(null==tr||null===(c=tr.WaterConnection)||void 0===c||null===(p=c[0])||void 0===p?void 0:p.applicationNo)||(null==tr||null===(E=tr.SewerageConnections)||void 0===E||null===(_=E[0])||void 0===_?void 0:_.applicationNo)},{data:or}=Digit.Hooks.useCommonMDMS(Ka,"common-masters","ReceiptKey",{select:e=>{var n,t,l;return(null===(n=e["common-masters"])||void 0===n||null===(t=n.uiCommonPay)||void 0===t||null===(l=t.filter(e=>{let{code:n}=e;return"WS.ONE_TIME_FEE".includes(n)})[0])||void 0===l?void 0:l.receiptKey)||"consolidatedreceipt"}}),ir=Digit.Hooks.useFetchBillsForBuissnessService(v({businessService:null!=Qa&&Qa.includes("SW")?null!=Qa&&Qa.includes("DC")?"SW":"SW.ONE_TIME_FEE":null!=Qa&&Qa.includes("DC")?"WS":"WS.ONE_TIME_FEE"},lr,{tenantId:Ka}),{enabled:!!(null!=tr&&null!==(g=tr.WaterConnection)&&void 0!==g&&null!==(N=g[0])&&void 0!==N&&N.applicationNo||null!=tr&&null!==(y=tr.SewerageConnections)&&void 0!==y&&null!==(D=y[0])&&void 0!==D&&D.applicationNo),retry:!1}),{data:ar}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:null==tr||null===(h=tr.WaterConnection)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.propertyId}},{filters:{propertyIds:null==tr||null===(I=tr.WaterConnection)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.propertyId},privacy:Digit.Utils.getPrivacyObject()}),rr=Digit.Hooks.ws.useToCheckPrivacyEnablement({privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(b=tr.WaterConnection)||void 0===b||null===(L=b[0])||void 0===L||null===(R=L.connectionHolders)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.uuid:null==tr||null===(W=tr.SewerageConnections)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.connectionHolders)||void 0===M||null===(x=M[0])||void 0===x?void 0:x.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner"}})||!1,ur="CONNECTION_ACTIVATED"===(null==tr||null===(B=tr.WaterConnection)||void 0===B||null===(F=B[0])||void 0===F?void 0:F.applicationStatus)||"PENDING_FOR_CONNECTION_ACTIVATION"===(null==tr||null===(k=tr.WaterConnection)||void 0===k||null===(H=k[0])||void 0===H?void 0:H.applicationStatus)||"CONNECTION_ACTIVATED"===(null==tr||null===(V=tr.SewerageConnections)||void 0===V||null===(z=V[0])||void 0===z?void 0:z.applicationStatus)||"PENDING_FOR_CONNECTION_ACTIVATION"===(null==tr||null===(Y=tr.SewerageConnections)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.applicationStatus);if(nr)return l.createElement(a.Loader,null);let dr=[];const sr={order:1,label:Ya("WS_ESTIMATION_NOTICE"),onClick:()=>{var e,n,t,l,o,i,a;return null!=tr&&null!==(e=tr.WaterConnection)&&void 0!==e&&e[0]?T([null==tr||null===(n=tr.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.estimationFileStoreId],Ka):T([null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.estimationFileStoreId],Ka)}},cr={order:2,label:Ya("WS_SANCTION_LETTER"),onClick:()=>{var e,n,t,l,o,i,a;return null!=tr&&null!==(e=tr.WaterConnection)&&void 0!==e&&e[0]?T([null==tr||null===(n=tr.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.sanctionFileStoreId],Ka):T([null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.additionalDetails)||void 0===a?void 0:a.sanctionFileStoreId],Ka)}},vr={order:3,label:Ya("WS_APPLICATION"),onClick:function(){try{var e,n,t,l,o,i,a;const r=(null==tr||null===(e=tr.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==tr||null===(t=tr.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId);let u=(null==tr||null===(o=tr.WaterConnection)||void 0===o?void 0:o[0])||(null==tr||null===(i=tr.SewerageConnections)||void 0===i?void 0:i[0]);return Z(v({},u),v({},null==ar||null===(a=ar.Properties)||void 0===a?void 0:a[0]),r,Ya).then(e=>Digit.Utils.pdf.generatev1(e)),Za(!1),Promise.resolve()}catch(e){return Promise.reject(e)}}},pr={order:4,label:Ya("DOWNLOAD_RECEIPT_HEADER"),onClick:function(){try{var e,n,t,l,o,i;const a=Digit.ULBService.getCurrentTenantId(),r=Digit.ULBService.getStateId();let u=null!=tr&&null!==(e=tr.WaterConnection)&&void 0!==e&&e[0]?"WS.ONE_TIME_FEE":"SW.ONE_TIME_FEE";return Promise.resolve(Digit.PaymentService.getReciept(a,u,{consumerCodes:null!=tr&&null!==(n=tr.WaterConnection)&&void 0!==n&&n[0]?null==tr||null===(t=tr.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo:null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo})).then(function(e){var n;function t(){return Promise.resolve(Digit.PaymentService.printReciept(r,{fileStoreIds:l.filestoreIds[0]})).then(function(e){window.open(e[l.filestoreIds[0]],"_blank")})}let l={filestoreIds:[null===(n=e.Payments[0])||void 0===n?void 0:n.fileStoreId]};const o=function(n){if(null===(n=e.Payments[0])||void 0===n||!n.fileStoreId)return Promise.resolve(Digit.PaymentService.generatePdf(r,{Payments:e.Payments},or)).then(function(e){l=e})}();return o&&o.then?o.then(t):t()})}catch(e){return Promise.reject(e)}}},mr=[{order:1,label:Ya("WS_APPLICATION"),onClick:function(){try{var e,n,t,l,o,i,a;const r=(null==tr||null===(e=tr.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==tr||null===(t=tr.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId);let u=(null==tr||null===(o=tr.WaterConnection)||void 0===o?void 0:o[0])||(null==tr||null===(i=tr.SewerageConnections)||void 0===i?void 0:i[0]);return xi(v({},u),v({},null==ar||null===(a=ar.Properties)||void 0===a?void 0:a[0]),r,Ya).then(e=>Digit.Utils.pdf.generatev1(e)),Za(!1),Promise.resolve()}catch(e){return Promise.reject(e)}}},{order:2,label:Ya("WS_DISCONNECTION_NOTICE_LABEL"),onClick:()=>function(){try{var e,n,t,l;let u="ws-waterdisconnectionnotice",d={};var o,i,a,r;return null!=Qa&&Qa.includes("WS")?d={WaterConnection:[v({},null==tr||null===(o=tr.WaterConnection)||void 0===o?void 0:o[0],{property:null==ar||null===(i=ar.Properties)||void 0===i?void 0:i[0]})]}:(u="ws-seweragedisconnectionnotice",d={SewerageConnection:[v({},null==tr||null===(a=tr.SewerageConnections)||void 0===a?void 0:a[0],{property:null==ar||null===(r=ar.Properties)||void 0===r?void 0:r[0]})]}),Promise.resolve(Digit.WSService.WSDisconnectionNotice((null==tr||null===(e=tr.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==tr||null===(t=tr.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId),d,u)).then(function(e){var n,t,l,o;return Promise.resolve(Digit.PaymentService.printReciept((null==tr||null===(n=tr.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.tenantId)||(null==tr||null===(l=tr.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.tenantId),{fileStoreIds:e.filestoreIds[0]})).then(function(n){window.open(n[null==e?void 0:e.filestoreIds[0]],"_blank")})})}catch(e){return Promise.reject(e)}}()}],Er=(null==tr||null===(q=tr.WaterConnection)||void 0===q||null===(K=q[0].applicationType)||void 0===K?void 0:K.includes("DISCONNECT"))||(null==tr||null===(X=tr.SewerageConnections)||void 0===X||null===($=X[0].applicationType)||void 0===$?void 0:$.includes("DISCONNECT"));switch((null==tr||null===(J=tr.WaterConnection)||void 0===J||null===(Q=J[0])||void 0===Q?void 0:Q.applicationStatus)||(null==tr||null===(ee=tr.SewerageConnections)||void 0===ee||null===(ne=ee[0])||void 0===ne?void 0:ne.applicationStatus)){case"PENDING_FOR_DOCUMENT_VERIFICATION":dr=null!=tr&&null!==(te=tr.WaterConnection)&&void 0!==te&&null!==(le=te[0].applicationType)&&void 0!==le&&le.includes("DISCONNECT")||null!=tr&&null!==(oe=tr.SewerageConnections)&&void 0!==oe&&null!==(ie=oe[0].applicationType)&&void 0!==ie&&ie.includes("DISCONNECT")?mr:dr.concat(vr);break;case"PENDING_FOR_CITIZEN_ACTION":case"PENDING_FOR_FIELD_INSPECTION":dr=dr.concat(vr);break;case"PENDING_APPROVAL_FOR_CONNECTION":case"PENDING_FOR_PAYMENT":dr=dr.concat(vr,sr);break;case"PENDING_FOR_CONNECTION_ACTIVATION":case"CONNECTION_ACTIVATED":dr=dr.concat(cr,sr,vr,pr);break;case"REJECTED":dr=dr.concat(vr);break;case"PENDING_FOR_DISCONNECTION_EXECUTION":case"DISCONNECTION_EXECUTED":case"PENDING_FOR_PAYMENT":dr=null!=tr&&null!==(ae=tr.WaterConnection)&&void 0!==ae&&null!==(re=ae[0].applicationType)&&void 0!==re&&re.includes("DISCONNECT")||null!=tr&&null!==(ue=tr.SewerageConnections)&&void 0!==ue&&null!==(de=ue[0].applicationType)&&void 0!==de&&de.includes("DISCONNECT")?mr:dr.concat(vr);break;default:dr=dr.concat(vr)}dr.sort(function(e,n){return e.order-n.order});let Sr=tr&&null!=tr&&null!==(se=tr.WaterConnection)&&void 0!==se&&se[0]?"WATER":"SEWERAGE";return sessionStorage.setItem("ApplicationNoState",Qa),l.createElement(l.Fragment,null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(a.Header,null,Ya("WS_APPLICATION_DETAILS_HEADER")),l.createElement("div",{style:{zIndex:"10",display:"flex",flexDirection:"row-reverse",alignItems:"center",marginTop:"-25px"}},dr&&dr.length>0&&l.createElement("div",{ref:Ga},l.createElement(a.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>Za(!Xa),displayOptions:Xa,options:dr})),l.createElement(a.LinkButton,{label:Ya("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"}),Ja(!0)}}))),rr&&l.createElement(j,{t:Ya}),l.createElement("div",{className:"hide-seperator"},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_MYCONNECTIONS_APPLICATION_NO"),text:(null==tr||null===(ce=tr.WaterConnection)||void 0===ce||null===(ve=ce[0])||void 0===ve?void 0:ve.applicationNo)||(null==tr||null===(pe=tr.SewerageConnections)||void 0===pe||null===(me=pe[0])||void 0===me?void 0:me.applicationNo),textStyle:{}}),((null==tr||null===(Ee=tr.WaterConnection)||void 0===Ee||null===(Se=Ee[0].applicationType)||void 0===Se?void 0:Se.includes("DISCONNECT"))||(null==tr||null===(_e=tr.SewerageConnections)||void 0===_e||null===(fe=_e[0].applicationType)||void 0===fe?void 0:fe.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_MYCONNECTIONS_CONSUMER_NO"),text:(null==tr||null===(ge=tr.WaterConnection)||void 0===ge||null===(Ce=ge[0])||void 0===Ce?void 0:Ce.connectionNo)||(null==tr||null===(Ne=tr.SewerageConnections)||void 0===Ne||null===(ye=Ne[0])||void 0===ye?void 0:ye.connectionNo),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_SERVICE_NAME_LABEL"),text:Ya("WS_APPLICATION_TYPE_"+((null==tr||null===(De=tr.WaterConnection)||void 0===De||null===(Te=De[0])||void 0===Te?void 0:Te.applicationType)||(null==tr||null===(he=tr.SewerageConnections)||void 0===he||null===(Ae=he[0])||void 0===Ae?void 0:Ae.applicationType))),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),text:null!=ir&&null!==(Ie=ir.data)&&void 0!==Ie&&null!==(Oe=Ie.Bill)&&void 0!==Oe&&null!==(be=Oe[0])&&void 0!==be&&null!==(Le=be.billDetails)&&void 0!==Le&&null!==(Re=Le[0])&&void 0!==Re&&Re.amount?"₹ "+Number(null==ir||null===(we=ir.data)||void 0===we||null===(We=we.Bill)||void 0===We||null===(Pe=We[0])||void 0===Pe||null===(Me=Pe.billDetails)||void 0===Me||null===(xe=Me[0])||void 0===xe?void 0:xe.amount).toFixed(2):Ya("₹0"),textStyle:{whiteSpace:"pre"}}),((null==tr||null===(Be=tr.WaterConnection)||void 0===Be||null===(Fe=Be[0].applicationType)||void 0===Fe?void 0:Fe.includes("DISCONNECT"))||(null==tr||null===(Ue=tr.SewerageConnections)||void 0===Ue||null===(ke=Ue[0].applicationType)||void 0===ke?void 0:ke.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_DISCONNECTION_PROPOSED_DATE"),text:null!=Qa&&Qa.includes("WS")?f(null==tr||null===(He=tr.WaterConnection)||void 0===He||null===(je=He[0])||void 0===je?void 0:je.dateEffectiveFrom):f(null==tr||null===(Ve=tr.SewerageConnections)||void 0===Ve||null===(ze=Ve[0])||void 0===ze?void 0:ze.dateEffectiveFrom),textStyle:{wordBreak:"break-word"}}),((null==tr||null===(Ye=tr.WaterConnection)||void 0===Ye||null===(Ge=Ye[0].applicationType)||void 0===Ge?void 0:Ge.includes("DISCONNECT"))||(null==tr||null===(qe=tr.SewerageConnections)||void 0===qe||null===(Ke=qe[0].applicationType)||void 0===Ke?void 0:Ke.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_DISCONNECTION_EXECUTED_DATE"),text:null!=Qa&&Qa.includes("WS")?f(null==tr||null===(Xe=tr.WaterConnection)||void 0===Xe||null===(Ze=Xe[0])||void 0===Ze?void 0:Ze.disconnectionExecutionDate):f(null==tr||null===($e=tr.SewerageConnections)||void 0===$e||null===(Je=$e[0])||void 0===Je?void 0:Je.disconnectionExecutionDate),textStyle:{wordBreak:"break-word"}}),((null==tr||null===(Qe=tr.WaterConnection)||void 0===Qe||null===(en=Qe[0].applicationType)||void 0===en?void 0:en.includes("DISCONNECT"))||(null==tr||null===(nn=tr.SewerageConnections)||void 0===nn||null===(tn=nn[0].applicationType)||void 0===tn?void 0:tn.includes("DISCONNECT")))&&l.createElement(a.Row,{className:"border-none",label:Ya("WS_DISCONNECTION_REASON"),text:null!=(null==tr||null===(ln=tr.WaterConnection)||void 0===ln||null===(on=ln[0])||void 0===on?void 0:on.disconnectionReason)?null==tr||null===(an=tr.WaterConnection)||void 0===an||null===(rn=an[0])||void 0===rn?void 0:rn.disconnectionReason:null!=(null==tr||null===(un=tr.SewerageConnections)||void 0===un||null===(dn=un[0])||void 0===dn?void 0:dn.disconnectionReason)?null==tr||null===(sn=tr.SewerageConnections)||void 0===sn||null===(cn=sn[0])||void 0===cn?void 0:cn.disconnectionReason:Ya("NA"),textStyle:{wordBreak:"break-word"}}))),(null==ir||null===(vn=ir.data)||void 0===vn||null===(pn=vn.Bill)||void 0===pn||null===(mn=pn[0])||void 0===mn||null===(En=mn.billDetails)||void 0===En||null===(Sn=En[0])||void 0===Sn?void 0:Sn.billAccountDetails.length)>0&&l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_FEE_DEATAILS_HEADER")),l.createElement(a.StatusTable,null,null==ir||null===(_n=ir.data)||void 0===_n||null===(fn=_n.Bill)||void 0===fn||null===(gn=fn[0])||void 0===gn||null===(Cn=gn.billDetails)||void 0===Cn||null===(Nn=Cn[0])||void 0===Nn?void 0:Nn.billAccountDetails.map(e=>l.createElement(a.Row,{className:"border-none",label:Ya(null==e?void 0:e.taxHeadCode),text:"₹"+Number(null==e?void 0:e.amount).toFixed(2),textStyle:{textAlign:"right"}})),l.createElement(a.Row,{className:"border-none",label:Ya("WS_TOTAL_AMOUNT_DUE"),text:"₹"+Number(ur?0:null==ir||null===(yn=ir.data)||void 0===yn||null===(Dn=yn.Bill)||void 0===Dn||null===(Tn=Dn[0])||void 0===Tn||null===(hn=Tn.billDetails)||void 0===hn||null===(An=hn[0])||void 0===An?void 0:An.amount).toFixed(2),textStyle:{textAlign:"right",fontSize:"18px",fontWeight:"700"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_COMMON_TABLE_COL_APPLICATION_STATUS"),text:ur||0==Number(null==ir||null===(In=ir.data)||void 0===In||null===(On=In.Bill)||void 0===On||null===(bn=On[0])||void 0===bn||null===(Ln=bn.billDetails)||void 0===Ln||null===(Rn=Ln[0])||void 0===Rn?void 0:Rn.amount).toFixed(2)?Ya("WS_COMMON_PAID_LABEL"):Ya("WS_COMMON_NOT_PAID"),textStyle:ur||0==Number(null==ir||null===(wn=ir.data)||void 0===wn||null===(Wn=wn.Bill)||void 0===Wn||null===(Pn=Wn[0])||void 0===Pn||null===(Mn=Pn.billDetails)||void 0===Mn||null===(xn=Mn[0])||void 0===xn?void 0:xn.amount).toFixed(2)?{textAlign:"right",color:"darkgreen"}:{textAlign:"right",color:"red"}}))),l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_PROPERTY_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_PROPERTY_ID_LABEL"),text:(null==tr||null===(Bn=tr.WaterConnection)||void 0===Bn||null===(Fn=Bn[0])||void 0===Fn?void 0:Fn.propertyId)||(null==tr||null===(Un=tr.SewerageConnections)||void 0===Un||null===(kn=Un[0])||void 0===kn?void 0:kn.propertyId),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:null==ar||null===(Hn=ar.Properties)||void 0===Hn||null===(jn=Hn[0])||void 0===jn||null===(Vn=jn.owners.sort((e,n)=>{var t,l;return(null==e||null===(t=e.additionalDetails)||void 0===t?void 0:t.ownerSequence)-(null==n||null===(l=n.additionalDetails)||void 0===l?void 0:l.ownerSequence)}))||void 0===Vn||null===(zn=Vn[0])||void 0===zn?void 0:zn.name,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_PROPERTY_ADDRESS"),text:C(null==ar||null===(Yn=ar.Properties)||void 0===Yn||null===(Gn=Yn[0])||void 0===Gn?void 0:Gn.address,Ya)||Ya("CS_NA"),textStyle:{wordBreak:"break-word"},privacy:{uuid:null==ar||null===(qn=ar.Properties)||void 0===qn||null===(Kn=qn[0])||void 0===Kn||null===(Xn=Kn.owners)||void 0===Xn||null===(Zn=Xn[0])||void 0===Zn?void 0:Zn.uuid,fieldName:["doorNo","street","landmark"],model:"Property",hide:!(null!=ar&&null!==($n=ar.Properties)&&void 0!==$n&&null!==(Jn=$n[0])&&void 0!==Jn&&Jn.address),showValue:!0,loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:Ka,propertyIds:(null==tr||null===(Qn=tr.WaterConnection)||void 0===Qn||null===(et=Qn[0])||void 0===et?void 0:et.propertyId)||(null==tr||null===(nt=tr.SewerageConnections)||void 0===nt||null===(tt=nt[0])||void 0===tt?void 0:tt.propertyId)},jsonPath:"Properties[0].address.street",isArray:!1,d:e=>(U.get(e,"Properties[0].address.doorNo")?U.get(e,"Properties[0].address.doorNo")+", ":"")+(U.get(e,"Properties[0].address.street")?U.get(e,"Properties[0].address.street")+", ":"")+(U.get(e,"Properties[0].address.landmark")?""+U.get(e,"Properties[0].address.landmark"):"")}}}),l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+((null==tr||null===(lt=tr.WaterConnection)||void 0===lt||null===(ot=lt[0])||void 0===ot?void 0:ot.propertyId)||(null==tr||null===(it=tr.SewerageConnections)||void 0===it||null===(at=it[0])||void 0===at?void 0:at.propertyId))+"&tenantId="+((null==tr||null===(rt=tr.WaterConnection)||void 0===rt||null===(ut=rt[0])||void 0===ut?void 0:ut.tenantId)||(null==tr||null===(dt=tr.SewerageConnections)||void 0===dt||null===(st=dt[0])||void 0===st?void 0:st.tenantId))},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:Ya("WS_VIEW_PROPERTY")})))),(null==tr||null===(ct=tr.WaterConnection)||void 0===ct||null===(vt=ct[0])||void 0===vt||null===(pt=vt.connectionHolders)||void 0===pt?void 0:pt.length)>0||(null==tr||null===(mt=tr.SewerageConnections)||void 0===mt||null===(Et=mt[0])||void 0===Et||null===(St=Et.connectionHolders)||void 0===St?void 0:St.length)>0?l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_MOBILE_NO_LABEL"),text:(null==tr||null===(_t=tr.WaterConnection)||void 0===_t||null===(ft=_t[0])||void 0===ft||null===(gt=ft.connectionHolders)||void 0===gt||null===(Ct=gt[0])||void 0===Ct?void 0:Ct.mobileNumber)||(null==tr||null===(Nt=tr.SewerageConnections)||void 0===Nt||null===(yt=Nt[0])||void 0===yt||null===(Dt=yt.connectionHolders)||void 0===Dt||null===(Tt=Dt[0])||void 0===Tt?void 0:Tt.mobileNumber),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(ht=tr.WaterConnection)||void 0===ht||null===(At=ht[0])||void 0===At||null===(It=At.connectionHolders)||void 0===It||null===(Ot=It[0])||void 0===Ot?void 0:Ot.uuid:null==tr||null===(bt=tr.SewerageConnections)||void 0===bt||null===(Lt=bt[0])||void 0===Lt||null===(Rt=Lt.connectionHolders)||void 0===Rt||null===(wt=Rt[0])||void 0===wt?void 0:wt.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].mobileNumber":"SewerageConnections[0].connectionHolders[0].mobileNumber",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:(null==tr||null===(Wt=tr.WaterConnection)||void 0===Wt||null===(Pt=Wt[0])||void 0===Pt||null===(Mt=Pt.connectionHolders)||void 0===Mt||null===(xt=Mt[0])||void 0===xt?void 0:xt.name)||(null==tr||null===(Bt=tr.SewerageConnections)||void 0===Bt||null===(Ft=Bt[0])||void 0===Ft||null===(Ut=Ft.connectionHolders)||void 0===Ut||null===(kt=Ut[0])||void 0===kt?void 0:kt.name),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_GENDER_LABEL"),text:Ya((null==tr||null===(Ht=tr.WaterConnection)||void 0===Ht||null===(jt=Ht[0])||void 0===jt||null===(Vt=jt.connectionHolders)||void 0===Vt||null===(zt=Vt[0])||void 0===zt?void 0:zt.gender)||(null==tr||null===(Yt=tr.SewerageConnections)||void 0===Yt||null===(Gt=Yt[0])||void 0===Gt||null===(qt=Gt.connectionHolders)||void 0===qt||null===(Kt=qt[0])||void 0===Kt?void 0:Kt.gender)),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(Xt=tr.WaterConnection)||void 0===Xt||null===(Zt=Xt[0])||void 0===Zt||null===($t=Zt.connectionHolders)||void 0===$t||null===(Jt=$t[0])||void 0===Jt?void 0:Jt.uuid:null==tr||null===(Qt=tr.SewerageConnections)||void 0===Qt||null===(el=Qt[0])||void 0===el||null===(nl=el.connectionHolders)||void 0===nl||null===(tl=nl[0])||void 0===tl?void 0:tl.uuid,fieldName:"gender",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].gender":"SewerageConnections[0].connectionHolders[0].gender",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_FATHER_OR_HUSBAND_NAME"),text:(null==tr||null===(ll=tr.WaterConnection)||void 0===ll||null===(ol=ll[0])||void 0===ol||null===(il=ol.connectionHolders)||void 0===il||null===(al=il[0])||void 0===al?void 0:al.fatherOrHusbandName)||(null==tr||null===(rl=tr.SewerageConnections)||void 0===rl||null===(ul=rl[0])||void 0===ul||null===(dl=ul.connectionHolders)||void 0===dl||null===(sl=dl[0])||void 0===sl?void 0:sl.fatherOrHusbandName)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(cl=tr.WaterConnection)||void 0===cl||null===(vl=cl[0])||void 0===vl||null===(pl=vl.connectionHolders)||void 0===pl||null===(ml=pl[0])||void 0===ml?void 0:ml.uuid:null==tr||null===(El=tr.SewerageConnections)||void 0===El||null===(Sl=El[0])||void 0===Sl||null===(_l=Sl.connectionHolders)||void 0===_l||null===(fl=_l[0])||void 0===fl?void 0:fl.uuid,fieldName:"fatherOrHusbandName",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].fatherOrHusbandName":"SewerageConnections[0].connectionHolders[0].fatherOrHusbandName",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_RELATION_LABEL"),text:(null==tr||null===(gl=tr.WaterConnection)||void 0===gl||null===(Cl=gl[0])||void 0===Cl||null===(Nl=Cl.connectionHolders)||void 0===Nl||null===(yl=Nl[0])||void 0===yl?void 0:yl.relationship)||(null==tr||null===(Dl=tr.SewerageConnections)||void 0===Dl||null===(Tl=Dl[0])||void 0===Tl||null===(hl=Tl.connectionHolders)||void 0===hl||null===(Al=hl[0])||void 0===Al?void 0:Al.relationship)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(Il=tr.WaterConnection)||void 0===Il||null===(Ol=Il[0])||void 0===Ol||null===(bl=Ol.connectionHolders)||void 0===bl||null===(Ll=bl[0])||void 0===Ll?void 0:Ll.uuid:null==tr||null===(Rl=tr.SewerageConnections)||void 0===Rl||null===(wl=Rl[0])||void 0===wl||null===(Wl=wl.connectionHolders)||void 0===Wl||null===(Pl=Wl[0])||void 0===Pl?void 0:Pl.uuid,fieldName:"relationship",model:"WnSConnection",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].relationship":"SewerageConnections[0].connectionHolders[0].relationship",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_CROSADD"),text:(null==tr||null===(Ml=tr.WaterConnection)||void 0===Ml||null===(xl=Ml[0])||void 0===xl||null===(Bl=xl.connectionHolders)||void 0===Bl||null===(Fl=Bl[0])||void 0===Fl?void 0:Fl.correspondenceAddress)||(null==tr||null===(Ul=tr.SewerageConnections)||void 0===Ul||null===(kl=Ul[0])||void 0===kl||null===(Hl=kl.connectionHolders)||void 0===Hl||null===(jl=Hl[0])||void 0===jl?void 0:jl.correspondenceAddress)||Ya("CS_NA"),privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(Vl=tr.WaterConnection)||void 0===Vl||null===(zl=Vl[0])||void 0===zl||null===(Yl=zl.connectionHolders)||void 0===Yl||null===(Gl=Yl[0])||void 0===Gl?void 0:Gl.uuid:null==tr||null===(ql=tr.SewerageConnections)||void 0===ql||null===(Kl=ql[0])||void 0===Kl||null===(Xl=Kl.connectionHolders)||void 0===Xl||null===(Zl=Xl[0])||void 0===Zl?void 0:Zl.uuid,fieldName:"correspondenceAddress",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].correspondenceAddress":"SewerageConnections[0].connectionHolders[0].correspondenceAddress",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_SPECIAL_APPLICANT_LABEL"),text:(null!=Qa&&Qa.includes("WS")?null!=tr&&null!==($l=tr.WaterConnection)&&void 0!==$l&&null!==(Jl=$l[0])&&void 0!==Jl&&null!==(Ql=Jl.connectionHolders)&&void 0!==Ql&&null!==(eo=Ql[0])&&void 0!==eo&&null!==(no=eo.ownerType)&&void 0!==no&&no.includes("*"):null!=tr&&null!==(to=tr.SewerageConnections)&&void 0!==to&&null!==(lo=to[0])&&void 0!==lo&&null!==(oo=lo.connectionHolders)&&void 0!==oo&&null!==(io=oo[0])&&void 0!==io&&null!==(ao=io.ownerType)&&void 0!==ao&&ao.includes("*"))?null!=Qa&&Qa.includes("WS")?null==tr||null===(So=tr.WaterConnection)||void 0===So||null===(_o=So[0])||void 0===_o||null===(fo=_o.connectionHolders)||void 0===fo||null===(go=fo[0])||void 0===go?void 0:go.ownerType:null==tr||null===(Co=tr.SewerageConnections)||void 0===Co||null===(No=Co[0])||void 0===No||null===(yo=No.connectionHolders)||void 0===yo||null===(Do=yo[0])||void 0===Do?void 0:Do.ownerType:Ya("COMMON_MASTERS_OWNERTYPE_"+(null!=Qa&&Qa.includes("WS")?null==tr||null===(ro=tr.WaterConnection)||void 0===ro||null===(uo=ro[0])||void 0===uo||null===(so=uo.connectionHolders)||void 0===so||null===(co=so[0])||void 0===co?void 0:co.ownerType:null==tr||null===(vo=tr.SewerageConnections)||void 0===vo||null===(po=vo[0])||void 0===po||null===(mo=po.connectionHolders)||void 0===mo||null===(Eo=mo[0])||void 0===Eo?void 0:Eo.ownerType)),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(To=tr.WaterConnection)||void 0===To||null===(ho=To[0])||void 0===ho||null===(Ao=ho.connectionHolders)||void 0===Ao||null===(Io=Ao[0])||void 0===Io?void 0:Io.uuid:null==tr||null===(Oo=tr.SewerageConnections)||void 0===Oo||null===(bo=Oo[0])||void 0===bo||null===(Lo=bo.connectionHolders)||void 0===Lo||null===(Ro=Lo[0])||void 0===Ro?void 0:Ro.uuid,fieldName:"ownerType",model:"WnSConnection",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].ownerType":"SewerageConnections[0].connectionHolders[0].ownerType",isArray:!1,d:e=>{var n,t,l,o,i,a,r,u,d,s,c;return null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n[0]?Ya("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(t=e.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.connectionHolders)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.ownerType)||void 0===a?void 0:a.toUpperCase())):Ya("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(r=e.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.ownerType)||void 0===c?void 0:c.toUpperCase()))}}}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_OWN_DETAIL_EMAIL_ID_LABEL"),text:(null==tr||null===(wo=tr.WaterConnection)||void 0===wo||null===(Wo=wo[0])||void 0===Wo||null===(Po=Wo.connectionHolders)||void 0===Po||null===(Mo=Po[0])||void 0===Mo?void 0:Mo.emailId)||(null==tr||null===(xo=tr.SewerageConnections)||void 0===xo||null===(Bo=xo[0])||void 0===Bo||null===(Fo=Bo.connectionHolders)||void 0===Fo||null===(Uo=Fo[0])||void 0===Uo?void 0:Uo.emailId)||"NA",textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=Qa&&Qa.includes("WS")?null==tr||null===(ko=tr.WaterConnection)||void 0===ko||null===(Ho=ko[0])||void 0===Ho||null===(jo=Ho.connectionHolders)||void 0===jo||null===(Vo=jo[0])||void 0===Vo?void 0:Vo.uuid:null==tr||null===(zo=tr.SewerageConnections)||void 0===zo||null===(Yo=zo[0])||void 0===Yo||null===(Go=Yo.connectionHolders)||void 0===Go||null===(qo=Go[0])||void 0===qo?void 0:qo.uuid,fieldName:"connectionHoldersEmailId",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===Sr?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Ka,applicationNumber:Qa},jsonPath:"WATER"===Sr?"WaterConnection[0].connectionHolders[0].emailId":"SewerageConnections[0].connectionHolders[0].emailId",isArray:!1}}}))):l.createElement("div",null,l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,Ya("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),l.createElement(a.CardText,null,Ya("WS_SAME_AS_PROPERTY_OWNERS")))),Er?null:l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_CONNECTION_DETAIL")),(null==tr?void 0:tr.WaterConnection)&&(null==tr||null===(Ko=tr.WaterConnection)||void 0===Ko?void 0:Ko.length)>0&&l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_TASK_DETAILS_CONN_DETAIL_NO_OF_TAPS_PROPOSED"),text:(null==tr||null===(Xo=tr.WaterConnection)||void 0===Xo||null===(Zo=Xo[0])||void 0===Zo?void 0:Zo.proposedTaps)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_SERV_DETAIL_PIPE_SIZE"),text:(null==tr||null===($o=tr.WaterConnection)||void 0===$o||null===(Jo=$o[0])||void 0===Jo?void 0:Jo.proposedPipeSize)+" "+Ya("WS_INCHES_LABEL")||Ya("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(i.Link,{to:"/digit-ui/citizen/ws/connection/additional/"+(null==tr||null===(Qo=tr.WaterConnection)||void 0===Qo||null===(ei=Qo[0])||void 0===ei?void 0:ei.applicationNo)},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:Ya("WS_ADDITIONAL_DETAILS")}))),(null==tr?void 0:tr.SewerageConnections)&&(null==tr||null===(ni=tr.SewerageConnections)||void 0===ni?void 0:ni.length)>0&&l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:Ya("WS_NO_OF_WATER_CLOSETS_LABEL"),text:null==tr||null===(ti=tr.SewerageConnections)||void 0===ti||null===(li=ti[0])||void 0===li?void 0:li.proposedWaterClosets,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:Ya("WS_SERV_DETAIL_NO_OF_TOILETS"),text:(null==tr||null===(oi=tr.SewerageConnections)||void 0===oi||null===(ii=oi[0])||void 0===ii?void 0:ii.proposedToilets)||Ya("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(i.Link,{to:"/digit-ui/citizen/ws/connection/additional/"+(null==tr||null===(ai=tr.SewerageConnections)||void 0===ai||null===(ri=ai[0])||void 0===ri?void 0:ri.applicationNo)},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:Ya("WS_ADDITIONAL_DETAILS")})))),l.createElement(a.Card,null,l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},Ya("WS_COMMON_DOCUMENT_DETAILS")),(null==tr||null===(ui=tr.WaterConnection)||void 0===ui||null===(di=ui[0])||void 0===di?void 0:di.documents)&&(null==tr||null===(si=tr.WaterConnection)||void 0===si||null===(ci=si[0])||void 0===ci?void 0:ci.documents.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:"doc-"+n},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,Ya(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:null==tr||null===(o=tr.WaterConnection)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.documents,Code:null==e?void 0:e.documentType,index:n}),(null==tr||null===(r=tr.WaterConnection)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.documents.length)!=n+1?l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))})),(null==tr||null===(vi=tr.SewerageConnections)||void 0===vi||null===(pi=vi[0])||void 0===pi?void 0:pi.documents)&&(null==tr||null===(mi=tr.SewerageConnections)||void 0===mi||null===(Ei=mi[0])||void 0===Ei?void 0:Ei.documents.map((e,n)=>{var t,o,i,r,u;return l.createElement("div",{key:"doc-"+n},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,Ya(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:null==tr||null===(o=tr.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.documents,Code:null==e?void 0:e.documentType,index:n}),(null==tr||null===(r=tr.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.documents.length)!=n+1?l.createElement("hr",{style:{color:"white",backgroundColor:"white",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))}))),l.createElement(a.Card,null,l.createElement("div",{id:"timeline"},l.createElement(bi,{application:(null==tr||null===(Si=tr.WaterConnection)||void 0===Si?void 0:Si[0])||(null==tr||null===(_i=tr.SewerageConnections)||void 0===_i?void 0:_i[0]),id:(null==tr||null===(fi=tr.WaterConnection)||void 0===fi||null===(gi=fi[0])||void 0===gi?void 0:gi.applicationNo)||(null==tr||null===(Ci=tr.SewerageConnections)||void 0===Ci||null===(Ni=Ci[0])||void 0===Ni?void 0:Ni.applicationNo),paymentbuttonenabled:!1})),"PENDING_FOR_PAYMENT"===(null==tr||null===(yi=tr.WaterConnection)||void 0===yi||null===(Di=yi[0])||void 0===Di?void 0:Di.applicationStatus)||"PENDING_FOR_PAYMENT"===(null==tr||null===(Ti=tr.SewerageConnections)||void 0===Ti||null===(hi=Ti[0])||void 0===hi?void 0:hi.applicationStatus)?l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/payment/my-bills/"+(null==ir||null===(Ai=ir.data)||void 0===Ai||null===(Ii=Ai.Bill)||void 0===Ii||null===(Oi=Ii[0])||void 0===Oi?void 0:Oi.businessService)+"/"+(null!=Qa&&Qa.includes("DC")?m(null==tr||null===(Ri=tr.WaterConnection)||void 0===Ri||null===(wi=Ri[0])||void 0===wi?void 0:wi.connectionNo,"/","+")||m(null==tr||null===(Wi=tr.SewerageConnections)||void 0===Wi||null===(Pi=Wi[0])||void 0===Pi?void 0:Pi.connectionNo,"/","+"):m(null==tr||null===(Mi=tr.WaterConnection)||void 0===Mi||null===(Bi=Mi[0])||void 0===Bi?void 0:Bi.applicationNo,"/","+")||m(null==tr||null===(Fi=tr.SewerageConnections)||void 0===Fi||null===(Ui=Fi[0])||void 0===Ui?void 0:Ui.applicationNo,"/","+"))+"?workflow=WNS&tenantId="+((null==tr||null===(ki=tr.WaterConnection)||void 0===ki||null===(Hi=ki[0])||void 0===Hi?void 0:Hi.tenantId)||(null==tr||null===(ji=tr.SewerageConnections)||void 0===ji||null===(Vi=ji[0])||void 0===Vi?void 0:Vi.tenantId))+"&ConsumerName="+((null==tr||null===(zi=tr.WaterConnection)||void 0===zi||null===(Yi=zi[0])||void 0===Yi||null===(Gi=Yi.connectionHolders)||void 0===Gi?void 0:Gi.map(e=>e.name).join(","))||(null==tr||null===(qi=tr.SewerageConnections)||void 0===qi||null===(Ki=qi[0])||void 0===Ki||null===(Xi=Ki.connectionHolders)||void 0===Xi?void 0:Xi.map(e=>e.name).join(","))||(null==ar||null===(Zi=ar.Properties)||void 0===Zi||null===($i=Zi[0])||void 0===$i||null===(Ji=$i.owners)||void 0===Ji?void 0:Ji.map(e=>e.name).join(",")))+"&isDisoconnectFlow="+!(null==Qa||!Qa.includes("DC")),state:{}}},l.createElement(a.SubmitBar,{label:Ya("MAKE_PAYMENT")})):null,(null==tr||null===(Qi=tr.WaterConnection)||void 0===Qi||null===(ea=Qi[0])||void 0===ea||!ea.applicationType.includes("DISCONNECT"))&&null!=tr&&null!==(na=tr.WaterConnection)&&void 0!==na&&null!==(ta=na[0])&&void 0!==ta&&ta.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")||(null==tr||null===(la=tr.SewerageConnections)||void 0===la||null===(oa=la[0])||void 0===oa||!oa.applicationType.includes("DISCONNECT"))&&null!=tr&&null!==(ia=tr.SewerageConnections)&&void 0!==ia&&null!==(aa=ia[0])&&void 0!==aa&&aa.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")?l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/ws/edit-application/"+((null==tr||null===(ra=tr.WaterConnection)||void 0===ra||null===(ua=ra[0])||void 0===ua?void 0:ua.tenantId)||(null==tr||null===(da=tr.SewerageConnections)||void 0===da||null===(sa=da[0])||void 0===sa?void 0:sa.tenantId)),state:{id:""+((null==tr||null===(ca=tr.WaterConnection)||void 0===ca||null===(va=ca[0])||void 0===va?void 0:va.applicationNo)||(null==tr||null===(pa=tr.SewerageConnections)||void 0===pa||null===(ma=pa[0])||void 0===ma?void 0:ma.applicationNo))}}},l.createElement(a.SubmitBar,{label:Ya("COMMON_EDIT")})):null,null!=tr&&null!==(Ea=tr.WaterConnection)&&void 0!==Ea&&null!==(Sa=Ea[0])&&void 0!==Sa&&Sa.applicationType.includes("DISCONNECT")&&null!=tr&&null!==(_a=tr.WaterConnection)&&void 0!==_a&&null!==(fa=_a[0])&&void 0!==fa&&fa.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")||null!=tr&&null!==(ga=tr.SewerageConnections)&&void 0!==ga&&null!==(Ca=ga[0])&&void 0!==Ca&&Ca.applicationType.includes("DISCONNECT")&&null!=tr&&null!==(Na=tr.SewerageConnections)&&void 0!==Na&&null!==(ya=Na[0])&&void 0!==ya&&ya.applicationStatus.includes("PENDING_FOR_CITIZEN_ACTION")?l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen/ws/resubmit-disconnect-application",state:{id:""+((null==tr||null===(Da=tr.WaterConnection)||void 0===Da||null===(Ta=Da[0])||void 0===Ta?void 0:Ta.applicationNo)||(null==tr||null===(ha=tr.SewerageConnections)||void 0===ha||null===(Aa=ha[0])||void 0===Aa?void 0:Aa.applicationNo))}}},l.createElement(a.SubmitBar,{label:Ya("RESUBMIT_APPLICATION"),onSubmit:Digit.SessionStorage.set("WS_DISCONNECTION",null!=Qa&&Qa.includes("SW")?{applicationData:null==tr||null===(Ia=tr.SewerageConnections)||void 0===Ia?void 0:Ia[0],serviceType:"SEWERAGE",WSDisconnectionForm:{type:null!=tr&&null!==(Oa=tr.SewerageConnections)&&void 0!==Oa&&null!==(ba=Oa[0])&&void 0!==ba&&ba.isDisconnectionTemporary?{code:"type",value:{name:"Temporary",i18nKey:"WS_DISCONNECTIONTYPE_TEMPORARY",active:!0,code:"Temporary"}}:{code:"type",value:{name:"Permanent",i18nKey:"WS_DISCONNECTIONTYPE_PERMANENT",active:!0,code:"Permanent"}},date:S(null==tr||null===(La=tr.SewerageConnections)||void 0===La||null===(Ra=La[0])||void 0===Ra?void 0:Ra.dateEffectiveFrom,!0),reason:{code:"reason",value:null==tr||null===(wa=tr.SewerageConnections)||void 0===wa||null===(Wa=wa[0])||void 0===Wa?void 0:Wa.disconnectionReason},documents:null==tr||null===(Pa=tr.SewerageConnections)||void 0===Pa||null===(Ma=Pa[0])||void 0===Ma?void 0:Ma.documents}}:{applicationData:null==tr||null===(xa=tr.WaterConnection)||void 0===xa?void 0:xa[0],serviceType:"WATER",WSDisconnectionForm:{type:null!=tr&&null!==(Ba=tr.WaterConnection)&&void 0!==Ba&&null!==(Fa=Ba[0])&&void 0!==Fa&&Fa.isDisconnectionTemporary?{code:"type",value:{name:"Temporary",i18nKey:"WS_DISCONNECTIONTYPE_TEMPORARY",active:!0,code:"Temporary"}}:{code:"type",value:{name:"Permanent",i18nKey:"WS_DISCONNECTIONTYPE_PERMANENT",active:!0,code:"Permanent"}},date:S(null==tr||null===(Ua=tr.WaterConnection)||void 0===Ua||null===(ka=Ua[0])||void 0===ka?void 0:ka.dateEffectiveFrom,!0),reason:{code:"reason",value:null==tr||null===(Ha=tr.WaterConnection)||void 0===Ha||null===(ja=Ha[0])||void 0===ja?void 0:ja.disconnectionReason},documents:null==tr||null===(Va=tr.WaterConnection)||void 0===Va||null===(za=Va[0])||void 0===za?void 0:za.documents}})})):null)))},WSAdditionalDetails:()=>{var e,n,t,i,r,u,d,s,c,v,p,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn;const{t:sn}=o.useTranslation(),cn=Digit.UserService.getUser(),vn=Digit.ULBService.getCurrentTenantId()||(null==cn||null===(e=cn.info)||void 0===e?void 0:e.permanentCity),pn=window.location.href.includes("SW_")?window.location.href.substring(window.location.href.indexOf("SW_")):window.location.href.substring(window.location.href.indexOf("WS_"));let mn={tenantId:vn,applicationNumber:pn};const{isLoading:En,data:Sn}=Digit.Hooks.ws.useMyApplicationSearch({filters:mn,BusinessService:null!=pn&&pn.includes("SW")?"SW":"WS"},{filters:mn});return En?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,null,sn("WS_COMMON_ADDN_DETAILS")),l.createElement("div",{className:"hide-seperator"},l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_COMMON_CONNECTION_DETAIL")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_COMMON_TABLE_COL_CONNECTIONTYPE_LABEL"),text:(null==Sn||null===(n=Sn.WaterConnection)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.connectionType)||(null==Sn||null===(i=Sn.SewerageConnections)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.connectionType)||sn("NA"),textStyle:{whiteSpace:"pre"}}),(null==Sn?void 0:Sn.WaterConnection)&&(null==Sn||null===(u=Sn.WaterConnection)||void 0===u?void 0:u.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_NO_OF_TAPS"),text:(null==Sn||null===(d=Sn.WaterConnection)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.noOfTaps)||(null==Sn||null===(c=Sn.SewerageConnections)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.noOfTaps)||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_PIPE_SIZE_IN_INCHES_LABEL"),text:(null==Sn||null===(p=Sn.WaterConnection)||void 0===p||null===(E=p[0])||void 0===E?void 0:E.pipeSize)||(null==Sn||null===(S=Sn.SewerageConnections)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.pipeSize)||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_WATER_SOURCE"),text:sn("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==Sn||null===(f=Sn.WaterConnection)||void 0===f||null===(g=f[0])||void 0===g||null===(C=g.waterSource)||void 0===C||null===(N=C.split("."))||void 0===N?void 0:N[0],".","_"))||sn("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null==Sn||null===(y=Sn.SewerageConnections)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.waterSource,".","_"))||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_WATER_SUB_SOURCE"),text:sn(null==Sn||null===(T=Sn.WaterConnection)||void 0===T||null===(h=T[0])||void 0===h||null===(A=h.waterSource)||void 0===A||null===(I=A.split("."))||void 0===I?void 0:I[1])||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}))),(null==Sn?void 0:Sn.SewerageConnections)&&(null==Sn||null===(O=Sn.SewerageConnections)||void 0===O?void 0:O.length)>0&&l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_NUMBER_WATER_CLOSETS_LABEL"),text:null==Sn||null===(b=Sn.SewerageConnections)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.proposedWaterClosets,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_NO_OF_TOILETS"),text:(null==Sn||null===(R=Sn.SewerageConnections)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.proposedToilets)||sn("CS_NA"),textStyle:{whiteSpace:"pre"}}))),l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_COMMON_PLUMBER_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_PLUMBER_PROVIDED_BY"),text:("ULB"===(null==Sn||null===(W=Sn.WaterConnection)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.additionalDetails)||void 0===M?void 0:M.detailsProvidedBy)?sn("WS_PLUMBER_ULB"):sn("WS_PLUMBER_SELF"))||("ULB"===(null==Sn||null===(x=Sn.SewerageConnections)||void 0===x||null===(B=x[0])||void 0===B||null===(F=B.additionalDetails)||void 0===F?void 0:F.detailsProvidedBy)?sn("WS_PLUMBER_ULB"):sn("WS_PLUMBER_SELF"))||sn("NA"),textStyle:{whiteSpace:"pre"}}),("ULB"===(null==Sn||null===(U=Sn.WaterConnection)||void 0===U||null===(k=U[0])||void 0===k||null===(H=k.additionalDetails)||void 0===H?void 0:H.detailsProvidedBy)||"ULB"===(null==Sn||null===(j=Sn.SewerageConnections)||void 0===j||null===(V=j[0])||void 0===V||null===(z=V.additionalDetails)||void 0===z?void 0:z.detailsProvidedBy))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:sn("WS_PLUMBER_LIC_NO"),text:(null==Sn||null===(Y=Sn.WaterConnection)||void 0===Y||null===(G=Y[0])||void 0===G||null===(q=G.plumberInfo)||void 0===q||null===(K=q[0])||void 0===K?void 0:K.licenseNo)||(null==Sn||null===(X=Sn.SewerageConnections)||void 0===X||null===(Z=X[0])||void 0===Z||null===($=Z.plumberInfo)||void 0===$?void 0:$.licenseNo)||sn("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_PLUMBER_NAME_LABEL"),text:(null==Sn||null===(J=Sn.WaterConnection)||void 0===J||null===(Q=J[0])||void 0===Q||null===(ee=Q.plumberInfo)||void 0===ee||null===(ne=ee[0])||void 0===ne?void 0:ne.name)||(null==Sn||null===(te=Sn.SewerageConnections)||void 0===te||null===(le=te[0])||void 0===le||null===(oe=le.plumberInfo)||void 0===oe?void 0:oe.name)||"NA",textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_PLUMBER_MOB_NO"),text:(null==Sn||null===(ie=Sn.WaterConnection)||void 0===ie||null===(ae=ie[0])||void 0===ae||null===(re=ae.plumberInfo)||void 0===re||null===(ue=re[0])||void 0===ue?void 0:ue.mobileNumber)||(null==Sn||null===(de=Sn.SewerageConnections)||void 0===de||null===(se=de[0])||void 0===se||null===(ce=se.plumberInfo)||void 0===ce?void 0:ce.mobileNumber)||"NA",textStyle:{whiteSpace:"pre"},privacy:{uuid:pn,fieldName:["plumberInfoMobileNumber"],model:"WnSConnectionPlumber",showValue:!1,loadData:{serviceName:null!=pn&&pn.includes("WS")?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:vn,applicationNumber:pn},jsonPath:null!=pn&&pn.includes("WS")?"WaterConnection[0].plumberInfo[0].mobileNumber":"SewerageConnections[0].plumberInfo[0].mobileNumber",isArray:!1}}})))),l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_ROAD_CUTTING_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAIL_ROAD_TYPE"),text:null!=Sn&&null!==(ve=Sn.WaterConnection)&&void 0!==ve&&null!==(pe=ve[0])&&void 0!==pe&&null!==(me=pe.roadCuttingInfo)&&void 0!==me&&null!==(Ee=me[0])&&void 0!==Ee&&Ee.roadType||null!=Sn&&null!==(Se=Sn.SewerageConnections)&&void 0!==Se&&null!==(_e=Se[0])&&void 0!==_e&&null!==(fe=_e.roadCuttingInfo)&&void 0!==fe&&null!==(ge=fe[0])&&void 0!==ge&&ge.roadType?sn("WS_ROADTYPE_"+((null==Sn||null===(Ce=Sn.WaterConnection)||void 0===Ce||null===(Ne=Ce[0])||void 0===Ne||null===(ye=Ne.roadCuttingInfo)||void 0===ye||null===(De=ye[0])||void 0===De?void 0:De.roadType)||(null==Sn||null===(Te=Sn.SewerageConnections)||void 0===Te||null===(he=Te[0])||void 0===he||null===(Ae=he.roadCuttingInfo)||void 0===Ae||null===(Ie=Ae[0])||void 0===Ie?void 0:Ie.roadType))):sn("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_AREA_LABEL"),text:(null==Sn||null===(Oe=Sn.WaterConnection)||void 0===Oe||null===(be=Oe[0])||void 0===be||null===(Le=be.roadCuttingInfo)||void 0===Le||null===(Re=Le[0])||void 0===Re?void 0:Re.roadCuttingArea)||(null==Sn||null===(we=Sn.SewerageConnections)||void 0===we||null===(We=we[0])||void 0===We||null===(Pe=We.roadCuttingInfo)||void 0===Pe||null===(Me=Pe[0])||void 0===Me?void 0:Me.roadCuttingArea)||sn("NA"),textStyle:{whiteSpace:"pre"}}))),l.createElement(a.Card,null,l.createElement(a.CardSubHeader,null,sn("WS_ACTIVATION_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),text:null!=Sn&&null!==(xe=Sn.WaterConnection)&&void 0!==xe&&null!==(Be=xe[0])&&void 0!==Be&&Be.connectionExecutionDate||null!=Sn&&null!==(Fe=Sn.SewerageConnections)&&void 0!==Fe&&null!==(Ue=Fe[0])&&void 0!==Ue&&Ue.connectionExecutionDate?Digit.DateUtils.ConvertEpochToDate((null==Sn||null===(ke=Sn.WaterConnection)||void 0===ke||null===(He=ke[0])||void 0===He?void 0:He.connectionExecutionDate)||(null==Sn||null===(je=Sn.SewerageConnections)||void 0===je||null===(Ve=je[0])||void 0===Ve?void 0:Ve.connectionExecutionDate)):sn("NA"),textStyle:{whiteSpace:"pre"}}),(null==Sn?void 0:Sn.WaterConnection)&&(null==Sn||null===(ze=Sn.WaterConnection)||void 0===ze?void 0:ze.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:sn("WS_SERV_DETAIL_METER_ID"),text:(null==Sn||null===(Ye=Sn.WaterConnection)||void 0===Ye||null===(Ge=Ye[0])||void 0===Ge?void 0:Ge.meterId)||(null==Sn||null===(qe=Sn.SewerageConnections)||void 0===qe||null===(Ke=qe[0])||void 0===Ke?void 0:Ke.meterId)||sn("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAIL_METER_INSTALL_DATE"),text:null!=Sn&&null!==(Xe=Sn.WaterConnection)&&void 0!==Xe&&null!==(Ze=Xe[0])&&void 0!==Ze&&Ze.meterInstallationDate||null!=Sn&&null!==($e=Sn.SewerageConnections)&&void 0!==$e&&null!==(Je=$e[0])&&void 0!==Je&&Je.meterInstallationDate?Digit.DateUtils.ConvertEpochToDate((null==Sn||null===(Qe=Sn.WaterConnection)||void 0===Qe||null===(en=Qe[0])||void 0===en?void 0:en.meterInstallationDate)||(null==Sn||null===(nn=Sn.SewerageConnections)||void 0===nn||null===(tn=nn[0])||void 0===tn?void 0:tn.meterInstallationDate)):sn("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:sn("WS_ADDN_DETAILS_INITIAL_METER_READING"),text:(null==Sn||null===(ln=Sn.WaterConnection)||void 0===ln||null===(on=ln[0])||void 0===on||null===(an=on.additionalDetails)||void 0===an?void 0:an.initialMeterReading)||(null==Sn||null===(rn=Sn.SewerageConnections)||void 0===rn||null===(un=rn[0])||void 0===un||null===(dn=un.additionalDetails)||void 0===dn?void 0:dn.initialMeterReading)||"NA",textStyle:{whiteSpace:"pre"}}))))))},WSMyConnections:e=>{var n,t,i,r,u,d,s,c;const{t:p}=o.useTranslation(),m=Digit.UserService.getUser(),E=(null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code)||(null==m||null===(t=m.info)||void 0===t?void 0:t.permanentCity)||Digit.ULBService.getCurrentTenantId();let S=window.location.href.split("/").pop(),_=isNaN(parseInt(S))?{tenantId:E,mobileNumber:null==m||null===(r=m.info)||void 0===r?void 0:r.mobileNumber,searchType:"CONNECTION"}:{tenantId:E,mobileNumber:null==m||null===(i=m.info)||void 0===i?void 0:i.mobileNumber,searchType:"CONNECTION"};const{isLoading:f,data:g}=Digit.Hooks.ws.useMyApplicationSearch({filters:_},{filters:_}),{isLoading:C,data:N}=Digit.Hooks.ws.useMyApplicationSearch({filters:_,BusinessService:"SW"},{filters:_});let y=null==g?void 0:g.WaterConnection.concat(null==N?void 0:N.SewerageConnections),D=g&&(null==g||null===(u=g.WaterConnection)||void 0===u?void 0:u.map(e=>null==e?void 0:e.propertyId).join(","))||"",T=N&&(null==N||null===(d=N.SewerageConnections)||void 0===d?void 0:d.map(e=>null==e?void 0:e.propertyId).join(","))||"",h=D.concat(T);const{isLoading:A,data:I}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:h}},{filters:{propertyIds:h},enabled:!!h});return y=y&&y.map(e=>{var n;return v({},e,{property:null==I||null===(n=I.Properties)||void 0===n?void 0:n.filter(n=>(null==n?void 0:n.propertyId)===(null==e?void 0:e.propertyId))[0]})}),f||A||C?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,null,p("WS_MYCONNECTIONS_HEADER")+" "+(y?"("+y.length+")":"")),l.createElement(j,{t:p}),l.createElement("div",null,(null===(s=y)||void 0===s?void 0:s.length)>0&&y.map((e,n)=>l.createElement("div",{key:n},l.createElement(Yi,{application:e}))),!(null!==(c=y)&&void 0!==c&&c.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},p("PT_NO_APPLICATION_FOUND_MSG"))))},WSCitizenConnectionDetails:()=>{var e,n,r,u,d,s,c,p,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,k,H,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn,sn,cn,vn,pn,mn,En,Sn,_n,fn,gn,Cn,Nn,yn,Dn,Tn,hn,An,In,On,bn,Ln,Rn,wn,Wn,Pn,Mn,xn,Bn,Fn,Un,kn,Hn,jn,Vn,zn,Yn,Gn,qn,Kn,Xn,Zn,$n,Jn,Qn,et,nt,tt,lt,ot,it,at,rt,ut,dt,st,ct,vt,pt,mt,Et,St,_t,ft,gt,Ct,Nt,yt,Dt,Tt,ht,At,It,Ot,bt,Lt,Rt,wt,Wt,Pt,Mt,xt,Bt,Ft,Ut,kt,Ht,jt,Vt,zt,Yt,Gt,qt,Kt,Xt,Zt,$t,Jt,Qt,el,nl,tl,ll,ol,il,al,rl,ul,dl,sl,cl;const{t:vl}=o.useTranslation(),pl=t.useRef(),ml=Digit.UserService.getUser(),El=i.useHistory(),Sl=(null===(e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===e?void 0:e.code)||(null==ml||null===(n=ml.info)||void 0===n?void 0:n.permanentCity)||Digit.ULBService.getCurrentTenantId(),[_l,fl]=t.useState(!1),gl=window.location.href.includes("SW_")?window.location.href.substring(window.location.href.indexOf("SW_")):window.location.href.substring(window.location.href.indexOf("WS_"));let{state:Cl={}}=i.useLocation();const[Nl,yl]=t.useState(!1),[Dl,Tl]=t.useState(null),hl=Digit.Utils.browser.isMobile();let Al={tenantId:Sl,applicationNumber:gl};var{isLoading:Il,data:Ol}=Digit.Hooks.ws.useMyApplicationSearch({filters:Al,BusinessService:null!=gl&&gl.includes("SW")?"SW":"WS"},{filters:Al,privacy:Digit.Utils.getPrivacyObject()},!0);let bl={tenantId:Sl,connectionNumber:null!=gl&&gl.includes("SW")?null==Ol||null===(r=Ol.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.connectionNo:null==Ol||null===(d=Ol.WaterConnection)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.connectionNo};var{data:Ll}=Digit.Hooks.ws.useMyApplicationSearch({filters:bl,BusinessService:null!=gl&&gl.includes("SW")?"SW":"WS"},{filters:bl,privacy:Digit.Utils.getPrivacyObject(),enabled:!(null==bl||!bl.connectionNumber)},!0);Cl=(null===(c=Object.keys(Cl))||void 0===c?void 0:c.length)>0?Cl:null!=gl&&gl.includes("WS")?null==Ll||null===(p=Ll.WaterConnection)||void 0===p?void 0:p[0]:null==Ll||null===(E=Ll.SewerageConnections)||void 0===E?void 0:E[0],Digit.Hooks.useClickOutside(pl,()=>{fl(!1)},_l);const{isLoading:Rl,data:wl}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:null==Ol||null===(S=Ol.WaterConnection)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.propertyId}},{filters:{propertyIds:null==Ol||null===(f=Ol.WaterConnection)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.propertyId},privacy:Digit.Utils.getPrivacyObject()}),Wl=Digit.Hooks.ws.useToCheckPrivacyEnablement({privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(C=Ol.WaterConnection)||void 0===C||null===(N=C[0])||void 0===N||null===(y=N.connectionHolders)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.uuid:null==Ol||null===(T=Ol.SewerageConnections)||void 0===T||null===(h=T[0])||void 0===h||null===(A=h.connectionHolders)||void 0===A||null===(I=A[0])||void 0===I?void 0:I.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner"}})||!1,Pl=()=>{Tl(null)};let Ml=null!=gl&&gl.includes("WS")?null==Ll?void 0:Ll.WaterConnection:null==Ll?void 0:Ll.SewerageConnections,xl=!1;if((null==Ml?void 0:Ml.length)>0){const e=null==Ml?void 0:Ml.filter(e=>"DISCONNECTION_EXECUTED"==(null==e?void 0:e.applicationStatus)&&(null==e?void 0:e.applicationType.includes("DISCONNECT")));null!=e&&e.length&&(xl=!0)}Digit.Hooks.useCommonMDMS(Sl,"common-masters","ReceiptKey",{select:e=>{var n,t,l;return(null===(n=e["common-masters"])||void 0===n||null===(t=n.uiCommonPay)||void 0===t||null===(l=t.filter(e=>{let{code:n}=e;return"WS".includes(n)})[0])||void 0===l?void 0:l.receiptKey)||"consolidatedreceipt"}});let Bl=[];Bl.push({order:1,label:vl("WS_CONNECTION_DETAILS"),onClick:()=>function(){try{var e,n,t,l,o,i,a;const r=(null==Ol||null===(e=Ol.WaterConnection)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.tenantId)||(null==Ol||null===(t=Ol.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.tenantId);let u=(null==Ol||null===(o=Ol.WaterConnection)||void 0===o?void 0:o[0])||(null==Ol||null===(i=Ol.SewerageConnections)||void 0===i?void 0:i[0]);return Hi(v({},u),v({},null==wl||null===(a=wl.Properties)||void 0===a?void 0:a[0]),r,vl).then(e=>Digit.Utils.pdf.generatev1(e)),fl(!1),Promise.resolve()}catch(e){return Promise.reject(e)}}()}),vl("WS_APPLICATION"),vl("WS_RECEIPT_APPLICATION_FEE"),Bl.sort(function(e,n){return e.order-n.order});const Fl=null===(O=Cl)||void 0===O||null===(b=O.applicationNo)||void 0===b?void 0:b.includes("SW"),Ul={consumerCode:null===(L=Cl)||void 0===L?void 0:L.connectionNo},kl=Digit.Hooks.useFetchBillsForBuissnessService(v({businessService:Fl?"SW":"WS"},Ul,{tenantId:Sl}),{retry:!1}),Hl=()=>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"})),jl=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Vl=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(Hl,null));if(Il||Rl)return l.createElement(a.Loader,null);sessionStorage.setItem("ApplicationNoState",null===(R=Cl)||void 0===R?void 0:R.applicationNo);let zl=null!==(w=Cl)&&void 0!==w&&null!==(W=w.applicationType)&&void 0!==W&&W.includes("WATER")?"WATER":"SEWERAGE";return l.createElement(l.Fragment,null,l.createElement("div",{className:"cardHeaderWithOptions",style:{marginRight:"auto",maxWidth:"960px"}},l.createElement(a.Header,null,vl("WS_COMMON_CONNECTION_DETAIL")),Bl&&Bl.length>0&&l.createElement("div",{ref:pl},l.createElement(a.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>fl(!_l),displayOptions:_l,options:Bl,optionsStyle:{margin:"0px"}}))),Wl&&l.createElement(j,{t:vl}),l.createElement("div",{className:"hide-seperator"},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:vl("WS_MYCONNECTIONS_CONSUMER_NO"),text:null===(P=Cl)||void 0===P?void 0:P.connectionNo}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERVICE_NAME_LABEL"),text:vl("WS_APPLICATION_TYPE_"+(null===(M=Cl)||void 0===M?void 0:M.applicationType)),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_STATUS"),text:(null===(x=Cl)||void 0===x?void 0:x.status)||"NA",textStyle:{whiteSpace:"pre"}})),l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},vl("WS_COMMON_CONNECTION_DETAIL")),l.createElement(a.StatusTable,null,(null===(B=Cl)||void 0===B||null===(F=B.applicationType)||void 0===F?void 0:F.includes("WATER"))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:vl("WS_COMMON_TABLE_COL_CONNECTIONTYPE_LABEL"),text:(null===(k=Cl)||void 0===k?void 0:k.connectionType)||vl("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_NO_OF_TAPS"),text:null===(H=Cl)||void 0===H?void 0:H.noOfTaps,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_PIPE_SIZE_IN_INCHES_LABEL"),text:(null===(V=Cl)||void 0===V?void 0:V.pipeSize)||"NA",textStyle:{whiteSpace:"pre"}})),(null===(z=Cl)||void 0===z||null===(Y=z.applicationType)||void 0===Y?void 0:Y.includes("SEWERAGE"))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:vl("WS_CONN_DETAIL_WATER_CLOSETS"),text:null===(G=Cl)||void 0===G?void 0:G.proposedWaterClosets,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_NO_OF_TOILETS"),text:(null===(q=Cl)||void 0===q?void 0:q.proposedToilets)||vl("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),text:null!==(K=Cl)&&void 0!==K&&K.connectionExecutionDate?Digit.DateUtils.ConvertEpochToDate(null===(X=Cl)||void 0===X?void 0:X.connectionExecutionDate):vl("CS_NA"),textStyle:{whiteSpace:"pre"}})),(null===(Z=Cl)||void 0===Z||null===($=Z.applicationType)||void 0===$?void 0:$.includes("WATER"))&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_WATER_SOURCE"),text:vl("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null===(J=Cl)||void 0===J||null===(Q=J.waterSource)||void 0===Q||null===(ee=Q.split("."))||void 0===ee?void 0:ee[0],".","_"))||vl("WS_SERVICES_MASTERS_WATERSOURCE_"+m(null===(ne=Cl)||void 0===ne?void 0:ne.waterSource,".","_"))||vl("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_WATER_SUB_SOURCE"),text:vl(null===(te=Cl)||void 0===te||null===(le=te.waterSource)||void 0===le||null===(oe=le.split("."))||void 0===oe?void 0:oe[1])||vl("CS_NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_CONN_EXECUTION_DATE"),text:Digit.DateUtils.ConvertEpochToDate(null===(ie=Cl)||void 0===ie?void 0:ie.connectionExecutionDate)||vl("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_SERV_DETAIL_METER_ID"),text:null===(ae=Cl)||void 0===ae?void 0:ae.meterId,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_ADDN_DETAIL_METER_INSTALL_DATE"),text:Digit.DateUtils.ConvertEpochToDate(null===(re=Cl)||void 0===re?void 0:re.meterInstallationDate)||"NA",textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_ADDN_DETAILS_INITIAL_METER_READING"),text:(null===(ue=Cl)||void 0===ue||null===(de=ue.additionalDetails)||void 0===de?void 0:de.initialMeterReading)||"NA",textStyle:{whiteSpace:"pre"}})),"Metered"===(null===(se=Cl)||void 0===se?void 0:se.connectionType)&&l.createElement(i.Link,{to:"/digit-ui/citizen/ws/consumption/details?applicationNo="+(null===(ce=Cl)||void 0===ce?void 0:ce.connectionNo)},l.createElement(a.LinkButton,{style:{textAlign:"left",marginBottom:"10px",marginTop:"5px"},label:vl("WS_CONNECTION_DETAILS_VIEW_CONSUMPTION_LABEL")}))),l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},vl("WS_COMMON_PROPERTY_DETAILS")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:vl("WS_PROPERTY_ID_LABEL"),text:null===(ve=Cl)||void 0===ve?void 0:ve.propertyId}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:null===(pe=Cl)||void 0===pe||null===(me=pe.property)||void 0===me||null===(Ee=me.owners)||void 0===Ee?void 0:Ee.map(e=>e.name).join(","),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_PROPADD"),text:(Yl=null==wl||null===(Se=wl.Properties)||void 0===Se||null===(_e=Se[0])||void 0===_e?void 0:_e.address,(null!=Yl&&Yl.doorNo?(null==Yl?void 0:Yl.doorNo)+", ":"")+(null!=Yl&&Yl.street?(null==Yl?void 0:Yl.street)+", ":"")+(null!=Yl&&Yl.landmark?(null==Yl?void 0:Yl.landmark)+", ":"")+(null!=Yl&&null!==(Gl=Yl.locality)&&void 0!==Gl&&Gl.code?vl("TENANTS_MOHALLA_"+(null==Yl||null===(ql=Yl.locality)||void 0===ql?void 0:ql.code)):"")+(null!=Yl&&null!==(Kl=Yl.city)&&void 0!==Kl&&Kl.code||null!=Yl&&Yl.city?", "+vl((null==Yl?void 0:Yl.city.code)||(null==Yl?void 0:Yl.city)):"")+(null!=Yl&&Yl.pincode?", "+Yl.pincode:" ")||vl("CS_NA")),textStyle:{wordBreak:"break-word"},privacy:{uuid:null==wl||null===(fe=wl.Properties)||void 0===fe||null===(ge=fe[0])||void 0===ge||null===(Ce=ge.owners)||void 0===Ce||null===(Ne=Ce[0])||void 0===Ne?void 0:Ne.uuid,fieldName:["doorNo","street","landmark"],model:"Property",hide:!(null!=wl&&null!==(ye=wl.Properties)&&void 0!==ye&&null!==(De=ye[0])&&void 0!==De&&De.address),showValue:!0,loadData:{serviceName:"/property-services/property/_search",requestBody:{},requestParam:{tenantId:Sl,propertyIds:null===(Te=Cl)||void 0===Te?void 0:Te.propertyId},jsonPath:"Properties[0].address.street",isArray:!1,d:e=>(U.get(e,"Properties[0].address.doorNo")?U.get(e,"Properties[0].address.doorNo")+", ":"")+(U.get(e,"Properties[0].address.street")?U.get(e,"Properties[0].address.street")+", ":"")+(U.get(e,"Properties[0].address.landmark")?""+U.get(e,"Properties[0].address.landmark"):"")}}}),l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+(null===(he=Cl)||void 0===he?void 0:he.propertyId)+"&tenantId="+(null===(Ae=Cl)||void 0===Ae?void 0:Ae.tenantId)},l.createElement(a.LinkButton,{style:{textAlign:"left",marginBottom:"10px",marginTop:"5px"},label:vl("WS_VIEW_PROPERTY")}))),l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},vl("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),null!==(Ie=Cl)&&void 0!==Ie&&Ie.connectionHolders?l.createElement("div",null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_OWN_NAME_LABEL"),text:null===(Oe=Cl)||void 0===Oe||null===(be=Oe.connectionHolders)||void 0===be||null===(Le=be[0])||void 0===Le?void 0:Le.name,textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_GENDER_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(Re=Ol.WaterConnection)||void 0===Re||null===(we=Re[0])||void 0===we||null===(We=we.connectionHolders)||void 0===We||null===(Pe=We[0])||void 0===Pe?void 0:Pe.gender:null==Ol||null===(Me=Ol.SewerageConnections)||void 0===Me||null===(xe=Me[0])||void 0===xe||null===(Be=xe.connectionHolders)||void 0===Be||null===(Fe=Be[0])||void 0===Fe?void 0:Fe.gender,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Ue=Ol.WaterConnection)||void 0===Ue||null===(ke=Ue[0])||void 0===ke||null===(He=ke.connectionHolders)||void 0===He||null===(je=He[0])||void 0===je?void 0:je.uuid:null==Ol||null===(Ve=Ol.SewerageConnections)||void 0===Ve||null===(ze=Ve[0])||void 0===ze||null===(Ye=ze.connectionHolders)||void 0===Ye||null===(Ge=Ye[0])||void 0===Ge?void 0:Ge.uuid,fieldName:"gender",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].gender":"SewerageConnections[0].connectionHolders[0].gender",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_MOBILE_NO_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(qe=Ol.WaterConnection)||void 0===qe||null===(Ke=qe[0])||void 0===Ke||null===(Xe=Ke.connectionHolders)||void 0===Xe||null===(Ze=Xe[0])||void 0===Ze?void 0:Ze.mobileNumber:null==Ol||null===($e=Ol.SewerageConnections)||void 0===$e||null===(Je=$e[0])||void 0===Je||null===(Qe=Je.connectionHolders)||void 0===Qe||null===(en=Qe[0])||void 0===en?void 0:en.mobileNumber,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(nn=Ol.WaterConnection)||void 0===nn||null===(tn=nn[0])||void 0===tn||null===(ln=tn.connectionHolders)||void 0===ln||null===(on=ln[0])||void 0===on?void 0:on.uuid:null==Ol||null===(an=Ol.SewerageConnections)||void 0===an||null===(rn=an[0])||void 0===rn||null===(un=rn.connectionHolders)||void 0===un||null===(dn=un[0])||void 0===dn?void 0:dn.uuid,fieldName:"connectionHoldersMobileNumber",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].mobileNumber":"SewerageConnections[0].connectionHolders[0].mobileNumber",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_FATHER_OR_HUSBAND_NAME"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(sn=Ol.WaterConnection)||void 0===sn||null===(cn=sn[0])||void 0===cn||null===(vn=cn.connectionHolders)||void 0===vn||null===(pn=vn[0])||void 0===pn?void 0:pn.fatherOrHusbandName:null==Ol||null===(mn=Ol.SewerageConnections)||void 0===mn||null===(En=mn[0])||void 0===En||null===(Sn=En.connectionHolders)||void 0===Sn||null===(_n=Sn[0])||void 0===_n?void 0:_n.fatherOrHusbandName,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(fn=Ol.WaterConnection)||void 0===fn||null===(gn=fn[0])||void 0===gn||null===(Cn=gn.connectionHolders)||void 0===Cn||null===(Nn=Cn[0])||void 0===Nn?void 0:Nn.uuid:null==Ol||null===(yn=Ol.SewerageConnections)||void 0===yn||null===(Dn=yn[0])||void 0===Dn||null===(Tn=Dn.connectionHolders)||void 0===Tn||null===(hn=Tn[0])||void 0===hn?void 0:hn.uuid,fieldName:"fatherOrHusbandName",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].fatherOrHusbandName":"SewerageConnections[0].connectionHolders[0].fatherOrHusbandName",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_RELATION_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(An=Ol.WaterConnection)||void 0===An||null===(In=An[0])||void 0===In||null===(On=In.connectionHolders)||void 0===On||null===(bn=On[0])||void 0===bn?void 0:bn.relationship:null==Ol||null===(Ln=Ol.SewerageConnections)||void 0===Ln||null===(Rn=Ln[0])||void 0===Rn||null===(wn=Rn.connectionHolders)||void 0===wn||null===(Wn=wn[0])||void 0===Wn?void 0:Wn.relationship,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Pn=Ol.WaterConnection)||void 0===Pn||null===(Mn=Pn[0])||void 0===Mn||null===(xn=Mn.connectionHolders)||void 0===xn||null===(Bn=xn[0])||void 0===Bn?void 0:Bn.uuid:null==Ol||null===(Fn=Ol.SewerageConnections)||void 0===Fn||null===(Un=Fn[0])||void 0===Un||null===(kn=Un.connectionHolders)||void 0===kn||null===(Hn=kn[0])||void 0===Hn?void 0:Hn.uuid,fieldName:"relationship",model:"WnSConnection",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].relationship":"SewerageConnections[0].connectionHolders[0].relationship",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_CROSADD"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(jn=Ol.WaterConnection)||void 0===jn||null===(Vn=jn[0])||void 0===Vn||null===(zn=Vn.connectionHolders)||void 0===zn||null===(Yn=zn[0])||void 0===Yn?void 0:Yn.correspondenceAddress:null==Ol||null===(Gn=Ol.SewerageConnections)||void 0===Gn||null===(qn=Gn[0])||void 0===qn||null===(Kn=qn.connectionHolders)||void 0===Kn||null===(Xn=Kn[0])||void 0===Xn?void 0:Xn.correspondenceAddress,privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Zn=Ol.WaterConnection)||void 0===Zn||null===($n=Zn[0])||void 0===$n||null===(Jn=$n.connectionHolders)||void 0===Jn||null===(Qn=Jn[0])||void 0===Qn?void 0:Qn.uuid:null==Ol||null===(et=Ol.SewerageConnections)||void 0===et||null===(nt=et[0])||void 0===nt||null===(tt=nt.connectionHolders)||void 0===tt||null===(lt=tt[0])||void 0===lt?void 0:lt.uuid,fieldName:"correspondenceAddress",model:"WnSConnectionOwner",hide:!(null!==(ot=Cl)&&void 0!==ot&&ot.connectionHolders),showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].correspondenceAddress":"SewerageConnections[0].connectionHolders[0].correspondenceAddress",isArray:!1}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_DETAIL_SPECIAL_APPLICANT_LABEL"),text:(null!=gl&&gl.includes("WS")?null!=Ol&&null!==(it=Ol.WaterConnection)&&void 0!==it&&null!==(at=it[0])&&void 0!==at&&null!==(rt=at.connectionHolders)&&void 0!==rt&&null!==(ut=rt[0])&&void 0!==ut&&null!==(dt=ut.ownerType)&&void 0!==dt&&dt.includes("*"):null!=Ol&&null!==(st=Ol.SewerageConnections)&&void 0!==st&&null!==(ct=st[0])&&void 0!==ct&&null!==(vt=ct.connectionHolders)&&void 0!==vt&&null!==(pt=vt[0])&&void 0!==pt&&null!==(mt=pt.ownerType)&&void 0!==mt&&mt.includes("*"))?null!=gl&&gl.includes("WS")?null==Ol||null===(Dt=Ol.WaterConnection)||void 0===Dt||null===(Tt=Dt[0])||void 0===Tt||null===(ht=Tt.connectionHolders)||void 0===ht||null===(At=ht[0])||void 0===At?void 0:At.ownerType:null==Ol||null===(It=Ol.SewerageConnections)||void 0===It||null===(Ot=It[0])||void 0===Ot||null===(bt=Ot.connectionHolders)||void 0===bt||null===(Lt=bt[0])||void 0===Lt?void 0:Lt.ownerType:vl("COMMON_MASTERS_OWNERTYPE_"+(null!=gl&&gl.includes("WS")?null==Ol||null===(Et=Ol.WaterConnection)||void 0===Et||null===(St=Et[0])||void 0===St||null===(_t=St.connectionHolders)||void 0===_t||null===(ft=_t[0])||void 0===ft?void 0:ft.ownerType:null==Ol||null===(gt=Ol.SewerageConnections)||void 0===gt||null===(Ct=gt[0])||void 0===Ct||null===(Nt=Ct.connectionHolders)||void 0===Nt||null===(yt=Nt[0])||void 0===yt?void 0:yt.ownerType)),textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Rt=Ol.WaterConnection)||void 0===Rt||null===(wt=Rt[0])||void 0===wt||null===(Wt=wt.connectionHolders)||void 0===Wt||null===(Pt=Wt[0])||void 0===Pt?void 0:Pt.uuid:null==Ol||null===(Mt=Ol.SewerageConnections)||void 0===Mt||null===(xt=Mt[0])||void 0===xt||null===(Bt=xt.connectionHolders)||void 0===Bt||null===(Ft=Bt[0])||void 0===Ft?void 0:Ft.uuid,fieldName:"ownerType",model:"WnSConnection",hide:!(null!==(Ut=Cl)&&void 0!==Ut&&null!==(kt=Ut.connectionHolders)&&void 0!==kt&&null!==(Ht=kt[0])&&void 0!==Ht&&Ht.ownerType),showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].ownerType":"SewerageConnections[0].connectionHolders[0].ownerType",isArray:!1,d:e=>{var n,t,l,o,i,a,r,u,d,s,c;return null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n[0]?vl("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(t=e.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.connectionHolders)||void 0===o||null===(i=o[0])||void 0===i||null===(a=i.ownerType)||void 0===a?void 0:a.toUpperCase())):vl("PROPERTYTAX_OWNERTYPE_"+(null==e||null===(r=e.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.connectionHolders)||void 0===d||null===(s=d[0])||void 0===s||null===(c=s.ownerType)||void 0===c?void 0:c.toUpperCase()))}}}}),l.createElement(a.Row,{className:"border-none",label:vl("WS_OWN_EMAIL_IDNO_LABEL"),text:null!=gl&&gl.includes("WS")?null==Ol||null===(jt=Ol.WaterConnection)||void 0===jt||null===(Vt=jt[0])||void 0===Vt||null===(zt=Vt.connectionHolders)||void 0===zt||null===(Yt=zt[0])||void 0===Yt?void 0:Yt.emailId:null==Ol||null===(Gt=Ol.SewerageConnections)||void 0===Gt||null===(qt=Gt[0])||void 0===qt||null===(Kt=qt.connectionHolders)||void 0===Kt||null===(Xt=Kt[0])||void 0===Xt?void 0:Xt.emailId,textStyle:{whiteSpace:"pre"},privacy:{uuid:null!=gl&&gl.includes("WS")?null==Ol||null===(Zt=Ol.WaterConnection)||void 0===Zt||null===($t=Zt[0])||void 0===$t||null===(Jt=$t.connectionHolders)||void 0===Jt||null===(Qt=Jt[0])||void 0===Qt?void 0:Qt.uuid:null==Ol||null===(el=Ol.SewerageConnections)||void 0===el||null===(nl=el[0])||void 0===nl||null===(tl=nl.connectionHolders)||void 0===tl||null===(ll=tl[0])||void 0===ll?void 0:ll.uuid,fieldName:"connectionHoldersEmailId",model:"WnSConnectionOwner",showValue:!1,loadData:{serviceName:"WATER"===zl?"/ws-services/wc/_search":"/sw-services/swc/_search",requestBody:{},requestParam:{tenantId:Sl,applicationNumber:gl},jsonPath:"WATER"===zl?"WaterConnection[0].connectionHolders[0].emailId":"SewerageConnections[0].connectionHolders[0].emailId",isArray:!1}}}))):l.createElement(a.CardText,null,vl("WS_PROPERTY_OWNER_SAME_AS_CONN_HOLDERS")),"inactive"===(null===(ol=Cl)||void 0===ol?void 0:ol.status)&&"Inactive"===(null===(il=Cl)||void 0===il?void 0:il.applicationStatus)&&"INACTIVE"===(null===(al=Cl)||void 0===al?void 0:al.applicationStatus)||xl?"DISCONNECTION_EXECUTED"==(null===(rl=Cl)||void 0===rl?void 0:rl.applicationStatus)&&"Inactive"==(null===(ul=Cl)||void 0===ul?void 0:ul.status)&&(null===(dl=Cl)||void 0===dl?void 0:dl.isDisconnectionTemporary)&&l.createElement(a.ActionBar,{style:{position:"relative",boxShadow:"none",minWidth:"240px",maxWidth:"310px",padding:"0px",marginTop:"15px"}},l.createElement("div",{style:{width:"100%"}},l.createElement(a.SubmitBar,{style:{width:"100%"},label:vl("WS_RECONNECTION_BUTTON"),onSubmit:function(){(()=>{var e,n,t,l,o,i,a,r,u,d,s;if(console.log("getRestorationButton",Ol,!(null!=Ol&&Ol.checkWorkFlow)),console.log("Payment",kl),null!=Ol&&Ol.checkWorkFlow){if(0===(null==kl||null===(e=kl.data)||void 0===e||null===(n=e.Bill)||void 0===n?void 0:n.length)){console.log("Payment",kl);let e="/digit-ui/citizen/ws/restoration-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else if((null==kl||null===(t=kl.data)||void 0===t||null===(l=t.Bill)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.totalAmount)<0){let e="/digit-ui/citizen/ws/restore-application/restoration-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else if(0!==(null==kl||null===(i=kl.data)||void 0===i||null===(a=i.Bill)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.totalAmount))yl(!0);else if(0==(null==kl||null===(u=kl.data)||void 0===u||null===(d=u.Bill)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.totalAmount)){let e="/digit-ui/citizen/ws/restore-application/restoration-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}}else Tl({key:"error",label:"CONNECTION_INPROGRESS_LABEL"}),setTimeout(()=>{Pl()},5e3)})()}}))):l.createElement(a.ActionBar,{style:{position:"relative",boxShadow:"none",minWidth:"240px",maxWidth:"310px",padding:"0px",marginTop:"15px"}},l.createElement("div",{style:{width:"100%"}},l.createElement(a.SubmitBar,{style:{width:"100%"},label:vl("WS_DISCONNECTION_BUTTON"),onSubmit:function(){(()=>{var e,n,t,l,o,i,a,r;if(null!=Ol&&Ol.checkWorkFlow)if(0===(null==kl||null===(e=kl.data)||void 0===e||null===(n=e.Bill)||void 0===n?void 0:n.length)){let e="/digit-ui/citizen/ws/disconnect-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else if((null==kl||null===(t=kl.data)||void 0===t||null===(l=t.Bill)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.totalAmount)<0){let e="/digit-ui/citizen/ws/disconnect-application";Digit.SessionStorage.set("WS_DISCONNECTION",v({},Cl,{serviceType:Fl?"SEWERAGE":"WATER"})),El.push(""+e)}else 0!==(null==kl||null===(i=kl.data)||void 0===i||null===(a=i.Bill)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.totalAmount)&&yl(!0);else Tl({key:"error",label:"CONNECTION_INPROGRESS_LABEL"}),setTimeout(()=>{Pl()},5e3)})()}}))),Nl?l.createElement(a.Modal,{open:Nl,headerBarMain:l.createElement(jl,{label:vl("WS_PENDING_DUES_LABEL")}),headerBarEnd:l.createElement(Vl,{onClick:()=>yl(!1)}),center:!0,formId:"modal-action",actionSingleLabel:vl("COMMON_MAKE_PAYMENT"),hideSubmit:!0,actionSingleSubmit:()=>{var e,n;El.push("/digit-ui/citizen/payment/collect/"+(Fl?"SW":"WS")+"/"+encodeURIComponent(null===(e=Cl)||void 0===e?void 0:e.connectionNo)+"/"+Sl+"?consumerCode="+(null===(n=Cl)||void 0===n?void 0:n.connectionNo)+"&&tenantId="+Sl+"&&workflow=WNS"),yl(!1)},popupStyles:hl?{width:"720px"}:{},style:hl?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:hl?{paddingLeft:"5px"}:{}},l.createElement("div",{className:"modal-header-ws"},vl("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL")," "),l.createElement("div",{className:"modal-body-ws"},l.createElement("span",null,vl("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),": ₹",Number(null==kl||null===(sl=kl.data)||void 0===sl||null===(cl=sl.Bill[0])||void 0===cl?void 0:cl.totalAmount).toFixed(2))," ")):null),Dl&&l.createElement(a.Toast,{style:{bottom:"150px"},error:Dl.key,label:vl(""+Dl.label),onClose:Pl})));var Yl,Gl,ql,Kl},WSCitizenConsumptionDetails:e=>{var n,t;const{t:i}=o.useTranslation(),r=Digit.UserService.getUser(),u=(null===(n=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===n?void 0:n.code)||(null==r||null===(t=r.info)||void 0===t?void 0:t.permanentCity)||Digit.ULBService.getCurrentTenantId(),{applicationNo:d}=Digit.Hooks.useQueryParams();let s={tenantId:u,connectionNos:d};const{isLoading:c,data:v}=Digit.Hooks.ws.useWSConsumptionSearch({filters:s},{filters:s});if(c)return l.createElement(a.Loader,null);let{meterReadings:p}=v||{};return l.createElement(l.Fragment,null,l.createElement(a.Header,null,""+i("WS_VIEW_CONSUMPTION")),l.createElement("div",null,(null==p?void 0:p.length)>0&&p.map((e,n)=>{return l.createElement("div",{key:n},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:i("WS_MYCONNECTIONS_CONSUMER_NO"),text:(null==e?void 0:e.connectionNo)||i("NA"),textStyle:{}}),l.createElement(a.Row,{className:"border-none",label:i("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),text:(null==e?void 0:e.billingPeriod)||i("NA"),textStyle:{wordBreak:"break-word"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_METER_STATUS_LABEL"),text:(null==e?void 0:e.meterStatus)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),text:(null==e?void 0:e.lastReading)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),text:Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.lastReadingDate)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_CURRENT_READING_LABEL"),text:(null==e?void 0:e.currentReading)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),text:Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.currentReadingDate)||i("NA"),textStyle:{whiteSpace:"pre"}}),l.createElement(a.Row,{className:"border-none",label:i("WS_CONSUMPTION_DETAILS_CONSUMPTION_LABEL"),text:(t=null==e?void 0:e.currentReading,o=null==e?void 0:e.lastReading,t&&o?Number(t-o):i("NA")),textStyle:{whiteSpace:"pre"}}))));var t,o}),!(null!=p&&p.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},i("WS_NO_CONSUMPTION_FOUND"))))},WSMyPayments:()=>{var e,n,t,i,r,u,d,s,c,p,m,E,S,_,f,g,C;const{t:N}=o.useTranslation(),y=Digit.UserService.getUser(),D=(null===(e=Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"))||void 0===e?void 0:e.code)||(null==y||null===(n=y.info)||void 0===n?void 0:n.permanentCity)||Digit.ULBService.getCurrentTenantId();let T=window.location.href.split("/").pop(),h=isNaN(parseInt(T))?{tenantId:D,mobileNumber:null==y||null===(i=y.info)||void 0===i?void 0:i.mobileNumber,searchType:"CONNECTION"}:{tenantId:D,mobileNumber:null==y||null===(t=y.info)||void 0===t?void 0:t.mobileNumber,searchType:"CONNECTION"};const{isLoading:A,data:I}=Digit.Hooks.ws.useMyApplicationSearch({filters:h},{filters:h}),{isLoading:O,data:b}=Digit.Hooks.ws.useMyApplicationSearch({filters:h,BusinessService:"SW"},{filters:h});let L=null==I||null===(r=I.WaterConnection)||void 0===r?void 0:r.concat(null==b?void 0:b.SewerageConnections),R=I&&(null==I||null===(u=I.WaterConnection)||void 0===u?void 0:u.length)>0?null==I||null===(d=I.WaterConnection)||void 0===d?void 0:d.map(e=>e.connectionNo).join(","):null,w=b&&(null==b||null===(s=b.SewerageConnections)||void 0===s?void 0:s.length)>0?null==b||null===(c=b.SewerageConnections)||void 0===c?void 0:c.map(e=>e.connectionNo).join(","):null,W=I&&(null==I||null===(p=I.WaterConnection)||void 0===p?void 0:p.length)>0?null==I||null===(m=I.WaterConnection)||void 0===m?void 0:m.map(e=>e.propertyId).join(","):null,P=b&&(null==b||null===(E=b.SewerageConnections)||void 0===E?void 0:E.length)>0?null==b||null===(S=b.SewerageConnections)||void 0===S?void 0:S.map(e=>e.propertyId).join(","):null,M=W?null==W?void 0:W.concat(",",P):null==P?void 0:P.concat(",",W);const{data:x,isLoading:B}=Digit.Hooks.ws.useMypaymentWS({tenantId:D,filters:{consumerCodes:R},BusinessService:"WS"},{enabled:null!==R}),{data:F,isLoading:U}=Digit.Hooks.ws.useMypaymentWS({tenantId:D,filters:{consumerCodes:w},BusinessService:"SW"},{enabled:null!==w}),{data:k,isLoading:H}=Digit.Hooks.ws.useWaterPropertySearch({tenantId:D,filters:{propertyids:M}},{enabled:null!==w});if(A||B||U||O||H)return l.createElement(a.Loader,null);let V=(x&&(null==x?void 0:x.Payments)||[]).concat(F&&(null==F?void 0:F.Payments)||[]);return V=null===(_=V)||void 0===_?void 0:_.map(e=>{var n;return v({},e,{details:null==L||null===(n=L.filter(n=>{var t,l,o;return(null==n?void 0:n.connectionNo)===(null==e||null===(t=e.paymentDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.bill)||void 0===o?void 0:o.consumerCode)}))||void 0===n?void 0:n[0]})}),V=null===(f=V)||void 0===f?void 0:f.map(e=>{var n,t;return v({},e,{property:null==k||null===(n=k.Properties)||void 0===n||null===(t=n.filter(n=>{var t;return(null==n?void 0:n.propertyId)===(null==e||null===(t=e.details)||void 0===t?void 0:t.propertyId)}))||void 0===t?void 0:t[0]})}),l.createElement(l.Fragment,null,l.createElement(a.Header,null,N("WS_MY_PAYMENTS_HEADER")+" "+(V?"("+V.length+")":"")),l.createElement(j,{t:N}),l.createElement("div",null,(null===(g=V)||void 0===g?void 0:g.length)>0&&V.map((e,n)=>l.createElement("div",{key:n},l.createElement(ji,{application:e}))),!(null!==(C=V)&&void 0!==C&&C.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},N("PT_NO_APPLICATION_FOUND_MSG"))))},WSCitizenEditApplication:e=>{var n,r,u,s,c,p,m;const E=d.useQueryClient();let S=i.useRouteMatch();const{t:_}=o.useTranslation();let{tenantId:f}=i.useParams();const{pathname:g,state:C}=i.useLocation(),N=i.useHistory();let y=(null==C?void 0:C.id)||sessionStorage.getItem("ApplicationNoState"),D=[],T={},h={};const[A,I,O]=Digit.Hooks.useSessionStorage("WS_EDIT_APPLICATION",{}),b=Digit.ULBService.getStateId();let{data:L,isLoading:R}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(b,{}),w={};y&&(w.applicationNumber=y),f&&(w.tenantId=f);const{data:W}=Digit.Hooks.ws.useWaterSearch({tenantId:f,filters:v({},w,{isInternalCall:!0}),BusinessService:"WS",t:_},{enabled:!(!y||!y.includes("WS"))}),{data:P}=Digit.Hooks.ws.useSewarageSearch({tenantId:f,filters:v({},w,{isInternalCall:!0}),BusinessService:"SW",t:_},{enabled:!(!y||!y.includes("SW"))});let M=window.location.href.includes("/modify-connection/")||window.location.href.includes("/edit-application/");t.useEffect(()=>{var e,n;if(T=W,h=P,(W&&T||P&&h)&&(!(Object.keys(A).length>0)||T&&(null==A?void 0:A.applicationNo)!==(null===(e=T)||void 0===e?void 0:e.applicationNo)||h&&(null==A?void 0:A.applicationNo)!==(null===(n=h)||void 0===n?void 0:n.applicationNo))){T=W,h=P,window.location.href.includes("edit-application")?(T&&(T.isEditApplication=!0,T.isModifyConnection=!1),h&&(h.isEditApplication=!0,h.isModifyConnection=!1)):window.location.href.includes("modify-connection")&&(T&&(T.isModifyConnection=!0,T.isEditApplication=!1),h&&(h.isModifyConnection=!0,h.isEditApplication=!1)),sessionStorage.setItem("WaterInitialObject",JSON.stringify(v({},T))),sessionStorage.setItem("SewerageInitialObject",JSON.stringify(v({},h)));let e=((e,n,t)=>{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me;if(e)e.ConnectionHolderDetails=null!=e&&e.connectionHolders?v({},null==e||null===(l=e.connectionHolders)||void 0===l?void 0:l[0],{address:null==e||null===(o=e.connectionHolders)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=e&&null!==(a=e.connectionHolders)&&void 0!==a&&null!==(r=a[0])&&void 0!==r&&r.gender?{code:null==e||null===(u=e.connectionHolders)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.gender,i18nKey:"COMMON_GENDER_"+(null==e||null===(s=e.connectionHolders)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.gender)}:null,guardian:null==e||null===(p=e.connectionHolders)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.fatherOrHusbandName,isOwnerSame:!((null==e||null===(E=e.connectionHolders)||void 0===E?void 0:E.length)>0),mobileNumber:null==e||null===(S=e.connectionHolders)||void 0===S||null===(_=S[0])||void 0===_?void 0:_.mobileNumber,name:null==e||null===(f=e.connectionHolders)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.name,relationship:null!=e&&null!==(C=e.connectionHolders)&&void 0!==C&&null!==(N=C[0])&&void 0!==N&&N.relationship?{code:null==e||null===(y=e.connectionHolders)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==e||null===(T=e.connectionHolders)||void 0===T||null===(h=T[0])||void 0===h?void 0:h.relationship)}:null,specialCategoryType:null!=e&&null!==(A=e.connectionHolders)&&void 0!==A&&null!==(I=A[0])&&void 0!==I&&I.ownerType?{code:null==e||null===(O=e.connectionHolders)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==e||null===(L=e.connectionHolders)||void 0===L||null===(R=L[0])||void 0===R?void 0:R.ownerType)}:""}):{address:null==e||null===(w=e.property)||void 0===w||null===(W=w.owners)||void 0===W||null===(P=W[0])||void 0===P?void 0:P.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=e&&null!==(M=e.property)&&void 0!==M&&null!==(x=M.owners)&&void 0!==x&&null!==(B=x[0])&&void 0!==B&&B.gender?{code:null==e||null===(F=e.property)||void 0===F||null===(U=F.owners)||void 0===U||null===(k=U[0])||void 0===k?void 0:k.gender,i18nKey:"COMMON_GENDER_"+(null==e||null===(H=e.property)||void 0===H||null===(j=H.owners)||void 0===j||null===(V=j[0])||void 0===V?void 0:V.gender)}:null,guardian:null==e||null===(z=e.property)||void 0===z||null===(Y=z.owners)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.fatherOrHusbandName,isOwnerSame:null==e||!e.connectionHolders,mobileNumber:null==e||null===(q=e.property)||void 0===q||null===(K=q.owners)||void 0===K||null===(X=K[0])||void 0===X?void 0:X.mobileNumber,name:null==e||null===(Z=e.property)||void 0===Z||null===($=Z.owners)||void 0===$||null===(J=$[0])||void 0===J?void 0:J.name,relationship:null!=e&&null!==(Q=e.property)&&void 0!==Q&&null!==(ee=Q.owners)&&void 0!==ee&&null!==(ne=ee[0])&&void 0!==ne&&ne.relationship?{code:null==e||null===(te=e.property)||void 0===te||null===(le=te.owners)||void 0===le||null===(oe=le[0])||void 0===oe?void 0:oe.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==e||null===(ie=e.property)||void 0===ie||null===(ae=ie.owners)||void 0===ae||null===(re=ae[0])||void 0===re?void 0:re.relationship)}:null,specialCategoryType:null!=e&&null!==(ue=e.connectionHolders)&&void 0!==ue&&null!==(de=ue[0])&&void 0!==de&&de.ownerType?{code:null==e||null===(se=e.connectionHolders)||void 0===se||null===(ce=se[0])||void 0===ce?void 0:ce.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==e||null===(ve=e.connectionHolders)||void 0===ve||null===(pe=ve[0])||void 0===pe?void 0:pe.ownerType)}:""},e.WaterConnectionResult={WaterConnection:[v({},e)]},e.cpt={details:v({},null==e?void 0:e.property)},e.cptId={id:null==e?void 0:e.propertyId},e.documents={documents:null==e?void 0:e.documents},e.plumberPreference={plumberPreference:{code:"ULB",i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE"}},e.serviceName=null!=e&&null!==(me=e.applicationType)&&void 0!==me&&me.includes("WATER")?{code:"WATER",i18nKey:"WS_WATER_CONNECTION_ONLY"}:{code:"SEWERAGE",i18nKey:"WS_SEWERAGE_CONNECTION_ONLY"},e.waterConectionDetails={proposedPipeSize:{code:null==e?void 0:e.proposedPipeSize,i18nKey:(null==e?void 0:e.proposedPipeSize)+" "+t("WS_INCHES_LABEL"),size:null==e?void 0:e.proposedPipeSize},proposedTaps:null==e?void 0:e.proposedTaps};else if(n){var Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke,Xe,Ze,$e,Je,Qe,en,nn,tn,ln,on,an,rn,un,dn,sn,cn,vn,pn,mn,En,Sn,_n,fn,gn,Cn,Nn,yn,Dn,Tn,hn;n.ConnectionHolderDetails=null!=n&&n.connectionHolders?v({},null==n||null===(Ee=n.connectionHolders)||void 0===Ee?void 0:Ee[0],{address:null==n||null===(Se=n.connectionHolders)||void 0===Se||null===(_e=Se[0])||void 0===_e?void 0:_e.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=n&&null!==(fe=n.connectionHolders)&&void 0!==fe&&null!==(ge=fe[0])&&void 0!==ge&&ge.gender?{code:null==n||null===(Ce=n.connectionHolders)||void 0===Ce||null===(Ne=Ce[0])||void 0===Ne?void 0:Ne.gender,i18nKey:"COMMON_GENDER_"+(null==n||null===(ye=n.connectionHolders)||void 0===ye||null===(De=ye[0])||void 0===De?void 0:De.gender)}:null,guardian:null==n||null===(Te=n.connectionHolders)||void 0===Te||null===(he=Te[0])||void 0===he?void 0:he.fatherOrHusbandName,isOwnerSame:!((null==n||null===(Ae=n.connectionHolders)||void 0===Ae?void 0:Ae.length)>0),mobileNumber:null==n||null===(Ie=n.connectionHolders)||void 0===Ie||null===(Oe=Ie[0])||void 0===Oe?void 0:Oe.mobileNumber,name:null==n||null===(be=n.connectionHolders)||void 0===be||null===(Le=be[0])||void 0===Le?void 0:Le.name,relationship:null!=n&&null!==(Re=n.connectionHolders)&&void 0!==Re&&null!==(we=Re[0])&&void 0!==we&&we.relationship?{code:null==n||null===(We=n.connectionHolders)||void 0===We||null===(Pe=We[0])||void 0===Pe?void 0:Pe.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==n||null===(Me=n.connectionHolders)||void 0===Me||null===(xe=Me[0])||void 0===xe?void 0:xe.relationship)}:null,specialCategoryType:null!=n&&null!==(Be=n.connectionHolders)&&void 0!==Be&&null!==(Fe=Be[0])&&void 0!==Fe&&Fe.ownerType?{code:null==n||null===(Ue=n.connectionHolders)||void 0===Ue||null===(ke=Ue[0])||void 0===ke?void 0:ke.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==n||null===(He=n.connectionHolders)||void 0===He||null===(je=He[0])||void 0===je?void 0:je.ownerType)}:""}):{address:null==n||null===(Ve=n.property)||void 0===Ve||null===(ze=Ve.owners)||void 0===ze||null===(Ye=ze[0])||void 0===Ye?void 0:Ye.correspondenceAddress,documentId:"",documentType:"",filestoreId:null,gender:null!=n&&null!==(Ge=n.property)&&void 0!==Ge&&null!==(qe=Ge.owners)&&void 0!==qe&&null!==(Ke=qe[0])&&void 0!==Ke&&Ke.gender?{code:null==n||null===(Xe=n.property)||void 0===Xe||null===(Ze=Xe.owners)||void 0===Ze||null===($e=Ze[0])||void 0===$e?void 0:$e.gender,i18nKey:"COMMON_GENDER_"+(null==n||null===(Je=n.property)||void 0===Je||null===(Qe=Je.owners)||void 0===Qe||null===(en=Qe[0])||void 0===en?void 0:en.gender)}:null,guardian:null==n||null===(nn=n.property)||void 0===nn||null===(tn=nn.owners)||void 0===tn||null===(ln=tn[0])||void 0===ln?void 0:ln.fatherOrHusbandName,isOwnerSame:null==n||!n.connectionHolders,mobileNumber:null==n||null===(on=n.property)||void 0===on||null===(an=on.owners)||void 0===an||null===(rn=an[0])||void 0===rn?void 0:rn.mobileNumber,name:null==n||null===(un=n.property)||void 0===un||null===(dn=un.owners)||void 0===dn||null===(sn=dn[0])||void 0===sn?void 0:sn.name,relationship:null!=n&&null!==(cn=n.property)&&void 0!==cn&&null!==(vn=cn.owners)&&void 0!==vn&&null!==(pn=vn[0])&&void 0!==pn&&pn.relationship?{code:null==n||null===(mn=n.property)||void 0===mn||null===(En=mn.owners)||void 0===En||null===(Sn=En[0])||void 0===Sn?void 0:Sn.relationship,i18nKey:"COMMON_MASTERS_OWNERTYPE_"+(null==n||null===(_n=n.property)||void 0===_n||null===(fn=_n.owners)||void 0===fn||null===(gn=fn[0])||void 0===gn?void 0:gn.relationship)}:null,specialCategoryType:null!=n&&null!==(Cn=n.connectionHolders)&&void 0!==Cn&&null!==(Nn=Cn[0])&&void 0!==Nn&&Nn.ownerType?{code:null==n||null===(yn=n.connectionHolders)||void 0===yn||null===(Dn=yn[0])||void 0===Dn?void 0:Dn.ownerType,i18nKey:"PROPERTYTAX_OWNERTYPE_"+(null==n||null===(Tn=n.connectionHolders)||void 0===Tn||null===(hn=Tn[0])||void 0===hn?void 0:hn.ownerType)}:""},n.SewerageConnectionResult={SewerageConnections:[v({},n)]},n.cpt={details:v({},null==n?void 0:n.property)},n.cptId={id:null==n?void 0:n.propertyId},n.documents={documents:[...null==n?void 0:n.documents]},n.plumberPreference={plumberPreference:{code:"ULB",i18nKey:"WS_I_WOULD_PREFER_FROM_MUNICIPAL_OFFICE"}},n.serviceName=null!=n&&n.applicationType.includes("WATER")?{code:"WATER",i18nKey:"WS_WATER_CONNECTION_ONLY"}:{code:"SEWERAGE",i18nKey:"WS_SEWERAGE_CONNECTION_ONLY"},n.sewerageConnectionDetails={proposedToilets:null==n?void 0:n.proposedToilets,proposedWaterClosets:null==n?void 0:n.proposedWaterClosets}}return v({},e||n)})(T,h,_);I(v({},A,e))}},[W,P]);const x=(e,n,t,l)=>{I(l?n:""===e?v({},n):v({},A,{[e]:v({},A[e],n)})),(e=>{var n,t,l,o,i;const a=g.split("/").pop();let{nextStep:r}=D.find(e=>e.route===a),u=D.find(e=>e.route===a&&e);"object"==typeof r&&null!=r&&(!r[sessionStorage.getItem("KnowProperty")]||"search-property"!==r[sessionStorage.getItem("KnowProperty")]&&"create-property"!==r[sessionStorage.getItem("KnowProperty")]||(r=""+r[sessionStorage.getItem("KnowProperty")])),u[sessionStorage.getItem("serviceName")]&&(r=u[sessionStorage.getItem("serviceName")]),(null!=A&&null!==(n=A.cptId)&&void 0!==n&&n.id||null!=A&&null!==(t=A.cpt)&&void 0!==t&&null!==(l=t.details)&&void 0!==l&&l.propertyId||M&&null!=A&&null!==(o=A.cpt)&&void 0!==o&&null!==(i=o.details)&&void 0!==i&&i.propertyId)&&"know-your-property"===r&&(r="property-details"),"docsrequired"===r&&"yes"===sessionStorage.getItem("changePropertySelected")&&(r="property-details");let d=N.push;if(null===r)return d(Vi(S.path,S.params)+"/check");d(Vi(S.path,S.params)+"/"+r)})()},B=()=>{};if(L=null!==(n=L)&&void 0!==n&&n.WSCreateConfig?null===(r=L)||void 0===r?void 0:r.WSCreateConfig:Kl,null===(u=L)||void 0===u||u.forEach(e=>{D=D.concat(e.body.filter(e=>!e.hideInCitizen))}),D.indexRoute="property-details",(W&&Object.keys(W).length>0||!P)&&null!=W&&W.isLoading||null!=P&&P.isLoading||R)return l.createElement(a.Loader,null);const F=null===(s=Digit)||void 0===s||null===(c=s.ComponentRegistryService)||void 0===c?void 0:c.getComponent("WSCheckPage"),U=null===(p=Digit)||void 0===p||null===(m=p.ComponentRegistryService)||void 0===m?void 0:m.getComponent("WSAcknowledgement");return l.createElement(i.Switch,null,D.map((e,n)=>{const{component:t,texts:o,inputs:a,key:r,isSkipEnabled:u}=e,d="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:Vi(S.path,S.params)+"/"+e.route,key:n},l.createElement(d,{config:{texts:o,inputs:a,key:r,isSkipEnabled:u},onSelect:x,onSkip:B,t:_,formData:A,userType:"citizen"}))}),l.createElement(i.Route,{path:Vi(S.path,S.params)+"/check"},l.createElement(F,{onSubmit:function(){try{return N.push(Vi(S.path,S.params)+"/acknowledgement"),Promise.resolve()}catch(e){return Promise.reject(e)}},value:A})),l.createElement(i.Route,{path:Vi(S.path,S.params)+"/acknowledgement"},l.createElement(U,{data:A,onSuccess:()=>{E.invalidateQueries("WS_CREATE")},clearParams:O})),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Vi(S.path,S.params)+"/"+D.indexRoute})))},WSReSubmitDisconnectionApplication:()=>{var e,n,t;d.useQueryClient();const{t:a}=o.useTranslation(),r=i.useRouteMatch(),u=Digit.ULBService.getStateId();let s=[],{data:c}=Digit.Hooks.ws.useWSConfigMDMS.getFormConfig(u,{});return c=null!==(e=c)&&void 0!==e&&e.WSDisconnectionConfig?null===(n=c)||void 0===n?void 0:n.WSDisconnectionConfig:Zl,null===(t=c.filter(e=>"RE_SUBMIT_DISCONNECTION_APPLICATION"===e.head))||void 0===t||t.forEach(e=>{s=s.concat(e.body.filter(e=>!e.hideInCitizen))}),s.indexRoute="application-form",l.createElement(i.Switch,null,s.map((e,n)=>{const{component:t,texts:o,inputs:u,key:d,isSkipEnabled:s}=e,c="string"==typeof t?Digit.ComponentRegistryService.getComponent(t):t;return l.createElement(i.Route,{path:zi(r.path,r.params)+"/"+e.route,key:n},l.createElement(c,{config:{texts:o,inputs:u,key:d,isSkipEnabled:s},t:a,userType:"citizen"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:zi(r.path,r.params)+"/"+s.indexRoute})))},WNSMyBillsComponent:()=>{const{t:e}=o.useTranslation(),{path:n}=i.useRouteMatch(),a=t.useMemo(()=>Ki.map(n=>{const t={};for(const l in n.texts)t[l]=e(n.texts[l]);return v({},n,{texts:t})},[Ki]));return l.createElement(i.Switch,null,l.createElement(i.Route,{path:""+n,exact:!0},l.createElement(Xi,{template:a[0].labels,header:a[0].texts.header,actionButtonLabel:a[0].texts.actionButtonLabel,t:e})))},WSCheckPage:e=>{var n,t,r,u,d,s,c,v,p,m,E,S,_;let{onSubmit:f,value:g}=e;const{t:C}=o.useTranslation();i.useHistory(),i.useRouteMatch();let N=window.Digit.Utils.browser.isMobile();const{ConnectionHolderDetails:y,serviceName:D,waterConectionDetails:T,sewerageConnectionDetails:h,documents:A,cpt:I}=g;let O="/digit-ui/citizen/ws/create-application";function b(e){location.href=e}window.location.href.includes("/edit-application/")&&(O="/digit-ui/citizen/ws/edit-application/"+(null==g?void 0:g.tenantId));let L=[];var R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne;I&&null!=I&&I.details&&Object.keys(null==I?void 0:I.details).length>0&&(null!=I&&null!==(R=I.details)&&void 0!==R&&null!==(w=R.address)&&void 0!==w&&w.doorNo&&L.push(null==I||null===(V=I.details)||void 0===V||null===(z=V.address)||void 0===z?void 0:z.doorNo),null!=I&&null!==(W=I.details)&&void 0!==W&&null!==(P=W.address)&&void 0!==P&&P.street&&L.push(null==I||null===(Y=I.details)||void 0===Y||null===(G=Y.address)||void 0===G?void 0:G.street),null!=I&&null!==(M=I.details)&&void 0!==M&&null!==(x=M.address)&&void 0!==x&&x.landmark&&L.push(null==I||null===(q=I.details)||void 0===q||null===(K=q.address)||void 0===K?void 0:K.landmark),null!=I&&null!==(B=I.details)&&void 0!==B&&null!==(F=B.address)&&void 0!==F&&null!==(U=F.locality)&&void 0!==U&&U.code&&L.push(C(Digit.Utils.pt.getMohallaLocale(null==I||null===(X=I.details)||void 0===X||null===(Z=X.address)||void 0===Z||null===($=Z.locality)||void 0===$?void 0:$.code,null==I||null===(J=I.details)||void 0===J?void 0:J.tenantId))),null!=I&&null!==(k=I.details)&&void 0!==k&&k.tenantId&&L.push(C(Digit.Utils.pt.getCityLocale(null==I||null===(Q=I.details)||void 0===Q?void 0:Q.tenantId))),null!=I&&null!==(H=I.details)&&void 0!==H&&null!==(j=H.address)&&void 0!==j&&j.pincode&&L.push(null==I||null===(ee=I.details)||void 0===ee||null===(ne=ee.address)||void 0===ne?void 0:ne.pincode));const te=Array.isArray(null==I||null===(n=I.details)||void 0===n?void 0:n.owners)?null==I||null===(t=I.details)||void 0===t?void 0:t.owners.slice().reverse():[];return l.createElement(l.Fragment,null,l.createElement(Te,{currentStep:4}),l.createElement(a.Header,{styles:{fontSize:"32px"}},C("WS_COMMON_SUMMARY")),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_BASIC_DETAILS_HEADER")),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:C("WS_PROPERTY_ID_LABEL"),text:null==I||null===(r=I.details)||void 0===r?void 0:r.propertyId}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWNERS_NAME_LABEL"),text:C(null===(u=te[0])||void 0===u?void 0:u.name)}),l.createElement(a.Row,{className:"border-none",label:C("WS_COMMON_TABLE_COL_ADDRESS"),text:L.join(", ")}),l.createElement(a.Row,{className:"border-none",label:C("WS_CONNECTION_DETAILS_STATUS_LABEL"),text:C(null==I||null===(d=I.details)||void 0===d?void 0:d.status)})),l.createElement("div",{style:{textAlign:"left"}},l.createElement(i.Link,{to:"/digit-ui/citizen/commonpt/view-property?propertyId="+(null==I||null===(s=I.details)||void 0===s?void 0:s.propertyId)+"&tenantId="+(null==I||null===(c=I.details)||void 0===c?void 0:c.tenantId)},l.createElement(a.LinkButton,{style:{textAlign:"left"},label:C("PT_VIEW_PROPERTY")})))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{position:"relative"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_COMMON_CONNECTION_HOLDER_DETAILS_HEADER")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-10px",float:"right",position:"relative",bottom:"32px",marginRight:"-10px"}}),style:{width:"100px",display:"inline"},onClick:()=>b(O+"/connection-holder")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:N?{marginRight:"-5px"}:{},label:C("WS_OWN_MOBILE_NO"),text:null==y?void 0:y.mobileNumber}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_NAME"),text:null==y?void 0:y.name}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_GENDER_LABEL"),text:C(null==y||null===(v=y.gender)||void 0===v?void 0:v.i18nKey)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_FATHERS_HUSBAND_NAME"),text:(null==y?void 0:y.guardian)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_CONN_HOLDER_OWN_DETAIL_RELATION_LABEL"),text:C(null==y||null===(p=y.relationship)||void 0===p?void 0:p.i18nKey)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_CROSADD"),text:(null==y?void 0:y.address)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_OWN_DETAIL_SPECIAL_APPLICANT_LABEL"),text:C(null==y||null===(m=y.specialCategoryType)||void 0===m?void 0:m.i18nKey)||C("CS_NA")}),l.createElement(a.Row,{className:"border-none",label:C("WS_EMAIL_ID"),text:(null==y?void 0:y.emailId)||C("CS_NA")}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{position:"relative"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_COMMON_CONNECTION_DETAIL")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-10px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>b(O+"/service-name")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",textStyle:N?{marginRight:"-10px"}:{},label:C("WS_SERVICE_NAME_LABEL"),text:C(null==D?void 0:D.i18nKey)}),T&&(null===(E=Object.keys(T))||void 0===E?void 0:E.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:C("WS_NO_OF_TAPS_PROPOSED"),text:null==T?void 0:T.proposedTaps}),l.createElement(a.Row,{className:"border-none",label:C("WS_SERV_DETAIL_PIPE_SIZE"),text:C(null==T||null===(S=T.proposedPipeSize)||void 0===S?void 0:S.i18nKey)})),h&&(null===(_=Object.keys(h))||void 0===_?void 0:_.length)>0&&l.createElement("div",null,l.createElement(a.Row,{className:"border-none",label:C("WS_NO_OF_WATER_CLOSETS"),text:null==h?void 0:h.proposedWaterClosets}),l.createElement(a.Row,{className:"border-none",label:C("WS_SERV_DETAIL_NO_OF_TOILETS"),text:null==h?void 0:h.proposedToilets})))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{position:"relative"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},C("WS_COMMON_DOCUMENT_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-10px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>b(O+"/document-details")})),A&&(null==A?void 0:A.documents.map((e,n)=>{var t;return l.createElement("div",{key:"doc-"+n},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,C(null==e||null===(t=e.documentType)||void 0===t?void 0:t.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:g,Code:null==e?void 0:e.documentType,index:n}),(null==A?void 0:A.documents.length)!=n+1?l.createElement("hr",{style:{color:"white",backgroundColor:"white",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))}))),l.createElement(a.SubmitBar,{label:C("CS_COMMON_SUBMIT"),onSubmit:f,style:{marginLeft:"10px",maxWidth:"95%"}}))},WSAcknowledgement:e=>{var n,r,u,d,s,c,p,m,E,S;let{data:_,onSuccess:f,clearParams:g}=e;const{t:C}=o.useTranslation(),[y,D,T]=Digit.Hooks.useSessionStorage("CITIZEN_TL_MUTATION_HAPPENED",!1),h=(Digit.ULBService.getCurrentTenantId(),Digit.Hooks.ws.useWSUpdateAPI("WATER")),A=Digit.Hooks.ws.useWSUpdateAPI("SEWERAGE");let I=window.location.href.includes("/edit-application/")||window.location.href.includes("/modify-connection/");const{data:O}=Digit.Hooks.useStore.getInitData(),{tenants:b}=O||{};return Digit.ULBService.getStateId(),t.useEffect(()=>{"true"!==sessionStorage.getItem("isCreateEnabled")?window.history.forward():sessionStorage.removeItem("isCreateEnabled")}),t.useEffect(()=>{try{var e,n;let o;if("WATER"===(null==_||null===(e=_.serviceName)||void 0===e?void 0:e.code)||"BOTH"===(null==_||null===(n=_.serviceName)||void 0===n?void 0:n.code)){var t,l;o=(null==_||null===(t=_.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.tenantId)||o;let e=I?(e=>{var n,t,l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P;let M=null==e||null===(n=e.WaterConnectionResult)||void 0===n||null===(t=n.WaterConnection)||void 0===t?void 0:t[0],x={WaterConnection:{id:null!=e&&e.isEditApplication?null==e?void 0:e.id:null==M?void 0:M.id,tenantId:null!=e&&e.isEditApplication?null==e?void 0:e.tenantId:null==M?void 0:M.tenantId,propertyId:null!=e&&e.isEditApplication?null==e?void 0:e.propertyId:null==M?void 0:M.propertyId,applicationNo:null!=e&&e.isEditApplication?null==e?void 0:e.applicationNo:null==M?void 0:M.applicationNo,applicationStatus:null!=e&&e.isEditApplication?null==e?void 0:e.applicationStatus:null==M?void 0:M.applicationStatus,status:null!=e&&e.isEditApplication?null==e?void 0:e.status:null==M?void 0:M.status,connectionNo:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionNo:null==M?void 0:M.connectionNo)||null,oldConnectionNo:null,documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],plumberInfo:null!=e&&e.isEditApplication?null==e?void 0:e.plumberInfo:(null==M?void 0:M.plumberInfo)||[],roadType:null,roadCuttingArea:null,roadCuttingInfo:[],connectionExecutionDate:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionExecutionDate:null==M?void 0:M.connectionExecutionDate)||null,connectionCategory:null,connectionType:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionType:null==M?void 0:M.connectionType)||null,additionalDetails:v({},null!=e&&e.isEditApplication?null==e?void 0:e.additionalDetails:null==M?void 0:M.additionalDetails),auditDetails:null!=e&&e.isEditApplication?null==e?void 0:e.auditDetails:null==M?void 0:M.auditDetails,processInstance:null!=e&&e.isEditApplication?v({},null==e?void 0:e.processInstance,{action:"RESUBMIT_APPLICATION"}):v({},null==M?void 0:M.processInstance,{action:"SUBMIT_APPLICATION"}),applicationType:null!=e&&e.isEditApplication?null==e?void 0:e.applicationType:"MODIFY_WATER_CONNECTION",dateEffectiveFrom:N(Date.now()+864e5),connectionHolders:null!=e&&e.isEditApplication?null!=e&&null!==(o=e.ConnectionHolderDetails)&&void 0!==o&&o.isOwnerSame?null:[{correspondenceAddress:(null==e||null===(i=e.ConnectionHolderDetails)||void 0===i?void 0:i.address)||"",fatherOrHusbandName:(null==e||null===(a=e.ConnectionHolderDetails)||void 0===a?void 0:a.guardian)||"",gender:(null==e||null===(r=e.ConnectionHolderDetails)||void 0===r||null===(u=r.gender)||void 0===u?void 0:u.code)||"",mobileNumber:(null==e||null===(d=e.ConnectionHolderDetails)||void 0===d?void 0:d.mobileNumber)||"",name:(null==e||null===(s=e.ConnectionHolderDetails)||void 0===s?void 0:s.name)||"",emailId:(null==e||null===(c=e.ConnectionHolderDetails)||void 0===c?void 0:c.emailId)||"",ownerType:(null==e||null===(p=e.ConnectionHolderDetails)||void 0===p||null===(m=p.specialCategoryType)||void 0===m?void 0:m.code)||"",relationship:(null==e||null===(E=e.ConnectionHolderDetails)||void 0===E||null===(S=E.relationship)||void 0===S?void 0:S.code)||"",sameAsPropertyAddress:null==e||null===(_=e.ConnectionHolderDetails)||void 0===_?void 0:_.sameAsOwnerDetails}]:null==M?void 0:M.connectionHolders,oldApplication:!1,channel:"CITIZEN",waterSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSource:null==M?void 0:M.waterSource)||null,meterId:(null!=e&&e.isEditApplication?null==e?void 0:e.meterId:null==M?void 0:M.meterId)||null,meterInstallationDate:(null!=e&&e.isEditApplication?null==e?void 0:e.meterInstallationDate:null==M?void 0:M.meterInstallationDate)||null,proposedPipeSize:null==e||null===(f=e.waterConectionDetails)||void 0===f||null===(g=f.proposedPipeSize)||void 0===g?void 0:g.code,proposedTaps:null==e||null===(C=e.waterConectionDetails)||void 0===C?void 0:C.proposedTaps,pipeSize:(null!=e&&e.isEditApplication?null==e?void 0:e.pipeSize:null==M?void 0:M.pipeSize)||null,noOfTaps:(null!=e&&e.isEditApplication?null==e?void 0:e.noOfTaps:null==M?void 0:M.noOfTaps)||null,waterSourceSubSource:null,waterSubSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSubSource:null==M?void 0:M.waterSubSource)||null,property:v({},null!=e&&e.isEditApplication?null==e?void 0:e.property:null==M?void 0:M.property),water:!(null==e||null===(y=e.applicationType)||void 0===y||!y.includes("WATER")),sewerage:!(null==e||null===(D=e.applicationType)||void 0===D||!D.includes("WATER")),service:null!=e&&e.isEditApplication?null==e||null===(T=e.serviceName)||void 0===T?void 0:T.code:null==M||null===(h=M.serviceName)||void 0===h?void 0:h.code,reviewDocData:[...null==e||null===(A=e.documents)||void 0===A?void 0:A.documents],proposedWaterClosets:null==e||null===(I=e.sewerageConnectionDetails)||void 0===I?void 0:I.proposedWaterClosets,proposedToilets:null==e||null===(O=e.sewerageConnectionDetails)||void 0===O?void 0:O.proposedToilets,comment:"",wfDocuments:[],assignee:[],action:null!=e&&e.isEditApplication?"RESUBMIT_APPLICATION":"SUBMIT_APPLICATION",assignes:[]}};return x=null!==(b=Digit)&&void 0!==b&&null!==(L=b.Customizations)&&void 0!==L&&null!==(R=L.WS)&&void 0!==R&&R.customiseEditWSUpdate?null===(w=Digit)||void 0===w||null===(W=w.Customizations)||void 0===W||null===(P=W.WS)||void 0===P?void 0:P.customiseEditWSUpdate(e,x):x,x})(_):(e=>{var n,t,l,o,i,a,r,u,d;let s={WaterConnection:v({},null==e||null===(n=e.WaterConnectionResult)||void 0===n||null===(t=n.WaterConnection)||void 0===t?void 0:t[0],{documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],processInstance:{action:"SUBMIT_APPLICATION"}})};return s=null!==(o=Digit)&&void 0!==o&&null!==(i=o.Customizations)&&void 0!==i&&null!==(a=i.WS)&&void 0!==a&&a.customiseWSUpdate?null===(r=Digit)||void 0===r||null===(u=r.Customizations)||void 0===u||null===(d=u.WS)||void 0===d?void 0:d.customiseWSUpdate(e,s):s,s})(_);const n=v({},e,{disconnectRequest:!1,reconnectRequest:!1});h.mutate(n,{onSuccess:f})}}catch(e){}},[_]),t.useEffect(()=>{var e,n;if("SEWERAGE"===(null==_||null===(e=_.serviceName)||void 0===e?void 0:e.code)||"BOTH"===(null==_||null===(n=_.serviceName)||void 0===n?void 0:n.code)&&h.isSuccess){let e=I?(e=>{var n,t,l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,y,D,T,h,A,I,O,b,L,R,w,W,P;let M=null==e||null===(n=e.SewerageConnectionResult)||void 0===n||null===(t=n.SewerageConnections)||void 0===t?void 0:t[0],x={SewerageConnection:{id:null!=e&&e.isEditApplication?null==e?void 0:e.id:null==M?void 0:M.id,tenantId:null!=e&&e.isEditApplication?null==e?void 0:e.tenantId:null==M?void 0:M.tenantId,propertyId:null!=e&&e.isEditApplication?null==e?void 0:e.propertyId:null==M?void 0:M.propertyId,applicationNo:null!=e&&e.isEditApplication?null==e?void 0:e.applicationNo:null==M?void 0:M.applicationNo,applicationStatus:null!=e&&e.isEditApplication?null==e?void 0:e.applicationStatus:null==M?void 0:M.applicationStatus,status:null!=e&&e.isEditApplication?null==e?void 0:e.status:null==M?void 0:M.status,connectionNo:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionNo:null==M?void 0:M.connectionNo)||null,oldConnectionNo:null,documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],plumberInfo:null!=e&&e.isEditApplication?null==e?void 0:e.plumberInfo:(null==M?void 0:M.plumberInfo)||[],roadType:null,roadCuttingArea:null,roadCuttingInfo:[],connectionExecutionDate:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionExecutionDate:null==M?void 0:M.connectionExecutionDate)||null,connectionCategory:null,connectionType:(null!=e&&e.isEditApplication?null==e?void 0:e.connectionType:null==M?void 0:M.connectionType)||null,additionalDetails:v({},null!=e&&e.isEditApplication?null==e?void 0:e.additionalDetails:null==M?void 0:M.additionalDetails),auditDetails:null!=e&&e.isEditApplication?null==e?void 0:e.auditDetails:null==M?void 0:M.auditDetails,processInstance:null!=e&&e.isEditApplication?v({},null==e?void 0:e.processInstance,{action:"RESUBMIT_APPLICATION"}):v({},null==M?void 0:M.processInstance,{action:"SUBMIT_APPLICATION"}),applicationType:null!=e&&e.isEditApplication?null==e?void 0:e.applicationType:"MODIFY_WATER_CONNECTION",dateEffectiveFrom:N(Date.now()+864e5),connectionHolders:null!=e&&e.isEditApplication?null!=e&&null!==(o=e.ConnectionHolderDetails)&&void 0!==o&&o.isOwnerSame?null:[{correspondenceAddress:(null==e||null===(i=e.ConnectionHolderDetails)||void 0===i?void 0:i.address)||"",fatherOrHusbandName:(null==e||null===(a=e.ConnectionHolderDetails)||void 0===a?void 0:a.guardian)||"",gender:(null==e||null===(r=e.ConnectionHolderDetails)||void 0===r||null===(u=r.gender)||void 0===u?void 0:u.code)||"",mobileNumber:(null==e||null===(d=e.ConnectionHolderDetails)||void 0===d?void 0:d.mobileNumber)||"",name:(null==e||null===(s=e.ConnectionHolderDetails)||void 0===s?void 0:s.name)||"",emailId:(null==e||null===(c=e.ConnectionHolderDetails)||void 0===c?void 0:c.emailId)||"",ownerType:(null==e||null===(p=e.ConnectionHolderDetails)||void 0===p||null===(m=p.specialCategoryType)||void 0===m?void 0:m.code)||"",relationship:(null==e||null===(E=e.ConnectionHolderDetails)||void 0===E||null===(S=E.relationship)||void 0===S?void 0:S.code)||"",sameAsPropertyAddress:null==e||null===(_=e.ConnectionHolderDetails)||void 0===_?void 0:_.sameAsOwnerDetails}]:null==M?void 0:M.connectionHolders,oldApplication:!1,channel:"CITIZEN",waterSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSource:null==M?void 0:M.waterSource)||null,meterId:(null!=e&&e.isEditApplication?null==e?void 0:e.meterId:null==M?void 0:M.meterId)||null,meterInstallationDate:(null!=e&&e.isEditApplication?null==e?void 0:e.meterInstallationDate:null==M?void 0:M.meterInstallationDate)||null,proposedPipeSize:null==e||null===(f=e.waterConectionDetails)||void 0===f||null===(g=f.proposedPipeSize)||void 0===g?void 0:g.code,proposedTaps:null==e||null===(C=e.waterConectionDetails)||void 0===C?void 0:C.proposedTaps,pipeSize:(null!=e&&e.isEditApplication?null==e?void 0:e.pipeSize:null==M?void 0:M.pipeSize)||null,noOfTaps:(null!=e&&e.isEditApplication?null==e?void 0:e.noOfTaps:null==M?void 0:M.noOfTaps)||null,waterSourceSubSource:null,waterSubSource:(null!=e&&e.isEditApplication?null==e?void 0:e.waterSubSource:null==M?void 0:M.waterSubSource)||null,property:v({},null!=e&&e.isEditApplication?null==e?void 0:e.property:null==M?void 0:M.property),water:!(null==e||null===(y=e.applicationType)||void 0===y||!y.includes("WATER")),sewerage:!(null==e||null===(D=e.applicationType)||void 0===D||!D.includes("WATER")),service:null!=e&&e.isEditApplication?null==e||null===(T=e.serviceName)||void 0===T?void 0:T.code:null==M||null===(h=M.serviceName)||void 0===h?void 0:h.code,reviewDocData:[...null==e||null===(A=e.documents)||void 0===A?void 0:A.documents],proposedWaterClosets:null==e||null===(I=e.sewerageConnectionDetails)||void 0===I?void 0:I.proposedWaterClosets,proposedToilets:null==e||null===(O=e.sewerageConnectionDetails)||void 0===O?void 0:O.proposedToilets,comment:"",wfDocuments:[],assignee:[],action:null!=e&&e.isEditApplication?"RESUBMIT_APPLICATION":"SUBMIT_APPLICATION",assignes:[]}};return x=null!==(b=Digit)&&void 0!==b&&null!==(L=b.Customizations)&&void 0!==L&&null!==(R=L.WS)&&void 0!==R&&R.customiseEditSWUpdate?null===(w=Digit)||void 0===w||null===(W=w.Customizations)||void 0===W||null===(P=W.WS)||void 0===P?void 0:P.customiseEditSWUpdate(e,x):x,x})(_):(e=>{var n,t,l,o,i,a,r,u,d;let s={SewerageConnection:v({},null==e||null===(n=e.SewerageConnectionResult)||void 0===n||null===(t=n.SewerageConnections)||void 0===t?void 0:t[0],{connectionType:"Non Metered",documents:[...null==e||null===(l=e.documents)||void 0===l?void 0:l.documents],processInstance:{action:"SUBMIT_APPLICATION"}})};return s=null!==(o=Digit)&&void 0!==o&&null!==(i=o.Customizations)&&void 0!==i&&null!==(a=i.WS)&&void 0!==a&&a.customiseSWUpdate?null===(r=Digit)||void 0===r||null===(u=r.Customizations)||void 0===u||null===(d=u.WS)||void 0===d?void 0:d.customiseSWUpdate(e,s):s,s})(_);const n=v({},e,{disconnectRequest:!1,reconnectRequest:!1});A.mutate(n,{onSuccess:f})}},[_,h.isSuccess]),("WATER"===(null==_||null===(n=_.serviceName)||void 0===n?void 0:n.code)?h.isLoading||h.isIdle:"SEWERAGE"===(null==_||null===(r=_.serviceName)||void 0===r?void 0:r.code)?A.isLoading||A.isIdle:h.isLoading||h.isIdle||A.isLoading||A.isIdle)?l.createElement(a.Loader,null):l.createElement(a.Card,null,l.createElement(qi,{t:C,clearParams:g,Waterdata:h.data,Seweragedata:A.data,isSuccess:"WATER"===(null==_||null===(u=_.serviceName)||void 0===u?void 0:u.code)?h.isSuccess:A.isSuccess,isLoading:"WATER"===(null==_||null===(d=_.serviceName)||void 0===d?void 0:d.code)?h.isLoading||h.isIdle:"SEWERAGE"===(null==_||null===(s=_.serviceName)||void 0===s?void 0:s.code)?A.isLoading||A.isIdle:h.isLoading||h.isIdle||A.isLoading||A.isIdle}),("WATER"===(null==_||null===(c=_.serviceName)||void 0===c?void 0:c.code)?h.isSuccess:A.isSuccess)&&l.createElement(a.CardText,null,C("WS_FILE_RESPONSE")),("WATER"===(null==_||null===(p=_.serviceName)||void 0===p?void 0:p.code)||"BOTH"===(null==_||null===(m=_.serviceName)||void 0===m?void 0:m.code))&&h.isSuccess&&l.createElement(a.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},C("WS_PRINT_WATER_APPLICATION_LABEL"))),onClick:()=>{var e,n,t;const l=null==h||null===(e=h.data)||void 0===e||null===(n=e.WaterConnection)||void 0===n?void 0:n[0],o=b.find(e=>{var n,t;return e.code===(null==_||null===(n=_.cpt)||void 0===n||null===(t=n.details)||void 0===t?void 0:t.tenantId)});Z(v({},l),v({},null==_||null===(t=_.cpt)||void 0===t?void 0:t.details),null==o?void 0:o.code,C).then(e=>Digit.Utils.pdf.generatev1(e))}}),("SEWERAGE"===(null==_||null===(E=_.serviceName)||void 0===E?void 0:E.code)||"BOTH"===(null==_||null===(S=_.serviceName)||void 0===S?void 0:S.code))&&A.isSuccess&&l.createElement(a.LinkButton,{label:l.createElement("div",{className:"response-download-button"},l.createElement("span",null,l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"#a82227"},l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}))),l.createElement("span",{className:"download-button"},C("WS_PRINT_SEWERAGE_APPLICATION_LABEL"))),onClick:()=>{var e,n,t;const l=null==A||null===(e=A.data)||void 0===e||null===(n=e.SewerageConnections)||void 0===n?void 0:n[0],o=b.find(e=>{var n,t;return e.code===(null==_||null===(n=_.cpt)||void 0===n||null===(t=n.details)||void 0===t?void 0:t.tenantId)});Z(v({},l),v({},null==_||null===(t=_.cpt)||void 0===t?void 0:t.details),null==o?void 0:o.code,C).then(e=>Digit.Utils.pdf.generatev1(e))}}),l.createElement(i.Link,{to:{pathname:"/digit-ui/citizen"}},l.createElement(a.SubmitBar,{label:C("CORE_COMMON_GO_TO_HOME")})))},WSDisconnectionCheckPage:()=>{const{t:e}=o.useTranslation(),n=i.useHistory(),r=(i.useRouteMatch(),Digit.SessionStorage.get("WS_DISCONNECTION")),[u,d]=t.useState(r.WSDisconnectionForm.documents||[]);let s="/digit-ui/citizen/ws/disconnect-application";function c(e){location.href=e}window.location.href.includes("/edit-application/")&&(s="/digit-ui/citizen/ws/edit-disconnect-application");const[p,m]=t.useState(!1),{mutate:E}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:S}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:_}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:g}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),C=()=>{setShowToast(null)};return p?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},e("WS_COMMON_SUMMARY")),l.createElement(Ft,{currentStep:3}),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},e("WS_DISCONNECTION_APPLICATION_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>c(s+"/application-form")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_CONSUMER_NUMBER"),text:r.connectionNo}),l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_TYPE"),text:e(r.WSDisconnectionForm.type.value.i18nKey)}),l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_PROPOSED_DATE"),text:f(N(r.WSDisconnectionForm.date))}),"Temporary"==r.WSDisconnectionForm.type.value.code?l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_PROPOSED_END_DATE"),text:f(N(r.WSDisconnectionForm.endDate))}):"",l.createElement(a.Row,{className:"border-none",label:e("WS_DISCONNECTION_REASON"),text:e(r.WSDisconnectionForm.reason.value.i18nKey)}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},e("WS_COMMON_DOCUMENT_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>c(s+"/documents-upload")})),u&&(null==u?void 0:u.map((n,t)=>{var o;return l.createElement("div",{key:"doc-"+t},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,e(null==n||null===(o=n.documentType)||void 0===o?void 0:o.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:{documents:r.WSDisconnectionForm},Code:null==n?void 0:n.documentType,index:t,showFileName:!0}),(null==u?void 0:u.length)!=t+1?l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))})),l.createElement(a.SubmitBar,{label:e("CS_COMMON_SUBMIT"),onSubmit:()=>function(e){try{return Promise.resolve(A(e,{applicationData:r},r.serviceType)).then(function(e){const t=function(t){if(null!=e&&null!==(t=e.WaterConnection)&&void 0!==t&&t.water){var l;null!==(l=e.WaterConnection)&&void 0!==l&&l.isDisconnectionTemporary&&(e.WaterConnection.endDate=N(r.WSDisconnectionForm.endDate)||"");const t=function(){if(E)return m(!0),Promise.resolve(E(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(I(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){let t={WaterConnection:e};return t=v({},t,{disconnectRequest:!0}),Promise.resolve(S(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/disconnect-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}else{const t=function(t){if(null!=e&&null!==(t=e.SewerageConnection)&&void 0!==t&&t.sewerage){e.SewerageConnection.isDisconnectionTemporary&&(e.SewerageConnection.endDate=N(r.WSDisconnectionForm.endDate)||"");const t=function(){if(_)return m(!0),Promise.resolve(_(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(I(null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0],"SEWERAGE")).then(function(e){let t={SewerageConnection:e};return t=v({},t,{disconnectRequest:!0}),Promise.resolve(g(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/disconnect-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}}(null==r?void 0:r.WSDisconnectionForm)})))},WSRestorationCheckPage:()=>{const{t:e}=o.useTranslation(),n=i.useHistory(),r=(i.useRouteMatch(),Digit.SessionStorage.get("WS_DISCONNECTION")),[u,d]=t.useState(r.WSDisconnectionForm.documents||[]),[s,c]=t.useState(null),[p,m]=t.useState(!1),{mutate:E}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:S}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:_}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:g}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),C=()=>{setShowToast(null)};return p?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},e("WS_COMMON_SUMMARY")),l.createElement(Ft,{currentStep:3}),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},e("WS_RESTORATION_APPLICATION_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>{location.href="/digit-ui/citizen/ws/restoration-application/application-form"}})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:e("WS_RESTORATION_CONSUMER_NUMBER"),text:r.connectionNo}),l.createElement(a.Row,{className:"border-none",label:e("WS_RESTORATION_PROPOSED_DATE"),text:f(N(r.WSDisconnectionForm.date))}),l.createElement(a.Row,{className:"border-none",label:e("WS_RESTORATION_REASON"),text:r.WSDisconnectionForm.reason.value}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement(a.SubmitBar,{label:e("CS_COMMON_SUBMIT"),onSubmit:()=>function(e){try{return Promise.resolve(A(e,{applicationData:r},r.serviceType)).then(function(e){const t=function(t){if(null!=e&&null!==(t=e.WaterConnection)&&void 0!==t&&t.water){e.WaterConnection.isdisconnection=!1,e.WaterConnection.reconnectionReason=e.WaterConnection.disconnectionReason,e.WaterConnection.disconnectionReason="",e.WaterConnection.isDisconnectionTemporary=!0,e.reconnectRequest=!0,e.disconnectRequest=!1;const t=function(){if(E)return m(!0),Promise.resolve(E(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(O(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){let t={WaterConnection:e};return t=v({},t,{disconnectRequest:!1,reconnectRequest:!0}),Promise.resolve(S(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/restoration-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}else{const t=function(t){if(null!=e&&null!==(t=e.SewerageConnection)&&void 0!==t&&t.sewerage){e.SewerageConnection.isdisconnection=!1,e.SewerageConnection.reconnectionReason=e.SewerageConnection.disconnectionReason,e.SewerageConnection.disconnectionReason="",e.SewerageConnection.isDisconnectionTemporary=!0,e.reconnectRequest=!0,e.disconnectRequest=!1;const t=function(){if(_)return m(!0),Promise.resolve(_(e,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(O(null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0],"SEWERAGE")).then(function(e){let t={SewerageConnection:e};return t=v({},t,{disconnectRequest:!1,reconnectRequest:!0}),Promise.resolve(g(t,{onError:(e,n)=>{var t,l,o,i,a,r;m(!1),c({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(C,5e3)},onSuccess:(e,t)=>{var l;Digit.SessionStorage.set("WS_DISCONNECTION",v({},r,{DisconnectionResponse:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0]})),n.push("/digit-ui/citizen/ws/restoration-acknowledge")}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}}(null==r?void 0:r.WSDisconnectionForm)})),s&&l.createElement(a.Toast,{error:"error"===(null==s?void 0:s.key),label:e(null==s?void 0:s.message),onClose:()=>c(null)}))},WSReSubmitDisconnectionCheckPage:()=>{var e;const{t:n}=o.useTranslation(),r=i.useHistory(),u=(i.useRouteMatch(),Digit.SessionStorage.get("WS_DISCONNECTION")),[d,s]=t.useState(u.WSDisconnectionForm.documents||[]);let c="/digit-ui/citizen/ws/resubmit-disconnect-application";function p(e){location.href=e}window.location.href.includes("/resubmit")&&(c="/digit-ui/citizen/ws/resubmit-disconnect-application");const[m,E]=t.useState(!1),{mutate:S}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:_}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),g=()=>{setShowToast(null)};return m?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement(a.Header,{styles:{fontSize:"32px"}},n("WS_COMMON_SUMMARY")),l.createElement(Ft,{currentStep:3}),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},n("WS_DISCONNECTION_APPLICATION_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>p(c+"/application-form")})),l.createElement(a.StatusTable,null,l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_CONSUMER_NUMBER"),text:u.connectionNo||(null==u||null===(e=u.applicationData)||void 0===e?void 0:e.connectionNo)}),l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_TYPE"),text:n(u.WSDisconnectionForm.type.value.i18nKey)}),l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_PROPOSED_DATE"),text:f(N(u.WSDisconnectionForm.date))}),l.createElement(a.Row,{className:"border-none",label:n("WS_DISCONNECTION_REASON"),text:u.WSDisconnectionForm.reason.value}))),l.createElement(a.Card,{style:{paddingRight:"16px"}},l.createElement("div",{style:{display:"inline"}},l.createElement(a.CardHeader,{styles:{fontSize:"28px"}},n("WS_COMMON_DOCUMENT_DETAILS")),l.createElement(a.LinkButton,{label:l.createElement(a.EditIcon,{style:{marginTop:"-20px",float:"right",position:"relative",bottom:"32px"}}),style:{width:"100px",display:"inline"},onClick:()=>p(c+"/documents-upload")})),d&&(null==d?void 0:d.map((e,t)=>{var o;return l.createElement("div",{key:"doc-"+t},l.createElement("div",null,l.createElement(a.CardSectionHeader,null,n(null==e||null===(o=e.documentType)||void 0===o?void 0:o.split(".").slice(0,2).join("_"))),l.createElement(a.StatusTable,null,l.createElement(Li,{value:{documents:u.WSDisconnectionForm},Code:null==e?void 0:e.documentType,index:t,showFileName:!0}),(null==d?void 0:d.length)!=t+1?l.createElement("hr",{style:{color:"#cccccc",backgroundColor:"#cccccc",height:"2px",marginTop:"20px",marginBottom:"20px"}}):null)))})),l.createElement(a.SubmitBar,{label:n("CS_COMMON_SUBMIT"),onSubmit:()=>function(e){try{return Promise.resolve(function(e,n,t){try{var l,o,i,a,r,u,d,s,c,p,m,E,S,_;Digit.UserService.getType();let f={WaterConnection:v({},null==n?void 0:n.applicationData,{dateEffectiveFrom:N(null==e?void 0:e.date),isDisconnectionTemporary:"Temporary"===(null==e||null===(l=e.type)||void 0===l||null===(o=l.value)||void 0===o?void 0:o.code),disconnectionReason:null==e||null===(i=e.reason.value)||void 0===i?void 0:i.code,documents:null==e?void 0:e.documents,water:!0,sewerage:!1,service:"Water",processInstance:v({},null==n||null===(a=n.applicationData)||void 0===a?void 0:a.processInstance,{action:"RESUBMIT_APPLICATION"}),channel:"CITIZEN"}),disconnectRequest:!0};n.applicationData.connectionType&&(n.applicationData.meterInstallationDate&&(f.WaterConnection.meterInstallationDate=n.applicationData.meterInstallationDate),n.applicationData.meterId&&(f.WaterConnection.meterId=n.applicationData.meterId));let g={SewerageConnection:v({},null==n?void 0:n.applicationData,{dateEffectiveFrom:N(null==e?void 0:e.date),isdisconnection:!0,isDisconnectionTemporary:"Temporary"===(null==e||null===(r=e.type)||void 0===r||null===(u=r.value)||void 0===u?void 0:u.code),disconnectionReason:null==e||null===(d=e.reason.value)||void 0===d?void 0:d.code,documents:null==e?void 0:e.documents,water:!1,sewerage:!0,service:"Sewerage",processInstance:v({},null==n||null===(s=n.applicationData)||void 0===s?void 0:s.processInstance,{action:"RESUBMIT_APPLICATION"}),channel:"CITIZEN"}),disconnectRequest:!0},C="WATER"===t?f:g;return C=null!==(c=Digit)&&void 0!==c&&null!==(p=c.Customizations)&&void 0!==p&&null!==(m=p.WS)&&void 0!==m&&m.customiseCreatePayloadOfWSReSubmitDisconnection?null===(E=Digit)||void 0===E||null===(S=E.Customizations)||void 0===S||null===(_=S.WS)||void 0===_?void 0:_.customiseCreatePayloadOfWSReSubmitDisconnection(e,C,t):C,Promise.resolve(C)}catch(e){return Promise.reject(e)}}(e,u,u.serviceType)).then(function(e){const n=function(n){if(null!=e&&null!==(n=e.WaterConnection)&&void 0!==n&&n.water){const n=function(){if(S)return E(!0),Promise.resolve(S(e,{onError:(e,n)=>{var t,l,o,i,a,r;E(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(g,5e3)},onSuccess:function(e,n){try{var t,l,o;return Digit.SessionStorage.set("WS_DISCONNECTION",v({},null==u?void 0:u.applicationData,null==u?void 0:u.WSDisconnectionForm,{DisconnectionResponse:null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]})),r.push("/digit-ui/citizen/ws/disconnect-acknowledge?applicationNumber="+(null==e||null===(l=e.WaterConnection)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo)),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}else{const n=function(n){if(null!=e&&null!==(n=e.SewerageConnection)&&void 0!==n&&n.sewerage){const n=function(){if(_)return E(!0),Promise.resolve(_(e,{onError:(e,n)=>{var t,l,o,i,a,r;E(!1),setError({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(g,5e3)},onSuccess:function(e,n){try{var t,l,o;return Digit.SessionStorage.set("WS_DISCONNECTION",v({},null==u?void 0:u.applicationData,null==u?void 0:u.WSDisconnectionForm,{DisconnectionResponse:null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0]})),r.push("/digit-ui/citizen/ws/disconnect-acknowledge?applicationNumber="+(null==e||null===(l=e.SewerageConnections)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.applicationNo)),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})}}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}(null==u?void 0:u.WSDisconnectionForm)})))},WSApplicationBillAmendment:()=>{var e,n,u,d,s,c,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O;const[b,L]=t.useState(null),{t:R}=o.useTranslation(),{connectionNumber:w,tenantId:W,isEdit:P}=Digit.Hooks.useQueryParams(),M=Digit.ULBService.getStateId();let{state:x}=i.useLocation();x=x?"string"==typeof x?JSON.parse(x):x:{};const[B,F]=t.useState(""),[U,k]=t.useState(!1),[H,j]=t.useState(!1);let V=window.Digit.Utils.browser.isMobile(),z=window.location.href.includes("/employee");const{isLoading:Y,data:G}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSMDMSBillAmendment({tenantId:M}),q=w.includes("WS")?"WS":"SW",K={tenantId:W,consumerCode:w,service:q},{data:X,isLoading:Z}=Digit.Hooks.usePaymentSearch(W,K),{data:$}=Digit.Hooks.fsm.useMDMS(M,"DIGIT-UI","WSTaxHeadMaster"),J=null==$||null===(e=$.BillingService)||void 0===e||null===(n=e.TaxHeadMaster)||void 0===n?void 0:n.filter(e=>e.IsBillamend);let Q=null==X?void 0:X.filter(e=>null==J?void 0:J.find(n=>n.code===e.taxHeadCode));null==$||null===(u=$.BillingService)||void 0===u||null===(d=u.TaxHeadMaster)||void 0===d||d.filter(e=>e.code.includes("ADHOC")&&e.IsBillamend&&e.service===q);const ee=r.useForm({defaultValues:v({},null===(s=x)||void 0===s||null===(c=s.data)||void 0===c||null===(m=c.applicationDetails)||void 0===m||null===(E=m.amendment)||void 0===E||null===(S=E.additionalDetails)||void 0===S?void 0:S.editForm)}),{register:ne,control:te,watch:le,setValue:oe,handleSubmit:ie,formState:{errors:ae},getValues:re}=ee,{mutate:ue}=(p(ee.formState,$i),p(ee,Zi),Digit.Hooks.ws.useApplicationActionsBillAmendUpdate()),[de,se]=t.useState(!1),ce=le("effectivefrom"),ve=le("amendmentReason"),pe=le("WS_REDUCED_AMOUNT"),me=le("WS_ADDITIONAL_AMOUNT"),Ee=le("SW_REDUCED_AMOUNT"),Se=le("SW_ADDITIONAL_AMOUNT"),_e=i.useHistory();t.useEffect(()=>ge({type:"updateAmendmentReason",payload:ve}),[ve]);const[fe,ge]=t.useReducer(function(e,n){var t,l;switch(n.type){case"upload":return e.map(e=>e.documentType===n.payload.id?v({},e,{url:n.payload.url}):e);case"remove":return e.map(e=>{let t=e;return e.documentType===n.payload.id&&(delete t.url,delete t.loader),t});case"addLoader":return e.map(e=>e.documentType===n.payload.id?v({},e,{loader:!0}):e);case"removeLoader":return e.map(e=>e.documentType===n.payload.id?v({},e,{loader:!1}):e);case"updateAmendmentReason":return null===(t=n.payload)||void 0===t||null===(l=t.allowedDocuments)||void 0===l?void 0:l.allowedDocs;default:return e}},[]),Ce=e=>{oe(e,{VALUE:!1})},Ne=e=>{var n,t,l,o,i,a,r,u;let d;const s=void 0!==(null==e||null===(n=e[q+"_REDUCED_AMOUNT"])||void 0===n?void 0:n.VALUE)&&null!=e&&null!==(t=e[q+"_REDUCED_AMOUNT"])&&void 0!==t&&t.VALUE||void 0!==(null==e||null===(l=e[q+"_ADDITIONAL_AMOUNT"])||void 0===l?void 0:l.VALUE)&&(null==e||null===(o=e[q+"_ADDITIONAL_AMOUNT"])||void 0===o||!o.VALUE)?"rebate":"penalty";d="WS"===q?JSON.parse(JSON.stringify(null!=e&&null!==(i=e.WS_REDUCED_AMOUNT)&&void 0!==i&&i.VALUE?null==e?void 0:e.WS_REDUCED_AMOUNT:null==e?void 0:e.WS_ADDITIONAL_AMOUNT)):JSON.parse(JSON.stringify(null!=e&&null!==(a=e.SW_REDUCED_AMOUNT)&&void 0!==a&&a.VALUE?null==e?void 0:e.SW_REDUCED_AMOUNT:null==e?void 0:e.SW_ADDITIONAL_AMOUNT)),null===(r=d)||void 0===r||delete r.VALUE;const c=Object.entries(d);return null!=e&&e[q+"_REBATE"]?c.push([q+"_TIME_ADHOC_REBATE",null==e?void 0:e[q+"_REBATE"]]):null!=e&&e[q+"_PENALTY"]&&c.push([q+"_TIME_ADHOC_PENALTY",null==e?void 0:e[q+"_PENALTY"]]),null===(u=c.filter(e=>""!==(null==e?void 0:e[1])))||void 0===u?void 0:u.map(e=>(Q.find(n=>n.taxHeadCode===e[0]),{taxHeadMasterCode:e[0],taxAmount:e[1]?"penalty"!==s?-parseInt(e[1]):parseInt(e[1]):0}))},ye=e=>{var n,t,l,o;const i=null!=e&&null!==(n=e[q+"_REDUCED_AMOUNT"])&&void 0!==n&&n.VALUE?"REBATE":"PENALTY",a={};let r;return Q.map(e=>{a[e.taxHeadCode]=e.amount}),r="WS"===q?JSON.parse(JSON.stringify(null!=e&&null!==(t=e.WS_REDUCED_AMOUNT)&&void 0!==t&&t.VALUE?null==e?void 0:e.WS_REDUCED_AMOUNT:null==e?void 0:e.WS_ADDITIONAL_AMOUNT)):JSON.parse(JSON.stringify(null!=e&&null!==(l=e.SW_REDUCED_AMOUNT)&&void 0!==l&&l.VALUE?null==e?void 0:e.SW_REDUCED_AMOUNT:null==e?void 0:e.SW_ADDITIONAL_AMOUNT)),null===(o=r)||void 0===o||delete o.VALUE,r[q+"_"+i]=null!=e&&e[q+"_"+i]?null==e?void 0:e[q+"_"+i]:0,v({},r,{actionPerformed:r,TOTAL:Object.values(r).reduce((e,n)=>parseInt(e)+parseInt(n),0),originalDemand:a,action:i})},De=()=>{L(null)};t.useEffect(()=>{const e=setTimeout(()=>{var e;de&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/generate-note-bill-amendment?applicationNumber="+(null===(e=x)||void 0===e?void 0:e.data.applicationDetails.amendment.amendmentId))},5e3);return()=>clearTimeout(e)},[de]);let Te=0;return null===(_=Q)||void 0===_||null===(f=_.filter(e=>{var n;return null==e||null===(n=e.taxHeadCode)||void 0===n?void 0:n.includes("ADHOC")}))||void 0===f||f.map(e=>{Te+=null==e?void 0:e.amount}),Q=null===(g=Q)||void 0===g?void 0:g.filter(e=>{var n;return!(null!=e&&null!==(n=e.taxHeadCode)&&void 0!==n&&n.includes("ADHOC"))}),l.createElement("form",{onSubmit:ie(e=>{var n,t;const l={Amendment:{consumerCode:w,tenantId:W,businessService:q,amendmentReason:null==ve?void 0:ve.code,reasonDocumentNumber:null==e?void 0:e.reasonDocumentNumber,effectiveFrom:new Date(null==e?void 0:e.effectiveFrom).getTime(),effectiveTill:new Date(null==e?void 0:e.effectiveTill).getTime(),documents:Object.values(null==e?void 0:e.DOCUMENTS).map(e=>{const n=v({},e,{documentType:null==e?void 0:e.id,fileUrl:null==e?void 0:e.url});return delete n.id,delete n.url,n}),demandDetails:Ne(e),additionalDetails:{searchBillDetails:ye(e),editForm:e}}};if("RE-SUBMIT-APPLICATION"!==(null===(n=x)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.action))_e.push("/digit-ui/employee/ws/response",l);else{var o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C;const e={businessId:null===(o=x)||void 0===o||null===(i=o.data)||void 0===i||null===(a=i.applicationDetails)||void 0===a||null===(r=a.amendment)||void 0===r?void 0:r.amendmentId,action:"RE-SUBMIT",tenantId:W,businessService:"WATER"===(null===(u=x)||void 0===u||null===(d=u.data)||void 0===d||null===(s=d.applicationDetails)||void 0===s||null===(c=s.applicationData)||void 0===c?void 0:c.serviceType)?"WS.AMENDMENT":"SW.AMENDMENT",moduleName:"WATER"===(null===(p=x)||void 0===p||null===(m=p.data)||void 0===m||null===(E=m.applicationDetails)||void 0===E||null===(S=E.applicationData)||void 0===S?void 0:S.serviceType)?"WS":"SW"},n=v({},null===(_=x)||void 0===_||null===(f=_.data)||void 0===f||null===(g=f.applicationDetails)||void 0===g||null===(C=g.applicationData)||void 0===C?void 0:C.billAmendmentDetails,{workflow:e},null==l?void 0:l.Amendment);ue({AmendmentUpdate:n},{onError:(e,n)=>{L({key:"error",error:e,label:R("CS_WATER_UPDATE_APPLICATION_FAILED")}),setTimeout(De,5e3)},onSuccess:(e,n)=>{var t,l,o;if((null==e||null===(t=e.Amendments)||void 0===t?void 0:t.length)>0)return null!=n&&null!==(l=n.AmendmentUpdate)&&void 0!==l&&null!==(o=l.workflow)&&void 0!==o&&o.action.includes("RE-SUBMIT")&&L({key:"success",label:R("ES_MODIFYSWCONNECTION_RE_SUBMIT_UPDATE_SUCCESS")}),void se(!0)}})}})},l.createElement("div",{style:{marginLeft:"20px"}},l.createElement(a.Header,null,null!==(C=x)&&void 0!==C&&null!==(N=C.data)&&void 0!==N&&N.action?R("WS_APP_FOR_WATER_AND_SEWERAGE_EDIT_LABEL"):R("WS_BILL_AMENDMENT_BUTTON"))),l.createElement(a.Card,null,l.createElement(a.LabelFieldPair,{style:{marginBottom:"20px"}},l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_ACKNO_CONNECTION_NO_LABEL")),l.createElement(a.CardText,{style:{marginBottom:"0px"}},w)),l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},R("WS_ADJUSTMENT_AMOUNT")),l.createElement(a.CardSectionSubText,{style:{marginBottom:"16px"}},R("WS_ADJUSTMENT_AMOUNT_ADDITION_TEXT")),Z?l.createElement(a.Loader,null):l.createElement("table",{cellPadding:"8px",cellSpacing:"10px"},l.createElement("div",{style:V&&z?{overflow:"scroll",maxWidth:"50%"}:{}},l.createElement("tbody",null,l.createElement("tr",{style:{textAlign:"left"}},l.createElement("th",null,R("WS_TAX_HEADS")),l.createElement("th",{style:{textAlign:"right"}},R("WS_CURRENT_AMOUNT")),l.createElement("th",{style:{paddingLeft:"150px"}},l.createElement(t.Fragment,null,l.createElement(r.Controller,{name:q+"_REDUCED_AMOUNT.VALUE",key:q+"_REDUCED_AMOUNT.VALUE",control:te,rules:{validate:e=>!(!e&&("WS"===q?null==me||!me.VALUE:null==Se||!Se.VALUE))},render:e=>{var n,t,o,i,r,u,d,s,c,v,p,m,E,S;return l.createElement("div",{style:{paddingTop:"20px"}},l.createElement(a.CheckBox,{style:{marginLeft:"35px"},label:R(q+"_REDUCED_AMOUNT"),onChange:n=>{n.target.checked?(e.onChange(!0),k(!0),j(!1),Ce(q+"_ADDITIONAL_AMOUNT")):(k(!1),e.onChange(!1))},disable:!(!P||0!=(null===(n=x)||void 0===n||null===(t=n.data)||void 0===t||null===(o=t.applicationDetails)||void 0===o||null===(i=o.amendment)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(u=r.editForm)||void 0===u||null===(d=u.WS_REDUCED_AMOUNT)||void 0===d?void 0:d.VALUE)&&0!=(null===(s=x)||void 0===s||null===(c=s.data)||void 0===c||null===(v=c.applicationDetails)||void 0===v||null===(p=v.amendment)||void 0===p||null===(m=p.additionalDetails)||void 0===m||null===(E=m.editForm)||void 0===E||null===(S=E.SW_REDUCED_AMOUNT)||void 0===S?void 0:S.VALUE)),checked:null==e?void 0:e.value}))}}),null!=ae&&null!==(y=ae.WS_REDUCED_AMOUNT)&&void 0!==y&&y.VALUE&&1==U?l.createElement(a.CardLabelError,null,R("WS_REQUIRED_FIELD")):null)),l.createElement("th",null,l.createElement(t.Fragment,null,l.createElement(r.Controller,{name:q+"_ADDITIONAL_AMOUNT.VALUE",key:q+"_ADDITIONAL_AMOUNT.VALUE",control:te,rules:{validate:e=>!(!e&&("WS"===q?null==pe||!pe.VALUE:null==Ee||!Ee.VALUE))},render:e=>{var n,t,o,i,r,u,d,s,c,v,p,m,E,S;return l.createElement("div",{style:{paddingTop:"17px"}},l.createElement(a.CheckBox,{style:{marginLeft:"35px"},label:R(q+"_ADDITIONAL_AMOUNT"),onChange:n=>{n.target.checked?(e.onChange(!0),j(!0),k(!1),Ce(q+"_REDUCED_AMOUNT")):(j(!1),e.onChange(!1))},disable:!(!P||0!=(null===(n=x)||void 0===n||null===(t=n.data)||void 0===t||null===(o=t.applicationDetails)||void 0===o||null===(i=o.amendment)||void 0===i||null===(r=i.additionalDetails)||void 0===r||null===(u=r.editForm)||void 0===u||null===(d=u.WS_ADDITIONAL_AMOUNT)||void 0===d?void 0:d.VALUE)&&0!=(null===(s=x)||void 0===s||null===(c=s.data)||void 0===c||null===(v=c.applicationDetails)||void 0===v||null===(p=v.amendment)||void 0===p||null===(m=p.additionalDetails)||void 0===m||null===(E=m.editForm)||void 0===E||null===(S=E.WS_ADDITIONAL_AMOUNT)||void 0===S?void 0:S.VALUE)),checked:null==e?void 0:e.value}))}}),null!=ae&&null!==(D=ae.WS_ADDITIONAL_AMOUNT)&&void 0!==D&&D.VALUE&&1==H?l.createElement(a.CardLabelError,null,R("WS_REQUIRED_FIELD")):null))),null===(T=Q)||void 0===T?void 0:T.map(e=>{var n,o,i,r,u,d,s,c,v,p,m;return l.createElement("tr",null,l.createElement("td",{style:{paddingRight:"60px",fontWeight:"700"}},R(""+e.taxHeadCode)),l.createElement("td",{style:{textAlign:"end"}},"₹ ",e.amount),l.createElement("div",null,l.createElement("td",{style:{paddingRight:"60px",paddingLeft:"150px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=pe&&pe.VALUE):!(null!=Ee&&Ee.VALUE),type:"number",name:q+"_REDUCED_AMOUNT."+e.taxHeadCode,inputRef:ne({max:{value:e.amount,message:R(q+"_ERROR_ENTER_LESS_THAN_MAX_VALUE")},pattern:{value:/^[+]?[1-9]\d*$/,message:R("CS_INVALID_INPUT")}})}))),"WS"===q?(null==ae||null===(n=ae.WS_REDUCED_AMOUNT)||void 0===n?void 0:n[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginBottom:"-20px",marginTop:"-30px",marginLeft:"150px"}},null==ae||null===(o=ae.WS_REDUCED_AMOUNT)||void 0===o||null===(i=o[e.taxHeadCode])||void 0===i?void 0:i.message):(null==ae||null===(r=ae.SW_REDUCED_AMOUNT)||void 0===r?void 0:r[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginBottom:"-20px",marginTop:"-30px",marginLeft:"150px"}},null==ae||null===(u=ae.SW_REDUCED_AMOUNT)||void 0===u?void 0:u[e.taxHeadCode].message)),l.createElement("td",{style:{paddingRight:"60px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=me&&me.VALUE):!(null!=Se&&Se.VALUE),type:"number",name:q+"_ADDITIONAL_AMOUNT."+e.taxHeadCode,inputRef:ne({pattern:{value:/^[+]?[1-9]\d*$/,message:R("CS_INVALID_INPUT")}})})),"WS"===q?(null==ae||null===(d=ae.WS_ADDITIONAL_AMOUNT)||void 0===d?void 0:d[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginTop:"-19px"}},null==ae||null===(s=ae.WS_ADDITIONAL_AMOUNT)||void 0===s||null===(c=s[e.taxHeadCode])||void 0===c?void 0:c.message):(null==ae||null===(v=ae.SW_ADDITIONAL_AMOUNT)||void 0===v?void 0:v[e.taxHeadCode])&&l.createElement(a.CardLabelError,{style:{marginTop:"-19px"}},null==ae||null===(p=ae.SW_ADDITIONAL_AMOUNT)||void 0===p||null===(m=p[e.taxHeadCode])||void 0===m?void 0:m.message)))}),l.createElement("tr",null,l.createElement("td",{style:{paddingRight:"60px",fontWeight:"700"}},R("WS_REBATE_PENALTY"),l.createElement("div",{className:"tooltip",style:{marginLeft:"10px",marginBottom:"-4px"}},l.createElement(a.InfoBannerIcon,{fill:"#0b0c0c",style:!0}),l.createElement("span",{className:"tooltiptext",style:{whiteSpace:"nowrap",fontSize:"medium"}},"1. "+R("WS_ADHOC_REBATE_TOOLTIP"),l.createElement("br",null),l.createElement("br",null),"2. "+R("WS_ADHOC_PENALTY_TOOLTIP")))),l.createElement("td",{style:{textAlign:"end"}},"₹ ",Te||0),l.createElement("td",{style:{paddingRight:"60px",paddingLeft:"150px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=pe&&pe.VALUE):!(null!=Ee&&Ee.VALUE),name:q+"_REBATE",inputRef:ne()}))),l.createElement("td",{style:{paddingRight:"60px"}},l.createElement(t.Fragment,null,l.createElement(a.TextInput,{disabled:"WS"===q?!(null!=me&&me.VALUE):!(null!=Se&&Se.VALUE),name:q+"_PENALTY",inputRef:ne()}))))))),Y?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},R("WS_ADD_DEMAND_REVISION_BASIS")),l.createElement(a.CardSectionSubText,{style:{marginBottom:"16px"}},R("WS_SELECT_DEMAND_REVISION")),l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_DEMAND_REVISION_BASIS")+" *"),l.createElement(r.Controller,{name:"amendmentReason",control:te,rules:{required:!0},render:e=>l.createElement(a.Dropdown,{style:V&&z?{}:{width:"640px"},option:G,selected:null==e?void 0:e.value,optionKey:"code",t:R,select:null==e?void 0:e.onChange})})),null!=ae&&ae.amendmentReason?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")):null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("COURT_CASE_SETTLEMENT"===(null==ve?void 0:ve.code)?"WS_COURT_ORDER_NO":"ARREAR_WRITE_OFF"===(null==ve?void 0:ve.code)||"ONE_TIME_SETTLEMENT"===(null==ve?void 0:ve.code)?"WS_GOVERNMENT_NOTIFICATION_NUMBER":"WS_DOCUMENT_NO")+" *"),l.createElement("div",{className:"reasonDocumentNumber"},l.createElement(a.TextInput,{style:V&&z?{}:{width:"640px"},name:"reasonDocumentNumber",inputRef:ne({required:!0})}))),null!=ae&&ae.reasonDocumentNumber?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")):null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_BILL_AMEND_EFFECTIVE_FROM")+" *"),l.createElement(r.Controller,{render:e=>l.createElement(a.DatePicker,{style:V&&z?{}:{width:"640px"},date:e.value,disabled:!1,onChange:e.onChange}),name:"effectiveFrom",rules:{required:!0},control:te})),null!=ae&&ae.effectiveFrom?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")):null,"COURT_CASE_SETTLEMENT"!==(null==ve?void 0:ve.code)&&l.createElement("div",null,l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R("WS_BILL_AMEND_EFFECTIVE_TILL")+" *"),l.createElement(r.Controller,{render:e=>l.createElement(a.DatePicker,{style:V&&z?{}:{width:"640px"},date:e.value,disabled:!1,onChange:e.onChange}),name:"effectiveTill",rules:{required:!0,validate:{isValidToDate:e=>new Date(e).getTime()>(ce?new Date(ce).getTime():(new Date).getTime())||"Invalid format"}},control:te})),"required"===(null==ae||null===(h=ae.effectiveTill)||void 0===h?void 0:h.type)&&l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("WS_REQUIRED_FIELD")),"Invalid format"===(null==ae||null===(A=ae.effectiveTill)||void 0===A?void 0:A.message)&&l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},R("ERR_DEFAULT_INPUT_FIELD_MSG")))),ve?l.createElement(a.CardSectionHeader,{style:{marginBottom:"16px"}},R("WS_DOCUMENT_REQUIRED")):null,null==fe?void 0:fe.map(e=>{var n;return l.createElement("div",{style:{marginBottom:"25px"}},l.createElement(a.LabelFieldPair,null,l.createElement(a.CardLabel,{style:{fontWeight:"500"}},R(""+(null==e?void 0:e.documentType)),null!=e&&e.required?"*":null),l.createElement("div",{className:"field"},l.createElement(r.Controller,{name:"DOCUMENTS."+(null==e?void 0:e.documentType),control:te,rules:null!=e&&e.required?{required:!0}:{},render:n=>l.createElement(a.UploadFile,{id:"ws-doc-"+e.documentType,onUpload:t=>function(e,n,t){return Promise.resolve(function(e,n,t){try{return F(""),Promise.resolve(function(l,o){try{var i=he(function(){const l=function(l,o,i,a,r,u){var d,s,c,v;if((null==e||null===(l=e.target)||void 0===l||null===(o=l.files)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.size)<5242880&&/(.*?)(jpg|jpeg|png|pdf)$/i.test(null==e||null===(a=e.target)||void 0===a||null===(r=a.files)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.type))return ge({type:"addLoader",payload:{id:n}}),Promise.resolve(Digit.UploadServices.Filestorage("WS",null==e||null===(d=e.target)||void 0===d?void 0:d.files[0],W)).then(function(l){var o,i,a;const r=null==l||null===(o=l.data)||void 0===o||null===(i=o.files)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.fileStoreId,u=function(){if(r)return Promise.resolve(Digit.UploadServices.Filefetch([r],W)).then(function(l){var o,i,a,u;let{data:d}=l;const s=null==d||null===(o=d.fileStoreIds)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.url;ge({type:"upload",payload:{id:n,url:s}}),t.onChange({id:n,url:s,fileName:null==e||null===(a=e.target)||void 0===a||null===(u=a.files[0])||void 0===u?void 0:u.name,fileStoreId:r,fileStore:r})});alert(R("CS_FILE_UPLOAD_ERROR"))}();if(u&&u.then)return u.then(function(){})});(null==e||null===(s=e.target)||void 0===s||null===(c=s.files)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.size)>5242880?F({message:"FILE_SIZE_EXCEEDED",documentType:n}):F({message:"FILE_TYPE_MISMATCHED",documentType:n})}();if(l&&l.then)return l.then(function(){})},function(){})}catch(e){return o(!0,e)}return i&&i.then?i.then(o.bind(null,!1),o.bind(null,!0)):o(!1,i)}(0,function(e,t){if(ge({type:"removeLoader",payload:{id:n}}),e)throw t;return t}))}catch(e){return Promise.reject(e)}}(e,n,t)).then(function(){})}(t,null==e?void 0:e.documentType,n),onDelete:()=>ge({type:"remove",payload:{id:null==e?void 0:e.documentType}}),style:V&&z?{}:{width:"640px"},message:null!=e&&e.url?"1 "+R("CS_ACTION_FILEUPLOADED"):R("CS_ACTION_NO_FILEUPLOADED"),accept:"image/*, .pdf, .png, .jpeg, .jpg",textStyles:{width:"100%"},inputStyles:{width:"280px"},error:null==B?void 0:B.message})}))),null!=ae&&null!==(n=ae.DOCUMENTS)&&void 0!==n&&n[null==e?void 0:e.documentType]||B&&(null==B?void 0:B.documentType)===e.documentType?l.createElement(a.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px"}},R(B&&(null==B?void 0:B.documentType)===e.documentType?null==B?void 0:B.message:"WS_NO_FILE_SELECTED")):null)})),b?l.createElement(a.Toast,{isDleteBtn:!0,error:null==b?void 0:b.error,label:null==b?void 0:b.label,onClose:De}):null,l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{submit:!0,label:null!==(I=x)&&void 0!==I&&null!==(O=I.data)&&void 0!==O&&O.action?R("WF_CITIZEN_NEWSW1_RESUBMIT_APPLICATION"):R("WS_COMMON_BUTTON_SUBMIT"),disabled:"WS"==q&&U&&(""==re().WS_REDUCED_AMOUNT.WS_CHARGE||null==re().WS_REDUCED_AMOUNT.WS_CHARGE)&&(""==re().WS_REDUCED_AMOUNT.WS_TIME_PENALTY||null==re().WS_REDUCED_AMOUNT.WS_TIME_PENALTY)&&(""==re().WS_REDUCED_AMOUNT.WS_TIME_INTEREST||null==re().WS_REDUCED_AMOUNT.WS_TIME_INTEREST)&&(""==re().WS_REDUCED_AMOUNT.WS_WATER_CESS||null==re().WS_REDUCED_AMOUNT.WS_WATER_CESS)||"SW"==q&&U&&(""==re().SW_REDUCED_AMOUNT.SW_CHARGE||null==re().SW_REDUCED_AMOUNT.SW_CHARGE)&&(""==re().SW_REDUCED_AMOUNT.SW_TIME_PENALTY||null==re().SW_REDUCED_AMOUNT.SW_TIME_PENALTY)&&(""==re().SW_REDUCED_AMOUNT.SW_TIME_INTEREST||null==re().SW_REDUCED_AMOUNT.SW_TIME_INTEREST)&&(""==re().SW_REDUCED_AMOUNT.SW_SEWERAGE_CESS||null==re().SW_REDUCED_AMOUNT.SW_SEWERAGE_CESS)||"WS"==q&&H&&(""==re().WS_ADDITIONAL_AMOUNT.WS_CHARGE||null==re().WS_ADDITIONAL_AMOUNT.WS_CHARGE)&&(""==re().WS_ADDITIONAL_AMOUNT.WS_TIME_PENALTY||null==re().WS_ADDITIONAL_AMOUNT.WS_TIME_PENALTY)&&(""==re().WS_ADDITIONAL_AMOUNT.WS_TIME_INTEREST||null==re().WS_ADDITIONAL_AMOUNT.WS_TIME_INTEREST)&&(""==re().WS_ADDITIONAL_AMOUNT.WS_WATER_CESS||null==re().WS_ADDITIONAL_AMOUNT.WS_WATER_CESS)||"SW"==q&&H&&(""==re().SW_ADDITIONAL_AMOUNT.SW_CHARGE||null==re().SW_ADDITIONAL_AMOUNT.SW_CHARGE)&&(""==re().SW_ADDITIONAL_AMOUNT.SW_TIME_PENALTY||null==re().SW_ADDITIONAL_AMOUNT.SW_TIME_PENALTY)&&(""==re().SW_ADDITIONAL_AMOUNT.SW_TIME_INTEREST||null==re().SW_ADDITIONAL_AMOUNT.SW_TIME_INTEREST)&&(""==re().SW_ADDITIONAL_AMOUNT.SW_SEWERAGE_CESS||null==re().SW_ADDITIONAL_AMOUNT.SW_SEWERAGE_CESS)})))},WSRequiredDocuments:e=>{let{path:n}=e;const{search:r}=i.useLocation();let{state:u}=i.useLocation();u=u?"string"==typeof u?JSON.parse(u):u:{};const d=i.useHistory(),{t:s}=o.useTranslation(),c=Digit.ULBService.getStateId(),v=t.useRef(),{isLoading:p,data:m}=Digit.Hooks.ws.WSSearchMdmsTypes.useWSMDMSBillAmendment({tenantId:c});return l.createElement(t.Fragment,null,l.createElement("div",{ref:v},l.createElement("div",{className:"options"},l.createElement(a.Header,null,s("ES_COMMON_WS_DOCUMENTS_REQUIRED")),l.createElement("div",{className:"mrsm",style:{marginRight:"35px"},onClick:()=>Digit.Download.PDF(v,s("ES_COMMON_WS_DOCUMENTS_REQUIRED"))},l.createElement(a.DownloadIcon,{className:"mrsm"}),s("ES_WS_REQUIRED_DOCS_DOWNLOAD"))),l.createElement(a.Card,{style:{position:"relative"},className:"employeeCard-override"},p?l.createElement(a.Loader,null):null==m?void 0:m.map(e=>l.createElement(t.Fragment,null,l.createElement(a.CardHeader,null,s(e.code).replaceAll("_"," ")),l.createElement(a.CardLabel,null,s("WS_DOCS_REQ_INFO")),e.allowedDocuments.allowedDocs.map((e,n)=>l.createElement(a.CardLabelDesc,null,n+1,". ",s(""+e.documentType))))))),l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{label:s("WS_COMMON_BUTTON_APPLY"),onSubmit:()=>{var e;d.push(n+"/bill-amendment"+r,JSON.stringify({data:null===(e=u)||void 0===e?void 0:e.data}))}})))},WSNewApplication:()=>{const{t:e}=o.useTranslation(),n=(i.useLocation(),i.useHistory());g(location.search);const[r,u]=t.useState(!1),[d,s]=t.useState(!1),[c,p]=t.useState(null),[m,E]=t.useState({}),[S,_]=t.useState(null),[f,C]=t.useState({head:"",body:[]});let N=Digit.ULBService.getCurrentTenantId();N||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const y=Digit.ULBService.getStateId();let{data:D,isLoading:T}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(y,{});const[A,I]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[O,b,L]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:R}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:A},tenantId:N},{filters:{propertyIds:A},tenantId:N,enabled:!(!A||""==A)});t.useEffect(()=>{if(!T){var e;const n=D.find(e=>e.hideInCitizen&&e.isCreate);n.head="WS_APP_FOR_WATER_AND_SEWERAGE_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isCreateConnection&&t.push(e)}),n.body=t,C(n)}},[D]),t.useEffect(()=>{var e,n,t,l;!A&&(null==O||null===(e=O.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&I(null==O||null===(t=O.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==O?void 0:O.cpt]),t.useEffect(()=>{var e;b(v({},O,{cpt:{details:null==R||null===(e=R.Properties)||void 0===e?void 0:e[0]}}))},[R]);const{mutate:w}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:W}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:P}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:M}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE"),x=()=>{p(null)};return d||T?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,e(f.head))),l.createElement(a.FormComposer,{config:f.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o,i,a,r;U.isEqual(O,n)||(b(v({},O,n)),sessionStorage.setItem("FORMSTATE_ERRORS",JSON.stringify(null==t?void 0:t.errors))),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&null!=t&&null!==(l=t.errors)&&void 0!==l&&null!==(o=l.ConnectionHolderDetails)&&void 0!==o&&o.type&&1==(null===(i=Object.keys(null==t||null===(a=t.errors)||void 0===a||null===(r=a.ConnectionHolderDetails)||void 0===r?void 0:r.type))||void 0===i?void 0:i.length)&&t.errors.ConnectionHolderDetails&&Object.values(t.errors.ConnectionHolderDetails.type).filter(e=>{var n;return"required"===e.type&&""!==(null==e||null===(n=e.ref)||void 0===n?void 0:n.value)}).length>0?u(!0):u(!Object.keys(t.errors).length)},label:e("CS_COMMON_SUBMIT"),onSubmit:function(e){try{var t,l,o;if(!(null!=e&&null!==(t=e.cpt)&&void 0!==t&&t.id||null!=R&&null!==(l=R.Properties)&&void 0!==l&&l[0]||null!=e&&null!==(o=e.cpt)&&void 0!==o&&o.details&&R))return p({key:"error",message:"ERR_INVALID_PROPERTY_ID"}),Promise.resolve();const i=sessionStorage.getItem("FORMSTATE_ERRORS"),a="string"==typeof i?JSON.parse(i):{};return Promise.resolve(function(t,l,o){var i,r;if(!(Object.keys(a).length>0)||1==Object.keys(a).length&&null!=a&&null!==(t=a.ConnectionHolderDetails)&&void 0!==t&&t.type&&1==(null===(l=Object.keys(null==a||null===(o=a.ConnectionHolderDetails)||void 0===o?void 0:o.type))||void 0===l?void 0:l.length)&&a.ConnectionHolderDetails&&Object.values(a.ConnectionHolderDetails.type).filter(e=>{var n;return"required"===e.type&&""!==(null==e||null===(n=e.ref)||void 0===n?void 0:n.value)}).length>0)return null!=e&&null!==(i=e.cpt)&&void 0!==i&&i.details||(e.cpt={details:null==R||null===(r=R.Properties)||void 0===r?void 0:r[0]}),Lt(e),Promise.resolve(function(e){try{var n,t,l,o,i,a,r,u,d,s,c,v,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge;null==e||null===(n=e.cpt)||void 0===n||null===(t=n.details)||void 0===t||null===(l=t.owners)||void 0===l||l.forEach(e=>{null!=e&&e.permanentAddress&&(e.correspondenceAddress=null==e?void 0:e.permanentAddress)});let Ce={water:null==e||null===(o=e.ConnectionDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.water,sewerage:null==e||null===(a=e.ConnectionDetails)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.sewerage,proposedTaps:(null==e||null===(u=e.ConnectionDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.proposedTaps)&&Number(null==e||null===(s=e.ConnectionDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.proposedTaps),proposedPipeSize:(null==e||null===(v=e.ConnectionDetails)||void 0===v||null===(p=v[0])||void 0===p||null===(m=p.proposedPipeSize)||void 0===m?void 0:m.size)&&Number(null==e||null===(E=e.ConnectionDetails)||void 0===E||null===(S=E[0])||void 0===S||null===(_=S.proposedPipeSize)||void 0===_?void 0:_.size),proposedWaterClosets:(null==e||null===(f=e.ConnectionDetails)||void 0===f||null===(g=f[0])||void 0===g?void 0:g.proposedWaterClosets)&&Number(null==e||null===(C=e.ConnectionDetails)||void 0===C||null===(N=C[0])||void 0===N?void 0:N.proposedWaterClosets),proposedToilets:(null==e||null===(y=e.ConnectionDetails)||void 0===y||null===(D=y[0])||void 0===D?void 0:D.proposedToilets)&&Number(null==e||null===(T=e.ConnectionDetails)||void 0===T||null===(h=T[0])||void 0===h?void 0:h.proposedToilets),connectionHolders:null!=e&&null!==(A=e.ConnectionHolderDetails)&&void 0!==A&&null!==(I=A[0])&&void 0!==I&&I.sameAsOwnerDetails?null:[{correspondenceAddress:(null==e||null===(O=e.ConnectionHolderDetails)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.address)||"",fatherOrHusbandName:(null==e||null===(L=e.ConnectionHolderDetails)||void 0===L||null===(R=L[0])||void 0===R?void 0:R.guardian)||"",gender:(null==e||null===(w=e.ConnectionHolderDetails)||void 0===w||null===(W=w[0])||void 0===W||null===(P=W.gender)||void 0===P?void 0:P.code)||"",mobileNumber:(null==e||null===(M=e.ConnectionHolderDetails)||void 0===M||null===(x=M[0])||void 0===x?void 0:x.mobileNumber)||"",name:(null==e||null===(B=e.ConnectionHolderDetails)||void 0===B||null===(F=B[0])||void 0===F?void 0:F.name)||"",ownerType:(null==e||null===(U=e.ConnectionHolderDetails)||void 0===U||null===(k=U[0])||void 0===k||null===(H=k.ownerType)||void 0===H?void 0:H.code)||"",relationship:(null==e||null===(j=e.ConnectionHolderDetails)||void 0===j||null===(V=j[0])||void 0===V||null===(z=V.relationship)||void 0===z?void 0:z.code)||"",sameAsPropertyAddress:null==e||null===(Y=e.ConnectionHolderDetails)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.sameAsOwnerDetails,emailId:(null==e||null===(q=e.ConnectionHolderDetails)||void 0===q?void 0:q[0].emailId)||""}],service:null==e||null===(K=e.ConnectionDetails)||void 0===K||null===(X=K[0])||void 0===X||!X.water||null!=e&&null!==(Z=e.ConnectionDetails)&&void 0!==Z&&null!==($=Z[0])&&void 0!==$&&$.sewerage?null!=e&&null!==(J=e.ConnectionDetails)&&void 0!==J&&null!==(Q=J[0])&&void 0!==Q&&Q.water||null==e||null===(ee=e.ConnectionDetails)||void 0===ee||null===(ne=ee[0])||void 0===ne||!ne.sewerage?"Water And Sewerage":"Sewerage":"Water",property:null==e||null===(te=e.cpt)||void 0===te?void 0:te.details,propertyId:null==e||null===(le=e.cpt)||void 0===le||null===(oe=le.details)||void 0===oe?void 0:oe.propertyId,roadCuttingArea:null,noOfTaps:null,noOfWaterClosets:null,noOfToilets:null,additionalDetails:{initialMeterReading:null,detailsProvidedBy:"",locality:null==e||null===(ie=e.cpt)||void 0===ie||null===(ae=ie.details)||void 0===ae||null===(re=ae.address)||void 0===re||null===(ue=re.locality)||void 0===ue?void 0:ue.code},tenantId:null==e||null===(de=e.cpt)||void 0===de||null===(se=de.details)||void 0===se||null===(ce=se.address)||void 0===ce?void 0:ce.tenantId,processInstance:{action:"INITIATE"},channel:"CFC_COUNTER"};return sessionStorage.setItem("WS_DOCUMENTS_INOF",JSON.stringify(null==e||null===(ve=e.DocumentsRequired)||void 0===ve?void 0:ve.documents)),sessionStorage.setItem("WS_PROPERTY_INOF",JSON.stringify(null==e||null===(pe=e.cpt)||void 0===pe?void 0:pe.details)),Ce=null!==(me=Digit)&&void 0!==me&&null!==(Ee=me.Customizations)&&void 0!==Ee&&null!==(Se=Ee.WS)&&void 0!==Se&&Se.customiseCreatePayloadOfWS?null===(_e=Digit)||void 0===_e||null===(fe=_e.Customizations)||void 0===fe||null===(ge=fe.WS)||void 0===ge?void 0:ge.customiseCreatePayloadOfWS(e,Ce):Ce,Promise.resolve(Ce)}catch(e){return Promise.reject(e)}}(e)).then(function(e){let t=!1;null!=e&&e.water&&null!=e&&e.sewerage&&(t=!0);let l={WaterConnection:e,disconnectRequest:!1,reconnectRequest:!1},o={SewerageConnection:e,disconnectRequest:!1,reconnectRequest:!1};t?(_(!0),sessionStorage.setItem("setWaterAndSewerageBoth",JSON.stringify(!0))):sessionStorage.setItem("setWaterAndSewerageBoth",JSON.stringify(!1));const i=function(){if(null!=e&&e.water&&null!=e&&e.sewerage){const e=function(){if(w&&P)return s(!0),Promise.resolve(w(l,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(h(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){W({WaterConnection:e,disconnectRequest:!1,reconnectRequest:!1},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return E(v({},m,{waterConnection:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),Promise.resolve(P(o,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(t,l){try{var o;return Promise.resolve(h(null==t||null===(o=t.SewerageConnections)||void 0===o?void 0:o[0],"SEWERAGE")).then(function(t){return Promise.resolve(M({SewerageConnection:t,disconnectRequest:!1,reconnectRequest:!1},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(t,l){try{var o,i,a,r,u;return E(v({},m,{sewerageConnection:null==t||null===(o=t.SewerageConnections)||void 0===o?void 0:o[0]})),L(),n.push("/digit-ui/employee/ws/ws-response?applicationNumber="+(null==e||null===(i=e.WaterConnection)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.applicationNo)+"&applicationNumber1="+(null==t||null===(r=t.SewerageConnections)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.applicationNo)),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}catch(e){return Promise.reject(e)}}})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}else{const t=function(){if(null==e||!e.water||null!=e&&e.sewerage){const t=function(){if(null!=e&&e.sewerage&&(null==e||!e.water)){const e=function(){if(P)return s(!0),Promise.resolve(P(o,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(h(null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0],"SEWERAGE")).then(function(e){return Promise.resolve(M({SewerageConnection:e},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{var l,o,i;E(v({},m,{sewerageConnection:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0]})),L(),n.push("/digit-ui/employee/ws/ws-response?applicationNumber1="+(null==e||null===(o=e.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}else{const e=function(){if(w)return s(!0),Promise.resolve(w(l,{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:function(e,t){try{var l;return Promise.resolve(h(null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0],"WATER")).then(function(e){W({WaterConnection:e},{onError:(e,n)=>{var t,l,o,i,a,r;s(!1),p({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(x,5e3)},onSuccess:(e,t)=>{var l,o,i;E(v({},m,{waterConnection:null==e||null===(l=e.WaterConnection)||void 0===l?void 0:l[0]})),L(),n.push("/digit-ui/employee/ws/ws-response?applicationNumber="+(null==e||null===(o=e.WaterConnection)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo))}})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();if(t&&t.then)return t.then(function(){})}}();if(i&&i.then)return i.then(function(){})});p({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"})}())}catch(e){return Promise.reject(e)}},defaultValues:O}),c&&l.createElement(a.Toast,{isDleteBtn:!0,error:"error"===(null==c?void 0:c.key),warning:null==c?void 0:c.warning,label:e(null==c?void 0:c.message),onClose:()=>{p(null)},isWarning:null==c?void 0:c.isWarning}))},WSApplicationDetails:()=>{var e,n,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,h,A,I,O,b,R,w,W,P,M,B,F,U,k,H,j,V,z,Y,G,q,K,X,$,J,Q,ee,ne,te,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e;i.useParams();const{t:fe}=o.useTranslation(),ge=Digit.UserService.getUser(),Ce=Digit.ULBService.getCurrentTenantId(),Ne=Digit.ULBService.getStateId(),[ye,De]=t.useState(null),[Te,he]=t.useState(null),[Ae,Ie]=t.useState(!1),[Oe,be]=(i.useHistory(),Digit.ULBService.getStateId(),window.Digit.Utils.browser.isMobile(),t.useState(!1)),[Le,Re]=t.useState(!1);let we=g(location.search);const We=null==we?void 0:we.applicationNumber,Pe=null==we?void 0:we.service,Me=t.useRef();sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists");const[xe,Be,Fe]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),[Ue,ke,He]=Digit.Hooks.useSessionStorage("ADHOC_BILL_ADD_REBATE_DATA",{}),{isBillingServiceLoading:je}=Digit.Hooks.obps.useMDMS(Ne,"BillingService",["BusinessService"]),{isCommonmastersLoading:Ve,data:ze}=Digit.Hooks.obps.useMDMS(Ne,"common-masters",["uiCommonPay"]),{isServicesMasterLoading:Ye,data:Ge}=Digit.Hooks.ws.useMDMS(Ne,"ws-services-masters",["WSEditApplicationByConfigUser"]),qe=(null==ze||null===(e=ze["common-masters"])||void 0===e?void 0:e.uiCommonPay)||[],Ke=qe&&qe.findIndex(e=>"WS.ONE_TIME_FEE"==e.code);let Xe="";Xe=Ke>-1?qe[Ke]:qe&&qe.filter(e=>"DEFAULT"===e.code);const Ze=(null===(n=Xe)||void 0===n?void 0:n.receiptKey)||"consolidatedreceipt",{data:$e}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"DataSecurity",[{name:"SecurityPolicy"}],{select:e=>{var n,t;return(null==e||null===(n=e.DataSecurity)||void 0===n||null===(t=n.SecurityPolicy)||void 0===t?void 0:t.find(e=>"User"==(null==e?void 0:e.model)))||{}}});let{isLoading:Je,data:Qe}=Digit.Hooks.ws.useWSDetailsPage(fe,Ce,We,Pe,ge,{privacy:Digit.Utils.getPrivacyObject()}),en=Digit.Hooks.useWorkflowDetails({tenantId:Ce,id:We,moduleCode:null==Qe||null===(r=Qe.processInstancesDetails)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.businessService,config:{enabled:!(null==Qe||null===(d=Qe.processInstancesDetails)||void 0===d||null===(s=d[0])||void 0===s||!s.businessService),privacy:Digit.Utils.getPrivacyObject()}});const{data:nn}=Digit.Hooks.useRecieptSearch({tenantId:Ce,businessService:"WATER"==Pe?"WS.ONE_TIME_FEE":"SW.ONE_TIME_FEE",consumerCodes:null==Qe||null===(c=Qe.applicationData)||void 0===c?void 0:c.applicationNo},{enabled:!(null==Qe||null===(p=Qe.applicationData)||void 0===p||null===(m=p.applicationType)||void 0===m||!m.includes("NEW_")),privacy:Digit.Utils.getPrivacyObject()}),{data:tn}=Digit.Hooks.ws.useOldValue({tenantId:Ce,filters:{connectionNumber:null==Qe||null===(E=Qe.applicationData)||void 0===E?void 0:E.connectionNo,isConnectionSearch:!0},businessService:Pe},{enabled:!(null==Qe||null===(S=Qe.applicationData)||void 0===S||null===(_=S.applicationType)||void 0===_||!_.includes("MODIFY_")),privacy:Digit.Utils.getPrivacyObject()});sessionStorage.removeItem("eyeIconClicked");const ln=[null==tn?void 0:tn.WaterConnection,null==tn?void 0:tn.SewerageConnections],on=null==ln?void 0:ln.filter(e=>e),an=null==Qe?void 0:Qe.applicationData,rn=null===(f=on[0])||void 0===f?void 0:f.flatMap(e=>{const n=Object.entries(e).filter(e=>{let[n,t]=e;return(null==an?void 0:an[n])!==t});return null!=n&&n.length?Object.fromEntries(n):[]}),{mutate:un}=Digit.Hooks.ws.useWSApplicationActions(Pe),dn=()=>{var e,n,t,l;if("WSReconnection"==(null==Qe||null===(e=Qe.processInstancesDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.businessService)||"SWReconnection"==(null==Qe||null===(t=Qe.processInstancesDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.businessService))return!0;{var o,i,a,r,u,d,s,c,v,p,m,E,S;const e=null==Qe||null===(o=Qe.applicationData)||void 0===o?void 0:o.connectionType,n=0===(null==Qe||null===(i=Qe.applicationData)||void 0===i?void 0:i.noOfTaps)?null:null==Qe||null===(a=Qe.applicationData)||void 0===a?void 0:a.noOfTaps,t=0===(null==Qe||null===(r=Qe.applicationData)||void 0===r?void 0:r.pipeSize)?null:null==Qe||null===(u=Qe.applicationData)||void 0===u?void 0:u.pipeSize,l=null==Qe||null===(d=Qe.applicationData)||void 0===d?void 0:d.waterSource,_=0===(null==Qe||null===(s=Qe.applicationData)||void 0===s?void 0:s.noOfWaterClosets)?null:null==Qe||null===(c=Qe.applicationData)||void 0===c?void 0:c.noOfWaterClosets,f=0===(null==Qe||null===(v=Qe.applicationData)||void 0===v?void 0:v.noOfToilets)?null:null==Qe||null===(p=Qe.applicationData)||void 0===p?void 0:p.noOfToilets,g=null==Qe||null===(m=Qe.applicationData)||void 0===m||null===(E=m.additionalDetails)||void 0===E?void 0:E.detailsProvidedBy,C=null==Qe||null===(S=Qe.applicationData)||void 0===S?void 0:S.roadCuttingInfo;return!!(e&&(n&&t&&l||_&&f)&&g&&C)}};let sn=[],cn=(null==Qe||null===(C=Qe.applicationData)||void 0===C?void 0:C.applicationStatus)||"";var vn,pn;null==en||null===(N=en.data)||void 0===N||null===(y=N.actionState)||void 0===y||null===(D=y.nextActions)||void 0===D||D.forEach(e=>{if("ACTIVATE_CONNECTION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/activate-connection?applicationNumber="+We+"&service="+Pe+"&action=ACTIVATE_CONNECTION",state:null==Qe?void 0:Qe.applicationData}),"RESUBMIT_APPLICATION"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(n=Qe.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==Ge||null===(t=Ge["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&cn===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(i=Qe.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:Qe,action:"RESUBMIT_APPLICATION"}}}var a;"SUBMIT_APPLICATION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/modify-application-edit?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(a=Qe.propertyDetails)||void 0===a?void 0:a.propertyId),state:Qe})}),!((null==en||null===(h=en.data)||void 0===h||null===(A=h.nextActions)||void 0===A?void 0:A.length)>0&&(null==en||null===(I=en.data)||void 0===I||null===(O=I.actionState)||void 0===O||null===(b=O.nextActions)||void 0===b?void 0:b.length)>0)||null!=en&&null!==(R=en.data)&&void 0!==R&&null!==(w=R.actionState)&&void 0!==w&&null!==(W=w.nextActions)&&void 0!==W&&W.find(e=>"EDIT"===e.action)||null!=en&&null!==(P=en.data)&&void 0!==P&&null!==(M=P.actionState)&&void 0!==M&&null!==(B=M.nextActions)&&void 0!==B&&B.find(e=>"RESUBMIT_APPLICATION"===e.action)||null!=en&&null!==(F=en.data)&&void 0!==F&&null!==(U=F.actionState)&&void 0!==U&&null!==(k=U.nextActions)&&void 0!==k&&k.find(e=>"ACTIVATE_CONNECTION"===e.action)||null!=en&&null!==(H=en.data)&&void 0!==H&&null!==(j=H.actionState)&&void 0!==j&&null!==(V=j.nextActions)&&void 0!==V&&V.find(e=>"SUBMIT_APPLICATION"===e.action)||null==en||null===(vn=en.data)||void 0===vn||null===(pn=vn.nextActions)||void 0===pn||pn.forEach(e=>{"EDIT"==e.action&&en.data.actionState.nextActions.push(e)}),null==en||null===(z=en.data)||void 0===z||null===(Y=z.actionState)||void 0===Y||null===(G=Y.nextActions)||void 0===G||G.forEach(e=>{if("EDIT"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(n=Qe.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==Ge||null===(t=Ge["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&cn===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+We+"&service="+Pe+"&propertyId="+(null==Qe||null===(i=Qe.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:Qe,action:"VERIFY_AND_FORWARD"}}}}),null==en||null===(q=en.data)||void 0===q||null===(K=q.nextActions)||void 0===K||K.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==cn||dn()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==en||null===(X=en.data)||void 0===X||null===($=X.actionState)||void 0===$||null===(J=$.nextActions)||void 0===J||J.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==cn||dn()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==en||null===(Q=en.data)||void 0===Q||null===(ee=Q.nextActions)||void 0===ee||ee.forEach(e=>{var n,t,l,o,i,a;"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll="WSReconnection"==(null==en||null===(n=en.data)||void 0===n||null===(t=n.processInstances)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.businessService)?{pathname:"WSReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:"SWReconnection"==(null==en||null===(o=en.data)||void 0===o||null===(i=o.processInstances)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.businessService)?{pathname:"SWReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:{pathname:L(we)+"/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId})}),null==en||null===(ne=en.data)||void 0===ne||null===(te=ne.actionState)||void 0===te||null===(oe=te.nextActions)||void 0===oe||oe.forEach(e=>{var n,t,l,o,i,a;console.log("workflowDetails",en),"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll="WSReconnection"==(null==en||null===(n=en.data)||void 0===n||null===(t=n.processInstances)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.businessService)?{pathname:"WSReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:"SWReconnection"==(null==en||null===(o=en.data)||void 0===o||null===(i=o.processInstances)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.businessService)?{pathname:"SWReconnection/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId}:{pathname:L(we)+"/"+(null==Qe?void 0:Qe.applicationNo)+"/"+(null==Qe?void 0:Qe.tenantId)+"?tenantId="+(null==Qe?void 0:Qe.tenantId)+"&ISWSAPP&applicationNumber="+(null==Qe?void 0:Qe.applicationNo),state:null==Qe?void 0:Qe.tenantId})});const mn="WATER"===Pe?null==tn||null===(ie=tn.WaterConnection)||void 0===ie?void 0:ie[(null==tn||null===(ae=tn.WaterConnection)||void 0===ae?void 0:ae.length)-1]:null==tn||null===(re=tn.SewerageConnections)||void 0===re?void 0:re[(null==tn||null===(ue=tn.SewerageConnections)||void 0===ue?void 0:ue.length)-1],En={order:1,label:fe("WS_ESTIMATION_NOTICE"),onClick:function(){try{const e=function(e,n){if(null!=Qe&&null!==(e=Qe.applicationData)&&void 0!==e&&null!==(n=e.additionalDetails)&&void 0!==n&&n.estimationFileStoreId){var t,l;T([null==Qe||null===(t=Qe.applicationData)||void 0===t||null===(l=t.additionalDetails)||void 0===l?void 0:l.estimationFileStoreId],null==Qe?void 0:Qe.tenantId)}else{const e=sessionStorage.getItem("WARINIG_COUNT")||"0",n=JSON.parse(e),t=function(){if(0==n){const e={applicationNumber:We};return console.log(e,"filters"),Promise.resolve(Digit.WSService.search({tenantId:null==Qe?void 0:Qe.tenantId,filters:v({},e),businessService:"WATER"==Pe?"WS":"SW"})).then(function(e){var t,l,o;let i="WATER"==Pe?null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0]:null==e||null===(l=e.SewerageConnections)||void 0===l?void 0:l[0];var a;null!=i&&null!==(o=i.additionalDetails)&&void 0!==o&&o.estimationFileStoreId?T([null==i||null===(a=i.additionalDetails)||void 0===a?void 0:a.estimationFileStoreId],Ce):(sessionStorage.setItem("WARINIG_COUNT",n?n+1:1),setTimeout(()=>{sessionStorage.setItem("WARINIG_COUNT","0")},6e4),he({isError:!1,isWarning:!0,key:"warning",message:fe("WS_WARNING_FILESTOREID_PLEASE_TRY_AGAIN_SOMETIME_LABEL")}))})}Te||he({isError:!1,isWarning:!0,key:"warning",message:fe("WS_WARNING_FILESTOREID_PLEASE_TRY_AGAIN_SOMETIME_LABEL")})}();if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},Sn={order:2,label:fe("WS_SANCTION_LETTER"),onClick:()=>{var e,n;return T([null==Qe||null===(e=Qe.applicationData)||void 0===e||null===(n=e.additionalDetails)||void 0===n?void 0:n.sanctionFileStoreId],null==Qe?void 0:Qe.tenantId)}},_n={order:3,label:fe("WS_APPLICATION"),onClick:function(){try{var e,n,t;const l=null==Qe||null===(e=Qe.applicationData)||void 0===e?void 0:e.tenantId;let o=null==Qe?void 0:Qe.applicationData;return null!=Qe&&null!==(n=Qe.applicationData)&&void 0!==n&&null!==(t=n.applicationType)&&void 0!==t&&t.includes("MODIFY_")?(le(v({},o),v({},null==Qe?void 0:Qe.propertyDetails),l,fe,mn).then(e=>Digit.Utils.pdf.generateModifyPdf(e)),Promise.resolve()):(Z(v({},o),v({},null==Qe?void 0:Qe.propertyDetails),l,fe).then(e=>Digit.Utils.pdf.generatev1(e)),Promise.resolve())}catch(e){return Promise.reject(e)}}},fn={order:4,label:fe("DOWNLOAD_RECEIPT_HEADER"),onClick:()=>{var e;return function(e,n,t,l){try{let t=null;const o=null!=n&&n.fileStoreId?(t={filestoreIds:[null==n?void 0:n.fileStoreId]},Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})):Promise.resolve(Digit.PaymentService.generatePdf(e,{Payments:[v({},n)]},l)).then(function(n){return t=n,Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){var n;window.open(e[null===(n=t)||void 0===n?void 0:n.filestoreIds[0]],"_blank")})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}(Digit.ULBService.getStateId(),null==nn||null===(e=nn.Payments)||void 0===e?void 0:e[0],0,Ze)}};switch(fe("WS_APLICATION_RECEIPT"),cn){case"PENDING_FOR_DOCUMENT_VERIFICATION":case"PENDING_FOR_CITIZEN_ACTION":case"PENDING_FOR_FIELD_INSPECTION":sn=[_n];break;case"PENDING_APPROVAL_FOR_CONNECTION":case"PENDING_FOR_PAYMENT":sn=[_n,En];break;case"PENDING_FOR_CONNECTION_ACTIVATION":case"CONNECTION_ACTIVATED":sn=null!=Qe&&null!==(de=Qe.applicationData)&&void 0!==de&&null!==(se=de.applicationType)&&void 0!==se&&se.includes("NEW_")&&(null==nn||null===(ce=nn.Payments)||void 0===ce?void 0:ce.length)>0?[Sn,En,_n,fn]:[Sn,En,_n];break;case"REJECTED":default:sn=[_n]}return Digit.Hooks.useClickOutside(Me,()=>{be(!1)},Oe),sn.sort(function(e,n){return e.order-n.order}),l.createElement(t.Fragment,null,l.createElement("div",{className:"employee-main-application-details"},l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},fe("CS_TITLE_APPLICATION_DETAILS")),l.createElement("div",{style:{zIndex:"10",display:"flex",flexDirection:"row-reverse",alignItems:"center",marginTop:"-25px"}},l.createElement("div",{style:{zIndex:"10",position:"relative",maxWidth:"100% !important"}},sn&&sn.length>0&&l.createElement(a.MultiLink,{className:"multilinkWrapper",onHeadClick:()=>be(!Oe),displayOptions:Oe,options:sn,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:Me})),l.createElement(a.LinkButton,{label:fe("VIEW_TIMELINE"),style:{color:"#A52A2A"},onClick:()=>{Re(!0);const e=document.getElementById("timeline");e&&e.scrollIntoView({behavior:"smooth"})}}))),l.createElement(Wr,{applicationDetails:Qe,isLoading:Je||je||Ve||Ye,isDataLoading:Je||je||Ve||Ye,applicationData:null==Qe?void 0:Qe.applicationData,mutate:un,id:"timeline",workflowDetails:en,businessService:null==Qe||null===(ve=Qe.processInstancesDetails)||void 0===ve||null===(pe=ve[0])||void 0===pe||null===(me=pe.businessService)||void 0===me?void 0:me.toUpperCase(),moduleCode:"WS",showToast:ye,setShowToast:De,closeToast:()=>{De(null)},timelineStatusPrefix:"WF_"+(null==Qe||null===(Ee=Qe.processInstancesDetails)||void 0===Ee||null===(Se=Ee[0])||void 0===Se||null===(_e=Se.businessService)||void 0===_e?void 0:_e.toUpperCase())+"_",oldValue:rn,isInfoLabel:!(Je||!Digit.Utils.checkPrivacy($e,{uuid:(null==Qe||null===(gn=Qe.applicationData)||void 0===gn||null===(Cn=gn.connectionHolders)||void 0===Cn?void 0:Cn.uuid)||(null==Qe||null===(Nn=Qe.propertyDetails)||void 0===Nn||null===(yn=Nn.owners)||void 0===yn||null===(Dn=yn[0])||void 0===Dn?void 0:Dn.uuid),fieldName:"mobileNumber",model:"User"})),clearDataDetails:()=>{Fe(),Be({}),ke({}),He()}}),Te&&l.createElement(a.Toast,{style:{zIndex:"10000"},warning:null==Te?void 0:Te.isWarning,error:null==Te||!Te.isWarning,label:fe(null==Te?void 0:Te.message),onClose:()=>{he(null)},isDleteBtn:!0})));var gn,Cn,Nn,yn,Dn},WSGetConnectionDetails:()=>{var e,n,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,T,h,A,I,O,b,L,R;const{t:w}=o.useTranslation(),W=Digit.ULBService.getCurrentTenantId(),P=i.useHistory(),[M,B]=t.useState(!1),[F,U]=t.useState(null);let k=g(location.search);const H=null==k?void 0:k.applicationNumber,V=null==k?void 0:k.service,z=null==k?void 0:k.due,Y=null==k?void 0:k.tenantId,[G,q]=t.useState(!1),K=Digit.ULBService.getStateId(),X=["MODIFY_CONNECTION_BUTTON","BILL_AMENDMENT_BUTTON","DISCONNECTION_BUTTON"],{isLoading:Z,data:$}=Digit.Hooks.ws.useConnectionDetail(w,W,H,V,{privacy:Digit.Utils.getPrivacyObject()}),J=t.useRef(),Q=t.useRef();sessionStorage.removeItem("IsDetailsExists"),Digit.SessionStorage.del("PT_CREATE_EMP_WS_NEW_FORM");const{data:ee}=Digit.Hooks.useDemandSearch({consumerCode:null==$||null===(e=$.applicationData)||void 0===e?void 0:e.connectionNo,businessService:"WATER"===V?"WS":"SW",tenantId:W},{enabled:!(null==$||null===(n=$.applicationData)||void 0===n||!n.applicationNo)}),[ne,te]=t.useState(!1),[le,oe]=t.useState([]),[ie,ae]=t.useState(null),re=Digit.Hooks.ws.useToCheckPrivacyEnablement({privacy:{uuid:null!=$&&null!==(r=$.applicationData)&&void 0!==r&&null!==(u=r.applicationNo)&&void 0!==u&&u.includes("WS")?null==$||null===(d=$.applicationData)||void 0===d||null===(s=d.WaterConnection)||void 0===s||null===(c=s[0])||void 0===c||null===(p=c.connectionHolders)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.uuid:null==$||null===(E=$.applicationData)||void 0===E||null===(S=E.SewerageConnections)||void 0===S||null===(_=S[0])||void 0===_||null===(f=_.connectionHolders)||void 0===f||null===(C=f[0])||void 0===C?void 0:C.uuid,fieldName:["connectionHoldersMobileNumber"],model:"WnSConnectionOwner"}})||!1,{mutate:ue}=Digit.Hooks.ws.useWSApplicationActions(V),de=Digit.Utils.browser.isMobile(),{data:se}=Digit.Hooks.obps.useMDMS(K,"common-masters",["uiCommonPay"]),ce=(null==se||null===(N=se["common-masters"])||void 0===N?void 0:N.uiCommonPay)||[],ve=ce&&ce.findIndex(e=>"WS.ONE_TIME_FEE"==e.code);let pe="";pe=ve>-1?ce[ve]:ce&&ce.filter(e=>"DEFAULT"===e.code),t.useEffect(function(){try{return Promise.resolve(Digit.PaymentService.searchAmendment(W,{consumerCode:H,businessService:"WATER"===V?"WS":"SW"})).then(function(e){oe(e.Amendments)})}catch(e){return Promise.reject(e)}},[]);const me=()=>{ae(null)};setTimeout(()=>{me()},1e4);const Ee="Active"===(null==$||null===(y=$.applicationData)||void 0===y?void 0:y.status),Se=null==$?void 0:$.isApplicationApproved;function _e(e){var n,t,l,o;"MODIFY_CONNECTION_BUTTON"===e?(()=>{var e,n,t;if(!Ee)return void ae({key:"error",label:"CONN_NOT_ACTIVE"});if((null==$||null===(e=$.fetchBillsData[0])||void 0===e?void 0:e.totalAmount)>0)return void ae({key:"error",label:"WS_DUE_AMOUNT_SHOULD_BE_ZERO"});let l="/digit-ui/employee/ws/modify-application?applicationNumber="+(null==$||null===(n=$.applicationData)||void 0===n?void 0:n.connectionNo)+"&service="+V+"&propertyId="+(null==$||null===(t=$.propertyDetails)||void 0===t?void 0:t.propertyId)+"&from=WS_COMMON_CONNECTION_DETAIL";P.push(""+l,JSON.stringify({data:$}))})():"BILL_AMENDMENT_BUTTON"===e?(()=>{var e,n;let t=!1;null==le||le.map(e=>{"INWORKFLOW"!==(null==e?void 0:e.status)||(t=!0)}),0!==(null==ee||null===(e=ee.Demands)||void 0===e?void 0:e.length)?t?ae({key:"error",label:"WORKFLOW_IN_PROGRESS"}):P.push("/digit-ui/employee/ws/required-documents?connectionNumber="+(null==$||null===(n=$.applicationData)||void 0===n?void 0:n.connectionNo)+"&tenantId="+Y+"&service="+V,JSON.stringify({data:$})):ae({key:"error",label:"No_Bills_Found"})})():"DISCONNECTION_BUTTON"===e?Se?(console.log("due",z,$),"ACTIVE"===(null===(l=le[0])||void 0===l?void 0:l.status)||(null==$||null===(o=$.fetchBillsData)||void 0===o?void 0:o.length)<=0||"0"==z||z<0?(Digit.SessionStorage.set("WS_DISCONNECTION",$),P.push("/digit-ui/employee/ws/new-disconnection")):te(!0)):ae({key:"error",label:"WORKFLOW_IN_PROGRESS"}):"RESTORATION_BUTTON"===e&&(Se?"ACTIVE"===(null===(n=le[0])||void 0===n?void 0:n.status)||(null==$||null===(t=$.fetchBillsData)||void 0===t?void 0:t.length)<=0||"0"===z?(Digit.SessionStorage.set("WS_DISCONNECTION",$),P.push("/digit-ui/employee/ws/new-restoration")):te(!0):ae({key:"error",label:"WORKFLOW_IN_PROGRESS"}))}Digit.Hooks.useClickOutside(J,()=>{q(!1)},G),Digit.Hooks.useClickOutside(Q,()=>{B(!1)},M);const fe="Active"===(null==$||null===(D=$.applicationData)||void 0===D?void 0:D.status)?X:X.filter(e=>"DISCONNECTION_BUTTON"!==e);let ge=[];const Ce={order:1,label:w("WS_COMMON_DOWNLOAD_BILL"),onClick:()=>function(){try{const e=function(e){if((null==$||null===(e=$.fetchBillsData)||void 0===e?void 0:e.length)>0){var n;const e="WATER"===V?"WS":"SW";let t={isConnectionSearch:!0,connectionNumber:null==$||null===(n=$.applicationData)||void 0===n?void 0:n.connectionNo};return Promise.resolve(Digit.WSService.search({tenantId:W,filters:t,businessService:e})).then(function(n){var t,l,o,i,a,r;let u={applicationNumber:"WATER"===V?null==n||null===(t=n.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo:null==n||null===(o=n.SewerageConnections)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationNo,bussinessService:e};var d;((null==n||null===(a=n.WaterConnection)||void 0===a?void 0:a.length)>0||(null==n||null===(r=n.SewerageConnections)||void 0===r?void 0:r.length)>0)&&function(e,n){try{const t=Digit.ULBService.getCurrentTenantId();Promise.resolve(Digit.WSService.generateBillPdf({tenantId:t,filters:n})).then(function(n){const t=parseInt(n.status,10);201!==t&&200!==t||((e,n)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var t=new FileReader;t.readAsDataURL(e),t.onloadend=function(){window.mSewaApp.downloadBase64File(t.result,n)}}else{const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=n,document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(t.href),7e3)}})(new Blob([n.data],{type:"application/pdf"}),"BILL-"+e+".pdf")})}catch(e){return Promise.reject(e)}}(null==$||null===(d=$.applicationData)||void 0===d?void 0:d.connectionNo,u)})}}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}()},Ne={order:2,label:w("WS_CONNECTION_DETAILS"),onClick:()=>function(){try{var e;const n=null==$||null===(e=$.applicationData)||void 0===e?void 0:e.tenantId;return Hi(v({},null==$?void 0:$.applicationData),v({},null==$?void 0:$.propertyDetails),n,w).then(e=>Digit.Utils.pdf.generatev1(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}()};ge=(null==$||null===(T=$.fetchBillsData)||void 0===T?void 0:T.length)>0?[Ce,Ne]:[Ne];const ye=()=>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"})),De=e=>l.createElement("h1",{style:{marginLeft:"22px"},className:"heading-m BPAheading-m"},e.label),Te=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ye,null));return l.createElement(t.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement("style",null,"\n .multilinkWrapper employee-mulitlink-main-divNew {\n max-width:100%;\n maegin-top:-20px\n }"),l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"80%"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},w("WS_CONNECTION_DETAILS"))),ge&&ge.length>0&&l.createElement("div",{style:{maxWidth:"100% !imnportant",zIndex:"10"}},l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-divNew",onHeadClick:()=>q(!G),displayOptions:G,options:ge,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:J,style:{maxWidth:"100%"}})))),l.createElement(Wr,{applicationDetails:$,isLoading:Z,isDataLoading:Z,applicationData:null==$?void 0:$.applicationData,mutate:ue,businessService:null==$||null===(h=$.processInstancesDetails)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.businessService,moduleCode:"WS",showToast:F,setShowToast:U,closeToast:()=>{U(null)},isInfoLabel:re,labelComponent:l.createElement(j,{t:w})}),(!x("WS_CEMP")||!Ee||null!=$&&$.isDisconnectionDone)&&null!=$&&null!==(I=$.applicationData)&&void 0!==I&&I.isDisconnectionTemporary&&"Active"!==(null==$||null===(O=$.applicationData)||void 0===O?void 0:O.status)&&"DISCONNECTION_EXECUTED"==(null==$||null===(b=$.applicationData)||void 0===b?void 0:b.applicationStatus)?l.createElement(a.ActionBar,null,M?l.createElement(a.Menu,{options:["RESTORATION_BUTTON"],localeKeyPrefix:"WS",t:w,onSelect:_e}):null,l.createElement(a.SubmitBar,{ref:Q,label:w("WF_TAKE_ACTION"),onSubmit:()=>B(!M)})):l.createElement(a.ActionBar,null,M?l.createElement(a.Menu,{options:fe,localeKeyPrefix:"WS",t:w,onSelect:_e}):null,l.createElement(a.SubmitBar,{ref:Q,label:w("WF_TAKE_ACTION"),onSubmit:()=>B(!M)})),ne?l.createElement(a.Modal,{open:ne,headerBarMain:l.createElement(De,{label:w("WS_PENDING_DUES_LABEL")}),headerBarEnd:l.createElement(Te,{onClick:()=>te(!1)}),center:!0,formId:"modal-action",actionCancelOnSubmit:()=>te(!1),actionCancelLabel:w("CS_COMMON_CANCEL"),actionSaveLabel:w("WS_COMMON_COLLECT_LABEL"),actionSaveOnSubmit:()=>{P.push("/digit-ui/employee/payment/collect/"+("WATER"===V?"WS":"SW")+"/"+encodeURIComponent(H)+"/"+Y+"?tenantId="+Y+"&ISWSCON"),te(!1)},popupStyles:de?{width:"720px"}:{},style:de?{minHeight:"45px",height:"auto",width:"44%"}:{minHeight:"45px",height:"auto",width:"107px",paddingLeft:"0px",paddingRight:"0px"},popupModuleMianStyles:de?{paddingLeft:"5px"}:{}},l.createElement("div",{className:"modal-header-ws"},w("WS_CLEAR_DUES_DISCONNECTION_SUB_HEADER_LABEL")," "),l.createElement("div",{className:"modal-body-ws"},l.createElement("span",null,w("WS_COMMON_TABLE_COL_AMT_DUE_LABEL"),": ₹",z||(null==$||null===(L=$.fetchBillsData)||void 0===L||null===(R=L[0])||void 0===R?void 0:R.totalAmount)))):null,ie&&l.createElement(a.Toast,{error:ie.key,label:w(""+ie.label),onClose:me})))},WSActivateConnection:()=>{var e,n,r,u,d,s,c,p,E,S,_,f,C,N,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe,Me,xe,Be,Fe;const{t:Ue}=o.useTranslation();let{state:ke}=i.useLocation();ke=ke?JSON.parse(ke):{},i.useHistory();let He=g(location.search);const[je,Ve]=t.useState(!1),[ze,Ye]=t.useState(!1),[Ge,qe]=t.useState(null),[Ke,Xe]=t.useState({}),[Ze,$e]=t.useState(!1),[Je,Qe]=l.useState({head:"",body:[]}),en=Digit.ULBService.getStateId();let nn=Digit.ULBService.getCurrentTenantId();nn||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");let{data:tn,isLoading:ln}=Digit.Hooks.ws.useWSConfigMDMS.WSActivationConfig(en,{}),on=Lt(null===(e=ke)||void 0===e?void 0:e.data),{isLoading:an,data:rn}=Digit.Hooks.ws.useWSDetailsPage(Ue,nn,null===(n=on)||void 0===n?void 0:n.applicationNo,null===(r=on)||void 0===r?void 0:r.serviceType,{privacy:Digit.Utils.getPrivacyObject()});on=Lt(rn),ke={data:v({},null==rn?void 0:rn.applicationData)};const{mutate:un}=Digit.Hooks.ws.useWSApplicationActions(null==He?void 0:He.service),dn=null!==(u=ke)&&void 0!==u&&null!==(d=u.data)&&void 0!==d&&d.waterSource?Lt(null===(s=ke)||void 0===s||null===(c=s.data)||void 0===c?void 0:c.waterSource):"",sn=dn?m(null==dn?void 0:dn.toUpperCase()," ","_"):"",cn=sn?m(null==sn?void 0:sn.toUpperCase(),".","_"):"",vn="WATER"===(null==He?void 0:He.service)?{connectionType:null!==(p=ke)&&void 0!==p&&null!==(E=p.data)&&void 0!==E&&E.connectionType?{code:null===(S=ke)||void 0===S||null===(_=S.data)||void 0===_?void 0:_.connectionType,i18nKey:"WS_CONNECTIONTYPE_"+m(null===(f=ke)||void 0===f||null===(C=f.data)||void 0===C||null===(N=C.connectionType)||void 0===N?void 0:N.toUpperCase()," ","_")}:"",waterSource:null!==(D=ke)&&void 0!==D&&null!==(T=D.data)&&void 0!==T&&T.waterSource?{code:null===(h=ke)||void 0===h||null===(A=h.data)||void 0===A?void 0:A.waterSource,i18nKey:"WS_SERVICES_MASTERS_WATERSOURCE_"+m(null===(I=ke)||void 0===I||null===(O=I.data)||void 0===O||null===(b=O.waterSource)||void 0===b||null===(L=b.split(".")[0])||void 0===L?void 0:L.toUpperCase()," ","_")}:"",sourceSubData:null!==(R=ke)&&void 0!==R&&null!==(w=R.data)&&void 0!==w&&w.waterSource?{code:null===(W=ke)||void 0===W||null===(P=W.data)||void 0===P?void 0:P.waterSource,i18nKey:"WS_SERVICES_MASTERS_WATERSOURCE_"+cn}:"",pipeSize:null!==(M=ke)&&void 0!==M&&null!==(x=M.data)&&void 0!==x&&x.pipeSize?{code:null===(B=ke)||void 0===B||null===(F=B.data)||void 0===F?void 0:F.pipeSize,i18nKey:null===(U=ke)||void 0===U||null===(k=U.data)||void 0===k?void 0:k.pipeSize}:"",noOfTaps:(null===(H=ke)||void 0===H||null===(j=H.data)||void 0===j?void 0:j.noOfTaps)||"",formDetails:on}:{noOfWaterClosets:(null===(V=ke)||void 0===V||null===(z=V.data)||void 0===z?void 0:z.noOfWaterClosets)||"",noOfToilets:(null===(Y=ke)||void 0===Y||null===(G=Y.data)||void 0===G?void 0:G.noOfToilets)||"",formDetails:on},pn=[{plumberName:(null===(q=ke)||void 0===q||null===(K=q.data)||void 0===K||null===(X=K.plumberInfo)||void 0===X||null===(Z=X[0])||void 0===Z?void 0:Z.name)||"",plumberMobileNo:(null===($=ke)||void 0===$||null===(J=$.data)||void 0===J||null===(Q=J.plumberInfo)||void 0===Q||null===(ee=Q[0])||void 0===ee?void 0:ee.mobileNumber)||"",plumberLicenseNo:(null===(ne=ke)||void 0===ne||null===(te=ne.data)||void 0===te||null===(le=te.plumberInfo)||void 0===le||null===(oe=le[0])||void 0===oe?void 0:oe.licenseNo)||"",detailsProvidedBy:null!==(ie=ke)&&void 0!==ie&&null!==(ae=ie.data)&&void 0!==ae&&null!==(re=ae.additionalDetails)&&void 0!==re&&re.detailsProvidedBy?{i18nKey:"WS_PLUMBER_"+(null===(ue=ke)||void 0===ue||null===(de=ue.data)||void 0===de||null===(se=de.additionalDetails)||void 0===se||null===(ce=se.detailsProvidedBy)||void 0===ce?void 0:ce.toUpperCase()),code:null===(ve=ke)||void 0===ve||null===(pe=ve.data)||void 0===pe||null===(me=pe.additionalDetails)||void 0===me?void 0:me.detailsProvidedBy}:"",applicationNo:null===(Ee=ke)||void 0===Ee||null===(Se=Ee.data)||void 0===Se?void 0:Se.applicationNo,key:Date.now()}],mn="METERED"===(null===(_e=ke)||void 0===_e||null===(fe=_e.data)||void 0===fe||null===(ge=fe.connectionType)||void 0===ge?void 0:ge.toUpperCase())&&"WATER_RECONNECTION"!==(null===(Ce=ke)||void 0===Ce||null===(Ne=Ce.data)||void 0===Ne?void 0:Ne.applicationType)?[{meterId:(null===(ye=ke)||void 0===ye||null===(De=ye.data)||void 0===De?void 0:De.meterId)||"",meterInstallationDate:null!==(Te=ke)&&void 0!==Te&&null!==(he=Te.data)&&void 0!==he&&he.meterInstallationDate?y(null===(Ae=ke)||void 0===Ae||null===(Ie=Ae.data)||void 0===Ie?void 0:Ie.meterInstallationDate):null,meterInitialReading:(null===(Oe=ke)||void 0===Oe||null===(be=Oe.data)||void 0===be||null===(Le=be.additionalDetails)||void 0===Le?void 0:Le.initialMeterReading)||"",connectionExecutionDate:null!==(Re=ke)&&void 0!==Re&&null!==(we=Re.data)&&void 0!==we&&we.connectionExecutionDate?y(null===(We=ke)||void 0===We||null===(Pe=We.data)||void 0===Pe?void 0:Pe.connectionExecutionDate):null}]:[{connectionExecutionDate:null!==(Me=ke)&&void 0!==Me&&null!==(xe=Me.data)&&void 0!==xe&&xe.connectionExecutionDate?y(null===(Be=ke)||void 0===Be||null===(Fe=Be.data)||void 0===Fe?void 0:Fe.connectionExecutionDate):null}],En={formDetails:on,connectionDetails:[vn],plumberDetails:pn,activationDetails:mn};t.useEffect(()=>{an||Xe(on)},[]),t.useEffect(()=>{if(!ln){const e=tn.find(e=>e.hideInCitizen);Qe(e)}},[tn]),t.useEffect(()=>{const e=setTimeout(()=>{Ze&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==He?void 0:He.applicationNumber)+"&service="+(null==He?void 0:He.service))},3e3);return()=>clearTimeout(e)},[Ze]);const Sn=function(e){try{let n=m(e,"/","-"),t="";return t=n.split("-")[2]>1900?n.split("-")[2]+"-"+n.split("-")[1]+"-"+n.split("-")[0]:n.split("-")[0]+"-"+n.split("-")[2]+"-"+n.split("-")[1],Promise.resolve(function(e,n){void 0===n&&(n="dayend");try{const t=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(t[1],t[3]-1,t[2]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===n&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(n){return e}}(t))}catch(e){return Promise.reject(e)}},_n=()=>{qe(null)};return ze||ln||an?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,Ue(Je.head))),l.createElement(a.FormComposer,{config:Je.body,userType:"employee",defaultValues:En,onSubmit:function(e){try{const n=function(){if(je){var n,t,l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe;function ie(){var n,t,l,o;function i(){var n,t,l,o,i,a,r,u,d,s;re.comment=(null==ae||null===(n=ae.comments)||void 0===n?void 0:n.comments)||"",re.action=null==He?void 0:He.action,re.wfDocuments=null!=e&&null!==(t=e.supportingDocuments)&&void 0!==t&&null!==(l=t[0])&&void 0!==l&&l.fileStoreId?[{documentType:"Document - 1",fileStoreId:null==e||null===(o=e.supportingDocuments)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.fileStoreId}]:[],re.processInstance={action:null==He?void 0:He.action,comment:(null==ae||null===(a=ae.comments)||void 0===a?void 0:a.comments)||"",documents:null!=e&&null!==(r=e.supportingDocuments)&&void 0!==r&&null!==(u=r[0])&&void 0!==u&&u.fileStoreId?[{documentType:"Document - 1",fileStoreId:null==e||null===(d=e.supportingDocuments)||void 0===d||null===(s=d[0])||void 0===s?void 0:s.fileStoreId}]:[]},un&&un("WATER"==(null==He?void 0:He.service)?"WATER_RECONNECTION"===(null==re?void 0:re.applicationType)?{WaterConnection:re,reconnectRequest:!0,disconnectRequest:!1}:{WaterConnection:re}:"SEWERAGE_RECONNECTION"===(null==re?void 0:re.applicationType)?{SewerageConnection:re,reconnectRequest:!0,disconnectRequest:!1}:{SewerageConnection:re},{onError:(e,n)=>{qe({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(_n,5e3)},onSuccess:(e,n)=>{qe({key:!1,message:"WS_ACTIVATE_SUCCESS_MESSAGE_MAIN"}),$e(!0)}})}null!=ae&&null!==(n=ae.activationDetails)&&void 0!==n&&null!==(t=n[0])&&void 0!==t&&t.meterInitialReading&&(re.additionalDetails.initialMeterReading=null==ae||null===(l=ae.activationDetails)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.meterInitialReading);const a=function(e,n,t,l){if(null!=ae&&null!==(e=ae.activationDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.connectionExecutionDate)return Promise.resolve(Sn(null==ae||null===(t=ae.activationDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.connectionExecutionDate)).then(function(e){re.connectionExecutionDate=e})}();return a&&a.then?a.then(i):i()}const ae=Lt(e),re=(null===(n=Object.keys(Ke))||void 0===n?void 0:n.length)>0?v({},Ke):v({},null===(t=on)||void 0===t?void 0:t.applicationData);null!=ae&&null!==(l=ae.connectionDetails)&&void 0!==l&&null!==(o=l[0])&&void 0!==o&&null!==(i=o.connectionType)&&void 0!==i&&i.code&&(re.connectionType=null==ae||null===(a=ae.connectionDetails)||void 0===a||null===(r=a[0])||void 0===r||null===(u=r.connectionType)||void 0===u?void 0:u.code),null!=ae&&null!==(d=ae.connectionDetails)&&void 0!==d&&null!==(s=d[0])&&void 0!==s&&null!==(c=s.waterSource)&&void 0!==c&&c.code&&(re.waterSource=null==ae||null===(p=ae.connectionDetails)||void 0===p||null===(m=p[0])||void 0===m||null===(E=m.sourceSubData)||void 0===E?void 0:E.code),null!=ae&&null!==(S=ae.connectionDetails)&&void 0!==S&&null!==(_=S[0])&&void 0!==_&&null!==(f=_.pipeSize)&&void 0!==f&&f.size&&(re.pipeSize=null==ae||null===(g=ae.connectionDetails)||void 0===g||null===(C=g[0])||void 0===C||null===(N=C.pipeSize)||void 0===N?void 0:N.size),null!=ae&&null!==(y=ae.connectionDetails)&&void 0!==y&&null!==(D=y[0])&&void 0!==D&&D.noOfTaps&&(re.noOfTaps=null==ae||null===(T=ae.connectionDetails)||void 0===T||null===(h=T[0])||void 0===h?void 0:h.noOfTaps),null!=ae&&null!==(A=ae.connectionDetails)&&void 0!==A&&null!==(I=A[0])&&void 0!==I&&I.noOfWaterClosets&&(re.noOfWaterClosets=null==ae||null===(O=ae.connectionDetails)||void 0===O||null===(b=O[0])||void 0===b?void 0:b.noOfWaterClosets),null!=ae&&null!==(L=ae.connectionDetails)&&void 0!==L&&null!==(R=L[0])&&void 0!==R&&R.noOfToilets&&(re.noOfToilets=null==ae||null===(w=ae.connectionDetails)||void 0===w||null===(W=w[0])||void 0===W?void 0:W.noOfToilets),null!=ae&&null!==(P=ae.plumberDetails)&&void 0!==P&&null!==(M=P[0])&&void 0!==M&&null!==(x=M.detailsProvidedBy)&&void 0!==x&&x.code&&(re.additionalDetails.detailsProvidedBy=null==ae||null===(B=ae.plumberDetails)||void 0===B||null===(F=B[0])||void 0===F||null===(U=F.detailsProvidedBy)||void 0===U?void 0:U.code),null!=re&&null!==(k=re.plumberInfo)&&void 0!==k&&k[0]||"ULB"!=(null==ae||null===(H=ae.plumberDetails)||void 0===H||null===(j=H.detailsProvidedBy)||void 0===j?void 0:j.code)||(re.plumberInfo=[{}]),null!=ae&&null!==(V=ae.plumberDetails)&&void 0!==V&&null!==(z=V[0])&&void 0!==z&&z.plumberName&&(re.plumberInfo[0].name=null==ae||null===(Y=ae.plumberDetails)||void 0===Y||null===(G=Y[0])||void 0===G?void 0:G.plumberName),null!=ae&&null!==(q=ae.plumberDetails)&&void 0!==q&&null!==(K=q[0])&&void 0!==K&&K.plumberLicenseNo&&(re.plumberInfo[0].licenseNo=null==ae||null===(X=ae.plumberDetails)||void 0===X||null===(Z=X[0])||void 0===Z?void 0:Z.plumberLicenseNo),null!=ae&&null!==($=ae.plumberDetails)&&void 0!==$&&null!==(J=$[0])&&void 0!==J&&J.plumberMobileNo&&(re.plumberInfo[0].mobileNumber=null==ae||null===(Q=ae.plumberDetails)||void 0===Q||null===(ee=Q[0])||void 0===ee?void 0:ee.plumberMobileNo),null!=ae&&null!==(ne=ae.activationDetails)&&void 0!==ne&&null!==(te=ne[0])&&void 0!==te&&te.meterId&&(re.meterId=null==ae||null===(le=ae.activationDetails)||void 0===le||null===(oe=le[0])||void 0===oe?void 0:oe.meterId);const ue=function(e,n,t,l){if(null!=ae&&null!==(e=ae.activationDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.meterInstallationDate)return Promise.resolve(Sn(null==ae||null===(t=ae.activationDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.meterInstallationDate)).then(function(e){re.meterInstallationDate=e})}();return ue&&ue.then?ue.then(ie):ie()}qe({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{qe(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},label:Ue("WF_EMPLOYEE_NEWSW1_ACTIVATE_CONNECTION"),onFormValueChange:(e,n,t)=>{Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&Object.getPrototypeOf(t.errors)===Object.prototype?Ve(!0):Ve(!Object.keys(t.errors).length)}}),Ge&&l.createElement(a.Toast,{error:Ge.key,label:Ue(null==Ge?void 0:Ge.message),warning:null==Ge?void 0:Ge.warning,onClose:()=>{qe(null)}}))},WSApplicationDetailsBillAmendment:()=>{var e,n,i,r,u,d,s,c,v,p,m,E;const{applicationNumber:S}=Digit.Hooks.useQueryParams(),_=Digit.ULBService.getCurrentTenantId(),{t:f}=o.useTranslation();let g="WATER";S.includes("SW")&&(g="SEWERAGE");const[C,N]=t.useState(!1),{isLoading:y,data:D}=Digit.Hooks.ws.useWSApplicationDetailsBillAmendment(f,_,S,g),T=Digit.Hooks.useWorkflowDetails({tenantId:_,id:S,moduleCode:null==D||null===(e=D.processInstancesDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.businessService,config:{enabled:!(null==D||null===(i=D.processInstancesDetails)||void 0===i||null===(r=i[0])||void 0===r||!r.businessService)}});null==T||null===(u=T.data)||void 0===u||null===(d=u.actionState)||void 0===d||null===(s=d.nextActions)||void 0===s||s.forEach(e=>{if("RE-SUBMIT"===(null==e?void 0:e.action)){var n;let t="/digit-ui/employee/ws/bill-amendment?connectionNumber="+(null==D||null===(n=D.applicationData)||void 0===n?void 0:n.connectionNo)+"&tenantId="+_+"&isEdit=true";e.redirectionUrll={action:"RE-SUBMIT-APPLICATION",pathname:t,state:{applicationDetails:D,action:"RE-SUBMIT-APPLICATION"}}}});const{isError:h,error:A,isSuccess:I,mutate:O}=Digit.Hooks.ws.useApplicationActionsBillAmendUpdate();t.useEffect(()=>{C&&setTimeout(()=>N(!1),5e3)},[C]);const[b,L]=t.useState(!1),R=[{order:1,label:f("WS_ACK_PDF"),onClick:()=>function(e,n,t,l,o){try{return ie(e,n,t,l).then(e=>Digit.Utils.pdf.generateBillAmendPDF(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}(null==D?void 0:D.amendment,_,f,null==D?void 0:D.applicationDetails)}];return l.createElement(t.Fragment,null,l.createElement("div",{className:"employee-main-application-details"},l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},f("CS_TITLE_GENERATE_NOTE")),R&&R.length>0&&l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-div",onHeadClick:()=>L(!b),displayOptions:b,options:R,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className"})),l.createElement(Wr,{applicationDetails:D,isLoading:y,isDataLoading:y,applicationData:null==D?void 0:D.applicationData,mutate:O,workflowDetails:T,businessService:null==D||null===(c=D.processInstancesDetails)||void 0===c||null===(v=c[0])||void 0===v?void 0:v.businessService,moduleCode:"WS",showToast:C,setShowToast:N,closeToast:()=>N(null),timelineStatusPrefix:"WF_"+(null==D||null===(p=D.processInstancesDetails)||void 0===p||null===(m=p[0])||void 0===m||null===(E=m.businessService)||void 0===E?void 0:E.toUpperCase())+"_"})),C?l.createElement(a.Toast,{isDleteBtn:!0,error:h?"WS_APPLICATION_UPDATE_ERROR":null,label:I?null==C?void 0:C.label:null==A?void 0:A.Error}):null)},WSSearch:e=>{const[n,i]=t.useState(!0),{t:r}=o.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[d,s]=t.useState({}),c=Digit.ComponentRegistryService.getComponent("WSSearchApplication"),p=window.location.pathname.includes("water/search-application")?"WS":"SW",[m,E]=t.useState(null),S={enabled:!!(d&&Object.keys(d).length>0)},_=Digit.Hooks.ws.useSearchWS({tenantId:u,filters:d,config:S,bussinessService:p,t:r,shortAddress:!0}),f=window.Digit.Utils.browser.isMobile();return null!=_&&_.isLoading&&f?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,l.createElement(c,{t:r,tenantId:u,onSubmit:function(e){if(!(""!==e.applicationNumber||""!==e.connectionNumber||""!==e.mobileNumber||e.applicationType||e.applicationStatus||e.fromDate||e.toDate))return E({warning:!0,label:"ERR_PT_FILL_VALID_FIELDS"}),void setTimeout(()=>{E(!1)},3e3);var n=new Date(null==e?void 0:e.fromDate);null==n||n.setSeconds((null==n?void 0:n.getSeconds())-19800);var t=new Date(null==e?void 0:e.toDate);null==t||t.setSeconds((null==t?void 0:t.getSeconds())+86399-19800);const l=v({},e,e.toDate?{toDate:null==t?void 0:t.getTime()}:{},e.fromDate?{fromDate:null==n?void 0:n.getTime()}:{});s(Object.keys(l).filter(e=>l[e]).reduce((e,n)=>v({},e,{[n]:"object"==typeof l[n]?l[n].code:l[n]}),{}))},data:0==(null==_||null===(C=_.data)||void 0===C?void 0:C.length)?{display:"ES_COMMON_NO_DATA"}:(null==_||null===(N=_.data)||void 0===N?void 0:N.length)>0?null==_?void 0:_.data:[],count:null==_?void 0:_.count,resultOk:(null==_||null===(g=_.data)||void 0===g?void 0:g.length)>0,businessService:p,isLoading:null==_?void 0:_.isLoading}),m&&l.createElement(a.Toast,{error:m.error,warning:m.warning,label:r(m.label),onClose:()=>{E(null)}}));var g,C,N},WSSearchWater:e=>{var n;const[i,r]=t.useState(!0),{t:u}=o.useTranslation(),d=Digit.ULBService.getCurrentTenantId(),[s,c]=t.useState({}),[p,m]=t.useState(!1),E=Digit.ComponentRegistryService.getComponent("WSSearchWaterConnection"),S=window.location.pathname.includes("water/search-connection")?"WS":"SW",[_,f]=t.useState(null),g=t.useCallback(e=>{const{connectionNumber:n,oldConnectionNumber:t,mobileNumber:l,propertyId:o}=e;n||t||l||o?c(Object.keys(e).filter(n=>e[n]).reduce((n,t)=>v({},n,{[t]:"object"==typeof e[t]?e[t].code:e[t]}),{})):(f({error:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"}),setTimeout(()=>{f(!1)},3e3))}),C={enabled:!!(s&&Object.keys(s).length>0)};let N=Digit.Hooks.ws.useSearchWS({tenantId:d,filters:s,config:C,bussinessService:S,t:u,shortAddress:!0});const y=window.Digit.Utils.browser.isMobile();return null!=N&&N.isLoading&&y?l.createElement(a.Loader,null):(null!=N&&N.isLoading||(N.data=null==N||null===(n=N.data)||void 0===n?void 0:n.map(e=>{var n,t;return null!=e&&null!==(n=e.connectionNo)&&void 0!==n&&n.includes("WS")?e.service="WATER":null!=e&&null!==(t=e.connectionNo)&&void 0!==t&&t.includes("SW")&&(e.service="SEWERAGE"),e})),l.createElement(t.Fragment,null,l.createElement(E,{t:u,tenantId:d,onSubmit:g,data:0==(null==N||null===(T=N.data)||void 0===T?void 0:T.length)?{display:"ES_COMMON_NO_DATA"}:(null==N||null===(h=N.data)||void 0===h?void 0:h.length)>0?null==N?void 0:N.data:[],count:null==N?void 0:N.count,resultOk:(null==N||null===(D=N.data)||void 0===D?void 0:D.length)>0,businessService:S,isLoading:null==N?void 0:N.isLoading}),_&&l.createElement(a.Toast,{error:_.error,warning:_.warning,label:u(_.label),onClose:()=>{f(null)}})));var D,T,h},WSEditApplication:()=>{var e,n,r,u,d,s,c,p;const{t:m}=o.useTranslation();let{state:E}=i.useLocation();E=E?"string"==typeof E?JSON.parse(E):E:{},i.useHistory();let S=g(location.search);const[_,f]=t.useState(!1),[C,N]=t.useState(null),[y,D]=t.useState({}),[T,h]=t.useState({head:"",body:[]}),[A,I]=t.useState(!0),[O,b]=t.useState(!1);let L=Digit.ULBService.getCurrentTenantId();L||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const w=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")),W=(null==S?void 0:S.service)||(null==w||null===(e=w.applicationData)||void 0===e?void 0:e.serviceType);let P=Lt(null===(n=E)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.applicationDetails);const M=Lt(null===(u=E)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.action),x=Digit.ULBService.getStateId();let{data:B,isLoading:F}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(x,{}),{isLoading:k,data:H}=Digit.Hooks.ws.useWSDetailsPage(m,L,null===(s=P)||void 0===s?void 0:s.applicationNo,null===(c=P)||void 0===c||null===(p=c.applicationData)||void 0===p?void 0:p.serviceType,{privacy:Digit.Utils.getPrivacyObject()});P=H;const[j,V]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[z,Y,G]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:q}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:j},tenantId:L},{filters:{propertyIds:j},tenantId:L,enabled:!(!j||""==j),privacy:Digit.Utils.getPrivacyObject()});t.useEffect(()=>{if(!F){var e;const n=B.find(e=>e.hideInCitizen&&e.isEdit);n.head="WS_APP_FOR_WATER_AND_SEWERAGE_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isEditConnection&&t.push(e)}),n.body=t,h(n)}},[B]),t.useEffect(()=>{var e,n,t,l;!j&&(null==z||null===(e=z.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&V(null==z||null===(t=z.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==z?void 0:z.cpt]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=P)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return sessionStorage.setItem("appData",JSON.stringify(y)),Promise.resolve(R(P,W,!1,!1,m)).then(function(e){Y(v({},z,e)),D(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[P,H,null==z?void 0:z.cpt,z,q]),t.useEffect(()=>{var e;Y(v({},z,{cpt:{details:null==q||null===(e=q.Properties)||void 0===e?void 0:e[0]}}))},[q]),t.useEffect(()=>{var e,n,t,l,o,i,a;((null==z||null===(e=z.DocumentsRequired)||void 0===e||null===(n=e.documents)||void 0===n?void 0:n.length)>0||null!=z&&null!==(t=z.ConnectionDetails)&&void 0!==t&&null!==(l=t[0])&&void 0!==l&&l.water||null!=z&&null!==(o=z.ConnectionDetails)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.sewerage||null!=z&&null!==(a=z.cpt)&&void 0!==a&&a.details&&!k)&&I(!1)},[q,z,null==z?void 0:z.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;O&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==z||null===(e=z.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==z||null===(t=z.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase()))},5e3);return()=>clearTimeout(e)},[O]);const{mutate:K}=Digit.Hooks.ws.useWSApplicationActions(W);return A||F?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,m(T.head))),l.createElement(a.FormComposer,{config:T.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(z,n)||Y(v({},z,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?f(!0):f(!Object.keys(t.errors).length)},label:m("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(_){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(function(e,n,t){try{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q;null==e||null===(l=e.cpt)||void 0===l||null===(o=l.details)||void 0===o||null===(i=o.owners)||void 0===i||i.forEach(e=>{null!=e&&e.permanentAddress&&(e.correspondenceAddress=null==e?void 0:e.permanentAddress)});let ee=v({},n.applicationData,{propertyId:null==e||null===(a=e.cpt)||void 0===a||null===(r=a.details)||void 0===r?void 0:r.propertyId,proposedTaps:(null==e||null===(u=e.ConnectionDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.proposedTaps)&&Number(null==e||null===(s=e.ConnectionDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.proposedTaps),proposedPipeSize:(null==e||null===(p=e.ConnectionDetails)||void 0===p||null===(m=p[0])||void 0===m||null===(E=m.proposedPipeSize)||void 0===E?void 0:E.size)&&Number(null==e||null===(S=e.ConnectionDetails)||void 0===S||null===(_=S[0])||void 0===_||null===(f=_.proposedPipeSize)||void 0===f?void 0:f.size),proposedWaterClosets:(null==e||null===(g=e.ConnectionDetails)||void 0===g||null===(C=g[0])||void 0===C?void 0:C.proposedWaterClosets)&&Number(null==e||null===(N=e.ConnectionDetails)||void 0===N||null===(y=N[0])||void 0===y?void 0:y.proposedWaterClosets),proposedToilets:(null==e||null===(D=e.ConnectionDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.proposedToilets)&&Number(null==e||null===(h=e.ConnectionDetails)||void 0===h||null===(A=h[0])||void 0===A?void 0:A.proposedToilets),connectionHolders:null!=e&&null!==(I=e.ConnectionHolderDetails)&&void 0!==I&&null!==(O=I[0])&&void 0!==O&&O.sameAsOwnerDetails?null:[v({},null==n||null===(b=n.applicationData)||void 0===b||null===(L=b.connectionHolders)||void 0===L?void 0:L[0],{correspondenceAddress:(null==e||null===(R=e.ConnectionHolderDetails)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.address)||"",fatherOrHusbandName:(null==e||null===(W=e.ConnectionHolderDetails)||void 0===W||null===(P=W[0])||void 0===P?void 0:P.guardian)||"",gender:(null==e||null===(M=e.ConnectionHolderDetails)||void 0===M||null===(x=M[0])||void 0===x||null===(B=x.gender)||void 0===B?void 0:B.code)||"",mobileNumber:(null==e||null===(F=e.ConnectionHolderDetails)||void 0===F||null===(U=F[0])||void 0===U?void 0:U.mobileNumber)||"",name:(null==e||null===(k=e.ConnectionHolderDetails)||void 0===k||null===(H=k[0])||void 0===H?void 0:H.name)||"",emailId:(null==e||null===(j=e.ConnectionHolderDetails)||void 0===j||null===(V=j[0])||void 0===V?void 0:V.emailId)||"",ownerType:(null==e||null===(z=e.ConnectionHolderDetails)||void 0===z||null===(Y=z[0])||void 0===Y||null===(G=Y.ownerType)||void 0===G?void 0:G.code)||"",relationship:(null==e||null===(q=e.ConnectionHolderDetails)||void 0===q||null===(K=q[0])||void 0===K||null===(X=K.relationship)||void 0===X?void 0:X.code)||"",sameAsPropertyAddress:null==e||null===(Z=e.ConnectionHolderDetails)||void 0===Z||null===($=Z[0])||void 0===$?void 0:$.sameAsOwnerDetails})],property:null==e||null===(J=e.cpt)||void 0===J?void 0:J.details,processInstance:{action:t||"RESUBMIT_APPLICATION"},action:t||"RESUBMIT_APPLICATION",documents:null==e||null===(Q=e.DocumentsRequired)||void 0===Q?void 0:Q.documents});return Promise.resolve(ee)}catch(e){return Promise.reject(e)}}(e,n,M)).then(function(t){var l,o,i,a,r,u;const d="WATER"==(null==e||null===(l=e.ConnectionDetails)||void 0===l||null===(o=l[0])||void 0===o?void 0:o.serviceName)?{WaterConnection:t}:{SewerageConnection:t};var s;f(!1),null!=n&&null!==(i=n.processInstancesDetails)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&null!==(r=a.state)&&void 0!==r&&null!==(u=r.applicationStatus)&&void 0!==u&&u.includes("CITIZEN_ACTION")?K&&K(d,{onError:(e,n)=>{N({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(closeToastOfError,5e3),f(!0)},onSuccess:(e,n)=>{N({key:!1,message:"WS_APPLICATION_SUBMITTED_SUCCESSFULLY_LABEL"}),b(!0)}}):(sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(t)),window.location.assign(""+window.location.origin+(null===(s=E)||void 0===s?void 0:s.url)))})}N({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{N(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:z,appData:y}),C&&l.createElement(a.Toast,{error:C.key,label:m(null==C?void 0:C.message),warning:null==C?void 0:C.warning,onClose:()=>{N(null)}}))},WSConsumptionDetails:e=>{var n,i,r,u,d,s,c;const{t:p}=o.useTranslation(),m=Digit.UserService.getUser(),E=(null==m||null===(n=m.info)||void 0===n?void 0:n.tenantId)||Digit.ULBService.getCurrentTenantId();let S=g(location.search);const{applicationNo:_}=Digit.Hooks.useQueryParams(),f=null==S?void 0:S.service;let C={tenantId:E,connectionNos:_};const[N,y]=t.useState(!1),[D,T]=t.useState({}),[h,A]=t.useState({}),I="WATER"===f?"WS":"SW",O=!!Digit.Utils.browser.isMobile(),[b,L]=t.useState(""),[R,w]=t.useState(null),[W,P]=t.useState(null),[M,x]=t.useState(!1),[B,F]=t.useState(""),[U,k]=t.useState(""),[H,j]=t.useState(""),[V,z]=t.useState(!1),Y=Digit.UserService.getUser().info.roles.map(e=>e.code).filter(e=>"WS_CEMP"===e||"SW_CEMP"===e).length>0,{isLoading:G,data:q}=Digit.Hooks.ws.useWSConsumptionSearch({filters:C},{filters:C}),{isLoading:K,data:X}=Digit.Hooks.ws.useGetMeterStatusList(E),{isLoading:Z,data:$}=Digit.Hooks.ws.useGetBillingPeriodValidation(E);let J={connectionNumber:_};const{isLoading:Q,data:ee}=Digit.Hooks.ws.useOldValue({tenantId:E,filters:v({},J),businessService:"WS"===I?"WATER":"SEWERAGE"}),{mutate:ne}=Digit.Hooks.ws.useMeterReadingCreateAPI(I);t.useEffect(()=>{if(!Q){let e="WS"==I?null==ee?void 0:ee.WaterConnection:null==ee?void 0:ee.SewerageConnections,n=null==e?void 0:e.filter(e=>{var n;return null==e||null===(n=e.applicationType)||void 0===n?void 0:n.includes("DISCONNECT")});0==(null==n?void 0:n.length)&&z(!0),null==n||n.map(e=>{z("DISCONNECTION_EXECUTED"!==(null==e?void 0:e.applicationStatus)&&"PENDING_FOR_DISCONNECTION_EXECUTION"!==(null==e?void 0:e.applicationStatus))})}},[ee]);const te=function(e,n){void 0===n&&(n="dayend");try{const t=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(t[1],t[2]-1,t[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===n&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(n){return e}},le=(null==$||null===(i=$.MdmsRes)||void 0===i||null===(r=i["ws-services-masters"])||void 0===r||r.billingPeriod.filter(e=>"Metered"===e.connectionType),()=>{y(!1)}),oe=()=>{w(!1),P(null)};let ie=null==X||null===(u=X.MdmsRes)||void 0===u||null===(d=u["ws-services-calculation"])||void 0===d?void 0:d.MeterStatus.map(e=>({code:e,i18nKey:"WS_SERVICES_CALCULATION_METERSTATUS_"+Digit.Utils.locale.getTransformedLocale(e)})),ae={},re={};const ue=e=>e?new Date(e).getDate()+"/"+(new Date(e).getMonth()+1)+"/"+new Date(e).getFullYear().toString():"NA",de=null==q?void 0:q.meterReadings,se={label:{heading:"WS_CONSUMPTION_BUTTON_METER_READING_LABEL",submit:"CORE_COMMON_SAVE",cancel:"CORE_CHANGE_TENANT_CANCEL"},form:[{body:[{populators:l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),label:""+p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),text:H,className:"border-none"}))},{label:""+p("WS_SERV_DETAIL_METER_STAT"),isMandatory:!0,type:"dropdown",populators:l.createElement(a.Dropdown,{option:ie,autoComplete:"off",optionKey:"i18nKey",id:"meterStatus",select:e=>{L(e),k("")},selected:b,t:p})},{populators:l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),text:null==de||null===(s=de[0])||void 0===s?void 0:s.currentReading,className:"border-none"}))},{populators:l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),text:ue(null==de||null===(c=de[0])||void 0===c?void 0:c.currentReadingDate),className:"border-none"}))},{label:p("WS_CONSUMPTION_DETAILS_CURRENT_READING_LABEL"),isMandatory:"Working"===b.code,disable:"Working"!==b.code,type:"number",populators:v({name:"currentReading"},ae="Working"===b.code?{}:{value:""})},{label:p("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),isMandatory:"Working"===b.code,disable:"Working"!==b.code,type:"custom",populators:{name:"currentReadingDate",validation:{required:"Working"===b.code},customProps:{},defaultValue:Digit.Utils.date.getDate(),component:(e,n)=>l.createElement(a.DatePicker,v({onChange:e.onChange,date:e.value},n,{disabled:"Working"!==b.code}))}},{label:p("WS_SERV_DETAIL_CONSUMP"),isMandatory:!1,type:"number",disable:"Working"===b.code,populators:v({},re="Working"===b.code?{name:"consumption",value:U}:{name:"consumption"})}]}]},ce=e=>l.createElement("h1",{className:"heading-m"},e.label),ve=()=>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"})),pe=e=>l.createElement("div",{className:"icon-bg-secondary",onClick:e.onClick},l.createElement(ve,null));if(G||Q)return l.createElement(a.Loader,null);let{meterReadings:me}=q||{};return l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement(a.Header,{styles:{marginLeft:"15px"}},""+p("WS_VIEW_CONSUMPTION")),l.createElement("div",null,(null==me?void 0:me.length)>0&&me.map((e,n)=>{return l.createElement("div",{key:n},l.createElement(a.Card,null,l.createElement(a.StatusTable,null,l.createElement(a.Row,{key:p("WS_MYCONNECTIONS_CONSUMER_NO"),label:""+p("WS_MYCONNECTIONS_CONSUMER_NO"),text:(null==e?void 0:e.connectionNo)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),label:""+p("WS_VIEW_BILL_BILLING_PERIOD_LABEL"),text:(null==e?void 0:e.billingPeriod)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_METER_STATUS_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_METER_STATUS_LABEL"),text:(null==e?void 0:e.meterStatus)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_LABEL"),text:(null==e?void 0:e.lastReading)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_LAST_READING_DATE_LABEL"),text:null!=e&&e.lastReadingDate?Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.lastReadingDate):p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_SERV_DETAIL_CUR_METER_READ"),label:""+p("WS_SERV_DETAIL_CUR_METER_READ"),text:(null==e?void 0:e.currentReading)||p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_CURRENT_READING_DATE_LABEL"),text:null!=e&&e.currentReadingDate?Digit.DateUtils.ConvertEpochToDate(null==e?void 0:e.currentReadingDate):p("NA"),className:"border-none"}),l.createElement(a.Row,{key:p("WS_CONSUMPTION_DETAILS_CONSUMPTION_LABEL"),label:""+p("WS_CONSUMPTION_DETAILS_CONSUMPTION_LABEL"),text:(t=null==e?void 0:e.currentReading,o=null==e?void 0:e.lastReading,t&&o?Number(t-o):p("NA")),className:"border-none"}))));var t,o}),!(null!=me&&me.length)>0&&l.createElement("p",{style:{marginLeft:"16px",marginTop:"16px"}},p("WS_NO_CONSUMPTION_FOUND"))),G||K||Z||!Y?null:l.createElement("div",null,V&&l.createElement(a.ActionBar,null,l.createElement(a.SubmitBar,{label:p("WS_CONSUMPTION_BUTTON_METER_READING_LABEL"),onSubmit:()=>{var e,n;y(!0),T(null==q?void 0:q.meterReadings[0]),L({code:null==q||null===(e=q.meterReadings[0])||void 0===e?void 0:e.meterStatus,i18nKey:"WS_SERVICES_CALCULATION_METERSTATUS_"+Digit.Utils.locale.getTransformedLocale(null==q||null===(n=q.meterReadings[0])||void 0===n?void 0:n.meterStatus)}),j(ue(null==D?void 0:D.currentReadingDate)+" - "+ue(te(Digit.Utils.date.getDate())))}})))),N&&l.createElement(a.Modal,{headerBarMain:l.createElement(ce,{label:p(se.label.heading)}),headerBarEnd:l.createElement(pe,{onClick:le}),actionCancelLabel:p(se.label.cancel),actionCancelOnSubmit:le,actionSaveLabel:p(se.label.submit),actionSaveOnSubmit:()=>{},formId:"modal-action",popupStyles:O?{width:"720px"}:{},popupModuleMianStyles:O?{paddingLeft:"5px"}:{}},M?l.createElement(a.Loader,null):l.createElement(a.FormComposer,{config:se.form,onFormValueChange:(e,n,t)=>{var l,o;"Working"===(null==b?void 0:b.code)?(F(null==n?void 0:n.currentReading),j(ue(null==D?void 0:D.currentReadingDate)+" - "+ue(null==n?void 0:n.currentReadingDate)),parseInt(B)<parseInt(null==de||null===(l=de[0])||void 0===l?void 0:l.lastReading)?(n.consumption="0",k("0")):(n.consumption=""+(parseInt(B)-parseInt(null==de||null===(o=de[0])||void 0===o?void 0:o.currentReading)),k(n.consumption))):k(n.consumption)},cardStyle:{marginLeft:"0px",marginRight:"0px",marginTop:"-25px"},className:"BPAemployeeCard",noBoxShadow:!0,inline:!0,childrenAtTheBottom:!0,onSubmit:function(e){try{let t=parseInt(null==D?void 0:D.currentReadingDate),l=parseInt(te(null==e?void 0:e.currentReadingDate)),o=parseInt(te(Digit.Utils.date.getDate()));if("Working"===(null==b?void 0:b.code)){var n;if(null==e||!e.currentReading||null==(null==e?void 0:e.currentReading)||""===(null==e?void 0:e.currentReading))return w({key:"error",message:p("ERR_CURRENT_READING_REQUIRED")}),P(p("ERR_CURRENT_READING_REQUIRED")),setTimeout(oe,5e3),Promise.resolve();if(l<t||l>o)return w({key:"error",message:p("ERR_CURRENT_READING_DATE_SHOULD_NOT_BE_LESS_THAN_FROM_DATE_AND_NOT_GREATER_THAN_TO_DATE")}),P(p("ERR_CURRENT_READING_DATE_SHOULD_NOT_BE_LESS_THAN_FROM_DATE_AND_NOT_GREATER_THAN_TO_DATE")),setTimeout(oe,5e3),Promise.resolve();if((null==e?void 0:e.currentReading)<=(null==de||null===(n=de[0])||void 0===n?void 0:n.currentReading))return w({key:"error",message:p("CURRENT_READING_ERROR")}),P(p("CURRENT_READING_ERROR")),setTimeout(oe,5e3),Promise.resolve()}else e.currentReading=parseInt(null==D?void 0:D.currentReading)+parseInt(null==e?void 0:e.consumption);let i={meterReadings:{billingPeriod:ue(null==D?void 0:D.currentReadingDate)+" - "+ue(null==e?void 0:e.currentReadingDate),connectionNo:null==D?void 0:D.connectionNo,currentReading:null==e?void 0:e.currentReading,currentReadingDate:te(null==e?void 0:e.currentReadingDate),lastReading:null==D?void 0:D.currentReading,lastReadingDate:null==D?void 0:D.currentReadingDate,meterStatus:null==b?void 0:b.code,tenantId:null==D?void 0:D.tenantId}};const a=function(){if(ne)return x(!0),Promise.resolve(ne(i,{onError:(e,n)=>{x(!1),y(!1),w({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(oe,5e3)},onSuccess:function(e,n){try{return x(!1),y(!1),w({key:"success",message:"WS_METER_READING_ADDED_SUCCESFULLY"}),setTimeout(oe,3e3),setTimeout(()=>{window.location.reload()},4e3),Promise.resolve()}catch(e){return Promise.reject(e)}}})).then(function(){})}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:h,formId:"modal-action"})),R&&l.createElement(a.Toast,{style:{zIndex:"10000"},error:"error"===(null==R?void 0:R.key),label:p(null==R?void 0:R.message),onClose:oe}))},WSModifyApplication:()=>{var e,n,r,u;const{t:d}=o.useTranslation();let{state:s}=i.useLocation();s=s?"string"==typeof s?JSON.parse(s):s:{};const c=i.useHistory();let p=g(location.search);const[m,E]=t.useState(!1),[S,_]=t.useState(null),[f,C]=t.useState({}),[N,y]=t.useState({head:"",body:[]}),[D,T]=t.useState(!0),[A,I]=t.useState(!1),[O,b]=t.useState(!1);let L=Digit.ULBService.getCurrentTenantId();const w=null==p?void 0:p.service,W=Digit.ULBService.getStateId();let{data:P,isLoading:x}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(W,{}),B=Lt(null===(e=s)||void 0===e?void 0:e.data),{data:F}=Digit.Hooks.ws.useWSDetailsPage(d,L,null===(n=B)||void 0===n?void 0:n.applicationNo,null===(r=B)||void 0===r||null===(u=r.applicationData)||void 0===u?void 0:u.serviceType,{privacy:Digit.Utils.getPrivacyObject()});B=F;const[k,H]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[j,V,z]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:Y}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:k},tenantId:L},{filters:{propertyIds:k},tenantId:L,enabled:!(!k||""==k),privacy:Digit.Utils.getPrivacyObject()});t.useEffect(()=>{if(!x){var e;const n=P.find(e=>e.hideInCitizen&&e.isModify);n.head="WS_WATER_AND_SEWERAGE_MODIFY_CONNECTION_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isModifyConnection&&t.push(e)}),t.forEach(e=>{"WS_COMMON_PROPERTY_DETAILS"==(null==e?void 0:e.head)&&(e.head="")}),n.body=t,y(n)}},[P]),t.useEffect(()=>{var e,n,t,l;!k&&(null==j||null===(e=j.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&H(null==j||null===(t=j.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==j?void 0:j.cpt]),t.useEffect(function(){try{sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));const e=function(e,n){if(null!==(e=B)&&void 0!==e&&null!==(n=e.applicationData)&&void 0!==n&&n.id)return Promise.resolve(R(B,w,!0,void 0,d)).then(function(e){V(v({},j,e)),C(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[B,F]),t.useEffect(()=>{var e;V(v({},j,{cpt:{details:null==Y||null===(e=Y.Properties)||void 0===e?void 0:e[0]}}))},[Y]),t.useEffect(()=>{var e,n;null!=j&&null!==(e=j.ConnectionDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.applicationNo&&T(!1)},[Y,j,null==j?void 0:j.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;A&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==j||null===(e=j.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==j||null===(t=j.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase()))},3e3);return()=>clearTimeout(e)},[A]);const{mutate:G}=Digit.Hooks.ws.useWaterCreateAPI("WATER"),{mutate:q}=Digit.Hooks.ws.useWSApplicationActions("WATER"),{mutate:K}=Digit.Hooks.ws.useWaterCreateAPI("SEWERAGE"),{mutate:X}=Digit.Hooks.ws.useWSApplicationActions("SEWERAGE");return D||O||x?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,d(N.head))),l.createElement(a.FormComposer,{config:N.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(j,n)||V(v({},j,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?E(!0):E(!Object.keys(t.errors).length)},label:d("CS_COMMON_SUBMIT"),onSubmit:function(e){try{var n,t,l;if(!(null!=e&&null!==(n=e.cpt)&&void 0!==n&&n.id||null!=Y&&null!==(t=Y.Properties)&&void 0!==t&&t[0]||null!=e&&null!==(l=e.cpt)&&void 0!==l&&l.details&&Y))return _({key:"error",message:"ERR_INVALID_PROPERTY_ID"}),Promise.resolve();const o=function(){if(m){var n,t;null!=e&&null!==(n=e.cpt)&&void 0!==n&&n.details||(e.cpt={details:null==Y||null===(t=Y.Properties)||void 0===t?void 0:t[0]});const l=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(M(e,l)).then(function(n){var t,l,o,i,a;function r(){const e=function(){if("WATER"!==w){const e=function(){if(K)return b(!0),Promise.resolve(K(u,{onError:(e,n)=>{var t,l,o,i,a,r,u,d;b(!1),_({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.message?null==e||null===(a=e.response)||void 0===a||null===(r=a.data)||void 0===r||null===(u=r.Errors)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(h(null==e||null===(t=e.SewerageConnections)||void 0===t?void 0:t[0],"SEWERAGE")).then(function(e){return Promise.resolve(X({SewerageConnection:e,reconnectRequest:!1,disconnectRequest:!1},{onError:(e,n)=>{b(!1),_({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:(e,n)=>{var t,l;z(),c.push("/digit-ui/employee/ws/ws-response?applicationNumber1="+(null==e||null===(t=e.SewerageConnections)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo))}})).then(function(){})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})}const u="WATER"==(null==e||null===(t=e.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.serviceName)?"WATER_RECONNECTION"===(null==e||null===(o=e.ConnectionDetails)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.applicationType)?{WaterConnection:n,reconnectRequest:!0,disconnectRequest:!1}:{WaterConnection:n,reconnectRequest:!1,disconnectRequest:!1}:"SEWERAGE_RECONNECTION"===(null===(a=formData)||void 0===a?void 0:a.applicationType)?{SewerageConnection:n,reconnectRequest:!0,disconnectRequest:!1}:{SewerageConnection:n,reconnectRequest:!1,disconnectRequest:!1},d=function(){if("WATER"==w){const e=function(){if(G)return b(!0),Promise.resolve(G(u,{onError:(e,n)=>{var t,l,o,i,a,r;b(!1),_({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:function(e,n){try{var t;return Promise.resolve(h(null==e||null===(t=e.WaterConnection)||void 0===t?void 0:t[0],"WATER")).then(function(e){q({WaterConnection:e,reconnectRequest:!1,disconnectRequest:!1},{onError:(e,n)=>{var t,l,o,i,a,r;b(!1),_({key:"error",message:null!=e&&null!==(t=e.response)&&void 0!==t&&null!==(l=t.data)&&void 0!==l&&null!==(o=l.Errors)&&void 0!==o&&o[0].message?null==e||null===(i=e.response)||void 0===i||null===(a=i.data)||void 0===a||null===(r=a.Errors)||void 0===r?void 0:r[0].message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:(e,n)=>{var t,l;z(),c.push("/digit-ui/employee/ws/ws-response?applicationNumber="+(null==e||null===(t=e.WaterConnection)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.applicationNo))}})})}catch(e){return Promise.reject(e)}}})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();return d&&d.then?d.then(r):r()})}_({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{_(!1)},3e3)}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:j,appData:f}),S&&l.createElement(a.Toast,{isDleteBtn:!0,error:"error"===(null==S?void 0:S.key),label:d(null==S?void 0:S.message),onClose:()=>{_(null)}}))},WSEditModifyApplication:()=>{var e;const{t:n}=o.useTranslation();let{state:r}=i.useLocation();r=r?"string"==typeof r?JSON.parse(r):r:{},i.useHistory();let u=g(location.search);const[d,s]=t.useState(!1),[c,p]=t.useState(null),[m,E]=t.useState({}),[S,_]=t.useState({head:"",body:[]}),[f,C]=t.useState(!0),[N,y]=t.useState(!1),D=Digit.ULBService.getCurrentTenantId(),T=null==u?void 0:u.service,h=Lt(null===(e=r)||void 0===e?void 0:e.data),A=Digit.ULBService.getStateId();let{data:I,isLoading:O}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(A,{});const[b,L]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[w,W,P]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{data:x}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:b},tenantId:D},{filters:{propertyIds:b},tenantId:D,enabled:!(!b||""==b)});t.useEffect(()=>{if(!O){var e;const n=I.find(e=>e.hideInCitizen&&e.isModify);n.head="WS_WATER_AND_SEWERAGE_MODIFY_CONNECTION_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isModifyConnection&&t.push(e)}),t.forEach(e=>{"WS_COMMON_PROPERTY_DETAILS"==(null==e?void 0:e.head)&&(e.head="")}),n.body=t,_(n)}},[I]),t.useEffect(()=>{var e,n,t,l;!b&&(null==w||null===(e=w.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&L(null==w||null===(t=w.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==w?void 0:w.cpt]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),t=function(t){if(null!=h&&null!==(t=h.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(R(h,T,!0,!1,n)).then(function(e){W(v({},w,e)),E(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[x,w,null==w?void 0:w.cpt]),t.useEffect(()=>{var e;W(v({},w,{cpt:{details:null==x||null===(e=x.Properties)||void 0===e?void 0:e[0]}}))},[x]),t.useEffect(()=>{var e,n;null!=w&&null!==(e=w.ConnectionDetails)&&void 0!==e&&null!==(n=e[0])&&void 0!==n&&n.applicationNo&&C(!1)},[x,w,null==w?void 0:w.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;N&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==w||null===(e=w.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==w||null===(t=w.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase())+"&mode=MODIFY")},3e3);return()=>clearTimeout(e)},[N]);const{mutate:B}=Digit.Hooks.ws.useWSApplicationActions(null==u?void 0:u.service);return f||O?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,n(S.head))),l.createElement(a.FormComposer,{config:S.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(w,n)||W(v({},w,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?s(!0):s(!Object.keys(t.errors).length)},label:n("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(d){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(M(e,n,"SUBMIT_APPLICATION")).then(function(n){var t,l;const o="WATER"==(null==e||null===(t=e.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.serviceName)?{WaterConnection:n}:{SewerageConnection:n};B&&B(o,{onError:(e,n)=>{p({key:"error",message:null!=e&&e.message?e.message:e}),setTimeout(closeToastOfError,5e3)},onSuccess:(e,n)=>{p({key:!1,message:"WS_APPLICATION_SUBMITTED_SUCCESSFULLY_LABEL"}),y(!0)}})})}p({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{p(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:w}),c&&l.createElement(a.Toast,{error:c.key,label:n(null==c?void 0:c.message),onClose:()=>{p(null)},isDleteBtn:!0}))},WSDisconnectionApplication:()=>{const{t:e}=o.useTranslation(),n=i.useRouteMatch(),t=Digit.ULBService.getStateId();let{data:r,isLoading:u}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(t,{}),d=[];return!u&&r.length>0?(r.forEach(e=>{d=d.concat(e.body.filter(e=>!e.hideInCitizen))}),d.indexRoute="docsrequired",l.createElement(i.Switch,null,d.map((t,o)=>{const{component:a,texts:r,inputs:u,key:d,isSkipEnabled:s}=t,c="string"==typeof a?Digit.ComponentRegistryService.getComponent(a):a;return l.createElement(i.Route,{path:Fr(n.path,n.params)+"/"+t.route,key:o},l.createElement(c,{config:{texts:r,inputs:u,key:d,isSkipEnabled:s},t:e,userType:"employee"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Fr(n.path,n.params)+"/"+d.indexRoute})))):l.createElement(a.Loader,null)},WSRestorationApplication:()=>{const{t:e}=o.useTranslation(),n=i.useRouteMatch(),t=Digit.ULBService.getStateId();let{data:r,isLoading:u}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(t,{}),d=[];return u?l.createElement(a.Loader,null):(r.forEach(e=>{d=d.concat(e.body.filter(e=>!e.hideInCitizen))}),d.indexRoute="new-restoration",console.log("configconfig",d),l.createElement(i.Switch,null,d.map((t,o)=>{const{texts:a,inputs:r,key:u,isSkipEnabled:d}=t,s=Digit.ComponentRegistryService.getComponent("WSRestorationForm");return l.createElement(i.Route,{path:Ur(n.path,n.params)+"/new-restoration",key:o},l.createElement(s,{config:{texts:a,inputs:r,key:u,isSkipEnabled:d},t:e,userType:"employee"}))}),l.createElement(i.Route,null,l.createElement(i.Redirect,{to:Ur(n.path,n.params)+"/"+d.indexRoute}))))},WSEditApplicationByConfig:()=>{var e,n,r,u,d,s,c,p;const{t:m}=o.useTranslation();let{state:E}=i.useLocation();E=E?"string"==typeof E?JSON.parse(E):E:{},i.useHistory();let S=g(location.search);const[_,f]=t.useState(!1),[C,N]=t.useState(null),[y,D]=t.useState({}),[T,h]=t.useState({head:"",body:[]}),[A,I]=t.useState(!0),[O,b]=t.useState(!1);let L=Digit.ULBService.getCurrentTenantId();L||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const w=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")),W=(null==S?void 0:S.service)||(null==w||null===(e=w.applicationData)||void 0===e?void 0:e.serviceType),P=Digit.ULBService.getStateId();let{data:M,isLoading:x}=Digit.Hooks.ws.useWSConfigMDMS.WSCreateConfig(P,{}),B=Lt(null===(n=E)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.applicationDetails);Lt(null===(u=E)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.action);let{isLoading:F,data:k}=Digit.Hooks.ws.useWSDetailsPage(m,L,null===(s=B)||void 0===s?void 0:s.applicationNo,null===(c=B)||void 0===c||null===(p=c.applicationData)||void 0===p?void 0:p.serviceType,{privacy:Digit.Utils.getPrivacyObject()});B=k;const[H,j]=t.useState(new URLSearchParams(i.useLocation().search).get("propertyId")),[V,z,Y]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),[G,q,K]=Digit.Hooks.useSessionStorage("ADHOC_ADD_REBATE_DATA",{}),{data:X}=Digit.Hooks.pt.usePropertySearch({filters:{propertyIds:H},tenantId:L},{filters:{propertyIds:H},tenantId:L,enabled:!(!H||""==H),privacy:Digit.Utils.getPrivacyObject()});return t.useEffect(()=>{if(!x){var e;const n=M.find(e=>e.hideInCitizen&&e.isEditByConfig);n.head="WS_APP_FOR_WATER_AND_SEWERAGE_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isEditByConfigConnection&&t.push(e)}),n.body=t,h(n)}},[M]),t.useEffect(()=>{var e,n,t,l;!H&&(null==V||null===(e=V.cpt)||void 0===e||null===(n=e.details)||void 0===n?void 0:n.propertyId)&&j(null==V||null===(t=V.cpt)||void 0===t||null===(l=t.details)||void 0===l?void 0:l.propertyId)},[null==V?void 0:V.cpt]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=B)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return sessionStorage.setItem("appData",JSON.stringify(y)),Promise.resolve(R(B,W,!1,!1,m)).then(function(e){z(v({},V,e)),D(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[B,k,null==V?void 0:V.cpt,V,X]),t.useEffect(()=>{var e;z(v({},V,{cpt:{details:null==X||null===(e=X.Properties)||void 0===e?void 0:e[0]}}))},[X]),t.useEffect(()=>{var e,n,t,l,o,i,a;((null==V||null===(e=V.DocumentsRequired)||void 0===e||null===(n=e.documents)||void 0===n?void 0:n.length)>0||null!=V&&null!==(t=V.ConnectionDetails)&&void 0!==t&&null!==(l=t[0])&&void 0!==l&&l.water||null!=V&&null!==(o=V.ConnectionDetails)&&void 0!==o&&null!==(i=o[0])&&void 0!==i&&i.sewerage||null!=V&&null!==(a=V.cpt)&&void 0!==a&&a.details&&!F)&&I(!1)},[X,V,null==V?void 0:V.cpt]),t.useEffect(()=>{const e=setTimeout(()=>{var e,n,t,l,o;O&&(window.location.href=window.location.origin+"/digit-ui/employee/ws/application-details?applicationNumber="+(null==V||null===(e=V.ConnectionDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.applicationNo)+"&service="+(null==V||null===(t=V.ConnectionDetails)||void 0===t||null===(l=t[0])||void 0===l||null===(o=l.serviceName)||void 0===o?void 0:o.toUpperCase()))},5e3);return()=>clearTimeout(e)},[O]),Digit.Hooks.ws.useWSApplicationActions(W),A||x?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,m(T.head))),l.createElement(a.FormComposer,{config:T.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P;U.isEqual(V,n)||z(v({},V,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?f(!0):null!==(i=n.ConnectionDetails)&&void 0!==i&&null!==(a=i[0])&&void 0!==a&&a.water&&(""==(null===(r=n.roadCuttingDetails)||void 0===r||null===(u=r[0])||void 0===u||null===(d=u.roadType)||void 0===d?void 0:d.code)||""==(null===(s=n.roadCuttingDetails)||void 0===s||null===(c=s[0])||void 0===c?void 0:c.area)||""==(null===(p=n.plumberDetails)||void 0===p||null===(m=p[0])||void 0===m?void 0:m.detailsProvidedBy)||""==(null===(E=n.connectionDetails)||void 0===E||null===(S=E[0])||void 0===S?void 0:S.connectionType)||""==(null===(_=n.connectionDetails)||void 0===_||null===(g=_[0])||void 0===g?void 0:g.waterSource)||""==(null===(C=n.connectionDetails)||void 0===C||null===(N=C[0])||void 0===N?void 0:N.sourceSubData))||null!==(y=n.ConnectionDetails)&&void 0!==y&&null!==(D=y[0])&&void 0!==D&&D.sewerage&&(""==(null===(T=n.roadCuttingDetails)||void 0===T||null===(h=T[0])||void 0===h||null===(A=h.roadType)||void 0===A?void 0:A.code)||""==(null===(I=n.roadCuttingDetails)||void 0===I||null===(O=I[0])||void 0===O?void 0:O.area)||""==(null===(b=n.plumberDetails)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.detailsProvidedBy)||""==(null===(R=n.connectionDetails)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.noOfWaterClosets)||""==(null===(W=n.connectionDetails)||void 0===W||null===(P=W[0])||void 0===P?void 0:P.noOfToilets))?f(!1):f(!Object.keys(t.errors).length)},label:m("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(_){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(((e,n,t)=>{var l,o,i,a,r,u,d,s,c,p,m,E,S,_,f,g,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,x,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$,J,Q,ee,ne,te,le,oe,ie,ae,re,ue,de,se,ce,ve,pe,me,Ee,Se,_e,fe,ge,Ce,Ne,ye,De,Te,he,Ae,Ie,Oe,be,Le,Re,we,We,Pe;null==e||null===(l=e.cpt)||void 0===l||null===(o=l.details)||void 0===o||null===(i=o.owners)||void 0===i||i.forEach(e=>{null!=e&&e.permanentAddress&&(e.correspondenceAddress=null==e?void 0:e.permanentAddress)});let Me=v({},n.applicationData,{proposedTaps:(null==e||null===(a=e.ConnectionDetails)||void 0===a||null===(r=a[0])||void 0===r?void 0:r.proposedTaps)&&Number(null==e||null===(u=e.ConnectionDetails)||void 0===u||null===(d=u[0])||void 0===d?void 0:d.proposedTaps),proposedPipeSize:(null==e||null===(s=e.ConnectionDetails)||void 0===s||null===(c=s[0])||void 0===c||null===(p=c.proposedPipeSize)||void 0===p?void 0:p.size)&&Number(null==e||null===(m=e.ConnectionDetails)||void 0===m||null===(E=m[0])||void 0===E||null===(S=E.proposedPipeSize)||void 0===S?void 0:S.size),proposedWaterClosets:(null==e||null===(_=e.ConnectionDetails)||void 0===_||null===(f=_[0])||void 0===f?void 0:f.proposedWaterClosets)&&Number(null==e||null===(g=e.ConnectionDetails)||void 0===g||null===(C=g[0])||void 0===C?void 0:C.proposedWaterClosets),proposedToilets:(null==e||null===(N=e.ConnectionDetails)||void 0===N||null===(y=N[0])||void 0===y?void 0:y.proposedToilets)&&Number(null==e||null===(D=e.ConnectionDetails)||void 0===D||null===(T=D[0])||void 0===T?void 0:T.proposedToilets),connectionHolders:null!=e&&null!==(h=e.ConnectionHolderDetails)&&void 0!==h&&null!==(A=h[0])&&void 0!==A&&A.sameAsOwnerDetails?null:[v({},null==n||null===(I=n.applicationData)||void 0===I||null===(O=I.connectionHolders)||void 0===O?void 0:O[0],{correspondenceAddress:(null==e||null===(b=e.ConnectionHolderDetails)||void 0===b||null===(L=b[0])||void 0===L?void 0:L.address)||"",fatherOrHusbandName:(null==e||null===(R=e.ConnectionHolderDetails)||void 0===R||null===(w=R[0])||void 0===w?void 0:w.guardian)||"",gender:(null==e||null===(W=e.ConnectionHolderDetails)||void 0===W||null===(P=W[0])||void 0===P||null===(M=P.gender)||void 0===M?void 0:M.code)||"",mobileNumber:(null==e||null===(x=e.ConnectionHolderDetails)||void 0===x||null===(B=x[0])||void 0===B?void 0:B.mobileNumber)||"",name:(null==e||null===(F=e.ConnectionHolderDetails)||void 0===F||null===(U=F[0])||void 0===U?void 0:U.name)||"",ownerType:(null==e||null===(k=e.ConnectionHolderDetails)||void 0===k||null===(H=k[0])||void 0===H||null===(j=H.ownerType)||void 0===j?void 0:j.code)||"",relationship:(null==e||null===(V=e.ConnectionHolderDetails)||void 0===V||null===(z=V[0])||void 0===z||null===(Y=z.relationship)||void 0===Y?void 0:Y.code)||"",sameAsPropertyAddress:null==e||null===(G=e.ConnectionHolderDetails)||void 0===G||null===(q=G[0])||void 0===q?void 0:q.sameAsOwnerDetails})],property:null==e||null===(K=e.cpt)||void 0===K?void 0:K.details,propertyId:null==e||null===(X=e.cpt)||void 0===X||null===(Z=X.details)||void 0===Z?void 0:Z.propertyId,processInstance:v({},null==n?void 0:n.processInstance,{action:"VERIFY_AND_FORWARD"}),action:"VERIFY_AND_FORWARD",documents:null==e||null===($=e.DocumentsRequired)||void 0===$?void 0:$.documents,plumberInfo:[{licenseNo:(null==e||null===(J=e.plumberDetails)||void 0===J||null===(Q=J[0])||void 0===Q?void 0:Q.plumberLicenseNo)||(null==n?void 0:n.plumberLicenseNo),name:(null==e||null===(ee=e.plumberDetails)||void 0===ee||null===(ne=ee[0])||void 0===ne?void 0:ne.plumberName)||(null==n?void 0:n.plumberName),mobileNumber:(null==e||null===(te=e.plumberDetails)||void 0===te||null===(le=te[0])||void 0===le?void 0:le.plumberMobileNo)||(null==n?void 0:n.plumberMobileNo)}],roadCuttingInfo:null==e||null===(oe=e.roadCuttingDetails)||void 0===oe?void 0:oe.filter(e=>""!=e.roadType.code).map(e=>{var n,t;return null!=e&&e.id&&null!==(null==e?void 0:e.id)?{id:null==e?void 0:e.id,roadType:null==e||null===(n=e.roadType)||void 0===n?void 0:n.code,roadCuttingArea:null==e?void 0:e.area,status:null==e?void 0:e.status}:{roadType:null==e||null===(t=e.roadType)||void 0===t?void 0:t.code,roadCuttingArea:null==e?void 0:e.area}}),connectionNo:null},"WATER"===t?{connectionType:(null==e||null===(ie=e.connectionDetails)||void 0===ie||null===(ae=ie[0])||void 0===ae||null===(re=ae.connectionType)||void 0===re?void 0:re.code)||(null==n?void 0:n.connectionType),waterSource:(null==e||null===(ue=e.connectionDetails)||void 0===ue||null===(de=ue[0])||void 0===de||null===(se=de.sourceSubData)||void 0===se?void 0:se.code)||(null==n?void 0:n.waterSource),pipeSize:(null==e||null===(ce=e.connectionDetails)||void 0===ce||null===(ve=ce[0])||void 0===ve||null===(pe=ve.pipeSize)||void 0===pe?void 0:pe.size)||(null==n?void 0:n.pipeSize),noOfTaps:(null==e||null===(me=e.connectionDetails)||void 0===me||null===(Ee=me[0])||void 0===Ee?void 0:Ee.noOfTaps)||(null==n?void 0:n.noOfTaps),sourceSubData:(null==e||null===(Se=e.connectionDetails)||void 0===Se||null===(_e=Se[0])||void 0===_e||null===(fe=_e.sourceSubData)||void 0===fe?void 0:fe.code)||(null==n?void 0:n.sourceSubData)}:{connectionType:"Non Metered",noOfWaterClosets:(null==e||null===(ge=e.connectionDetails)||void 0===ge||null===(Ce=ge[0])||void 0===Ce?void 0:Ce.noOfWaterClosets)||(null==n?void 0:n.noOfWaterClosets)||"",noOfToilets:(null==e||null===(Ne=e.connectionDetails)||void 0===Ne||null===(ye=Ne[0])||void 0===ye?void 0:ye.noOfToilets)||(null==n?void 0:n.noOfToilets)||""},{tenantId:null==e||null===(De=e.cpt)||void 0===De||null===(Te=De.details)||void 0===Te?void 0:Te.tenantId});var xe,Be,Fe,Ue,ke,He,je,Ve,ze,Ye,Ge,qe,Ke;return(null!=e&&null!==(he=e.plumberDetails)&&void 0!==he&&null!==(Ae=he[0])&&void 0!==Ae&&null!==(Ie=Ae.detailsProvidedBy)&&void 0!==Ie&&Ie.code||null!=n&&n.detailsProvidedBy)&&(Me.additionalDetails.detailsProvidedBy=(null==e||null===(xe=e.plumberDetails)||void 0===xe||null===(Be=xe[0])||void 0===Be||null===(Fe=Be.detailsProvidedBy)||void 0===Fe?void 0:Fe.code)||(null==n?void 0:n.detailsProvidedBy),Me.additionalDetails.initialMeterReading=null),null!=e&&null!==(Oe=e.cpt)&&void 0!==Oe&&null!==(be=Oe.details)&&void 0!==be&&null!==(Le=be.address)&&void 0!==Le&&null!==(Re=Le.locality)&&void 0!==Re&&Re.code&&(Me.additionalDetails.locality=null==e||null===(Ue=e.cpt)||void 0===Ue||null===(ke=Ue.details)||void 0===ke||null===(He=ke.address)||void 0===He||null===(je=He.locality)||void 0===je?void 0:je.code),"ULB"==(null==e||null===(we=e.plumberDetails)||void 0===we||null===(We=we[0])||void 0===We||null===(Pe=We.detailsProvidedBy)||void 0===Pe?void 0:Pe.code)&&(Me.plumberInfo=[{licenseNo:(null==e||null===(Ve=e.plumberDetails)||void 0===Ve||null===(ze=Ve[0])||void 0===ze?void 0:ze.plumberLicenseNo)||(null==n?void 0:n.plumberLicenseNo),name:(null==e||null===(Ye=e.plumberDetails)||void 0===Ye||null===(Ge=Ye[0])||void 0===Ge?void 0:Ge.plumberName)||(null==n?void 0:n.plumberName),mobileNumber:(null==e||null===(qe=e.plumberDetails)||void 0===qe||null===(Ke=qe[0])||void 0===Ke?void 0:Ke.plumberMobileNo)||(null==n?void 0:n.plumberMobileNo)}]),Me})(e,n,W)).then(function(e){var n;null!=G&&G.adhocPenalty&&(e.additionalDetails.adhocPenalty=parseInt(null==G?void 0:G.adhocPenalty)),null!=G&&G.adhocPenaltyComment&&(e.additionalDetails.adhocPenaltyComment=(null==G?void 0:G.adhocPenaltyComment)||""),null!=G&&G.adhocPenaltyReason&&(e.additionalDetails.adhocPenaltyReason=(null==G?void 0:G.adhocPenaltyReason)||""),null!=G&&G.adhocRebate&&(e.additionalDetails.adhocRebate=parseInt(null==G?void 0:G.adhocRebate)),null!=G&&G.adhocRebateComment&&(e.additionalDetails.adhocRebateComment=(null==G?void 0:G.adhocRebateComment)||""),null!=G&&G.adhocRebateReason&&(e.additionalDetails.adhocRebateReason=(null==G?void 0:G.adhocRebateReason)||""),f(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),window.location.assign(""+window.location.origin+(null===(n=E)||void 0===n?void 0:n.url))})}N({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{N(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:V,appData:y}),C&&l.createElement(a.Toast,{error:C.key,label:m(null==C?void 0:C.message),warning:null==C?void 0:C.warning,onClose:()=>{N(null)}}))},WSGetDisconnectionDetails:()=>{var e,n,i,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,T,h,A,I,O,b,L,R,w,W,P,M,B,F,U,k,H,j,V,z,Y,G,q;const{t:K}=o.useTranslation(),X=t.useRef();let Z=g(location.search);const[$,J]=t.useState(!1),[Q,ee]=t.useState(null),ne=Digit.ULBService.getCurrentTenantId(),te=null==Z?void 0:Z.applicationNumber,le=null==Z?void 0:Z.service,oe=Digit.ULBService.getStateId();sessionStorage.removeItem("Digit.PT_CREATE_EMP_WS_NEW_FORM"),sessionStorage.removeItem("IsDetailsExists"),sessionStorage.setItem("disconnectionURL",JSON.stringify({url:""+(null===(e=location)||void 0===e?void 0:e.pathname)+location.search}));let{isLoading:ie,data:ae}=Digit.Hooks.ws.useDisConnectionDetails(K,ne,te,le,{privacy:Digit.Utils.getPrivacyObject()});const{isServicesMasterLoading:re,data:ue}=Digit.Hooks.ws.useMDMS(oe,"ws-services-masters",["WSEditApplicationByConfigUser"]),de=(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.applicationStatus)||"";let se=Digit.Hooks.useWorkflowDetails({tenantId:ne,id:te,moduleCode:null==ae||null===(i=ae.processInstancesDetails)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.businessService},{enabled:!(null==ae||null===(u=ae.processInstancesDetails)||void 0===u||null===(d=u[0])||void 0===d||!d.businessService)});const{mutate:ce}=Digit.Hooks.ws.useWSApplicationActions(le);var ve,pe,me,Ee,Se;Digit.Hooks.useClickOutside(X,()=>{J(!1)},$),Digit.Utils.browser.isMobile(),!((null==se||null===(s=se.data)||void 0===s||null===(c=s.nextActions)||void 0===c?void 0:c.length)>0&&(null==se||null===(p=se.data)||void 0===p||null===(m=p.actionState)||void 0===m||null===(E=m.nextActions)||void 0===E?void 0:E.length)>0)||null!=se&&null!==(S=se.data)&&void 0!==S&&null!==(_=S.actionState)&&void 0!==_&&null!==(f=_.nextActions)&&void 0!==f&&f.find(e=>"EDIT"===e.action)||null!=se&&null!==(C=se.data)&&void 0!==C&&null!==(N=C.actionState)&&void 0!==N&&null!==(y=N.nextActions)&&void 0!==y&&y.find(e=>"RESUBMIT_APPLICATION"===e.action)||null!=se&&null!==(D=se.data)&&void 0!==D&&null!==(T=D.actionState)&&void 0!==T&&null!==(h=T.nextActions)&&void 0!==h&&h.find(e=>"EXECUTE_DISCONNECTION"===e.action)||null!=se&&null!==(A=se.data)&&void 0!==A&&null!==(I=A.actionState)&&void 0!==I&&null!==(O=I.nextActions)&&void 0!==O&&O.find(e=>"SUBMIT_APPLICATION"===e.action)||null!=se&&null!==(b=se.data)&&void 0!==b&&null!==(L=b.actionState)&&void 0!==L&&null!==(R=L.nextActions)&&void 0!==R&&R.find(e=>"DISCONNECTION_EXECUTED"===e.action)||null==se||null===(ve=se.data)||void 0===ve||null===(pe=ve.nextActions)||void 0===pe||pe.forEach(e=>{"EDIT"==e.action&&se.data.actionState.nextActions.push(e)}),"DISCONNECTION_EXECUTED"==(null==ae||null===(w=ae.applicationData)||void 0===w?void 0:w.applicationStatus)&&(null!=se&&null!==(me=se.data)&&void 0!==me&&null!==(Ee=me.actionState)&&void 0!==Ee&&Ee.nextActions&&(se.data.actionState.nextActions=[]),null!=se&&null!==(Se=se.data)&&void 0!==Se&&Se.nextActions&&(se.data.nextActions=[])),null==se||null===(W=se.data)||void 0===W||null===(P=W.nextActions)||void 0===P||P.forEach(e=>{var n,t;"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:("WATER"==le?"WS":"SW")+"/"+(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.connectionNo)+"/"+(null==ae?void 0:ae.tenantId)+"?tenantId="+(null==ae?void 0:ae.tenantId)+"&ISWSAPP&applicationNumber="+(null==ae||null===(t=ae.applicationData)||void 0===t?void 0:t.connectionNo)+"&IsDisconnectionFlow="+!0,state:null==ae?void 0:ae.tenantId})}),null==se||null===(M=se.data)||void 0===M||null===(B=M.actionState)||void 0===B||null===(F=B.nextActions)||void 0===F||F.forEach(e=>{var n,t;"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:("WATER"==le?"WS":"SW")+"/"+(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.connectionNo)+"/"+(null==ae?void 0:ae.tenantId)+"?tenantId="+(null==ae?void 0:ae.tenantId)+"&ISWSAPP&applicationNumber="+(null==ae||null===(t=ae.applicationData)||void 0===t?void 0:t.connectionNo)+"&IsDisconnectionFlow="+!0,state:null==ae?void 0:ae.tenantId})}),null==se||null===(U=se.data)||void 0===U||null===(k=U.actionState)||void 0===k||null===(H=k.nextActions)||void 0===H||H.forEach(e=>{if("EDIT"===(null==e?void 0:e.action)){var n,t,l;let o="/digit-ui/employee/ws/edit-disconnection-application?applicationNumber="+te+"&service="+le;const i=(null==ue||null===(n=ue["ws-services-masters"])||void 0===n?void 0:n.WSEditApplicationByConfigUser)||[],a=(null==i||null===(t=i[0])||void 0===t?void 0:t.roles)||[],r=null==i||null===(l=i[0])||void 0===l?void 0:l.status;let u=!1;a.every((e,n)=>(u=x(e),!u)),u&&de===r&&(o="/digit-ui/employee/ws/config-by-disconnection-application?applicationNumber="+te+"&service="+le),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:o,state:{applicationDetails:ae,action:"VERIFY_AND_FORWARD"}}}"RESUBMIT_APPLICATION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/resubmit-disconnection-application?applicationNumber="+te+"&service="+le,state:{applicationDetails:ae,action:"VERIFY_AND_FORWARD"}})});const _e={order:1,label:K("WS_APPLICATION"),onClick:function(){try{var e;const n=null==ae||null===(e=ae.applicationData)||void 0===e?void 0:e.tenantId;return xi(v({},null==ae?void 0:ae.applicationData),v({},null==ae?void 0:ae.propertyDetails),n,K).then(e=>Digit.Utils.pdf.generatev1(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}},fe={order:2,label:K("WS_DISCONNECTION_NOTICE_LABEL"),onClick:()=>function(){try{var e,n,t;let l="ws-waterdisconnectionnotice",o={WaterConnection:[v({},null==ae?void 0:ae.applicationData,{property:ae.propertyDetails})]};return null!=ae&&null!==(e=ae.applicationData)&&void 0!==e&&null!==(n=e.applicationType)&&void 0!==n&&n.includes("WATER")||(l="ws-seweragedisconnectionnotice",o={SewerageConnection:[v({},null==ae?void 0:ae.applicationData,{property:ae.propertyDetails})]}),Promise.resolve(Digit.WSService.WSDisconnectionNotice(null==ae||null===(t=ae.applicationData)||void 0===t?void 0:t.tenantId,o,l)).then(function(e){var n;return Promise.resolve(Digit.PaymentService.printReciept(null==ae||null===(n=ae.applicationData)||void 0===n?void 0:n.tenantId,{fileStoreIds:e.filestoreIds[0]})).then(function(n){window.open(n[null==e?void 0:e.filestoreIds[0]],"_blank")})})}catch(e){return Promise.reject(e)}}()};let ge=[];switch(de){case"DISCONNECTION_EXECUTED":case"PENDING_FOR_PAYMENT":case"PENDING_FOR_DISCONNECTION_EXECUTION":ge=[_e,fe];break;default:ge=[_e]}return ge.sort(function(e,n){return e.order-n.order}),l.createElement(t.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement("div",{style:{display:"flex"}},l.createElement("div",{style:{width:"70%"}},l.createElement(a.Header,null,K("WS_APPLICATION_DETAILS")," ")),l.createElement("div",{style:{width:"30%",zIndex:"10"}},l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-divNew",onHeadClick:()=>J(!$),displayOptions:$,options:ge,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:X})))),l.createElement(Wr,{applicationDetails:ae,isLoading:ie||re,isDataLoading:ie||re,applicationData:null==ae?void 0:ae.applicationData,mutate:ce,workflowDetails:se,businessService:null==ae||null===(j=ae.processInstancesDetails)||void 0===j||null===(V=j[0])||void 0===V||null===(z=V.businessService)||void 0===z?void 0:z.toUpperCase(),moduleCode:"WS",showToast:Q,setShowToast:ee,closeToast:()=>{ee(null)},timelineStatusPrefix:"WF_"+(null==ae||null===(Y=ae.processInstancesDetails)||void 0===Y||null===(G=Y[0])||void 0===G||null===(q=G.businessService)||void 0===q?void 0:q.toUpperCase())+"_",isInfoLabel:"true"===sessionStorage.getItem("isPrivacyEnabled")})))},WSModifyApplicationDetails:()=>{var e,n,i,r,u,d,s,c,p,m,E,S,_,f,C,N,y,D,T,h,A,I,O,b,R,w,W,P,M,B,F,U,k,H,j,V,z,Y,G,q,K,X,Z,$;const{t:J}=o.useTranslation(),Q=Digit.UserService.getUser(),ee=Digit.ULBService.getCurrentTenantId(),[ne,te]=t.useState(null),[oe,ie]=t.useState(!1);let ae=g(location.search);const re=null==ae?void 0:ae.applicationNumber,ue=null==ae?void 0:ae.service,de=Digit.ULBService.getStateId(),se=t.useRef();let{isLoading:ce,data:ve}=Digit.Hooks.ws.useWSModifyDetailsPage(J,ee,re,ue,Q,{privacy:Digit.Utils.getPrivacyObject()});const{isServicesMasterLoading:pe,data:me}=Digit.Hooks.ws.useMDMS(de,"ws-services-masters",["WSEditApplicationByConfigUser"]);let Ee=Digit.Hooks.useWorkflowDetails({tenantId:ee,id:re,moduleCode:null==ve||null===(e=ve.processInstancesDetails)||void 0===e||null===(n=e[0])||void 0===n?void 0:n.businessService,config:{enabled:!(null==ve||null===(i=ve.processInstancesDetails)||void 0===i||null===(r=i[0])||void 0===r||!r.businessService),privacy:Digit.Utils.getPrivacyObject()}});const{mutate:Se}=Digit.Hooks.ws.useWSApplicationActions(ue),_e=()=>{var e,n,t,l,o,i,a,r,u,d,s,c,v;const p=null==ve||null===(e=ve.applicationData)||void 0===e?void 0:e.connectionType,m=0===(null==ve||null===(n=ve.applicationData)||void 0===n?void 0:n.noOfTaps)?null:null==ve||null===(t=ve.applicationData)||void 0===t?void 0:t.noOfTaps,E=0===(null==ve||null===(l=ve.applicationData)||void 0===l?void 0:l.pipeSize)?null:null==ve||null===(o=ve.applicationData)||void 0===o?void 0:o.pipeSize,S=null==ve||null===(i=ve.applicationData)||void 0===i?void 0:i.waterSource,_=0===(null==ve||null===(a=ve.applicationData)||void 0===a?void 0:a.noOfWaterClosets)?null:null==ve||null===(r=ve.applicationData)||void 0===r?void 0:r.noOfWaterClosets,f=0===(null==ve||null===(u=ve.applicationData)||void 0===u?void 0:u.noOfToilets)?null:null==ve||null===(d=ve.applicationData)||void 0===d?void 0:d.noOfToilets,g=null==ve||null===(s=ve.applicationData)||void 0===s||null===(c=s.additionalDetails)||void 0===c?void 0:c.detailsProvidedBy,C=null==ve||null===(v=ve.applicationData)||void 0===v?void 0:v.roadCuttingInfo;return!!(p&&(m&&E&&S||_&&f)&&g&&C)};let fe=[],ge=(null==ve||null===(u=ve.applicationData)||void 0===u?void 0:u.applicationStatus)||"";var Ce,Ne;null==Ee||null===(d=Ee.data)||void 0===d||null===(s=d.actionState)||void 0===s||null===(c=s.nextActions)||void 0===c||c.forEach(e=>{if("ACTIVATE_CONNECTION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/activate-connection?applicationNumber="+re+"&service="+ue+"&action=ACTIVATE_CONNECTION",state:null==ve?void 0:ve.applicationData}),"RESUBMIT_APPLICATION"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(n=ve.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==me||null===(t=me["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&ge===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(i=ve.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:ve,action:"RESUBMIT_APPLICATION"}}}var a;"SUBMIT_APPLICATION"===(null==e?void 0:e.action)&&(e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:"/digit-ui/employee/ws/modify-application-edit?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(a=ve.propertyDetails)||void 0===a?void 0:a.propertyId),state:ve})}),!((null==Ee||null===(p=Ee.data)||void 0===p||null===(m=p.nextActions)||void 0===m?void 0:m.length)>0&&(null==Ee||null===(E=Ee.data)||void 0===E||null===(S=E.actionState)||void 0===S||null===(_=S.nextActions)||void 0===_?void 0:_.length)>0)||null!=Ee&&null!==(f=Ee.data)&&void 0!==f&&null!==(C=f.actionState)&&void 0!==C&&null!==(N=C.nextActions)&&void 0!==N&&N.find(e=>"EDIT"===e.action)||null!=Ee&&null!==(y=Ee.data)&&void 0!==y&&null!==(D=y.actionState)&&void 0!==D&&null!==(T=D.nextActions)&&void 0!==T&&T.find(e=>"RESUBMIT_APPLICATION"===e.action)||null!=Ee&&null!==(h=Ee.data)&&void 0!==h&&null!==(A=h.actionState)&&void 0!==A&&null!==(I=A.nextActions)&&void 0!==I&&I.find(e=>"ACTIVATE_CONNECTION"===e.action)||null!=Ee&&null!==(O=Ee.data)&&void 0!==O&&null!==(b=O.actionState)&&void 0!==b&&null!==(R=b.nextActions)&&void 0!==R&&R.find(e=>"SUBMIT_APPLICATION"===e.action)||null==Ee||null===(Ce=Ee.data)||void 0===Ce||null===(Ne=Ce.nextActions)||void 0===Ne||Ne.forEach(e=>{"EDIT"==e.action&&Ee.data.actionState.nextActions.push(e)}),null==Ee||null===(w=Ee.data)||void 0===w||null===(W=w.actionState)||void 0===W||null===(P=W.nextActions)||void 0===P||P.forEach(e=>{if("EDIT"===(null==e?void 0:e.action)){var n,t,l,o;let a="/digit-ui/employee/ws/edit-application?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(n=ve.propertyDetails)||void 0===n?void 0:n.propertyId);const r=(null==me||null===(t=me["ws-services-masters"])||void 0===t?void 0:t.WSEditApplicationByConfigUser)||[],u=(null==r||null===(l=r[0])||void 0===l?void 0:l.roles)||[],d=null==r||null===(o=r[0])||void 0===o?void 0:o.status;let s=!1;var i;u.every((e,n)=>(s=x(e),!s)),s&&ge===d&&(a="/digit-ui/employee/ws/edit-application-by-config?applicationNumber="+re+"&service="+ue+"&propertyId="+(null==ve||null===(i=ve.propertyDetails)||void 0===i?void 0:i.propertyId)),e.redirectionUrll={action:"ACTIVATE_CONNECTION",pathname:a,state:{applicationDetails:ve,action:"VERIFY_AND_FORWARD"}}}}),null==Ee||null===(M=Ee.data)||void 0===M||null===(B=M.nextActions)||void 0===B||B.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==ge||_e()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==Ee||null===(F=Ee.data)||void 0===F||null===(U=F.actionState)||void 0===U||null===(k=U.nextActions)||void 0===k||k.forEach(e=>{"VERIFY_AND_FORWARD"!==(null==e?void 0:e.action)||"PENDING_FOR_FIELD_INSPECTION"!==ge||_e()||(e.isToast=!0,e.toastMessage="MISSING_ADDITIONAL_DETAILS")}),null==Ee||null===(H=Ee.data)||void 0===H||null===(j=H.nextActions)||void 0===j||j.forEach(e=>{"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:L(ae)+"/"+(null==ve?void 0:ve.applicationNo)+"/"+(null==ve?void 0:ve.tenantId)+"?tenantId="+(null==ve?void 0:ve.tenantId)+"&ISWSAPP&applicationNumber="+(null==ve?void 0:ve.applicationNo),state:null==ve?void 0:ve.tenantId})}),null==Ee||null===(V=Ee.data)||void 0===V||null===(z=V.actionState)||void 0===z||null===(Y=z.nextActions)||void 0===Y||Y.forEach(e=>{"PAY"===(null==e?void 0:e.action)&&(e.redirectionUrll={pathname:L(ae)+"/"+(null==ve?void 0:ve.applicationNo)+"/"+(null==ve?void 0:ve.tenantId)+"?tenantId="+(null==ve?void 0:ve.tenantId)+"&ISWSAPP&applicationNumber="+(null==ve?void 0:ve.applicationNo),state:null==ve?void 0:ve.tenantId})});const ye={order:3,label:J("WS_APPLICATION"),onClick:function(){try{var e;const n=null==ve||null===(e=ve.applicationData)||void 0===e?void 0:e.tenantId;let t=null==ve?void 0:ve.oldApplication;return le(v({},null==ve?void 0:ve.applicationData),v({},null==ve?void 0:ve.propertyDetails),n,J,t).then(e=>Digit.Utils.pdf.generateModifyPdf(e)),Promise.resolve()}catch(e){return Promise.reject(e)}}};switch(ge){case"REJECTED":default:fe=[ye]}return Digit.Hooks.useClickOutside(se,()=>{ie(!1)},oe),fe.sort(function(e,n){return e.order-n.order}),l.createElement(t.Fragment,null,l.createElement("div",{className:"employee-main-application-details"},l.createElement("div",{className:"employee-application-details",style:{marginBottom:"15px"}},l.createElement(a.Header,{styles:{marginLeft:"0px",paddingTop:"10px",fontSize:"32px"}},J("CS_TITLE_APPLICATION_DETAILS")),fe&&fe.length>0&&l.createElement(a.MultiLink,{className:"multilinkWrapper employee-mulitlink-main-div",onHeadClick:()=>ie(!oe),displayOptions:oe,options:fe,downloadBtnClassName:"employee-download-btn-className",optionsClassName:"employee-options-btn-className",ref:se})),l.createElement(Wr,{applicationDetails:ve,isLoading:ce||pe,isDataLoading:ce||pe,applicationData:null==ve?void 0:ve.applicationData,mutate:Se,workflowDetails:Ee,businessService:null==ve||null===(G=ve.processInstancesDetails)||void 0===G||null===(q=G[0])||void 0===q||null===(K=q.businessService)||void 0===K?void 0:K.toUpperCase(),moduleCode:"WS",showToast:ne,setShowToast:te,closeToast:()=>{te(null)},timelineStatusPrefix:"WF_"+(null==ve||null===(X=ve.processInstancesDetails)||void 0===X||null===(Z=X[0])||void 0===Z||null===($=Z.businessService)||void 0===$?void 0:$.toUpperCase())+"_",isInfoLabel:"true"===sessionStorage.getItem("isPrivacyEnabled")})))},WSEditDisconnectionApplication:()=>{var e,n,r,u,d,s,c;const{t:p}=o.useTranslation();let{state:m}=i.useLocation();m=m?"string"==typeof m?JSON.parse(m):m:{},g(location.search);const[E,S]=t.useState(!1),[_,f]=t.useState(null),[C,N]=t.useState({}),[y,D]=t.useState({head:"",body:[]});let T=Digit.ULBService.getCurrentTenantId();T||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"),JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS"));const h=Digit.ULBService.getStateId();let{data:A,isLoading:I}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(h,{}),O=Lt(null===(e=m)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.applicationDetails);const b=Lt(null===(r=m)||void 0===r||null===(u=r.data)||void 0===u?void 0:u.action);let{isLoading:L,data:R}=Digit.Hooks.ws.useDisConnectionDetails(p,T,null===(d=O)||void 0===d?void 0:d.applicationNo,null===(s=O)||void 0===s||null===(c=s.applicationData)||void 0===c?void 0:c.serviceType,{privacy:Digit.Utils.getPrivacyObject()});O=R;const[P,M,x]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{});t.useEffect(()=>{if(!L&&!I){var e;const n=A.find(e=>e.isDisonnectionEdit);n.head="WS_WATER_SEWERAGE_DISCONNECTION_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isDisonnectionEdit&&t.push(e)}),n.body=t,D(n)}},[R,L,A]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=O)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(w(O,0,!1)).then(function(e){M(v({},P,e)),N(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[O,R,P]);const B=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));return L||!B||I?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,p(y.head))),l.createElement(a.FormComposer,{config:y.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(P,n)||M(v({},P,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?S(!0):S(!Object.keys(t.errors).length)},label:p("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(E){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(W(e,n,b)).then(function(e){var n;S(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),window.location.assign(""+window.location.origin+(null===(n=m)||void 0===n?void 0:n.url))})}f({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{f(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:P,appData:C,noBreakLine:!0}),_&&l.createElement(a.Toast,{error:_.key,label:p(null==_?void 0:_.message),warning:null==_?void 0:_.warning,onClose:()=>{f(null)}}))},WSEditDisconnectionByConfig:()=>{var e,n,r,u,d,s,c;const{t:p}=o.useTranslation();let{state:m}=i.useLocation();m=m?"string"==typeof m?JSON.parse(m):m:{},g(location.search);const[E,S]=t.useState(!1),[_,f]=t.useState(null),[C,N]=t.useState({}),[y,D]=t.useState({head:"",body:[]});let T=Digit.ULBService.getCurrentTenantId();T||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY"),JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS"));const h=Digit.ULBService.getStateId();let{data:A,isLoading:I}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(h,{}),O=Lt(null===(e=m)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.applicationDetails);const b=Lt(null===(r=m)||void 0===r||null===(u=r.data)||void 0===u?void 0:u.action);let{isLoading:L,data:R}=Digit.Hooks.ws.useDisConnectionDetails(p,T,null===(d=O)||void 0===d?void 0:d.applicationNo,null===(s=O)||void 0===s||null===(c=s.applicationData)||void 0===c?void 0:c.serviceType,{privacy:Digit.Utils.getPrivacyObject()});O=R;const[P,M,x]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{});t.useEffect(()=>{if(!L&&!I){var e;const n=A.find(e=>e.isDisonnectionEdit);n.head="WS_WATER_SEWERAGE_DISCONNECTION_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isDisonnectionEditByConfig&&t.push(e)}),n.body=t,D(n)}},[R,L,A]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=O)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(w(O,0,!0)).then(function(e){M(v({},P,e)),N(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[O,R,P]);const B=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));return L||!B||I?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,p(y.head))),l.createElement(a.FormComposer,{config:y.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(P,n)||M(v({},P,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?S(!0):S(!Object.keys(t.errors).length)},label:p("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(E){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(W(e,n,b)).then(function(e){var n;S(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),window.location.assign(""+window.location.origin+(null===(n=m)||void 0===n?void 0:n.url))})}f({warning:!0,message:"Please fill mandatory details"}),setTimeout(()=>{f(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:P,appData:C,noBreakLine:!0}),_&&l.createElement(a.Toast,{error:_.key,label:p(null==_?void 0:_.message),warning:null==_?void 0:_.warning,onClose:()=>{f(null)}}))},WSResubmitDisconnection:()=>{var e,n,r,u,d,s,c,p;const{t:m}=o.useTranslation();let{state:E}=i.useLocation();E=E?"string"==typeof E?JSON.parse(E):E:{};let S=g(location.search);const[_,f]=t.useState(!1),[C,N]=t.useState(null),[y,D]=t.useState({}),[T,h]=t.useState({head:"",body:[]}),[A,I]=t.useState(!1);let O=Digit.ULBService.getCurrentTenantId();O||Digit.SessionStorage.get("CITIZEN.COMMON.HOME.CITY");const b=Digit.ULBService.getStateId();let{data:L,isLoading:R}=Digit.Hooks.ws.useWSConfigMDMS.WSDisconnectionConfig(b,{});const P=JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")),M=(null==S?void 0:S.service)||(null==P||null===(e=P.applicationData)||void 0===e?void 0:e.serviceType);let x=Lt(null===(n=E)||void 0===n||null===(r=n.data)||void 0===r?void 0:r.applicationDetails);const B=Lt(null===(u=E)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.action);let{isLoading:F,data:k}=Digit.Hooks.ws.useDisConnectionDetails(m,O,null===(s=x)||void 0===s?void 0:s.applicationNo,null===(c=x)||void 0===c||null===(p=c.applicationData)||void 0===p?void 0:p.serviceType,{privacy:Digit.Utils.getPrivacyObject()});x=k;const[H,j,V]=Digit.Hooks.useSessionStorage("PT_CREATE_EMP_WS_NEW_FORM",{}),{mutate:z}=Digit.Hooks.ws.useWSApplicationActions(M);t.useEffect(()=>{if(!F&&!R){var e;const n=L.find(e=>e.isDisonnectionEdit);n.head="WS_WATER_SEWERAGE_DISCONNECTION_EDIT_LABEL";let t=[];null==n||null===(e=n.body)||void 0===e||e.forEach(e=>{null!=e&&e.isDisonnectionEdit&&t.push(e)}),n.body=t,h(n)}},[k,F,L]),t.useEffect(function(){try{const e=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists")),n=function(n,t){if(null!==(n=x)&&void 0!==n&&null!==(t=n.applicationData)&&void 0!==t&&t.id&&!e)return Promise.resolve(w(x,0,!1)).then(function(e){j(v({},H,e)),D(v({},e)),sessionStorage.setItem("IsDetailsExists",JSON.stringify(!0))})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},[x,k,H]),t.useEffect(()=>{const e=setTimeout(()=>{const e=sessionStorage.getItem("disconnectionURL"),n=e?JSON.parse(e):{};A&&window.location.assign(""+window.location.origin+(null==n?void 0:n.url))},5e3);return()=>clearTimeout(e)},[A]);const Y=!!sessionStorage.getItem("IsDetailsExists")&&JSON.parse(sessionStorage.getItem("IsDetailsExists"));return F||!Y||R?l.createElement(a.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{marginLeft:"15px"}},l.createElement(a.Header,null,m(T.head))),l.createElement(a.FormComposer,{config:T.body,userType:"employee",onFormValueChange:(e,n,t)=>{var l,o;U.isEqual(H,n)||j(v({},H,n)),Object.keys(t.errors).length>0&&1==Object.keys(t.errors).length&&t.errors.owners&&0==Object.values(t.errors.owners.type).filter(e=>"required"===e.type).length&&(null==n||null===(l=n.cpt)||void 0===l||null===(o=l.details)||void 0===o||!o.propertyId)?f(!0):f(!Object.keys(t.errors).length)},label:m("CS_COMMON_SUBMIT"),onSubmit:function(e){try{const n=function(){if(_){const n=sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")?JSON.parse(sessionStorage.getItem("WS_EDIT_APPLICATION_DETAILS")):{};return Promise.resolve(W(e,n,B)).then(function(e){f(!1),sessionStorage.setItem("redirectedfromEDIT",!0),sessionStorage.setItem("WS_SESSION_APPLICATION_DETAILS",JSON.stringify(e)),e.processInstance.action="RESUBMIT_APPLICATION";let n="WATER"==e.serviceType?{WaterConnection:e}:{SewerageConnection:e};n.disconnectRequest=!0,z&&z(n,{onError:(e,n)=>{N({key:"error",message:null!=e&&e.message?e.message:e}),f(!0)},onSuccess:(e,n)=>{N({key:!1,message:"WS_APPLICATION_SUBMITTED_SUCCESSFULLY_LABEL"}),I(!0)}})})}N({warning:!0,message:"PLEASE_FILL_MANDATORY_DETAILS"}),setTimeout(()=>{N(!1)},3e3)}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},defaultValues:H,appData:y,noBreakLine:!0}),C&&l.createElement(a.Toast,{error:C.key,label:m(null==C?void 0:C.message),warning:null==C?void 0:C.warning,onClose:()=>{N(null)}}))},WSSearchWaterConnectionIntegrated:Hr,WSSearchIntegrated:e=>{const[n,i]=t.useState(!0),{t:r}=o.useTranslation(),u=Digit.ULBService.getCurrentTenantId(),[d,s]=t.useState({}),[c,p]=t.useState(!1),m=Digit.ComponentRegistryService.getComponent("WSSearchWaterConnectionIntegrated"),E=window.location.pathname.includes("water/search")?"WS":"SW",[S,_]=t.useState(null),f=t.useCallback(e=>{const{connectionNumber:n,oldConnectionNumber:t,mobileNumber:l,propertyId:o}=e;n||t||l||o?s(Object.keys(e).filter(n=>e[n]).reduce((n,t)=>v({},n,{[t]:"object"==typeof e[t]?e[t].code:e[t]}),{})):(_({error:!0,label:"WS_HOME_SEARCH_CONN_RESULTS_DESC"}),setTimeout(()=>{_(!1)},3e3))}),g={enabled:!!(d&&Object.keys(d).length>0)};let C=Digit.Hooks.ws.useSearchWS({tenantId:u,filters:d,config:g,bussinessService:"WS",t:r,shortAddress:!0}),N=Digit.Hooks.ws.useSearchWS({tenantId:u,filters:d,config:g,bussinessService:"SW",t:r,shortAddress:!0});return window.Digit.Utils.browser.isMobile(),l.createElement(t.Fragment,null,l.createElement(m,{t:r,tenantId:u,onSubmit:f,data:0==(null==N||null===(T=N.data)||void 0===T?void 0:T.length)&&0==(null==C||null===(h=C.data)||void 0===h?void 0:h.length)?{display:"ES_COMMON_NO_CONNECTION"}:(null==C||null===(A=C.data)||void 0===A?void 0:A.length)>0&&0==(null==N||null===(I=N.data)||void 0===I?void 0:I.length)?null==C?void 0:C.data:(null==N||null===(O=N.data)||void 0===O?void 0:O.length)>0&&0==(null==C||null===(b=C.data)||void 0===b?void 0:b.length)?null==N?void 0:N.data:(null==N||null===(L=N.data)||void 0===L?void 0:L.length)>0&&(null==C||null===(R=C.data)||void 0===R?void 0:R.length)>0?[...N.data,...C.data]:[],count:10,resultOk:(null==C||null===(y=C.data)||void 0===y?void 0:y.length)>0||(null==N||null===(D=N.data)||void 0===D?void 0:D.length)>0,businessService:E}),S&&l.createElement(a.Toast,{error:S.error,warning:S.warning,label:r(S.label),onClose:()=>{_(null)}}));var y,D,T,h,A,I,O,b,L,R},WSSearchWaterConnectionViewIntegrated:e=>{let{data:n,onSubmit:o,count:i,resultOk:a}=e;return l.createElement(t.Fragment,null,l.createElement(Hr,{onSubmit:o,data:n,count:i,resultOk:a}))},WSBulkBillGeneration:e=>{const[n,i]=t.useState(!0),{t:r}=o.useTranslation(),[u,d]=t.useState({}),[s,c]=t.useState(!1),v=Digit.ComponentRegistryService.getComponent("WSBulkBillSearch"),p=Digit.ULBService.getCurrentTenantId(),m=window.location.pathname.includes("water/search-connection")?"WS":"SW",[E,S]=t.useState(null),_={enabled:!!(u&&Object.keys(u).length>0)};let f=Digit.Hooks.ws.useBulkSearchWS({tenantId:p,filters:u,config:_});const g=window.Digit.Utils.browser.isMobile();return null!=f&&f.isLoading&&g?l.createElement(a.Loader,null):l.createElement(t.Fragment,null,l.createElement(v,{t:r,tenantId:p,onSubmit:e=>{var n;d({locality:null==e||null===(n=e.locality)||void 0===n?void 0:n.code})},data:(console.log("result",f),0==(null==f?void 0:f.meterReadings.length)?{display:"ES_COMMON_NO_DATA"}:(null==f?void 0:f.meterReadings.length)>0?null==f?void 0:f.meterReadings.map(e=>({billingPeriod:e.billingPeriod,connectionNo:e.connectionNo,lastReading:e.lastReading,lastReadingDate:e.lastReadingDate,meterStatus:e.meterStatus,currentReadingDate:"",currentReading:""})):[]),count:null==f?void 0:f.count,resultOk:(null==f||null===(C=f.meterReadings)||void 0===C?void 0:C.length)>0,businessService:m,isLoading:null==f?void 0:f.isLoading}),E&&l.createElement(a.Toast,{error:E.error,warning:E.warning,label:r(E.label),onClose:()=>{S(null)}}));var C}};exports.WSLinks=Vr,exports.WSModule=jr,exports.initWSComponents=()=>{Object.entries(zr).forEach(e=>{let[n,t]=e;Digit.ComponentRegistryService.setComponent(n,t)})};
|