1(this["webpackJsonpapp-yoosh"]=this["webpackJsonpapp-yoosh"]||[]).push([[27],{1013:function(e,t,a){"use strict";a.d(t,"a",(function(){return S}));var n=a(9),c=a(124),r=a(122),s=a(5),i=a(1),l=a(52),o=a(979),d=a(54),j=a(15),u=a(0);var b=function(e){var t=Object(l.a)(),a=Object(j.c)(Object(d.c)(t.palette.primary.main));return Object(u.jsx)("div",{className:e.classes.header,children:e.header&&Object(u.jsx)(o.a,{theme:a,children:e.header})})},p=a(2),m=a(14),h=a(137),O=a(1002),x=a(1003);var f=function(e){var t=Object(l.a)(),a=Object(j.c)(Object(d.c)(t.palette.primary.main)),n=e.classes;return Object(u.jsxs)(u.Fragment,{children:[e.header&&Object(u.jsx)(o.a,{theme:a,children:Object(u.jsx)("div",{className:Object(s.a)(n.sidebarHeader,e.variant),children:e.header})}),e.content&&Object(u.jsx)(c.a,{className:n.sidebarContent,enable:e.innerScroll,children:e.content})]})};function y(e,t){var a=Object(i.useState)(!1),n=Object(m.a)(a,2),c=n[0],r=n[1],l=e.classes;Object(i.useImperativeHandle)(t,(function(){return{toggleSidebar:o}}));var o=function(){r(!c)};return Object(u.jsxs)(u.Fragment,{children:[Object(u.jsx)(O.a,{lgUp:"permanent"===e.variant,children:Object(u.jsx)(x.a,{variant:"temporary",anchor:e.position,open:c,onOpen:function(e){},onClose:function(e){return o()},disableSwipeToOpen:!0,classes:{root:Object(s.a)(l.sidebarWrapper,e.variant),paper:Object(s.a)(l.sidebar,e.variant,"left"===e.position?l.leftSidebar:l.rightSidebar)},ModalProps:{keepMounted:!0},container:e.rootRef.current,BackdropProps:{classes:{root:l.backdrop}},style:{position:"absolute"},children:Object(u.jsx)(f,Object(p.a)({},e))})}),"permanent"===e.variant&&Object(u.jsx)(O.a,{mdDown:!0,children:Object(u.jsx)(h.a,{variant:"permanent",className:Object(s.a)(l.sidebarWrapper,e.variant),open:c,classes:{paper:Object(s.a)(l.sidebar,e.variant,"left"===e.position?l.leftSidebar:l.rightSidebar)},children:Object(u.jsx)(f,Object(p.a)({},e))})})]})}var N=Object(i.forwardRef)(y),g=200,v=Object(r.a)((function(e){return{"@global":{"#fuse-main":{height:function(e){return e.innerScroll&&"100vh"}}},root:{display:"flex",flexDirection:"row",minWidth:0,minHeight:"100%",position:"relative",flex:"1 1 auto",height:"auto",backgroundColor:e.palette.background.default},innerScroll:{height:"100%"},topBg:{position:"absolute",left:0,right:0,top:0,height:g,background:"linear-gradient(to right, ".concat(e.palette.primary.dark," 0%, ").concat(e.palette.primary.main," 100%)"),backgroundSize:"cover",pointerEvents:"none"},contentWrapper:Object(n.a)({display:"flex",flexDirection:"column",padding:"0 3.2rem",flex:"1 1 100%",zIndex:2,maxWidth:"100%",minWidth:0,minHeight:0},e.breakpoints.down("xs"),{padding:"0 1.6rem"}),header:{height:136,minHeight:136,maxHeight:136,display:"flex",color:e.palette.primary.contrastText},headerSidebarToggleButton:{color:e.palette.primary.contrastText},contentCard:{display:"flex",flex:"1 1 100%",flexDirection:"column",backgroundColor:e.palette.background.paper,boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",minHeight:0,borderRadius:"20px 20px 0 0"},toolbar:{height:64,minHeight:64,display:"flex",alignItems:"center",borderBottom:"1px solid ".concat(e.palette.divider)},content:{flex:"1 1 auto",height:"100%",overflow:"auto","-webkit-overflow-scrolling":"touch"},sidebarWrapper:{position:"absolute",backgroundColor:"transparent",zIndex:5,overflow:"hidden","&.permanent":Object(n.a)({},e.breakpoints.up("lg"),{zIndex:1,position:"relative"})},sidebar:{position:"absolute","&.permanent":Object(n.a)({},e.breakpoints.up("lg"),{backgroundColor:"transparent",position:"relative",border:"none",overflow:"hidden"}),width:240,height:"100%"},leftSidebar:{},rightSidebar:{},sidebarHeader:{height:g,minHeight:g,color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.dark,"&.permanent":Object(n.a)({},e.breakpoints.up("lg"),{backgroundColor:"transparent"})},sidebarContent:Object(n.a)({display:"flex",flex:"1 1 auto",flexDirection:"column",backgroundColor:e.palette.background.default,color:e.palette.text.primary},e.breakpoints.up("lg"),{overflow:"auto","-webkit-overflow-scrolling":"touch"}),backdrop:{position:"absolute"}}})),_=Object(i.forwardRef)((function(e,t){var a=Object(i.useRef)(null),n=Object(i.useRef)(null),r=Object(i.useRef)(null),l=v(e),o=e.rightSidebarHeader||e.rightSidebarContent,d=e.leftSidebarHeader||e.leftSidebarContent;return Object(i.useImperativeHandle)(t,(function(){return{rootRef:r,toggleLeftSidebar:function(){a.current.toggleSidebar()},toggleRightSidebar:function(){n.current.toggleSidebar()}}})),Object(u.jsxs)("div",{className:Object(s.a)(l.root,e.innerScroll&&l.innerScroll),ref:r,children:[Object(u.jsx)("div",{className:l.topBg}
1),Object(u.jsxs)("div",{className:"flex container w-full",children:[d&&Object(u.jsx)(N,{position:"left",header:e.leftSidebarHeader,content:e.leftSidebarContent,variant:e.leftSidebarVariant||"permanent",innerScroll:e.innerScroll,classes:l,ref:a,rootRef:r}),Object(u.jsxs)("div",{className:Object(s.a)(l.contentWrapper,d&&(void 0===e.leftSidebarVariant||"permanent"===e.leftSidebarVariant)&&"lg:ltr:pl-0 lg:rtl:pr-0",o&&(void 0===e.rightSidebarVariant||"permanent"===e.rightSidebarVariant)&&"lg:pr-0"),children:[Object(u.jsx)(b,{header:e.header,classes:l}),Object(u.jsxs)("div",{className:Object(s.a)(l.contentCard,e.innerScroll&&"inner-scroll"),children:[e.contentToolbar&&Object(u.jsx)("div",{className:l.toolbar,children:e.contentToolbar}),e.content&&Object(u.jsx)(c.a,{className:l.content,enable:e.innerScroll,scrollToTopOnRouteChange:e.innerScroll,children:e.content})]})]}),o&&Object(u.jsx)(N,{position:"right",header:e.rightSidebarHeader,content:e.rightSidebarContent,variant:e.rightSidebarVariant||"permanent",innerScroll:e.innerScroll,classes:l,ref:n,rootRef:r})]})]})}));_.defaultProps={};var S=Object(i.memo)(_)},1101:function(e,t,a){"use strict";var n=a(287),c=a(2),r=a(14),s=a(51),i=(a(22),a(980)),l=a(1007),o=a(150),d=a(194),j=a(282),u=a(283),b=a(430),p=a(34),m=a(123),h=a(1008),O=a(151),x=a(365),f=a(935),y=a(113),N=a(606),g=a(122),v=a(52),_=a(1),S=a(15),w=a(366),E=(a(90),a(178),a(5)),C=a(3);function T(e,t){var a=String(t.length).pad(2);return String(e+a+t)}function A(e){var t=T("00","01"),a=T("01",e.amount||""!==e.amount?"12":"11"),n=T("00","hk.com.hkicl"),c="";switch(e.account){case"02":c=T("02",e.fps_id);break;case"03":c=T("01",e.bank_code)+T("03","+852-".concat(e.mobile));break;case"04":c=T("01",e.bank_code)+T("04",e.email.toUpperCase())}var r=T("26",n+c),s=T("53","344"),i=""===e.amount?"":T("54",e.amount),l=T("58","HK"),o=e.merchantName?T("59",e.merchantName):T("59","NA"),d=e.merchantCity?T("60",e.merchantCity):T("60","HK"),j="",u=(e.billNum&&(j+=T("01",e.billNum)),e.reference&&(j+=T("05",e.reference)),e.customer&&(j+=T("06",e.customer)),j.length>0&&T("62",j),"");u+=t,u+=a,u+=r,u+="52040000",u+=o,u+=d,u+=l,u+=s,u+=i;var b=function(e){var t,a,n=65535;for(a=0;a<e.length;a++){if((t=e.charCodeAt(a))>255)throw new RangeError;n=L[255&(t^n>>8)]^n<<8}return 65535&(0^n)}(u+="6304").toString(16).pad(4).toUpperCase();return"".concat(u).concat(b)}String.prototype.pad=function(e){for(var t=this;t.length<(e||2);)t="0".concat(t);return t};var L=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],I=a(40),P=a(97),R=a(21),U=a(61),k=a(216),D=a(0),M=Object(g.a)({root:{"& .MuiTextField-root":{"& input::-webkit-clear-button, & input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button":{display:"none"}}}
1,avatar:{border:"2px solid black"},backDrop:{backdropFilter:"blur(3px)",backgroundColor:"rgba(0,0,30,0.4)"},qrPaper:{width:"300px"}}),z="e_Payment";t.a=function(e){var t=Object(S.b)(),a=Object(w.a)("billingApp").t,g=Object(v.a)(),T=M(g),L=Object(S.c)((function(e){var t=e.auth;return t.business.selectedBusiness?t.business.selectedBusiness:null})),F=(Object(S.c)((function(e){var t=e.auth;return t.business.selectedLocation?t.business.selectedLocation:null})),Object(S.c)((function(e){var t=e.auth;return t.user.locale?t.user.locale:"en-US"}))),q=Object(S.c)(U.u),Y=Object(S.c)((function(e){var t=e.billingApp;return t?t.payments.paymentDialog:null})),H=Object(s.c)(null),Q=H.form,B=H.handleChange,W=H.setForm,V=H.setInForm,$=Object(_.useState)({title:"",msg:null}),G=Object(r.a)($,2),J=G[0],K=G[1],X=Object(_.useState)(null),Z=Object(r.a)(X,2),ee=Z[0],te=Z[1],ae=Object(_.useState)(""),ne=Object(r.a)(ae,2),ce=ne[0],re=ne[1],se=Object(_.useState)(!1),ie=Object(r.a)(se,2),le=ie[0],oe=ie[1],de=Object(_.useState)((function(){return function(){}})),je=Object(r.a)(de,2),ue=je[0],be=je[1],pe=Object(_.useState)(!1),me=Object(r.a)(pe,2),he=me[0],Oe=me[1],xe=function(e){e||"fps"!==Q.type||V("type",""),Oe(e)},fe=L&&L.custom&&L.custom.payments?L.custom.payments:null;L.data&&L.data.payments&&L.data.payments.stripe&&L.data.payments.stripe.id;var ye=null;function Ne(){return t(Object(k.h)())}function ge(e){var a={profile_id:e.profile_id,order_id:e.order_id,bill_to:e.bill_to};switch(e.tempNotes&&(a.notes=[{date:(new Date).toISOString(),text:e.tempNotes.text}]),e.type.toUpperCase()){case"CASH":t(Object(k.m)(Object(c.a)(Object(c.a)({},a),{},{method:"cash",data:{amount:e.amount,currency_code:e.currency_code}}))).then((function(e){e.payload&&e.payload.id&&Ne()}));break;case"CHEQUE":t(Object(k.m)(Object(c.a)(Object(c.a)({},a),{},{method:"cheque",data:{cheque_num:e.payData.cheque,amount:e.amount,currency_code:e.currency_code}}))).then((function(e){e.payload&&e.payload.id&&Ne()}));break;case"CREDIT_CARD":t(Object(k.m)(Object(c.a)(Object(c.a)({},a),{},{method:"creditcard",data:{transaction:e.payData.creditcard,amount:e.amount,currency_code:e.currency_code}}))).then((function(e){e.payload&&e.payload.id&&Ne()}));break;case"STRIPE":case"E_PAYMENT":t(Object(k.m)(Object(c.a)(Object(c.a)({},a),{},{method:"stripe",data:{transaction:e.payData.stripe,amount:(+e.amount).toFixed(2),currency_code:e.currency_code},qrCode:e.qrCode}))).then((function(t){e.qrCode&&t.payload&&t.payload.stripeURL?(K({title:"e_Payment",msg:t.payload.stripeURL}),xe(!0)):Ne()}))}}var ve=Object(_.useCallback)((function(){if(("pay"===Y.type||"refund"===Y.type)&&Y.data){var e=q.find((function(e){return e.id.toUpperCase()===Y.data.profile_id.toUpperCase()})),t=q.find((function(e){return e.id.toUpperCase()===Y.data.bill_to.toUpperCase()})),a={date:null,text:null};if(Y.data.notes&&Y.data.notes.length>0){var r=Object(n.a)(Y.data.notes);a=r[0],r.slice(1)}W(Object(c.a)(Object(c.a)({},Y.data),{},{orders:Y.data.order_id.join("-"),type:ee?ee[0]:"",payData:{cheque:null,creditcard:null,stripe:null},profile:e,billToProfile:t,tempNotes:a}))}}),[Y.data,Y.type,t,W]);return Object(_.useEffect)((function(){var e=null,t=new Set(["cash","cheque","credit_card"]),a=L&&L.plan_info?L.plan_info.limit:null;Y.props.open&&(fe.options&&(e=a&&a.epayment&&fe.options.includes(z)&&L.accountStatus&&"active"===L.accountStatus?fe.options:fe.options.filter((function(e){return e!==z}))),Object(P.a)(I.e.PAYMENT,I.c.PAY)?te(e):te(e.filter((function(e){return!t.has(e)}))),ve())}),[Y.props.open,ve]),Q&&Y.data?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(j.a,Object(c.a)(Object(c.a)({},Y.props),{},{onClose:Ne,fullWidth:!0,maxWidth:"sm",classes:{paper:"rounded-8"},PaperProps:{style:{overflow:"initial",border:"2px solid orange"}},children:[Object(D.jsx)(i.a,{className:"dialogHeader dialogHeaderShadow",position:"static",elevation:1,children:Object(D.jsxs)(f.a,{className:"flex justify-between w-full",children:[Object(D.jsxs)("div",{className:"flex items-center dialogProfileHeader",children:[Object(D.jsx)(N.a,{title:Q.profile_id?Q.profile_id:"",children:Object(D.jsx)(l.a,{className:Object(E.a)(T.avatar,"mx-8 items-center"),src:Q.profile?Q.profile.photo_url:"assets/images/avatars/profile.jpg"})}),Object(D.jsx)(y.a,{className:"h3",color:"inherit",children:Q.profile?" ".concat(Q.profile.last_name,", ").concat(Q.profile.first_name):" ".concat(Q.profile_id)})]}),Object(D.jsx)("div",{className:"flex items-center",children:Object(D.jsx)(y.a,{color:"primary",className:"dialogSwitch",children:Object(D.jsx)(m.a,{onClick:function(){return Ne()},children:Object(D.jsx)(p.a,{style:{color:d.a[500]},children:"close"})})})})]})}),Object(D.jsxs)(u.a,{classes:{root:"p-0"},children:[Object(D.jsx)("div",{className:"mb-8 w-full",children:Object(D.jsxs)("div",{className:"flex items-center justify-between p-16",children:[Object(D.jsx)("div",{className:"px-16 h3",children:a("MAKE_PAYMENT")}),Object(D.jsx)("div",{className:"flex items-center justify-start mr-12",children:Object(D.jsx)(y.a,{className:"h4 viewLabels",children:"".concat(function(e){if(e){var t=q.find((function(t){return t.id.toUpperCase()===e.toUpperCase()}));if(t)return"".concat(t.last_name,", ").concat(t.first_name)}return""}(Q.bill_to)," (").concat(Q.currency_code,")")})})]})}),Object(D.jsxs)("div",{className:"mb-12 px-16 sm:px-24 w-full",children:[Object(D.jsx)(b.a,{className:"mb-8"}),Object(D.jsxs)("div",{className:"flex items-center justify-center p-16",children:[Object(D.jsx)(y.a,{className:"h3 viewLabels mr-8",children:"".concat(a("ORDER"),": ")}),Object(D.jsx)("div",{children:Q.order_id.map((function(e,t){return Object(D.jsx)(h.a,{label:e,className:"mr-4 my-4 h4",classes:{label:"px-8"},size:"small",variant:"outlined",color:"primary"},t)}))})]}),Object(D.jsx)("div",{className:"flex items-center justify-center mb-16 px-16 sm:px-24",children:Object(D.jsx)(y.a,{className:"text-48 font-semibold",color:"primary",children:Object(C.w)({currencyLocale:F,currencyCode:Q.currency_code,value:Q.amount})})}),Object(D.jsx)("div",{className:"flex items-center justify-center mb-16 px-16 sm:px-24",children:Object(D.jsx)(O.a,{className:"fieldElement",label:a("PAYMENT_TYPE"),id:"type",name:"type",value:Q.type,onCh
1ange:function(e){return function(e){var t=e.target.value;"stripe"!==t&&"e_payment"!==t||(R.ib.includes(Q.currency_code.toUpperCase())?(console.log("no *100 currency required",Q.currency_code),Q.amount):Q.amount);V("type",t)}(e)},variant:"outlined",size:"small",select:!0,children:ee.map((function(e,t){return Object(D.jsx)(x.a,{value:e,children:a(e.toUpperCase())},t)}))})}),"cheque"===Q.type&&Object(D.jsx)("div",{className:"flex items-center justify-center mb-16 px-16 sm:px-24",children:Object(D.jsx)(O.a,{label:a("CHEQUE_NUM"),name:"payData.cheque",id:"cheque",variant:"outlined",size:"small",fullWidth:!0,value:Q.payData.cheque||"",onChange:B})}),"credit_card"===Q.type&&Object(D.jsx)("div",{className:"flex items-center justify-center mb-16 px-16 sm:px-24",children:Object(D.jsx)(O.a,{label:a("TRANSACTION_NUM"),name:"payData.creditcard",id:"creditcard",variant:"outlined",size:"small",fullWidth:!0,value:Q.payData.creditcard||"",onChange:B})}),Object(D.jsx)("div",{className:"flex items-center justify-center mb-16 px-16 sm:px-24",children:Object(D.jsx)(O.a,{label:a("NOTES"),className:"fieldElement",variant:"outlined",size:"small",name:"tempNotes.text",value:null!==Q.tempNotes.text?Q.tempNotes.text:"",onChange:B,multiline:!0,rows:3})}),Object(D.jsxs)("div",{className:"flex items-center justify-center mb-16 px-16 sm:px-24",children:[("fps"===Q.type||"e_Payment"===Q.type)&&Object(D.jsx)(o.a,{variant:"contained",color:"secondary",onClick:function(e){e.preventDefault(),"fps"===Q.type?!0?(ye=A(Object(c.a)(Object(c.a)({},fe.fps),{},{merchantName:L.business_name,amount:Q.amount.toString(),customer:Q.profile_id,billNum:Q.orders})),K({title:"fps",msg:ye}),xe(!0),V("type","fps")):(K(null),xe(!1)):"e_Payment"===Q.type&&ge(Object(c.a)(Object(c.a)({},Q),{},{qrCode:!0}))},children:a("PAY_QRCODE")}),"fps"!==Q.type&&Object(D.jsx)(o.a,{className:"mx-12",variant:"contained",color:"secondary",onClick:function(e){var t,n;e.preventDefault(),"e_Payment"===Q.type?ge(Object(c.a)(Object(c.a)({},Q),{},{qrCode:!1})):(t=a("PAY"),n=function(){ge(Q)},re(t),be((function(){return n})),oe(!0))},disabled:!Q.type||""===Q.type,children:a("PAY_NOW")})]})]})]})]})),Object(D.jsx)(C.e,{title:J.title,fpsQR:J.msg,open:he,setOpen:xe,onConfirm:function(){return"fps"===J.title?function(e){var a={profile_id:e.profile_id,order_id:e.order_id,bill_to:e.bill_to};e.tempNotes&&(a.notes=[{date:(new Date).toISOString(),text:e.tempNotes.text}]),Object(P.a)(I.e.PAYMENT,I.c.PAY)?t(Object(k.m)(Object(c.a)(Object(c.a)({},a),{},{method:"fps",data:{amount:e.amount,currency_code:e.currency_code}}))).then((function(e){e.payload&&e.payload.id&&Ne()})):Ne()}(Q):Ne()},showConfirm:Object(P.a)(I.e.PAYMENT,I.c.PAY)}),Object(D.jsx)(C.a,{title:ce,open:le,setOpen:oe,onConfirm:ue,noLabel:a("NO"),yesLabel:a("YES"),children:Q.order_id.map((function(e,t){return"".concat(e," ")}))})]}):null}},1143:function(e,t,a){"use strict";var n=a(2),c=a(14),r=a(51),s=a(22),i=a(980),l=a(1007),o=a(150),d=a(111),j=a(148),u=a(194),b=a(135),p=a(282),m=a(283),h=a(430),O=a(34),x=a(123),f=a(1008),y=a(935),N=a(113),g=a(606),v=a(122),_=a(52),S=a(1),w=a(15),E=a(366),C=(a(178),a(5)),T=a(126),A=a(90),L=a(3),I=a(40),P=a(97),R=a(61),U=a(169),k=a(216),D=a(0),M=Object(v.a)({root:{"& .MuiTextField-root":{"& input::-webkit-clear-button, & input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button":{display:"none"}}},avatar:{border:"2px solid black"}});t.a=function(e){var t=Object(w.b)(),a=Object(E.a)("billingApp").t,v=Object(_.a)(),z=M(v),F=Object(w.c)((function(e){var t=e.auth;return t.business.selectedLocation?t.business.selectedLocation:null})),q=Object(w.c)((function(e){var t=e.auth;return t.user.locale?t.user.locale:"en-US"})),Y=(Object(w.c)((function(e){var t=e.calendarApp;return t.events.timezone?t.events.timezone:"local"})),Object(w.c)(R.u)),H=Object(w.c)((function(e){var t=e.billingApp;return t?t.payments.paymentDialog:null})),Q=Object(r.c)(null),B=Q.form,W=(Q.handleChange,Q.setForm),V=(Q.setInForm,Object(S.useState)(null)),$=Object(c.a)(V,2),G=($[0],$[1],Object(S.useState)("")),J=Object(c.a)(G,2),K=J[0],X=J[1],Z=Object(S.useState)(!1),ee=Object(c.a)(Z,2),te=ee[0],ae=ee[1],ne=Object(S.useState)((function(){return function(){}})),ce=Object(c.a)(ne,2),re=ce[0],se=ce[1];function ie(){return t(Object(k.i)())}var le,oe,de,je=Object(S.useCallback)((function(){var e=null;"view"===H.type&&H.data&&t(Object(k.k)([H.data.payment_id])).then((function(t){if(t.payload){var c=t.payload[0];c.sent&&(e=s.a.sortBy(c.sent,["date"])),W(Object(n.a)(Object(n.a)({},c),{},{sent:e}))}else Object(L.i)("error",a("ERROR_RETRIEVING_DATA"))}))}),[H.data,H.type,t,W]);return Object(S.useEffect)((function(){H.props.open&&je()}),[H.props.open,je]),B&&H.data?Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(p.a,Object(n.a)(Object(n.a)({},H.props),{},{onClose:ie,fullWidth:!0,maxWidth:"sm",classes:{paper:"rounded-8"}
1,PaperProps:{style:{overflow:"initial",border:"2px solid orange"}},children:[Object(D.jsx)(i.a,{className:"dialogHeader dialogHeaderShadow",position:"static",elevation:1,children:Object(D.jsxs)(y.a,{className:"flex justify-between w-full",children:[Object(D.jsxs)("div",{className:"flex items-center dialogProfileHeader",children:[Object(D.jsx)(g.a,{title:B.profile_id?B.profile_id:"",children:Object(D.jsx)(l.a,{className:Object(C.a)(z.avatar,"mx-8 items-center"),src:H.data.profileInfo?H.data.profileInfo.photo_url:"assets/images/avatars/profile.jpg"})}),Object(D.jsx)(N.a,{className:"h3",color:"inherit",children:H.data.profileInfo?" ".concat(H.data.profileInfo.last_name,", ").concat(H.data.profileInfo.first_name):" ".concat(B.profile_id)})]}),Object(D.jsx)("div",{className:"flex items-center",children:Object(D.jsx)(x.a,{onClick:function(){return ie()},children:Object(D.jsx)(O.a,{style:{color:u.a[500]},children:"close"})})})]})}),Object(D.jsxs)(m.a,{classes:{root:"p-0"},children:[Object(D.jsx)("div",{className:"mb-8 w-full",children:Object(D.jsxs)("div",{className:"flex items-center justify-between p-16",children:[Object(D.jsx)("div",{className:"px-16 h3",title:B.id,children:B.id}),Object(D.jsxs)("div",{className:"flex items-center justify-start mr-12",children:[(de=B.sent,de&&de.length>1?Object(D.jsx)(O.a,{className:"mx-12 valign-icon",fontSize:"medium",style:{color:d.a[500]},children:"forward_to_inbox"}):Object(D.jsx)(O.a,{className:"mx-12 valign-icon",fontSize:"medium",style:{color:j.a[500]},children:"forward_to_inbox"})),Object(L.D)(B.status,"medium")]})]})}),Object(D.jsxs)("div",{className:"mb-12 px-16 sm:px-24 w-full",children:[Object(D.jsx)(h.a,{className:"mb-8"}),Object(D.jsxs)("table",{children:[Object(D.jsxs)("colgroup",{children:[Object(D.jsx)("col",{style:{width:"50%"}}),Object(D.jsx)("col",{style:{width:"50%"}})]}),Object(D.jsxs)("tbody",{children:[Object(D.jsxs)("tr",{children:[Object(D.jsxs)("td",{className:"alignLeft",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("AMOUNT")}),"refund"===B.type?Object(D.jsx)(N.a,{className:"h3 py-6",style:{color:b.a[500]},children:Object(L.v)({currencyLocale:q,currencyCode:B.currency_code}).format(-B.amount)}):Object(D.jsx)(N.a,{className:"h3 py-6",children:Object(L.v)({currencyLocale:q,currencyCode:B.currency_code}).format(B.amount)})]}),Object(D.jsxs)("td",{className:"alignLeft",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("ORDERS")}),Object(D.jsx)(N.a,{className:"h3 py-8",children:function(e){if(e){var t=null;return e.map((function(e){e&&(t=t?"".concat(t,", ").concat(e.order_id):e.order_id)})),t}return"-"}(B.order_id)})]})]}),Object(D.jsxs)("tr",{children:[Object(D.jsxs)("td",{className:"alignLeft",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("TYPE")}),Object(D.jsxs)(N.a,{className:"h3 py-4",children:[B.type&&"payment"!==B.type?"".concat(a(B.type.toUpperCase()),": "):"",a(B.method.toUpperCase())]}),(oe={method:B.method,data:B.data},"cheque"===oe.method?Object(D.jsxs)("span",{children:["#",oe.data.cheque_num]}):null)]}),Object(D.jsxs)("td",{className:"alignLeft",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("DATE")}),Object(D.jsx)(N.a,{className:"h3 py-4",children:Object(T.a)(B.created,"PPp",q)})]})]}),Object(D.jsxs)("tr",{children:[Object(D.jsxs)("td",{className:"alignLeft",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("BILL_TO")}),Object(D.jsx)(N.a,{className:"h3 py-4",children:function(e){if(e){var t=Y.find((function(t){return t.id.toUpperCase()===e.toUpperCase()}));if(t)return"".concat(t.last_name,", ").concat(t.first_name)}return"-"}(B.bill_to)})]}),Object(D.jsxs)("td",{className:"alignLeft",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("LOCATION_ID")}),Object(D.jsx)(N.a,{className:"h3 py-4",children:(le=B.location_id,le?F.location_id===le[0]?F.name:le[0].toUpperCase():"-")})]})]}),Object(D.jsx)("tr",{children:Object(D.jsxs)("td",{className:"alignLeft",colSpan:"2",children:[Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("SENT")}),Object(D.jsxs)(N.a,{component:"span",className:"h3 py-8",children:[B.sent&&B.sent.length>1?"":"-",B.sent&&B.sent.map((function(e,t){return Object(D.jsx)(f.a,{label:"".concat(Object(T.a)(e.date,"Pp",q)," : ").concat(e.channel),className:"mr-4 my-4",classes:{label:"px-8"},size:"small",variant:"outlined",color:"primary"},t)}))]})]})}),Object(D.jsx)("tr",{children:Object(D.jsx)("td",{className:"alignLeft",colSpan:"2",children:Object(D.jsx)(N.a,{className:"h4 viewLabels",color:"textSecondary",children:a("NOTES")})})}),B.notes&&B.notes.map((function(e,t){return Object(D.jsx)("tr",{children:Object(D.jsxs)("td",{className:"alignLeft",colSpan:"2",children:[Object(D.jsx)("span",{children:(a=e.date,a?Object(A.a)(a,F.timezone).toLocaleDateString(q,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}):"-")}),Object(D.jsx)(N.a,{className:"h3 py-2 show-white-space",children:e.text})]})},t);var a}))]})]})]})]}),Object(D.jsx)(i.a,{position:"static",color:"primary",sx:{top:"auto",bottom:0},children:Object(D.jsx)(y.a,{className:"justify-end",children:function(e){return Object(P.a)(I.e.PAYMENT,I.c.REFUND)?Object(D.jsx)("div",{className:"px-16",children:Object(D.jsx)(o.a,{variant:"contained",color:"secondary",onClick:function(e){var n,c;e.preventDefault(),e.stopPropagation(),n=a("REFUND"),c=function(){!function(e){t(Object(k.p)({type:"refund",payment_id:e.id,method:e.method,amount:e.amount,order_id:e.order_id})).then((function(e){"order"===H.data.origin&&t(Object(U.h)({orderId:H.data.origin_id}))})),ie()}(B)},X(n),se((function(){return c})),ae(!0)},disabled:"payment"!==e.type||e.reversed,children:a("REFUND")})}):Object(D.jsx)("div",{})}(B)})}),Object(D.jsx)(L.a,{title:K,open:te,setOpen:ae,onConfirm:re,noLabel:a("NO"),yesLabel:a("YES"),children:"".concat(B.id)})]}))}):null}},1285:function(e,t){e.exports=d,e.exports.match=function(e,t){var a=[];return c(d(e,a,t),a)},e.exports.regexpToFunction=c,e.exports.parse=n,e.exports.compile=function(e,t){return r(n(e,t),t)},e.exports.tokensToFunction=r,e.exports.tokensToRegExp=o;var a=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function n(e,t){for(var n,c=[],r=0,l=0,o="",d=t&&t.delimiter||"/",j=t&&t.whitelist||void 0,u=!1;null!==(n=a.exec(e));){var b=n[0],p=n[1],m=n.index;if(o+=e.slice(l,m),l=m+b.length,p)o+=p[1],u=!0;else{var h="",O=n[2],x=n[3],f=n[4],y=n[5];if(!u&&o.length){var N=o.length-1,g=o[N];(!j||j.indexOf(g)>
1-1)&&(h=g,o=o.slice(0,N))}o&&(c.push(o),o="",u=!1);var v="+"===y||"*"===y,_="?"===y||"*"===y,S=x||f,w=h||d;c.push({name:O||r++,prefix:h,delimiter:w,optional:_,repeat:v,pattern:S?i(S):"[^"+s(w===d?w:w+d)+"]+?"})}}return(o||l<e.length)&&c.push(o+e.substr(l)),c}function c(e,t){return function(a,n){var c=e.exec(a);if(!c)return!1;for(var r=c[0],s=c.index,i={},l=n&&n.decode||decodeURIComponent,o=1;o<c.length;o++)if(void 0!==c[o]){var d=t[o-1];d.repeat?i[d.name]=c[o].split(d.delimiter).map((function(e){return l(e,d)})):i[d.name]=l(c[o],d)}return{path:r,index:s,params:i}}}function r(e,t){for(var a=new Array(e.length),n=0;n<e.length;n++)"object"===typeof e[n]&&(a[n]=new RegExp("^(?:"+e[n].pattern+")$",l(t)));return function(t,n){for(var c="",r=n&&n.encode||encodeURIComponent,s=!n||!1!==n.validate,i=0;i<e.length;i++){var l=e[i];if("string"!==typeof l){var o,d=t?t[l.name]:void 0;if(Array.isArray(d)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but got array');if(0===d.length){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var j=0;j<d.length;j++){if(o=r(d[j],l),s&&!a[i].test(o))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'"');c+=(0===j?l.prefix:l.delimiter)+o}}else if("string"!==typeof d&&"number"!==typeof d&&"boolean"!==typeof d){if(!l.optional)throw new TypeError('Expected "'+l.name+'" to be '+(l.repeat?"an array":"a string"))}else{if(o=r(String(d),l),s&&!a[i].test(o))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but got "'+o+'"');c+=l.prefix+o}}else c+=l}return c}}function s(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function i(e){return e.replace(/([=!:$/()])/g,"\\$1")}function l(e){return e&&e.sensitive?"":"i"}function o(e,t,a){for(var n=(a=a||{}).strict,c=!1!==a.start,r=!1!==a.end,i=a.delimiter||"/",o=[].concat(a.endsWith||[]).map(s).concat("$").join("|"),d=c?"^":"",j=0;j<e.length;j++){var u=e[j];if("string"===typeof u)d+=s(u);else{var b=u.repeat?"(?:"+u.pattern+")(?:"+s(u.delimiter)+"(?:"+u.pattern+"))*":u.pattern;t&&t.push(u),u.optional?u.prefix?d+="(?:"+s(u.prefix)+"("+b+"))?":d+="("+b+")?":d+=s(u.prefix)+"("+b+")"}}if(r)n||(d+="(?:"+s(i)+")?"),d+="$"===o?"$":"(?="+o+")";else{var p=e[e.length-1],m="string"===typeof p?p[p.length-1]===i:void 0===p;n||(d+="(?:"+s(i)+"(?="+o+"))?"),m||(d+="(?="+s(i)+"|"+o+")")}return new RegExp(d,l(a))}function d(e,t,a){return e instanceof RegExp?function(e,t){if(!t)return e;var a=e.source.match(/\((?!\?)/g);if(a)for(var n=0;n<a.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return e}(e,t):Array.isArray(e)?function(e,t,a){for(var n=[],c=0;c<e.length;c++)n.push(d(e[c],t,a).source);return new RegExp("(?:"+n.join("|")+")",l(a))}(e,t,a):function(e,t,a){return o(n(e,a),t,a)}(e,t,a)}},1286:function(e,t,a){"use strict";var n=a(138),c=a(139);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=c(a(1)),s=(0,n(a(140)).default)(r.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");t.default=s},1474:function(e,t,a){"use strict";a.r(t);var n=a(287),c=a(26),r=a(14),s=a(2),i=a(22),l=a(51),o=a(1013),d=a(135),j=a(194),u=a(148),b=a(433),p=a(150),m=a(430),h=a(123),O=a(1286),x=a.n(O),f=a(34),y=a(940),N=a(365),g=a(993),v=a(1e3),_=a(151),S=a(113),w=a(122),E=a(52),C=a(217),T=a(1),A=a(15),L=a(63),I=a(43),P=a(366),R=a(90),U=a(214),k=a(71),D=a(939),M=a(115),z=a(243),F=a(609),q=a(608),Y=a(100),H=a(96),Q=a(177),B=a(5),W=a(61),V=a(294),$=a(169),G=a(40),J=a(97),K=a(3),X=a(126),Z=a(21),ee=a(180),te=a(289),ae=a(1143),ne=a(1101),ce=a(453),re=a(216),se=a(0),ie=[{id:1,name:"INACTIVE",color:"bg-grey text-black"},{id:2,name:"ACTIVE",color:"bg-green text-black"},{id:3,name:"SUSPEND",color:"bg-orange text-black"},{id:4,name:"SHIPPED",color:"bg-purple text-white"},{id:5,name:"DELIVERED",color:"bg-green-700 text-white"},{id:6,name:"CANCELED",color:"bg-pink text-white"},{id:7,name:"REFUND",color:"bg-red text-white"},{id:8,name:"PAYMENT_ERROR",color:"bg-red-700 text-white"},{id:9,name:"PRE_ORDER",color:"bg-purple-300 text-white"},{id:10,name:"Awaiting bank wire payment",color:"bg-blue text-white"},{id:11,name:"Awaiting PayPal payment",color:"bg-blue-700 text-white"},{id:12,name:"Remote payment accepted",color:"bg-green-800 text-white"},{id:13,name:"On pre-order (not paid)",color:"bg-purple-700 text-white"},{id:14,name:"Awaiting Cash-on-delivery payment",color:"bg-blue-800 text-white"}];var le=function(e){var t=Object(P.a)("billingApp").t;return i.a.find(ie,{name:e.status.toUpperCase()})?Object(se.jsx)("div",{className:Object(B.a)("inline text-16 px-4 roun
1ded truncate",i.a.find(ie,{name:e.status.toUpperCase()}).color),children:t(e.status.toUpperCase())}):Object(se.jsx)("div",{className:Object(B.a)("inline text-16 px-4 rounded truncate","bg-black text-white"),children:t(e.status.toUpperCase())})},oe=(a(178),Object(T.lazy)((function(){return Promise.all([a.e(21),a.e(47)]).then(a.bind(null,1451))}))),de=a(1285),je="150px",ue=Object(w.a)({layoutRoot:{},table:{tableLayout:"fixed","& .day":{width:"50%"},"& .time":{width:"20%"},"& .date":{width:"30%"}}});t.default=Object(C.a)("billingApp",ce.a)((function(e){var t=Object(A.b)(),a=Object(P.a)("billingApp").t,O=Object(E.a)(),w=ue(O),C=Object(L.g)(),ce={enUS:z.a,zhTW:F.a,zhCN:q.a},ie=Object(A.c)(W.u),be=Object(A.c)(V.q),pe=(Object(A.c)((function(e){return e.billingApp.orders.selectedOrder})),Object(A.c)((function(e){return e.billingApp.orders.orderDialog}))),me=Object(A.c)((function(e){return e.billingApp.orders.routeParams})),he=Object(A.c)((function(e){var t=e.auth;return t.business.selectedBusiness?t.business.selectedBusiness:null})),Oe=Object(A.c)((function(e){var t=e.auth;return t.user.locale?t.user.locale:"en-US"})),xe=Object(A.c)((function(e){var t=e.auth;return t.business.selectedLocation?t.business.selectedLocation:null})),fe=Object(A.c)(ee.l),ye=Object(A.c)(te.l),Ne=de.compile(e.match.path),ge=Object(L.i)(),ve=(Ne(Object(s.a)({},ge)),Object(T.useState)(0)),_e=Object(r.a)(ve,2),Se=_e[0],we=_e[1],Ee=Object(T.useState)(!1),Ce=Object(r.a)(Ee,2),Te=Ce[0],Ae=Ce[1],Le=Object(T.useState)(null),Ie=Object(r.a)(Le,2),Pe=Ie[0],Re=Ie[1],Ue=Object(T.useState)("0"),ke=Object(r.a)(Ue,2),De=(ke[0],ke[1],Object(T.useState)("0")),Me=Object(r.a)(De,2),ze=(Me[0],Me[1],Object(T.useState)([])),Fe=Object(r.a)(ze,2),qe=(Fe[0],Fe[1],Object(T.useState)([])),Ye=Object(r.a)(qe,2),He=Ye[0],Qe=Ye[1],Be=Object(l.c)(null),We=Be.form,Ve=Be.handleChange,$e=Be.setInForm,Ge=Be.setForm,Je=Object(T.useState)(null),Ke=Object(r.a)(Je,2),Xe=Ke[0],Ze=Ke[1],et=Object(T.useState)(null),tt=Object(r.a)(et,2),at=tt[0],nt=tt[1],ct=Object(T.useState)(null),rt=Object(r.a)(ct,2),st=rt[0],it=rt[1],lt=Object(T.useState)([]),ot=Object(r.a)(lt,2),dt=ot[0],jt=ot[1],ut=Object(T.useState)([]),bt=Object(r.a)(ut,2),pt=bt[0],mt=bt[1],ht=Object(T.useState)(i.a.orderBy(be.filter((function(e){return"active"===e.status&&("material"!==e.type||"material"===e.type&&!e.inventory_tracking||"material"===e.type&&e.inventory_tracking&&e.inventory_qty>0)})),["id"],["asc"])),Ot=Object(r.a)(ht,2),xt=Ot[0],ft=Ot[1],yt=Object(T.useState)(""),Nt=Object(r.a)(yt,2),gt=Nt[0],vt=Nt[1],_t=Object(T.useState)(!1),St=Object(r.a)(_t,2),wt=St[0],Et=St[1],Ct=Object(T.useState)((function(){return function(){}})),Tt=Object(r.a)(Ct,2),At=Tt[0],Lt=Tt[1],It=[{id:"percent",label:"PERCENT"},{id:"amount",label:"AMOUNT"}],Pt=[{id:1,name:"UNPAID",color:"bg-grey text-black"},{id:2,name:"PAID",color:"bg-green text-black"}],Rt=!!(he&&he.custom&&he.custom.payments.enabled)&&he.custom.payments.enabled,Ut=function(e,t){return e?Object(X.a)(e,t,Oe):"-"},kt=function(e,t){if(e&&Object(Y.a)(Object(H.a)(e))){var a=Object(R.a)(e,xe.timezone);return Object(X.a)(a,t,Oe)}return"-"},Dt=function(e){if(e){var t=fe.find((function(t){return t.id.toUpperCase()===e.toUpperCase()}));return t?"".concat(t.name," (").concat(t.id,")"):e}return"-"},Mt=function(e){if(e){var t=ye.find((function(t){return t.id.toUpperCase()===e.toUpperCase()}));return t?"".concat(t.name," (").concat(t.id,")"):e}return"-"},zt=function(e){return Object(K.w)({currencyLocale:Oe,currencyCode:We.currency_code,value:parseFloat(e)})},Ft=function(e){if(e){if(e.discount_percent&&e.discount_percent>0)return"".concat(e.discount_percent,"%");if(e.discount_amount)return zt(+We.discount_amount)}return"-"},qt=function(e){if(e&&e.subtotal>0){if(e.discount_percent&&e.discount_percent>0){var t=Math.round(e.subtotal*e.discount_percent)/100;return e.subtotal-t}if(e.discount_amount&&e.discount_amount>0){var a=Math.round(100*e.discount_amount)/100;return e.subtotal-a}return null}return null},Yt=function(e){if(e){var t=be.find((function(t){return t.id.toUpperCase()===e.toUpperCase()}));if(t)return t.name}return null};function Ht(e){if(e.status){var t=e.status.toUpperCase();return i.a.find(Pt,{name:t})?Object(se.jsx)("div",{className:Object(B.a)("inline text-16 px-4 roun
1ded truncate",i.a.find(Pt,{name:t}).color),children:a(t)}):Object(se.jsx)("div",{className:Object(B.a)("inline text-16 px-4 rounded truncate","bg-black text-white"),children:a(t)})}return null}function Qt(e){if(e){var t=ie.find((function(t){return t.id.toUpperCase()===e.toUpperCase()}));if(t)return"".concat(t.last_name,", ").concat(t.first_name)}return e}function Bt(e){Te!==e&&(e?(Ze(Object(s.a)({},We)),Ae(!0)):(Ge(Object(s.a)({},Xe)),Ze(null),Ae(!1)))}function Wt(e){var t=i.a.orderBy(ie.filter((function(e){return"active"===e.status&&e.profile_types.some((function(e){return"parent"===e.type&&"active"===e.status}))})),[function(e){return e.last_name.toUpperCase()}],["asc"]);e&&t.unshift(e),jt(t)}function Vt(e){e&&null!==e&&void 0!==e&&""!==e.id?($e("bill_to",e.id),nt(e)):($e("bill_to",null),nt(null))}function $t(e){$e("due_date",e)}function Gt(e){var t=e.target.value;if(null!==t&&void 0!==t){var a=0,n=0;"percent"===t&&(a=We.discount_percent),"amount"===t&&(n=We.discount_amount);var c=ta({subtotal:We.subtotal,discount_percent:a,discount_amount:n,taxesArray:We.taxesArray});Ge(Object(s.a)(Object(s.a)({},We),{},{discountType:t,discount_percent:a,discount_amount:n,total:c.total,tax:c.tax,taxesArray:c.taxesArray}))}}function Jt(e){var t=e.target.value,a=null,n=null;null!==t&&void 0!==t&&(""===(a=(a=t.replace(/^(\d+.?\d{0,2})\d*$/,"$1")).replace(/(^0+)?(\d+)/,"$2"))&&(a=0),a>=0&&("percent"===We.discountType?(a>100&&(a=100),n=ta({subtotal:We.subtotal,discount_percent:a,discount_amount:0,taxesArray:We.taxesArray}),Ge(Object(s.a)(Object(s.a)({},We),{},{discount_percent:a,discount_amount:0,total:n.total,tax:n.tax,taxesArray:n.taxesArray}))):(a>parseFloat(We.subtotal)&&(a=We.discount_amount),n=ta({subtotal:We.subtotal,discount_percent:0,discount_amount:a,taxesArray:We.taxesArray}),Ge(Object(s.a)(Object(s.a)({},We),{},{discount_percent:0,discount_amount:a,total:n.total,tax:n.tax,taxesArray:n.taxesArray})))))}function Kt(e){var t=e.target.value,a=null;if(null!==t&&void 0!==t&&Xt(t)){var n=parseFloat(t);n>=0&&(a=ta({subtotal:n,discount_percent:We.discount_percent,discount_amount:We.discount_amount,taxesArray:We.taxesArray}),Ge(Object(s.a)(Object(s.a)({},We),{},{subtotal:n,total:a.total,tax:a.tax,taxesArray:a.taxesArray})))}}function Xt(e){if(!/^-?\d+(?:[.,]\d*?)?$/.test(e))return!1;var t=parseFloat(e);return!Number.isNaN(t)}var Zt=i.a.debounce((function(e){var n=0,r=0,i=Object(c.a)(xt),l=Object(c.a)(He);e.newProduct.length>0&&e.newProduct.map((function(e){if(n=parseInt(e.pQuantity,10),r=parseFloat(e.pPrice),function(e){if(!/^-?\d+$/.test(e))return!1;var t=parseInt(e,10);return parseFloat(e)==t&&!Number.isNaN(t)}(e.pQuantity)&&Xt(e.pPrice)&&n>0&&r>=0)if(e.inventory_tracking&&e.inventory_qty<n)t(Object(K.i)("error",a("INVENTORY_QUANTITY_ISSUE")));else{var c={product_id:e.id,type:e.type,name:e.name,price:r,quantity:n};if(l.push(c),e.inventory_tracking){var o=i.findIndex((function(t){return t.id===e.id}));o>-1&&(i[o]=Object(s.a)(Object(s.a)({},i[o]),{},{inventory_qty:i[o].inventory_qty-n}),console.log("adjust Inv",n,i[o]))}it(null),ft(i),Qe(l)}}))}),400),ea=i.a.debounce((function(e){var t=Object(c.a)(He),a=Object(c.a)(xt);if(e.idx>-1&&t[e.idx].product_id===e.id){var n=a.findIndex((function(t){return t.id===e.id}));n>-1&&a[n].inventory_tracking&&(a[n].inventory_qty+=t[e.idx].quantity,ft(a),it(null)),t.splice(e.idx,1),Qe(t);var r=0;t.map((function(e){r+=e.quantity*e.price})),Kt({target:{value:r}})}}),400),ta=function(e){var t=0;e.subtotal>0&&(e.discount_percent>0&&(t+=Math.round(e.subtotal*Number(e.discount_percent))/100),e.discount_amount>0&&(t+=Number(e.discount_amount)));var a=e.subtotal-t,n=0,c=JSON.parse(JSON.stringify(e.taxesArray)),r=null;if(c&&c.length>0){var s=Object(K.p)(a,c);Object.keys(s.taxes).forEach((function(e){r=c.findIndex((function(t){return t.name===e})),c[r].amount=s.taxes[e],c[r].included||(n+=s.taxes[e])}))}return(a+=n)<0&&(a=0),{tax:n,taxesArray:c,total:+a.toFixed(2)}},aa=i.a.debounce((function(e){t(Object(re.n)({profile_id:e.profile_id,bill_to:e.bill_to,order_id:[e.id],currency_code:e.currency_code,amount:e.total}))}),400),na=Object(l.a)((function(e){ca(e)}),400),ca=function(){Ge(null),t(Object($.m)()),window.history.back()};function ra(){var e=(new Date).toISOString(),t=We.profile_id&&We.bill_to&&Object(Y.a)(We.due_date);return"new"===pe.type?t&&He.length>0&&Object(Q.a)(We.due_date).toISOString()>=e:t}var sa,ia,la=i.a.debounce((function(e){var a=Object(K.G)(e,Xe);a&&Object.keys(a).length>0&&(a.id=e.id,a.location_id=e.location_id,a.product_list&&(a.type="product"),a.registration_list&&(a.type="registration"),a.enroll_list&&(a.type="enrollment"),a.bill_date&&(a.bill_date=Object(U.a)(a.bill_date,xe.timezone).toISOString()),a.due_date&&(a.due_date=Object(U.a)(a.due_date,xe.timezone).toISOString()),a.subtotal&&(a.subtotal=parseFloat(a.subtotal)),a.discount_amount&&(a.discount_amount=parseFloat(a.discount_amount)),a.discount_rate&&(a.discount_rate=parseFloat(a.discount_rate)),delete a.discountType,a.tempNotes&&(a.notes=[{date:(new Date).toISOString(),text:a.tempNotes.text}],$e("notes",[a.tempNotes]),delete a.tempNotes),t(Object($.o)(a)
1).then((function(e){"rejected"!==e.meta.requestStatus&&(Ze(null),Ae(!1))})))}),400),oa=i.a.debounce((function(e){var a={};Object.keys(e).forEach((function(t){null!==e[t]&&(a[t]=e[t])})),a.bill_date?a.bill_date=Object(U.a)(a.bill_date,xe.timezone).toISOString():a.bill_date=Object(U.a)(new Date,xe.timezone).toISOString(),a.due_date&&(a.due_date=Object(U.a)(Object(Q.a)(a.due_date),xe.timezone).toISOString()),a.discount_amount&&(a.discount_amount=parseFloat(a.discount_amount)),a.discount_rate&&(a.discount_rate=parseFloat(a.discount_rate)),a.tempNotes&&(a.notes=[{date:(new Date).toISOString(),text:a.tempNotes.text}],delete a.tempNotes),delete a.pPrice,delete a.pQuantity,delete a.discountType,delete a.taxes,delete a.taxesArray,delete a.taxesArray,delete a.tax,delete a.subtotal,a=Object(s.a)(Object(s.a)({},a),{},{product_list:He}),t(Object($.a)(a)).then((function(e){"rejected"!==e.meta.requestStatus?(t(Object(V.n)()),t(Object($.m)()),C.push("/apps/billing/orders")):t(Object(K.i)("error","New Order: failed"))}))}),400);return Object(T.useEffect)((function(){var a={date:null,text:null},c=null;ge.orderId?c=ge.orderId:me.orderId&&(c=me.orderId);var r=null;if(Qe([]),e&&e.location)if(e.location.search){var l=new URLSearchParams(e.location.search);l.has("tab")&&we(+l.get("tab"))}else e.location.pathname.includes("invoice")&&we(1);var o=i.a.orderBy(ie.filter((function(e){return"active"===e.status&&e.profile_types.some((function(e){return"parent"===e.type&&"active"===e.status}))})),[function(e){return e.last_name.toUpperCase()}],["asc"]),d=i.a.orderBy(ie.filter((function(e){return"active"===e.status&&e.profile_types.some((function(e){return"student"===e.type&&"active"===e.status}))})),[function(e){return e.last_name.toUpperCase()}],["asc"]);if(c){r=Object(K.u)(he.country_code),Re(Object(K.y)(Oe,r));var j=null,u=[];if("new"===c){if(t(Object($.r)()),Ge(Object(s.a)(Object(s.a)({},Z.O),{},{location_id:[xe.location_id],currency_code:r,status:"active",discountType:"percent",type:"product",pPrice:0,pQuantity:1,taxesArray:xe.tax_rates,tempNotes:a})),e.location.search&&e.location.search.length>0){var b=e.location.search.replace("?itemId=","");b.length>0&&JSON.parse(b).map((function(e){(j=xt.find((function(t){return t.id===e})))&&u.push(Object(s.a)(Object(s.a)({},j),{},{pQuantity:1,pPrice:j.price})),Zt(u)}))}}else t(Object($.p)(c)).then((function(e){if(e.payload&&e.payload.length>0){var t=e.payload[0],c="percent";t.discount_amount&&t.discount_amount>0&&(c="amount");var r=null;t.taxes&&Object.keys(t.taxes).length>0&&(r=Object.keys(t.taxes).map((function(e){return t.taxes[e]})));var i=ta({subtotal:t.subtotal,discount_percent:t.discount_percent,discount_amount:t.discount_amount,taxesArray:r});if(t.notes&&t.notes.length>0){var l=Object(n.a)(t.notes);a=l[0],l.slice(1)}var d=Object(s.a)(Object(s.a)({},t),{},{bill_date:t.bill_date?Object(H.a)(t.bill_date):null,due_date:t.due_date?Object(H.a)(t.due_date):null,send_date:t.send_date?Object(H.a)(t.send_date):null,pdf_date:t.pdf_date?Object(H.a)(t.pdf_date):null,discountType:c,taxesArray:i.taxesArray,tempNotes:a});Ge(Object(s.a)({},d));var j=ie.find((function(e){return e.id.toUpperCase()===t.profile_id.toUpperCase()}));if(j&&o.unshift(j),t.bill_to){var u=ie.find((function(e){return e.id.toUpperCase()===t.bill_to.toUpperCase()}));u&&nt(u)}"edit"===pe.type?(Ae(!0),Ze(Object(s.a)({},d))):Ae(!1)}else Ge(null),Ze(null),nt(null)}));jt(o),mt(d)}}),[t,ge,me]),Object(T.useEffect)((function(){if("new"===pe.type&&We){var e=0;He.map((function(t){e+=t.quantity*t.price})),Kt({target:{value:e}})}}),[He]),We&&ge?Object(se.jsx)(o.a,{classes:{root:w.layoutRoot,toolbar:"p-0"},header:Object(se.jsx)("div",{className:"py-16",children:Object(se.jsx)("table",{children:Object(se.jsxs)("tbody",{children:[Object(se.jsx)("tr",{children:Object(se.jsx)("td",{className:"alignLeft",colSpan:"2",children:Object(se.jsxs)(S.a,{className:"normal-case items-center mb-12 min-w-full",component:I.a,role:"button",to:"/apps/billing/orders",color:"inherit",children:[Object(se.jsx)(f.a,{className:"text-base",children:"ltr"===O.direction?"arrow_back":"arrow_forward"}),Object(se.jsx)("span",{className:"mx-4 h3",children:a("ORDER")})]})})}),Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"alignLeft",children:Object(se.jsx)(S.a,{className:"text-16 md:mx-8 my-8 md:my-8",color:"inherit",children:We.id||a("NEW_ORDER")})}),Object(J.a)(G.e.ORDER,G.c.UPDATE)&&"new"!==pe.type&&Object(se.jsx)("td",{className:"alignLeft ml-16",children:Object(se.jsx)(p.a,{className:"whitespace-nowrap mx-8 px-12",variant:"contained",color:"secondary",disabled:Te||"paid"===We.payment_status||"active"!==We.status&&"suspend"!==We.status,onClick:function(e){var n,c;n=a("DELETE"),c=function(){var e;e=We.id,t(Object($.b)(e)).then((function(e){C.push("/apps/billing/orders")}))},vt(n),Lt((function(){return c})),Et(!0)},children:a("CANCEL")})})]})]})})}),contentToolbar:Object(se.jsxs)(v.a,{value:Se,onChange:function(e,t){Te||we(t)},indicatorColor:"primary",textColor:"primary",variant:"scrollable",scrollButtons:"auto",classes:{root:"w-full h-64"},children:[Object(se.jsx)(g.a,{className:"h-64 text-16",label:a("INFO")}),!(Te||"new"===pe.type)&&Object(se.jsx)(g.a,{className:"h-64 text-16",label:a("INVOICE")})]}),content:Object(se.jsxs)(se.Fragment,{children:["new"===pe.type?Object(se.jsxs)("div",{className:"p-16 sm:p-24 max-w-2xl w-full",children:[Object(se.jsxs)("div",{className:"formRow mt-8 pb-16",children:[Object(se.jsxs)("div",{className:"rowElement mb-12 pr-16",children:[Object(se.jsx)("span",{className:"px-4",children:a("STUDENT")}),Object(se.jsx)(b.a,{id:"profile_id",options:pt,getOptionSelected:function(e,t){return e.id===t.id},getOptionLabel:function(e){return"string"===typeof e?e:"".concat(e.last_name,", ").concat(e.first_name,"
1(").concat(e.id,")")},onChange:function(e,t){return function(e){e&&null!==e&&void 0!==e&&""!==e.id?($e("profile_id",e.id),$e("bill_to",e.id),Wt(e),nt(e)):($e("profile_id",null),$e("bill_to",null),Wt(null),nt(null))}(t)},renderInput:function(e){return Object(se.jsx)(_.a,Object(s.a)(Object(s.a)({},e),{},{fullWidth:!0,variant:"outlined",error:!We.profile_id,helperText:!We.profile_id&&a("REQUIRED_INPUT")}))},size:"small",className:"fieldElement",noOptionsText:a("NO_OPTIONS")})]}),Object(se.jsxs)("div",{className:"rowElement mb-12 pr-16",children:[Object(se.jsx)("span",{className:"px-4",children:a("BILL_TO")}),Object(se.jsx)(b.a,{className:"fieldElement",id:"bill_to",size:"small",value:at,options:dt,getOptionSelected:function(e,t){return e.id===t.id},getOptionLabel:function(e){return"string"===typeof e?e:"".concat(e.last_name,", ").concat(e.first_name," (").concat(e.id,")")},onChange:function(e,t){return Vt(t)},renderInput:function(e){return Object(se.jsx)(_.a,Object(s.a)(Object(s.a)({},e),{},{fullWidth:!0,variant:"outlined",error:!at,helperText:!at&&a("REQUIRED_INPUT")}))},noOptionsText:a("NO_OPTIONS")})]}),Object(se.jsxs)("div",{className:"rowElement mb-12 pr-16",children:[Object(se.jsx)("span",{className:"px-4",children:a("DUE_DATE")}),Object(se.jsx)(k.a,{utils:M.a,locale:ce[Z.n[Oe]],children:Object(se.jsx)(D.b,{className:"fieldElement",inputVariant:"outlined",size:"small",margin:"normal",autoOk:!0,disablePast:!0,placeholder:a("DATE_FORMAT"),format:"dd/MM/yyyy",id:"next_date",value:We.due_date,onChange:$t,variant:"dialog",cancelLabel:a("CANCEL"),clearLabel:a("CLEAR"),okLabel:a("OK"),todayLabel:a("TODAY")})})]})]}),Object(se.jsx)("div",{className:"formRow",children:Object(se.jsx)("div",{className:"rowElement px-4",children:Object(se.jsx)(S.a,{className:"h3",color:"primary",children:a("ADD_ITEMS")})})}),Object(se.jsxs)("div",{className:"formRow mt-8 pb-32",style:{display:"flex"},children:[Object(se.jsx)("div",{className:"rowElement pr-16",children:Object(se.jsx)(b.a,{className:"fieldElement",size:"small",id:"product_id",label:a("ITEMS"),options:xt,value:st,getOptionSelected:function(e,t){return e.id===t.id},getOptionLabel:function(e){return e.inventory_tracking?"".concat(e.id,": ").concat(e.name," (").concat(e.inventory_qty,")"):"".concat(e.id,": ").concat(e.name)},onChange:function(e,t){return function(e){e&&null!==e&&void 0!==e&&""!==e.id?($e("pPrice",e.price),it(e)):($e("pPrice",0),it(null))}(t)},renderInput:function(e){return Object(se.jsx)(_.a,Object(s.a)(Object(s.a)({},e),{},{fullWidth:!0,variant:"outlined",error:!st&&He.length<1,helperText:!st&&He.length<1&&a("MIN_PRODUCT_1")}))},noOptionsText:a("NO_OPTIONS")})}),Object(se.jsxs)("div",{className:"rowElement pr-12 items-center",children:[Object(se.jsx)(_.a,{className:"fieldElement pr-16",style:{width:"".concat(je)},id:"pQuantity",name:"pQuantity",label:a("QUANTITY"),size:"small",value:We.pQuantity,variant:"outlined",onChange:Ve,error:We.pQuantity<=0||!K.f.test(We.pQuantity),helperText:(We.pQuantity<=0||!K.f.test(We.pQuantity))&&a("NUMBER_GREATER_0")}),Object(se.jsx)(_.a,{className:"fieldElement pr-16",style:{width:"".concat(je)},id:"pPrice",name:"pPrice",label:a("PRICE"),size:"small",value:We.pPrice,variant:"outlined",onChange:Ve,error:null===We.pPrice||!K.h.test(We.pPrice),helperText:null!==We.pPrice&&K.h.test(We.pPrice)?"":a("PRICE_GREATER_0"),InputProps:{startAdornment:Object(se.jsx)(y.a,{position:"start",children:Pe})}}),Object(se.jsx)(p.a,{className:"mt-8 px-12",size:"small",variant:"contained",color:"primary",disabled:!st||!K.f.test(We.pQuantity)||We.pQuantity<1||!K.d.test(We.pPrice),onClick:function(e){e.preventDefault(),Zt({newProduct:[Object(s.a)(Object(s.a)({},st),{},{pQuantity:We.pQuantity,pPrice:We.pPrice})]})},children:"+ ".concat(a("ADD"))})]})]}),Object(se.jsx)("div",{className:"table-responsive pr-16",children:Object(se.jsxs)("table",{className:"simple",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"50%"}}),Object(se.jsx)("col",{style:{width:"15%"}}),Object(se.jsx)("col",{style:{width:"15%"}}),Object(se.jsx)("col",{style:{width:"15%"}}),Object(se.jsx)("col",{style:{width:"5%"}})]}),Object(se.jsx)("thead",{children:Object(se.jsxs)("tr",{children:[Object(se.jsx)("th",{className:"h4 alignLeft",children:a("ITEM")}),Object(se.jsx)("th",{className:"h4",children:a("QUANTITY")}),Object(se.jsx)("th",{className:"h4",align:"right",children:a("PRICE")}),Object(se.jsx)("th",{className:"h4",children:a("TOTAL")}),Object(se.jsx)("th",{className:"h4 alignLeft",align:"left",children:Object(se.jsx)(h.a,{children:Object(se.jsx)(x.a,{})})})]})}),Object(se.jsxs)("tbody",{children:[(ia=He,ia&&ia.length>0?Object(se.jsx)(se.Fragment,{children:ia.map((function(e,t){return Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"h3 alignLeft",children:"".concat(e.name," (").concat(e.product_id,")")}),Object(se.jsx)("td",{className:"h3",children:e.quantity}),Object(se.jsx)("td",{className:"h3",children:zt(e.price)}),Object(se.jsx)("td",{className:"h3",align:"right",children:zt(e.quantity*e.price)}),Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(h.a,{"aria-label":"delete",onClick:function(a){ea({id:e.product_id,idx:t})},children:Object(se.jsx)(f.a,{fontSize:"small",style:{color:j.a[500]},children:"close"})})})]},t)}))}):Object(se.jsx)("tr",{children:Object(se.jsx)("td",{className:"h3 alignLeft",children:a("NO_ITEMS")})}
1)),He.length>0&&Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"h3 alignLeft",colSpan:"3",children:a("SUBTOTAL")}),Object(se.jsx)("td",{className:"h3",align:"right",children:zt(We.subtotal)}),Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(h.a,{children:Object(se.jsx)(x.a,{})})})]})]})]})}),Object(se.jsx)("div",{className:"formRow mt-24",style:{display:"flex",alignItems:"center"},children:Object(se.jsxs)("div",{className:"rowElement px-16",children:[Object(se.jsx)(_.a,{className:"fieldElement mr-8",style:{width:"".concat("150px")},name:"discountType",value:We.discountType,onChange:Gt,label:a("DISCOUNT"),variant:"outlined",size:"small",select:!0,children:It.map((function(e,t){return Object(se.jsx)(N.a,{value:e.id,children:a(e.label)},t)}))}),We.discountType&&"percent"===We.discountType&&Object(se.jsx)(_.a,{className:"fieldElement",style:{width:"".concat(je)},id:"discount_percent",name:"discount_percent",label:a("PERCENT"),value:We.discount_percent,variant:"outlined",size:"small",error:We.discount_percent>0&&!K.d.test(We.discount_percent),onChange:Jt}),We.discountType&&"amount"===We.discountType&&Object(se.jsx)(_.a,{className:"fieldElement",style:{width:"".concat(je)},id:"discount_amount",name:"discount_amount",label:a("AMOUNT"),value:We.discount_amount,variant:"outlined",size:"small",error:We.discount_amount>0&&!K.d.test(We.discount_amount),onChange:Jt,InputProps:{startAdornment:Object(se.jsx)(y.a,{position:"start",children:Pe})}})]})}),Object(se.jsx)("div",{className:"table-responsive",children:Object(se.jsxs)("table",{className:"simple mt-2",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"80%"}}),Object(se.jsx)("col",{style:{width:"20%"}})]}),Object(se.jsx)("tbody",{children:Object(se.jsxs)("tr",{className:"pr-16",children:[Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textPrimary",children:a("DISCOUNT")}),qt(We)&&Object(se.jsx)(S.a,{className:"h4",color:"textPrimary",children:a("DISCOUNT_SUBTOTAL")}),We.taxesArray&&Object.values(We.taxesArray).map((function(e,t){return e.included?null:Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:"".concat(e.rate,"% ").concat(e.name," ").concat(e.cumulative?a("CUMULATIVE"):"")},t)})),Object(se.jsx)(S.a,{className:"text-20 py-8",children:a("TOTAL")})]}),Object(se.jsxs)("td",{align:"right",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:Ft(We)}),qt(We)&&Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:zt(qt(We))}),We.taxesArray&&Object.values(We.taxesArray).map((function(e,t){return e.included?null:Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:zt(e.amount)},t)})),Object(se.jsx)(S.a,{className:"text-20 py-8",children:zt(We.total)})]})]})})]})}),Object(se.jsx)("div",{className:"formRow my-16 px-16",children:Object(se.jsx)("div",{className:"rowElement pr-8",children:Object(se.jsx)(_.a,{className:"fieldElement",variant:"outlined",size:"small",label:a("NOTES"),name:"tempNotes.text",value:null!==We.tempNotes.text?We.tempNotes.text:"",onChange:Ve,multiline:!0,rows:5})})}),Object(se.jsxs)("div",{className:"flex px-16 justify-end",children:[Object(se.jsx)(p.a,{className:"whitespace-nowrap mx-8 px-12",variant:"contained",color:"primary",onClick:function(){return na()},startIcon:Object(se.jsx)(f.a,{className:"hidden sm:flex",children:"close"}),children:a("CANCEL")}),Object(se.jsx)(p.a,{className:"whitespace-nowrap mx-8 px-12",variant:"contained",color:"secondary",disabled:!ra(),onClick:function(){return oa(We)},startIcon:Object(se.jsx)(f.a,{className:"hidden sm:flex",children:"check"}),children:a("SAVE")})]})]}):Object(se.jsxs)("div",{className:"p-16 sm:p-24 max-w-2xl w-full",children:[0===Se&&Object(se.jsxs)("div",{children:[Object(se.jsxs)("div",{className:"pb-24",children:[Object(se.jsxs)("div",{className:"pb-12 flex items-center",children:[Object(se.jsx)(f.a,{color:"action",children:"info"}),Object(se.jsx)(S.a,{className:"h2 mx-8",color:"textSecondary",children:a("INFO")})]}),Object(se.jsx)("div",{className:"table-responsive",children:Object(se.jsxs)("table",{className:"simple",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"35%"}}),Object(se.jsx)("col",{style:{width:"35%"}}),Object(se.jsx)("col",{style:{width:"30%"}})]}),Object(se.jsxs)("tbody",{children:[Object(se.jsxs)("tr",{className:"px-16",children:[Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("NAME")}),Object(se.jsx)(S.a,{className:"h3 py-8",children:Qt(We.profile_id)})]}),Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("BILL_TO")}),Te?Object(se.jsx)(b.a,{className:"fieldElement",id:"bill_to",size:"small",value:at,options:dt,getOptionSelected:function(e,t){return e.id===t.id},getOptionLabel:function(e){return"string"===typeof e?e:"".concat(e.last_name,", ").concat(e.first_name,"
1(").concat(e.id,")")},onChange:function(e,t){return Vt(t)},renderInput:function(e){return Object(se.jsx)(_.a,Object(s.a)(Object(s.a)({error:!at},e),{},{variant:"outlined",helperText:!at&&a("BILLTO_REQUIRED")}))},noOptionsText:a("NO_OPTIONS")}):Object(se.jsx)(S.a,{className:"h3 py-8",children:Qt(We.bill_to)})]}),Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("LOCATION")}),Object(se.jsx)(S.a,{className:"h3 py-8",children:(sa=We.location_id[0],sa?"all"===sa.toLowerCase()?a("ALL"):xe.location_id===sa?xe.name:sa:"-")})]})]}),Object(se.jsxs)("tr",{className:"px-16",children:[Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("ORDER")}),Object(se.jsx)(S.a,{className:"h3 py-8",children:We.id})]}),Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("TOTAL")}),Object(se.jsx)(S.a,{className:"h3 py-8",children:zt(We.total)})]}),Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4 mb-8",color:"textSecondary",children:a("STATUS")}),Object(se.jsx)(le,{status:We.status})]})]}),Object(se.jsxs)("tr",{className:"px-16",children:[Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4 mb-4",color:"textSecondary",children:a("DUE_DATE")}),Te?Object(se.jsx)(k.a,{utils:M.a,locale:ce[Z.n[Oe]],children:Object(se.jsx)(D.b,{className:"fieldElement",inputVariant:"outlined",size:"small",margin:"normal",autoOk:!0,disablePast:!0,placeholder:a("DATE_FORMAT"),format:"dd/MM/yyyy",id:"next_date",value:We.due_date,onChange:$t,variant:"dialog",cancelLabel:a("CANCEL"),clearLabel:a("CLEAR"),okLabel:a("OK"),todayLabel:a("TODAY")})}):Object(se.jsx)(S.a,{className:"h3 py-8",children:Ut(We.due_date,"P")})]}),Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("SEND_DATE")}),Object(se.jsx)(S.a,{className:"h3 py-8",children:function(e){if(e&&e.length>0){var t=e[e.length-1];return Ut(t.date,"P")}return"-"}(We.sent)})]}),Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("BILL_DATE")}),Object(se.jsx)(S.a,{className:"h3 py-8",children:Ut(We.bill_date,"Pp")})]})]})]})]})})]}),Object(se.jsxs)("div",{className:"pb-24",children:[Object(se.jsxs)("div",{className:"pb-12 flex items-center",children:[Object(se.jsx)(f.a,{color:"action",children:"attach_money"}),Object(se.jsx)(S.a,{className:"h2 mx-8",color:"textSecondary",children:a("PAYMENT")}),"paid"!==We.payment_status&&Rt&&!Te&&Object(J.a)(G.e.ORDER,G.c.PAYMENT)?Object(se.jsx)("div",{className:"px-12 rounded",children:Object(se.jsx)(p.a,{variant:"contained",color:"secondary",size:"small",disabled:"cancel"===We.status,onClick:function(e){e.preventDefault(),e.stopPropagation(),aa(We)},children:a("PAY_NOW")})}):Object(se.jsx)(Ht,{status:We.payment_status})]}),We.payments&&We.payments.length>0&&Object(se.jsx)("div",{className:"table-responsive",children:Object(se.jsxs)("table",{className:"simple",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"20%"}}),Object(se.jsx)("col",{style:{width:"30%"}}),Object(se.jsx)("col",{style:{width:"20%"}}),Object(se.jsx)("col",{style:{width:"30%"}})]}),Object(se.jsx)("thead",{children:Object(se.jsxs)("tr",{children:[Object(se.jsx)("th",{className:"h4 alignLeft",children:a("PAYMENT_ID")}),Object(se.jsx)("th",{className:"h4 alignLeft",children:a("DATE")}),Object(se.jsx)("th",{className:"h4 alignLeft",children:a("AMOUNT")}),Object(se.jsx)("th",{className:"h4 alignLeft",children:a("TYPE")})]})}),Object(se.jsx)("tbody",{children:function(e){if(e&&e.length>0){var n=i.a.orderBy(e,["payment_id"],["desc"]);return Object(se.jsx)(se.Fragment,{children:n.map((function(e){return Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(p.a,{className:"h4",variant:"contained",size:"small",color:"primary",onClick:function(){return t(Object(re.o)({origin:"order",origin_id:We.id,payment_id:e.payment_id,profileInfo:ie.find((function(e){return e.id.toUpperCase()===We.profile_id.toUpperCase()}))}))},children:e.payment_id})}),Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(X.a)(e.datetime,"Pp",Oe)}),"payment"===e.type&&Object(se.jsx)("td",{className:"h3 alignLeft",children:zt(e.amount)}),"refund"===e.type&&Object(se.jsx)("td",{className:"h3 alignLeft",style:{color:d.a[500]},children:zt(e.amount)}),Object(se.jsxs)("td",{className:"h3 alignLeft",children:[e.method?"".concat(a(e.method.toUpperCase())):"-",e.type&&"payment"!==e.type?" : ".concat(a(e.type.toUpperCase())):""]})]},e.payment_id)}))})}return Object(se.jsx)("tr",{children:Object(se.jsx)("td",{className:"h3 alignLeft",children:a("NO_PAYMENTS")})})}(We.payments)})]})})]}),Object(se.jsxs)("div",{className:"pb-24",children:[Object(se.jsx)("div",{className:"pb-12 flex w-full",children:Object(se.jsxs)("div",{className:"flex items-center mr-16",children:[Object(se.jsx)(f.a,{color:"action",children:"shopping_cart"}),Object(se.jsx)(S.a,{className:"h2 mx-8",color:"textSecondary",children:a("ORDER")}),Object(J.a)(G.e.ORDER,G.c.UPDATE)&&!Te&&Object(se.jsx)(h.a,{className:"ml-16",disabled:"paid"===We.payment_status||"active"!==We.status,onClick:function(){return Bt(!0)},children:Object(se.jsx)(f.a,{style:{color:"paid"===We.payment_status||"active"!==We.status?u.a[500]:j.a[500]},children:"edit"})}),Object(J.a)(G.e.ORDER,G.c.UPDATE)&&Te&&Object(se.jsx)(h.a,{className:"mx-16",onClick:function(){return Bt(!1)},children:Object(se.jsx)(f.a,{className:"valign-icon",style:{color:j.a[500]},children:"close"})}),Te&&Object(se.jsx)(p.a,{variant:"contained",color:"primary",disabled:!ra(),onClick:function(e){la(We)},children:a("SAVE")})]})}),Object(se.jsx)("div",{className:"table-responsive",children:function(e){return e.type&&"product"===e.type?Object(se.jsxs)("table",{className:"simple",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"25%"}}),Object(se.jsx)("col",{style:{width:"40%"}}),Object(se.jsx)("col",{style:{width:"15%"}}),Object(se.jsx)("col",{style:{width:"20%"}})]}),Object(se.jsx)("thead",{children:Object(se.jsxs)("tr",{children:[Object(se.jsx)("th",{className:"h4 alignLeft",children:a("PRODUCT_ID")}),Object(se.jsx)("th",{className:"h4 alignLeft",children:a("ITEM")}),Object(se.jsx)("th",{className:"h4",children:a("QUANTITY")}),Object(se.jsx)("th",{className:"h4",align:"right",children:a("UNIT_PRICE")})]})}),Object(se.jsx)("tbody",{children:e.product_list.map((function(e,t){return Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(S.a,{className:"h3 inline px-4",children:e.product_id||"-"})}),Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(S.a,{className:"h3 inline px-4",children:Yt(e.product_id)||"-"})}),Object(se.jsx)("td",{className:"h3",align:"right",children:Object(se.jsx)(S.a,{className:"h3 inline px-4",children:e.quantity||"-"})}),Object(se.jsx)("td",{className:"h3",align:"right",children:Object(se.jsx)("span",{className:"truncate",children:zt(e.price)})})]},t)}))})]}):e.type&&"registration"===e.type?Object(se.jsxs)("table",{className:"simple",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"25%"}}),Object(se.jsx)("col",{style:{width:"55%"}}
1),Object(se.jsx)("col",{style:{width:"20%"}})]}),Object(se.jsx)("thead",{children:Object(se.jsxs)("tr",{children:[Object(se.jsx)("th",{className:"h4 alignLeft",children:a("REGISTRATION")}),Object(se.jsx)("th",{className:"h4 alignLeft",children:a("SESSION")}),Object(se.jsx)("th",{className:"h4",align:"right",children:a("PRICE")})]})}),Object(se.jsx)("tbody",{children:e.registration_list.map((function(e,t){return Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(S.a,{className:"h3 inline",children:"".concat(e.registration_id,": ").concat(kt(e.start_datetime,"Pp"))||"-"})}),Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(S.a,{className:"h3 inline",children:"".concat(e.session_id," ").concat(e.lesson_name)||"-"})}),Object(se.jsx)("td",{className:"h3",align:"right",children:Object(se.jsx)("span",{className:"truncate",children:zt(e.price)})})]},t)}))})]}):e.type&&"enrollment"===e.type?Object(se.jsxs)("table",{className:"simple",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"25%"}}),Object(se.jsx)("col",{style:{width:"55%"}}),Object(se.jsx)("col",{style:{width:"20%"}})]}),Object(se.jsx)("thead",{children:Object(se.jsxs)("tr",{children:[Object(se.jsx)("th",{className:"h4 alignLeft",children:a("ENROLL_ID")}),Object(se.jsx)("th",{className:"h4 alignLeft",children:a("PROGRAM")}),Object(se.jsx)("th",{className:"h4",align:"right",children:a("PRICE")})]})}),Object(se.jsx)("tbody",{children:e.enroll_list.map((function(e,t){return Object(se.jsxs)("tr",{children:[Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsx)(S.a,{className:"h3 inline",children:e.enroll_id||"-"})}),Object(se.jsx)("td",{className:"h3 alignLeft",children:Object(se.jsxs)(S.a,{className:"h3 inline",children:[e.program_id&&Mt(e.program_id),e.lesson_id&&Dt(e.lesson_id),", ".concat((n=e,"session"===n.credit_type?"".concat(n.session," ").concat(a("SESSIONS")):"fee"===n.credit_type?zt(n.fee):"time"===n.credit_type?"".concat(Object(K.o)(n.time).timeStr," ").concat(a("HOURS")):"-"))]})}),Object(se.jsx)("td",{className:"h3",align:"right",children:Object(se.jsx)("span",{className:"truncate",children:zt(e.price)})})]},t);var n}))})]}):null}(We)}),Object(se.jsx)(m.a,{}),Te&&Object(se.jsx)(se.Fragment,{children:Object(se.jsxs)("div",{className:"formRow mt-24 px-16",children:[Object(se.jsx)("div",{className:"rowElement pr-8",children:Object(se.jsx)(_.a,{className:"fieldElement",name:"discountType",value:We.discountType,onChange:Gt,label:a("DISCOUNT"),variant:"outlined",size:"small",select:!0,children:It.map((function(e,t){return Object(se.jsx)(N.a,{value:e.id,children:a(e.label)},t)}))})}),Object(se.jsxs)("div",{className:"rowElement pr-8",children:[We.discountType&&"percent"===We.discountType&&Object(se.jsx)(_.a,{className:"fieldElement",id:"discount_percent",name:"discount_percent",label:a("PERCENT"),value:We.discount_percent,variant:"outlined",size:"small",error:We.discount_percent>0&&!K.d.test(We.discount_percent),onChange:Jt}),We.discountType&&"amount"===We.discountType&&Object(se.jsx)(_.a,{className:"fieldElement",id:"discount_amount",name:"discount_amount",label:a("AMOUNT"),value:We.discount_amount,variant:"outlined",size:"small",error:We.discount_amount>0&&!K.d.test(We.discount_amount),onChange:Jt})]})]})}),Object(se.jsx)("div",{className:"table-responsive",children:Object(se.jsxs)("table",{className:"simple mt-16",children:[Object(se.jsxs)("colgroup",{children:[Object(se.jsx)("col",{style:{width:"80%"}}),Object(se.jsx)("col",{style:{width:"20%"}})]}),Object(se.jsxs)("tbody",{children:[Object(se.jsxs)("tr",{className:"px-16",children:[Object(se.jsxs)("td",{className:"alignLeft",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("SUBTOTAL")}),Object(se.jsx)(S.a,{className:"h4",color:"textPrimary",children:a("DISCOUNT")}),qt(We)&&Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:a("DISCOUNT_SUBTOTAL")}),We.taxes&&Object.values(We.taxes).map((function(e,t){return e.included?Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:"".concat(e.rate,"% ").concat(e.name," (included) ").concat(e.cumulative?a("CUMULATIVE"):"")},t):Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:"".concat(e.rate,"% ").concat(e.name," ").concat(e.cumulative?a("CUMULATIVE"):"")},t)})),Object(se.jsx)(S.a,{className:"text-20 py-8",children:a("TOTAL")})]}),Object(se.jsxs)("td",{align:"right",children:[Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:"".concat(zt(We.subtotal))}),Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:Ft(We)}),qt(We)&&Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:zt(qt(We))}),We.taxesArray&&Object.values(We.taxesArray).map((function(e,t){return Object(se.jsx)(S.a,{className:"h4",color:"textSecondary",children:zt(e.amount)},t)})),Object(se.jsx)(S.a,{className:"text-20 py-8",children:zt(We.total)})]})]}),!Te&&Object(se.jsxs)(se.Fragment,{children:[Object(se.jsx)("tr",{className:"px-16",children:Object(se.jsx)("td",{className:"alignLeft",colSpan:"2",children:Object(se.jsx)(S.a,{className:"h4 viewLabels",color:"textSecondary",children:a("NOTES")})})}),We.notes&&We.notes.map((function(e,t){return Object(se.jsx)("tr",{className:"px-16",children:Object(se.jsxs)("td",{className:"alignLeft",colSpan:"2",children:[Object(se.jsx)("span",{children:(a=e.date,a?Object(R.a)(a,xe.timezone).toLocaleDateString(Oe,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}):"-")}),Object(se.jsx)(S.a,{className:"h3 py-2 show-white-space",children:e.text})]})},t);var a}))]})]})]})}),Te&&Object(se.jsx)("div",{className:"formRow mt-18 px-16",children:Object(se.jsx)("div",{className:"rowElement pr-8",children:Object(se.jsx)(_.a,{className:"fieldElement",variant:"outlined",size:"small",label:a("NOTES"),name:"tempNotes.text",value:null!==We.tempNotes.text?We.tempNotes.text:"",onChange:Ve,multiline:!0,rows:5})})})]})]}),1===Se&&Object(se.jsx)(oe,{order:We})]}),Object(se.jsx)(ae.a,{}
1),Object(se.jsx)(ne.a,{}),Object(se.jsx)(K.a,{title:gt,open:wt,setOpen:Et,onConfirm:At,noLabel:a("NO"),yesLabel:a("YES"),children:We.id})]})}):null}))}}]);
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.