PageSourceSearch

https://web.pgmanager.in/static/js/5050.665eaa3d.chunk.js

js pgmanager.in collected 2026-10-02 01:58:14 UTC 28,027 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkpg_manager=self.webpackChunkpg_manager||[]).push([[5050],{43735:(e,n,l)=>{l.d(n,{Z:()=>f});var t=l(5574),o=l(97123),i=l(24518),a=l(39157),s=l(36314),r=l(20890),d=l(13400),c=l(55931),u=l(72791),m=l(29823),p=l(65661),x=l(46995),h=l(80184);const y=u.forwardRef((function(e,n){return(0,h.jsx)(c.Z,{direction:"left",ref:n,...e,sx:{justifyContent:{sm:"right"}}})}));function f(e){const n=(0,u.useMemo)((()=>e.showCloseIcon||!1),[e.showCloseIcon]),l=(0,u.useMemo)((()=>e.disableDialogActions||!1),[e.disableDialogActions]),c=(0,u.useMemo)((()=>"function"===typeof e.onApplyButtonClick||e.showApplyButton||!1),[e.showApplyButton,e.onApplyButtonClick]),f=(0,u.useMemo)((()=>e.applyButtonLabel||"Apply"),[e.applyButtonLabel]),[v,j]=(0,u.useState)(!1),[Z]=(0,u.useState)("paper"),g=(0,u.useRef)(null),b=()=>{null!==e&&void 0!==e&&e.onModalClose&&e.onModalClose(),j(!1)},C=(0,u.useRef)(null);return(0,u.useEffect)((()=>{if(v){const{current:e}=C;null!==e&&e.focus()}}),[v]),(0,u.useEffect)((()=>{e.open!==v&&j(e.open)}),[e.open,j,v]),(0,h.jsxs)(t.Z,{fullWidth:"boolean"===typeof(null===e||void 0===e?void 0:e.fullWidth)?e.fullWidth:!(null!==e&&void 0!==e&&e.isFullScreen),fullScreen:(null===e||void 0===e?void 0:e.isFullScreen)||!1,maxWidth:e.maxWidth||"sm",open:v,onClose:b,scroll:Z,"aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",ref:g,TransitionComponent:y,sx:{height:"100%",".MuiDialog-paper":{m:2,height:"100%",borderRadius:4,pb:1}},children:[(0,h.jsxs)(p.Z,{id:"scroll-dialog-title",children:[null!==e&&void 0!==e&&e.isFullScreen||e.title?(0,h.jsxs)(s.Z,{direction:"row",alignItems:"center",children:[null!==e&&void 0!==e&&e.isFullScreen?(0,h.jsx)(d.Z,{onClick:b,children:(0,h.jsx)(x.Z,{})}):null,e.title?(0,h.jsx)(r.Z,{variant:"h6",fontWeight:400,fontSize:"1.2rem",children:e.title}):""]}):null,e.caption?(0,h.jsx)(r.Z,{sx:{px:null!==e&&void 0!==e&&e.isFullScreen?1:0},display:"block",variant:"caption",color:"textSecondary",children:e.caption}):null,n?(0,h.jsx)(d.Z,{"aria-label":"close",onClick:b,sx:{position:"absolute",right:8,top:8,color:e=>e.palette.grey[500]},children:(0,h.jsx)(m.Z,{})}):null]}),(0,h.jsx)(a.Z,{dividers:"paper"!==Z,sx:{display:"flex"},children:u.cloneElement(e.children,{handleClose:b,dialogRef:g})}),!0===l?null:(0,h.jsxs)(o.Z,{sx:{my:1,mx:1},children:[(0,h.jsx)(i.Z,{color:"secondary",onClick:b,children:"Close"}),c?(0,h.jsx)(i.Z,{variant:"tonal",color:"secondary",onClick:()=>{null!==e&&void 0!==e&&e.onApplyButtonClick&&e.onApplyButtonClick()},children:f}):null]})]})}},3928:(e,n,l)=>{l.d(n,{Z:()=>h});var t=l(36314),o=l(20890),i=l(13400),a=l(72791),s=l(24518),r=l(5574),d=l(97123),c=l(39157),u=l(29823),m=l(65661),p=l(46995),x=l(80184);function h(e){const n=(0,a.useMemo)((()=>e.showCloseIcon||!1),[e.showCloseIcon]),l=(0,a.useMemo)((()=>e.disableDialogActions||!1),[e.disableDialogActions]),h=(0,a.useMemo)((()=>"function"===typeof e.onApplyButtonClick||e.showApplyButton||!1),[e.showApplyButton,e.onApplyButtonClick]),y=(0,a.useMemo)((()=>e.applyButtonLabel||"Apply"),[e.applyButtonLabel]),[f,v]=(0,a.useState)(!1),[j]=(0,a.useState)("paper"),Z=(0,a.useRef)(null),g=(n,l)=>{"backdropClick"===l&&null!==e&&void 0!==e&&e.preventBackdropClickClose||(null!==e&&void 0!==e&&e.onModalClose&&e.onModalClose(),v(!1))},b=(0,a.useRef)(null);return(0,a.useEffect)((()=>{if(f){const{current:e}=b;null!==e&&e.focus()}}),[f]),(0,a.useEffect)((()=>{e.open!==f&&v(e.open)}),[e.open,v,f]),(0,x.jsxs)(r.Z,{fullWidth:"boolean"===typeof(null===e||void 0===e?void 0:e.fullWidth)?e.fullWidth:!(null!==e&&void 0!==e&&e.isFullScreen),fullScreen:(null===e||void 0===e?void 0:e.isFullScreen)||!1,maxWidth:e.maxWidth||"sm",disableEscapeKeyDown:(null===e||void 0===e?void 0:e.disableEscapeKeyDown)||!1,open:f,onClose:g,scroll:j,"aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",ref:Z,sx:{".MuiDialog-paper":{borderRadius:{xs:null!==e&&void 0!==e&&e.isFullScreen?0:4,sm:4}}},children:[(0,x.jsxs)(m.Z,{id:"scroll-dialog-title",children:[null!==e&&void 0!==e&&e.isFullScreen||e.title?(0,x.jsxs)(t.Z,{direction:"row",alignItems:"center",children:[null!==e&&void 0!==e&&e.isFullScreen?(0,x.jsx)(i.Z,{onClick:g,children:(0,x.jsx)(p.Z,{})}):null,e.title?(0,x.jsx)(o.Z,{variant:"h6",fontWeight:400,fontSize:"1.2rem",children:e.title}):""]}):null,e.caption?(0,x.jsx)(o.Z,{sx:{px:null!==e&&void 0!==e&&e.isFullScreen?1:0},display:"block",variant:"caption",color:"textSecondary",children:e.caption}):null,n?(0,x.jsx)(i.Z,{"aria-label":"close",onClick:g,sx:{position:"absolute",right:8,top:8,color:e=>e.palette.grey[500]},children:(0,x.jsx)(u.Z,{})}):null]}),(0,x.jsx)(c.Z,{dividers:"paper"!==j,children:a.cloneElement(e.children,{handleClose:g,dialogRef:Z})}),!0===l?null:(0,x.jsxs)(d.Z,{sx:{my:1,mx:1},children:[(0,x.jsx)(s.Z,{color:"secondary",onClick:g,children:"Close"}),h?(0,x.jsx)(s.Z,{variant:"tonal",color:"secondary",onClick:()=>{null!==e&&void 0!==e&&e.onApplyButtonClick&&e.onApplyButtonClick()},children:y}):null]})]})}},61696:(e,n,l)=>{l.d(n,{Z:()=>i});var t=l(21568),o=l(72791);const i=()=>(0,o.useContext)(t.Z)},95050:(e,n,l)=>{l.r(n),l.d(n,{default:()=>Be});var t=l(48550),o=l(63466),i=l(27825),a=l(81918),s=l(77057),r=l(36314),d=l(80872),c=l(24518),u=l(81882),m=l(20890),p=l(73745),x=l(61889),h=l(72791),y=l(20883),f=l(35552),v=l(97379),j=l(43735),Z=l(68870),g=l(68096),b=l(58406),C=l(23786),w=l(30829),P=l(61084),S=l(94721),k=l(71652),M=l(60222),D=l(63118),I=l(61134),A=l(5519),R=l(5541),T=l(80184);const F=[{name:"Paid",value:"paid"},{name:"Unpaid",value:"unpaid"}],W=[...R.kp,...R.KM];function z(e){let{filters:n,applyFilters:l,closeModal:o,defaultFormFields:i}=e;const{handleSubmit:s,control:d,formState:{errors:u},reset:m,watch:p,setValue:y}=(0,I.cI)({mode:"onTouched",defaultValues:{...i,filters:n}}),f=p("status");return(0,h.useEffect)((()=>{m({...n,paymentType:(null===n||void 0===n?void 0:n.paymentType)||"all"})}),[n,m]),(0,T.jsx)(Z.Z,{noValidate:!0,component:"form",onSubmit:s((function(e){l(e)})),display:"flex",children:(0,T.jsxs)(x.ZP,{container:!0,justifyContent:"space-between",flexDirection:"row",spacing:2,flexGrow:1,children:[(0,T.jsxs)(x.ZP,{item:!0,xs:12,container:!0,spacing:2,flexDirection:"row",alignContent:"flex-start",children:[(0,T.jsx)(x.ZP,{item:!0,xs:12,children:(0,T.jsx)(S.Z,{sx:{"::before, ::after":{borderColor:A.Z[200]}},"aria-hidden":"true",textAlign:"left",children:(0,T.jsx)(a.Z,{label:"Date Range",size:"small",sx:{borderRadius:1,backgroundColor:A.Z[100]}})})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:6,mt:1.5,children:(0,T.jsx)(I.Qr,{control:d,name:"from",id:"from",required:!0,rules:{required:!0},render:e=>{let{field:n}=e;return(0,T.jsx)(k._,{dateAdapter:D.H,children:(0,T.jsx)(M.M,{...n,required:!0,label:"Start date",format:"dd-MMM-yyyy",clearable:!1,maxDate:p("to"),value:n.value,onChange:e=>{n.onChange(e)},openTo:"day",views:["year","month","day"],textField:e=>(0,T.jsx)(t.Z,{value:n.value,...e,margin:"normal",sx:{width:"100%"}}),slotProps:{actionBar:{},textField:{error:!(null===u||void 0===u||!u.from),fullWidth:!0}}})})}})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:6,mt:1.5,children:(0,T.jsx)(I.Qr,{control:d,name:"to",id:"to",required:!0,rules:{required:!0},render:e=>{let{field:n}=e;return(0,T.jsx)(k._,{dateAdapter:D.H,children:(0,T.jsx)(M.M,{...n,required:!0,label:"End date",format:"dd-MMM-yyyy",clearable:!1,disableFuture:!0,value:n.value,onChange:e=>{n.onChange(e)},openTo:"day",views:["year","month","day"],textField:e=>(0,T.jsx)(t.Z,{value:n.value,...e,margin:"normal",sx:{width:"100%"}}),slotProps:{actionBar:{},textField:{error:!(null===u||void 0===u||!u.end),fullWidth:!0}}})})}})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,mt:3,children:(0,T.jsx)(S.Z,{sx:{"::before, ::after":{borderColor:A.Z[200]}},"aria-hidden":"true",textAlign:"left",children:(0,T.jsx)(a.Z,{label:"Payment Status",size:"small",sx:{borderRadius:1,backgroundColor:A.Z[100]}})})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,children:(0,T.jsx)(r.Z,{direction:"row",spacing:2,children:F.map((e=>{let{name:n,value:l}=e;return(0,T.jsx)(a.Z,{sx:{borderRadius:2},icon:(0,T.jsx)(P.Z,{sx:{fontSize:18}}),label:n,variant:f===l?"contained":"outlined",color:"primary",onClick:()=>y("status",f===l?null:l)},l)}))})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,mt:2,children:(0,T.jsx)(I.Qr,{control:d,name:"paymentType",id:"paymentType",render:e=>{let{field:n}=e;return(0,T.jsxs)(g.Z,{...n,fullWidth:!0,margin:"normal",children:[(0,T.jsx)(w.Z,{id:"paymentType-label",children:"Payment Type"}),(0,T.jsxs)(b.Z,{...n,defaultValue:"all",required:!0,name:"paymentType",labelId:"paymentType-label",id:"paymentType-select",label:"Payment Type",value:n.value,children:[(0,T.jsx)(C.Z,{value:"all",children:"All"}),W.map((e=>{let{name:n,value:l}=e;return(0,T.jsx)(C.Z,{value:l,children:n},l)}))]})]})}})})]}),(0,T.jsx)(x.ZP,{item:!0,xs:12,container:!0,alignContent:"flex-end",children:(0,T.jsxs)(r.Z,{direction:"row",sx:{width:"100%"},justifyContent:"space-between",children:[(0,T.jsxs)(Z.Z,{children:[(0,T.jsx)(c.Z,{type:"button",sx:{color:A.Z[600]},onClick:function(){m(i)},children:"Reset"}),(0,T.jsx)(c.Z,{type:"button",sx:{color:A.Z[600]},onClick:o,children:"Cancel"})]}),(0,T.jsx)(c.Z,{type:"submit",variant:"tonal",color:"success",children:"Apply"})]})})]})})}const E=(0,h.memo)(z);var B=l(15719),L=l(28030),q=l(16386),N=l(82460),_=l(95193),Q=l(57621),H=l(72363),U=l(66647),V=l(39504),G=l(50533),$=l(46385),K=l(13400),O=l(74530),J=l(89646),X=l(73124),Y=l(97639),ee=l(76450),ne=l(4378),le=l(16656),te=l(66934),oe=l(69293),ie=l(3928),ae=l(13096),se=l(39281),re=l(79836),de=l(53382),ce=l(56890),ue=l(35855),me=l(53994);const pe=e=>{let{paymentId:n,pageRef:l}=e;
1const[t,o]=(0,h.useState)(null),i=(0,h.useCallback)((()=>{const e=new AbortController;return(0,v.fg)(n,{signal:e.signal,pageRef:l}).then((e=>{let{response:n,error:l}=e;if("canceled"!==(null===l||void 0===l?void 0:l.message))return l?o([]):void o(n)})),e}),[l,n]);return(0,h.useEffect)((()=>{const e=i();return()=>{e.abort()}}),[i]),t?(0,T.jsx)(x.ZP,{container:!0,children:(0,T.jsx)(x.ZP,{item:!0,xs:12,children:(null===t||void 0===t?void 0:t.length)>0?(0,T.jsx)(se.Z,{sx:{maxHeight:300},children:(0,T.jsxs)(re.Z,{stickyHeader:!0,"aria-label":"sticky table",children:[(0,T.jsx)(ce.Z,{children:(0,T.jsxs)(ue.Z,{children:[(0,T.jsx)(me.Z,{children:"Date & Time"}),(0,T.jsx)(me.Z,{children:"Amount Paid"})]})}),(0,T.jsx)(de.Z,{children:null===t||void 0===t?void 0:t.map(((e,n)=>{let{paymentDate:l,amountPaid:t}=e;return(0,T.jsxs)(ue.Z,{hover:!0,role:"checkbox",tabIndex:-1,children:[(0,T.jsx)(me.Z,{children:l}),(0,T.jsx)(me.Z,{children:(0,ee.xG)(t)})]},n)}))})]})}):(0,T.jsx)(m.Z,{variant:"subtitle1",color:"error.light",textAlign:"center",my:4,children:"No data available"})})}):null},xe=(0,h.memo)(pe);var he=l(78148),ye=l(91098),fe=l(13208),ve=l(35527),je=l(53767),Ze=l(25028),ge=l(6409),be=l(49900),Ce=l(57064),we=l(8301),Pe=l(58680),Se=l(61696);const ke=(0,h.memo)((function(e){let{pageRef:n,enableMultiplePayments:l,paymentId:t,isInmatePaymentReminder:o=!1}=e;const[i,a]=(0,h.useState)(!1),s=(0,h.useRef)(null),d=(0,Se.Z)(),{enqueueSnackbar:u}=(0,f.Ds)(),m=()=>{a((e=>!e))},p=e=>{s.current&&s.current.contains(null===e||void 0===e?void 0:e.target)||a(!1)};function x(e){"Tab"===e.key?(e.preventDefault(),a(!1)):"Escape"===e.key&&a(!1)}const j=(0,h.useRef)(i);function Z(e){d({title:o?"Do you wish to send WhatsApp reminder to tenant?":"Do you wish to send WhatsApp reminder to Tenants?"}).then((()=>b("whatsApp"))).catch((()=>p(e)))}function g(e){d({title:o?"Do you wish to send SMS reminder to tenant?":"Do you wish to send SMS reminder to tenants?"}).then((()=>b("sms"))).catch((()=>p(e)))}function b(e){y.k.debug("[PaymentsPage]:{getPaymentsList} fetching data");const l=o?{paymentId:t}:{};(0,v.pX)(e,l,{pageRef:n}).then((e=>{let{response:n,error:l}=e;if(p(),"canceled"!==(null===l||void 0===l?void 0:l.message))return l?u(null===l||void 0===l?void 0:l.message,{variant:"error"}):void u("Reminder has been sent",{variant:"success"})}))}return(0,h.useEffect)((()=>{!0===j.current&&!1===i&&s.current.focus(),j.current=i}),[i]),(0,T.jsx)(r.Z,{direction:"row",spacing:2,children:(0,T.jsxs)("div",{children:[o?(0,T.jsx)(K.Z,{color:"info",onClick:m,ref:s,id:"composition-button","aria-controls":i?"composition-menu":void 0,"aria-expanded":i?"true":void 0,"aria-haspopup":"true",children:(0,T.jsx)(Pe.Z,{sx:{fontSize:"20px"}})}):(0,T.jsx)(c.Z,{ref:s,color:"info",id:"composition-button","aria-controls":i?"composition-menu":void 0,"aria-expanded":i?"true":void 0,"aria-haspopup":"true",onClick:m,startIcon:(0,T.jsx)(Pe.Z,{}),children:"Reminders"}),(0,T.jsx)(ye.Z,{open:i,anchorEl:s.current,role:void 0,placement:"top-start",transition:!0,disablePortal:!0,sx:{zIndex:1},children:e=>{let{TransitionProps:n,placement:l}=e;return(0,T.jsx)(fe.Z,{...n,style:{transformOrigin:"bottom-start"===l?"left top":"right top"},children:(0,T.jsx)(ve.Z,{children:(0,T.jsx)(je.d,{onClickAway:p,children:(0,T.jsxs)(Ze.Z,{autoFocusItem:i,id:"composition-menu","aria-labelledby":"composition-button",onKeyDown:x,children:[(0,T.jsxs)(C.Z,{onClick:g,children:[(0,T.jsx)(Ce.Z,{children:(0,T.jsx)(we.Z,{fontSize:"small",color:"info"})}),(0,T.jsx)(be.Z,{children:o?"SMS":"Send Payment Due SMS Reminder"})]}),(0,T.jsxs)(C.Z,{onClick:Z,children:[(0,T.jsx)(Ce.Z,{children:(0,T.jsx)(ge.Z,{fontSize:"small",color:"info"})}),(0,T.jsx)(be.Z,{children:o?"WhatsApp":"Send Payment Due WhatsApp Reminder"})]})]})})})})}})]})})}));var Me=l(42021);const De=[{name:"Card",value:"CARD"},{name:"Cash",value:"CASH"},{name:"Cheque",value:"CHEQUE"},{name:"NEFT/IMPS",value:"NEFT_IMPS"},{name:"UPI",value:"UPI"},{name:"Online",value:"ONLINE"}],Ie=e=>{var n;let{paymentId:l,onPaymentUpdated:o,data:i}=e;const a={refNo:"",comments:"",bankName:"",paymentMode:"",paymentDate:new Date},{enqueueSnackbar:s}=(0,f.Ds)(),{handleSubmit:r,control:d,formState:{errors:u},reset:m}=(0,I.cI)({mode:"onTouched",defaultValues:{...a}});(0,h.useEffect)((()=>{m({...i,paymentDate:i.paymentDate?(0,Me.Z)(i.paymentDate,"dd-MM-yyyy",new Date):new Date})}),[i,m]);return(0,T.jsx)(Z.Z,{noValidate:!0,component:"form",onSubmit:r((e=>{!function(e){(0,v.cQ)({...e,paymentId:l,paymentDate:(0,q.Z)(e.paymentDate,"dd-MM-yyyy")}).then((e=>{let{error:n}=e;n?s((null===n||void 0===n?void 0:n.message)||n,{variant:"error"}):(m({...a}),s("Payment details updated successfuly",{variant:"success"}),o())}))}(e)})),sx:{mt:2},children:(0,T.jsxs)(x.ZP,{container:!0,columnSpacing:2,rowSpacing:1,justifyContent:"center",children:[(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,children:(0,T.jsxs)(g.Z,{size:"small",fullWidth:!0,sx:{minWidth:120},required:!0,error:"required"===(null===(n=u.paymentMode)||void 0===n?void 0:n.type),children:[(0,T.jsx)(w.Z,{id:"payment-mode-label",children:"Payment Mode"}),(0,T.jsx)(I.Qr,{required:!0,control:d,name:"paymentMode",id:"paymentMode",rules:{required:"Select payment mode"},render:e=>{let{field:n}=e;return(0,T.jsx)(b.Z,{...n,required:!0,labelId:"payment-mode-label",label:"Payment Mode",children:De.map((e=>(0,T.jsx)(C.Z,{value:e.value,children:e.name})))})}})]})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,sx:{mt:2.5},children:(0,T.jsx)(I.Qr,{control:d,name:"paymentDate",id:"payment_date",rules:{required:"Select payment data"},render:e=>{let{field:n}=e;return(0,T.jsx)(k._,{dateAdapter:D.H,children:(0,T.jsx)(M.M,{label:"Payment Date",format:"dd-MM-yyyy",inputFormat:"dd-MM-yyyy",clearable:!1,maxDate:new Date,value:n.value||new Date,onChange:e=>{n.onChange(e)},required:!0,renderInput:e=>{var l;return(0,T.jsx)(t.Z,{required:!0,...n,...e,size:"small",sx:{width:"100%"},error:"required"===(null===(l=u.paymentDate)||void 0===l?void 0:l.type)})},slotProps:{textField:{fullWidth:!0,size:"small"}}})})}})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,children:(0,T.jsx)(I.Qr,{control:d,name:"refNo",id:"ref_no",render:e=>{let{field:n}=e;return(0,T.jsx)(t.Z,{...n,margin:"normal",fullWidth:!0,size:"small",autoFocus:!0,label:"Reference Number"})}})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,children:(0,T.jsx)(I.Qr,{control:d,name:"bankName",id:"bank_name",render:e=>{let{field:n}=e;return(0,T.jsx)(t.Z,{...n,margin:"normal",label:"Bank Name",size:"small",fullWidth:!0})}})}),(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:12,md:12,lg:12,children:(0,T.jsx)(I.Qr,{control:d,name:"comments",id:"comments",render:e=>{let{field:n}=e;return(0,T.jsx)(t.Z,{...n,margin:"normal",label:"Comments",multiline:!0,minRows:2,size:"small",fullWidth:!0})}})}),(0,T.jsx)(c.Z,{type:"submit",variant:"contained",sx:{mt:3,mb:2},color:"success",children:"Submit"})]})})},Ae=(0,h.memo)(Ie),Re=(0,te.ZP)((e=>{let{className:n,...l}=e;return(0,T.jsx)(Y.Z,{...l,classes:{popper:n},placement:"right-end",enterTouchDelay:0,leaveTouchDelay:3e3})}))((e=>{let{theme:n}=e;return{[`& .${oe.Z.tooltip}`]:{backgroundColor:n.palette.common.white,color:"rgba(0, 0, 0, 0.87)",boxShadow:n.shadows[1]}}})),Te=e=>{let{data:n={},onPaymentSuccess:l,isMultiplePaymentEnable:t,togglePaymentSelection:o,isPaymentSelected:i,isCollectPaymentsAllowed:s}=e;const{paymentId:d,inmateName:u,description:p,amountDue:y=0,mobile:f,rent:j,status:g,amountPaid:b=0,checkInDate:C,bedInfo:w,paymentType:P}=n,[S,k]=(0,h.useState)(!1),[M,D]=(0,h.useState)(!1),[I,F]=(0,h.useState)(!1),W=(0,h.useMemo)((()=>({paymentMode:(null===n||void 0===n?void 0:n.paymentMode)||"",paymentDate:(null===n||void 0===n?void 0:n.paymentDate)||"",bankName:(null===n||void 0===n?void 0:n.bankName)||"",refNo:(null===n||void 0===n?void 0:n.refNo)||"",comments:(null===n||void 0===n?void 0:n.comments)||""})),[n]),z=(0,h.useCallback)((()=>{k(!1)}),[]);return(0,T.jsx)(x.ZP,{item:!0,xs:12,sm:10,md:6,lg:4,xl:4,children:(0,T.jsxs)(Q.Z,{sx:{":hover":{boxShadow:{md:"rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px"}},height:"100%",boxShadow:{xs:0,md:"rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px"},borderRadius:{xs:i?2.2:0,md:2.2},borderBottom:{xs:`1px solid ${A.Z[200]}`,md:0},backgroundColor:i?ne.Z[50]:"#fff",position:"relative"},children:[(0,T.jsx)(U.Z,{disableRipple:!t,disableTouchRipple:!t,onClick:()=>!!t&&o(d),sx:{cursor:"inherit",":hover .MuiCardActionArea-focusHighlight":{opacity:0}
1},component:"div",children:(0,T.jsxs)(V.Z,{sx:{p:1.5,pb:"2px !important"},children:[t?i?(0,T.jsx)(X.Z,{sx:{position:"absolute",left:6,top:6,fontSize:"1.5rem",color:"secondary.main",backgroundColor:"#fff",zIndex:1,borderRadius:1}}):(0,T.jsx)(J.Z,{sx:{position:"absolute",left:6,top:6,fontSize:"1.5rem",color:"secondary.main",backgroundColor:"#fff",zIndex:1,borderRadius:1}}):null,(0,T.jsxs)(r.Z,{direction:"column",gap:1,justifyContent:"space-between",sx:{height:"100%"},children:[(0,T.jsxs)(r.Z,{direction:"row",gap:1,alignItems:"center",px:1,children:[(0,T.jsxs)(r.Z,{flexGrow:1,children:[(0,T.jsx)(m.Z,{variant:"h6",style:{fontSize:18},children:u}),(0,T.jsx)(m.Z,{variant:"body2",color:"grey",children:p})]}),(0,T.jsx)(r.Z,{children:(0,T.jsx)(m.Z,{variant:"h6",color:"PAID"===g?"success.main":"secondary",children:(0,ee.xG)("PAID"===g?b:y)})})]}),(0,T.jsxs)(r.Z,{direction:"row",gap:1,justifyContent:"space-between",alignContent:"center",children:[(0,T.jsxs)(r.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,T.jsx)(Re,{title:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(m.Z,{variant:"body2",color:"#555",children:w}),(0,T.jsx)(m.Z,{variant:"body2",color:"#555",children:C})]}),children:(0,T.jsx)(K.Z,{size:"small","aria-label":"Bed details",children:(0,T.jsx)(O.Z,{color:"tertiary",style:{opacity:.5}})})}),(0,T.jsxs)(r.Z,{direction:"row",gap:.25,alignItems:"center",children:[(0,T.jsx)($.Z,{fontSize:"1.2rem",sx:{color:A.Z[500]}}),(0,T.jsx)(m.Z,{variant:"caption",color:"grey",children:(0,T.jsx)(G.Z,{href:`tel:${f}`,underline:"none",color:"tertiary.main",children:f})})]})]}),(0,T.jsxs)(m.Z,{variant:"caption",color:"grey",children:["Rent: ",(0,T.jsx)("span",{style:{color:"#555"},children:(0,ee.xG)(j)})]})]})]})]})}),t?null:(0,T.jsx)(H.Z,{children:(0,T.jsxs)(r.Z,{direction:"row",gap:1,justifyContent:"space-between",width:"100%",children:[(0,T.jsxs)(r.Z,{direction:"row",alignItems:"center",children:["PAID"===g?null:(0,T.jsx)(ke,{paymentId:d,isInmatePaymentReminder:!0}),(0,T.jsx)(a.Z,{sx:{backgroundColor:le.Z[50],color:le.Z[900],borderRadius:2},label:R.xc[P],size:"small"})]}),"PAID"===g?(0,T.jsxs)(Z.Z,{children:[(0,T.jsx)(c.Z,{color:"warning",onClick:()=>F(!0),children:"Update Payment"}),(0,T.jsx)(c.Z,{color:"info",onClick:()=>D(!0),children:"Details"}),(0,T.jsx)(c.Z,{color:"success",onClick:()=>(0,v.JY)(d),children:"Receipt"}),(0,T.jsx)(ie.Z,{isFullScreen:!1,maxWidth:"xs",onModalClose:()=>D(!1),open:M,title:"Payment History",disableDialogActions:!0,showCloseIcon:!0,children:(0,T.jsx)(he.Z,{children:(0,T.jsx)(xe,{paymentId:d})})}),(0,T.jsx)(ie.Z,{isFullScreen:!1,maxWidth:"xs",onModalClose:()=>F(!1),open:I,title:"Payment Update",disableDialogActions:!0,showCloseIcon:!0,children:(0,T.jsx)(Ae,{paymentId:d,onPaymentUpdated:()=>{F(!1),l()},data:W})})]}):s?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(c.Z,{color:"primary",onClick:()=>k(!0),children:"Collect"}),(0,T.jsx)(Fe,{onModalClose:z,openModal:S,onPaymentSuccess:l,paymentId:d})]}):null]})})]})})};function Fe(e){let{openModal:n,onModalClose:l,paymentId:t,inmateId:o,onPaymentSuccess:i}=e;const a=(0,_.Z)((e=>e.breakpoints.up("sm")));return(0,T.jsx)(ie.Z,{isFullScreen:!a,maxWidth:"xs",onModalClose:l,open:n,title:"Payment Collection",handleClose:l,disableDialogActions:!0,showCloseIcon:!!a,children:(0,T.jsx)(he.Z,{children:(0,T.jsx)(ae.Z,{paymentId:t,inmateId:o,closeModal:l,onPaymentSuccess:i})})})}const We=(0,h.memo)(Te);var ze=l(71198),Ee=l(26211);const Be=e=>{var n,l,t,o;let{pageRef:i}=e;y.k.info("[PaymentsPage] mounting...");const[a,s]=(0,h.useState)(null),{enqueueSnackbar:r}=(0,f.Ds)(),[d,c]=(0,h.useState)({searchText:"",data:null}),[u,j]=(0,h.useState)(null),{permissions:Z}=(0,h.useContext)(ze.Il),g=(0,h.useMemo)((()=>(0,Ee._L)(["Collect payments"],Z)),[Z]),b=(0,h.useMemo)((()=>(0,Ee._L)(["Send rent due reminders"],Z)),[Z]),C=(0,h.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};y.k.debug("[PaymentsPage]:{getPaymentsList} fetching data");const n=new AbortController;return(0,v.Tg)(e,{signal:n.signal,pageRef:i}).then((e=>{let{response:n,error:l}=e;if("canceled"!==(null===l||void 0===l?void 0:l.message))return l?(s([]),r(null===l||void 0===l?void 0:l.message,{variant:"error"})):void s(n)})),n}),[i,r]);(0,h.useEffect)((()=>(y.k.debug("[PaymentsPage] mounted"),()=>{y.k.debug("[PaymentsPage] unmounted")})),[]),(0,h.useEffect)((()=>{var e;let n;if(null!==d&&void 0!==d&&null!==(e=d.data)&&void 0!==e&&e.from){const e={from:d.data.from,to:d.data.to,status:d.data.status};n=C(e)}return()=>{var e;null===(e=n)||void 0===e||e.abort()}}),[null===d||void 0===d||null===(n=d.data)||void 0===n?void 0:n.from,null===d||void 0===d||null===(l=d.data)||void 0===l?void 0:l.to,null===d||void 0===d||null===(t=d.data)||void 0===t?void 0:t.status,C]);const w=(0,h.useCallback)((e=>{c(e)}),[]),P=(0,h.useCallback)((()=>{const e={from:d.data.from,to:d.data.to,status:d.data.status};C(e)}),[d,C]);const S=(0,h.useCallback)((e=>{u&&(null!==u&&void 0!==u&&u.includes(e)?j(null===u||void 0===u?void 0:u.filter((n=>n!==e))):j([...u,e]))}),[u]);return(0,T.jsxs)(x.ZP,{container:!0,children:[(0,T.jsx)(x.ZP,{item:!0,xs:12,children:(0,T.jsx)(qe,{isSendRentDueRemindersAllowed:b,updateFilters:w,pageRef:i,enableMultiplePayments:()=>j((e=>e?null:[]))})}),0===(null===a||void 0===a?void 0:a.length)?(0,T.jsxs)(x.ZP,{item:!0,container:!0,justifyContent:"center",alignItems:"center",sx:{p:2},direction:"column",children:[(0,T.jsx)(p.Z,{sx:{color:N.Z[50],fontSize:80,mb:1}}),(0,T.jsx)(m.Z,{variant:"subtitle1",color:"grey",gutterBottom:!0,children:"No payments to show"})]}):null,(0,T.jsx)(x.ZP,{container:!0,item:!0,xs:12,spacing:2,mt:1,justifyContent:{xs:"center",md:"flex-start"},children:null===(o=function(e){if(!e)return;const{searchText:n="",paymentType:l}=d,t=(null===n||void 0===n?void 0:n.length)>0?null===e||void 0===e?void 0:e.filter((e=>{var l,t,o,i,a,s,r;let{inmateName:d,mobile:c,paymentType:u,description:m,checkInDate:p,bedInfo:x,paymentMode:h}=e;return(null===d||void 0===d||null===(l=d.toLowerCase())||void 0===l?void 0:l.includes(null===n||void 0===n?void 0:n.toLowerCase()))||(null===c||void 0===c||null===(t=c.toLowerCase())||void 0===t?void 0:t.includes(null===n||void 0===n?void 0:n.toLowerCase()))||(null===u||void 0===u||null===(o=u.toLowerCase())||void 0===o?void 0:o.includes(null===n||void 0===n?void 0:n.toLowerCase()))||(null===m||void 0===m||null===(i=m.toLowerCase())||void 0===i?void 0:i.includes(null===n||void 0===n?void 0:n.toLowerCase()))||(null===p||void 0===p||null===(a=p.toLowerCase())||void 0===a?void 0:a.includes(null===n||void 0===n?void 0:n.toLowerCase()))||(null===x||void 0===x||null===(s=x.toLowerCase())||void 0===s?void 0:s.includes(null===n||void 0===n?void 0:n.toLowerCase()))||(null===h||void 0===h||null===(r=h.toLowerCase())||void 0===r?void 0:r.includes(null===n||void 0===n?void 0:n.toLowerCase()))})):e;return l&&"all"!==l?t.filter((e=>e.paymentType===l)):t}(a))||void 0===o?void 0:o.map((e=>(0,T.jsx)(We,{data:e,onPaymentSuccess:P,isMultiplePaymentEnable:!!u,togglePaymentSelection:S,isPaymentSelected:null===u||void 0===u?void 0:u.includes(e.paymentId),isCollectPaymentsAllowed:g},e.paymentId)))})]})},Le={from:(0,B.Z)((0,L.Z)(new Date,1)),to:new Date,status:"unpaid",searchText:"",paymentType:null};function qe(e){let{updateFilters:n,pageRef:l,enableMultiplePayments:m,isSendRentDueRemindersAllowed:p}=e;const[y,f]=(0,h.useState)({toggle:!1,data:{...Le}}),{from:v,to:Z,status:g,paymentType:b}=(null===y||void 0===y?void 0:y.data)||{},[{name:C}={}]=F.filter((e=>{let{value:n}=e;return n===g})),w=(0,h.useCallback)((()=>{f((e=>({...e,toggle:!1})))}),[]),P=(0,h.useCallback)((e=>{f({toggle:!1,data:e})}),[]);function S(e){e.stopPropagation(),f((e=>({...e,toggle:!0})))}return(0,h.useEffect)((()=>{const{from:e,to:l,status:t,searchText:o,paymentType:i}=y.data,a={from:(0,q.Z)(e,"dd-MM-yyyy"),to:(0,q.Z)(l,"dd-MM-yyyy"),status:t&&""!==t?t:"all",paymentType:"all"===i?null:i};n({data:a,searchText:o,paymentType:i})}),[y.data,n]),(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(x.ZP,{item:!0,xs:12,children:[(0,T.jsxs)(r.Z,{alignItems:{xs:"flex-start",sm:"center"},direction:{xs:"column-reverse",sm:"row"},gap:1,justifyContent:"space-between",flexWrap:"wrap",children:[(0,T.jsxs)(r.Z,{direction:"row",gap:1,py:1,maxWidth:"100%",overflow:"auto",children:[v&&Z?(0,T.jsx)(c.Z,{color:"tertiary",variant:"tonal",sx:{flexShrink:0},startIcon:(0,T.jsx)(u.Z,{}),onClick:S,children:`${(0,q.Z)(v,"dd MMM, yyyy",new Date)} - ${(0,q.Z)(Z,"dd MMM, yyyy",new Date)}`}):null,C?(0,T.jsx)(c.Z,{color:"tertiary",variant:"tonal",sx:{flexShrink:0},onClick:S,endIcon:(0,T.jsx)(d.Z,{onClick:function(e){e.stopPropagation(),f({...y,data:{...y.data,status:null}})}}),children:C}):null,b&&"all"!==b?(0,T.jsx)(c.Z,{color:"tertiary",variant:"tonal",onClick:S,sx:{flexShrink:0},endIcon:(0,T.jsx)(d.Z,{onClick:function(e){e.stopPropagation(),f({...y,data:{...y.data,paymentType:null}})}}),children:R.xc[b]}):null]}),(0,T.jsxs)(r.Z,{direction:{xs:"row-reverse",sm:"row"},gap:1,justifyContent:"space-between",sx:{width:{xs:"100%",sm:"auto"}},children:[p?(0,T.jsx)(ke,{pageRef:l}):null,(0,T.jsx)(a.Z,{color:"tertiary",icon:(0,T.jsx)(s.Z,{}),label:"Filters",variant:"outlined",sx:{maxWidth:"max-content"},onClick:S})]})]}),(0,T.jsx)(j.Z,{open:y.toggle,onModalClose:w,disableDialogActions:!0,title:"Filters",maxWidth:"xs",children:(0,T.jsx)(E,{defaultFormFields:Le,filters:y.data,closeModal:w,applyFilters:P})})]}),(0,T.jsx)(x.ZP,{xs:12,sm:10,md:8,lg:4,xl:4,children:(0,T.jsx)(t.Z,{margin:"dense",size:"small",label:"Search",placeholder:"Name or Mobile no or Date or Bed or Payment type",fullWidth:!0,onChange:e=>f({...y,data:{...y.data,searchText:e.target.value}}),InputProps:{endAdornment:(0,T.jsx)(o.Z,{position:"end",children:(0,T.jsx)(i.Z,{})})}})})]})}}}]);
2//# sourceMappingURL=5050.665eaa3d.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.