@djb25/digit-ui-module-common 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+
2
+ # digit-ui-module-common
3
+
4
+ ## Install
5
+
6
+ ```bash
7
+ npm install --save @upyog/digit-ui-module-common
8
+ ```
9
+
10
+ ## Limitation
11
+
12
+ ```bash
13
+ This Package is more specific to DIGIT-UI's can be used across mission's
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ After adding the dependency make sure you have this dependency in
19
+
20
+ ```bash
21
+ frontend/micro-ui/web/package.json
22
+ ```
23
+
24
+ ```json
25
+ "@upyog/digit-ui-module-common":"^1.5.0",
26
+ ```
27
+
28
+ then navigate to App.js
29
+
30
+ ```bash
31
+ frontend/micro-ui/web/src/App.js
32
+ ```
33
+
34
+
35
+ ```jsx
36
+ /** add this import **/
37
+
38
+ import { initcommonComponents } from "@upyog/digit-ui-module-common";
39
+
40
+ /** inside enabledModules add this new module key **/
41
+
42
+ const enabledModules = ["Payment"];
43
+
44
+ /** inside init Function call this function **/
45
+
46
+ const initDigitUI = () => {
47
+ initcommonComponents();
48
+ };
49
+ ```
50
+
51
+
52
+
53
+
54
+ ### Changelog
55
+
56
+ ```bash
57
+ 1.7.1 UPYOG Base version
58
+ ```
59
+
60
+
61
+ ## Maintainer
62
+
63
+ - [Shivank-NIUA](https://github.com/ShivankShuklaa)
64
+
65
+
66
+ ### Published from UPYOG Frontend
67
+ UPYOG Frontend Repo (https://github.com/upyog/UPYOG/tree/develop)
68
+
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("@djb25/digit-ui-react-components"),n=require("react"),l=e(n),a=require("react-i18next"),i=require("react-router-dom"),o=require("react-hook-form"),r=e(require("jquery")),s=require("react-query"),u=require("@djb25/digit-ui-libraries");function c(){return(c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)({}).hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(null,arguments)}function d(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function m(e,t){if(null==e)return{};var n={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(-1!==t.indexOf(l))continue;n[l]=e[l]}return n}const v=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=""),void 0===n&&(n=""),""==t)return e;for(;e.includes(t);)e=e.replace(t,n);return e},p=e=>!!["adv-services","chb-services"].includes(e),E=["state"],f=e=>{var r,s,u,c,d,p,f,_;const h={code:"PAY_BY_OWNER",i18nKey:"PT_PAY_BY_OWNER",name:"I am making the payment as the owner/ consumer of the service"},y={code:"PAY_BEHALF_OWNER",i18nKey:"PT_PAY_BEHALF_OWNER",name:"I am making the payment on behalf of the owner/ consumer of the service"},g=null===(r=Digit.UserService.getUser())||void 0===r?void 0:r.info,S=null==g?void 0:g.name,P=null==g?void 0:g.mobileNumber,{t:b}=a.useTranslation(),A=i.useHistory(),N=i.useLocation(),{state:C}=N,{consumerCode:D,businessService:T,paymentAmt:I}=(m(N,E),i.useParams()),{workflow:O,tenantId:M,ConsumerName:L}=Digit.Hooks.useQueryParams(),[w,R]=n.useState(null==C?void 0:C.bill),x=(null==C?void 0:C.tenantId)||M||(null===(s=Digit.UserService.getUser().info)||void 0===s?void 0:s.tenantId),k=Digit.UserService.getUser(),{data:B,isLoading:H}=null!=C&&C.bill?{isLoading:!1}:Digit.Hooks.useFetchPayment({tenantId:x,businessService:T,consumerCode:D});let F=(null==B||null===(u=B.Bill)||void 0===u||null===(c=u[0])||void 0===c?void 0:c.userId)||"",U=["/user/_search",{},{data:{uuid:[F]}},{recordId:F,plainRequestFields:["mobileNumber"]},{enabled:!!F,cacheTime:100}];const{isLoading:j,data:Y}=Digit.Hooks.useCustomAPIHook(...U),V=(null==w||null===(d=w.billDetails)||void 0===d||null===(p=d.sort((e,t)=>t.fromPeriod-e.fromPeriod))||void 0===p?void 0:p[0])||[],[z,W]=(null==w||null===(f=w.billDetails)||void 0===f||null===(_=f.sort((e,t)=>t.fromPeriod-e.fromPeriod))||void 0===_||_.reduce((e,t,n)=>0===n?e:e+t.amount,0),n.useState(h)),[G,q]=n.useState(""),[K,X]=n.useState(""),{handleSubmit:Q}=o.useForm(),[Z,$]=n.useState(!1),[J,ee]=n.useState(null),[te,ne]=n.useState(!1),[le,ae]=n.useState(!1),[ie,oe]=n.useState(""),{isLoading:re,data:se}=Digit.Hooks.useCustomMDMS(Digit.ULBService.getStateId(),"common-masters",[{name:"CitizenConsentForm"}]);function ue(e){ne(e.target.checked)}return n.useEffect(()=>{var e,t,n,l,a;null!=se&&null!==(e=se["common-masters"])&&void 0!==e&&null!==(t=e.CitizenConsentForm)&&void 0!==t&&null!==(n=t[0])&&void 0!==n&&n.isCitizenConsentFormEnabled&&ae(null==se||null===(l=se["common-masters"])||void 0===l||null===(a=l.CitizenConsentForm)||void 0===a?void 0:a[0])},[se]),n.useEffect(()=>{if(!w&&B){var e;let t=null==B||null===(e=B.Bill)||void 0===e?void 0:e.filter(e=>e.consumerCode==D)[0];R(t)}},[H]),H||j||re?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.BackButton,null,b("CS_COMMON_BACK")),l.createElement("form",{onSubmit:Q(()=>{var e,t,n,l,a,i;"WNS"===O?A.push("/digit-ui/citizen/payment/collect/"+T+"/"+D+"?workflow=WNS&consumerCode="+v(D,"+","/"),{paymentAmount:I,tenantId:V.tenantId,name:(null==z?void 0:z.code)!==(null==y?void 0:y.code)&&"undefined"!==L?L:g?S:G,mobileNumber:(null==z?void 0:z.code)!==(null==y?void 0:y.code)?null!=w&&null!==(e=w.mobileNumber)&&void 0!==e&&e.includes("*")?null==Y||null===(t=Y.user)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.mobileNumber:null==w?void 0:w.mobileNumber:g?P:K}):A.push("/digit-ui/citizen/payment/collect/"+T+"/"+D,{paymentAmount:I,tenantId:V.tenantId,name:(null==z?void 0:z.code)!==(null==y?void 0:y.code)?null==w?void 0:w.payerName:g?S:G,mobileNumber:(null==z?void 0:z.code)!==(null==y?void 0:y.code)?null!=w&&null!==(l=w.mobileNumber)&&void 0!==l&&l.includes("*")?null==Y||null===(a=Y.user)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.mobileNumber:null==w?void 0:w.mobileNumber:g?P:K})})},l.createElement(t.Header,null,b("PAYERS_DETAILS_HEADER")),l.createElement(t.Card,null,l.createElement("span",{className:"card-label-error"},b(J)),l.createElement(t.RadioButtons,{selectedOption:z,onSelect:W,options:[h,y],optionsKey:"name",inputStyle:{marginTop:"11px"},innerStyles:{display:"flex"}}),l.createElement("div",{style:{position:"relative"}},(null==z?void 0:z.code)===(null==h?void 0:h.code)||g?null:l.createElement("div",{style:{position:"relative"}},l.createElement("span",null,l.createElement("span",null,b("PT_PAYERS_MOBILE_NO")),l.createElement(t.MobileNumber,{onChange:e=>{ee(null),e.match("^\\d{10}$")||(ee("CORE_COMMON_PHONENO_INVALIDMSG"),$(!1)),X(e),$(10==e.length&&""!=G)},value:K})),l.createElement("span",null,l.createElement("span",null,b("PT_PAYERS_NAME")),l.createElement(t.TextInput,{onChange:e=>{return q(t=e.target.value),void $(0!==t.length&&"CORE_COMMON_PHONENO_INVALIDMSG"!=J&&""!=G&&""!=K);var t},value:G})))),(null==le?void 0:le.isCitizenConsentFormEnabled)&&!(null!=k&&k.access_token)&&l.createElement("div",null,l.createElement(t.CheckBox,{className:"form-field",label:l.createElement("span",null,null==le||null===(ce=le.checkBoxLabels)||void 0===ce?void 0:ce.map((e,t)=>{var n;return l.createElement("span",null,(null==e?void 0:e.linkPrefix)&&l.createElement("span",null,b((null==e?void 0:e.linkPrefix)+"_")),(null==e?void 0:e.link)&&l.createElement("span",{id:null==e?void 0:e.linkId,onClick:e=>{(e=>{oe(e.target.id)})(e)},style:{color:"#a82227",cursor:"pointer"}},b((null==e?void 0:e.link)+"_")),(null==e?void 0:e.linkPostfix)&&l.createElement("span",null,b((null==e?void 0:e.linkPostfix)+"_")),t==(null==le||null===(n=le.checkBoxLabels)||void 0===n?void 0:n.length)-1&&b("LABEL"))})),value:te,checked:te,style:{marginTop:"5px",marginLeft:"55px"},styles:{marginBottom:"30px"},onChange:ue}),l.createElement(t.CitizenConsentForm,{styles:{},t:b,isCheckBoxChecked:ue,labels:null==le?void 0:le.checkBoxLabels,mdmsConfig:ie,setMdmsConfig:oe})),l.createElement(t.SubmitBar,{label:b("CS_COMMON_NEXT"),disabled:(()=>{if(null==le||!le.isCitizenConsentFormEnabled||null!=k&&k.access_token)return(null==z?void 0:z.code)===(null==y?void 0:y.code)&&!g&&!Z;{let e=!1;return e=!(((null==z?void 0:z.code)!==(null==y?void 0:y.code)||g||Z)&&te),e}})(),submit:!0}))));var ce},_=e=>{var n;let{bill:o,currentPath:r,businessService:s,getKeyNotesConfig:u}=e;const{t:c}=a.useTranslation(),d=i.useHistory();return l.createElement(l.Fragment,null,"function"==typeof u&&l.createElement(t.Card,null,u(s,c)["my-bill"].map((e,n)=>{const a=e.keyPath.reduce((e,t)=>"function"==typeof t?t(e):e[t],o);return l.createElement(t.KeyNote,{key:n+e.keyValue,keyValue:c(e.keyValue),note:a||e.fallback,noteStyle:e.noteStyle||{}})}),l.createElement(t.SubmitBar,{disabled:!(null!==(n=o.totalAmount)&&void 0!==n&&n.toFixed(2)),onSubmit:()=>{d.push(r+"/"+o.consumerCode,{tenantId:null==o?void 0:o.tenantId})},label:c("CS_MY_APPLICATION_VIEW_DETAILS")})))},h=e=>{let{billsList:o,currentPath:r,businessService:s}=e;const{t:u}=a.useTranslation(),d=(i.useHistory(),o.map(e=>e.consumerCode)),m=Digit.Hooks.useApplicationsForBusinessServiceSearch({filters:{consumerCodes:d.join()},businessService:s}),v=m.key,[p,E]=n.useState([]),[f,h]=n.useState(()=>{var e;return null===(e=Digit.ComponentRegistryService)||void 0===e?void 0:e.getComponent("getBillDetailsConfigWithBusinessService")}),y=n.useMemo(()=>({}),[]),g=n.useMemo(()=>({}),[]);return n.useEffect(()=>{m.data&&m.refetch()},[]),n.useEffect(()=>{if(m.data){const e=m.data.filter(e=>d.includes(e[v])),t=e.map(e=>e[v]);e.forEach(e=>{y[e[v]]=e}),o.forEach(e=>{g[e.consumerCode]=e});const n=t.map(e=>c({},g[e],y[e]));E(n)}},[m.data,f]),m.isLoading?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{className:"static"},l.createElement(t.Header,null,u("CS_TITLE_MY_BILLS")+" ("+p.length+")"),(null==p?void 0:p.length)>0&&f&&p.map((e,t)=>l.createElement("div",{key:t},l.createElement(_,{bill:e,currentPath:r,businessService:s,getKeyNotesConfig:f}))),!(null!=p&&p.length)>0&&l.createElement("p",{style:{paddingLeft:"16px"}},u("CS_BILLS_TEXT_NO_BILLS_FOUND")),"PT"===s&&l.createElement("p",{style:{paddingLeft:"16px",paddingTop:"16px"}},u("PT_TEXT_NOT_ABLE_TO_FIND_THE_PROPERTY"),l.createElement("span",{className:"link"},l.createElement(i.Link,{to:"/digit-ui/citizen/pt/property/citizen-search"},u("PT_COMMON_CLICK_HERE"))))))},y={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:{}},g=e=>{let{className:t="table",headers:n=[],values:i=[],arrears:o=0}=e;const{t:r}=a.useTranslation();return l.createElement(l.Fragment,null,l.createElement("div",{style:y.root},l.createElement("table",{className:"table-fixed-column-common-pay",style:y.table},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:c({},y.cell,y.cellLeft,y.cellHeader)},r("CS_BILL_PERIOD")),n.map((e,t)=>l.createElement("th",{style:c({},y.cell,n.length==t+1?y.cellRight:{},y.cellHeader),key:t},r(e))))),l.createElement("tbody",null,Object.values(i).map((e,t)=>l.createElement("tr",{key:t},l.createElement("td",{style:c({},y.cell,y.cellLeft),component:"th",scope:"row"},Object.keys(i)[t]),n.map((t,a)=>l.createElement("td",{style:c({},y.cell,{textAlign:"left"},n.length==a+1?y.cellRight:{},{whiteSpace:"pre"}),key:a,numeric:!0},a>1&&"₹",e[t]&&e[t].value||"0")))),l.createElement("tr",null,l.createElement("td",{style:c({},y.cell,y.cellLeft)}),n.map((e,t)=>t==n.length-1?l.createElement("td",{style:c({},y.cell,y.cellRight,{textAlign:"left",fontWeight:"700",whiteSpace:"pre"}),key:t,numeric:!0},o):t==n.length-2?l.createElement("td",{style:c({},y.cell,{textAlign:"left"}),key:t,numeric:!0},r("COMMON_ARREARS_TOTAL")):l.createElement("td",{style:y.cell,key:t,numeric:!0})))))))},S={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))"}},P=e=>{var t,i,o;let{bill:r={}}=e;const{t:s}=a.useTranslation();let u={},c=(null==r||null===(t=r.billDetails)||void 0===t?void 0:t.sort((e,t)=>t.fromPeriod-e.fromPeriod))||[];c=[...c];const d=(null===(i=c)||void 0===i?void 0:i.reduce((e,t,n)=>0===n?e:e+t.amount,0))||0;let m="₹ "+((null==d||null===(o=d.toFixed)||void 0===o?void 0:o.call(d,0))||Number(0).toFixed(0));c.shift(),c.map(e=>{let t=function(e){var t,n,l;void 0===e&&(e={});let a={};const{billAccountDetails:i=[]}=e;return i.map(e=>{a[e.taxHeadCode]={value:e.amount,order:e.order}}),a.CS_BILL_NO={value:(null===(t=e)||void 0===t?void 0:t.billNumber)||"NA",order:-2},a.CS_BILL_DUEDATE={value:(null===(n=e)||void 0===n?void 0:n.expiryDate)&&new Date(null===(l=e)||void 0===l?void 0:l.expiryDate).toLocaleDateString()||"NA",order:-1},a.TL_COMMON_TOTAL_AMT={value:e.amount,order:10},a}(e);u[((e,t)=>{const n=new Date(e),l=new Date(t);return l.getYear()-n.getYear()!=0?"FY"+(n.getYear()+1900)+"-"+(l.getYear()-100):n.toLocaleDateString()+"-"+l.toLocaleDateString()})(e.fromPeriod,e.toPeriod)]=t});let v={};!u||Object.keys(u).map((e,t)=>{Object.keys(u[e]).map(t=>{v[t]=u[e]&&u[e][t]&&u[e][t].order||0})});let p=[];p=Object.keys(v),p.sort((e,t)=>v[e]-v[t]);const[E,f]=n.useState(!1);return 0==d||d<0?l.createElement("span",null):l.createElement(l.Fragment,null,l.createElement("div",{style:S.headerStyle},s("CS_ARREARS_DETAILS")),E&&l.createElement(g,{headers:[...p],values:u,arrears:m}),!E&&l.createElement("div",{style:S.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!0)}},s("CS_SHOW_CARD"))),E&&l.createElement("div",{style:S.buttonStyle},l.createElement("button",{type:"button",onClick:()=>{f(!1)}},s("CS_HIDE_CARD"))))},b=e=>{var t;let{billAccountDetails:i,total:o,arrears:r}=e;const{t:s}=a.useTranslation(),{workflow:u}=Digit.Hooks.useQueryParams();return n.useEffect(()=>{"mcollect"===u&&i&&i.map(e=>{e.taxHeadCode.includes("CGST")?e.order=3:e.taxHeadCode.includes("SGST")&&(e.order=4)})},[i]),l.createElement(l.Fragment,null,l.createElement("div",{className:"bill-summary"},i.sort((e,t)=>e.order-t.order).map((e,t)=>{var n;return l.createElement("div",{key:t,className:"bill-account-details"},l.createElement("div",{className:"label"},s(e.taxHeadCode)),l.createElement("div",{className:"value"},"₹ ",Math.abs(null==e||null===(n=e.amount)||void 0===n?void 0:n.toFixed(2))))}),l.createElement("div",{className:"bill-account-details"},l.createElement("div",{className:"label"},s("COMMON_ARREARS")),l.createElement("div",{className:"value"},"₹ ",Math.abs((null==r||null===(t=r.toFixed)||void 0===t?void 0:t.call(r,2))||Number(0).toFixed(2)))),l.createElement("hr",{className:"underline"}),l.createElement("div",{className:"amount-details"},l.createElement("div",{className:"label"},s("CS_PAYMENT_TOTAL_AMOUNT")),l.createElement("div",{className:"value"},"₹ ",Number(o).toFixed(2)))))};function A(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));const N=e=>{let{businessService:a,t:i,SlotSearchData:o="",setTime:r}=e;const[s,u]=n.useState(0),[c,d]=n.useState(null),[m,v]=n.useState(!1),{refetch:p}=Digit.Hooks.chb.useChbSlotSearch({tenantId:null==o?void 0:o.tenantId,filters:{bookingId:null==o?void 0:o.bookingId,communityHallCode:null==o?void 0:o.communityHallCode,bookingStartDate:null==o?void 0:o.bookingStartDate,bookingEndDate:null==o?void 0:o.bookingEndDate,hallCode:null==o?void 0:o.hallCode,isTimerRequired:!0},enabled:!1}),E=Digit.Hooks.ads.useADSSlotSearch();return n.useEffect(()=>{0!==s||m||(function(){try{Promise.resolve(A(function(){const e=function(){if("adv-services"===a){const e={advertisementSlotSearchCriteria:null==o?void 0:o.cartDetails.map(e=>({bookingId:null==o?void 0:o.bookingId,addType:null==e?void 0:e.addType,bookingStartDate:null==e?void 0:e.bookingDate,bookingEndDate:null==e?void 0:e.bookingDate,faceArea:null==e?void 0:e.faceArea,tenantId:null==o?void 0:o.tenantId,location:null==e?void 0:e.location,nightLight:null==e?void 0:e.nightLight,isTimerRequired:!0}))};return Promise.resolve(E.mutateAsync(e)).then(function(e){var t;const n=null==e||null===(t=e.advertisementSlotAvailabiltityDetails)||void 0===t?void 0:t.some(e=>"BOOKED"===e.slotStaus),l=null==e?void 0:e.advertisementSlotAvailabiltityDetails[0].timerValue;n?d({error:!0,label:i("ADS_ADVERTISEMENT_ALREADY_BOOKED")}):u(l||0)})}{const e=function(){if("chb-services"===a)return Promise.resolve(p()).then(function(e){var t,n;(null==e||null===(t=e.data)||void 0===t||null===(n=t.hallSlotAvailabiltityDetails)||void 0===n?void 0:n.some(e=>"BOOKED"===e.slotStaus))?d({error:!0,label:i("CHB_COMMUNITY_HALL_ALREADY_BOOKED")}):u((null==e?void 0:e.data.timerValue)||0)})}();if(e&&e.then)return e.then(function(){})}}();if(e&&e.then)return e.then(function(){})},function(){d({error:!0,label:i("CS_SOMETHING_WENT_WRONG")})}))}catch(e){return Promise.reject(e)}}(),v(!0))},[a,o,p,i,s,m,E]),n.useEffect(()=>{if(s>0){const e=setInterval(()=>{u(t=>t<=0?(clearInterval(e),0):t-1)},1e3);return r(s),()=>clearInterval(e)}},[s]),n.useEffect(()=>{if(c){const e=setTimeout(()=>{d(null)},2e3);return()=>clearTimeout(e)}},[c]),l.createElement("div",null,i("CS_TIME_REMAINING"),": ",l.createElement("span",{className:"astericColor"},(e=>{const t=e%60;return Math.floor(e/60)+":"+(t<10?"0":"")+t})(s)),c&&l.createElement(t.Toast,{error:c.error,warning:c.warning,label:i(c.label),onClose:()=>{d(null)}}))},C=e=>{var o,r,s,u,c,d,m,E,f,_,h,y,g,S,A,C;let{paymentRules:D,businessService:T}=e;const{t:I}=a.useTranslation(),O=i.useHistory(),{state:M,pathname:L,search:w}=i.useLocation(),R=Digit.UserService.getUser();let{consumerCode:x}=i.useParams();const{workflow:k,tenantId:B,authorization:H,ConsumerName:F}=Digit.Hooks.useQueryParams(),[U,j]=n.useState(null==M?void 0:M.bill),Y=(null==M?void 0:M.tenantId)||B||(null===(o=Digit.UserService.getUser().info)||void 0===o?void 0:o.tenantId),V=null==M?void 0:M.propertyId,[z,W]=n.useState(0);"WNS"===k&&x.includes("?")&&(x=x.substring(0,x.indexOf("?")));const{data:G,isLoading:q}=null!=M&&M.bill?{isLoading:!1}:Digit.Hooks.useFetchPayment({tenantId:Y,businessService:T,consumerCode:"WNS"===k?v(x,"+","/"):x});let K=(null==G||null===(r=G.Bill)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.userId)||"",X=["/user/_search",{},{data:{uuid:[K]}},{recordId:K,plainRequestFields:["mobileNumber"]},{enabled:!!K,cacheTime:100}];const{data:Q}=Digit.Hooks.useCustomAPIHook(...X),{isLoading:Z,data:$}=Digit.Hooks.fsm.useApplicationDetail(I,Y,x,{enabled:!!L.includes("FSM")},"CITIZEN");let{minAmountPayable:J,isAdvanceAllowed:ee}=D;J="WNS"===k?100:J;const te=(null==U||null===(u=U.billDetails)||void 0===u||null===(c=u.sort((e,t)=>t.fromPeriod-e.fromPeriod))||void 0===c?void 0:c[0])||[],ne=(null==U||null===(d=U.billDetails)||void 0===d||null===(m=d.sort((e,t)=>t.fromPeriod-e.fromPeriod))||void 0===m?void 0:m.reduce((e,t,n)=>0===n?e:e+t.amount,0))||0,{label:le}=Digit.Hooks.useApplicationsForBusinessServiceSearch({businessService:T},{enabled:!1}),ae=()=>(null==U?void 0:U.totalAmount)||0,[ie,oe]=n.useState(I("CS_PAYMENT_FULL_AMOUNT")),[re,se]=n.useState(ae()),[ue,ce]=n.useState(!0),[de,me]=n.useState("");return"true"!==H||null!=R&&R.access_token||(localStorage.clear(),sessionStorage.clear(),window.location.href="/digit-ui/citizen/login?from="+encodeURIComponent(L+w)),n.useEffect(()=>{window.scroll({top:0,behavior:"smooth"})},[]),n.useEffect(()=>{ie==I("CS_PAYMENT_FULL_AMOUNT")&&se(ae())},[ie,U]),n.useEffect(()=>{let e=ee;ee&&"WNS"===k&&(e=!1);const t=J&&re>=J&&!e&&re<=ae()&&!de;ie!=I("CS_PAYMENT_FULL_AMOUNT")?ce(t):ce(!0)},[ie,re]),n.useEffect(()=>{var e,t;Z||"PENDING_APPL_FEE_PAYMENT_CITIZEN"!==(null==$||null===(e=$.pdfData)||void 0===e?void 0:e.applicationStatus)&&"PENDING_APPL_FEE_PAYMENT"!==(null==$||null===(t=$.pdfData)||void 0===t?void 0:t.applicationStatus)||(ce(!0),oe(I("CS_PAYMENT_ADV_COLLECTION")))}),n.useEffect(()=>{if(!U&&G){let e=G.Bill.filter(e=>e.consumerCode==("WNS"===k?v(x,"+","/"):x))[0];j(e)}},[q]),q||Z?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.Header,null,I("CS_PAYMENT_BILL_DETAILS")),l.createElement(t.Card,null,l.createElement("div",null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l.createElement(t.KeyNote,{keyValue:I("PT.MUTATION"==T?"PDF_STATIC_LABEL_MUATATION_NUMBER_LABEL":le),note:"WNS"===k?v(x,"+","/"):x}),p(T)&&l.createElement(t.CardSubHeader,{style:{textAlign:"right",fontSize:"24px"}},l.createElement(N,{businessService:T,setTime:W,timerValues:null==M?void 0:M.timerValue,t:I,SlotSearchData:null==M?void 0:M.SlotSearchData}))),"PT.MUTATION"!==T&&"FSM.TRIP_CHARGES"!==T&&l.createElement(t.KeyNote,{keyValue:I("CS_PAYMENT_BILLING_PERIOD"),note:(()=>{const{fromPeriod:e,toPeriod:t}=te;if(e&&t){let i,o;var n,l,a;return"mcollect"===k||"WNS"===k?(i=new Date(e).getDate().toString()+" "+(null===(n=Digit.Utils.date.monthNames[new Date(e).getMonth()])||void 0===n?void 0:n.toString())+" "+new Date(e).getFullYear().toString(),o=new Date(t).getDate()+" "+Digit.Utils.date.monthNames[new Date(t).getMonth()]+" "+new Date(t).getFullYear(),i+" - "+o):(i=new Date(te.fromPeriod).getFullYear().toString(),o=new Date(te.toPeriod).getFullYear().toString(),i===o?window.location.href.includes("BPA")?new Date(null==G||null===(l=G.Bill)||void 0===l||null===(a=l[0])||void 0===a?void 0:a.billDate).getMonth()+1<4?"FY "+(parseInt(i)-1).toString()+"-"+o:"FY "+i+"-"+(parseInt(o)+1).toString():"FY "+i:"FY "+i+"-"+o)}return"N/A"})()}),(null==T?void 0:T.includes("PT"))||"WNS"===k&&(null==te?void 0:te.currentBillNo)&&l.createElement(t.KeyNote,{keyValue:I("CS_BILL_NO"),note:null==te?void 0:te.currentBillNo}),(null==T?void 0:T.includes("PT"))||"WNS"===k&&(null==te?void 0:te.currentExpiryDate)&&l.createElement(t.KeyNote,{keyValue:I("CS_BILL_DUEDATE"),note:new Date(null==te?void 0:te.currentExpiryDate).toLocaleDateString()}),"FSM.TRIP_CHARGES"===T?l.createElement("div",null,l.createElement(t.KeyNote,{keyValue:I("ES_PAYMENT_DETAILS_TOTAL_AMOUNT"),note:null==$||null===(E=$.pdfData)||void 0===E?void 0:E.totalAmount}),l.createElement(t.KeyNote,{keyValue:I("ES_PAYMENT_DETAILS_ADV_AMOUNT"),note:null==$||null===(f=$.pdfData)||void 0===f?void 0:f.advanceAmount}),"PENDING_APPL_FEE_PAYMENT_CITIZEN"!==(null==$||null===(_=$.pdfData)||void 0===_?void 0:_.applicationStatus)||"PENDING_APPL_FEE_PAYMENT"!==(null==$||null===(h=$.pdfData)||void 0===h?void 0:h.applicationStatus)?l.createElement(t.KeyNote,{keyValue:I("FSM_DUE_AMOUNT_TO_BE_PAID"),note:(null==$||null===(y=$.pdfData)||void 0===y?void 0:y.totalAmount)-(null==$||null===(g=$.pdfData)||void 0===g?void 0:g.advanceAmount)}):null):l.createElement(b,{billAccountDetails:(null==te?void 0:te.billAccountDetails)||[],total:ae(),businessService:T,arrears:ne}),l.createElement(P,{bill:U})),l.createElement("div",{className:"bill-payment-amount"},l.createElement("hr",{className:"underline"}),l.createElement(t.CardSubHeader,null,I("CS_COMMON_PAYMENT_AMOUNT")),"FSM.TRIP_CHARGES"===T?null:l.createElement(t.RadioButtons,{selectedOption:ie,onSelect:oe,options:D.partPaymentAllowed&&"POST_PAY"!==(null==$||null===(S=$.pdfData)||void 0===S?void 0:S.paymentPreference)&&"PENDING_APPL_FEE_PAYMENT_CITIZEN"===(null==$||null===(A=$.pdfData)||void 0===A?void 0:A.applicationStatus)?[I("CS_PAYMENT_ADV_COLLECTION")]:[I("CS_PAYMENT_FULL_AMOUNT")]}),l.createElement("div",{style:{position:"relative"}},l.createElement("span",{className:"payment-amount-front",style:{border:"1px solid "+(I("CS_PAYMENT_FULL_AMOUNT"),"#9a9a9a")}},"₹"),console.log(U,"bill"),ie!==I("CS_PAYMENT_FULL_AMOUNT")?l.createElement(t.TextInput,"FSM.TRIP_CHARGES"===T?{className:"text-indent-xl",onChange:()=>{},value:null==$||null===(ve=$.pdfData)||void 0===ve?void 0:ve.advanceAmount,disable:!0}:{className:"text-indent-xl",onChange:e=>{return t=e.target.value,me(""),isNaN(t)||t.includes(".")?me("AMOUNT_INVALID"):!ee&&t>ae()?me("CS_ADVANCED_PAYMENT_NOT_ALLOWED"):t<J&&me("CS_CANT_PAY_BELOW_MIN_AMOUNT"),void se(t);var t},value:re,disable:0===ae()}):l.createElement(t.TextInput,"FSM.TRIP_CHARGES"===T?{className:"text-indent-xl",value:null==$||null===(C=$.pdfData)||void 0===C?void 0:C.advanceAmount,onChange:()=>{},disable:!0}:{className:"text-indent-xl",value:ae(),onChange:()=>{},disable:!0}),"CS_CANT_PAY_BELOW_MIN_AMOUNT"===de?l.createElement("span",{className:"card-label-error"},I(de),": ","₹"+J):l.createElement("span",{className:"card-label-error"},I(de))),l.createElement(t.SubmitBar,{disabled:!ue||0===ae(),onSubmit:()=>{var e,t;let n=ie===I("CS_PAYMENT_FULL_AMOUNT")?"FSM.TRIP_CHARGES"===T?null==$||null===(e=$.pdfData)||void 0===e?void 0:e.advanceAmount:ae():re||"FSM.TRIP_CHARGES"===T?null==$||null===(t=$.pdfData)||void 0===t?void 0:t.advanceAmount:re;if(window.location.href.includes("mcollect"))O.push("/digit-ui/citizen/payment/collect/"+T+"/"+x+"?workflow=mcollect",{paymentAmount:n,tenantId:te.tenantId});else if("WNS"===k){var l,a,i;O.push("/digit-ui/citizen/payment/billDetails/"+T+"/"+x+"/"+n+"?workflow=WNS&ConsumerName="+F,{paymentAmount:n,tenantId:te.tenantId,name:U.payerName,mobileNumber:U.mobileNumber&&null!==(l=U.mobileNumber)&&void 0!==l&&l.includes("*")?null==Q||null===(a=Q.user)||void 0===a||null===(i=a[0])||void 0===i?void 0:i.mobileNumber:U.mobileNumber})}else if("PT"===T){var o,r,s;O.push("/digit-ui/citizen/payment/billDetails/"+T+"/"+x+"/"+n,{paymentAmount:n,tenantId:te.tenantId,name:U.payerName,mobileNumber:U.mobileNumber&&null!==(o=U.mobileNumber)&&void 0!==o&&o.includes("*")?null==Q||null===(r=Q.user)||void 0===r||null===(s=r[0])||void 0===s?void 0:s.mobileNumber:U.mobileNumber})}else p(T)?O.push("/digit-ui/citizen/payment/collect/"+T+"/"+x,{paymentAmount:n,tenantId:te.tenantId,propertyId:V,timerValue:null==M?void 0:M.timerValue,SlotSearchData:null==M?void 0:M.SlotSearchData}):O.push("/digit-ui/citizen/payment/collect/"+T+"/"+x,{paymentAmount:n,tenantId:te.tenantId,propertyId:V})},label:I("CS_COMMON_PROCEED_TO_PAY")}))));var ve},D=["url"],T=e=>{let{billsList:n,paymentRules:a,businessService:o}=e;const r=i.useRouteMatch(),{url:s}=r;return m(r,D),l.createElement(l.Fragment,null,l.createElement(t.BackButton,null),l.createElement(i.Switch,null,l.createElement(i.Route,{exact:!0,path:""+s,component:()=>l.createElement(h,{billsList:n,currentPath:s,paymentRules:a,businessService:o})}),l.createElement(i.Route,{path:s+"/:consumerCode",component:()=>l.createElement(C,{paymentRules:a,businessService:o})})))},I=e=>{var n,a,o;let{stateCode:r}=e;const{businessService:s}=i.useParams(),{tenantId:u,isDisoconnectFlow:c}=Digit.Hooks.useQueryParams(),d=(Digit.Services.useStore({stateCode:r,moduleCode:s,language:Digit.StoreData.getCurrentLanguage()}),i.useHistory()),{url:m}=i.useRouteMatch(),v=i.useLocation(),{tenantId:p}=(null===(n=Digit.UserService.getUser())||void 0===n?void 0:n.info)||(null==v?void 0:v.state)||{tenantId:u}||{};p||null!=v&&null!==(a=v.state)&&void 0!==a&&a.fromSearchResults||d.replace("/digit-ui/citizen/login",{from:m});const{data:E}=Digit.Hooks.useFetchCitizenBillsForBuissnessService({businessService:s},{refetchOnMount:!0,enabled:!(null!=v&&null!==(o=v.state)&&void 0!==o&&o.fromSearchResults)}),{isLoading:f,data:_}=Digit.Hooks.useGetPaymentRulesForBusinessServices(p),h=(null==E?void 0:E.Bill)||[];return f?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(T,{billsList:h,paymentRules:(()=>{var e,t,n;const l=null==_||null===(e=_.MdmsRes)||void 0===e||null===(t=e.BillingService)||void 0===t?void 0:t.BusinessService;let a="WS"!==s&&"SW"!==s||"true"!==c?s:"DISCONNECT";return null!=l&&l.length?(null===(n=l.filter(e=>e.code==a))||void 0===n?void 0:n[0])||{isAdvanceAllowed:!1,isVoucherCreationEnabled:!0,minAmountPayable:100,partPaymentAllowed:!1}:{}})(),businessService:s}))},O=e=>{const{state:s={}}=i.useLocation(),u=Digit.UserService.getUser(),[c,d]=n.useState(null),{tenantId:m,authorization:E,workflow:f,consumerCode:_}=Digit.Hooks.useQueryParams(),h=null==s?void 0:s.paymentAmount,{t:y}=a.useTranslation(),{pathname:g,search:S}=(i.useHistory(),i.useLocation());let{consumerCode:P,businessService:b}=i.useParams();const C=(null==s?void 0:s.tenantId)||m||Digit.ULBService.getCurrentTenantId(),D=Digit.ULBService.getStateId(),{control:T,handleSubmit:I}=o.useForm(),[O,M]=n.useState(0),{data:L,isLoading:w}=Digit.Hooks.useCommonMDMS(D,"DIGIT-UI","PaymentGateway"),{data:R,isLoading:x}=Digit.Hooks.useFetchPayment({tenantId:C,consumerCode:"WNS"===f?_:P,businessService:b},{});(window.location.href.includes("ISWSCON")||"WNS"===f)&&(P=decodeURIComponent(P)),"WNS"===f&&(P=v(P,"+","/")),n.useEffect(()=>{null!=R&&R.Bill&&0==R.Bill.length&&d({key:!0,label:"CS_BILL_NOT_FOUND"})},[R]),n.useEffect(()=>{localStorage.setItem("BillPaymentEnabled","true")},[]);const{name:k,mobileNumber:B}=s,H=null!=R&&R.Bill?null==R?void 0:R.Bill[0]:{};return"true"!==E||u.access_token||(localStorage.clear(),sessionStorage.clear(),window.location.href="/digit-ui/citizen/login?from="+encodeURIComponent(g+S)),w||x?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement(t.BackButton,null,y("CS_COMMON_BACK")),l.createElement("form",{onSubmit:I(function(e){try{var t,n;const l={Transaction:{tenantId:null==H?void 0:H.tenantId,txnAmount:h||H.totalAmount,module:b,billId:H.id,consumerCode:P,productInfo:"Common Payment",gateway:(null==e?void 0:e.paymentType)||"AXIS",taxAndPayments:[{billId:H.id,amountPaid:h||H.totalAmount}],user:{name:k||(null==u||null===(t=u.info)||void 0===t?void 0:t.name)||(null==H?void 0:H.payerName),mobileNumber:B||(null==u||null===(n=u.info)||void 0===n?void 0:n.mobileNumber)||(null==H?void 0:H.mobileNumber),tenantId:null==H?void 0:H.tenantId,emailId:"sriranjan.srivastava@owc.com"},callbackUrl:window.location.href.includes("mcollect")||"WNS"===f?window.location.protocol+"//"+window.location.host+"/digit-ui/citizen/payment/success/"+b+"/"+P+"/"+C+"?workflow="+("WNS"===f?f:"mcollect"):window.location.protocol+"//"+window.location.host+"/digit-ui/citizen/payment/success/"+b+"/"+("WNS"===f?encodeURIComponent(P):P)+"/"+C+"?propertyId="+P,additionalDetails:{isWhatsapp:!1}}},a=A(function(){return Promise.resolve(Digit.PaymentService.createCitizenReciept(null==H?void 0:H.tenantId,l)).then(function(t){var n;const l=null==t||null===(n=t.Transaction)||void 0===n?void 0:n.redirectUrl;if("AXIS"==(null==e?void 0:e.paymentType))window.location=l;else if("NTTDATA"==(null==e?void 0:e.paymentType)){let e=l.split("returnURL="),t=e[0].split("?")[1].split("&");const n={atomTokenId:t[0].split("=")[1],merchId:t[1].split("=")[1],custEmail:"sriranjan.srivastava@owc.com",custMobile:t[3].split("=")[1],returnUrl:e[1]};new AtomPaynetz(n,"uat")}else try{var a,i,o,s,u,c,d,m,v,p,E;const e=null==l||null===(a=l.split("?"))||void 0===a||null===(i=a.slice(1))||void 0===i||null===(o=i.join("?"))||void 0===o||null===(s=o.split("&"))||void 0===s?void 0:s.reduce((e,t)=>{var n=t.split("=");return e[n[0]]=n[1],e},{});var f=r("<form>",{action:e.txURL,method:"POST",target:"_top"});const t=["checksum","messageType","merchantId","serviceId","orderId","customerId","transactionAmount","currencyCode","requestDateTime","successUrl","failUrl","additionalField1","additionalField2","additionalField3","additionalField4","additionalField5"];for(var _ of(e.requestDateTime=null===(u=e.requestDateTime)||void 0===u?void 0:u.split((new Date).getFullYear()).join((new Date).getFullYear()+" "),e.successUrl=(null==l||null===(c=l.split("successUrl="))||void 0===c||null===(d=c[1])||void 0===d||null===(m=d.split("eg_pg_txnid="))||void 0===m?void 0:m[0])+"eg_pg_txnid="+(null==e?void 0:e.orderId),e.failUrl=(null==l||null===(v=l.split("failUrl="))||void 0===v||null===(p=v[1])||void 0===p||null===(E=p.split("eg_pg_txnid="))||void 0===E?void 0:E[0])+"eg_pg_txnid="+(null==e?void 0:e.orderId),t))f.append(r("<input>",{name:_,value:e[_]}));r(document.body).append(f),f.submit(),function(e,t){try{var n=new Headers;n.append("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"),n.append("Access-Control-Allow-Origin","*"),fetch(e,{method:"POST",headers:n,body:t,mode:"no-cors",redirect:"follow"}).then(e=>e.text()).then(e=>console.log(e)).catch(e=>console.log("error",e)),Promise.resolve()}catch(e){return Promise.reject(e)}}(e.txURL,f)}catch(e){console.log("Error in payment redirect ",e)}})},function(e){var t,n,l;let a="CS_PAYMENT_UNKNOWN_ERROR_ON_SERVER";if(null!==(t=e.response)&&void 0!==t&&null!==(n=t.data)&&void 0!==n&&null!==(l=n.Errors)&&void 0!==l&&l[0]){var i,o,r;const{code:t}=null===(i=e.response)||void 0===i||null===(o=i.data)||void 0===o||null===(r=o.Errors)||void 0===r?void 0:r[0];a=t}d({key:!0,label:y(a)})});return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})},l.createElement(t.Header,null,y("PAYMENT_CS_HEADER")),l.createElement(t.Card,null,p(b)&&l.createElement(t.CardSubHeader,{style:{textAlign:"right",fontSize:"24px"}},l.createElement(N,{businessService:b,setTime:M,timerValues:null==s?void 0:s.timerValue,t:y,SlotSearchData:null==s?void 0:s.SlotSearchData})),l.createElement("div",{className:"payment-amount-info",style:{marginBottom:"26px"}},l.createElement(t.CardLabel,{className:"dark"},y("PAYMENT_CS_TOTAL_AMOUNT_DUE")),l.createElement(t.CardSectionHeader,null," ₹ ",void 0!==h?Number(h).toFixed(2):Number(null==H?void 0:H.totalAmount).toFixed(2))),l.createElement(t.CardLabel,null,y("PAYMENT_CS_SELECT_METHOD")),(null==L?void 0:L.length)&&l.createElement(o.Controller,{name:"paymentType",defaultValue:L[0],control:T,render:e=>l.createElement(t.RadioButtons,{selectedOption:e.value,options:L,onSelect:e.onChange})}),!c&&l.createElement(t.SubmitBar,{label:y("PAYMENT_CS_BUTTON_LABEL"),submit:!0,disabled:p(b)?0===O:null}))),l.createElement(t.InfoBanner,{label:y("CS_COMMON_INFO"),text:y("CS_PAYMENT_REDIRECT_NOTICE")}),c&&l.createElement(t.Toast,{error:c.key,label:y(c.label),onClose:()=>{d(null)}}))},M=e=>"true"!==localStorage.getItem("BillPaymentEnabled")?(window.history.forward(),null):l.createElement(w,e),L=e=>{if(e){const t=new Date(e);let n=t.getMonth()+1,l=t.getDate(),a=t.getFullYear();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+a}return"NA"},w=e=>{var o,r,u,d,m,v,p,E,f,_,h,y,g,S,P,b,A,N,C,D,T,I,O,M,w,R,x,k;const{t:B}=a.useTranslation(),H=s.useQueryClient(),{eg_pg_txnid:F,workflow:U}=Digit.Hooks.useQueryParams(),[j,Y]=n.useState(!1),[V,z]=n.useState(!1),{businessService:W,consumerCode:G,tenantId:q}=i.useParams(),{data:K={},isLoading:X}=Digit.Hooks.obps.useOBPSSearch("",{},q,{applicationNo:G},{},{enabled:window.location.href.includes("bpa")||window.location.href.includes("BPA")}),{isLoading:Q,data:Z,isError:$}=Digit.Hooks.usePaymentUpdate({egId:F},W,{retry:!1,staleTime:Infinity,refetchOnWindowFocus:!1});console.log("datatatataty",Z);const{label:J}=Digit.Hooks.useApplicationsForBusinessServiceSearch({businessService:W},{enabled:!1}),ee=Digit.Hooks.chb.useChbCreateAPI(q,!1),te=Digit.Hooks.ads.useADSCreateAPI(q,!1),ne=W.includes("WS.ONE_TIME_FEE")?Digit.ULBService.getStateId():q,{data:le,isLoading:ae}=Digit.Hooks.useRecieptSearch({tenantId:q,businessService:W,receiptNumbers:null==Z||null===(o=Z.payments)||void 0===o||null===(r=o.Payments)||void 0===r||null===(u=r[0])||void 0===u?void 0:u.paymentDetails[0].receiptNumber},{retry:!1,staleTime:Infinity,refetchOnWindowFocus:!1,select:e=>e.Payments[0],enabled:V}),{data:ie}=Digit.Hooks.useCommonMDMS(ne,"common-masters","ReceiptKey",{select:e=>{var t,n,l;return(null===(t=e["common-masters"])||void 0===t||null===(n=t.uiCommonPay)||void 0===n||null===(l=n.filter(e=>{let{code:t}=e;return null==W?void 0:W.includes(t)})[0])||void 0===l?void 0:l.receiptKey)||"consolidatedreceipt"},retry:!1,staleTime:Infinity,refetchOnWindowFocus:!1}),oe=null==Z?void 0:Z.payments;if(n.useEffect(()=>()=>{localStorage.setItem("BillPaymentEnabled","false"),H.clear()},[]),n.useEffect(()=>{Z&&Z.txnStatus&&"FAILURE"!==Z.txnStatus&&z(!0)},[Z]),Q||ae)return l.createElement(t.Loader,null);const re=null==Z?void 0:Z.applicationNo,se=window.Digit.Utils.browser.isMobile();if($||!oe||!oe.Payments||0===oe.Payments.length||"FAILURE"===Z.txnStatus)return l.createElement(t.Card,null,l.createElement(t.Banner,{message:B("CITIZEN_FAILURE_COMMON_PAYMENT_MESSAGE"),info:B("CS_PAYMENT_TRANSANCTION_ID"),applicationNumber:F,successful:!1}),l.createElement(t.CardText,null,B("CS_PAYMENT_FAILURE_MESSAGE")),null!=W&&W.includes("PT")?l.createElement(l.Fragment,null,l.createElement(i.Link,{to:re&&"/digit-ui/citizen/payment/my-bills/"+W+"/"+re||"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CS_PAYMENT_TRY_AGAIN")})),l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"}},l.createElement(i.Link,{to:"/digit-ui/citizen"},B("CORE_COMMON_GO_TO_HOME")))):l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CORE_COMMON_GO_TO_HOME")})));const ue=null==Z||null===(d=Z.payments)||void 0===d?void 0:d.Payments[0],ce=null==ue?void 0:ue.transactionDate,de=function(){try{var e;function t(){return Promise.resolve(Digit.PaymentService.printReciept(a,{fileStoreIds:i.filestoreIds[0]})).then(function(e){e&&e[i.filestoreIds[0]]&&window.open(e[i.filestoreIds[0]],"_blank"),Y(!1)})}let n="ws-onetime-receipt";if(j)return Promise.resolve();Y(!0);let l=[];const a=Digit.ULBService.getStateId();let i={filestoreIds:[null===(e=oe.Payments[0])||void 0===e?void 0:e.fileStoreId]};const o=function(){if(null==ue||!ue.fileStoreId){let e,t,o="",r="",s=0;const u=function(u,d,m,v){if("PT"==(null==oe||null===(u=oe.Payments)||void 0===u||null===(d=u[0])||void 0===d||null===(m=d.paymentDetails)||void 0===m?void 0:m[0].businessService)||"PT.MUTATION"==(null==oe||null===(v=oe.Payments)||void 0===v?void 0:v[0].paymentDetails[0].businessService)){if(oe.Payments[0].paymentDetails[0].bill.billDetails.map(n=>{(n.amount>0||n.amountPaid>0)&&(s+=1,e=L(n.toPeriod).split("/")[2],t=L(n.fromPeriod).split("/")[2],o=""==o?t+"-"+e+"(Rs."+n.amountPaid+")":o+","+t+"-"+e+"(Rs."+n.amountPaid+")",r=t+"-"+e)}),0==s){let e=L(oe.Payments[0].paymentDetails[0].bill.billDetails[0].toPeriod).split("/")[2],t=L(oe.Payments[0].paymentDetails[0].bill.billDetails[0].fromPeriod).split("/")[2];o=""==o?t+"-"+e:o+","+t+"-"+e,r=t+"-"+e}oe.Payments[0].paymentDetails[0].additionalDetails={assessmentYears:o,arrearCode:""},be(oe)}else{let e,t=oe.Payments[0].paymentDetails[0].businessService;"BPAREG"==oe.Payments[0].paymentDetails[0].businessService&&(e=c({},oe.Payments[0].additionalDetails,{stakeholderType:"Application"})),oe.Payments[0].additionalDetails=e,l[0]=oe.Payments[0],console.log("generatedpdfkey",ie);const o=function(){if("WS"==W||"SW"==W)return Promise.resolve(Digit.PaymentService.generatePdf(a,{Payments:[c({},ue)]},n)).then(function(e){i=e});{const e=function(){if(t.includes("BPA")){var e,n;let t={applicationNo:null===(e=oe.Payments[0].paymentDetails[0])||void 0===e||null===(n=e.bill)||void 0===n?void 0:n.consumerCode};return Promise.resolve(Digit.OBPSService.BPASearch(oe.Payments[0].tenantId,t)).then(function(e){var t,n,l,o,r;const s=null==e||null===(t=e.BPA[0])||void 0===t||null===(n=t.additionalDetails)||void 0===n?void 0:n.typeOfArchitect,u=c({},ue,{paymentDetails:[c({},null===(l=ue.paymentDetails)||void 0===l?void 0:l[0],{additionalDetails:c({},ue.paymentDetails[0].additionalDetails,{propertyID:null==e||null===(o=e.BPA[0])||void 0===o||null===(r=o.additionalDetails)||void 0===r?void 0:r.propertyID,stakeholderType:s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()})})]});return Promise.resolve(Digit.PaymentService.generatePdf(a,{Payments:[c({},u)]},ie)).then(function(e){i=e})})}return Promise.resolve(Digit.PaymentService.generatePdf(a,{Payments:[c({},ue)]},ie)).then(function(e){i=e})}();if(e&&e.then)return e.then(function(){})}}();if(o&&o.then)return o.then(function(){})}}();if(u&&u.then)return u.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(t):t())}catch(e){return Promise.reject(e)}},me=function(e,t){void 0===t&&(t="download");try{var n,l;let a={applicationNo:null==K||null===(n=K[0])||void 0===n?void 0:n.applicationNo};return Promise.resolve(Digit.OBPSService.BPASearch(null==K||null===(l=K[0])||void 0===l?void 0:l.tenantId,a)).then(function(n){var l,a;return Promise.resolve(Digit.OBPSService.scrutinyDetails(null==K||null===(l=K[0])||void 0===l?void 0:l.tenantId,{edcrNumber:null==K||null===(a=K[0])||void 0===a?void 0:a.edcrNumber})).then(function(l){var a,i;let o=null==n||null===(a=n.BPA)||void 0===a?void 0:a[0],r=null==l||null===(i=l.edcrDetail)||void 0===i?void 0:i[0],s=new Date;o.additionalDetails.runDate=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}}(s.getFullYear()+"-"+(s.getMonth()+1)+"-"+s.getDate());let u=c({},o,{edcrDetail:[c({},r)]});return console.log("reqData",u),Promise.resolve(Digit.PaymentService.generatePdf(null==o?void 0:o.tenantId,{Bpa:[u]},e)).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(null==o?void 0:o.tenantId,{fileStoreIds:e.filestoreIds[0]})).then(function(n){var l;return window.open(n[null==e?void 0:e.filestoreIds[0]],"_blank"),u.applicationType=null==o||null===(l=o.additionalDetails)||void 0===l?void 0:l.applicationType,Promise.resolve(Digit.OBPSService.edcr_report_download({BPA:c({},u)})).then(function(e){const n=parseInt(e.status,10);201!==n&&200!==n||("print"==t?(e=>{const t=URL.createObjectURL(e);var n=window.open(t);null!=n&&n.addEventListener("load",e=>{n.focus(),n.print()})})(new Blob([e.data],{type:"application/pdf"})):((e,t)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){mSewaApp.downloadBase64File(n.result,"edcrReport.pdf")}}else{const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download="edcrReport.pdf",document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(t.href),7e3)}})(new Blob([e.data],{type:"application/pdf"})))})})})})})}catch(e){return Promise.reject(e)}};let ve;var pe,Ee,fe,_e,he;if(U)ve="CITIZEN_SUCCESS_UC_PAYMENT_MESSAGE";else if(null!=ue&&null!==(pe=ue.paymentDetails)&&void 0!==pe&&null!==(Ee=pe[0])&&void 0!==Ee&&Ee.businessService&&null!=ue&&null!==(fe=ue.paymentDetails)&&void 0!==fe&&null!==(_e=fe[0])&&void 0!==_e&&null!==(he=_e.businessService)&&void 0!==he&&he.includes("BPA")){var ye;let e=sessionStorage.getItem("BPA_ARCHITECT_NAME"),t=e?JSON.parse(e):"ARCHITECT";ve="CITIZEN_SUCCESS_"+(null==ue||null===(ye=ue.paymentDetails[0])||void 0===ye?void 0:ye.businessService.replace(/\./g,"_"))+"_"+t+"_PAYMENT_MESSAGE"}else if(null!=W&&W.includes("WS")||null!=W&&W.includes("SW"))ve=B("CITIZEN_SUCCESS_"+(null==ue?void 0:ue.paymentDetails[0].businessService.replace(/\./g,"_"))+"_WS_PAYMENT_MESSAGE");else{var ge,Se;ve=null!=ue&&null!==(ge=ue.paymentDetails[0])&&void 0!==ge&&ge.businessService?"CITIZEN_SUCCESS_"+(null==ue||null===(Se=ue.paymentDetails[0])||void 0===Se?void 0:Se.businessService.replace(/\./g,"_"))+"_PAYMENT_MESSAGE":B("CITIZEN_SUCCESS_UC_PAYMENT_MESSAGE")}const Pe={padding:"4px 0px",justifyContent:"space-between"},be=function(e){try{function t(){var t;function n(){return Promise.resolve(Digit.PaymentService.printReciept(l,{fileStoreIds:o.filestoreIds[0]})).then(function(e){window.open(e[o.filestoreIds[0]],"_blank")})}let o={filestoreIds:[null===(t=a.Payments[0])||void 0===t?void 0:t.fileStoreId]};const r=function(){{let t,n,r="",s="",u=0;if("PT"==a.Payments[0].paymentDetails[0].businessService||"PT.MUTATION"==a.Payments[0].paymentDetails[0].businessService){let e={},l=[],i={},o=[],c=0,d=0,m=0,v=0,p=0,E=0,f=0,_=0,h=0,y=0,g=0,S=0,P=0,b=0,A=0,N=0,C=0,D=0,T=0,I=0,O=0,M=0,w=0,R=0;if(a.Payments[0].paymentDetails[0].bill.billDetails.map(a=>{(a.amount>0||a.amountPaid>0)&&(u+=1,t=L(a.toPeriod).split("/")[2],n=L(a.fromPeriod).split("/")[2],r=""==r?n+"-"+t+"(Rs."+a.amountPaid+")":r+","+n+"-"+t+"(Rs."+a.amountPaid+")",s=n+"-"+t,a.billAccountDetails.map(e=>{"PT_TAX"==e.taxHeadCode?(d=e.adjustedAmount,b=e.amount):"PT_TIME_REBATE"==e.taxHeadCode?(E=e.adjustedAmount,D=e.amount):"PT_CANCER_CESS"==e.taxHeadCode?(v=e.adjustedAmount,N=e.amount):"PT_FIRE_CESS"==e.taxHeadCode?(m=e.adjustedAmount,A=e.amount):"PT_TIME_INTEREST"==e.taxHeadCode?(f=e.adjustedAmount,T=e.amount):"PT_TIME_PENALTY"==e.taxHeadCode?(p=e.adjustedAmount,C=e.amount):"PT_OWNER_EXEMPTION"==e.taxHeadCode?(h=e.adjustedAmount,O=e.amount):"PT_ROUNDOFF"==e.taxHeadCode?(c=e.adjustedAmount,P=e.amount):"PT_UNIT_USAGE_EXEMPTION"==e.taxHeadCode?(_=e.adjustedAmount,I=e.amount):"PT_ADHOC_PENALTY"==e.taxHeadCode?(y=e.adjustedAmount,M=e.amount):"PT_ADHOC_REBATE"==e.taxHeadCode&&(g=e.adjustedAmount,w=e.amount),R+=e.amount}),e={year:s,tax:d,firecess:m,cancercess:v,penalty:p,rebate:E,interest:f,usage_exemption:_,special_category_exemption:h,adhoc_penalty:y,adhoc_rebate:g,roundoff:c,total:a.amountPaid},i={year:s,tax:b,firecess:A,cancercess:N,penalty:C,rebate:D,interest:T,usage_exemption:I,special_category_exemption:O,adhoc_penalty:M,adhoc_rebate:w,roundoff:P,total:a.amount},l.push(e),o.push(i))}),0==u){let t=L(a.Payments[0].paymentDetails[0].bill.billDetails[0].toPeriod).split("/")[2],n=L(a.Payments[0].paymentDetails[0].bill.billDetails[0].fromPeriod).split("/")[2];r=""==r?n+"-"+t:r+","+n+"-"+t,s=n+"-"+t,a.Payments[0].paymentDetails[0].bill.billDetails[0].billAccountDetails.map(e=>{"PT_TAX"==e.taxHeadCode?(d=e.adjustedAmount,b=e.amount):"PT_TIME_REBATE"==e.taxHeadCode?(E=e.adjustedAmount,D=e.amount):"PT_CANCER_CESS"==e.taxHeadCode?(v=e.adjustedAmount,N=e.amount):"PT_FIRE_CESS"==e.taxHeadCode?(m=e.adjustedAmount,A=e.amount):"PT_TIME_INTEREST"==e.taxHeadCode?(f=e.adjustedAmount,T=e.amount):"PT_TIME_PENALTY"==e.taxHeadCode?(p=e.adjustedAmount,C=e.amount):"PT_OWNER_EXEMPTION"==e.taxHeadCode?(h=e.adjustedAmount,O=e.amount):"PT_ROUNDOFF"==e.taxHeadCode?(c=e.adjustedAmount,P=e.amount):"PT_UNIT_USAGE_EXEMPTION"==e.taxHeadCode?(_=e.adjustedAmount,I=e.amount):"PT_ADHOC_PENALTY"==e.taxHeadCode?(y=e.adjustedAmount,M=e.amount):"PT_ADHOC_REBATE"==e.taxHeadCode&&(g=e.adjustedAmount,w=e.amount),S+=e.adjustedAmount,R+=e.amount}),e={year:s,tax:d,firecess:m,cancercess:v,penalty:p,interest:f,usage_exemption:_,special_category_exemption:h,adhoc_penalty:y,adhoc_rebate:g,roundoff:c,total:a.Payments[0].paymentDetails[0].bill.billDetails[0].amountPaid},i={year:s,tax:b,firecess:A,cancercess:N,penalty:C,rebate:D,interest:T,usage_exemption:I,special_category_exemption:O,adhoc_penalty:M,adhoc_rebate:w,roundoff:P,total:a.Payments[0].paymentDetails[0].bill.billDetails[0].amount},l.push(e),o.push(i)}a.Payments[0].paymentDetails[0].additionalDetails={assessmentYears:r,arrearArray:l,taxArray:o}}i[0]=a.Payments[0];const c="PT.MUTATION"==e.Payments[0].paymentDetails[0].businessService?Promise.resolve(Digit.PaymentService.generatePdf(l,{Payments:i},"pt-receipt")).then(function(e){o=e}):Promise.resolve(Digit.PaymentService.generatePdf(l,{Payments:i},ie)).then(function(e){o=e});if(c&&c.then)return c.then(function(){})}}();return r&&r.then?r.then(n):n()}console.log("paymentpayment",e,e.Payments[0].paymentDetails[0].receiptNumber,e.Payments[0]);const n=Digit.ULBService.getCurrentTenantId(),l=Digit.ULBService.getStateId();let a,i=[];const o="PT.MUTATION"==e.Payments[0].paymentDetails[0].businessService?Promise.resolve(Digit.PaymentService.getReciept(n,"PT.MUTATION",{receiptNumbers:e.Payments[0].paymentDetails[0].receiptNumber})).then(function(e){a=e}):Promise.resolve(Digit.PaymentService.getReciept(n,"PT",{receiptNumbers:e.Payments[0].paymentDetails[0].receiptNumber})).then(function(e){a=e});return Promise.resolve(o&&o.then?o.then(t):t())}catch(e){return Promise.reject(e)}},Ae=["PT"].includes(W);return(window.location.href.includes("bpa")||window.location.href.includes("BPA"))&&X?l.createElement(t.Loader,null):l.createElement(t.Card,null,l.createElement(t.Banner,{svg:l.createElement("svg",{className:"payment-svg",xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none"},l.createElement("path",{d:"M20 0C8.96 0 0 8.96 0 20C0 31.04 8.96 40 20 40C31.04 40 40 31.04 40 20C40 8.96 31.04 0 20 0ZM16 30L6 20L8.82 17.18L16 24.34L31.18 9.16L34 12L16 30Z",fill:"white"})),message:B("CS_COMMON_PAYMENT_COMPLETE"),info:B("CS_COMMON_RECIEPT_NO"),applicationNumber:null==ue?void 0:ue.paymentDetails[0].receiptNumber,successful:!0}),l.createElement(t.CardText,null),l.createElement(t.StatusTable,null,l.createElement(t.Row,{rowContainerStyle:Pe,last:!0,label:B(J),text:re}),("PT"===W||U)&&l.createElement(t.Row,{rowContainerStyle:Pe,last:!0,label:B("CS_PAYMENT_BILLING_PERIOD"),text:(e=>{const{taxPeriodFrom:t,taxPeriodTo:n,fromPeriod:l,toPeriod:a}=e||{};return t&&n?"FY "+new Date(t).getFullYear().toString()+"-"+new Date(n).getFullYear().toString():l&&a?"mcollect"===U?new Date(l).getDate().toString()+" "+Digit.Utils.date.monthNames[new Date(l).getMonth()].toString()+" "+new Date(l).getFullYear().toString()+" - "+new Date(a).getDate()+" "+Digit.Utils.date.monthNames[new Date(a).getMonth()]+" "+new Date(a).getFullYear():"WNS"===U?new Date(l).getDate().toString()+"/"+(new Date(l).getMonth()+1).toString()+"/"+new Date(l).getFullYear().toString()+" - "+new Date(a).getDate()+"/"+(new Date(a).getMonth()+1)+"/"+new Date(a).getFullYear():"FY "+new Date(l).getFullYear().toString()+"-"+new Date(a).getFullYear().toString():"N/A"})(null==ue||null===(m=ue.paymentDetails[0])||void 0===m||null===(v=m.bill)||void 0===v?void 0:v.billDetails[0])}),("PT"===W||U)&&l.createElement(t.Row,{rowContainerStyle:Pe,last:!0,label:B("CS_PAYMENT_AMOUNT_PENDING"),text:(null==ue?void 0:ue.totalDue)-(null==ue?void 0:ue.totalAmountPaid)||null!=le&&null!==(p=le.paymentDetails)&&void 0!==p&&null!==(E=p[0])&&void 0!==E&&E.totalDue&&null!=le&&null!==(f=le.paymentDetails)&&void 0!==f&&null!==(_=f[0])&&void 0!==_&&_.totalAmountPaid?"₹ "+((null==le||null===(h=le.paymentDetails)||void 0===h||null===(y=h[0])||void 0===y?void 0:y.totalDue)-(null==le||null===(g=le.paymentDetails)||void 0===g||null===(S=g[0])||void 0===S?void 0:S.totalAmountPaid)):"₹ 0"}),l.createElement(t.Row,{rowContainerStyle:Pe,last:!0,label:B("CS_PAYMENT_TRANSANCTION_ID"),text:F}),l.createElement(t.Row,{rowContainerStyle:Pe,last:!0,label:B(Ae?"CS_PAYMENT_AMOUNT_PAID_WITHOUT_SYMBOL":"CS_PAYMENT_AMOUNT_PAID"),text:(null==ue?void 0:ue.totalAmountPaid)||(null!=le&&null!==(P=le.paymentDetails)&&void 0!==P&&null!==(b=P[0])&&void 0!==b&&b.totalAmountPaid?"₹ "+(null==le||null===(A=le.paymentDetails)||void 0===A||null===(N=A[0])||void 0===N?void 0:N.totalAmountPaid):"₹ 0")}),("PT"!==W||U)&&l.createElement(t.Row,{rowContainerStyle:Pe,last:!0,label:B("CS_PAYMENT_TRANSANCTION_DATE"),text:ce&&new Date(ce).toLocaleDateString("in")})),l.createElement("div",{style:{display:"flex"}},"TL"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:de},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("TL_RECEIPT")):null,"TL"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginTop:"15px"},onClick:function(){try{const e=q;return Promise.resolve(Digit.TLService.search({applicationNumber:G,tenantId:q})).then(function(t){const n=function(){if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{Licenses:null==t?void 0:t.Licenses},"tlcertificate")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("TL_CERTIFICATE")):null,"pet-services"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:de},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("PTR_FEE_RECEIPT")):null,"pet-services"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:function(){try{const e=q;return Promise.resolve(Digit.PTRService.search({tenantId:q,filters:{applicationNumber:G}})).then(function(t){const n=function(){var n;if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{PetRegistrationApplications:[null==t||null===(n=t.PetRegistrationApplications)||void 0===n?void 0:n[0]]},"petservicecertificate")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("PTR_CERTIFICATE")):null,"BPA_OC"!==(null==K||null===(C=K[0])||void 0===C?void 0:C.businessService)||"APPROVED"!==(null==K||null===(D=K[0])||void 0===D?void 0:D.status)&&"PENDING_SANC_FEE_PAYMENT"!==(null==K||null===(T=K[0])||void 0===T?void 0:T.status)?null:l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:e=>me("occupancy-certificate")},l.createElement(t.DownloadPrefixIcon,null),B("BPA_OC_CERTIFICATE")),"BPA_LOW"===(null==K||null===(I=K[0])||void 0===I?void 0:I.businessService)?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:e=>me("buildingpermit-low")},l.createElement(t.DownloadPrefixIcon,null),B("BPA_PERMIT_ORDER")):null,"BPA"!==(null==K||null===(O=K[0])||void 0===O?void 0:O.businessService)||"BPA_LOW"===(null==K||null===(M=K[0])||void 0===M?void 0:M.businessService)||"BPA_OC"===(null==K||null===(w=K[0])||void 0===w?void 0:w.businessService)||"PENDING_SANC_FEE_PAYMENT"!==(null==K||null===(R=K[0])||void 0===R?void 0:R.status)&&"APPROVED"!==(null==K||null===(x=K[0])||void 0===x?void 0:x.status)?null:l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:e=>me("buildingpermit")},l.createElement(t.DownloadPrefixIcon,null),B("BPA_PERMIT_ORDER"))),(null==W?void 0:W.includes("PT"))&&l.createElement("div",{style:{marginTop:"10px"}},l.createElement(i.Link,{to:"/digit-ui/citizen/feedback?redirectedFrom=digit-ui/citizen/payment/success&propertyId="+(G||"")+"&acknowldgementNumber="+(F||"")+"&tenantId="+q+"&creationReason="+(null==W||null===(k=W.split("."))||void 0===k?void 0:k[1])},l.createElement(t.SubmitBar,{label:B("CS_REVIEW_AND_FEEDBACK")}))),null!=W&&W.includes("PT")?l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"},onClick:de},B("CS_DOWNLOAD_RECEIPT")):null,null!=W&&W.includes("WS")?l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"},onClick:de},B("CS_DOWNLOAD_RECEIPT")):null,null!=W&&W.includes("SW")?l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"},onClick:de},B("CS_DOWNLOAD_RECEIPT")):null,null!=W&&W.includes("FSM")?l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"},onClick:de},B("CS_DOWNLOAD_RECEIPT")):null,null!=W&&W.includes("BPA")?l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"},onClick:de},B("CS_DOWNLOAD_RECEIPT")):null,"chb-services"==W?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"20px",marginRight:"20px",marginTop:"15px",marginBottom:"15px"}},l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.CHBServices.search({tenantId:q,filters:{bookingNo:G}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(q,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.hallsBookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.paymentReceiptFilestoreId;const i=function(){if(!a){let t={filestoreIds:[null==oe?void 0:oe.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(q,{Payments:[c({},ue)]},"chbservice-receipt")).then(function(n){var l;t=n;const i=c({},null==e?void 0:e.hallsBookingApplication[0],{paymentReceiptFilestoreId:null===(l=t)||void 0===l?void 0:l.filestoreIds[0]});return Promise.resolve(ee.mutateAsync({hallsBookingApplication:i})).then(function(){var e;a=null===(e=t)||void 0===e?void 0:e.filestoreIds[0]})})}}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("CHB_FEE_RECEIPT")),l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.CHBServices.search({tenantId:q,filters:{bookingNo:G}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(q,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.hallsBookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.permissionLetterFilestoreId;const i=function(){if(!a)return Promise.resolve(Digit.PaymentService.generatePdf(q,{hallsBookingApplication:[null==e?void 0:e.hallsBookingApplication[0]]},"chbpermissionletter")).then(function(t){const n=c({},null==e?void 0:e.hallsBookingApplication[0],{permissionLetterFilestoreId:null==t?void 0:t.filestoreIds[0]});return Promise.resolve(ee.mutateAsync({hallsBookingApplication:n})).then(function(){a=null==t?void 0:t.filestoreIds[0]})})}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("CHB_PERMISSION_LETTER"))):null,"adv-services"==W?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"20px",marginRight:"20px",marginTop:"15px",marginBottom:"15px"}},l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.ADSServices.search({tenantId:q,filters:{bookingNo:G}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(q,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.bookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.paymentReceiptFilestoreId;const i=function(){if(!a){let t={filestoreIds:[null==oe?void 0:oe.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(q,{Payments:[c({},ue)]},"advservice-receipt")).then(function(n){var l;t=n;const i=c({},null==e?void 0:e.bookingApplication[0],{paymentReceiptFilestoreId:null===(l=t)||void 0===l?void 0:l.filestoreIds[0]});return Promise.resolve(te.mutateAsync({bookingApplication:i})).then(function(){var e;a=null===(e=t)||void 0===e?void 0:e.filestoreIds[0]})})}}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("ADS_FEE_RECEIPT")),l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.ADSServices.search({tenantId:q,filters:{bookingNo:G}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(q,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.bookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.permissionLetterFilestoreId;const i=function(){if(!a)return Promise.resolve(Digit.PaymentService.generatePdf(q,{bookingApplication:[null==e?void 0:e.bookingApplication[0]]},"advpermissionletter")).then(function(t){const n=c({},null==e?void 0:e.bookingApplication[0],{permissionLetterFilestoreId:null==t?void 0:t.filestoreIds[0]});return Promise.resolve(te.mutateAsync({bookingApplication:n})).then(function(){a=null==t?void 0:t.filestoreIds[0]})})}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("ADS_PERMISSION_LETTER"))):null,"sv-services"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:de},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("SV_FEE_RECIEPT")):null,"sv-services"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:function(){try{const e=q;return Promise.resolve(Digit.SVService.search({tenantId:q,filters:{applicationNumber:G,isDraftApplication:!1}})).then(function(t){const n=function(){var n;if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{SVDetail:[null==t||null===(n=t.SVDetail)||void 0===n?void 0:n[0]]},"svcertificate")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("SV_CERTIFICATE")):null,"sv-services"==W?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:function(){try{const e=q;return Promise.resolve(Digit.SVService.search({tenantId:q,filters:{applicationNumber:G,isDraftApplication:!1}})).then(function(t){const n=function(){var n;if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{SVDetail:[null==t||null===(n=t.SVDetail)||void 0===n?void 0:n[0]]},"svidentitycard")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),B("SV_ID_CARD")):null,!("TL"==W)||!(null!=W&&W.includes("PT"))&&l.createElement(t.SubmitBar,{onSubmit:de,label:B("COMMON_DOWNLOAD_RECEIPT")}),!("TL"==W)||!(null!=W&&W.includes("PT"))&&l.createElement("div",{className:"link",style:se?{marginTop:"8px",width:"100%",textAlign:"center"}:{marginTop:"8px"}},l.createElement(i.Link,{to:"/digit-ui/citizen"},B("CORE_COMMON_GO_TO_HOME"))),"TL"==W&&l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CORE_COMMON_GO_TO_HOME")})),"pet-services"==W&&l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CORE_COMMON_GO_TO_HOME")})),"chb-services"==W&&l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CORE_COMMON_GO_TO_HOME")})),"adv-services"==W&&l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CORE_COMMON_GO_TO_HOME")})),"sv-services"==W&&l.createElement(i.Link,{to:"/digit-ui/citizen"},l.createElement(t.SubmitBar,{label:B("CORE_COMMON_GO_TO_HOME"),style:{marginTop:"15px"}})))},R=e=>{const{t:n}=a.useTranslation(),{consumerCode:o}=i.useParams();return l.createElement(t.Card,null,l.createElement(t.Banner,{message:"Failure !",complaintNumber:o,successful:!1}),l.createElement(t.CardText,null,n("ES_COMMON_TRACK_COMPLAINT_TEXT")))},x=e=>{let{stateCode:t,cityCode:n,moduleCode:a}=e;const{path:o}=i.useRouteMatch(),r={stateCode:t,cityCode:n,moduleCode:a};return l.createElement(l.Fragment,null,l.createElement("div",{className:"bills-citizen-wrapper"},l.createElement(i.Switch,null,l.createElement(i.Route,{path:o+"/my-bills/:businessService"},l.createElement(I,{stateCode:t})),l.createElement(i.Route,{path:o+"/billDetails/:businessService/:consumerCode/:paymentAmt"},l.createElement(f,c({},r,{stateCode:t,basePath:o}))),l.createElement(i.Route,{path:o+"/collect/:businessService/:consumerCode"},l.createElement(O,c({},r,{stateCode:t,basePath:o}))),l.createElement(i.Route,{path:o+"/success/:businessService/:consumerCode/:tenantId"},l.createElement(M,r)),l.createElement(i.Route,{path:o+"/failure"},l.createElement(R,r)))))},k=e=>{var i,o;let r=c({},(d(e),e));const{t:s}=a.useTranslation(),[u,m]=n.useState(null==r||null===(i=r.value)||void 0===i?void 0:i.manualReceiptDate),[v,p]=n.useState(null==r||null===(o=r.value)||void 0===o?void 0:o.manualReceiptNumber);return n.useEffect(()=>{if(r.onChange){let e={};u||(e.manualReceiptDate="ES_COMMON_MANUAL_RECEIPT_DATE"),v||(e.manualReceiptNumber="ES_COMMON_MANUAL_RECEIPT_NO"),r.onChange({manualReceiptNumber:v,manualReceiptDate:u,errorObj:e})}},[u,v]),l.createElement(l.Fragment,null,l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},s("NOC_PAYMENT_RCPT_NO_LABEL")),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:v,type:"text",name:"instrumentNumber",onChange:e=>p(e.target.value)})))),l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},s("NOC_PAYMENT_RECEIPT_ISSUE_DATE_LABEL")," "),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement(t.DatePicker,{date:u,onChange:e=>{m(e)}})))))},B=e=>{var t,i,o;let r=c({},(d(e),e));const{t:s}=a.useTranslation(),[u,m]=n.useState(null==r||null===(t=r.value)||void 0===t?void 0:t.last4Digits),[v,p]=n.useState(null==r||null===(i=r.value)||void 0===i?void 0:i.transactionNumber),[E,f]=n.useState(null==r||null===(o=r.value)||void 0===o?void 0:o.reTransanctionNumber);return n.useEffect(()=>{if(r.onChange){let e={};u||(e.last4Digits="ES_COMMON_LAST_4_DIGITS"),v||(e.transactionNumber="ES_COMMON_TRANSANCTION_NO"),E||(e.reTransanctionNumber="ES_COMMON_RE_TRANSANCTION_NO"),r.onChange({transactionNumber:v,reTransanctionNumber:E,instrumentNumber:u,errorObj:e})}},[u,v,E]),l.createElement(l.Fragment,null,l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},s("NOC_PAYMENT_CARD_LAST_DIGITS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:u,type:"text",name:"instrumentNumber",maxLength:"4",minLength:"4",required:!0,onChange:e=>m(e.target.value)})))),l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},s("NOC_PAYMENT_TRANS_NO_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:v,type:"text",name:"instrumentNumber",required:!0,onChange:e=>p(e.target.value)})))),l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},s("NOC_PAYMENT_RENTR_TRANS_LABEL")+" *"),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:E,type:"text",name:"instrumentNumber",required:!0,onChange:e=>f(e.target.value)})))))},H=e=>{var i;const{t:o}=a.useTranslation(),[r,s]=n.useState(e.chequeDetails.instrumentDate),[u,c]=n.useState(e.chequeDetails.instrumentNumber),[d,m]=n.useState(e.chequeDetails.ifscCode),[v,p]=n.useState(""),[E,f]=n.useState(e.chequeDetails.bankName),[_,h]=n.useState(null===(i=e.chequeDetails.bankBranch)||void 0===i?void 0:i.replace("┬á"," "));return n.useEffect(()=>{if(e.onChange){let t={};r||(t.instrumentDate="ES_COMMON_INSTRUMENT_DATE"),u||(t.instrumentNumber="ES_COMMON_INSTR_NUMBER"),d||(t.ifscCode="ES_COMMON_IFSC"),e.onChange({instrumentDate:r,instrumentNumber:u,ifscCode:d,bankName:E,bankBranch:_,errorObj:t,transactionNumber:u})}},[E,_,r,u]),l.createElement(l.Fragment,null,l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},o("PAYMENT_CHQ_NO_LABEL")," *"),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:u,type:"text",name:"instrumentNumber",onChange:e=>c(e.target.value),required:!0})))),l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},o("PAYMENT_CHEQUE_DATE_LABEL")," *"),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement(t.DatePicker,{isRequired:!0,date:r,onChange:e=>{s(e)}})))),l.createElement(l.Fragment,null,l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},o("PAYMENT_IFSC_CODE_LABEL")," *"),l.createElement("div",{className:"field"},l.createElement("div",null,l.createElement("div",{className:"cheque-date"},l.createElement("input",{value:d,type:"text",onChange:e=>{m(e.target.value),p("")},minlength:"11",maxlength:"11",required:!0}),l.createElement("button",{type:"button",onClick:function(){try{const e=A(function(){return Promise.resolve(window.fetch("https://ifsc.razorpay.com/"+d)).then(function(e){const t=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){let{BANK:t,BRANCH:n}=e;f(t),h(null==n?void 0:n.replace("┬á"," "))});p(o("CS_PAYMENT_INCORRECT_IFSC_CODE_ERROR"))}();if(t&&t.then)return t.then(function(){})})},function(){p(o("CS_PAYMENT_INCORRECT_IFSC_CODE_ERROR"))});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},l.createElement(t.SearchIconSvg,null)))))),v&&l.createElement(t.CardLabelError,{style:{width:"70%",marginLeft:"30%",fontSize:"12px",marginTop:"-21px"}},v),l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},o("PAYMENT_BANK_NAME_LABEL")),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:E,type:"text",className:"employee-card-input",readOnly:!0,disabled:!0})))),l.createElement("div",{className:"label-field-pair"},l.createElement("h2",{className:"card-label"},o("PAYMENT_BANK_BRANCH_LABEL")),l.createElement("div",{className:"field"},l.createElement("div",{className:"field-container"},l.createElement("input",{className:"employee-card-input",value:_,type:"text",className:"employee-card-input",readOnly:!0,disabled:!0}))))))};var F=function(e,t){return e===t||e!=e&&t!=t},U=function(e,t){for(var n=e.length;n--;)if(F(e[n][0],t))return n;return-1},j=Array.prototype.splice;function Y(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}Y.prototype.clear=function(){this.__data__=[],this.size=0},Y.prototype.delete=function(e){var t=this.__data__,n=U(t,e);return!(n<0||(n==t.length-1?t.pop():j.call(t,n,1),--this.size,0))},Y.prototype.get=function(e){var t=this.__data__,n=U(t,e);return n<0?void 0:t[n][1]},Y.prototype.has=function(e){return U(this.__data__,e)>-1},Y.prototype.set=function(e,t){var n=this.__data__,l=U(n,e);return l<0?(++this.size,n.push([e,t])):n[l][1]=t,this};var V=Y,z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function W(e,t){return e(t={exports:{}},t.exports),t.exports}var G,q="object"==typeof z&&z&&z.Object===Object&&z,K="object"==typeof self&&self&&self.Object===Object&&self,X=q||K||Function("return this")(),Q=X.Symbol,Z=Object.prototype,$=Z.hasOwnProperty,J=Z.toString,ee=Q?Q.toStringTag:void 0,te=Object.prototype.toString,ne=Q?Q.toStringTag:void 0,le=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ne&&ne in Object(e)?function(e){var t=$.call(e,ee),n=e[ee];try{e[ee]=void 0;var l=!0}catch(e){}var a=J.call(e);return l&&(t?e[ee]=n:delete e[ee]),a}(e):function(e){return te.call(e)}(e)},ae=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},ie=function(e){if(!ae(e))return!1;var t=le(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},oe=X["__core-js_shared__"],re=(G=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",se=Function.prototype.toString,ue=function(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ce=/^\[object .+?Constructor\]$/,de=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),me=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!ae(e)||(t=e,re&&re in t))&&(ie(e)?de:ce).test(ue(e));var t}(n)?n:void 0},ve=me(X,"Map"),pe=me(Object,"create"),Ee=Object.prototype.hasOwnProperty,fe=Object.prototype.hasOwnProperty;function _e(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}_e.prototype.clear=function(){this.__data__=pe?pe(null):{},this.size=0},_e.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},_e.prototype.get=function(e){var t=this.__data__;if(pe){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ee.call(t,e)?t[e]:void 0},_e.prototype.has=function(e){var t=this.__data__;return pe?void 0!==t[e]:fe.call(t,e)},_e.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=pe&&void 0===t?"__lodash_hash_undefined__":t,this};var he=_e,ye=function(e,t){var n,l,a=e.__data__;return("string"==(l=typeof(n=t))||"number"==l||"symbol"==l||"boolean"==l?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map};function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var l=e[t];this.set(l[0],l[1])}}ge.prototype.clear=function(){this.size=0,this.__data__={hash:new he,map:new(ve||V),string:new he}},ge.prototype.delete=function(e){var t=ye(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return ye(this,e).get(e)},ge.prototype.has=function(e){return ye(this,e).has(e)},ge.prototype.set=function(e,t){var n=ye(this,e),l=n.size;return n.set(e,t),this.size+=n.size==l?0:1,this};var Se=ge;function Pe(e){var t=this.__data__=new V(e);this.size=t.size}Pe.prototype.clear=function(){this.__data__=new V,this.size=0},Pe.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var n=this.__data__;if(n instanceof V){var l=n.__data__;if(!ve||l.length<199)return l.push([e,t]),this.size=++n.size,this;n=this.__data__=new Se(l)}return n.set(e,t),this.size=n.size,this};var be=Pe;function Ae(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Se;++t<n;)this.add(e[t])}Ae.prototype.add=Ae.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ae.prototype.has=function(e){return this.__data__.has(e)};var Ne=Ae,Ce=function(e,t){for(var n=-1,l=null==e?0:e.length;++n<l;)if(t(e[n],n,e))return!0;return!1},De=function(e,t,n,l,a,i){var o=1&n,r=e.length,s=t.length;if(r!=s&&!(o&&s>r))return!1;var u=i.get(e),c=i.get(t);if(u&&c)return u==t&&c==e;var d=-1,m=!0,v=2&n?new Ne:void 0;for(i.set(e,t),i.set(t,e);++d<r;){var p=e[d],E=t[d];if(l)var f=o?l(E,p,d,t,e,i):l(p,E,d,e,t,i);if(void 0!==f){if(f)continue;m=!1;break}if(v){if(!Ce(t,function(e,t){if(!v.has(t)&&(p===e||a(p,e,n,l,i)))return v.push(t)})){m=!1;break}}else if(p!==E&&!a(p,E,n,l,i)){m=!1;break}}return i.delete(e),i.delete(t),m},Te=X.Uint8Array,Ie=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,l){n[++t]=[l,e]}),n},Oe=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},Me=Q?Q.prototype:void 0,Le=Me?Me.valueOf:void 0,we=Array.isArray,Re=Object.prototype.propertyIsEnumerable,xe=Object.getOwnPropertySymbols,ke=xe?function(e){return null==e?[]:(e=Object(e),function(t,n){for(var l=-1,a=null==t?0:t.length,i=0,o=[];++l<a;){var r=t[l];Re.call(e,r)&&(o[i++]=r)}return o}(xe(e)))}:function(){return[]},Be=function(e){return null!=e&&"object"==typeof e},He=function(e){return Be(e)&&"[object Arguments]"==le(e)},Fe=Object.prototype,Ue=Fe.hasOwnProperty,je=Fe.propertyIsEnumerable,Ye=He(function(){return arguments}())?He:function(e){return Be(e)&&Ue.call(e,"callee")&&!je.call(e,"callee")},Ve=function(){return!1},ze=W(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n?X.Buffer:void 0;e.exports=(a?a.isBuffer:void 0)||Ve}),We=/^(?:0|[1-9]\d*)$/,Ge=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&We.test(e))&&e>-1&&e%1==0&&e<t},qe=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Ke={};Ke["[object Float32Array]"]=Ke["[object Float64Array]"]=Ke["[object Int8Array]"]=Ke["[object Int16Array]"]=Ke["[object Int32Array]"]=Ke["[object Uint8Array]"]=Ke["[object Uint8ClampedArray]"]=Ke["[object Uint16Array]"]=Ke["[object Uint32Array]"]=!0,Ke["[object Arguments]"]=Ke["[object Array]"]=Ke["[object ArrayBuffer]"]=Ke["[object Boolean]"]=Ke["[object DataView]"]=Ke["[object Date]"]=Ke["[object Error]"]=Ke["[object Function]"]=Ke["[object Map]"]=Ke["[object Number]"]=Ke["[object Object]"]=Ke["[object RegExp]"]=Ke["[object Set]"]=Ke["[object String]"]=Ke["[object WeakMap]"]=!1;var Xe,Qe=W(function(e,t){var n=t&&!t.nodeType&&t,l=n&&e&&!e.nodeType&&e,a=l&&l.exports===n&&q.process,i=function(){try{return l&&l.require&&l.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}),Ze=Qe&&Qe.isTypedArray,$e=Ze?(Xe=Ze,function(e){return Xe(e)}):function(e){return Be(e)&&qe(e.length)&&!!Ke[le(e)]},Je=Object.prototype.hasOwnProperty,et=Object.prototype,tt=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),nt=Object.prototype.hasOwnProperty,lt=function(e){return function(e,t,n){var l=function(e){return null!=(t=e)&&qe(t.length)&&!ie(t)?function(e,t){var n=we(e),l=!n&&Ye(e),a=!n&&!l&&ze(e),i=!n&&!l&&!a&&$e(e),o=n||l||a||i,r=o?function(e,t){for(var n=-1,l=Array(e);++n<e;)l[n]=t(n);return l}(e.length,String):[],s=r.length;for(var u in e)!Je.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ge(u,s))||r.push(u);return r}(e):function(e){if((t=e)!==("function"==typeof(n=t&&t.constructor)&&n.prototype||et))return tt(e);var t,n,l=[];for(var a in Object(e))nt.call(e,a)&&"constructor"!=a&&l.push(a);return l}(e);var t}(e);return we(e)?l:function(e,t){for(var n=-1,l=t.length,a=e.length;++n<l;)e[a+n]=t[n];return e}(l,n(e))}(e,0,ke)},at=Object.prototype.hasOwnProperty,it=me(X,"DataView"),ot=me(X,"Promise"),rt=me(X,"Set"),st=me(X,"WeakMap"),ut=ue(it),ct=ue(ve),dt=ue(ot),mt=ue(rt),vt=ue(st),pt=le;(it&&"[object DataView]"!=pt(new it(new ArrayBuffer(1)))||ve&&"[object Map]"!=pt(new ve)||ot&&"[object Promise]"!=pt(ot.resolve())||rt&&"[object Set]"!=pt(new rt)||st&&"[object WeakMap]"!=pt(new st))&&(pt=function(e){var t=le(e),n="[object Object]"==t?e.constructor:void 0,l=n?ue(n):"";if(l)switch(l){case ut:return"[object DataView]";case ct:return"[object Map]";case dt:return"[object Promise]";case mt:return"[object Set]";case vt:return"[object WeakMap]"}return t});var Et=pt,ft=Object.prototype.hasOwnProperty;const _t=(e,t)=>({PT:[{head:t("ES_BILL_DETAILS_PT_DETAILS_HEADING"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"PT",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],mcollect:[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:e.businessService,consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],"PT.MUTATION":[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:e.businessService,consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],TL:[{body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"TL",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],WS:[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"WS",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],"WS.ONE_TIME_FEE":[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"WS.ONE_TIME_FEE",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],"SW.ONE_TIME_FEE":[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"SW.ONE_TIME_FEE",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],WSReconnection:[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"WSReconnection",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],SWReconnection:[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"SWReconnection",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],SW:[{head:t("COMMON_PAY_SCREEN_HEADER"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:"SW",consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}],FSM:[{head:t("ES_TITLE_PAYMENT_DETAILS"),body:[{withoutLabel:!0,type:"custom",populators:{name:"amount",customProps:{businessService:e.businessService,consumerCode:e.consumerCode},component:(e,t)=>l.createElement(ht,c({onChange:e.onChange,amount:e.value},t))}}]}]}),ht=e=>{var i,o,r,s,u,d,m;let{businessService:v,consumerCode:p,onChange:E}=e;const{t:f}=a.useTranslation(),{workflow:_,IsDisconnectionFlow:h}=Digit.Hooks.useQueryParams(),y=Digit.ULBService.getCurrentTenantId(),{data:g,isLoading:S}=Digit.Hooks.useFetchPayment({tenantId:y,businessService:v,consumerCode:p}),P=window.location.href.includes("FSM"),{data:b}=Digit.Hooks.fsm.useSearch(y,{applicationNos:p},{staleTime:Infinity,enabled:!(null==v||null===(i=v.toUpperCase())||void 0===i||!i.includes("FSM"))}),[A,N]=n.useState(),[C,D]=n.useState(!0),{data:T}=Digit.Hooks.fsm.useApplicationDetail(f,y,p,{enabled:!!P},"EMPLOYEE"),I=null==A||null===(o=A.billDetails)||void 0===o?void 0:o.sort((e,t)=>t.fromPeriod-e.fromPeriod),O=(null==I?void 0:I[0])||[],M=()=>null!=A&&A.totalAmount?null==A?void 0:A.totalAmount:0,L=()=>null!=b&&b.advanceAmount?null==b?void 0:b.advanceAmount:0,w=(null==A||null===(r=A.billDetails)||void 0===r||null===(s=r.sort((e,t)=>t.fromPeriod-e.fromPeriod))||void 0===s?void 0:s.reduce((e,t,n)=>0===n?e:e+t.amount,0))||0,{isLoading:R,data:x}=Digit.Hooks.useGetPaymentRulesForBusinessServices(y),[k,B]=n.useState();n.useEffect(()=>{var e,t;const n=null==x||null===(e=x.MdmsRes)||void 0===e||null===(t=e.BillingService)||void 0===t?void 0:t.BusinessService;B(null!=n&&n.length?h?c({},n.filter(e=>e.code==v)[0],{partPaymentAllowed:!1}):n.filter(e=>e.code==v)[0]:{})},[x]);const{minAmountPayable:H,isAdvanceAllowed:F}=k||{},[U,j]=n.useState(f("CS_PAYMENT_FULL_AMOUNT")),[Y,V]=n.useState(M()),[z,W]=n.useState(!0),[G,q]=n.useState(""),K=e=>{V(e)};n.useEffect(()=>{"mcollect"===_&&(null==O?void 0:O.billAccountDetails)&&(null==O||O.billAccountDetails.map(e=>{e.taxHeadCode.includes("CGST")?e.order=3:e.taxHeadCode.includes("SGST")&&(e.order=4)}))},[null==O?void 0:O.billAccountDetails]),n.useEffect(()=>{let e=H&&Y>=H&&Y<=M()&&!G;("WS"===v||"SW"===v)&&Y>M()&&F&&(e=H&&Y>=H&&!G),U!=f("CS_PAYMENT_FULL_AMOUNT")?W(e):W(!0)},[U,Y]),n.useEffect(()=>{if(!A&&g){let e=g.Bill.filter(e=>e.consumerCode==p)[0];N(e)}},[g]),n.useEffect(()=>{U!==f("CS_PAYMENT_FULL_AMOUNT")?X(Y.toString()):(q(""),K(M()))},[U,A]),n.useEffect(()=>{U!==f("CS_PAYMENT_FULL_AMOUNT")?E({amount:Y,paymentAllowed:z,error:G,minAmountPayable:H}):E({amount:M(),paymentAllowed:!0,error:G,minAmountPayable:H})},[z,G,Y,U]);const X=e=>{q(""),isNaN(e)||e.includes(".")?q("AMOUNT_INVALID"):!F&&e>M()?q("CS_ADVANCED_PAYMENT_NOT_ALLOWED"):e<H&&q("CS_CANT_PAY_BELOW_MIN_AMOUNT"),K(e)};if(S||R)return l.createElement(t.Loader,null);const Q={textAlign:"left",borderBottom:"#D6D5D4 1px solid",padding:"16px 12px",whiteSpace:"break-spaces"},Z={textAlign:"left",borderBottom:"#D6D5D4 1px solid",padding:"8px 10px",breakWord:"no-break"},$={PT:{heading:"ES_BILL_DETAILS_PT_DETAILS_HEADING",details:[{keyValue:"PT_PROPERTY_ID",keyPath:["consumerCode"],fallback:""},{keyValue:"CS_PAYMENT_BILLING_PERIOD",keyPath:["billDetails",e=>{const{fromPeriod:t,toPeriod:n}=e[0];return t&&n?"FY "+new Date(t).getFullYear().toString()+"-"+new Date(n).getFullYear().toString():"N/A"}],fallback:"N/A"},{keyValue:"CS_BILL_NO",keyPath:["billDetails",e=>{const{currentBillNo:t}=e[0];return t||"N/A"}],fallback:"N/A"},{keyValue:"CS_BILL_DUEDATE",keyPath:["billDetails",e=>{const{currentExpiryDate:t}=e[0];return t?new Date(t).toLocaleDateString():"N/A"}],fallback:"N/A"}]},mcollect:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"UC_CHALLAN_NO",keyPath:["consumerCode"],fallback:""}]},"PT.MUTATION":{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"PDF_STATIC_LABEL_MUATATION_NUMBER_LABEL",keyPath:["consumerCode"],fallback:""},{keyValue:"CS_BILL_NO",keyPath:["billDetails",e=>{const{currentBillNo:t}=e[0];return t||"N/A"}],fallback:"N/A"},{keyValue:"CS_BILL_DUEDATE",keyPath:["billDetails",e=>{const{currentExpiryDate:t}=e[0];return t?new Date(t).toLocaleDateString():"N/A"}],fallback:"N/A"}]},TL:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"TL_TRADE_LICENSE_LABEL",keyPath:["consumerCode"],fallback:""}]},"WS.ONE_TIME_FEE":{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"WS_COMMON_TABLE_APP_NO_LABEL",keyPath:["consumerCode"],fallback:""}]},"SW.ONE_TIME_FEE":{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"WS_COMMON_TABLE_APP_NO_LABEL",keyPath:["consumerCode"],fallback:""}]},WSReconnection:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"WS_COMMON_TABLE_APP_NO_LABEL",keyPath:["consumerCode"],fallback:""}]},SWReconnection:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"WS_COMMON_TABLE_APP_NO_LABEL",keyPath:["consumerCode"],fallback:""}]},WS:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL",keyPath:["consumerCode"],fallback:""},{keyValue:"CS_PAYMENT_BILLING_PERIOD",keyPath:["billDetails",e=>{const{fromPeriod:t,toPeriod:n}=e[0];return t&&n?new Date(t).toLocaleDateString()+" - "+new Date(n).toLocaleDateString():"N/A"}],fallback:"N/A"},{keyValue:"CS_BILL_NO",keyPath:["billNumber"],fallback:"N/A"},{keyValue:"CS_BILL_DUEDATE",keyPath:["billDetails",e=>{const{currentExpiryDate:t}=e[0];return t?new Date(t).toLocaleDateString():"N/A"}],fallback:"N/A"}]},SW:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"WS_COMMON_TABLE_COL_CONSUMER_NO_LABEL",keyPath:["consumerCode"],fallback:""},{keyValue:"CS_PAYMENT_BILLING_PERIOD",keyPath:["billDetails",e=>{const{fromPeriod:t,toPeriod:n}=e[0];return t&&n?new Date(t).toLocaleDateString()+" - "+new Date(n).toLocaleDateString():"N/A"}],fallback:"N/A"},{keyValue:"CS_BILL_NO",keyPath:["billNumber"],fallback:"N/A"},{keyValue:"CS_BILL_DUEDATE",keyPath:["billDetails",e=>{const{expiryDate:t}=e[0];return t?new Date(t).toLocaleDateString():"N/A"}],fallback:"N/A"}]},FSM:{heading:"COMMON_PAY_SCREEN_HEADER",details:[{keyValue:"ADV_TOTAL_AMOUNT",keyPath:["totalAmount"],fallback:""},{keyValue:"ADV_COLLECTION",keyPath:["totalAmountPaid"],fallback:"N/A"}]}}[_||v],J="DSO_INPROGRESS"===(null==b?void 0:b.applicationStatus);return console.log(A,"bill"),l.createElement(l.Fragment,null,l.createElement(t.StatusTable,null,!P&&A&&$.details.map((e,n)=>{const a=e.keyPath.reduce((e,t)=>"function"==typeof t?t(e):e[t],A);return l.createElement(t.Row,{key:n+"bill",label:f(e.keyValue),text:a})})),P?l.createElement(t.StatusTable,null,l.createElement(t.Row,{label:f("ES_PAYMENT_DETAILS_AMOUNT_PER_TRIP"),textStyle:{textAlign:"left"},text:"₹ "+Number(null!=T&&null!==(ie=T.additionalDetails)&&void 0!==ie&&ie.tripAmount?null==T||null===(oe=T.additionalDetails)||void 0===oe?void 0:oe.tripAmount:0).toFixed(2)}),l.createElement(t.Row,{label:f("ES_PAYMENT_DETAILS_TOTAL_AMOUNT"),textStyle:{textAlign:"left"},text:null!=b&&b.paymentPreference?"₹ "+Number(null==A?void 0:A.totalAmount).toFixed(2):"₹ "+Number(null!=T&&T.totalAmount?null==T?void 0:T.totalAmount:0).toFixed(2)}),!(null!=b&&b.paymentPreference)&&l.createElement(t.Row,J?{label:f("ES_PAYMENT_DETAILS_ADV_AMOUNT_PAID"),textStyle:{fontWeight:"bold",textAlign:"left"},text:"₹ "+Number(L()).toFixed(2)}:{label:f("ES_PAYMENT_DETAILS_ADV_AMOUNT_DUE"),textStyle:{fontWeight:"bold",textAlign:"left"},text:"₹ "+Number(L()).toFixed(2)}),"PENDING_APPL_FEE_PAYMENT"!==(null==b?void 0:b.applicationStatus)||"PENDING_APPL_FEE_PAYMENT_CITIZEN"!==(null==b?void 0:b.applicationStatus)?l.createElement(t.Row,{label:f("FSM_DUE_AMOUNT_TO_BE_PAID"),textStyle:{fontWeight:"bold",textAlign:"left"},text:"₹ "+Number("FSM.TRIP_CHARGES"===(null==A?void 0:A.businessService)?null==A?void 0:A.totalAmount:null!=A&&A.totalAmount?(null==A?void 0:A.totalAmount)-(null==b?void 0:b.advanceAmount):0).toFixed(2)}):null):l.createElement(t.StatusTable,{style:{paddingTop:"46px"}},l.createElement(t.Row,{label:f("ES_PAYMENT_TAXHEADS"),textStyle:{fontWeight:"bold"},text:f("ES_PAYMENT_AMOUNT")}),l.createElement("hr",{style:{width:"40%"},className:"underline"}),null==O||null===(u=O.billAccountDetails)||void 0===u?void 0:u.sort((e,t)=>e.order-t.order).map((e,n)=>{var a;return l.createElement(t.Row,{key:n+"taxheads",labelStyle:{fontWeight:"normal"},textStyle:{textAlign:"right",maxWidth:"100px"},label:f(e.taxHeadCode),text:"₹ "+(null===(a=e.amount)||void 0===a?void 0:a.toFixed(2))})}),null!=w&&null!==(d=w.toFixed)&&void 0!==d&&d.call(w,2)?l.createElement(t.Row,{labelStyle:{fontWeight:"normal"},textStyle:{textAlign:"right",maxWidth:"100px"},label:f("COMMON_ARREARS"),text:"₹ "+(null==w||null===(m=w.toFixed)||void 0===m?void 0:m.call(w,2))||Number(0).toFixed(2)}):null,l.createElement("hr",{style:{width:"40%"},className:"underline"}),l.createElement(t.Row,{label:f("CS_PAYMENT_TOTAL_AMOUNT"),textStyle:{fontWeight:"bold",textAlign:"right",maxWidth:"100px"},text:"₹ "+Number(M()).toFixed(2)}),!C&&!_&&"TL"!==v&&(null==I?void 0:I.length)>1&&l.createElement(n.Fragment,null,l.createElement("div",{className:"row last"},l.createElement("div",{style:{maxWidth:"100px"},onClick:()=>D(!0),className:"filter-button value"},f("ES_COMMON_VIEW_DETAILS"))))),C&&(null==I?void 0:I.length)>1&&!_&&"TL"!==v&&l.createElement(l.Fragment,null,l.createElement("div",{style:{maxWidth:"95%",display:"inline-block",textAlign:"right"}},l.createElement("div",{style:{display:"flex",padding:"10px",paddingLeft:"unset",maxWidth:"95%"}},l.createElement("div",{style:{backgroundColor:"#EEEEEE",overflowX:"auto"}},l.createElement("table",{className:"table-fixed-column-common-pay"},l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",{style:Q},f("CS_BILL_NO")),l.createElement("th",{style:c({},Q)},f("CS_PAYMENT_BILLING_PERIOD")),l.createElement("th",{style:c({},Q)},f("CS_BILL_DUEDATE")),null==I||null===(ee=I.filter((e,t)=>t>0))||void 0===ee||null===(te=ee[0])||void 0===te||null===(ne=te.billAccountDetails)||void 0===ne||null===(le=ne.sort((e,t)=>e.order-t.order))||void 0===le?void 0:le.map((e,t)=>l.createElement("th",{style:c({},Q),key:t},f(e.taxHeadCode))),l.createElement("th",{style:Q},f("TOTAL_TAX")))),l.createElement("tbody",null,null==I||null===(ae=I.filter((e,t)=>t>0))||void 0===ae?void 0:ae.map((e,t)=>{var n;const a=null==e||null===(n=e.billAccountDetails)||void 0===n?void 0:n.sort((e,t)=>e.order-t.order);return l.createElement("tr",{key:t},l.createElement("td",{style:Z},null==e?void 0:e.billNumber),l.createElement("td",{style:Z},(e=>{const{fromPeriod:t,toPeriod:n}=e;return new Date(t).toLocaleDateString()+"-"+new Date(n).toLocaleDateString()})(e)),l.createElement("td",{style:Z},(null==e?void 0:e.expiryDate)&&new Date(null==e?void 0:e.expiryDate).toLocaleDateString()),a.map((e,t)=>l.createElement("td",{style:Z,key:t},e.amount)),l.createElement("td",{style:Z},e.amount))}))))),l.createElement("div",{style:{float:"left"},onClick:()=>D(!1),className:"filter-button"},f("ES_COMMON_HIDE_DETAILS")))),!P&&(null==k?void 0:k.partPaymentAllowed)&&l.createElement("div",{style:{marginTop:"50px"},className:"bill-payment-amount"},l.createElement(t.CardSectionHeader,null,f("CS_COMMON_PAYMENT_AMOUNT")),l.createElement(t.RadioButtons,{style:{display:"flex"},innerStyles:{padding:"5px"},selectedOption:U,onSelect:j,options:k.partPaymentAllowed?[f("CS_PAYMENT_FULL_AMOUNT"),f("CS_PAYMENT_CUSTOM_AMOUNT")]:[f("CS_PAYMENT_FULL_AMOUNT")]}),l.createElement("div",{style:{position:"relative"}},l.createElement("span",{className:"payment-amount-front",style:{border:"1px solid "+(U===f("CS_PAYMENT_FULL_AMOUNT")?"#9a9a9a":"black")}},"₹"),U!==f("CS_PAYMENT_FULL_AMOUNT")?l.createElement(t.TextInput,{style:{width:"30%"},className:"text-indent-xl",onChange:e=>X(e.target.value),value:Y,disable:!1}):l.createElement(t.TextInput,{style:{width:"30%"},className:"text-indent-xl",value:M(),disable:!0}),"CS_CANT_PAY_BELOW_MIN_AMOUNT"===G?l.createElement("span",{className:"card-label-error"},f(G),": ","₹"+H):l.createElement("span",{className:"card-label-error"},f(G)))));var ee,te,ne,le,ae,ie,oe},yt=["ManualRecieptDetails","paymentModeDetails"],gt=["errorObj"],St=e=>{var o;const{workflow:r,IsDisconnectionFlow:u}=Digit.Hooks.useQueryParams(),{t:d}=a.useTranslation(),v=i.useHistory(),E=s.useQueryClient(),{state:f,search:_}=i.useLocation();i.useRouteMatch();let{consumerCode:h,businessService:y}=i.useParams();const g=Digit.ULBService.getCurrentTenantId(),[S,P]=n.useState(0);window.location.href.includes("ISWSAPP")&&(h=new URLSearchParams(_).get("applicationNumber")),(window.location.href.includes("ISWSCON")||"WS"===r)&&(h=decodeURIComponent(h));const{data:b,isLoading:C}=Digit.Hooks.useFetchPayment({tenantId:g,consumerCode:h,businessService:y}),D=null!=b&&b.Bill?null==b?void 0:b.Bill[0]:{},{data:T}=Digit.Hooks.fsm.useSearch(g,{applicationNos:h},{staleTime:Infinity,enabled:!(null==y||null===(o=y.toUpperCase())||void 0===o||!o.includes("FSM"))}),I=null==T?void 0:T.advanceAmount,{cardConfig:O}=((e,t)=>({cardConfig:[{head:t("PAYMENT_CARD_HEAD"),headId:"paymentInfo",body:[{withoutLabel:!0,type:"custom",populators:{name:"paymentModeDetails",customProps:{},defaultValue:{},component:(e,t)=>l.createElement(B,c({onChange:e.onChange,value:e.value},t))}}]}]}))(0,d),{chequeConfig:M}=((e,t)=>({chequeConfig:[{head:t("PAYMENT_CHEQUE_HEAD"),headId:"paymentInfo",body:[{withoutLabel:!0,type:"custom",populators:{name:"paymentModeDetails",customProps:{},defaultValue:{instrumentNumber:"",instrumentDate:"",ifscCode:"",bankName:"",bankBranch:""},component:(e,t)=>l.createElement(H,c({onChange:e.onChange,chequeDetails:e.value},t))}}]}]}))(0,d),{cashConfig:L}=((e,t)=>({cashConfig:[{head:t("NOC_PAYMENT_RCPT_DETAILS"),headId:"paymentInfo",body:[{withoutLabel:!0,type:"custom",populators:{name:"ManualRecieptDetails",customProps:{},defaultValue:{manualReceiptNumber:"",manualReceiptDate:""},component:(e,t)=>l.createElement(k,c({},t,{onChange:e.onChange,value:e.value}))}}]}]}))(0,d),[w,R]=n.useState({}),[x,U]=n.useState(null);n.useEffect(()=>{null!=b&&b.Bill&&0===b.Bill.length&&U({key:"error",action:"CS_BILL_NOT_FOUND"})},[b]);const j=[{code:"CASH",label:d("COMMON_MASTERS_PAYMENTMODE_CASH")},{code:"CHEQUE",label:d("COMMON_MASTERS_PAYMENTMODE_CHEQUE")},{code:"CARD",label:d("COMMON_MASTERS_PAYMENTMODE_CREDIT/DEBIT CARD")}],Y={CHEQUE:M,CARD:O};n.useEffect(()=>{e.setLink(d("PAYMENT_COLLECT_LABEL"))},[]);const V=()=>j,z=[{code:"OWNER",name:d("COMMON_OWNER")},{code:"OTHER",name:d("COMMON_OTHER")}],[W,G]=n.useState((null==w?void 0:w.selectedPaymentMode)||V()[0]),[q,K]=n.useState((null==w?void 0:w.paidBy)||{code:"OWNER",name:d("COMMON_OWNER")});n.useEffect(()=>{var e,t,n,l;null===(e=document)||void 0===e||null===(t=e.getElementById("paymentInfo"))||void 0===t||t.scrollIntoView({behavior:"smooth"}),null===(n=document)||void 0===n||null===(l=n.querySelector("#paymentInfo + .label-field-pair input"))||void 0===l||l.focus()},[W]);let X=[{head:r||"TL"===y?"":d("COMMON_PAYMENT_HEAD"),body:[{label:d("PAY_TOTAL_AMOUNT"),populators:l.createElement(t.CardSectionHeader,{style:{marginBottom:0,textAlign:"right"}}," ","₹ "+(null==D?void 0:D.totalAmount)," ")}]},{head:d("PAYMENT_PAID_BY_HEAD"),body:[{label:d("PAYMENT_PAID_BY_LABEL"),isMandatory:!0,type:"custom",populators:{name:"paidBy",customProps:{t:d,isMendatory:!0,option:z,optionKey:"name"},component:(e,n)=>l.createElement(t.Dropdown,c({},n,{selected:e.value,select:t=>{t.name==z[0].name?e.setValue("payerName",null==D?void 0:D.payerName):(e.setValue("payerName",""),e.setValue("payerMobile","")),e.onChange(t),K(t)}})),defaultValue:(null==w?void 0:w.paidBy)||z[0]}},{label:d("PAYMENT_PAYER_NAME_LABEL"),isMandatory:!0,disable:!("OWNER"!==(null==q?void 0:q.code)||!(null!=D&&D.payerName||null!=w&&w.payerName)),type:"text",populators:{name:"payerName",validation:{required:!0,pattern:/^[A-Za-z]/},error:d("PAYMENT_INVALID_NAME"),defaultValue:(null==D?void 0:D.payerName)||(null==w?void 0:w.payerName)||"",className:"payment-form-text-input-correction"}},{label:d("PAYMENT_PAYER_MOB_LABEL"),isMandatory:!0,type:"text",populators:{name:"payerMobile",validation:{required:!0,pattern:/^[6-9]\d{9}$/},error:d("CORE_COMMON_APPLICANT_MOBILE_NUMBER_INVALID"),className:"payment-form-text-input-correction"}}]},{head:d("PAYMENT_MODE_HEAD"),body:[{label:d("PAYMENT_MODE_LABEL"),type:"custom",populators:{name:"paymentMode",customProps:{options:V(),optionsKey:"label",style:{display:"flex",flexWrap:"wrap"},innerStyles:{minWidth:"33%"}},defaultValue:(null==w?void 0:w.paymentMode)||V()[0],component:(e,n)=>l.createElement(t.RadioButtons,c({selectedOption:e.value,onSelect:t=>{e.onChange(t)}},n))}}]}];const Q=window.location.href.includes("FSM");return C?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,l.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l.createElement(t.Header,{styles:{marginLeft:"15px"}},d(Q?"PAYMENT_COLLECT_LABEL":"PAYMENT_COLLECT")),p(y)&&l.createElement(t.Header,{styles:{marginRight:"15px"}},l.createElement(N,{businessService:y,setTime:P,timerValues:null==f?void 0:f.timerValue,t:d,SlotSearchData:null==f?void 0:f.SlotSearchData}))),l.createElement(t.FormComposer,{cardStyle:{paddingBottom:"100px"},label:d("PAYMENT_COLLECT_LABEL"),config:(()=>{var e,t;(_t({consumerCode:h,businessService:y},d)[r?"SW"===y&&"WS"===r?y:r:y]||r||"TL"===y||y.includes("ONE_TIME_FEE"))&&X.splice(0,1);let n=X.concat(Y[null==w||null===(e=w.paymentMode)||void 0===e?void 0:e.code]||[]);return n=null===(t=n)||void 0===t?void 0:t.concat(L),_t({consumerCode:h,businessService:y},d)[r?"SW"===y&&"WS"===r?y:r:y]?_t({consumerCode:h,businessService:y},d)[r?"SW"===y&&"WS"===r?y:r:y].concat(n):n})(),onSubmit:function(t){try{var n,l,a,i,o,s,p,f,_,S;if(D.totalAmount=Math.round(D.totalAmount),t.paidBy=t.paidBy.code,_t({consumerCode:h,businessService:y},d)[r?"SW"===y&&"WS"===r?y:r:y]&&(null==t||null===(n=t.amount)||void 0===n||!n.paymentAllowed)){var P,b,N,C;let e="CS_CANT_PAY_BELOW_MIN_AMOUNT"===(null==t||null===(P=t.amount)||void 0===P?void 0:P.error)?d(null==t||null===(b=t.amount)||void 0===b?void 0:b.error)+"- "+(null==t||null===(N=t.amount)||void 0===N?void 0:N.minAmountPayable):d(null==t||null===(C=t.amount)||void 0===C?void 0:C.error);return U({key:"error",action:e}),Promise.resolve()}const{ManualRecieptDetails:M,paymentModeDetails:L}=t,w=(m(t,yt),m(L||{},gt));let R={Payment:{mobileNumber:t.payerMobile,paymentDetails:[{businessService:y,billId:D.id,totalDue:D.totalAmount,totalAmountPaid:(null==t||null===(l=t.amount)||void 0===l?void 0:l.amount)||D.totalAmount}],tenantId:D.tenantId,totalDue:D.totalAmount,totalAmountPaid:(null==t||null===(a=t.amount)||void 0===a?void 0:a.amount)||D.totalAmount,paymentMode:t.paymentMode.code,payerName:t.payerName,paidBy:t.paidBy}};if(null===I||"PENDING_APPL_FEE_PAYMENT"!==(null==T?void 0:T.applicationStatus)&&"PENDING_APPL_FEE_PAYMENT_CITIZEN"!==(null==T?void 0:T.applicationStatus)||T.paymentPreference||(R.Payment.paymentDetails[0].totalAmountPaid=I,R.Payment.totalAmountPaid=I,R.Payment.totalDue=D.totalAmount),t.ManualRecieptDetails.manualReceiptDate&&(R.Payment.paymentDetails[0].manualReceiptDate=new Date(M.manualReceiptDate).getTime()),t.ManualRecieptDetails.manualReceiptNumber&&(R.Payment.paymentDetails[0].manualReceiptNumber=M.manualReceiptNumber),R.Payment.paymentMode=null==t||null===(i=t.paymentMode)||void 0===i?void 0:i.code,t.paymentModeDetails){var O;if(R.Payment=c({},R.Payment,w),delete R.Payment.paymentModeDetails,t.paymentModeDetails.errorObj){const e=t.paymentModeDetails.errorObj,n=Object.keys(e).map(t=>d(e[t])).join();if(n)return U({key:"error",action:n+" "+d("ES_ERROR_REQUIRED")}),setTimeout(()=>U(null),5e3),Promise.resolve()}t.errorMsg&&U({key:"error",action:d(errorMsg)}),R.Payment.instrumentDate=new Date(null==R||null===(O=R.Payment)||void 0===O?void 0:O.instrumentDate).getTime(),R.Payment.transactionNumber=t.paymentModeDetails.transactionNumber}if(null!=t&&null!==(o=t.paymentModeDetails)&&void 0!==o&&o.transactionNumber){if(t.paymentModeDetails.transactionNumber!==t.paymentModeDetails.reTransanctionNumber&&["CARD"].includes(t.paymentMode.code))return U({key:"error",action:d("ERR_TRASACTION_NUMBERS_DONT_MATCH")}),setTimeout(()=>U(null),5e3),Promise.resolve();delete R.Payment.last4Digits,delete R.Payment.reTransanctionNumber}if(null!==(s=R.Payment)&&void 0!==s&&null!==(p=s.instrumentNumber)&&void 0!==p&&p.length&&(null===(f=R.Payment)||void 0===f||null===(_=f.instrumentNumber)||void 0===_?void 0:_.length)<6&&"CHEQUE"===(null==R||null===(S=R.Payment)||void 0===S?void 0:S.paymentMode))return U({key:"error",action:d("ERR_CHEQUE_NUMBER_LESS_THAN_6")}),setTimeout(()=>U(null),5e3),Promise.resolve();const x=A(function(){return Promise.resolve(Digit.PaymentService.createReciept(g,R)).then(function(t){var n,l,a,i,o,r,s,c,d,m;E.invalidateQueries(),v.push(u?e.basePath+"/success/"+y+"/"+(null==t||null===(n=t.Payments[0])||void 0===n||null===(l=n.paymentDetails[0])||void 0===l?void 0:l.receiptNumber.replace(/\//g,"%2F"))+"/"+(null==t||null===(a=t.Payments[0])||void 0===a||null===(i=a.paymentDetails[0])||void 0===i||null===(o=i.bill)||void 0===o?void 0:o.consumerCode)+"?IsDisconnectionFlow="+u:e.basePath+"/success/"+y+"/"+(null==t||null===(r=t.Payments[0])||void 0===r||null===(s=r.paymentDetails[0])||void 0===s?void 0:s.receiptNumber.replace(/\//g,"%2F"))+"/"+(null==t||null===(c=t.Payments[0])||void 0===c||null===(d=c.paymentDetails[0])||void 0===d||null===(m=d.bill)||void 0===m?void 0:m.consumerCode)+"?IsDisconnectionFlow="+u)})},function(e){var t,n,l,a;null===(t=U({key:"error",action:null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||null===(a=l.Errors)||void 0===a?void 0:a.map(e=>d(e.code))}))||void 0===t||t.join(" , "),setTimeout(()=>U(null),5e3)});return Promise.resolve(x&&x.then?x.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},formState:w,defaultValues:{payerName:(null==D?void 0:D.payerName)||(null==w?void 0:w.payerName)||""},isDisabled:p(y)&&0===S,onFormValueChange:(e,t)=>{(function e(t,n,l,a,i){return t===n||(null==t||null==n||!Be(t)&&!Be(n)?t!=t&&n!=n:function(e,t,n,l,a,i){var o=we(e),r=we(t),s=o?"[object Array]":Et(e),u=r?"[object Array]":Et(t),c="[object Object]"==(s="[object Arguments]"==s?"[object Object]":s),d="[object Object]"==(u="[object Arguments]"==u?"[object Object]":u),m=s==u;if(m&&ze(e)){if(!ze(t))return!1;o=!0,c=!1}if(m&&!c)return i||(i=new be),o||$e(e)?De(e,t,n,l,a,i):function(e,t,n,l,a,i,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Te(e),new Te(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return F(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var r=Ie;case"[object Set]":if(r||(r=Oe),e.size!=t.size&&!(1&l))return!1;var s=o.get(e);if(s)return s==t;l|=2,o.set(e,t);var u=De(r(e),r(t),l,a,i,o);return o.delete(e),u;case"[object Symbol]":if(Le)return Le.call(e)==Le.call(t)}return!1}(e,t,s,n,l,a,i);if(!(1&n)){var v=c&&ft.call(e,"__wrapped__"),p=d&&ft.call(t,"__wrapped__");if(v||p){var E=v?e.value():e,f=p?t.value():t;return i||(i=new be),a(E,f,n,l,i)}}return!!m&&(i||(i=new be),function(e,t,n,l,a,i){var o=1&n,r=lt(e),s=r.length;if(s!=lt(t).length&&!o)return!1;for(var u=s;u--;){var c=r[u];if(!(o?c in t:at.call(t,c)))return!1}var d=i.get(e),m=i.get(t);if(d&&m)return d==t&&m==e;var v=!0;i.set(e,t),i.set(t,e);for(var p=o;++u<s;){var E=e[c=r[u]],f=t[c];if(l)var _=o?l(f,E,c,t,e,i):l(E,f,c,e,t,i);if(!(void 0===_?E===f||a(E,f,n,l,i):_)){v=!1;break}p||(p="constructor"==c)}if(v&&!p){var h=e.constructor,y=t.constructor;h==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof y&&y instanceof y||(v=!1)}return i.delete(e),i.delete(t),v}(e,t,n,l,a,i))}(t,n,l,a,e,i))})(t.paymentMode,W)||(R(t),G(w.paymentMode))}}),x&&l.createElement(t.Toast,{error:"error"===x.key,label:d("success"===x.key?"ES_"+y.split(".")[0].toLowerCase()+"_"+x.action+"_UPDATE_SUCCESS":x.action),onClose:()=>U(null),style:{maxWidth:"670px"}}))},Pt=e=>{if(e){const t=new Date(e);let n=t.getMonth()+1,l=t.getDate(),a=t.getFullYear();return n=(n>9?"":"0")+n,l=(l>9?"":"0")+l,l+"/"+n+"/"+a}return"NA"},bt=e=>{var o,r,u,d,m,v,p,E,f,_,h;const y=i.useHistory(),{t:g}=a.useTranslation(),S=s.useQueryClient(),{IsDisconnectionFlow:P}=Digit.Hooks.useQueryParams(),[b,A]=n.useState(!1),[N,C]=n.useState(null),D=(null===(o=location)||void 0===o||null===(r=o.pathname)||void 0===r?void 0:r.includes("payment/success/FSM.TRIP_CHARGES"))?g("PAYMENT_COLLECT_LABEL")+" / "+g("PAYMENT_COLLECT"):g("PAYMENT_LOCALIZATION_RESPONSE");e.setLink(D);let{consumerCode:T,receiptNumber:I,businessService:O}=i.useParams();const M=Digit.ULBService.getCurrentTenantId();I=I.replace(/%2F/g,"/");const{data:L={},isLoading:w}=Digit.Hooks.obps.useOBPSSearch("",{},M,{applicationNo:T},{},{enabled:!(null==O||!O.includes("BPA"))}),R=Digit.UserService.hasAccess("FSM_EDITOR_EMP")||!1;n.useEffect(()=>()=>{!function(){try{const e=Digit.ULBService.getCurrentTenantId(),t=Digit.ULBService.getStateId();Promise.resolve(Digit.PaymentService.getReciept(e,O,{receiptNumbers:I})).then(function(e){var n;let l={filestoreIds:[null===(n=e.Payments[0])||void 0===n?void 0:n.fileStoreId]};const a=function(n){if(null===(n=e.Payments[0])||void 0===n||!n.fileStoreId)return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:e.Payments},B)).then(function(e){l=e})}();if(a&&a.then)return a.then(function(){})})}catch(e){return Promise.reject(e)}}(),S.clear()},[]),n.useEffect(()=>{switch(N){case"GO_TO_HOME":return y.push("/digit-ui/employee");case"ASSIGN_TO_DSO":return y.push("/digit-ui/employee/fsm/application-details/"+T);default:return null}},[N]);let x=["GO_TO_HOME"];R&&(x=[...x,"ASSIGN_TO_DSO"]);const k=null==O?void 0:O.includes("FSM"),{data:B}=Digit.Hooks.useCommonMDMS(M,"common-masters","ReceiptKey",{select:e=>{var t,n,l;return(null===(t=e["common-masters"])||void 0===t||null===(n=t.uiCommonPay)||void 0===n||null===(l=n.filter(e=>{let{code:t}=e;return null==O?void 0:O.includes(t)})[0])||void 0===l?void 0:l.receiptKey)||"consolidatedreceipt"}}),H=function(e,t){void 0===t&&(t="download");try{var n,l;let a={applicationNo:null==L||null===(n=L[0])||void 0===n?void 0:n.applicationNo};return Promise.resolve(Digit.OBPSService.BPASearch(null==L||null===(l=L[0])||void 0===l?void 0:l.tenantId,a)).then(function(n){var l,a;return Promise.resolve(Digit.OBPSService.scrutinyDetails(null==L||null===(l=L[0])||void 0===l?void 0:l.tenantId,{edcrNumber:null==L||null===(a=L[0])||void 0===a?void 0:a.edcrNumber})).then(function(l){var a,i;let o=null==n||null===(a=n.BPA)||void 0===a?void 0:a[0],r=null==l||null===(i=l.edcrDetail)||void 0===i?void 0:i[0],s=new Date;o.additionalDetails.runDate=function(e,t){void 0===t&&(t="dayend");try{const n=e.match(/(\d{4})-(\d{1,2})-(\d{1,2})/),l=new Date(Date.UTC(n[1],n[2]-1,n[3]));return l.setMinutes(l.getMinutes()+l.getTimezoneOffset()),"dayend"===t&&(l.setHours(l.getHours()+24),l.setSeconds(l.getSeconds()-1)),l.getTime()}catch(t){return e}}(s.getFullYear()+"-"+(s.getMonth()+1)+"-"+s.getDate());let u=c({},o,{edcrDetail:[c({},r)]});return Promise.resolve(Digit.PaymentService.generatePdf(null==o?void 0:o.tenantId,{Bpa:[u]},e)).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(null==o?void 0:o.tenantId,{fileStoreIds:e.filestoreIds[0]})).then(function(n){var l,a;return window.open(n[null==e?void 0:e.filestoreIds[0]],"_blank"),u.applicationType=null==L||null===(l=L[0])||void 0===l||null===(a=l.additionalDetails)||void 0===a?void 0:a.applicationType,Promise.resolve(Digit.OBPSService.edcr_report_download({BPA:c({},u)})).then(function(e){const n=parseInt(e.status,10);201!==n&&200!==n||("print"==t?(e=>{const t=URL.createObjectURL(e);var n=window.open(t);null!=n&&n.addEventListener("load",e=>{n.focus(),n.print()})})(new Blob([e.data],{type:"application/pdf"})):((e,t)=>{if(window.mSewaApp&&window.mSewaApp.isMsewaApp()&&window.mSewaApp.downloadBase64File){var n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){mSewaApp.downloadBase64File(n.result,"edcrReport.pdf")}}else{const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download="edcrReport.pdf",document.body.append(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(t.href),7e3)}})(new Blob([e.data],{type:"application/pdf"})))})})})})})}catch(e){return Promise.reject(e)}},F=function(){try{const e=Digit.ULBService.getCurrentTenantId(),t=Digit.ULBService.getStateId();return Promise.resolve(Digit.PaymentService.getReciept(e,O,{receiptNumbers:I})).then(function(e){var n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:a.filestoreIds[0]})).then(function(e){window.open(e[a.filestoreIds[0]],"_blank")})}let a={filestoreIds:[null===(n=e.Payments[0])||void 0===n?void 0:n.fileStoreId]};const i=function(n){if(null===(n=e.Payments[0])||void 0===n||!n.fileStoreId){let n,l,i="",o="",r=e.Payments[0].paymentDetails[0].businessService,s=0;const u=function(){if("PT"==e.Payments[0].paymentDetails[0].businessService||"PT.MUTATION"==e.Payments[0].paymentDetails[0].businessService){if(e.Payments[0].paymentDetails[0].bill.billDetails.map(e=>{(e.amount>0||e.amountPaid>0)&&(s+=1,n=Pt(e.toPeriod).split("/")[2],l=Pt(e.fromPeriod).split("/")[2],i=""==i?l+"-"+n+"(Rs."+e.amountPaid+")":i+","+l+"-"+n+"(Rs."+e.amountPaid+")",o=l+"-"+n)}),0==s){let t=Pt(e.Payments[0].paymentDetails[0].bill.billDetails[0].toPeriod).split("/")[2],n=Pt(e.Payments[0].paymentDetails[0].bill.billDetails[0].fromPeriod).split("/")[2];i=""==i?n+"-"+t:i+","+n+"-"+t,o=n+"-"+t}e.Payments[0].paymentDetails[0].additionalDetails={assessmentYears:i},U(e)}else{const n=function(){if(r.includes("BPA")){var n,l;let i={applicationNo:null===(n=e.Payments[0].paymentDetails[0])||void 0===n||null===(l=n.bill)||void 0===l?void 0:l.consumerCode};const o=e.Payments[0];return Promise.resolve(Digit.OBPSService.BPASearch(e.Payments[0].tenantId,i)).then(function(e){var n,l,i,r,s;const u=null==e||null===(n=e.BPA[0])||void 0===n||null===(l=n.additionalDetails)||void 0===l?void 0:l.typeOfArchitect,d=c({},o,{paymentDetails:[c({},null===(i=o.paymentDetails)||void 0===i?void 0:i[0],{additionalDetails:c({},o.paymentDetails[0].additionalDetails,{propertyID:null==e||null===(r=e.BPA[0])||void 0===r||null===(s=r.additionalDetails)||void 0===s?void 0:s.propertyID,stakeholderType:u.charAt(0).toUpperCase()+u.slice(1).toLowerCase()})})]});return Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:[c({},d)]},B)).then(function(e){a=e})})}return console.log("0987",e.Payments),Promise.resolve(Digit.PaymentService.generatePdf(t,{Payments:e.Payments},B)).then(function(e){a=e})}();if(n&&n.then)return n.then(function(){})}}();if(u&&u.then)return u.then(function(){})}}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}},U=function(e){try{function t(){var t;function n(){return Promise.resolve(Digit.PaymentService.printReciept(l,{fileStoreIds:o.filestoreIds[0]})).then(function(e){window.open(e[o.filestoreIds[0]],"_blank")})}let o={filestoreIds:[null===(t=a.Payments[0])||void 0===t?void 0:t.fileStoreId]};const r=function(){{let t,n,r="",s="",u=0;if("PT"==a.Payments[0].paymentDetails[0].businessService||"PT.MUTATION"==a.Payments[0].paymentDetails[0].businessService){let e={},l=[],i={},o=[],c=0,d=0,m=0,v=0,p=0,E=0,f=0,_=0,h=0,y=0,g=0,S=0,P=0,b=0,A=0,N=0,C=0,D=0,T=0,I=0,O=0,M=0,L=0,w=0;if(a.Payments[0].paymentDetails[0].bill.billDetails.map(a=>{(a.amount>0||a.amountPaid>0)&&(u+=1,t=Pt(a.toPeriod).split("/")[2],n=Pt(a.fromPeriod).split("/")[2],r=""==r?n+"-"+t+"(Rs."+a.amountPaid+")":r+","+n+"-"+t+"(Rs."+a.amountPaid+")",s=n+"-"+t,a.billAccountDetails.map(e=>{"PT_TAX"==e.taxHeadCode?(d=e.adjustedAmount,b=e.amount):"PT_TIME_REBATE"==e.taxHeadCode?(E=e.adjustedAmount,D=e.amount):"PT_CANCER_CESS"==e.taxHeadCode?(v=e.adjustedAmount,N=e.amount):"PT_FIRE_CESS"==e.taxHeadCode?(m=e.adjustedAmount,A=e.amount):"PT_TIME_INTEREST"==e.taxHeadCode?(f=e.adjustedAmount,T=e.amount):"PT_TIME_PENALTY"==e.taxHeadCode?(p=e.adjustedAmount,C=e.amount):"PT_OWNER_EXEMPTION"==e.taxHeadCode?(h=e.adjustedAmount,O=e.amount):"PT_ROUNDOFF"==e.taxHeadCode?(c=e.adjustedAmount,P=e.amount):"PT_UNIT_USAGE_EXEMPTION"==e.taxHeadCode?(_=e.adjustedAmount,I=e.amount):"PT_ADHOC_PENALTY"==e.taxHeadCode?(y=e.adjustedAmount,M=e.amount):"PT_ADHOC_REBATE"==e.taxHeadCode&&(g=e.adjustedAmount,L=e.amount),w+=e.amount}),e={year:s,tax:d,firecess:m,cancercess:v,penalty:p,rebate:E,interest:f,usage_exemption:_,special_category_exemption:h,adhoc_penalty:y,adhoc_rebate:g,roundoff:c,total:a.amountPaid},i={year:s,tax:b,firecess:A,cancercess:N,penalty:C,rebate:D,interest:T,usage_exemption:I,special_category_exemption:O,adhoc_penalty:M,adhoc_rebate:L,roundoff:P,total:a.amount},l.push(e),o.push(i))}),0==u){let t=Pt(a.Payments[0].paymentDetails[0].bill.billDetails[0].toPeriod).split("/")[2],n=Pt(a.Payments[0].paymentDetails[0].bill.billDetails[0].fromPeriod).split("/")[2];r=""==r?n+"-"+t:r+","+n+"-"+t,s=n+"-"+t,a.Payments[0].paymentDetails[0].bill.billDetails[0].billAccountDetails.map(e=>{"PT_TAX"==e.taxHeadCode?(d=e.adjustedAmount,b=e.amount):"PT_TIME_REBATE"==e.taxHeadCode?(E=e.adjustedAmount,D=e.amount):"PT_CANCER_CESS"==e.taxHeadCode?(v=e.adjustedAmount,N=e.amount):"PT_FIRE_CESS"==e.taxHeadCode?(m=e.adjustedAmount,A=e.amount):"PT_TIME_INTEREST"==e.taxHeadCode?(f=e.adjustedAmount,T=e.amount):"PT_TIME_PENALTY"==e.taxHeadCode?(p=e.adjustedAmount,C=e.amount):"PT_OWNER_EXEMPTION"==e.taxHeadCode?(h=e.adjustedAmount,O=e.amount):"PT_ROUNDOFF"==e.taxHeadCode?(c=e.adjustedAmount,P=e.amount):"PT_UNIT_USAGE_EXEMPTION"==e.taxHeadCode?(_=e.adjustedAmount,I=e.amount):"PT_ADHOC_PENALTY"==e.taxHeadCode?(y=e.adjustedAmount,M=e.amount):"PT_ADHOC_REBATE"==e.taxHeadCode&&(g=e.adjustedAmount,L=e.amount),S+=e.adjustedAmount,w+=e.amount}),e={year:s,tax:d,firecess:m,cancercess:v,penalty:p,interest:f,usage_exemption:_,special_category_exemption:h,adhoc_penalty:y,adhoc_rebate:g,roundoff:c,total:a.Payments[0].paymentDetails[0].bill.billDetails[0].amountPaid},i={year:s,tax:b,firecess:A,cancercess:N,penalty:C,rebate:D,interest:T,usage_exemption:I,special_category_exemption:O,adhoc_penalty:M,adhoc_rebate:L,roundoff:P,total:a.Payments[0].paymentDetails[0].bill.billDetails[0].amount},l.push(e),o.push(i)}a.Payments[0].paymentDetails[0].additionalDetails={assessmentYears:r,arrearArray:l,taxArray:o}}i[0]=a.Payments[0],console.log("payments",a);const c="PT.MUTATION"==e.Payments[0].paymentDetails[0].businessService?Promise.resolve(Digit.PaymentService.generatePdf(l,{Payments:i},"pt-receipt")).then(function(e){o=e}):Promise.resolve(Digit.PaymentService.generatePdf(l,{Payments:i},B)).then(function(e){o=e});if(c&&c.then)return c.then(function(){})}}();return r&&r.then?r.then(n):n()}console.log("paymentpayment",e,e.Payments[0].paymentDetails[0].receiptNumber,e.Payments[0]);const n=Digit.ULBService.getCurrentTenantId(),l=Digit.ULBService.getStateId();let a,i=[];const o="PT.MUTATION"==e.Payments[0].paymentDetails[0].businessService?Promise.resolve(Digit.PaymentService.getReciept(n,"PT.MUTATION",{receiptNumbers:e.Payments[0].paymentDetails[0].receiptNumber})).then(function(e){a=e}):Promise.resolve(Digit.PaymentService.getReciept(n,"PT",{receiptNumbers:e.Payments[0].paymentDetails[0].receiptNumber})).then(function(e){a=e});return Promise.resolve(o&&o.then?o.then(t):t())}catch(e){return Promise.reject(e)}};if(null!=O&&O.includes("BPA")&&w)return l.createElement(t.Loader,null);const j=Digit.Hooks.chb.useChbCreateAPI(M,!1),Y=Digit.Hooks.ads.useADSCreateAPI(M,!1);return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement(t.Banner,{message:g("ES_PAYMENT_COLLECTED"),info:g("PAYMENT_LOCALIZATION_RECIEPT_NO"),applicationNumber:I,successful:!0}),l.createElement(t.CardText,null,(()=>{if(null!=O&&O.includes("BPA")){let e=sessionStorage.getItem("BPA_ARCHITECT_NAME"),t=e?JSON.parse(e):"ARCHITECT";return g("ES_PAYMENT_"+O+"_"+t+"_SUCCESSFUL_DESCRIPTION")}return null!=O&&O.includes("WS")||null!=O&&O.includes("SW")?g("ES_PAYMENT_WS_"+(null==O?void 0:O.replace(/\./g,"_"))+"_SUCCESSFUL_DESCRIPTION"):g("ES_PAYMENT_SUCCESSFUL_DESCRIPTION")})()),B?l.createElement("div",{style:{display:"flex"}},"chb-services"!==O&&"adv-services"!==O&&"sv-services"!==O&&"pet-services"!==O&&l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px"},onClick:"true"===P?function(){try{let e=M||Digit.ULBService.getCurrentTenantId(),t=window.location.href.substring(window.location.href.lastIndexOf(T),window.location.href.lastIndexOf("?"));return Promise.resolve(Digit.Utils.downloadReceipt(t,O,"consolidatedreceipt",e)).then(function(){})}catch(e){return Promise.reject(e)}}:F},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"})),g("CS_COMMON_PRINT_RECEIPT")),"TL"==O?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:function(){try{const e=Digit.ULBService.getCurrentTenantId(),t=Digit.ULBService.getStateId();return Promise.resolve(Digit.TLService.search({applicationNumber:T,tenantId:e})).then(function(e){const n=function(){if(e)return Promise.resolve(Digit.PaymentService.generatePdf(t,{Licenses:null==e?void 0:e.Licenses},"tlcertificate")).then(function(e){return Promise.resolve(Digit.PaymentService.printReciept(t,{fileStoreIds:e.filestoreIds[0]})).then(function(t){window.open(t[e.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"})),g("CS_COMMON_PRINT_CERTIFICATE")):null,"BPA_OC"!==(null==L||null===(u=L[0])||void 0===u?void 0:u.businessService)||"APPROVED"!==(null==L||null===(d=L[0])||void 0===d?void 0:d.status)&&"PENDING_SANC_FEE_PAYMENT"!==(null==L||null===(m=L[0])||void 0===m?void 0:m.status)?null:l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:e=>H("occupancy-certificate")},l.createElement(t.DownloadPrefixIcon,null),g("BPA_OC_CERTIFICATE")),"sv-services"==O?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:F},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),g("SV_FEE_RECIEPT")):null,"sv-services"==O?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:function(){try{const e=M;return Promise.resolve(Digit.SVService.search({tenantId:M,filters:{applicationNumber:T,isDraftApplication:!1}})).then(function(t){const n=function(){var n;if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{SVDetail:[null==t||null===(n=t.SVDetail)||void 0===n?void 0:n[0]]},"svcertificate")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),g("SV_CERTIFICATE")):null,"sv-services"==O?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:function(){try{const e=M;return Promise.resolve(Digit.SVService.search({tenantId:M,filters:{applicationNumber:T,isDraftApplication:!1}})).then(function(t){const n=function(){var n;if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{SVDetail:[null==t||null===(n=t.SVDetail)||void 0===n?void 0:n[0]]},"svidentitycard")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),g("SV_ID_CARD")):null,"pet-services"==O?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:F},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),g("PTR_FEE_RECEIPT")):null,"pet-services"==O?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset",marginRight:"20px",marginTop:"15px",marginBottom:"15px"},onClick:function(){try{const e=M;return Promise.resolve(Digit.PTRService.search({tenantId:M,filters:{applicationNumber:T}})).then(function(t){const n=function(){var n;if(t)return Promise.resolve(Digit.PaymentService.generatePdf(e,{PetRegistrationApplications:[null==t||null===(n=t.PetRegistrationApplications)||void 0===n?void 0:n[0]]},"petservicecertificate")).then(function(t){return Promise.resolve(Digit.PaymentService.printReciept(e,{fileStoreIds:t.filestoreIds[0]})).then(function(e){window.open(e[t.filestoreIds[0]],"_blank")})})}();if(n&&n.then)return n.then(function(){})})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#a82227"},l.createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),l.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"})),g("PTR_CERTIFICATE")):null,"chb-services"==O?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"20px",marginRight:"20px",marginTop:"15px",marginBottom:"15px"}},l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.CHBServices.search({tenantId:M,filters:{bookingNo:T}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(M,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.hallsBookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.paymentReceiptFilestoreId;const i=function(){if(!a)return Promise.resolve(Digit.PaymentService.getReciept(M,O,{receiptNumbers:I})).then(function(t){var n;let l={filestoreIds:[null===(n=t.Payments[0])||void 0===n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(M,{Payments:t.Payments},"chbservice-receipt")).then(function(t){var n;l=t;const i=c({},null==e?void 0:e.hallsBookingApplication[0],{paymentReceiptFilestoreId:null===(n=l)||void 0===n?void 0:n.filestoreIds[0]});return Promise.resolve(j.mutateAsync({hallsBookingApplication:i})).then(function(){var e;a=null===(e=l)||void 0===e?void 0:e.filestoreIds[0]})})})}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"})),g("CHB_FEE_RECEIPT")),l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.CHBServices.search({tenantId:M,filters:{bookingNo:T}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(M,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.hallsBookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.permissionLetterFilestoreId;const i=function(){if(!a)return Promise.resolve(Digit.PaymentService.generatePdf(M,{hallsBookingApplication:[null==e?void 0:e.hallsBookingApplication[0]]},"chbpermissionletter")).then(function(t){const n=c({},null==e?void 0:e.hallsBookingApplication[0],{permissionLetterFilestoreId:null==t?void 0:t.filestoreIds[0]});return Promise.resolve(j.mutateAsync({hallsBookingApplication:n})).then(function(){a=null==t?void 0:t.filestoreIds[0]})})}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"})),g("CHB_PERMISSION_LETTER"))):null,"adv-services"==O?l.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"20px",marginRight:"20px",marginTop:"15px",marginBottom:"15px"}},l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.ADSServices.search({tenantId:M,filters:{bookingNo:T}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(M,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.bookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.paymentReceiptFilestoreId;const i=function(){if(!a)return Promise.resolve(Digit.PaymentService.getReciept(M,O,{receiptNumbers:I})).then(function(t){var n;let l={filestoreIds:[null===(n=t.Payments[0])||void 0===n?void 0:n.fileStoreId]};return Promise.resolve(Digit.PaymentService.generatePdf(M,{Payments:t.Payments},"advservice-receipt")).then(function(t){var n;l=t;const i=c({},null==e?void 0:e.bookingApplication[0],{paymentReceiptFilestoreId:null===(n=l)||void 0===n?void 0:n.filestoreIds[0]});return Promise.resolve(Y.mutateAsync({bookingApplication:i})).then(function(){var e;a=null===(e=l)||void 0===e?void 0:e.filestoreIds[0]})})})}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"})),g("ADS_FEE_RECEIPT")),l.createElement("div",{className:"primary-label-btn d-grid",onClick:function(){try{return Promise.resolve(Digit.ADSServices.search({tenantId:M,filters:{bookingNo:T}})).then(function(e){var t,n;function l(){return Promise.resolve(Digit.PaymentService.printReciept(M,{fileStoreIds:a})).then(function(e){window.open(e[a],"_blank")})}let a=null==e||null===(t=e.bookingApplication)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.permissionLetterFilestoreId;const i=function(){if(!a)return Promise.resolve(Digit.PaymentService.generatePdf(M,{bookingApplication:[null==e?void 0:e.bookingApplication[0]]},"advpermissionletter")).then(function(t){const n=c({},null==e?void 0:e.bookingApplication[0],{permissionLetterFilestoreId:null==t?void 0:t.filestoreIds[0]});return Promise.resolve(Y.mutateAsync({bookingApplication:n})).then(function(){a=null==t?void 0:t.filestoreIds[0]})})}();return i&&i.then?i.then(l):l()})}catch(e){return Promise.reject(e)}}},l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{d:"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"})),g("ADS_PERMISSION_LETTER"))):null,"BPA_LOW"===(null==L||null===(v=L[0])||void 0===v?void 0:v.businessService)?l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:e=>H("buildingpermit-low")},l.createElement(t.DownloadPrefixIcon,null),g("BPA_PERMIT_ORDER")):null,"BPA"!==(null==L||null===(p=L[0])||void 0===p?void 0:p.businessService)||"BPA_LOW"===(null==L||null===(E=L[0])||void 0===E?void 0:E.businessService)||"BPA_OC"===(null==L||null===(f=L[0])||void 0===f?void 0:f.businessService)||"PENDING_SANC_FEE_PAYMENT"!==(null==L||null===(_=L[0])||void 0===_?void 0:_.status)&&"APPROVED"!==(null==L||null===(h=L[0])||void 0===h?void 0:h.status)?null:l.createElement("div",{className:"primary-label-btn d-grid",style:{marginLeft:"unset"},onClick:e=>H("buildingpermit")},l.createElement(t.DownloadPrefixIcon,null),g("BPA_PERMIT_ORDER"))):null),k?l.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},b?l.createElement(t.Menu,{localeKeyPrefix:"ES_COMMON",options:x,t:g,onSelect:function(e){C(e),A(!1)}}):null,l.createElement(t.SubmitBar,{label:g("ES_COMMON_TAKE_ACTION"),onSubmit:()=>A(!b)})):l.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:g("CORE_COMMON_GO_TO_HOME")}))))},At=e=>{e.setLink("Response");const{t:n}=a.useTranslation(),{consumerCode:o}=i.useParams();return l.createElement(l.Fragment,null,l.createElement(t.Card,null,l.createElement(t.Banner,{message:n("ES_PAYMENT_COLLECTED_ERROR"),complaintNumber:o,successful:!1}),l.createElement(t.CardText,null,n("ES_PAYMENT_FAILED_DETAILS"))),l.createElement(t.ActionBar,{style:{display:"flex",justifyContent:"flex-end",alignItems:"baseline"}},l.createElement(i.Link,{to:"/digit-ui/employee"},l.createElement(t.SubmitBar,{label:n("CORE_COMMON_GO_TO_HOME")}))))},Nt={a:["1","2","3"],b:["4","5","6"],c:["7","8","9"],j:["10","11","12"],k:["22","45"],l:["456"]},Ct=e=>{const{stateCode:o}=e,{moduleName:r,pageName:s}=i.useParams(),{t:u}=a.useTranslation(),[c,d]=n.useState(""),[m,v]=n.useState(""),{data:p,isLoading:E}=Digit.Hooks.dss.useMDMS(o,"common-masters",["uiCommonConstants"],{select:e=>{var t,n;return(null==e||null===(t=e["common-masters"])||void 0===t||null===(n=t.uiCommonConstants)||void 0===n?void 0:n[0])||{}},enabled:!0});return n.useEffect(()=>{var e,t;const n=(null==p||null===(e=p[r])||void 0===e||null===(t=e["iframe-routes"])||void 0===t?void 0:t[s])||{},l=(null==n?void 0:n.isOrigin)?"development"===process.env.NODE_ENV?"https://qa.digit.org":document.location.origin:null==n?void 0:n.domain,a=(null==n?void 0:n.title)||"";d(""+l+((null==n?void 0:n.routePath)||"")),v(a)},[p,r,s]),E?l.createElement(t.Loader,null):c?l.createElement(l.Fragment,null,l.createElement(t.Header,null,u(m)),l.createElement("div",{className:"app-iframe-wrapper"},l.createElement("iframe",{src:c,title:m,className:"app-iframe"}))):l.createElement("div",null,"No Iframe To Load")};null==u.subFormRegistry||u.subFormRegistry.addSubForm("testForm",{addedFields:[],middlewares:[{middleWare_1:function(e,t,n){try{return e.a="a",Promise.resolve(n(e))}catch(e){return Promise.reject(e)}}},{middleWare_2:function(e,t,n){try{return e.b="b",Promise.resolve(n(e))}catch(e){return Promise.reject(e)}}},{middleWare_3:function(e,t,n){try{function l(){return Promise.resolve(n(e))}e.c="c";const t=function(){if("b"===e.b){const t=A(function(){return Promise.resolve(window.fetch("https://ifsc.razorpay.com/hdfc0000090")).then(function(t){const n=function(){if(t.ok)return Promise.resolve(t.json()).then(function(t){let{BANK:n}=t;e.BANKFROMMiddleWare=n});alert("Wrong IFSC Code")}();if(n&&n.then)return n.then(function(){})})},function(){alert("Something Went Wrong !")});if(t&&t.then)return t.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(l):l())}catch(e){return Promise.reject(e)}}}],state:{firstDDoptions:["a","b","c"],secondDDoptions:Nt.a,thirdDDoptions:["d","e","f"]},fields:[{label:"first",name:"pehla",defaultValue:"b",customProps:e=>({isMendatory:!0,option:e.firstDDoptions}),component:(e,n)=>l.createElement(t.Dropdown,c({select:t=>{e.setState({secondDDoptions:Nt[t]}),e.setValue("doosra",""),e.onChange(t)},selected:e.value},n)),validations:{}},{label:"second",name:"doosra",customProps:e=>({isMendatory:!0,option:e.secondDDoptions}),defaultValue:e=>e.secondDDoptions[1],component:(e,n)=>l.createElement(t.Dropdown,c({select:t=>{e.onChange(t)},selected:e.value},n))},{label:"third",name:"teesra",customProps:e=>({isMendatory:!0,option:e.thirdDDoptions}),defaultValue:"d",component:(e,n)=>l.createElement(t.Dropdown,c({select:t=>{e.onChange(t)},selected:e.value},n))},{label:"IFSC",name:"ifsc",customProps:{isMendatory:!0,setBankDetailsFromIFSC:function(e){try{const t=A(function(){return Promise.resolve(window.fetch("https://ifsc.razorpay.com/"+e.getValues("ifsc"))).then(function(t){const n=function(){if(t.ok)return Promise.resolve(t.json()).then(function(t){let{BANK:n,BRANCH:l}=t;e.setValue("bank",n),e.setValue("branch",l)});alert("Wrong IFSC Code")}();if(n&&n.then)return n.then(function(){})})},function(){alert("Something Went Wrong !")});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}},defaultValue:"",component:(e,n)=>l.createElement("div",{className:"ifsc-field"},l.createElement("input",{value:e.value,type:"text",onChange:t=>{e.setState({ifsc:t.target.value}),e.onChange(t.target.value)}}),l.createElement("button",{type:"button",onClick:()=>{n.setBankDetailsFromIFSC(e)}},l.createElement(t.SearchIconSvg,null)))},{label:"Bank",name:"bank",defaultValue:"d",component:(e,t)=>l.createElement("input",{readOnly:!0,value:e.value})},{label:"Branch",name:"branch",defaultValue:"d",component:(e,t)=>l.createElement("input",{readOnly:!0,value:e.value})}]});const Dt=e=>{var t,o,r,s;let{stateCode:u,cityCode:d,moduleCode:m}=e;const{path:v}=i.useRouteMatch(),{t:p}=a.useTranslation(),[E,f]=n.useState(null),_={stateCode:u,cityCode:d,moduleCode:m,setLink:f},h=(null===(t=location)||void 0===t||null===(o=t.pathname)||void 0===o?void 0:o.includes("fsm"))||(null===(r=location)||void 0===r||null===(s=r.pathname)||void 0===s?void 0:s.includes("FSM"));return l.createElement(l.Fragment,null,l.createElement("p",{className:"breadcrumb",style:{marginLeft:"15px"}},l.createElement(i.Link,{to:"/digit-ui/employee"},p("ES_COMMON_HOME")),h?l.createElement(i.Link,{to:"/digit-ui/employee/fsm/home"},"/ ",p("ES_TITLE_FSM")," "):null,h?l.createElement(i.Link,{to:"/digit-ui/employee/fsm/inbox"},"/ ",p("ES_TITLE_INBOX")):null,"/ ",E),l.createElement(i.Switch,null,l.createElement(i.Route,{path:v+"/collect/:businessService/:consumerCode"},l.createElement(St,c({},_,{basePath:v}))),l.createElement(i.Route,{path:v+"/success/:businessService/:receiptNumber/:consumerCode"},l.createElement(bt,_)),l.createElement(i.Route,{path:v+"/integration/:moduleName/:pageName"},l.createElement(Ct,_)),l.createElement(i.Route,{path:v+"/failure"},l.createElement(At,_))))},Tt={getBillDetailsConfigWithBusinessService:(e,t)=>{switch(null==e?void 0:e.toLowerCase().split(".")[0]){case"pt":return{"my-bill":[{keyValue:"CS_COMMON_AMOUNT_DUE",keyPath:[e=>{var n;const a=(new Date).getTime()-new Date(null===(n=e.billDetails[0])||void 0===n?void 0:n.toPeriod).getTime(),i=Math.floor(a/864e5);return l.createElement(l.Fragment,null,"₹"+e.totalAmount,i>=0?l.createElement("span",{className:"card-label-error",style:{fontSize:"16px",fontWeight:"normal"}}," ( "+t("CS_PAYMENT_OVERDUE")+" "+i+" "+t(1===i?"CS_COMMON_DAY":"CS_COMMON_DAYS")+")"):null)}],fallback:"N/A",noteStyle:{fontWeight:"bold",fontSize:"24px",paddingTop:"5px"}},{keyValue:"PT_PROPERTY_ID",keyPath:["propertyId"],fallback:""},{keyValue:"CS_OWNER_NAME",keyPath:["owners",0,"name"],fallback:"ES_TITLE_FSM"},{keyValue:"PT_PROPERTY_ADDRESS",keyPath:["address","locality","name"],fallback:"CS_APPLICATION_TYPE_DESLUDGING"},{keyValue:"CS_PAYMENT_BILLING_PERIOD",keyPath:["billDetails",e=>{const{fromPeriod:t,toPeriod:n}=e[0];return t&&n?"FY "+new Date(t).getFullYear().toString()+"-"+new Date(n).getFullYear().toString():"N/A"}],fallback:"N/A"},{keyValue:"PT_DUE_DATE",keyPath:["billDetails",e=>{var t,n;if(null===(t=e[0])||void 0===t||!t.toPeriod)return"N/A";const l=new Date(null===(n=e[0])||void 0===n?void 0:n.toPeriod),a=Digit.Utils.date.monthNames[l.getMonth()];return l.getDate()+" "+a+" "+l.getFullYear()}],fallback:"N/A"}],response:[]};case"fsm":return{"my-bill":[{keyValue:"CS_COMMON_AMOUNT_DUE",keyPath:["totalAmount",e=>e.toFixed(2),e=>"₹"+e],fallback:"N/A",noteStyle:{fontWeight:"bold",fontSize:"24px",paddingTop:"5px"}}],response:[]}}}};exports.PaymentLinks=e=>(a.useTranslation(),null),exports.PaymentModule=e=>{let{deltaConfig:n={},stateCode:a,cityCode:o,moduleCode:r="Payment",userType:s}=e;const{path:u,url:c}=i.useRouteMatch();return 0===Object.keys({data:{}}).length?l.createElement(t.Loader,null):l.createElement(l.Fragment,null,"citizen"===s?l.createElement(x,{stateCode:a,moduleCode:r,cityCode:o,path:u,url:c}):l.createElement(Dt,{stateCode:a,cityCode:o,moduleCode:r}))},exports.paymentConfigs=Tt;