1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[93218],{68185:function(e,i,n){"use strict";n.d(i,{r:function(){return o}});var t=n(67294),l=n(49184),a=n(38655),r=n(54520),cx=(...e)=>e.filter(Boolean).join(" "),dataAttr=e=>e?"":void 0,o=(0,a.Gp)(function(e,i){let n=(0,a.jC)("Switch",e),{spacing:o="0.5rem",children:s,...d}=(0,r.Lr)(e),{state:c,getInputProps:u,getCheckboxProps:h,getRootProps:x,getLabelProps:m}=(0,l.O)(d),g=(0,t.useMemo)(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...n.container}),[n.container]),b=(0,t.useMemo)(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...n.track}),[n.track]),p=(0,t.useMemo)(()=>({userSelect:"none",marginStart:o,...n.label}),[o,n.label]);return t.createElement(a.m$.label,{...x(),className:cx("chakra-switch",e.className),__css:g},t.createElement("input",{className:"chakra-switch__input",...u({},i)}),t.createElement(a.m$.span,{...h(),className:"chakra-switch__track",__css:b},t.createElement(a.m$.span,{__css:n.thumb,className:"chakra-switch__thumb","data-checked":dataAttr(c.isChecked),"data-hover":dataAttr(c.isHovered)})),s&&t.createElement(a.m$.span,{className:"chakra-switch__label",...m(),__css:p}
1,s))});o.displayName="Switch"},18034:function(e,i,n){"use strict";n.d(i,{OK:function(){return z},cb:function(){return S},gC:function(){return f},mQ:function(){return w},nP:function(){return E},td:function(){return F},x4:function(){return T},xD:function(){return useTab}});var t=n(67294),l=n(38655),a=n(28387),r=n(54520),o=n(18702),s=n(59430),d=n(44040),c=n(98053),u=n(34031),h=n(76734),x=n(82359),cx=(...e)=>e.filter(Boolean).join(" ");function callAllHandlers(...e){return function(i){e.some(e=>(null==e||e(i),null==i?void 0:i.defaultPrevented))}}var[m,g,b,p]=(0,s.n)(),[v,f]=(0,a.k)({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within <Tabs />"});function useTab(e){let{isDisabled:i,isFocusable:n,...t}=e,{setSelectedIndex:l,isManual:a,id:r,setFocusedIndex:s,selectedIndex:d}=f(),{index:c,register:u}=p({disabled:i&&!n}),x=c===d,m=(0,o.h)({...t,ref:(0,h.lq)(u,e.ref),isDisabled:i,isFocusable:n,onClick:callAllHandlers(e.onClick,()=>{l(c)})});return{...m,
1id:makeTabId(r,c),role:"tab",tabIndex:x?0:-1,type:"button","aria-selected":x,"aria-controls":makeTabPanelId(r,c),onFocus:i?void 0:callAllHandlers(e.onFocus,()=>{s(c);let e=i&&n;a||e||l(c)})}}var[j,I]=(0,a.k)({});function makeTabId(e,i){return`${e}--tab-${i}`}function makeTabPanelId(e,i){return`${e}--tabpanel-${i}`}var[y,C]=(0,a.k)({name:"TabsStylesContext",errorMessage:"useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in \"<Tabs />\" "}),w=(0,l.Gp)(function(e,i){let n=(0,l.jC)("Tabs",e),{children:a,className:o,...s}=(0,r.Lr)(e),{htmlProps:d,descendants:u,...h}=function(e){let{defaultIndex:i,onChange:n,index:l,isManual:a,isLazy:r,lazyBehavior:o="unmount",orientation:s="horizontal",direction:d="ltr",...u}=e,[h,x]=(0,t.useState)(i??0),[m,g]=(0,c.T)({defaultValue:i??0,value:l,onChange:n});(0,t.useEffect)(()=>{null!=l&&x(l)},[l]);let p=b(),v=(0,t.useId)(),f=e.id??v,j=`tabs-${f}`;return{id:j,selectedIndex:m,focusedIndex:h,setSelectedIndex:g,setFocusedIndex:x,isManual:a,isLazy:r,lazyBehavior:o,orientation:s,descendants:p,direction:d,htmlProps:u}}(s),x=(0,t.useMemo)(()=>h,[h]),{isFitted:g,...p}=d;return t.createElement(m,{value:u},t.createElement(v,{value:x},t.createElement(y,{value:n},t.createElement(l.m$.div,{className:cx("chakra-tabs",o),ref:i,...p,__css:n.root},a))))});w.displayName="Tabs";var S=(0,l.Gp)(function(e,i){let n=function(){let e=f(),i=g(),{selectedIndex:n,orientation:l}=e,a="horizontal"===l,r="vertical"===l,[o,s]=(0,t.useState)(()=>a?{left:0,width:0}:r?{top:0,height:0}:void 0),[c,u]=(0,t.useState)(!1);return(0,d.G)(()=>{if(null==n)return;let e=i.item(n);if(null==e)return;a&&s({left:e.node.offsetLeft,width:e.node.offsetWidth}),r&&s({top:e.node.offsetTop,height:e.node.offsetHeight});let t=requestAnimationFrame(()=>{u(!0)});return()=>{t&&cancelAnimationFrame(t)}},[n,a,r,i]),{position:"absolute",transitionProperty:"left, right, top, bottom, height, width",transitionDuration:c?"200ms":"0ms",transitionTimingFunction:"cubic-bezier(0, 0, 0.2, 1)",...o}}(),a={...e.style,...n},r=C();return t.createElement(l.m$.div,{ref:i,...e,className:cx("chakra-tabs__tab-indicator",e.className),style:a,__css:r.indicator})});S.displayName="TabIndicator";var F=(0,l.Gp)(function(e,i){let n=function(e){let{focusedIndex:i,orientation:n,direction:l}=f(),a=g(),r=(0,t.useCallback)(e=>{let nextTab=()=>{var e;let n=a.nextEnabled(i);n&&(null==(e=n.node)||e.focus())},prevTab=()=>{var e;let n=a.prevEnabled(i);n&&(null==(e=n.node)||e.focus())},t="horizontal"===n,r="vertical"===n,o=e.key,s="ltr"===l?"ArrowLeft":"ArrowRight",d="ltr"===l?"ArrowRight":"ArrowLeft",c={[s]:()=>t&&prevTab(),[d]:()=>t&&nextTab(),ArrowDown:()=>r&&nextTab(),ArrowUp:()=>r&&prevTab(),Home:()=>{var e;let i=a.firstEnabled();i&&(null==(e=i.node)||e.focus())},End:()=>{var e;let i=a.lastEnabled();i&&(null==(e=i.node)||e.focus())}}[o];c&&(e.preventDefault(),c(e))},[a,i,n,l]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:callAllHandlers(e.onKeyDown,r)}}({...e,ref:i}),a=C(),r={display:"flex",...a.tablist};return t.createElement(l.m$.div,{...n,className:cx("chakra-tabs__tablist",e.className),__css:r})});F.displayName="TabList";var T=(0,l.Gp)(function(e,i){let n=function(e){let{children:i,...n}=e,{isLazy:l,lazyBehavior:a}=f(),{isSelected:r,id:o,tabId:s}=I(),d=(0,t.useRef)(!1);r&&(d.current=!0);let c=(0,x.k)({wasSelected:d.current,isSelected:r,enabled:l,mode:a});return{tabIndex:0,...n,children:c?i:null,role:"tabpanel","aria-labelledby":s,hidden:!r,id:o}}({...e,ref:i}),a=C();return t.createElement(l.m$.div,{outline:"0",...n,className:cx("chakra-tabs__tab-panel",e.className),__css:a.tabpanel})});T.displayName="TabPanel";var E=(0,l.Gp)(function(e,i){let n=function(e){let i=f(),{id:n,selectedIndex:l}=i,a=(0,u.W)(e.children),r=a.map((e,i)=>(0,t.createElement)(j,{key:i,value:{isSelected:i===l,id:makeTabPanelId(n,i),tabId:makeTabId(n,i),selectedIndex:l}},e));return{...e,children:r}}(e),a=C();return t.createElement(l.m$.div,{...n,width:"100%",ref:i,className:cx("chakra-tabs__tab-panels",e.className),__css:a.tabpanels})});E.displayName="TabPanels";var z=(0,l.Gp)(function(e,i){let n=C(),a=useTab({...e,ref:i}),r={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...n.tab};return t.createElement(l.m$.button,{...a,className:cx("chakra-tabs__tab",e.className),__css:r})});z.displayName="Tab"},75328:function(e,i,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/financials/invoice-setting",function(){return n(90827)}])},2551:function(e,i,n){"use strict";n.d(i,{Q:function(){return ConfirmDialog}});var t=n(85893),l=n(6491),a=n(2821),r=n(48641),o=n(3038),s=n(47741),d=n(67294);let ConfirmDialog=e=>{let{body:i,confirmButtonText:n,cancelButtonText:c,isOpen:u,onClose:h,onConfirm:x,shouldHideCancelButton:m,title:g,heading:b,shouldCloseOnConfirmation:p=!0,confirmButtonColorScheme:v,alternativeButtonText:f,onClickAlternativeOption:j,alertText:I}
1=e,[y,C]=d.useState(!1),w=d.useRef(null),onClickConfirm=async()=>{if(null===x){h();return}C(!0);try{await x(),p&&h()}finally{C(!1)}};return(0,t.jsxs)(a.aR,{leastDestructiveRef:w,isOpen:u,onClose:h,size:"xl",isCentered:!0,children:[(0,t.jsx)(a.dh,{}),(0,t.jsxs)(a._T,{children:[(0,t.jsx)(a.fY,{border:"1px solid",borderColor:"strokePrimary.500",children:g}),(0,t.jsx)(a.lq,{}),(0,t.jsxs)(a.iP,{minH:"50px",children:[b&&(0,t.jsx)(r.xv,{fontWeight:"semibold",fontSize:"20px",mb:"2",mt:"2",children:b}),(0,t.jsx)(r.xv,{size:"sm",fontWeight:"medium",children:i}),(null!=I?I:"").length>0&&(0,t.jsxs)(o.bZ,{status:"error",borderRadius:"md",mt:4,border:"0",children:[(0,t.jsx)(l.szr,{boxSize:5,color:"red.500",mr:0,mt:"2px"}),(0,t.jsx)(o.Cd,{mr:2}),(0,t.jsx)(o.X,{color:"red.500",fontWeight:"medium",children:I})]})]}),(0,t.jsx)(a.xo,{children:(0,t.jsxs)(r.Ug,{spacing:"4",children:[m?null:(0,t.jsx)(s.zx,{ref:w,type:"button",variant:"outline",colorScheme:"primary",borderColor:"primary.500",onClick:h,isDisabled:y,children:null!=c?c:"Cancel"}),f&&(0,t.jsx)(s.zx,{ref:w,variant:"outline",colorScheme:"primary",borderColor:"primary.500",onClick:j,isDisabled:y,children:f}),(0,t.jsx)(s.zx,{onClick:onClickConfirm,type:"button",isLoading:y,colorScheme:v,children:n})]})})]})]})}},69150:function(e,i,n){"use strict";n.r(i),n.d(i,{ConfirmDialog:function(){return t.Q}});var t=n(2551)},11984:function(e,i,n){"use strict";n.d(i,{S:function(){return a},j:function(){return r}});var t=n(82729),l=n(50456);function _templateObject(){let e=(0,t._)(["\n query GetInvoiceSetting {\n getInvoiceSetting {\n _id\n createdAt\n updatedAt\n tenantId\n invoiceNumberPrefix\n invoiceNumberSuffix\n startInvoiceNumber\n headerFields {\n organizationName {\n enabled\n label\n }\n organizationAddress {\n enabled\n label\n }\n organizationEmail {\n enabled\n label\n }\n organizationPhone {\n enabled\n label\n }\n organizationWebsite {\n enabled\n label\n }\n }\n lineItemFields {\n items {\n enabled\n label\n }\n productType {\n enabled\n label\n }\n unitPrice {\n enabled\n label\n }\n quantity {\n enabled\n label\n }\n total {\n enabled\n label\n }\n discount {\n enabled\n label\n }\n }\n footer {\n enabled\n label\n }\n paymentInstructions {\n description {\n enabled\n label\n }\n }\n automaticInvoicingEnabled\n automaticInvoicingByApprovalEnabled\n }\n }\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,t._)(["\n mutation CreateOrUpdateInvoiceSetting(\n $input: CreateOrUpdateInvoiceSettingInput!\n ) {\n createOrUpdateInvoiceSetting(input: $input) {\n ... on CreateOrUpdateInvoiceSettingSuccess {\n message\n invoiceSetting {\n _id\n createdAt\n updatedAt\n tenantId\n invoiceNumberPrefix\n invoiceNumberSuffix\n startInvoiceNumber\n headerFields {\n organizationName {\n enabled\n label\n }\n organizationAddress {\n enabled\n label\n }\n organizationEmail {\n enabled\n label\n }\n organizationPhone {\n enabled\n label\n }\n organizationWebsite {\n enabled\n label\n }\n }\n lineItemFields {\n items {\n enabled\n label\n }\n productType {\n enabled\n label\n }\n unitPrice {\n enabled\n label\n }\n quantity {\n enabled\n label\n }\n total {\n enabled\n label\n }\n discount {\n enabled\n label\n }\n }\n footer {\n enabled\n label\n }\n paymentInstructions {\n description {\n enabled\n label\n }\n }\n automaticInvoicingEnabled\n automaticInvoicingByApprovalEnabled\n }\n }\n ... on CreateOrUpdateInvoiceSettingInsufficientPermissionsError {\n message\n }\n ... on CreateOrUpdateInvoiceSettingValidationError {\n message\n fieldErrors {\n field\n message\n }\n }\n }\n }\n"]);
1return _templateObject1=function(){return e},e}let a=(0,l.Ps)(_templateObject()),r=(0,l.Ps)(_templateObject1())},49764:function(e,i,n){"use strict";n.d(i,{j:function(){return SkeletonTableBody}});var t=n(85893),l=n(36696),a=n(36158),r=n(48641);let SkeletonTableBody=e=>{let{columnCount:i,rows:n=5,columnWidths:o=[],useFullWidth:s=!1}=e;return(0,t.jsx)(l.p3,{children:[...Array(n)].map((e,n)=>(0,t.jsx)(l.Tr,{children:[...Array(i)].map((e,i)=>(0,t.jsx)(l.Td,{children:s?(0,t.jsx)(a.Od,{height:"4",borderRadius:"4px"}):(0,t.jsx)(r.xu,{bg:"gray.200",height:"4",width:o[i]||"80px",borderRadius:"4px"})},i))},n))})}},90827:function(e,i,n){"use strict";n.r(i),n.d(i,{default:function(){return Y}});var t=n(85893),l=n(96317),a=n(17508),r=n(67294),o=n(48641),s=n(18034),d=n(85200),c=n(68185),u=n(80419),h=n(36158),x=n(3038),m=n(69150),g=n(37887),b=n(50319),p=n(11984);let v={invoiceNumberPrefix:"INV-",invoiceNumberSuffix:"",startInvoiceNumber:1001,headerFields:{organizationName:{enabled:!0,label:"Company Name"},organizationAddress:{enabled:!0,label:"Organization Address"},organizationEmail:{enabled:!0,label:"Organization Email"},organizationPhone:{enabled:!0,label:"Organization Phone"},organizationWebsite:{enabled:!0,label:"Organization Website"}},lineItemFields:{items:{enabled:!0,label:"Items"},productType:{enabled:!0,label:"Product Type"},unitPrice:{enabled:!0,label:"Unit Price"},quantity:{enabled:!0,label:"Quantity"},discount:{enabled:!0,label:"Discount"},total:{enabled:!0,label:"Total"}},footer:{enabled:!0,label:"Footer"},paymentInstructions:{description:{enabled:!0,label:"Description"}},automaticInvoicingEnabled:!1,automaticInvoicingByApprovalEnabled:!1},f=(0,r.createContext)(void 0),InvoiceSettingProvider=e=>{let{children:i}=e,{data:n,loading:l,error:a,refetch:o}=(0,g.a)(p.S,{fetchPolicy:"cache-and-network",notifyOnNetworkStatusChange:!0}),[s]=(0,b.D)(p.j),[d,c]=(0,r.useState)(null),u=(0,r.useMemo)(()=>{var e,i,t,l,a,r,o,s,c,u,h,x,m,g,b,p,v,f,j,I,y,C,w,S,F,T,E,z,A,N,O,P,k,_,W,R,M,D,U,$,q,G,L,B,V,K,H,Y,Q,X,Z,J,ee,ei,en,et,el,ea,er,eo,es,ed,ec,eu,eh;if(!(null==n?void 0:n.getInvoiceSetting))return null;let ex=n.getInvoiceSetting,em={_id:ex._id,createdAt:ex.createdAt,updatedAt:ex.updatedAt,tenantId:ex.tenantId,invoiceNumberPrefix:ex.invoiceNumberPrefix||"",invoiceNumberSuffix:ex.invoiceNumberSuffix||"",startInvoiceNumber:ex.startInvoiceNumber||1001,headerFields:{organizationName:{enabled:null===(Z=null===(i=ex.headerFields)||void 0===i?void 0:null===(e=i.organizationName)||void 0===e?void 0:e.enabled)||void 0===Z||Z,label:(null===(l=ex.headerFields)||void 0===l?void 0:null===(t=l.organizationName)||void 0===t?void 0:t.label)||"Organization Name"},organizationAddress:{enabled:null===(J=null===(r=ex.headerFields)||void 0===r?void 0:null===(a=r.organizationAddress)||void 0===a?void 0:a.enabled)||void 0===J||J,label:(null===(s=ex.headerFields)||void 0===s?void 0:null===(o=s.organizationAddress)||void 0===o?void 0:o.label)||"Organization Address"},organizationEmail:{enabled:null===(ee=null===(u=ex.headerFields)||void 0===u?void 0:null===(c=u.organizationEmail)||void 0===c?void 0:c.enabled)||void 0===ee||ee,label:(null===(x=ex.headerFields)||void 0===x?void 0:null===(h=x.organizationEmail)||void 0===h?void 0:h.label)||"Organization Email"},organizationPhone:{enabled:null===(ei=null===(g=ex.headerFields)||void 0===g?void 0:null===(m=g.organizationPhone)||void 0===m?void 0:m.enabled)||void 0===ei||ei,label:(null===(p=ex.headerFields)||void 0===p?void 0:null===(b=p.organizationPhone)||void 0===b?void 0:b.label)||"Organization Phone"},organizationWebsite:{enabled:null===(en=null===(f=ex.headerFields)||void 0===f?void 0:null===(v=f.organizationWebsite)||void 0===v?void 0:v.enabled)||void 0===en||en,label:(null===(I=ex.headerFields)||void 0===I?void 0:null===(j=I.organizationWebsite)||void 0===j?void 0:j.label)||"Organization Website"}},lineItemFields:{items:{enabled:null===(et=null===(C=ex.lineItemFields)||void 0===C?void 0:null===(y=C.items)||void 0===y?void 0:y.enabled)||void 0===et||et,label:(null===(S=ex.lineItemFields)||void 0===S?void 0:null===(w=S.items)||void 0===w?void 0:w.label)||"Items"},productType:{enabled:null===(el=null===(T=ex.lineItemFields)||void 0===T?void 0:null===(F=T.productType)||void 0===F?void 0:F.enabled)||void 0===el||el,label:(null===(z=ex.lineItemFields)||void 0===z?void 0:null===(E=z.productType)||void 0===E?void 0:E.label)||"Product Type"},unitPrice:{enabled:null===(ea=null===(N=ex.lineItemFields)||void 0===N?void 0:null===(A=N.unitPrice)||void 0===A?void 0:A.enabled)||void 0===ea||ea,label:(null===(P=ex.lineItemFields)||void 0===P?void 0:null===(O=P.unitPrice)||void 0===O?void 0:O.label)||"Unit Price"},quantity:{enabled:null===(er=null===(_=ex.lineItemFields)||void 0===_?void 0:null===(k=_.quantity)||void 0===k?void 0:k.enabled)||void 0===er||er,label:(null===(R=ex.lineItemFields)||void 0===R?void 0:null===(W=R.quantity)||void 0===W?void 0:W.label)||"Quantity"},discount:{enabled:null===(eo=null===(D=ex.lineItemFields)||void 0===D?void 0:null===(M=D.discount)||void 0===M?void 0:M.enabled)||void 0===eo||eo,label:(null===($=ex.lineItemFields)||void 0===$?void 0:null===(U=$.discount)||void 0===U?void 0:U.label)||"Discount"},total:{enabled:null===(es=null===(G=ex.lineItemFields)||void 0===G?void 0:null===(q=G.total)||void 0===q?void 0:q.enabled)||void 0===es||es,label:(null===(B=ex.lineItemFields)||void 0===B?void 0:null===(L=B.total)||void 0===L?void 0:L.label)||"Total"}},footer:{enabled:null===(ed=null===(V=ex.footer)||void 0===V?void 0:V.enabled)||void 0===ed||ed,label:(null===(K=ex.footer)||void 0===K?void 0:K.label)||"Footer"},paymentInstructions:{description:{enabled:null===(ec=null===(Y=ex.paymentInstructions)||void 0===Y?void 0:null===(H=Y.description)||void 0===H?void 0:H.enabled)||void 0===ec||ec,label:(null===(X=ex.paymentInstructions)||void 0===X?void 0:null===(Q=X.description)||void 0===Q?void 0:Q.label)||"Description"}},automaticInvoicingEnabled:null!==(eu=ex.automaticInvoicingEnabled)&&void 0!==eu&&eu,automaticInvoicingByApprovalEnabled:null!==(eh=ex.automaticInvoicingByApprovalEnabled)&&void 0!==eh&&eh};return d?{...em,...d,headerFields:d.headerFields?{...em.headerFields,...d.headerFields}:em.headerFields,lineItemFields:d.lineItemFields?{...em.lineItemFields,...d.lineItemFields}:em.lineItemFields,footer:d.footer?{...em.footer,...d.footer}:em.footer,paymentInstructions:d.paymentInstructions?{...em.paymentInstructions,...d.paymentInstructions}:em.paymentInstructions}:em},[n,d]),updateSettings=async e=>{if(u)try{var i,n;c(i=>{let n=i||{};return{...n,...e,headerFields:e.headerFields?{...u.headerFields,...n.headerFields,...e.headerFields}:n.headerFields,lineItemFields:e.lineItemFields?{...u.lineItemFields,...n.lineItemFields,...e.lineItemFields}:n.lineItemFields,footer:e.footer?{...u.footer,...n.footer,...e.footer}:n.footer,paymentInstructions:e.paymentInstructions?{...u.paymentInstructions,...n.paymentInstructions,...e.paymentInstructions}:n.paymentInstructions}});let t={...void 0!==e.startInvoiceNumber?{startInvoiceNumber:e.startInvoiceNumber}:{},...void 0!==e.invoiceNumberPrefix?{invoiceNumberPrefix:e.invoiceNumberPrefix}:{},...void 0!==e.invoiceNumberSuffix?{invoiceNumberSuffix:e.invoiceNumberSuffix}:{},...void 0!==e.headerFields?{headerFields:e.headerFields}:{},...void 0!==e.lineItemFields?{lineItemFields:e.lineItemFields}:{},...void 0!==e.footer?{footer:e.footer}:{},...void 0!==e.paymentInstructions?{paymentInstructions:e.paymentInstructions}:{},...void 0!==e.automaticInvoicingEnabled?{automaticInvoicingEnabled:e.automaticInvoicingEnabled}:{},...void 0!==e.automaticInvoicingByApprovalEnabled?{automaticInvoicingByApprovalEnabled:e.automaticInvoicingByApprovalEnabled}:{}},l=await s({variables:{input:t},update:(e,i)=>{var n;let{data:t}=i;if((null==t?void 0:null===(n=t.createOrUpdateInvoiceSetting)||void 0===n?void 0:n.__typename)==="CreateOrUpdateInvoiceSettingSuccess"){let i=t.createOrUpdateInvoiceSetting.invoiceSetting;e.writeQuery({query:p.S,data:{getInvoiceSetting:i}}),e.modify({fields:{getInvoiceSetting:e=>e?{...e,automaticInvoicingEnabled:i.automaticInvoicingEnabled,automaticInvoicingByApprovalEnabled:i.automaticInvoicingByApprovalEnabled}:e}})}}}),a=null===(i=l.data)||void 0===i?void 0:i.createOrUpdateInvoiceSetting;if((null==a?void 0:a.__typename)==="CreateOrUpdateInvoiceSettingSuccess")c(null);else if((null==a?void 0:a.__typename)==="CreateOrUpdateInvoiceSettingInsufficientPermissionsError")throw c(null),Error(a.message||"Insufficient permissions to update invoice settings");else if((null==a?void 0:a.__typename)==="CreateOrUpdateInvoiceSettingValidationError"){c(null);let e=(null===(n=a.fieldErrors)||void 0===n?void 0:n.length)?a.fieldErrors.map(e=>"".concat(e.field,": ").concat(e.message)).join(", "):a.message||"Validation error";throw Error(e)}else throw c(null),Error("Failed to update invoice settings")}catch(e){throw c(null),e}},h=(0,r.useMemo)(()=>({data:u,loading:l,error:a||null,refetch:o,updateSettings}),[u,l,a,o]);return(0,t.jsx)(f.Provider,{value:h,children:i})},useInvoiceSettingContext=()=>{let e=(0,r.useContext)(f);if(void 0===e)throw Error("useInvoiceSettingContext must be used within an InvoiceSettingProvider");return e},useInvoiceSetting=()=>{let{data:e,loading:i,error:n,refetch:t}=useInvoiceSettingContext(),l=(0,r.useMemo)(()=>e||v,[e]);return{settings:l,loading:i,error:n,refetch:t,hasCustomSettings:!!e}};var j=n(1644),I=n(8395),y=n(20979),C=n(36696),w=n(97026),S=n(32683),F=n(47503),T=n(52670),E=n(6491),z=n(51992),A=n(49764),N=n(82729),O=n(50456);
1function _templateObject(){let e=(0,N._)(["\n query GetAutomaticInvoicingMembers(\n $input: GetAutomaticInvoicingMembersInput!\n ) {\n getAutomaticInvoicingMembers(input: $input) {\n results {\n membershipTermId\n userId\n organizationId\n userName\n membershipName\n membershipStatus\n invoiceCreated\n invoiceApproved\n invoiceId\n invoiceStatus\n invoiceApprovalStatus\n }\n totalCount\n hasMore\n statusCounts {\n all\n notCreated\n pendingApproval\n approved\n }\n }\n }\n"]);return _templateObject=function(){return e},e}let P=(0,O.Ps)(_templateObject()),k={[F.$x.ACTIVE]:"Active",[F.$x.UP_FOR_RENEWAL]:"Up for Renewal",[F.$x.PAST_DUE]:"Past Due",[F.$x.RECENTLY_LAPSED]:"Recently Lapsed",[F.$x.LAPSED]:"Lapsed"},_={[F.$x.ACTIVE]:"green",[F.$x.UP_FOR_RENEWAL]:"blue",[F.$x.PAST_DUE]:"orange",[F.$x.RECENTLY_LAPSED]:"red",[F.$x.LAPSED]:"gray"},W={[F.Ar.NOT_CREATED]:"Not Created",[F.Ar.PENDING_APPROVAL]:"Pending Approval",[F.Ar.APPROVED]:"Approved"},R={[F.Ar.NOT_CREATED]:"gray",[F.Ar.PENDING_APPROVAL]:"orange",[F.Ar.APPROVED]:"green"},StatusFilterCard=e=>{let{label:i,count:n,isSelected:l,onClick:a}=e;return(0,t.jsxs)(o.xu,{bg:"white",borderRadius:"md",boxShadow:"sm",p:4,onClick:a,cursor:"pointer",position:"relative",borderWidth:"1px",borderColor:l?"primary.200":"gray.100",children:[l&&(0,t.jsx)(o.xu,{position:"absolute",left:"0",top:"0",bottom:"0",width:"4px",bg:"primary.500",borderRadius:"4px 0 0 4px"}),(0,t.jsxs)(o.gC,{spacing:1,align:"center",fontWeight:"semibold",fontSize:"md",children:[(0,t.jsx)(o.xv,{textAlign:"center",children:i}),(0,t.jsx)(o.xv,{fontWeight:"bold",fontSize:"2xl",color:"primary.500",children:n})]})]})},AutomaticInvoicingMembersList=e=>{var i,n,l,a,s,d,c,u;let{showApprovalColumns:h}=e,[x,m]=(0,r.useState)(""),b=(0,z.c)(x,400),[p,v]=(0,r.useState)("all"),f=(0,r.useRef)(null),N=(0,r.useRef)(null),O=(0,I.ff)("gray.200","whiteAlpha.200"),M=(0,I.ff)("gray.50","whiteAlpha.100"),D=(0,r.useMemo)(()=>({input:{offset:0,limit:20,search:b||null,filters:{invoiceApprovalStatus:h&&"all"!==p?p:null}}}),[b,p,h]),{data:U,error:$,fetchMore:q,networkStatus:G}=(0,g.a)(P,{variables:D,fetchPolicy:"cache-and-network",notifyOnNetworkStatusChange:!0}),L=null!==(s=null==U?void 0:null===(i=U.getAutomaticInvoicingMembers)||void 0===i?void 0:i.results)&&void 0!==s?s:[],B=null!==(d=null==U?void 0:null===(n=U.getAutomaticInvoicingMembers)||void 0===n?void 0:n.totalCount)&&void 0!==d?d:0,V=null!==(c=null==U?void 0:null===(l=U.getAutomaticInvoicingMembers)||void 0===l?void 0:l.hasMore)&&void 0!==c&&c,K=null!==(u=null==U?void 0:null===(a=U.getAutomaticInvoicingMembers)||void 0===a?void 0:a.statusCounts)&&void 0!==u?u:{all:0,notCreated:0,pendingApproval:0,approved:0},H=G===j.I.loading||G===j.I.setVariables,Y=G===j.I.fetchMore,Q=(0,r.useCallback)(async()=>{H||Y||!V||await q({variables:{input:{...D.input,offset:L.length,limit:20}},updateQuery:(e,i)=>{let{fetchMoreResult:n}=i;if(!n)return e;let t=[...e.getAutomaticInvoicingMembers.results,...n.getAutomaticInvoicingMembers.results],l=t.filter((e,i,n)=>i===n.findIndex(i=>i.membershipTermId===e.membershipTermId));return{...e,getAutomaticInvoicingMembers:{...n.getAutomaticInvoicingMembers,results:l}}}})},[q,V,Y,H,L.length,D.input]);return(0,r.useEffect)(()=>{let e=N.current,i=f.current;if(!e||!i||H)return;let n=new IntersectionObserver(e=>{let[i]=e;(null==i?void 0:i.isIntersecting)&&Q()},{root:i,rootMargin:"120px",threshold:0});return n.observe(e),()=>n.disconnect()},[Q,L.length,V,H]),(0,r.useEffect)(()=>{h||"all"===p||v("all")},[h,p]),(0,t.jsxs)(o.gC,{spacing:6,align:"stretch",mt:4,children:[h&&(0,t.jsxs)(o.MI,{columns:{base:2,md:4},spacing:4,children:[(0,t.jsx)(StatusFilterCard,{label:"All Members",count:K.all,isSelected:"all"===p,onClick:()=>v("all")}),(0,t.jsx)(StatusFilterCard,{label:"Not Created",count:K.notCreated,isSelected:p===F.Ar.NOT_CREATED,onClick:()=>v(F.Ar.NOT_CREATED)}),(0,t.jsx)(StatusFilterCard,{label:"Pending Approval",count:K.pendingApproval,isSelected:p===F.Ar.PENDING_APPROVAL,onClick:()=>v(F.Ar.PENDING_APPROVAL)}),(0,t.jsx)(StatusFilterCard,{label:"Approved",count:K.approved,isSelected:p===F.Ar.APPROVED,onClick:()=>v(F.Ar.APPROVED)})]}),(0,t.jsxs)(T.Z,{bg:"white",p:6,children:[(0,t.jsx)(o.xv,{fontSize:"lg",fontWeight:"bold",color:"gray.900",mb:1,children:"Automatic Invoicing Members"}),(0,t.jsx)(o.xv,{fontSize:"sm",color:"gray.600",mb:6,children:h?"Review members opted into automatic invoicing and track renewal invoice approval status":"Members who selected automatic invoicing when purchasing membership"}),(0,t.jsx)(o.kC,{justify:"space-between",align:{base:"left",lg:"center"},gap:4,flexDirection:{base:"column",md:"column",lg:"row"},flexWrap:"wrap",mb:6,children:(0,t.jsx)(o.xu,{children:(0,t.jsxs)(y.BZ,{w:"320px",children:[(0,t.jsx)(y.Z8,{pointerEvents:"none",children:(0,t.jsx)(E.W1M,{color:"gray.400"})}),(0,t.jsx)(y.II,{placeholder:"Search by Name & Membership",value:x,onChange:e=>m(e.target.value),bg:"white",borderColor:"gray.300",_focus:{borderColor:"blue.500",boxShadow:"0 0 0 1px #3182ce"}})]})})}),(0,t.jsxs)(o.xu,{overflow:"hidden",pb:2,children:[(0,t.jsxs)(o.xu,{ref:f,overflowX:"auto",overflowY:"auto",maxH:"60vh",minH:H||L.length>0?"280px":void 0,borderRadius:"md",children:[(0,t.jsxs)(C.iA,{size:"sm",children:[(0,t.jsx)(C.hr,{children:(0,t.jsxs)(C.Tr,{borderBottom:"1px",borderColor:O,children:[(0,t.jsx)(C.Th,{py:3,children:"User Name"}),(0,t.jsx)(C.Th,{py:3,children:"Membership"}),(0,t.jsx)(C.Th,{py:3,children:"Membership Status"}),(0,t.jsx)(C.Th,{py:3,children:"Invoice Status"})]})}
1),H?(0,t.jsx)(A.j,{columnCount:4,useFullWidth:!0,rows:10}):$?(0,t.jsx)(S.fQ,{children:(0,t.jsx)(o.xv,{color:"red.500",children:"Failed to load automatic invoicing members"})}):L.length>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.p3,{children:L.map(e=>(0,t.jsxs)(C.Tr,{_hover:{bg:M},children:[(0,t.jsx)(C.Td,{children:(0,t.jsx)(w.u,{label:e.userName,children:(0,t.jsx)(o.xv,{maxW:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e.userName||"-"})})}),(0,t.jsx)(C.Td,{children:(0,t.jsx)(w.u,{label:e.membershipName,children:(0,t.jsx)(o.xv,{maxW:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e.membershipName||"-"})})}),(0,t.jsx)(C.Td,{children:(0,t.jsx)(o.Ct,{colorScheme:_[e.membershipStatus],variant:"subtle",textTransform:"none",children:k[e.membershipStatus]})}),(0,t.jsx)(C.Td,{children:(0,t.jsx)(o.Ct,{colorScheme:R[e.invoiceApprovalStatus],variant:"subtle",textTransform:"none",children:W[e.invoiceApprovalStatus]})})]},e.membershipTermId))}),Y&&(0,t.jsx)(A.j,{columnCount:4,useFullWidth:!0,rows:3})]}):(0,t.jsx)(S.fQ,{children:h&&"all"!==p?"No members found for this invoice status":"No members have opted into automatic invoicing yet."})]}),!H&&V&&(0,t.jsx)(o.xu,{ref:N,h:"1px"})]}),(0,t.jsx)(o.kC,{justify:"center",align:"center",mt:4,children:(0,t.jsxs)(o.xu,{as:"span",fontSize:"sm",children:["Showing total ",null!=B?B:0," entries"]})})]})]})]})},AutomaticInvoicingToggleCard=e=>{let{title:i,description:n,isChecked:l,isDisabled:a,onChange:r}=e;return(0,t.jsx)(o.xu,{bg:"primary.50",borderRadius:"lg",p:4,h:"full",children:(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",gap:4,children:[(0,t.jsxs)(o.xu,{flex:"1",minW:0,children:[(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"semibold",color:"gray.800",mb:1,children:i}),(0,t.jsx)(o.xv,{fontSize:"sm",color:"gray.600",lineHeight:"tall",children:n})]}),(0,t.jsx)(c.r,{colorScheme:"blue",isChecked:l,isDisabled:a,onChange:e=>r(e.target.checked),flexShrink:0})]})})},SettingsContainer=e=>{let{children:i}=e;return(0,t.jsxs)(o.xu,{bg:"white",borderWidth:"1px",borderColor:"primary.100",borderRadius:"lg",p:{base:4,md:6},children:[(0,t.jsx)(o.xv,{fontSize:"lg",fontWeight:"bold",color:"gray.900",mb:{base:4,md:6},children:"Automatic Invoicing"}),i]})},AutomaticInvoicingSettings=()=>{var e,i;let n=(0,u.pm)(),{data:l,loading:a,updateSettings:s}=useInvoiceSettingContext(),[d,c]=(0,r.useState)(null),[g,b]=(0,r.useState)(!1),p=null!==(e=null==l?void 0:l.automaticInvoicingEnabled)&&void 0!==e&&e,v=null!==(i=null==l?void 0:l.automaticInvoicingByApprovalEnabled)&&void 0!==i&&i,f=!p&&!v,applyToggle=async e=>{if(e){b(!0);try{"direct"===e.type?await s({automaticInvoicingEnabled:e.enabled,automaticInvoicingByApprovalEnabled:!e.enabled&&v}):await s({automaticInvoicingByApprovalEnabled:e.enabled,automaticInvoicingEnabled:!e.enabled&&p})}catch(e){n({status:"error",description:e instanceof Error?e.message:"Failed to update automatic invoicing settings"})}finally{b(!1),c(null)}}},requestToggle=(e,i,n)=>{if(!i){applyToggle({type:e,enabled:i});return}if(n){c({type:e,enabled:i});return}applyToggle({type:e,enabled:i})};return a?(0,t.jsx)(SettingsContainer,{children:(0,t.jsx)(o.rj,{templateColumns:{base:"1fr",lg:"1fr 1fr"},gap:4,children:[0,1].map(e=>(0,t.jsx)(o.xu,{bg:"primary.50",borderRadius:"lg",p:4,children:(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",gap:4,children:[(0,t.jsxs)(o.xu,{flex:"1",children:[(0,t.jsx)(h.Od,{height:"20px",width:"200px",mb:2}),(0,t.jsx)(h.Od,{height:"14px",width:"100%",mb:1}),(0,t.jsx)(h.Od,{height:"14px",width:"85%"})]}),(0,t.jsx)(h.Od,{height:"24px",width:"44px",borderRadius:"full"})]})},e))})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(SettingsContainer,{children:(0,t.jsxs)(o.rj,{templateColumns:{base:"1fr",lg:"1fr 1fr"},gap:4,children:[(0,t.jsx)(AutomaticInvoicingToggleCard,{title:"Automatic Invoicing",description:"Allow the option of automatic invoicing for members who are due for renewal, without requiring an approval process",isChecked:p,isDisabled:a||g,onChange:e=>requestToggle("direct",e,v)}),(0,t.jsx)(AutomaticInvoicingToggleCard,{title:"Automatic Invoicing by Approval",description:"Renewal invoices are generated only after admin a
1pproval. Members who opt in will be reviewed before automatic invoicing is enabled.",isChecked:v,isDisabled:a||g,onChange:e=>requestToggle("approval",e,p)})]})}),f&&(0,t.jsxs)(x.bZ,{status:"warning",mt:4,children:[(0,t.jsx)(x.zM,{}),(0,t.jsxs)(x.X,{children:["Both automatic invoicing options are turned off. Members who previously selected"," ",(0,t.jsx)(o.xv,{as:"span",fontWeight:"semibold",children:"Automatic Invoicing"})," ","will be treated as"," ",(0,t.jsx)(o.xv,{as:"span",fontWeight:"semibold",children:"Send Renewal Reminders"})," ","until you turn one of these options back on."]})]}),(0,t.jsx)(AutomaticInvoicingMembersList,{showApprovalColumns:v}),(0,t.jsx)(m.ConfirmDialog,{isOpen:null!==d,onClose:()=>c(null),title:"Change Automatic Invoicing Mode",body:"Enabling this setting will disable the other automatic invoicing mode.",confirmButtonText:"Continue",cancelButtonText:"Cancel",onConfirm:()=>applyToggle(d)})]})};var M=n(69171),D=n(48076);function graphql_templateObject(){let e=(0,N._)(["\n query GetInvoiceCartGenerationSettings {\n getInvoiceCartGenerationSettings {\n allowIndividualUserToGenerateInvoiceThroughCart\n allowOrganizationOwnerToGenerateInvoiceThroughCart\n allowUserToGenerateInvoiceThroughCart\n }\n }\n"]);return graphql_templateObject=function(){return e},e}function _templateObject1(){let e=(0,N._)(["\n mutation UpdateInvoiceCartGenerationSettings(\n $input: UpdateInvoiceCartGenerationSettingsInput!\n ) {\n updateInvoiceCartGenerationSettings(input: $input) {\n message\n status\n }\n }\n"]);return _templateObject1=function(){return e},e}let U=(0,O.Ps)(graphql_templateObject()),$=(0,O.Ps)(_templateObject1()),ToggleRow=e=>{let{label:i,description:n,isChecked:l,isDisabled:a,onChange:r}=e;return(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",gap:4,children:[(0,t.jsxs)(o.xu,{flex:"1",minW:0,children:[i,n?(0,t.jsx)(o.xv,{fontSize:"sm",color:"gray.500",mt:1,children:n}):null]}),(0,t.jsx)(c.r,{colorScheme:"blue",isChecked:l,isDisabled:a,onChange:e=>r(e.target.checked),flexShrink:0})]})},InvoiceMeSettings=()=>{var e,i,n;let l=(0,u.pm)(),[a,s]=(0,r.useState)(!1),{data:d,loading:c,error:x}=(0,g.a)(U,{fetchPolicy:"cache-and-network"}),[m]=(0,b.D)($),p=null==d?void 0:d.getInvoiceCartGenerationSettings,v=null!==(e=null==p?void 0:p.allowUserToGenerateInvoiceThroughCart)&&void 0!==e&&e,f=null!==(i=null==p?void 0:p.allowIndividualUserToGenerateInvoiceThroughCart)&&void 0!==i&&i,j=null!==(n=null==p?void 0:p.allowOrganizationOwnerToGenerateInvoiceThroughCart)&&void 0!==n&&n,handleUpdate=async e=>{s(!0);try{var i;let n=await m({variables:{input:e},refetchQueries:[{query:U}]}),t=null===(i=n.data)||void 0===i?void 0:i.updateInvoiceCartGenerationSettings;if(t&&!t.status)throw Error(t.message||"Failed to update Invoice Me settings")}catch(e){l({status:"error",description:e instanceof Error?e.message:"Failed to update Invoice Me settings"})}finally{s(!1)}};return c&&!p?(0,t.jsx)(o.xu,{bg:"white",borderRadius:"lg",boxShadow:"md",p:{base:4,md:6},maxW:"900px",children:(0,t.jsx)(o.gC,{spacing:4,align:"stretch",children:(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",gap:4,children:[(0,t.jsxs)(o.xu,{flex:"1",children:[(0,t.jsx)(h.Od,{height:"20px",width:"180px",mb:2}),(0,t.jsx)(h.Od,{height:"14px",width:"160px"})]}),(0,t.jsx)(h.Od,{height:"24px",width:"44px",borderRadius:"full"})]})})}):x?(0,t.jsx)(D.S,{}):p?(0,t.jsx)(o.xu,{bg:"white",borderRadius:"lg",boxShadow:"md",p:{base:4,md:6},maxW:"900px",children:(0,t.jsxs)(o.gC,{spacing:6,align:"stretch",children:[(0,t.jsx)(ToggleRow,{label:(0,t.jsxs)(o.gC,{align:"start",spacing:1,children:[(0,t.jsxs)(o.Ug,{spacing:2,children:[(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"semibold",color:"gray.800",children:"Enable Invoice Me"}),(0,t.jsx)(w.u,{label:"When enabled, Invoice Me will appear as a payment option during checkout. Selecting it allows the user to complete the transaction without immediate payment. An unpaid invoice will be automatically created and emailed to the user.",hasArrow:!0,placement:"right",px:4,py:3,maxW:"sm",fontSize:"sm",lineHeight:"tall",children:(0,t.jsx)(o.xu,{as:"span",display:"inline-flex",alignItems:"center",onClick:e=>{e.preventDefault(),e.stopPropagation()},children:(0,t.jsx)(E.szr,{boxSize:4,color:"gray.500"})})})]}),(0,t.jsxs)(o.xv,{fontSize:"sm",color:"gray.500",children:["Invoice Me is ",v?"enabled":"disabled","."]})]}),isChecked:v,isDisabled:a,onChange:e=>void handleUpdate({allowUserToGenerateInvoiceThroughCart:e,allowIndividualUserToGenerateInvoiceThroughCart:null,allowOrganizationOwnerToGenerateInvoiceThroughCart:null})}),v&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.iz,{borderColor:"gray.200"}),(0,t.jsxs)(o.gC,{spacing:4,align:"stretch",children:[(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"semibold",color:"gray.800",mb:1,children:"Who can use Invoice Me?"}),(0,t.jsx)(o.xv,{fontSize:"sm",color:"gray.500",children:"Choose whether Invoice Me is available to individuals, organizations, or both."})]}),(0,t.jsx)(ToggleRow,{label:(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"semibold",color:"gray.800",children:"Allow Indiv
1iduals"}),isChecked:f,isDisabled:a,onChange:e=>void handleUpdate({allowUserToGenerateInvoiceThroughCart:null,allowIndividualUserToGenerateInvoiceThroughCart:e,allowOrganizationOwnerToGenerateInvoiceThroughCart:null})}),(0,t.jsx)(ToggleRow,{label:(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"semibold",color:"gray.800",children:"Allow Organizations"}),isChecked:j,isDisabled:a,onChange:e=>void handleUpdate({allowUserToGenerateInvoiceThroughCart:null,allowIndividualUserToGenerateInvoiceThroughCart:null,allowOrganizationOwnerToGenerateInvoiceThroughCart:e})})]})]})]})}):(0,t.jsx)(M.g,{})};var q=n(83234),G=n(57026),L=n(47741);let InvoiceNumberSetting=()=>{let{settings:e,loading:i,error:n}=useInvoiceSetting(),l=useInvoiceSettingContext(),{updateSettings:a}=l,s=(0,u.pm)(),[d,c]=(0,r.useState)("1001"),[m,g]=(0,r.useState)("INV"),[b,p]=(0,r.useState)(""),[v,f]=(0,r.useState)(!1),[j,I]=(0,r.useState)({prefix:"",startingNumber:""});(0,r.useEffect)(()=>{e&&(c(e.startInvoiceNumber.toString()),g(e.invoiceNumberPrefix),p(e.invoiceNumberSuffix))},[e]);let validatePrefix=e=>e&&""!==e.trim()?/^[a-zA-Z0-9-]+$/.test(e)?"":"Only alphabets, numbers, and hyphens are allowed":"Prefix is required",validateStartingNumber=e=>{if(!e)return"Starting number is required";if(!/^\d+$/.test(e))return"Special characters and symbols are not allowed";let i=parseInt(e);return i<1?"Starting number must be greater than 0":""},handlePrefixChange=e=>{g(e);let i=validatePrefix(e);I(e=>({...e,prefix:i}))},handleStartingNumberChange=e=>{c(e);let i=validateStartingNumber(e);I(e=>({...e,startingNumber:i}))},C="".concat(m,"-").concat(d).concat(b?"yyyy"===b?"-".concat(new Date().getFullYear()):"-".concat(new Date().getMonth(),"-").concat(new Date().getFullYear()):""),handleApply=async()=>{let e=validatePrefix(m),i=validateStartingNumber(d);if(I({prefix:e,startingNumber:i}),!e&&!i){f(!0);try{await a({invoiceNumberPrefix:m,invoiceNumberSuffix:b,startInvoiceNumber:parseInt(d)}),s({title:"Success",description:"Invoice number settings updated successfully",status:"success",duration:3e3,isClosable:!0})}catch(e){s({title:"Error",description:e.message||"Failed to update invoice number settings",status:"error",duration:5e3,isClosable:!0})}finally{f(!1)}}};return i?(0,t.jsx)(o.xu,{borderWidth:"1px",borderColor:"gray.200",borderRadius:"lg",p:{base:4,md:6},bg:"white",children:(0,t.jsxs)(o.gC,{spacing:6,align:"stretch",children:[(0,t.jsxs)(o.rj,{templateColumns:{base:"1fr",md:"repeat(3, 1fr)"},gap:4,children:[(0,t.jsxs)(o.P4,{children:[(0,t.jsx)(h.Od,{height:"14px",width:"60px",mb:2}),(0,t.jsx)(h.Od,{height:"40px",borderRadius:"md"})]}),(0,t.jsxs)(o.P4,{children:[(0,t.jsx)(h.Od,{height:"14px",width:"110px",mb:2}),(0,t.jsx)(h.Od,{height:"40px",borderRadius:"md"})]}),(0,t.jsxs)(o.P4,{children:[(0,t.jsx)(h.Od,{height:"14px",width:"50px",mb:2}),(0,t.jsx)(h.Od,{height:"40px",borderRadius:"md"})]})]}),(0,t.jsx)(h.Od,{height:"16px",width:"280px"}),(0,t.jsx)(o.Ug,{justify:"flex-end",children:(0,t.jsx)(h.Od,{height:"40px",width:"100px",borderRadius:"md"})})]})}):n?(0,t.jsx)(o.xu,{borderWidth:"1px",borderColor:"gray.200",borderRadius:"lg",p:{base:4,md:6},bg:"white",children:(0,t.jsxs)(x.bZ,{status:"error",children:[(0,t.jsx)(x.zM,{}),"Failed to load invoice settings. Please try again later."]})}):(0,t.jsx)(o.xu,{borderWidth:"1px",borderColor:"gray.200",borderRadius:"lg",p:{base:4,md:6},bg:"white",children:(0,t.jsxs)(o.gC,{spacing:6,align:"stretch",children:[(0,t.jsxs)(o.rj,{templateColumns:{base:"1fr",md:"repeat(3, 1fr)"},gap:4,children:[(0,t.jsx)(o.P4,{children:(0,t.jsxs)(q.NI,{isRequired:!0,isInvalid:!!j.prefix,children:[(0,t.jsx)(q.lX,{fontSize:"sm",fontWeight:"medium",children:"Prefix"}),(0,t.jsx)(y.II,{value:m,onChange:e=>handlePrefixChange(e.target.value),placeholder:"INV",isDisabled:v}),(0,t.jsx)(q.J1,{children:j.prefix})]})}),(0,t.jsx)(o.P4,{children:(0,t.jsxs)(q.NI,{isRequired:!0,isInvalid:!!j.startingNumber,children:[(0,t.jsx)(q.lX,{fontSize:"sm",fontWeight:"medium",children:"Starting Number"}),(0,t.jsx)(y.II,{value:d,onChange:e=>handleStartingNumberChange(e.target.value),placeholder:"1001",type:"number",min:"1",isDisabled:v}),(0,t.jsx)(q.J1,{children:j.startingNumber})]})}),(0,t.jsx)(o.P4,{children:(0,t.jsxs)(q.NI,{isRequired:!0,children:[(0,t.jsx)(q.lX,{fontSize:"sm",fontWeight:"medium",children:"Suffix"}),(0,t.jsxs)(G.Ph,{value:b,onChange:e=>p(e.target.value),placeholder:"Select Suffix",isDisabled:v,children:[(0,t.jsx)("option",{value:"yyyy",children:"YYYY"}),(0,t.jsx)("option",{value:"mm-yy",children:"MM-YY"})]})]})})]}),(0,t.jsxs)(o.xv,{fontSize:"sm",color:"gray.700",children:["Invoice Number Preview:"," ",(0,t.jsx)(o.xv,{as:"span",fontWeight:"medium",color:"blue.600",children:C})]}),(0,t.jsx)(o.Ug,{justify:"flex-end",children:(0,t.jsx)(L.zx,{colorScheme:"blue",onClick:handleApply,px:8,isLoading:v,loadingText:"Ap
1plying...",children:"Apply"})})]})})},ConfigSection=e=>{let{title:i,children:n}=e;return(0,t.jsxs)(o.gC,{align:"stretch",spacing:3,mb:6,children:[(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"semibold",color:"gray.700",children:i}),(0,t.jsx)(o.gC,{align:"stretch",spacing:2,children:n})]})},ToggleField=e=>{let{label:i,isChecked:n,onChange:l,icon:a}=e;return(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",py:2,px:3,bg:"gray.50",borderRadius:"md",_hover:{bg:"gray.100"},transition:"background 0.2s",children:[(0,t.jsxs)(o.kC,{align:"center",gap:2,children:[(0,t.jsx)(o.xv,{fontSize:"sm",color:"gray.900",children:i}),a]}),(0,t.jsx)(c.r,{colorScheme:"blue",isChecked:n,onChange:e=>l(e.target.checked),size:"md"})]})},EditableField=e=>{let{label:i,isChecked:n,onChange:l,onEdit:a}=e;return(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",py:2,px:3,bg:"gray.50",borderRadius:"md",_hover:{bg:"gray.100"},transition:"background 0.2s",children:[(0,t.jsxs)(o.kC,{align:"center",gap:2,children:[(0,t.jsx)(o.xv,{fontSize:"sm",color:"gray.900",children:i}),(0,t.jsx)(E.dY8,{color:"blue.500",cursor:"pointer",onClick:a,_hover:{color:"blue.600"}})]}),(0,t.jsx)(c.r,{colorScheme:"blue",isChecked:n,onChange:e=>l(e.target.checked),size:"md"})]})};var B=n(2821);let EditFieldModal=e=>{let{isOpen:i,onClose:n,fieldLabel:l,currentValue:a,onUpdate:o}=e,[s,d]=(0,r.useState)(a),[c,h]=(0,r.useState)(!1),x=(0,u.pm)();(0,r.useEffect)(()=>{d(a)},[a]);let handleUpdate=async()=>{if(!s.trim()){x({title:"Validation Error",description:"Field label cannot be empty",status:"error",duration:3e3,isClosable:!0});return}if(s===a){n();return}h(!0);try{await o(s),x({title:"Success",description:"Field updated successfully",status:"success",duration:3e3,isClosable:!0}),n()}catch(e){x({title:"Error",description:e.message||"Failed to update field",status:"error",duration:5e3,isClosable:!0})}finally{h(!1)}},handleClose=()=>{c||(d(a),n())};return(0,t.jsxs)(B.u_,{isOpen:i,onClose:handleClose,isCentered:!0,children:[(0,t.jsx)(B.ZA,{}),(0,t.jsxs)(B.hz,{children:[(0,t.jsx)(B.xB,{children:"Edit Field"}),(0,t.jsx)(B.ol,{isDisabled:c}),(0,t.jsx)(B.fe,{children:(0,t.jsxs)(q.NI,{children:[(0,t.jsx)(q.lX,{children:"Display Text"}),(0,t.jsx)(y.II,{value:s,onChange:e=>d(e.target.value),placeholder:"Enter display text",isDisabled:c,autoFocus:!0})]})}),(0,t.jsxs)(B.mz,{gap:3,children:[(0,t.jsx)(L.zx,{variant:"outline",onClick:handleClose,isDisabled:c,
1children:"Cancel"}),(0,t.jsx)(L.zx,{colorScheme:"blue",onClick:handleUpdate,isLoading:c,loadingText:"Updating...",children:"Update"})]})]})]})},InvoiceTemplateConfig=()=>{let e=useInvoiceSettingContext(),{data:i,loading:n,error:l,updateSettings:a}=e,s=(0,u.pm)(),[d,c]=(0,r.useState)({headerFields:{organizationName:!0,organizationAddress:!0,organizationEmail:!0,organizationPhone:!0,organizationWebsite:!0},lineItemColumns:{items:!0,productType:!0,unitPrice:!0,quantity:!0,discount:!0,total:!0},footerFields:{description:!0},paymentInstructions:{description:!0}}),[m,g]=(0,r.useState)({isOpen:!1,fieldType:null,fieldKey:null,currentLabel:""});(0,r.useEffect)(()=>{i&&c({headerFields:{organizationName:i.headerFields.organizationName.enabled,organizationAddress:i.headerFields.organizationAddress.enabled,organizationEmail:i.headerFields.organizationEmail.enabled,organizationPhone:i.headerFields.organizationPhone.enabled,organizationWebsite:i.headerFields.organizationWebsite.enabled},lineItemColumns:{items:i.lineItemFields.items.enabled,productType:i.lineItemFields.productType.enabled,unitPrice:i.lineItemFields.unitPrice.enabled,quantity:i.lineItemFields.quantity.enabled,discount:i.lineItemFields.discount.enabled,total:i.lineItemFields.total.enabled},footerFields:{description:i.footer.enabled},paymentInstructions:{description:i.paymentInstructions.description.enabled}})},[i]);let updateFieldEnabled=async(e,n,t)=>{if(!i)return;let l={headerFields:"headerFields",lineItemFields:"lineItemColumns",footer:"footerFields",paymentInstructions:"paymentInstructions"}[e];c(e=>({...e,[l]:{...e[l],[n]:t}}));try{let l={};if("headerFields"===e){let e=i.headerFields[n];l.headerFields={[n]:{enabled:t,label:e.label}}}else if("lineItemFields"===e){let e=i.lineItemFields[n];l.lineItemFields={[n]:{enabled:t,label:e.label}}}else if("footer"===e)l.footer={enabled:t,label:i.footer.label};else if("paymentInstructions"===e){let e=i.paymentInstructions[n];l.paymentInstructions={[n]:{enabled:t,label:e.label}}}await a(l),s({title:"Updated",description:"Field visibility updated successfully",status:"success",duration:2e3,isClosable:!0})}catch(e){c(e=>({...e,[l]:{...e[l],[n]:!t}})),s({title:"Error",description:e.message||"Failed to update field visibility",status:"error",duration:3e3,isClosable:!0})}},handleOpenEditModal=(e,i,n)=>{g({isOpen:!0,fieldType:e,fieldKey:i,currentLabel:n})},handleUpdateFieldLabel=async e=>{if(!m.fieldType||!m.fieldKey||!i)return;let n={};if("headerFields"===m.fieldType){let t=i.headerFields[m.fieldKey];n.headerFields={[m.fieldKey]:{enabled:t.enabled,label:e}}}else if("lineItemFields"===m.fieldType){let t=i.lineItemFields[m.fieldKey];n.lineItemFields={[m.fieldKey]:{enabled:t.enabled,label:e}}}
1else if("footer"===m.fieldType)n.footer={enabled:i.footer.enabled,label:e};else if("paymentInstructions"===m.fieldType){let t=i.paymentInstructions[m.fieldKey];n.paymentInstructions={[m.fieldKey]:{enabled:t.enabled,label:e}}}await a(n)};return n?(0,t.jsx)(o.xu,{bg:"white",p:{base:4,md:6},borderRadius:"lg",border:"1px solid",borderColor:"gray.200",h:"full",overflowY:"auto",children:(0,t.jsxs)(o.gC,{align:"stretch",spacing:6,children:[(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(h.Od,{height:"20px",width:"120px",mb:3}),(0,t.jsx)(o.Kq,{spacing:3,children:[1,2,3,4,5].map(e=>(0,t.jsxs)(o.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,t.jsx)(h.Od,{height:"16px",width:"140px"}),(0,t.jsx)(h.Od,{height:"24px",width:"44px",borderRadius:"full"})]},e))})]}),(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(h.Od,{height:"20px",width:"150px",mb:3}),(0,t.jsx)(o.Kq,{spacing:3,children:[1,2,3,4,5,6,7].map(e=>(0,t.jsxs)(o.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,t.jsx)(h.Od,{height:"16px",width:"140px"}),(0,t.jsx)(h.Od,{height:"24px",width:"44px",borderRadius:"full"})]},e))})]}),(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(h.Od,{height:"20px",width:"120px",mb:3}),(0,t.jsxs)(o.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,t.jsx)(h.Od,{height:"16px",width:"100px"}),(0,t.jsx)(h.Od,{height:"24px",width:"44px",borderRadius:"full"})]})]}),(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(h.Od,{height:"20px",width:"180px",mb:3}),(0,t.jsxs)(o.xu,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[(0,t.jsx)(h.Od,{height:"16px",width:"100px"}),(0,t.jsx)(h.Od,{height:"24px",width:"44px",borderRadius:"full"})]})]})]})}):l?(0,t.jsx)(o.xu,{bg:"white",p:{base:4,md:6},borderRadius:"lg",border:"1px solid",borderColor:"gray.200",h:"full",overflowY:"auto",children:(0,t.jsxs)(x.bZ,{status:"error",children:[(0,t.jsx)(x.zM,{}),"Failed to load invoice settings. Please try again later."]})}):(0,t.jsxs)(o.xu,{bg:"white",p:{base:4,md:6},borderRadius:"lg",border:"1px solid",borderColor:"gray.200",h:"full",overflowY:"auto",children:[(0,t.jsxs)(o.gC,{align:"stretch",spacing:6,children:[(0,t.jsxs)(ConfigSection,{title:"Header Fields",children:[(0,t.jsx)(ToggleField,{label:"Organization Name",isChecked:d.headerFields.organizationName,onChange:e=>updateFieldEnabled("headerFields","organizationName",e)}),(0,t.jsx)(ToggleField,{label:"Address",isChecked:d.headerFields.organizationAddress,onChange:e=>updateFieldEnabled("headerFields","organizationAddress",e)}),(0,t.jsx)(ToggleField,{label:"Email",isChecked:d.headerFields.organizationEmail,onChange:e=>updateFieldEnabled("headerFields","organizationEmail",e)}),(0,t.jsx)(ToggleField,{label:"Phone Number",isChecked:d.headerFields.organizationPhone,onChange:e=>updateFieldEnabled("headerFields","organizationPhone",e)}),(0,t.jsx)(ToggleField,{label:"Website",isChecked:d.headerFields.organizationWebsite,onChange:e=>updateFieldEnabled("headerFields","organizationWebsite",e)})]}),(0,t.jsxs)(ConfigSection,{title:"Line Item Columns",children:[(0,t.jsx)(EditableField,{label:"Items",isChecked:d.lineItemColumns.items,onChange:e=>updateFieldEnabled("lineItemFields","items",e),onEdit:()=>handleOpenEditModal("lineItemFields","items",(null==i?void 0:i.lineItemFields.items.label)||"Items")}),(0,t.jsx)(EditableField,{label:"Product Type",isChecked:d.lineItemColumns.productType,onChange:e=>updateFieldEnabled("lineItemFields","productType",e),onEdit:()=>handleOpenEditModal("lineItemFields","productType",(null==i?void 0:i.lineItemFields.productType.label)||"Product Type")}),(0,t.jsx)(EditableField,{label:"Quantity",isChecked:d.lineItemColumns.quantity,onChange:e=>updateFieldEnabled("lineItemFields","quantity",e),onEdit:()=>handleOpenEditModal("lineItemFields","quantity",(null==i?void 0:i.lineItemFields.quantity.label)||"Quantity")}),(0,t.jsx)(EditableField,{label:"Unit Price",isChecked:d.lineItemColumns.unitPrice,onChange:e=>updateFieldEnabled("lineItemFields","unitPrice",e),onEdit:()=>handleOpenEditModal("lineItemFields","unitPrice",(null==i?void 0:i.lineItemFields.unitPrice.label)||"Unit Price")}),(0,t.jsx)(EditableField,{label:"Discount",isChecked:d.lineItemColumns.discount,onChange:e=>updateFieldEnabled("lineItemFields","discount",e),onEdit:()=>handleOpenEditModal("lineItemFields","discount",(null==i?void 0:i.lineItemFields.discount.label)||"Discount")}
1),(0,t.jsx)(EditableField,{label:"Total",isChecked:d.lineItemColumns.total,onChange:e=>updateFieldEnabled("lineItemFields","total",e),onEdit:()=>handleOpenEditModal("lineItemFields","total",(null==i?void 0:i.lineItemFields.total.label)||"Total")})]}),(0,t.jsx)(ConfigSection,{title:"Footer Fields",children:(0,t.jsx)(EditableField,{label:"Description",isChecked:d.footerFields.description,onChange:e=>updateFieldEnabled("footer","description",e),onEdit:()=>handleOpenEditModal("footer","description",(null==i?void 0:i.footer.label)||"Description")})}),(0,t.jsx)(ConfigSection,{title:"Payment Instructions",children:(0,t.jsx)(EditableField,{label:"Description",isChecked:d.paymentInstructions.description,onChange:e=>updateFieldEnabled("paymentInstructions","description",e),onEdit:()=>handleOpenEditModal("paymentInstructions","description",(null==i?void 0:i.paymentInstructions.description.label)||"Description")})})]}),(0,t.jsx)(EditFieldModal,{isOpen:m.isOpen,onClose:()=>{g({isOpen:!1,fieldType:null,fieldKey:null,currentLabel:""})},fieldLabel:m.currentLabel,currentValue:m.currentLabel,onUpdate:handleUpdateFieldLabel})]})};var V=n(23887),K=n(45893);let InvoicePreview=()=>{var e,i,n,l,a,r,s,d,c,u,x,m,g,b,p,v,f,j,I,y,w,S,F,T,z,A,N,O;let{settings:P,loading:k}=useInvoiceSetting(),_=(0,K.x)(),W=null===(i=_.tenant)||void 0===i?void 0:null===(e=i.logo)||void 0===e?void 0:e.imageProxy,R=null===(n=_.tenant)||void 0===n?void 0:n.displayName,M=null===(a=_.tenant)||void 0===a?void 0:null===(l=a.contactInfo)||void 0===l?void 0:l.addressLine0,D=null===(s=_.tenant)||void 0===s?void 0:null===(r=s.contactInfo)||void 0===r?void 0:r.addressLocality,U=null===(c=_.tenant)||void 0===c?void 0:null===(d=c.contactInfo)||void 0===d?void 0:d.addressAdministrativeArea,$=null===(x=_.tenant)||void 0===x?void 0:null===(u=x.contactInfo)||void 0===u?void 0:u.addressPostalCode,q=null===(g=_.tenant)||void 0===g?void 0:null===(m=g.contactInfo)||void 0===m?void 0:m.ph
1oneNumber,G=null===(p=_.tenant)||void 0===p?void 0:null===(b=p.contactInfo)||void 0===b?void 0:b.email,L=null===(v=_.tenant)||void 0===v?void 0:v.absoluteUrl,B=null===(f=null==P?void 0:P.headerFields.organizationName.enabled)||void 0===f||f,H=null===(j=null==P?void 0:P.headerFields.organizationAddress.enabled)||void 0===j||j,Y=null===(I=null==P?void 0:P.headerFields.organizationEmail.enabled)||void 0===I||I,Q=null===(y=null==P?void 0:P.headerFields.organizationPhone.enabled)||void 0===y||y,X=null===(w=null==P?void 0:P.headerFields.organizationWebsite.enabled)||void 0===w||w,Z=null===(S=null==P?void 0:P.lineItemFields.productType.enabled)||void 0===S||S,J=null===(F=null==P?void 0:P.lineItemFields.quantity.enabled)||void 0===F||F,ee=null===(T=null==P?void 0:P.lineItemFields.unitPrice.enabled)||void 0===T||T,ei=null===(z=null==P?void 0:P.lineItemFields.total.enabled)||void 0===z||z,en=null===(A=null==P?void 0:P.lineItemFields.discount.enabled)||void 0===A||A,et=null===(N=null==P?void 0:P.footer.enabled)||void 0===N||N,el=null===(O=null==P?void 0:P.paymentInstructions.description.enabled)||void 0===O||O;return k?(0,t.jsx)(o.xu,{bg:"white",p:{base:4,md:8},borderRadius:"lg",border:"1px solid",borderColor:"gray.200",shadow:"sm",h:"full",overflowY:"auto",children:(0,t.jsxs)(o.gC,{align:"stretch",spacing:6,children:[(0,t.jsxs)(o.kC,{justify:"space-between",align:"flex-start",flexWrap:"wrap",gap:4,children:[(0,t.jsx)(h.Od,{height:"40px",width:"150px"}),(0,t.jsxs)(o.gC,{align:"flex-end",spacing:2,children:[(0,t.jsx)(h.Od,{height:"16px",width:"200px"}),(0,t.jsx)(h.Od,{height:"12px",width:"250px"}),(0,t.jsxs)(o.Ug,{spacing:3,children:[(0,t.jsx)(h.Od,{height:"12px",width:"120px"}),(0,t.jsx)(h.Od,{height:"12px",width:"100px"}),(0,t.jsx)(h.Od,{height:"12px",width:"140px"})]})]})]}),(0,t.jsx)(o.iz,{}),(0,t.jsxs)(o.kC,{justify:"space-between",align:"flex-start",children:[(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(h.Od,{height:"12px",width:"60px",mb:2}),(0,t.jsx)(h.Od,{height:"16px",width:"150px"})]}),(0,t.jsxs)(o.gC,{align:"flex-end",spacing:2,children:[(0,t.jsx)(h.Od,{height:"12px",width:"70px"}),(0,t.jsx)(h.Od,{height:"16px",width:"130px"}),(0,t.jsx)(h.Od,{height:"12px",width:"40px",mt:2}),(0,t.jsx)(h.Od,{height:"16px",width:"100px"})]})]}),(0,t.jsx)(o.xu,{children:(0,t.jsxs)(o.Kq,{spacing:2,children:[(0,t.jsx)(h.Od,{height:"32px"}),(0,t.jsx)(h.Od,{height:"40px"}),(0,t.jsx)(h.Od,{height:"50px"})]})}),(0,t.jsx)(o.iz,{}),(0,t.jsx)(o.kC,{justify:"flex-end",children:(0,t.jsx)(o.xu,{width:"250px",children:(0,t.jsxs)(o.Kq,{spacing:3,children:[(0,t.jsx)(h.Od,{height:"16px"}),(0,t.jsx)(h.Od,{height:"16px"}),(0,t.jsx)(h.Od,{height:"20px"})]})})}),(0,t.jsx)(o.iz,{}),(0,t.jsxs)(o.xu,{textAlign:"center",children:[(0,t.jsx)(h.Od,{height:"12px",width:"200px",mx:"auto",mb:2}),(0,t.jsx)(h.Od,{height:"12px",width:"180px",mx:"auto"})]})]})}):(0,t.jsx)(o.xu,{bg:"white",p:{base:4,md:8},borderRadius:"lg",border:"1px solid",borderColor:"gray.200",shadow:"sm",h:"full",overflowY:"auto",children:(0,t.jsxs)(o.gC,{align:"stretch",spacing:6,children:[(0,t.jsxs)(o.kC,{justify:"space-between",align:"flex-start",flexWrap:"wrap",gap:4,children:[(0,t.jsx)(o.xu,{flexShrink:0,maxW:{base:"100%",md:"200px"},children:W?(0,t.jsx)(V.Ee,{src:W,alt:"Tenant Logo",maxH:{base:"8",md:"10"},maxW:{base:"40",md:"52"},w:"auto",objectFit:"contain"}):(0,t.jsx)(o.xv,{fontSize:"2xl",fontWeight:"bold",color:"blue.600",children:R||"Company Name"})}),(0,t.jsxs)(o.gC,{align:{base:"flex-start",md:"flex-end"},spacing:1,flex:"1",minW:"0",children:[B&&(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"bold",color:"gray.900",noOfLines:2,wordBreak:"break-word",textAlign:{base:"left",md:"right"},children:R}),H&&(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.600",noOfLines:2,wordBreak:"break-word",textAlign:{base:"left",md:"right"},children:M&&D?"".concat(M," ⢠").concat(D," ⢠").concat(U," ").concat($):""}),(0,t.jsxs)(o.kC,{align:"center",gap:3,mt:1,flexWrap:"wrap",justify:{base:"flex-start",md:"flex-end"},w:"full",children:[Y&&(0,t.jsxs)(o.kC,{align:"center",gap:1,minW:"0",maxW:"200px",children:[(0,t.jsx)(E.bV6,{color:"gray.500",flexShrink:0}),G?(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.900",whiteSpace:"nowrap",children:G}):(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.900",whiteSpace:"nowrap",children:"--"})]}),Q&&(0,t.jsxs)(o.kC,{align:"center",gap:1,flexShrink:0,children:[(0,t.jsx)(E.qWc,{color:"gray.500",flexShrink:0}),q?(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.900",whiteSpace:"nowrap",children:q}):(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.900",whiteSpace:"nowrap",children:"--"})]}),X&&(0,t.jsxs)(o.kC,{align:"center",gap:1,minW:"0",maxW:"200px",children:[(0,t.jsx)(E.n9J,{color:"gray.500",flexShrink:0}),L?(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.900",whiteSpace:"nowrap",children:L}):(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.900",whiteSpace:"nowrap",children:"--"})]})]})]})]}),(0,t.jsx)(o.iz,{}),(0,t.jsxs)(o.kC,{justify:"space-between",align:"flex-start",flexWrap:"wrap",gap:4,children:[(0,t.jsxs)(o.xu,{children:[(0,t.jsx)(o.xv,{fontSize:"xs",fontWeight:"semibold",color:"gray.600",mb:1,children:"Billed To"}),(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"bold",color:"gray.900",children:"Test Customer Inc."})]}),(0,t.jsxs)(o.gC,{align:"flex-end",spacing:1,children:[(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.600",children:"Invoice #"}),(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"bold",color:"gray.900",children:"INV-1208-2025"}),(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.600",mt:2,children:"Date"}),(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"medium",color:"gray.900",children:"Nov 4, 2025"})]})]}),(0,t.jsx)(o.xu,{overflowX:"auto",children:(0,t.jsxs)(C.iA,{size:"sm",children:[(0,t.jsx)(C.hr,{bg:"#DBEBFF",children:(0,t.jsxs)(C.Tr,{children:[(null==P?void 0:P.lineItemFields.items.enabled)&&(0,t.jsx)(C.Th,{children:null==P?void 0:P.lineItemFields.items.label}),Z&&(0,t.jsx)(C.Th,{children:null==P?void 0:P.lineItemFields.productType.label}),J&&(0,t.jsx)(C.Th,{isNumeric:!0,children:null==P?void 0:P.lineItemFields.quantity.label}),ee&&(0,t.jsx)(C.Th,{isNumeric:!0,children:null==P?void 0:P.lineItemFields.unitPrice.label}),en&&(0,t.jsx)(C.Th,{isNumeric:!0,children:null==P?void 0:P.lineItemFields.discount.label}),ei&&(0,t.jsx)(C.Th,{isNumeric:!0,children:null==P?void 0:P.lineItemFields.total.label})]})}),(0,t.jsxs)(C.p3,{children:[(0,t.jsxs)(C.Tr,{children:[(null==P?void 0:P.lineItemFields.items.enabled)&&(0,t.jsx)(C.Td,{children:"Premium Membership"}),Z&&(0,t.jsx)(C.Td,{children:"Membership"}),J&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"1"}),ee&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$49.00"}),en&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$00.00"}),ei&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$49.00"})]}),(0,t.jsxs)(C.Tr,{children:[(null==P?void 0:P.lineItemFields.items.enabled)&&(0,t.jsxs)(C.Td,{children:["Ticket Name 1",(0,t.jsx)(o.xv,{color:"gray.500",children:"Annual Tech Conference"})]}),Z&&(0,t.jsx)(C.Td,{children:"Event"}),J&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"2"}),ee&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$150.00"}),en&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$10.00"}),ei&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$290.00"})]}),(0,t.jsxs)(C.Tr,{children:[(null==P?void 0:P.lineItemFields.items.enabled)&&(0,t.jsx)(C.Td,{children:"Premium Items"}),Z&&(0,t.jsx)(C.Td,{children:"Other Items"}),J&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"1"}),ee&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$200.00"}),en&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$00.00"}),ei&&(0,t.jsx)(C.Td,{isNumeric:!0,children:"$200.00"})]})]})]})}),(0,t.jsx)(o.iz,{}),(0,t.jsxs)(o.kC,{justify:"space-between",flexWrap:"wrap",gap:6,children:[(0,t.jsx)(o.gC,{align:"stretch",spacing:3,flex:"1",minW:"150px",maxW:"250px"}),(0,t.jsxs)(o.gC,{align:"stretch",bg:"gray.50",p:4,borderRadius:"md",spacing:3,minW:"250px",maxW:"250px",children:[(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",children:[(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"medium",color:"gray.900",children:"Subtotal"}),(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"bold",color:"gray.900",children:"$549.00"})]}),(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",children:[(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"medium",color:"green.500",children:"Discount Amount"}),(0,t.jsx)(o.xv,{fontSize:"sm",fontWeight:"bold",color:"green.500",children:"$10.00"})]}),(0,t.jsx)(o.iz,{my:1}),(0,t.jsxs)(o.kC,{justify:"space-between",align:"center",children:[(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"bold",color:"gray.600",children:"Net Amount"}),(0,t.jsx)(o.xv,{fontSize:"md",fontWeight:"bold",color:"gray.900",children:"$539.00"})]})]})]}),(0,t.jsx)(o.iz,{}),et&&(0,t.jsxs)(o.xu,{textAlign:"center",children:[(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.500",children:(null==P?void 0:P.footer.label)||"Invoice due within 30 days of invoice date. Thank y
1ou for your support!"}),(0,t.jsx)(o.iz,{mt:5})]}),el&&(0,t.jsxs)(o.xu,{textAlign:"center",children:[(0,t.jsx)(o.xv,{fontSize:"xs",color:"gray.500",children:null==P?void 0:P.paymentInstructions.description.label}),(0,t.jsx)(o.iz,{mt:5})]})]})})},InvoiceTemplate=()=>(0,t.jsxs)(o.xu,{w:"full",children:[(0,t.jsx)(o.xv,{fontSize:"lg",fontWeight:"semibold",mb:4,color:"gray.700",children:"Invoice Preview"}),(0,t.jsxs)(o.rj,{templateColumns:{base:"1fr",lg:"0.8fr 2fr"},gap:6,w:"full",minH:"600px",children:[(0,t.jsx)(InvoiceTemplateConfig,{}),(0,t.jsx)(InvoicePreview,{})]})]}),InvoiceSetting=()=>{let[e,i]=(0,r.useState)(0);return(0,t.jsx)(InvoiceSettingProvider,{children:(0,t.jsx)(o.xu,{w:"full",minH:"100vh",p:{base:4,md:6},children:(0,t.jsxs)(o.gC,{spacing:6,align:"stretch",children:[(0,t.jsx)(d.yG,{children:(0,t.jsx)(d.lm,{children:"Invoice Settings"})}),(0,t.jsxs)(s.mQ,{variant:"soft-rounded",colorScheme:"blue",index:e,onChange:e=>i(e),children:[(0,t.jsxs)(s.td,{mb:4,children:[(0,t.jsx)(s.OK,{children:"Invoice Template"}),(0,t.jsx)(s.OK,{children:"Invoice Number Setting"}),(0,t.jsx)(s.OK,{children:"Automatic Invoicing"}),(0,t.jsx)(s.OK,{children:"Invoice Me"})]}),(0,t.jsxs)(s.nP,{children:[(0,t.jsx)(s.x4,{px:0,children:(0,t.jsx)(InvoiceTemplate,{})}),(0,t.jsx)(s.x4,{px:0,children:(0,t.jsx)(InvoiceNumberSetting,{})}),(0,t.jsx)(s.x4,{px:0,children:(0,t.jsx)(AutomaticInvoicingSettings,{})}),(0,t.jsx)(s.x4,{px:0,children:(0,t.jsx)(InvoiceMeSettings,{})})]})]})]})})})},InvoiceSettingPage=()=>(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(InvoiceSetting,{})});n(48432);var H=n(93064),Y=(0,n(52609).z)(()=>(0,t.jsx)(l.C,{children:(0,t.jsx)(a.H,{title:"Invoice Setting",children:(0,t.jsx)(InvoiceSettingPage,{})})}),{requiresEvery:[H.lj.ADMIN_ROLE]})}},function(e){e.O(0,[75278,64986,96317,44472,26976,49774,92888,40179],function(){return e(e.s=75328)}),_N_E=e.O()}]); 2//# sourceMappingURL=invoice-setting-c9c05d4788ed867a.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.