1"use strict";(self.webpackChunkwumdrop_web=self.webpackChunkwumdrop_web||[]).push([[3957],{3957(t,e,a){a.r(e),a.d(e,{default:()=>ot});var n=a(89379),s=a(76998),o=a(59917),l=a(50849),i=a(49113),c=a(48051),r=a(7146),d=a(63659),h=a(29800),p=a(5e4),u=a(1808),m=a(89592),A=a(66971),f=a(96204),g=a(73804),C=a(55363),x=a(1499),y=a(82263),S=a(20756),v=a(38732),w=a(84077),T=a(70013),b=a(46790),k=a(22720),D=a(47742),O=a(96710),j=a(80296),L=a(80075),E=a(96751),P=a(51379),F=a(3151),W=a(27574),U=a(21489),I=a(73911),N=a(5868),M=a(23446);function q(t){let e=t.open,a=t.selectedAccounts,n=t.onConfirmClick,o=t.onCloseClick,l=t.loading;const i=s.useState(0),c=(0,j.A)(i,1)[0],r=s.useState(new Map),d=(0,j.A)(r,2),h=d[0],p=d[1];(0,s.useEffect)(()=>{if(h.size!==a.length&&a.length>0){const t=new Map(a.map(t=>[t.id,t.balance]));p(t)}},[a,h.size]);const m=(t,e)=>{const a=new Map(h);a.set(t,e),p(a)};return(0,s.useEffect)(()=>()=>{e&&p(new Map)},[e]),(0,M.jsx)(N.A,{open:e,fullWidth:!0,maxWidth:"md",onSubmitClick:()=>n(h),onCloseClick:()=>{o(),p(new Map)},title:"Withdrawal Allocation",submitText:"Allocate",loading:l,children:(0,u.default)(a)?(0,M.jsx)(U.A,{}):(0,M.jsxs)(L.A,{children:[(0,M.jsx)(E.A,{children:(0,M.jsxs)(P.A,{children:[(0,M.jsx)(F.A,{children:"Account name"}),(0,M.jsx)(F.A,{align:"right",children:"Balance"}),(0,M.jsx)(F.A,{align:"right",children:"Withdrawing"})]})}),(0,M.jsx)(W.A,{children:a.map(t=>(0,M.jsxs)(P.A,{children:[(0,M.jsx)(F.A,{component:"th",scope:"row",children:t.accountName}),(0,M.jsx)(F.A,{align:"right",children:(0,v.A)(t.balance)}),(0,M.jsx)(F.A,{align:"right",children:(0,M.jsx)(I.A,{min:1,max:t.balance,defaultValue:t.balance,rowId:t.id,allocated:c,allocations:h,changeCallback:m})})]},t.id))})]})})}var _=a(57252),R=a(25443),B=a.n(R);const H=(t,e)=>{let a=[];return(0,u.default)(e)||e.forEach(e=>{a.push({field:t,value:e})}),a},V=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const e=new Date;let a=e.getMonth()+t,n=e.getFullYear();for(;a>=12;)a-=12,n=t>0?n+1:n-1;for(;a<0;)a+=12,n=t>0?n+1:n-1;let s=new Date(n,a,1),o=new Date(n,a+1,0);return a===e.getMonth()&&(o=e),{startDate:B()(s).format(S.DXO),endDate:B()(o).format(S.DXO)}};var z=a(95366),Z=a(15215),J=a(86460),K=a(88979);const Y=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;let e=(new Date).getMonth()+t;for(;e>=12;)e-=12;for(;e<0;)e+=12;return["January","February","March","April","May","June","July","August","September","October","November","December"][e]},X=t=>{let e=t.open,a=t.loading,n=t.onConfirmClick,s=t.onCloseClick,o=t.onDateTypeSelect,l=t.onDateChange,i=t.title,c=t.confirmText,r=void 0===c?"Confirm":c,d=t.cancelText,h=void 0===d?"Cancel":d,p=t.confirmDisabled,u=void 0!==p&&p,A=t.description,x=void 0===A?"":A,S=t.onSetDateRange,v=void 0===S?null:S,w=t.startDate,T=void 0===w?null:w,b=t.endDate,k=void 0===b?null:b,D=t.dateTypeSelectEnabled,O=void 0!==D&&D,j=t.dateTypeOptions,L=void 0===j?m.iU0:j;return(0,M.jsxs)(y.A,{open:e,onConfirmClick:n,onCloseClick:s,title:i,confirmText:r,cancelText:h,confirmDisabled:u,loading:a,children:[(0,M.jsx)(f.A,{color:"secondary",children:x}),(0,M.jsx)("br",{}),O&&(0,M.jsx)(K.A,{fieldName:"dateType",label:"Date Type",values:L,onSelect:o}),(0,M.jsx)("br",{}),(0,M.jsxs)(g.A,{"aria-label":"finance group",fullWidth:!0,children:[(0,M.jsx)(C.A,{color:"secondary",onClick:()=>v(-2),children:Y(-2)}),(0,M.jsx)(C.A,{color:"secondary",onClick:()=>v(-1),children:Y(-1)}),(0,M.jsx)(C.A,{color:"secondary",onClick:()=>v(0),children:Y(0)})]}),(0,M.jsxs)(z.$,{dateAdapter:J.Y,children:[(0,M.jsx)(Z.l,{disableFuture:!0,label:"Start Date",value:T,onChange:t=>l("startDate","endDate",t),format:m.YIi,slotProps:{textField:{fullWidth:!0,margin:"dense",variant:"standard"}}}),(0,M.jsx)(Z.l,{disableFuture:!0,label:"End Date",value:k,onChange:t=>l("endDate","startDate",t),format:m.YIi,slotProps:{textField:{fullWidth:!0,margin:"dense",variant:"standard"}}})]}),(0,M.jsx)("br",{})]})};const Q=(0,a(64172).A)((0,M.jsx)("path",{d:"M18 17H6v-2h12zm0-4H6v-2h12zm0-4H6V7h12zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2z"}),"Receipt");var $=a(59278),G=a(54251);const tt=(0,s.lazy)(()=>Promise.all([a.e(5043),a.e(7108),a.e(295),a.e(830)]).then(a.bind(a,70295))),et=-.05,at=.05;
1class nt extends s.Component{constructor(t){var e;super(t),e=this,this.getWithrawalTotalAmount=()=>{const t=this.state,e=t.withrawals,a=t.selected;let n=0;const s=e[Symbol.iterator]();for(const o of s)a.includes(o[0])&&(n+=o[1]);return n},this._getSelectedPhrase=()=>{const t=this.state.selected;return t.length>1?"".concat(t.length," selected accounts"):"The selected account"},this.dispalyTransactionMessage=()=>{switch(this.state.request.transactionType){case S.Lhw.UNLOCK_FUNDS:return"You are about to alter the locked amount.\n This amount must be the same as the amount shown in the error log.";case S.Lhw.ADVANCE:return"".concat(this._getSelectedPhrase()," will be advanced the following amount:");case S.Lhw.CASH_CREDIT:return"".concat(this._getSelectedPhrase()," will be cash credited the following amount:");case S.Lhw.CASH_DEBIT:return"".concat(this._getSelectedPhrase()," will be cash debited the following amount:");default:return"Oops! Something went wrong."}},this.diplayConfirmationMessage=()=>{const t=this.state,e=t.request,a=t.selected;let n=e.transactionType===S.Lhw.CASH_CREDIT?"into":"from",s=e.transactionType===S.Lhw.WITHDRAW?this.getWithrawalTotalAmount():e.amount*a.length;return"Are you sure you want to ".concat(e.transactionType.toLowerCase()," funds worth ").concat((0,v.A)(1*s)," ").concat(n," ").concat(this._getSelectedPhrase().toLowerCase())},this.diplayUpdateLockedAmountConfirmationMessage=()=>{const t=this.state,e=t.request,a=t.selected,n=this.props.accounts;if(!(0,u.default)(a)&&1===a.length){let t=n.data.items.filter(t=>a.includes(t.id)&&t.isActive);if(!(0,u.default)(t)&&t.length===a.length)return"Are you sure you want to update the locked amount from ".concat((0,v.A)(Number(t[0].locked))," to ").concat((0,v.A)(Number(e.newLockedAmount))," from ").concat(this._getSelectedPhrase().toLowerCase(),"?")}},this.dispalyWarningMessage=()=>{const t=this.state.request;let e="All accounts selected for ".concat(t.transactionType.toLowerCase(),"ing need to be active");return t.transactionType===S.Lhw.WITHDRAW?"".concat(e," , belong to a partner company and have a positive balance."):t.transactionType===S.Lhw.CASH_CREDIT?"".concat(e,', and of type "Cash Threshold".'):"".concat(e,".")},this.dispalySuccessMessage=()=>{switch(this.state.request.transactionType){case S.Lhw.UNLOCK_FUNDS:return"The locked amount has been successfully updated";case S.Lhw.CREDIT:case S.Lhw.CASH_CREDIT:return"".concat(this._getSelectedPhrase()," credited sucessfully.");case S.Lhw.DEBIT:case S.Lhw.CASH_DEBIT:return"".concat(this._getSelectedPhrase()," debited sucessfully.");default:return"Oops! Something went wrong."}},this.handleUnlockOpen=()=>this.setState({unlockOpen:!0}),this.handleUnlockClose=()=>this.setState({unlockOpen:!1}),this.handleAdvanceOpen=()=>this.setState({advanceOpen:!0}),this.handleAdvanceClose=()=>this.setState({advanceOpen:!1}),this.handleTransactionExportOpen=()=>this.setState({exportOpen:!0}),this.handleTransactionExportClose=()=>!this.props.transactions.loading&&this.setState({exportOpen:!1,exportFilters:[]}),this.handleSalesExportOpen=()=>this.setState({salesExportOpen:!0}),this.handleSalesExportClose=()=>!this.props.transactions.loading&&this.setState({salesExportOpen:!1,exportFilters:[]}),this.handleCostOfSalesExportOpen=()=>this.setState({costOfSalesExportOpen:!0}),this.handleCostOfSalesExportClose=()=>!this.props.transactions.loading&&this.setState({costOfSalesExportOpen:!1,exportFilters:[]}),this.handleConfirmationOpen=()=>this.setState({confirmOpen:!0,advanceOpen:!1,withdrawOpen:!1,unlockOpen:!1}),this.handleConfirmationClose=()=>this.setState({confirmOpen:!1}),this.handleUnlockLockedAmountConfirmationOpen=()=>this.setState({updateLockedAmountConfirmationOpen:!0,confirmOpen:!1,advanceOpen:!1,withdrawOpen:!1,unlockOpen:!1}),this.handleUnlockLockedAmountConfirmationClose=()=>this.setState({updateLockedAmountConfirmationOpen:!1}),this.handleWithdrawOpen=()=>this.setState({withdrawOpen:!0}),this.handleWithdrawClose=()=>this.setState({withdrawOpen:!1}),this.handleCashCreditDebitOpen=()=>this.setState({cashCreditDebitOpen:!0}),this.handleCashCreditDebitClose=()=>this.setState({cashCreditDebitOpen:!1}),this.handleWithdrawAllocate=t=>{this.setState({withrawals:t}),this.handleConfirmationOpen()},this.handleWarningOpen=()=>this.setState({warningOpen:!0}),this.handleWarningClose=()=>this.setState({warningOpen:!1}),this.handleAccountSelect=t=>this.setState({selected:t}),this.handleWithdrawalConfirmation=(t,e)=>{let a=this.props.accounts.data.items.filter(t=>e.includes(t.id)&&t.balance>0&&t.isActive),s=(0,n.A)({},st);s.transactionType=t,(0,u.default)(a)||a.length!==e.length?this.setState({request:s},()=>this.handleWarningOpen()):this.setState({request:s},()=>this.handleWithdrawOpen())},this.handleUnlockConfirmation=(t,e)=>{let a=this.props.accounts.data.items.filter(t=>e.includes(t.id)&&t.isActive),s=(0,n.A)({},st);s.transactionType=t,(0,u.default)(a)||a.length!==e.length?this.setState({request:s},()=>this.handleWarningOpen()):this.setState({request:s},()=>this.handleUnlockOpen())},this.getCurrentLockedAmount=()=>{const t=this.state.selected,e=this.props.accounts;if(!(0,u.default)(t)&&1===t.length){let a=e.data.items.filter(e=>t.includes(e.id)&&e.isActive);if(!(0,u.default)(a)&&a.length===t.length)return"".concat((0,v.A)(Number(a[0].locked)))}},this.handleAdvanceConfirmation=(t,e)=>{let a=this.props.accounts.data.items.filter(t=>e.includes(t.id)&&t.isActive),s=(0,n.A)({},st);s.transactionType=t,(0,u.default)(a)||a.length!==e.length?this.setState({request:s},()=>this.handleWarningOpen()):this.setState({request:s},()=>this.handleAdvanceOpen())},this.handleCashCreditDebitConfirmation=(t,e)=>{let a=this.props.accounts.data.items.filter(t=>e.includes(t.id)&&3===t.accountTypeId&&t.isActive),s=(0,n.A)({},st);s.transactionType=t,(0,u.default)(a)||a.length!==e.length?this.setState({request:s},()=>this.handleWarningOpen()):this.setState({request:s},()=>this.handleCashCreditDebitOpen())},this.handleUnlockedAmountChange=t=>{const e=this.state.request,a=t.target.value;e[t.target.name]=a>
1at?at:a<et?et:a,this.setState({request:e})},this.handleChange=t=>{const e=this.state.request;e[t.target.name]=t.target.value,this.setState({request:e})},this.handleCreateTransaction=()=>{const t=this.state,e=t.request,a=t.selected,n=t.withrawals;this.setState({loading:!0});let s=[];if(e.transactionType===S.Lhw.WITHDRAW){const t=n[Symbol.iterator]();for(const e of t)a.includes(e[0])&&s.push({accountId:e[0],amount:e[1]})}else s=a.map(t=>({accountId:t,amount:e.amount}));let o={transactions:s,description:e.description,transactionType:e.transactionType};this.props.createTransaction(o,this.props.history)},this.handleUpdateLockedAmount=()=>{const t=this.state,e=t.request,a=t.selected,n=this.props.accounts;if(e.transactionType===S.Lhw.UNLOCK_FUNDS&&(this.setState({loading:!0}),!(0,u.default)(a)&&1===a.length)){let t=n.data.items.filter(t=>a.includes(t.id)&&t.isActive);if(!(0,u.default)(t)&&t.length===a.length){const a={lockedAmount:e.newLockedAmount,balanceAmount:t[0].balance},n=t[0].id;this.props.updateLockedAccountAmount(n,a),this.handleUnlockLockedAmountConfirmationClose(),this.setState({loading:!1}),this.setState({successUpdateLockedAmountOpen:!0})}return}},this.successClose=()=>{this.setState({successOpen:!1,request:st}),this.props.clearTransactionSuccess()},this.successUpdateLockedAmountClose=()=>{this.setState({successUpdateLockedAmountOpen:!1},()=>this._reloadData()),this.successClose()},this.handleDateTypeSelect=t=>{let e=this.state.exportFilters.filter(e=>e.field!==t.field);0===t.value&&(t.value=1),e.push(t),this.setState({exportFilters:e})},this.handleDateChange=(t,e,a)=>{let n=this.state.exportFilters;this.setState({exportFilters:(0,_.A)(t,e,a,n)})},this.setDateRange=function(){let t=V(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0),a=e.state.exportFilters.filter(t=>"startDate"!==t.field).filter(t=>"endDate"!==t.field);a.push({field:"startDate",value:t.startDate}),a.push({field:"endDate",value:t.endDate}),e.setState({exportFilters:a})},this.handleTransactionExport=()=>{let t=this.state,e=t.exportFilters,a=t.selected,n=H("a",a),s=(0,A.A)();s.filters=[...e,...n,{field:"detailed",value:!0}],s.exportExcel=!0,this.props.exportAccountTransactions(s)},this.handleSalesExport=()=>{let t=this.state.exportFilters,e=(0,A.A)();e.filters=[...t,{field:"detailed",value:!0}],e.exportExcel=!0,this.props.exportSalesTransactions(e)},this.handleCostOfSalesExport=()=>{let t=this.state.exportFilters,e=(0,A.A)();e.filters=[...t,{field:"detailed",value:!0}],e.exportExcel=!0,this.props.exportCostOfSalesTransactions(e)},this.accountActions=(t,e)=>(0,M.jsxs)(s.Fragment,{children:[(0,M.jsxs)(g.A,{"aria-label":"sales group",children:[(0,M.jsx)(C.A,{color:"inherit",variant:"outlined",endIcon:(0,M.jsx)($.A,{}),onClick:this.handleSalesExportOpen,children:"Sales"}),(0,M.jsx)(C.A,{color:"inherit",variant:"outlined",endIcon:(0,M.jsx)(Q,{}),onClick:this.handleCostOfSalesExportOpen,children:"Cost of sales"})]}),"\xa0\xa0",(0,M.jsx)(C.A,{color:"inherit",variant:"outlined",endIcon:(0,M.jsx)(D.A,{}),disabled:0===e.length,onClick:this.handleTransactionExportOpen,children:"Transactions"}),(0,M.jsx)(C.A,{color:"inherit",variant:"outlined",endIcon:(0,M.jsx)(D.A,{}),onClick:this.handleDownloadPage,children:"Account Balances"}),"\xa0\xa0",(0,M.jsxs)(g.A,{"aria-label":"finance group",children:[(0,M.jsx)(C.A,{color:"secondary",disabled:0===e.length||e.length>1,onClick:()=>this.handleUnlockConfirmation(S.Lhw.UNLOCK_FUNDS,e),children:"Unlock"}),(0,M.jsx)(C.A,{color:"secondary",disabled:0===e.length,onClick:()=>this.handleAdvanceConfirmation(S.Lhw.ADVANCE,e),children:"Advance"}),(0,M.jsx)(C.A,{color:"secondary",disabled:0===e.length,onClick:()=>this.handleWithdrawalConfirmation(S.Lhw.WITHDRAW,e),children:"Withdraw"})]})]}),this.isRequestValid=()=>{const t=this.state,e=t.request,a=t.selected;return!(0,u.default)(a)&&!(0,u.default)(e.transactionType)&&!(0,u.default)(e.description)&&!(0,u.default)(e.amount)&&e.amount>0},this.isUnlockAmountRequestValid=()=>{const t=this.state,e=t.request,a=t.selected;return!(0,u.default)(a)&&!(0,u.default)(e.transactionType)&&!(0,u.default)(e.newLockedAmount)&&e.newLockedAmount>=et&&e.newLockedAmount<=at},this._reloadData=()=>{let t=this.props.nav.adminTableMeta[p.Dx],e=(0,A.A)();(0,u.default)(t)||(e=(0,A.A)({},t.filters,t.page,t.pageSize,t.search,t.sortDirection,t.sortBy)),this.props.getAccountsPage(e)},this.handleDownloadPage=t=>{let e=this.props.nav.adminTableMeta[p.Dx];return t.filters=e.filters,t.exportExcel=!0,this.props.exportAccounts(t,G.saveAs)};let a=t.match.url,o=[],l=null,i=null,c=null;a.toLowerCase().includes("/".concat(p.wl,"/"))?(l=t.match.params.id,i=p.wl,c="#".concat(l),o.push({f
1ield:"companyid",value:l})):a.toLowerCase().includes("/".concat(p.ZZ,"/"))?(l=t.match.params.id,i=p.ZZ,c="#".concat(l),o.push({field:"storeid",value:l})):a.toLowerCase().includes("/".concat(p.Jr,"/"))&&(l=t.match.params.id,i=p.Jr,c="#".concat(l),o.push({field:"appuserid",value:l})),this.state={loading:!1,unlockOpen:!1,advanceOpen:!1,withdrawOpen:!1,cashCreditDebitOpen:!1,confirmOpen:!1,updateLockedAmountConfirmationOpen:!1,successOpen:!1,successUpdateLockedAmountOpen:!1,warningOpen:!1,exportOpen:!1,salesExportOpen:!1,costOfSalesExportOpen:!1,exportFilters:[],selected:[],withrawals:new Map,request:st,urlFilters:o,firstParentId:l,firstParentText:c,firstParentType:i},(0,u.default)(this.props.accountTypes.data)&&this.props.getAccountTypes()}componentDidUpdate(t){(0,w.A)(this.props.transactions,t.transactions)||this.setState({loading:!1,updateLockedAmountConfirmationOpen:!1,confirmOpen:!1}),(0,u.default)(this.props.transactions.success)||(this.setState({successOpen:!0}),this.props.clearTransactionSuccess(),this._reloadData())}getSelectedAccounts(){const t=this.props.accounts,e=this.state.selected;return!(0,u.default)(t.data)&&t.data.totalItems>0&&e.length>0?t.data.items.filter(t=>e.includes(t.id)):[]}componentWillUnmount(){this.handleAccountSelect([])}render(){const t=this.props,e=t.portal,a=t.auth,s=t.transactions,o=this.state,l=o.unlockOpen,i=o.withdrawOpen,c=o.advanceOpen,r=o.cashCreditDebitOpen,d=o.updateLockedAmountConfirmationOpen,A=o.confirmOpen,g=o.successUpdateLockedAmountOpen,C=o.successOpen,S=o.warningOpen,v=o.exportOpen,w=o.exportFilters,D=o.salesExportOpen,j=o.costOfSalesExportOpen,L=o.request,E=o.loading,P=o.urlFilters,F=o.firstParentId,W=o.firstParentText,U=o.firstParentType;let I="";(0,u.default)(e)||(0,u.default)(e.data)||(I=e.data.cca2);let N=[...P],_=(0,n.A)({},m.pUV);_.filter=null,_.apiEntity="".concat(p.wl,"/").concat(I);let R=(0,n.A)({},m.w1g);R.apiEntity="".concat(p.ZZ,"/").concat(I);let H=(0,n.A)({},m.Bq0);H.apiEntity="".concat(p.Jr,"/").concat(I);let V=(0,n.A)({},m.f_J);V.values=this.props.accountTypes.data,(0,u.default)(U)&&(N.push(H),N.push(_),N.push(R)),N.push(V),N.push(m.CcY),N.push(m.V_Z),N.push(m.lnM),N.push(m.YAs);let z=(0,b.A)(a,{isNormalUser:!0})&&(0,k.A)(a,{isAdministrator:!0,isManagementOperator:!0}),Z=(0,b.A)(a,{isNormalUser:!0})&&(0,k.A)(a,{isAdministrator:!0}),J=(0,b.A)(a,{isAdministrator:!0,isManagementOperator:!0}),K=w.find(t=>"startDate"===t.field),Y=w.find(t=>"endDate"===t.field),Q=(0,u.default)(K)||(0,u.default)(K.value)?null:B()(K.value),$=(0,u.default)(Y)||(0,u.default)(Y.value)?null:B()(Y.value);return(0,M.jsxs)(h.A,{type:p.Dx,linkText:"Accounts",firstParentId:F,firstParentText:W,firstParentType:U,currentBaseType:p.Dx,isReadOnly:z,children:[(0,M.jsx)(tt,{buildCustomTools:J?this.accountActions:null,selectedCallback:this.handleAccountSelect,type:p.Dx,tableData:this.props.accounts,getPage:this.props.getAccountsPage,filters:N,delete:this.props.deleteAccountsBulk,clearSuccess:this.props.clearAccountsSuccess,clearData:this.props.clearAccounts,firstParentId:F,firstParentType:U,isSearchable:!0,isEditable:!z,isDeletable:!Z,isDrillDown:!0}),(0,M.jsxs)(y.A,{open:l,onConfirmClick:this.handleUnlockLockedAmountConfirmationOpen,onCloseClick:this.handleUnlockClose,title:"Edit locked amount",confirmText:L.transactionType,confirmDisabled:!this.isUnlockAmountRequestValid(),loading:E,children:[(0,M.jsx)(f.A,{color:"secondary",children:this.dispalyTransactionMessage()}),(0,M.jsx)("br",{}),(0,M.jsxs)(f.A,{children:["Current locked amount: ",this.getCurrentLockedAmount()]}),(0,M.jsx)("br",{}),(0,M.jsx)(f.A,{children:"Update Locked amount to:"}),(0,M.jsx)(x.A,{variant:"standard",name:"newLockedAmount",label:"New locked amount",type:"number",fullWidth:!0,inputProps:{min:et,max:at},value:L.newLockedAmount,onChange:this.handleUnlockedAmountChange,margin:"normal"})]}),(0,M.jsxs)(y.A,{open:c,onConfirmClick:this.handleConfirmationOpen,onCloseClick:this.handleAdvanceClose,title:"".concat(L.transactionType," Transaction"),confirmText:L.transactionType,confirmDisabled:!this.isRequestValid(),children:[(0,M.jsx)(f.A,{children:this.dispalyTransactionMessage()}),(0,M.jsx)(x.A,{variant:"standard",name:"amount",label:"Amount to ".concat(L.transactionType.toLowerCase()),type:"number",fullWidth:!0,value:L.amount,onChange:this.handleChange,margin:"normal"}),(0,M.jsx)(x.A,{variant:"standard",name:"description",label:"Short reason for ".concat(L.transactionType.toLowerCase()),fullWidth:!0,value:L.description,onChange:this.handleChange,margin:"normal"})]}),(0,M.jsx)(q,{open:i,selectedAccounts:this.getSelectedAccounts(),onConfirmClick:this.handleWithdrawAllocate,onCloseClick:this.handleWithdrawClose,loading:E}),(0,M.jsxs)(y.A,{open:r,onConfirmClick:this.handleConfirmationOpen,onCloseClick:this.handleCashCreditDebitClose,title:"".concat(L.transactionType," Transaction"),confirmText:L.transactionType,confirmDisabled:!this.isRequestValid(),children:[(0,M.jsx)(f.A,{children:this.dispalyTransactionMessage()}),(0,M.jsx)(x.A,{variant:"standard",name:"amount",label:"Amount to ".concat(L.transactionType.toLowerCase()),type:"number",fullWidth:!0,value:L.amount,onChange:this.handleChange,margin:"normal"}),(0,M.jsx)(x.A,{variant:"standard",name:"description",label:"Short reason for ".concat(L.transactionType.toLowerCase()),fullWidth:!0,value:L.description,onChange:this.handleChange,margin:"normal"})]}),(0,M.jsxs)(y.A,{open:A,onConfirmClick:this.handleCreateTransaction,onCloseClick:this.handleConfirmationClose,title:"".concat(L.transactionType," Confirmation"),loading:E,children:[(0,M.jsxs)(f.A,{color:"secondary",children:[(0,M.jsx)(O.A,{style:{marginBottom:-5}})," Transaction cannot be undone!"]}),(0,M.jsx)("br",{}),(0,M.jsx)(f.A,{children:this.diplayConfirmationMessage()})]}),(0,M.jsxs)(y.A,{open:d,onConfirmClick:this.handleUpdateLockedAmount,onCloseClick:this.handleUnlockLockedAmountConfirmationClose,title:"".concat(L.transactionType," confirmation"),loading:E,children:[(0,M.jsxs)(f.A,{color:"secondary",children:[(0,M.jsx)(O.A,{style:{marginBottom:-5}})," Transaction cannot be undone!"]}),(0,M.jsx)("br",{}
1),(0,M.jsx)(f.A,{children:this.diplayUpdateLockedAmountConfirmationMessage()})]}),(0,M.jsx)(X,{open:v,onConfirmClick:this.handleTransactionExport,onCloseClick:this.handleTransactionExportClose,title:"Export Confirmation",confirmText:"Export",cancelText:"Cancel",confirmDisabled:3!==w.length,loading:s.loading,description:"You are about to export transactions for ".concat(this._getSelectedPhrase().toLowerCase(),". Select your export date range to continue."),onSetDateRange:this.setDateRange,startDate:Q,endDate:$,onDateTypeSelect:this.handleDateTypeSelect,onDateChange:this.handleDateChange,dateTypeSelectEnabled:!0,dateTypeOptions:m.ujU}),(0,M.jsx)(X,{open:D,onConfirmClick:this.handleSalesExport,onCloseClick:this.handleSalesExportClose,title:"Export Sales",confirmText:"Export",cancelText:"Cancel",confirmDisabled:3!==w.length,loading:s.loading,description:"You are about to export ALL sales transactions. Select your export date range to continue.",onSetDateRange:this.setDateRange,startDate:Q,endDate:$,onDateTypeSelect:this.handleDateTypeSelect,onDateChange:this.handleDateChange,dateTypeSelectEnabled:!0}),(0,M.jsx)(X,{open:j,onConfirmClick:this.handleCostOfSalesExport,onCloseClick:this.handleCostOfSalesExportClose,title:"Export Cost of Sales",confirmText:"Export",cancelText:"Cancel",confirmDisabled:3!==w.length,loading:s.loading,description:"You are about to export ALL cost of sales transactions. Select your export date range to continue.",onSetDateRange:this.setDateRange,startDate:Q,endDate:$,onDateTypeSelect:this.handleDateTypeSelect,onDateChange:this.handleDateChange,dateTypeSelectEnabled:!0}),(0,M.jsx)(T.A,{open:C,title:"Success",onCloseClick:this.successClose,children:this.dispalySuccessMessage()}),(0,M.jsx)(T.A,{open:g,title:"Success",onCloseClick:this.successUpdateLockedAmountClose,children:this.dispalySuccessMessage()}),(0,M.jsx)(T.A,{open:S,title:"Warning",onCloseClick:this.handleWarningClose,children:this.dispalyWarningMessage()})]})}}const st={amount:"",newLockedAmount:0,description:"",transactionType:""},ot=(0,o.Zz)(i.y,(0,l.Ng)(t=>({accounts:t.accounts,transactions:t.transactions,errors:t.errors,accountTypes:t.accountTypes,portal:t.portal,nav:t.nav,auth:t.auth}),{updateLockedAccountAmount:c.hw,getAccountsPage:c.Q9,getAccountTypes:d.t,deleteAccountsBulk:c.EU,clearAccountsSuccess:c.fJ,clearAccounts:c.ge,createTransaction:r.zS,clearTransactionSuccess:r.tu,exportAccountTransactions:r.Pi,exportSalesTransactions:r.SW,exportCostOfSalesTransactions:r.wv,exportAccounts:c.v8}))(nt)},73911(t,e,a){a.d(e,{A:()=>p});var n=a(80296),s=a(76998),o=a(51892),l=a(90492),i=a(83644),c=a(1808),r=a(35689),d=a(23446);const h=(0,o.A)({box:{marginBottom:"-15px !important"},input:{marginBottom:"-5px !important"},slider:{marginTop:"-10px !important"}});function p(t){let e=t.min,a=t.max,o=t.disabled,p=t.defaultValue,u=t.rowId,m=t.allocated,A=t.allocations,f=t.changeCallback;const g=h(),C=s.useState(p),x=(0,n.A)(C,2),y=x[0],S=x[1],v=(t,e)=>{let n=(0,c.default)(A.get(u))?0:A.get(u),s=m-n,o=e;s+e<=a||(o=a-s),S(o),f(u,o)};return(0,d.jsxs)(r.A,{className:g.box,children:[(0,d.jsx)(i.A,{className:g.input,value:y,margin:"dense",fullWidth:!0,disabled:o,onChange:t=>{let e=""===t.target.value?"":Number(t.target.value);v(0,e)},onBlur:()=>{y<0?(S(0),f(u,0)):y>a&&(S(a),f(u,a))},inputProps:{min:0,max:a,type:"number","aria-labelledby":"input-slider"}}),(0,d.jsx)(l.Ay,{className:g.slider,min:e,max:a,disabled:o,value:"number"===typeof y?y:0,valueLabelDisplay:"auto",onChange:(t,e)=>{S(e)},onChangeCommitted:v,"aria-labelledby":"input-slider"})]})}},88979(t,e,a){a.d(e,{A:()=>g});var n=a(89379),s=a(76998),o=a(28961),l=a(29386),i=a(64848),c=a(88171),r=a(99874),d=a(1808),h=a(51895);const p=(0,a(51892).A)(t=>({root:{display:"flex !important",flexWrap:"wrap !important"},formControl:{minWidth:"150px !important",width:"100% !important"},formControlFullWidth:{minWidth:"150px !important",width:"100% !important"},selectEmpty:{marginTop:"".concat(t.spacing(2)," !important"),fontSize:"".concat(h.Ef,"px !important")},select:{fontSize:"".concat(h.Ef,"px !important")},feedback:{},nothing:{color:"rgba(0, 0, 0, 0.40) !important",fontSize:"".concat(h.Ef,"px !important")},menuItem:{fontSize:"".concat(h.Ef,"px !important")}}));var u=a(34917),m=a(61140),A=a(23446);class f extends s.PureComponent{constructor(t){super(t),this.handleChange=t=>{this.props.onSelect&&this.props.onSelect({field:t.target.name,value:t.target.value}),this.setState({[t.target.name]:t.target.value})};let e="";(0,d.default)(this.props.value)||(e=this.props.value),this.state={[this.props.fieldName]:e}}componentDidUpdate(t){t.value!==this.props.value&&this.setState({[this.props.fieldName]:this.props.value})}render(){const t=this.props,e=t.classes,a=t.label,s=t.values,o=t.fieldName,h=t.floatLabel,p=t.materialIcon,f=t.handleBlur,g=t.disabled,C=t.fullWidth,x=t.errorMessage,y=t.hideNone,S=void 0!==y&&y;let v=!!(0,d.default)(h)||h,w=!(0,d.default)(g)&&g,T=(0,d.default)(p)?"expand_more":p;return(0,A.jsx)("div",{className:e.root,autoComplete:"off",children:(0,A.jsxs)(c.A,{variant:"standard",className:C?e.formControlFullWidth:e.formControl,error:!(0,d.default)(x),children:[v&&(0,A.jsx)(l.A,{htmlFor:o,children:a}),(0,A.jsxs)(r.A,{variant:"standard",disabled:w,displayEmpty:!v,name:o,id:o,IconComponent:t=>(0,A.jsx)(u.A,(0,n.A)((0,n.A)({},t),{},{children:T})),className:C?e.select:e.selectEmpty,value:null!==this.state[o]?this.state[o]:"",onCh
1ange:this.handleChange,onBlur:f,children:[S?(0,A.jsx)(A.Fragment,{}):v?(0,A.jsx)(i.A,{value:"",className:e.nothing,children:(0,A.jsx)("em",{children:"None"})}):(0,A.jsx)(i.A,{value:"",disabled:!0,className:e.nothing,children:a}),Array.isArray(s)&&s.length>0&&s.map(t=>{const a="string"===typeof t.value&&t.value.toLowerCase().includes("deprecated*");return(0,A.jsx)(i.A,{value:t.key,className:e.menuItem,disabled:a,children:t.value},t.key)})]}),(0,A.jsx)(m.A,{children:x})]})})}}const g=(0,o.A)(p)(f)},63659(t,e,a){a.d(e,{t:()=>l});var n=a(35264),s=a(1354),o=a(20756);const l=()=>t=>(0,n.A)().then(e=>e.get(o.HFj).then(e=>{t({type:s.pIj,payload:e.data})}).catch(e=>{t({type:s.FPn,payload:e.response})}))},48051(t,e,a){a.d(e,{EU:()=>C,P4:()=>u,Q9:()=>m,_m:()=>A,fJ:()=>x,ge:()=>y,hw:()=>g,v8:()=>v,z0:()=>f});var n=a(1354),s=a(20756),o=a(4419),l=a(19904),i=a(13703),c=a(14642),r=a(58364),d=a(1808),h=a(59981),p=a(35264);const u=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=>{(0,d.default)(t)||(t="/".concat(t));let a=r.A.getState().portal.data.cca2;return(0,p.A)().then(o=>o.get("".concat(s.A3t,"/").concat(a).concat(t)).then(t=>{e({type:n.OAJ,payload:t.data})}).catch(t=>{e({type:n.FPn,payload:t.response})}))}},m=t=>e=>S(t,e),A=(t,e)=>a=>{let o=r.A.getState().portal.data.cca2;return(0,p.A)().then(l=>l.post("".concat(s.A3t,"/").concat(o),t).then(t=>{a({type:n.a_b,payload:t.data}),e.push("/accounts/edit/"+t.data.id)}).catch(t=>{a({type:n.FPn,payload:t.response})}))},f=(t,e)=>a=>{let o=r.A.getState().portal.data.cca2;return(0,p.A)().then(l=>l.put("".concat(s.A3t,"/").concat(o,"/").concat(t),e).then(t=>{a({type:n.h52,payload:t.data})}).catch(t=>{a({type:n.FPn,payload:t.response})}))},g=(t,e)=>a=>(0,p.A)().then(o=>o.put(s.A3t+"/UpdateAccountAmount/"+t,e).then(t=>{a({type:n.kNU,payload:t.data})}).catch(t=>{a({type:n.FPn,payload:t.response})})),C=(t,e)=>a=>{let l=(0,c.A)(t),i=r.A.getState().portal.data.cca2;return(0,p.A)().then(c=>c.delete("".concat(s.A3t,"/").concat(i,"?").concat((0,o.A)(l))).then(e=>{a({type:n.jKe,payload:t})}).then(t=>{S(e,a)}).catch(t=>{a({type:n.FPn,payload:t.response})}))},x=()=>t=>{t({type:n.rse,payload:""})},y=()=>t=>{t({type:n.bmu,payload:""})};let S=(t,e)=>{let a=(0,l.A)(t),c=r.A.getState().portal.data.cca2;return(0,p.A)().then(l=>l.get("".concat(s.A3t,"/").concat(c,"?").concat((0,o.A)(a))).then(a=>{a=(0,i.A)(a,t),e({type:n.OAJ,payload:a.data})}).catch(t=>{e({type:n.FPn,payload:t.response})}))};const v=(t,e)=>a=>{let i=(0,l.A)(t),c=r.A.getState().portal.data.cca2;return(0,p.A)().then(t=>t.get("".concat(s.A3t,"/").concat(c,"?").concat((0,o.A)(i)),s.Fpe).then(t=>{let a=new Blob([t.data],h.PH);e(a,h.jz)}).catch(t=>{a({type:n.FPn,payload:t.response})}))}},7146(t,e,a){a.d(e,{$i:()=>b,B1:()=>S,Ec:()=>v,I0:()=>m,Pi:()=>g,Pv:()=>w,SW:()=>C,fh:()=>A,sJ:()=>f,tu:()=>k,wv:()=>x,zS:()=>y});var n=a(35264),s=a(1354),o=a(20756),l=a(5e4),i=a(59981),c=a(4419),r=a(19904),d=a(13703),h=a(58364),p=a(1808),u=a(54251);const m=t=>e=>{let a=h.A.getState().portal.data.cca2;return(0,n.A)().then(n=>n.get("".concat(o.ZK9,"/").concat(a,"/").concat(t)).then(t=>{e({type:s.ZSS,payload:t.data})}).catch(t=>{e({type:s.FPn,payload:t.response})}))},A=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=>T(null,t,e)},f=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a=>T(t,e,a)},g=t=>e=>{let a=(0,r.A)(t),l=h.A.getState().portal.data.cca2;return D(e,!0),(0,n.A)().then(t=>t.get("".concat(o.ZK9,"/").concat(l,"?").concat((0,c.A)(a)),o.Fpe).then(t=>{let a=new Blob([t.data],i.PH);(0,u.saveAs)(a,i.it),D(e,!1)}).catch(t=>{e({type:s.FPn,payload:t.response}),D(e,!1)}))},C=t=>e=>{let a=(0,r.A)(t),l=h.A.getState().portal.data.cca2;return D(e,!0),(0,n.A)().then(t=>t.get("".concat(o.ZK9,"/").concat(l,"/sales?").concat((0,c.A)(a)),o.Fpe).then(t=>{let a=new Blob([t.data],i.PH);(0,u.saveAs)(a,i.it),D(e,!1)}).catch(t=>{e({type:s.FPn,payload:t.response}),D(e,!1)}))},x=t=>e=>{let a=(0,r.A)(t),l=h.A.getState().portal.data.cca2;return D(e,!0),(0,n.A)().then(t=>t.get("".concat(o.ZK9,"/").concat(l,"/costs?").concat((0,c.A)(a)),o.Fpe).then(t=>{let a=new Blob([t.data],i.PH);(0,u.saveAs)(a,i.it),D(e,!1)}).catch(t=>{e({type:s.FPn,payload:t.response}),D(e,!1)}))},y=(t,e)=>a=>{let i=h.A.getState().portal.data.cca2;return(0,n.A)().then(n=>n.post("".concat(o.ZK9,"/").concat(i),t).then(n=>{switch(a({type:s.VAA,payload:n.data}),t.transactionType){case o.Lhw.CREDIT:case o.Lhw.DEBIT:e.push("/".concat(l.Dx));break;case o.Lhw.DEPOSIT:e.push("/".concat(l.JH,"/").concat(t.fundsReceivedId,"/").concat(l.JB));break;case o.Lhw.WITHDRAW:e.push("/".concat(l.DU));break;case o.Lhw.ADVANCE:e.push("/".concat(l.s6))}}).catch(t=>{a({type:s.FPn,payload:t.response})}))},S=(t,e)=>e=>{let a=h.A.getState().portal.data.cca2;return(0,n.A)().then(n=>n.post("".concat(o.KyF,"/").concat(a),t).then(t=>{e({type:s.VAA,payload:t.data})}).catch(t=>{e({type:s.FPn,payload:t.response})}))},v=t=>e=>{let a=h.A.getState().portal.data.cca2;return(0,n.A)().then(n=>n.put("".concat(o.ZK9,"/").concat(a,"/").concat(t.transactionId),t).then(t=>{e({type:s.mD2,payload:t.data})}).catch(t=>{e({type:s.FPn,payload:t.response})}))},w=t=>e=>{let a=h.A.getState().portal.data.cca2;return(0,n.A)().then(n=>n.put("".concat(o.JRD).concat(o.ZK9,"/").concat(a),t).then(t=>{e({type:s.Vyi,payload:t.data})}).catch(t=>{e({type:s.FPn,payload:t.response})}))};let T=(t,e,a)=>{let l=(0,r.A)(e);(0,p.default)(t)||l.push({field:"a",value:[t]});let i=h.A.getState().portal.data.cca2;return(0,n.A)().then(t=>t.get("".concat(o.ZK9,"/").concat(i,"?").concat((0,c.A)(l))).then(t=>{t=(0,d.A)(t,e),a({type:s.ZSS,payload:t.data})}).catch(t=>{a({type:s.FPn,payload:t.response})}))};const b=()=>t=>{t({type:s.urw,payload:""})},k=()=>t=>{t({type:s.UYI,payload:""})},D=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t({type:s.CIJ,payload:e})}},57252(t,e,a){a.d(e,{A:()=>i});var n=a(1808),s=a(20756),o=a(25443),l=a.n(o);const i=(t,e,a,o)=>{let i=null;!(0,n.default)(a)&&a._isValid&&a.isValid()&&(i=a.format(s.DXO));let c=o.filter(e=>e.field!==t);
1if(null!==i&&c.push({field:t,value:i}),t.toLowerCase().includes("start")&&null!==i&&a){let t=o.find(t=>t.field===e);if(!(0,n.default)(t)&&!(0,n.default)(t.value)){let n=l()(t.value);n.isValid()&&a.isAfter(n)&&(c=c.filter(t=>t.field!==e))}}return c}},47742(t,e,a){a.d(e,{A:()=>o});var n=a(64172),s=a(23446);const o=(0,n.A)((0,s.jsx)("path",{d:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z"}),"SaveAlt")}}]); 2//# sourceMappingURL=3957.4c6d279f.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.