@accounter/client 0.0.8-alpha-20251026083544-7d9134707c8a0f6a55deaeb77c1ad729f9b51d0d → 0.0.8-alpha-20251027003629-e64c01111f4a4cec34d5ca9a84e02646b69f80b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/assets/{Checkbox-BctviB1F.js → Checkbox-DjollWGm.js} +1 -1
- package/dist/assets/{Progress-CT5anCpU.js → Progress-AG7ZMAJu.js} +1 -1
- package/dist/assets/{Typography-C51J2BpA.js → Typography-Cd0kk1vc.js} +1 -1
- package/dist/assets/{accordion-6Thtee7g.js → accordion-s9Ku08QQ.js} +1 -1
- package/dist/assets/{accountant-approvals-D7YOziiO.js → accountant-approvals-Bqrsn1y5.js} +1 -1
- package/dist/assets/{all-charges-CidU5jnZ.js → all-charges-BQcsaMon.js} +1 -1
- package/dist/assets/{arrow-up-down-DWuFVTo-.js → arrow-up-down-J-i_WnHP.js} +1 -1
- package/dist/assets/{building-2-C72DIX9G.js → building-2-B92gXbOj.js} +1 -1
- package/dist/assets/business-CfqFJUkR.js +32 -0
- package/dist/assets/{business-header-BM0vGcqN.js → business-header-Cr5S_Mz7.js} +1 -1
- package/dist/assets/{business-transactions-single-7klK_DwC.js → business-transactions-single-BD4bLNv2.js} +1 -1
- package/dist/assets/{business-trip-Dnqh6cG4.js → business-trip-DYkKK6Gk.js} +1 -1
- package/dist/assets/{charges-filters-DWHUf-Is.js → charges-filters-CoFkjW00.js} +1 -1
- package/dist/assets/{charges-ledger-validation-BmCt7xrd.js → charges-ledger-validation-D_cg1bn-.js} +1 -1
- package/dist/assets/{chart-B5BAyboc.js → chart-CQ9Opsuw.js} +1 -1
- package/dist/assets/{data-table-pagination-BJTvP_Tz.js → data-table-pagination-CN5CnGZV.js} +1 -1
- package/dist/assets/{editable-business-trip-CbpH4HVw.js → editable-business-trip--kNXo9tv.js} +1 -1
- package/dist/assets/{index-DdAxnagN.js → index--XWh2RKR.js} +1 -1
- package/dist/assets/{index-CL3datPm.js → index-Au8Djmrz.js} +1 -1
- package/dist/assets/{index-kItdD0sA.js → index-BGHdyfCs.js} +1 -1
- package/dist/assets/{index-DzOvo__B.js → index-BNtiIPMq.js} +1 -1
- package/dist/assets/{index-C6QmtL9H.js → index-BSmbKLQe.js} +1 -1
- package/dist/assets/{index-Dlo1N0hJ.js → index-BWpLPx22.js} +1 -1
- package/dist/assets/{index-bKLAd8hM.js → index-C3pV-XkD.js} +1 -1
- package/dist/assets/{index-DBrW8QEI.js → index-C66UYUUf.js} +1 -1
- package/dist/assets/{index-BI586iYK.js → index-C7al3ztL.js} +1 -1
- package/dist/assets/{index-Btqo1jZa.js → index-CC_fLCrA.js} +1 -1
- package/dist/assets/{index-221yLSiW.js → index-CS40C1qp.js} +1 -1
- package/dist/assets/{index-BIG8MoDg.js → index-Cc4HfGhd.js} +1 -1
- package/dist/assets/{index-BGXkXw0n.js → index-Cw9zbBbJ.js} +1 -1
- package/dist/assets/{index-CB_VF1mZ.js → index-DDGgWxhe.js} +1 -1
- package/dist/assets/{index-D6H0AeUx.js → index-DNTlYcfH.js} +1 -1
- package/dist/assets/{index-C7xDo8-i.js → index-DS_RReq_.js} +1 -1
- package/dist/assets/{index-D9EUSjLh.js → index-DVbMTBK4.js} +1 -1
- package/dist/assets/{index-D_zzRzR-.js → index-DepseT6D.js} +1 -1
- package/dist/assets/{index-B84WKwxY.js → index-DfI9E1Fb.js} +4 -4
- package/dist/assets/{index-DFuZXV_A.js → index-DzNfXERJ.js} +1 -1
- package/dist/assets/{index-B5mviWED.js → index-fwXllLnH.js} +1 -1
- package/dist/assets/{index-BkSWW9yp.js → index-hr9hQe_a.js} +1 -1
- package/dist/assets/{index-DjUf-350.js → index-n3bzj3IE.js} +1 -1
- package/dist/assets/{index.es-DQWORH2l.js → index.es-CKlpQqlO.js} +1 -1
- package/dist/assets/{issue-document--X5UMceP.js → issue-document-B4kkfOo0.js} +1 -1
- package/dist/assets/{login-page-DnBQv4Ww.js → login-page-NvQKYh34.js} +1 -1
- package/dist/assets/{missing-info-charges-BY_Fzwe4.js → missing-info-charges-DrF2b0mO.js} +1 -1
- package/dist/assets/{page-not-found-DnNUQLnj.js → page-not-found-7AAOkZhu.js} +1 -1
- package/dist/assets/{pencil-CzjZ9zId.js → pencil-DNPAJOPL.js} +1 -1
- package/dist/assets/{report-commentary-row-BLPxwr93.js → report-commentary-row-CF-l1YIC.js} +1 -1
- package/dist/assets/{save-Dsb4Gmff.js → save-D84vX5ea.js} +1 -1
- package/dist/assets/{sub-ETjYSvjF.js → sub-BbpGm1pj.js} +1 -1
- package/dist/assets/subMonths-0tIJizDp.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/clients/modify-client-dialog.tsx +3 -3
- package/src/components/common/modals/insert-business.tsx +1 -1
- package/dist/assets/business-BDhEY0HJ.js +0 -32
- package/dist/assets/subMonths-CG2m25Yw.js +0 -1
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{D as xe,G as be,S as Te,H as Ne,a as we,J as Ms,r as y,j as e,K as Pe,N as Be,O as Us,n as Cs,Q as zs,i as pe,t as O,l as je,U as qs,V as Ie,W as Oe,X as De,Y as G,Z as W,_ as K,$ as H,a0 as Ae,a1 as X,a2 as j,a3 as g,a4 as f,a5 as N,v as T,a6 as I,a7 as C,a8 as Ye,B as E,a9 as Gs,aa as Le,ab as Ze,ac as V,ad as bs,ae as es,af as Ws,s as Ks,C as Hs,ag as Xs,ah as L,ai as ds,aj as Js,ak as Qs,al as Ys,am as de,an as ss,ao as q,ap as ns,aq as ts,ar as as,as as Z,at as ue,au as re,av as ie,aw as le,ax as ce,ay as oe,az as rs,aA as is,aB as Ue,aC as ae,aD as ze,aE as qe,aF as Fe,aG as Zs,aH as ee,aI as Y,aJ as en,aK as sn,aL as nn,aM as Ge,aN as tn,aO as an,aP as rn,aQ as ln,aR as cn,aS as We,aT as Ke,aU as ws,aV as on,aW as He,aX as dn,aY as Is,aZ as Ds,a_ as un,a$ as mn,b0 as As,b1 as ls,b2 as hn,b3 as us,b4 as xn,b5 as pn,b6 as jn,b7 as gn,b8 as fn,b9 as vn,ba as yn,bb as D,bc as Nn,bd as cs,be as Cn,bf as bn,bg as wn,bh as In,bi as Dn,bj as An,bk as Q,bl as Sn,bm as kn,bn as z,bo as Tn,bp as En,bq as Pn,br as Bn}from"./index-B84WKwxY.js";import{S as os}from"./save-Dsb4Gmff.js";import{B as On}from"./business-header-BM0vGcqN.js";import{i as Ln,D as Vn,f as Fn,E as _n,L as _e,a as Se,C as $n,A as Rn,b as ve,c as Mn,d as Xe,h as Un,e as zn,g as Ss,u as qn,G as Gn,j as ms,k as Wn,X as ks,Y as Ts,l as Kn,m as Hn,R as Xn,n as Jn,o as Qn,p as Yn}from"./chart-B5BAyboc.js";import{P as Zn}from"./pencil-CzjZ9zId.js";import{A as et,a as $e,b as Re,c as hs}from"./accordion-6Thtee7g.js";import{B as st}from"./building-2-C72DIX9G.js";import"./sequential-CAnleQny.js";/**
|
|
2
|
-
* @license lucide-react v0.546.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const nt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xs=xe("circle-check",nt);/**
|
|
7
|
-
* @license lucide-react v0.546.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const tt=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ke=xe("dollar-sign",tt);/**
|
|
12
|
-
* @license lucide-react v0.546.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const at=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],rt=xe("file-check",at);/**
|
|
17
|
-
* @license lucide-react v0.546.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const it=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],lt=xe("plug",it);/**
|
|
22
|
-
* @license lucide-react v0.546.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const ct=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Es=xe("shield",ct);/**
|
|
27
|
-
* @license lucide-react v0.546.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const ot=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Me=xe("trending-up",ot);function Ps(s){switch(s){case be.Annual:return"Annual";case be.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${s}`)}}function Bs(s){switch(s){case Te.Enterprise:return"Enterprise";case Te.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${s}`)}}function dt(s){return Ne(s,"yyyy-MM-dd")}function ut({businessId:s,tagIds:n,description:t,open:a,onOpenChange:l,onClose:i}){const[{data:c,fetching:r},o]=we({pause:!0,query:Ms,variables:{businessId:s,tagsDifferentThan:n?n.map(m=>m.id):void 0,descriptionDifferentThan:t}});y.useEffect(()=>{a&&(n||t)&&!c&&o()},[a,n,t,o,c]);const d=y.useCallback(m=>{l(m),a&&!m&&i?.()},[l,i,a]),h=y.useMemo(()=>a&&(!!n||!!t)&&c&&c?.similarChargesByBusiness.length>0,[a,n,t,c]);return e.jsx(Pe,{open:h,onOpenChange:d,children:e.jsx(Be,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",onClick:m=>m.stopPropagation(),children:e.jsx(Us,{fallback:e.jsx("div",{children:"Error fetching similar charges"}),children:r?e.jsx(Cs,{}):n||t?e.jsx(zs,{data:c?.similarChargesByBusiness??[],tagIds:n,description:t,onOpenChange:d,title:"Similar Charges by Business"}):null})})})}const mt="updateAdminBusiness",ht=()=>{const[{fetching:s},n]=pe(qs),t=y.useCallback(async a=>{const l=`Error updating admin business ID [${a.adminBusinessId}]`,i=`${mt}-${a.adminBusinessId}`;O.loading("Updating admin business",{id:i});try{const c=await n(a),r=je(c,l,i,"updateAdminBusiness");if(r)return O.success("Success",{id:i,description:"Admin Business Updated"}),r.updateAdminBusiness}catch(c){console.error(`${l}: ${c}`),O.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateAdminBusiness:t}},xt=Le({employerWithholdingTaxAccountNumber:V().min(1,{message:"Employer Withholding Tax Account Number is required"}),taxPrepaymentId:V().min(1,{message:"Tax Prepayment ID is required"}),nationalInsuranceEmployerId:V().min(1,{message:"National Insurance Employer ID is required"}),advanceTaxRate:bs().min(0,{message:"Advance Tax Rate must be at least 0"}).max(100,{message:"Advance Tax Rate must be at most 100"}),registrationDate:V().min(1,{message:"Registration Date is required"})});function ps(s){return!s||s.__typename!=="LtdFinancialEntity"||!s.adminInfo?{}:{employerWithholdingTaxAccountNumber:s.adminInfo.employerWithholdingTaxAccountNumber??"",taxPrepaymentId:s.adminInfo.taxPrepaymentId??"",nationalInsuranceEmployerId:s.adminInfo.nationalInsuranceEmployerId??"",advanceTaxRate:s.adminInfo.advanceTaxRate??0,registrationDate:s.adminInfo.registrationDate??""}}function pt(s){return{employerWithholdingTaxAccountNumber:s.employerWithholdingTaxAccountNumber,taxPrepaymentId:s.taxPrepaymentId,nationalInsuranceEmployerId:s.nationalInsuranceEmployerId,advanceTaxRate:s.advanceTaxRate,registrationDate:s.registrationDate?dt(new Date(s.registrationDate)):void 0}}function jt({data:s,refetchBusiness:n}){const t=De(Gs,s),[a,l]=y.useState(ps(t)),{updateAdminBusiness:i,fetching:c}=ht(),r=Ie({resolver:Oe(xt),defaultValues:a}),o=async d=>{if(!t)return;const h=Ze(d,r.formState.dirtyFields);if(!h)return;const m=pt(h);await i({adminBusinessId:t.id,fields:m}),n?.()};return y.useEffect(()=>{if(t){const d=ps(t);l(d),r.reset(d)}},[t,r]),e.jsxs(G,{children:[e.jsxs(W,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Es,{className:"h-5 w-5 text-primary"}),e.jsx(K,{children:"Admin Business Configuration"})]}),e.jsx(H,{children:"Tax and registration information for the business operating this application"})]}),e.jsx(Ae,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(o),className:"space-y-6",children:[e.jsx(X,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(j,{control:r.control,name:"employerWithholdingTaxAccountNumber",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Employer Withholding Tax Account Number"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter account number",...d,className:I(h)})}),e.jsx(C,{})]})}),e.jsx(j,{control:r.control,name:"taxPrepaymentId",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tax Prepayment ID"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter prepayment ID",...d,className:I(h)})}),e.jsx(C,{})]})}),e.jsx(j,{control:r.control,name:"nationalInsuranceEmployerId",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"National Insurance Employer ID"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter employer ID",...d,className:I(h)})}),e.jsx(C,{})]})}),e.jsx(j,{control:r.control,name:"advanceTaxRate",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Advance Tax Rate (%)"}),e.jsx(N,{children:e.jsx(T,{type:"number",step:"0.01",min:"0",max:"100",placeholder:"Enter tax rate",...d,className:I(h)})}),e.jsx(C,{})]})}),e.jsx(j,{control:r.control,name:"registrationDate",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Registration Date"}),e.jsx(N,{children:e.jsx(T,{type:"date",...d,className:I(h)})}),e.jsx(C,{})]})})]})}),e.jsx(Ye,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(E,{type:"submit",disabled:c||Object.keys(r.formState.dirtyFields).length===0||!r.formState.isValid,children:[e.jsx(os,{className:"h-4 w-4"}),"Save Changes"]})})]})})]})}function gt({businessId:s}){const{userContext:n}=y.useContext(es),[t,a]=y.useState(1),[{data:l,fetching:i}]=we({query:Ws,variables:{filters:{byOwners:n?.context.adminBusinessId?[n.context.adminBusinessId]:void 0,sortBy:{field:Xs.Date,asc:!1},byBusinesses:[s]},page:t,limit:100}}),c=l?.allCharges?.pageInfo.totalPages??1,r=l?.allCharges?.nodes??[];return i?e.jsx("div",{children:"Loading charges..."}):e.jsxs(G,{children:[e.jsxs(W,{className:"flex w-full justify-between items-center",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(K,{children:"Charges"}),e.jsx(H,{children:"Recurring and one-time charges for this business"})]})}),c>1&&e.jsx(Ks,{className:"flex-fit",value:t,onChange:a,total:c})]}),e.jsx(X,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Hs,{data:r,isAllOpened:!1})})})]})}var ft=["type","layout","connectNulls","ref"],vt=["key"];function me(s){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},me(s)}function js(s,n){if(s==null)return{};var t=yt(s,n),a,l;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);for(l=0;l<i.length;l++)a=i[l],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(s,a)&&(t[a]=s[a])}return t}function yt(s,n){if(s==null)return{};var t={};for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)){if(n.indexOf(a)>=0)continue;t[a]=s[a]}return t}function Ce(){return Ce=Object.assign?Object.assign.bind():function(s){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=t[a])}return s},Ce.apply(this,arguments)}function gs(s,n){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);n&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(s,l).enumerable})),t.push.apply(t,a)}return t}function _(s){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?gs(Object(t),!0).forEach(function(a){M(s,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):gs(Object(t)).forEach(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(t,a))})}return s}function te(s){return wt(s)||bt(s)||Ct(s)||Nt()}function Nt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
32
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ct(s,n){if(s){if(typeof s=="string")return Je(s,n);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Je(s,n)}}function bt(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function wt(s){if(Array.isArray(s))return Je(s)}function Je(s,n){(n==null||n>s.length)&&(n=s.length);for(var t=0,a=new Array(n);t<n;t++)a[t]=s[t];return a}function It(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")}function fs(s,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,Ls(a.key),a)}}function Dt(s,n,t){return n&&fs(s.prototype,n),t&&fs(s,t),Object.defineProperty(s,"prototype",{writable:!1}),s}function At(s,n,t){return n=Ee(n),St(s,Os()?Reflect.construct(n,t||[],Ee(s).constructor):n.apply(s,t))}function St(s,n){if(n&&(me(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kt(s)}function kt(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Os(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Os=function(){return!!s})()}function Ee(s){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ee(s)}function Tt(s,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(n&&n.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),n&&Qe(s,n)}function Qe(s,n){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,l){return a.__proto__=l,a},Qe(s,n)}function M(s,n,t){return n=Ls(n),n in s?Object.defineProperty(s,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[n]=t,s}function Ls(s){var n=Et(s,"string");return me(n)=="symbol"?n:n+""}function Et(s,n){if(me(s)!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var a=t.call(s,n);if(me(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var he=(function(s){function n(){var t;It(this,n);for(var a=arguments.length,l=new Array(a),i=0;i<a;i++)l[i]=arguments[i];return t=At(this,n,[].concat(l)),M(t,"state",{isAnimationFinished:!0,totalLength:0}),M(t,"generateSimpleStrokeDasharray",function(c,r){return"".concat(r,"px ").concat(c-r,"px")}),M(t,"getStrokeDasharray",function(c,r,o){var d=o.reduce(function(b,k){return b+k});if(!d)return t.generateSimpleStrokeDasharray(r,c);for(var h=Math.floor(c/d),m=c%d,x=r-c,A=[],u=0,p=0;u<o.length;p+=o[u],++u)if(p+o[u]>m){A=[].concat(te(o.slice(0,u)),[m-p]);break}var S=A.length%2===0?[0,x]:[x];return[].concat(te(n.repeat(o,h)),te(A),S).map(function(b){return"".concat(b,"px")}).join(", ")}),M(t,"id",qn("recharts-line-")),M(t,"pathRef",function(c){t.mainCurve=c}),M(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),M(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return Tt(n,s),Dt(n,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();this.setState({totalLength:a})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();a!==this.state.totalLength&&this.setState({totalLength:a})}}},{key:"getTotalLength",value:function(){var a=this.mainCurve;try{return a&&a.getTotalLength&&a.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(a,l){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,c=i.points,r=i.xAxis,o=i.yAxis,d=i.layout,h=i.children,m=Fn(h,_n);if(!m)return null;var x=function(p,S){return{x:p.x,y:p.y,value:p.value,errorVal:Ss(p.payload,S)}},A={clipPath:a?"url(#clipPath-".concat(l,")"):null};return L.createElement(_e,A,m.map(function(u){return L.cloneElement(u,{key:"bar-".concat(u.props.dataKey),data:c,xAxis:r,yAxis:o,layout:d,dataPointFormatter:x})}))}},{key:"renderDots",value:function(a,l,i){var c=this.props.isAnimationActive;if(c&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.dot,d=r.points,h=r.dataKey,m=Se(this.props,!1),x=Se(o,!0),A=d.map(function(p,S){var b=_(_(_({key:"dot-".concat(S),r:3},m),x),{},{index:S,cx:p.x,cy:p.y,value:p.value,dataKey:h,payload:p.payload,points:d});return n.renderDotItem(o,b)}),u={clipPath:a?"url(#clipPath-".concat(l?"":"dots-").concat(i,")"):null};return L.createElement(_e,Ce({className:"recharts-line-dots",key:"dots"},u),A)}},{key:"renderCurveStatically",value:function(a,l,i,c){var r=this.props,o=r.type,d=r.layout,h=r.connectNulls;r.ref;var m=js(r,ft),x=_(_(_({},Se(m,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:l?"url(#clipPath-".concat(i,")"):null,points:a},c),{},{type:o,layout:d,connectNulls:h});return L.createElement($n,Ce({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(a,l){var i=this,c=this.props,r=c.points,o=c.strokeDasharray,d=c.isAnimationActive,h=c.animationBegin,m=c.animationDuration,x=c.animationEasing,A=c.animationId,u=c.animateNewValues,p=c.width,S=c.height,b=this.state,k=b.prevPoints,F=b.totalLength;return L.createElement(Rn,{begin:h,duration:m,isActive:d,easing:x,from:{t:0},to:{t:1},key:"line-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(R){var $=R.t;if(k){var J=k.length/r.length,U=r.map(function(B,Ve){var ge=Math.floor(Ve*J);if(k[ge]){var fe=k[ge],ne=ve(fe.x,B.x),_s=ve(fe.y,B.y);return _(_({},B),{},{x:ne($),y:_s($)})}if(u){var $s=ve(p*2,B.x),Rs=ve(S/2,B.y);return _(_({},B),{},{x:$s($),y:Rs($)})}return _(_({},B),{},{x:B.x,y:B.y})});return i.renderCurveStatically(U,a,l)}var se=ve(0,F),v=se($),w;if(o){var P="".concat(o).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});w=i.getStrokeDasharray(v,F,P)}else w=i.generateSimpleStrokeDasharray(F,v);return i.renderCurveStatically(r,a,l,{strokeDasharray:w})})}},{key:"renderCurve",value:function(a,l){var i=this.props,c=i.points,r=i.isAnimationActive,o=this.state,d=o.prevPoints,h=o.totalLength;return r&&c&&c.length&&(!d&&h>0||!Mn(d,c))?this.renderCurveWithAnimation(a,l):this.renderCurveStatically(c,a,l)}},{key:"render",value:function(){var a,l=this.props,i=l.hide,c=l.dot,r=l.points,o=l.className,d=l.xAxis,h=l.yAxis,m=l.top,x=l.left,A=l.width,u=l.height,p=l.isAnimationActive,S=l.id;if(i||!r||!r.length)return null;var b=this.state.isAnimationFinished,k=r.length===1,F=ds("recharts-line",o),R=d&&d.allowDataOverflow,$=h&&h.allowDataOverflow,J=R||$,U=Xe(S)?this.id:S,se=(a=Se(c,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},v=se.r,w=v===void 0?3:v,P=se.strokeWidth,B=P===void 0?2:P,Ve=Un(c)?c:{},ge=Ve.clipDot,fe=ge===void 0?!0:ge,ne=w*2+B;return L.createElement(_e,{className:F},R||$?L.createElement("defs",null,L.createElement("clipPath",{id:"clipPath-".concat(U)},L.createElement("rect",{x:R?x:x-A/2,y:$?m:m-u/2,width:R?A:A*2,height:$?u:u*2})),!fe&&L.createElement("clipPath",{id:"clipPath-dots-".concat(U)},L.createElement("rect",{x:x-ne/2,y:m-ne/2,width:A+ne,height:u+ne}))):null,!k&&this.renderCurve(J,U),this.renderErrorBar(J,U),(k||c)&&this.renderDots(J,fe,U),(!p||b)&&zn.renderCallByParent(this.props,r))}}],[{key:"getDerivedStateFromProps",value:function(a,l){return a.animationId!==l.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,prevPoints:l.curPoints}:a.points!==l.curPoints?{curPoints:a.points}:null}},{key:"repeat",value:function(a,l){for(var i=a.length%2!==0?[].concat(te(a),[0]):a,c=[],r=0;r<l;++r)c=[].concat(te(c),te(i));return c}},{key:"renderDotItem",value:function(a,l){var i;if(L.isValidElement(a))i=L.cloneElement(a,l);else if(Ln(a))i=a(l);else{var c=l.key,r=js(l,vt),o=ds("recharts-line-dot",typeof a!="boolean"?a.className:"");i=L.createElement(Vn,Ce({key:c},r,{className:o}))}return i}}])})(y.PureComponent);M(he,"displayName","Line");M(he,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Gn.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});M(he,"getComposedData",function(s){var n=s.props,t=s.xAxis,a=s.yAxis,l=s.xAxisTicks,i=s.yAxisTicks,c=s.dataKey,r=s.bandSize,o=s.displayedData,d=s.offset,h=n.layout,m=o.map(function(x,A){var u=Ss(x,c);return h==="horizontal"?{x:ms({axis:t,ticks:l,bandSize:r,entry:x,index:A}),y:Xe(u)?null:a.scale(u),value:u,payload:x}:{x:Xe(u)?null:t.scale(u),y:ms({axis:a,ticks:i,bandSize:r,entry:x,index:A}),value:u,payload:x}});return _({points:m,layout:h},d)});var Pt=Wn({chartName:"LineChart",GraphicalChild:he,axisComponents:[{axisType:"xAxis",AxisComp:ks},{axisType:"yAxis",AxisComp:Ts}],formatAxisMap:Kn});const ye=[{month:"Jan",revenue:12500,expenses:8200},{month:"Feb",revenue:15800,expenses:9100},{month:"Mar",revenue:18200,expenses:10500},{month:"Apr",revenue:16900,expenses:9800},{month:"May",revenue:21300,expenses:11200},{month:"Jun",revenue:24500,expenses:12800},{month:"Jul",revenue:22800,expenses:11900},{month:"Aug",revenue:26100,expenses:13500},{month:"Sep",revenue:28900,expenses:14200},{month:"Oct",revenue:31200,expenses:15100}];function Bt(){const s=ye.reduce((t,a)=>t+a.revenue,0),n=s/ye.length;return e.jsxs(G,{children:[e.jsxs(W,{children:[e.jsx(K,{children:"Revenue Analytics"}),e.jsx(H,{children:"Revenue and expenses over time"})]}),e.jsxs(X,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3 mb-6",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ke,{className:"h-4 w-4"}),"Total Revenue"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",s.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Me,{className:"h-3 w-3"}),e.jsx("span",{children:"+24.5% from last period"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ke,{className:"h-4 w-4"}),"Average Monthly"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",n.toLocaleString(void 0,{maximumFractionDigits:0})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Me,{className:"h-3 w-3"}),e.jsx("span",{children:"+18.2% growth rate"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ke,{className:"h-4 w-4"}),"Current Month"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",ye[ye.length-1].revenue.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Me,{className:"h-3 w-3"}),e.jsx("span",{children:"+8.0% from last month"})]})]})]}),e.jsx(Hn,{config:{revenue:{label:"Revenue",color:"hsl(var(--chart-1))"},expenses:{label:"Expenses",color:"hsl(var(--chart-2))"}},className:"h-[400px]",children:e.jsx(Xn,{width:"100%",height:"100%",children:e.jsxs(Pt,{data:ye,margin:{top:5,right:10,left:10,bottom:5},children:[e.jsx(Jn,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(ks,{dataKey:"month",className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ts,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qn,{content:e.jsx(Yn,{})}),e.jsx(he,{type:"monotone",dataKey:"revenue",stroke:"var(--color-revenue)",strokeWidth:2,dot:{fill:"var(--color-revenue)",r:4}}),e.jsx(he,{type:"monotone",dataKey:"expenses",stroke:"var(--color-expenses)",strokeWidth:2,dot:{fill:"var(--color-expenses)",r:4}})]})})})]})]})}const Ot="updateBusiness",Vs=()=>{const[{fetching:s},n]=pe(Js),t=y.useCallback(async a=>{const l=`Error updating business ID [${a.businessId}]`,i=`${Ot}-${a.businessId}`;O.loading("Updating business",{id:i});try{const c=await n(a),r=je(c,l,i,"updateBusiness");if(r)return O.success("Success",{id:i,description:"Business updated"}),r.updateBusiness}catch(c){console.error(`${l}: ${c}`),O.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateBusiness:t}},Lt="insertClient",Vt=()=>{const[{fetching:s},n]=pe(Qs),t=y.useCallback(async a=>{const l=`Error creating client [${a.fields.businessId}]`,i=`${Lt}-${a.fields.businessId}`;O.loading("Creating Client...",{id:i});try{const c=await n(a),r=je(c,l,i,"insertClient");if(r)return O.success("Success",{id:i,description:`Client [${a.fields.businessId}] was created`}),r.insertClient}catch(c){console.error(`${l}: ${c}`),O.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertClient:t}},Ft="updateClient",Fs=()=>{const[{fetching:s},n]=pe(Ys),t=y.useCallback(async a=>{const l=`Error updating client ID [${a.businessId}]`,i=`${Ft}-${a.businessId}`;O.loading("Updating client",{id:i});try{const c=await n(a),r=je(c,l,i,"updateClient");if(r)return O.success("Success",{id:i,description:"Client updated"}),r.updateClient}catch(c){console.error(`${l}: ${c}`),O.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateClient:t}},_t=Le({id:Ue().optional(),emails:ze(qe()).optional(),generatedDocumentType:ae(Object.values(de)),greenInvoiceId:Ue().optional(),hiveId:V().optional()});function $t({client:s,businessId:n,onDone:t}){const[a,l]=y.useState(!1),[i,c]=y.useState(null),{updateClient:r}=Fs(),{insertClient:o}=Vt(),[d,h]=y.useState(""),m={id:n,generatedDocumentType:de.Proforma,emails:[]},x=Ie({resolver:Oe(_t),defaultValues:s||m});y.useEffect(()=>{s&&(c(s),x.reset({emails:s.emails,greenInvoiceId:s.greenInvoiceId,hiveId:s.hiveId,generatedDocumentType:s.generatedDocumentType,id:s.id}),l(!0))},[s,x]);const A=()=>{c(null),x.reset(m),l(!0)},u=()=>{if(d.trim()){const b=x.getValues("emails");x.setValue("emails",[...b??[],d.trim()],{shouldDirty:!0}),h("")}},p=b=>{const k=x.getValues("emails");x.setValue("emails",(k??[]).filter((F,R)=>R!==b),{shouldDirty:!0})},S=y.useCallback(async b=>{if(i)r({businessId:n,fields:b});else{if(!b.greenInvoiceId){x.setError("greenInvoiceId",{message:"Green Invoice ID is required"});return}o({fields:{...b,greenInvoiceId:b.greenInvoiceId,businessId:n}})}l(!1),c(null),t?.()},[i,t,r,n,o,x]);return e.jsxs(Pe,{open:a,onOpenChange:l,children:[e.jsx(ss,{asChild:!0,children:e.jsxs(E,{size:"sm",onClick:A,children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"New Client"]})}),e.jsxs(Be,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ns,{children:[e.jsx(ts,{children:i?"Edit Client":"Create New Client"}),e.jsx(as,{children:i?"Update client details":"Add a new client with all required details"})]}),e.jsx(Ae,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(S),children:[e.jsx("div",{className:"grid gap-4 py-4",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:x.control,name:"emails",render:({field:b})=>e.jsxs(g,{children:[e.jsx(f,{children:"Emails"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{placeholder:"Add email...",value:d,onChange:k=>h(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),u())}}),e.jsx(E,{type:"button",size:"sm",onClick:u,children:e.jsx(q,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.value?.map((k,F)=>e.jsxs(Z,{variant:"secondary",className:"gap-1",children:[k,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>p(F),children:e.jsx(ue,{className:"size-3 cursor-pointer"})})]},F))}),e.jsx(C,{})]})}),e.jsx(j,{control:x.control,name:"generatedDocumentType",render:({field:b})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Document Type"}),e.jsxs(re,{onValueChange:b.onChange,defaultValue:b.value,children:[e.jsx(N,{children:e.jsx(ie,{children:e.jsx(le,{})})}),e.jsx(ce,{children:Object.values(de).map(k=>e.jsx(oe,{value:k,children:rs(k)},k))})]}),e.jsx(C,{})]})}),e.jsx(j,{control:x.control,name:"greenInvoiceId",render:({field:b})=>e.jsxs(g,{children:[e.jsx(f,{children:"Green Invoice ID"}),e.jsx(N,{children:e.jsx(T,{type:"text",placeholder:"Enter Green Invoice ID",...b,required:!i})}),e.jsx(C,{})]})}),e.jsx(j,{control:x.control,name:"hiveId",render:({field:b})=>e.jsxs(g,{children:[e.jsx(f,{children:"Hive ID"}),e.jsx(N,{children:e.jsx(T,{type:"text",placeholder:"Enter Hive ID",...b,required:!i})}),e.jsx(C,{})]})})]})}),e.jsxs(is,{children:[e.jsx(E,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(E,{type:"submit",children:i?"Update Client":"Create Client"})]})]})})]})]})}const Rt=Object.values(ln);function vs(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{isClient:!!s.clientInfo?.id,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough??void 0,isDocumentsOptional:s.isDocumentsOptional??void 0,isVatOptional:s.optionalVAT??void 0,isExemptDealer:s.exemptDealer??void 0,sortCode:s.sortCode?.key?.toString()??void 0,taxCategory:s.taxCategory?.id??void 0,pcn874RecordType:s?.pcn874RecordType??void 0,irsCode:s?.irsCode??void 0,description:s.suggestions?.description??void 0,tags:s.suggestions?.tags?.map(n=>n.id)??[],phrases:s.suggestions?.phrases??[],emails:s.suggestions?.emails??[],internalLinks:s.suggestions?.emailListener?.internalEmailLinks??[],attachmentTypes:s.suggestions?.emailListener?.attachments??[],useMessageBody:s.suggestions?.emailListener?.emailBody??void 0}}function Mt(s){const t=s.internalLinks||s.useMessageBody||s.attachmentTypes?{internalEmailLinks:s.internalLinks,emailBody:s.useMessageBody,attachments:s.attachmentTypes}:void 0,l=s.description||s.tags||s.phrases||s.emails||t?{description:s.description,tags:s.tags?.map(i=>({id:i})),phrases:s.phrases,emails:s.emails,emailListener:t}:void 0;return{optionalVAT:s.isVatOptional,exemptDealer:s.isExemptDealer,sortCode:s.sortCode?parseInt(s.sortCode):void 0,taxCategory:s.taxCategory,pcn874RecordType:s.pcn874RecordType,irsCode:s.irsCode,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough,isDocumentsOptional:s.isDocumentsOptional,suggestions:l}}function Ut({data:s,refetchBusiness:n}){const t=De(Zs,s),[a,l]=y.useState(vs(t)),{userContext:i}=y.useContext(es),{updateBusiness:c,fetching:r}=Vs(),[o,d]=y.useState(!1),[h,m]=y.useState(void 0),x=Ie({defaultValues:a}),A=async p=>{if(!t||!i?.context.adminBusinessId)return;const S=Ze(p,x.formState.dirtyFields);if(!S)return;const b=Mt(S);await c({businessId:t.id,ownerId:i.context.adminBusinessId,fields:b}),S.tags?.length||S.description?(m({tagIds:S.tags?.map(k=>({id:k})),description:S.description}),d(!0)):n?.()};if(y.useEffect(()=>{if(t){const p=vs(t);l(p),x.reset(p)}},[t,x]),!t)return e.jsx("div",{});const u=x.watch("isClient");return e.jsxs(G,{children:[e.jsx(W,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(K,{children:"Configurations"}),e.jsx(H,{children:"Business status, tax settings, automation rules, and integration preferences"})]}),!u&&e.jsx($t,{businessId:t.id,onDone:n})]})}),e.jsx(Ae,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(A),children:[e.jsxs(X,{className:"space-y-6",children:[e.jsx(zt,{form:x}),e.jsx(Fe,{}),e.jsx(qt,{form:x}),e.jsx(Fe,{}),e.jsx(Gt,{form:x}),e.jsx(Fe,{}),e.jsx(Wt,{form:x})]}),e.jsx(Ye,{className:"flex justify-end border-t pt-6",children:e.jsxs(E,{type:"submit",disabled:r||Object.keys(x.formState.dirtyFields).length===0,children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(ut,{businessId:t.id,tagIds:h?.tagIds,description:h?.description,open:o,onOpenChange:d,onClose:n})]})}function zt({form:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Business Status & Behavior"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:s.control,name:"isClient",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Client"}),e.jsx(ee,{children:"Mark this business as a client"})]}),e.jsx(N,{children:e.jsx(Y,{disabled:!0,checked:n.value,onCheckedChange:n.onChange,className:I(t)})})]})}),e.jsx(j,{control:s.control,name:"isActive",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Active"}),e.jsx(ee,{children:"Business is currently active"})]}),e.jsx(N,{children:e.jsx(Y,{checked:n.value,onCheckedChange:n.onChange,className:I(t)})})]})}),e.jsx(j,{control:s.control,name:"isReceiptEnough",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Receipt Enough"}),e.jsx(ee,{children:"Generate ledger for receipt documents if no invoice available"})]}),e.jsx(N,{children:e.jsx(Y,{checked:n.value,onCheckedChange:n.onChange,className:I(t)})})]})}),e.jsx(j,{control:s.control,name:"isDocumentsOptional",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"No Docs Required"}),e.jsx(ee,{children:"Skip document validation for common charges"})]}),e.jsx(N,{children:e.jsx(Y,{checked:n.value,onCheckedChange:n.onChange,className:I(t)})})]})}),e.jsx(j,{control:s.control,name:"isVatOptional",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is VAT Optional"}),e.jsx(ee,{children:"Mute missing VAT indicator"})]}),e.jsx(N,{children:e.jsx(Y,{checked:n.value,onCheckedChange:n.onChange,className:I(t)})})]})}),e.jsx(j,{control:s.control,name:"isExemptDealer",render:({field:n,fieldState:t})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Exempt Dealer"}),e.jsx(ee,{children:"Business is exempt from VAT requirements"})]}),e.jsx(N,{children:e.jsx(Y,{checked:n.value,onCheckedChange:n.onChange,className:I(t)})})]})})]})]})}function qt({form:s}){const{selectableTaxCategories:n,fetching:t}=en(),{selectableSortCodes:a,fetching:l,sortCodes:i}=sn(),{selectableTags:c,fetching:r}=nn(),o=y.useCallback(d=>{if(d){const h=i.find(m=>Number(m.key)===Number(d));h&&(h.defaultIrsCode?s.setValue("irsCode",h.defaultIrsCode,{shouldDirty:!0}):s.setValue("irsCode",null,{shouldDirty:!0}))}},[s,i]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Default Settings"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:s.control,name:"sortCode",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Sort Code"}),e.jsx(N,{children:e.jsx(Ge,{onChange:m=>{o(m),d.onChange(m)},data:a,value:d.value,disabled:l,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:I(h)}})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"taxCategory",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tax Category"}),e.jsx(N,{children:e.jsx(Ge,{data:n,disabled:t,value:d.value,onChange:d.onChange,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:I(h)}})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"pcn874RecordType",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"PCN874 Record Type"}),e.jsxs(re,{onValueChange:d.onChange,value:d.value,children:[e.jsx(N,{children:e.jsx(ie,{className:I(h),children:e.jsx(le,{})})}),e.jsx(ce,{children:Object.entries(tn).map(([m,x])=>e.jsx(oe,{value:m,children:`${x} (${m})`},m))})]}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"irsCode",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(N,{children:e.jsx(an,{value:d.value??void 0,onValueChange:m=>d.onChange(m??null),hideControls:!0,decimalScale:0,className:I(h)})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"description",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Charge Description"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter default charge description",...d,className:I(h)})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"tags",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tags"}),e.jsx(N,{children:e.jsx(rn,{options:Object.values(c).map(({value:m,label:x})=>({label:x,value:m})),onValueChange:d.onChange,defaultValue:d.value,value:d.value,placeholder:"Select Default Tags",variant:"default",disabled:r,className:I(h)})}),e.jsx(C,{})]})})]})]})}function Gt({form:s}){const[n,t]=y.useState(""),[a,l]=y.useState(""),i=()=>{if(n.trim()){const d=s.getValues("phrases");s.setValue("phrases",[...d,n.trim()],{shouldDirty:!0}),t("")}},c=()=>{if(a.trim()){const d=s.getValues("emails");s.setValue("emails",[...d,a.trim()],{shouldDirty:!0}),l("")}},r=d=>{const h=s.getValues("phrases");s.setValue("phrases",h.filter((m,x)=>x!==d),{shouldDirty:!0})},o=d=>{const h=s.getValues("emails");s.setValue("emails",h.filter((m,x)=>x!==d),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Auto-matching Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure patterns for automatic matching of bank transactions and documents"}),e.jsx(j,{control:s.control,name:"phrases",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Phrases"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{placeholder:"Add phrase...",value:n,onChange:m=>t(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),i())},className:I(h)}),e.jsx(E,{type:"button",size:"sm",onClick:i,children:e.jsx(q,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((m,x)=>e.jsxs(Z,{variant:"secondary",className:"gap-1",children:[m,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>r(x),children:e.jsx(ue,{className:"size-3 cursor-pointer",onClick:()=>r(x)})})]},x))}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"emails",render:({field:d,fieldState:h})=>e.jsxs(g,{children:[e.jsx(f,{children:"Email Addresses"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"email",placeholder:"Add email...",value:a,onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),c())},className:I(h)}),e.jsx(E,{type:"button",size:"sm",onClick:c,children:e.jsx(q,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((m,x)=>e.jsxs(Z,{variant:"secondary",className:"gap-1",children:[m,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>o(x),children:e.jsx(ue,{className:"size-3 cursor-pointer"})})]},x))}),e.jsx(C,{})]})})]})}function Wt({form:s}){const[n,t]=y.useState(""),a=()=>{if(n.trim()){const c=s.getValues("internalLinks");s.setValue("internalLinks",[...c,n.trim()],{shouldDirty:!0}),t("")}},l=c=>{const r=s.getValues("attachmentTypes");s.setValue("attachmentTypes",r?.includes(c)?r.filter(o=>o!==c):[...r,c],{shouldDirty:!0})},i=c=>{const r=s.getValues("internalLinks");s.setValue("internalLinks",r.filter((o,d)=>d!==c),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Gmail Feature Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Gmail integration settings for document processing"}),e.jsx(j,{control:s.control,name:"attachmentTypes",render:({field:c,fieldState:r})=>e.jsxs(g,{children:[e.jsx(f,{children:"Attachment Types"}),e.jsx("div",{className:I(r)+" rounded-md flex flex-wrap gap-2",children:Rt.map(o=>e.jsx(Z,{variant:c.value?.includes(o)?"default":"outline",className:"cursor-pointer",onClick:()=>l(o),children:o},o))}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"internalLinks",render:({field:c,fieldState:r})=>e.jsxs(g,{children:[e.jsx(f,{children:"Internal Links"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"url",placeholder:"Add internal link...",value:n,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),a())}}),e.jsx(E,{type:"button",size:"sm",onClick:a,children:e.jsx(q,{className:"h-4 w-4"})})]}),e.jsx("div",{className:I(r)+" flex flex-wrap gap-2 rounded-md",children:c.value?.map((o,d)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[o,e.jsx(E,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>i(d),children:e.jsx(ue,{className:"size-3 cursor-pointer flex-shrink-0"})})]},d))}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"useMessageBody",render:({field:c,fieldState:r})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Should Use Message Body"}),e.jsx(ee,{children:"Extract information from email message body"})]}),e.jsx(N,{children:e.jsx(Y,{checked:c.value,onCheckedChange:c.onChange,className:I(r)})})]})})]})}const Kt=Le({businessName:V().min(1,"Business name is required"),locality:V().min(1,"Locality is required"),localName:V().optional(),govId:V().optional(),address:V().optional(),localAddress:V().optional(),phone:V().optional(),website:Is("Invalid URL").optional().or(Ds("")),generalContacts:ze(qe()).optional(),billingEmails:ze(qe()).optional()});function ys(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{businessName:s.name,locality:s.country,localName:s.hebrewName??void 0,govId:s.governmentId??void 0,address:s.address??void 0,phone:s.phoneNumber??void 0,website:s.website??void 0,generalContacts:s.email?.split(",").map(n=>n.trim()),billingEmails:s.clientInfo?.emails}}function Ht(s){return{name:s.businessName,country:s.locality,hebrewName:s.localName,governmentId:s.govId,address:s.address,phoneNumber:s.phone,website:s.website,email:s.generalContacts?.join(", ")}}function Xt({data:s,refetchBusiness:n}){const t=De(dn,s),[a,l]=y.useState(ys(t)),{userContext:i}=y.useContext(es),{updateBusiness:c,fetching:r}=Vs(),o=Ie({resolver:Oe(Kt),defaultValues:a}),{countries:d,fetching:h}=cn(),[m,x]=y.useState(""),[A,u]=y.useState(""),p=o.watch("locality"),S=o.watch("address"),b=o.watch("localAddress");y.useEffect(()=>{S!==a.address&&o.setValue("address",S,{shouldDirty:!0})},[S,a.address,o]),y.useEffect(()=>{b!==a.localAddress&&o.setValue("localAddress",b,{shouldDirty:!0})},[b,a.localAddress,o]);const k=t&&"clientInfo"in t&&!!t.clientInfo,F=p===i?.context.locality,R=v=>{m.trim()&&(o.setValue("generalContacts",[...v,m.trim()],{shouldDirty:!0}),x(""))},$=(v,w)=>{o.setValue("generalContacts",v.filter((P,B)=>B!==w),{shouldDirty:!0})},J=v=>{A.trim()&&(o.setValue("billingEmails",[...v,A.trim()],{shouldDirty:!0}),u(""))},U=(v,w)=>{o.setValue("billingEmails",v.filter((P,B)=>B!==w),{shouldDirty:!0})},se=async v=>{if(!t||!i?.context.adminBusinessId)return;const w=Ze(v,o.formState.dirtyFields);if(!w)return;const P=Ht(w);await c({businessId:t.id,ownerId:i.context.adminBusinessId,fields:P}),n?.()};return y.useEffect(()=>{if(t){const v=ys(t);l(v),o.reset(v)}},[t,o]),e.jsxs(G,{children:[e.jsxs(W,{children:[e.jsx(K,{children:"Contact Information"}),e.jsx(H,{children:"Business contact details and address information"})]}),e.jsx(Ae,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(se),children:[e.jsx(X,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(j,{control:o.control,name:"businessName",render:({field:v,fieldState:w})=>e.jsxs(g,{children:[e.jsx(f,{children:"Business Name"}),e.jsx(N,{children:e.jsx(T,{...v,className:I(w)})}),e.jsx(C,{})]})}),e.jsx(j,{control:o.control,name:"locality",render:({field:v,fieldState:w})=>e.jsxs(g,{children:[e.jsx(f,{children:"Locality / Country"}),e.jsx(Ge,{onChange:v.onChange,data:d.map(P=>({value:P.code,label:P.name})),value:v.value,disabled:h,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:I(w)}}),e.jsx(C,{})]})}),F&&e.jsx(j,{control:o.control,name:"localName",render:({field:v,fieldState:w})=>e.jsxs(g,{children:[e.jsx(f,{children:"Local Name"}),e.jsx(N,{children:e.jsx(T,{...v,placeholder:"Business name in local language",className:I(w)})}),e.jsx(C,{})]})}),F&&e.jsx(j,{control:o.control,name:"govId",render:({field:v,fieldState:w})=>e.jsxs(g,{children:[e.jsx(f,{children:"Government ID"}),e.jsx(N,{children:e.jsx(T,{...v,placeholder:"Enter Government ID",className:I(w)})}),e.jsx(C,{})]})}),e.jsx(j,{control:o.control,name:"address",render:({field:v,fieldState:w})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"Address"]}),e.jsx(N,{children:e.jsx(Ke,{...v,rows:3,placeholder:"Enter business address",className:I(w)})}),e.jsx(C,{})]})}),F&&e.jsx(j,{control:o.control,name:"localAddress",render:({field:v,fieldState:w})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"Local Address"]}),e.jsx(N,{children:e.jsx(Ke,{...v,rows:3,placeholder:"Enter address in local language",className:I(w)})}),e.jsx(C,{})]})}),e.jsx(j,{control:o.control,name:"phone",render:({field:v,fieldState:w})=>e.jsxs(g,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),"Phone"]}),e.jsx(N,{children:e.jsx(T,{...v,type:"tel",placeholder:"+1 (555) 123-4567",className:I(w)})}),e.jsx(C,{})]})}),e.jsx(j,{control:o.control,name:"website",render:({field:v,fieldState:w})=>e.jsxs(g,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(on,{className:"h-4 w-4"}),"Website"]}),e.jsx(N,{children:e.jsx(T,{...v,type:"url",placeholder:"https://example.com",className:I(w)})}),e.jsx(C,{})]})}),e.jsx(j,{control:o.control,name:"generalContacts",render:({field:v,fieldState:w})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"General Contacts"]}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:I(w)+" flex flex-wrap gap-2 mb-2 rounded-md",children:v.value?.map((P,B)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 pr-1",children:[P,e.jsx("button",{type:"button",onClick:()=>$(v.value??[],B),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ue,{className:"h-3 w-3"})})]},B))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{value:m,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),R(v.value??[]))},placeholder:"Add contact email",type:"email"}),e.jsx(E,{type:"button",variant:"outline",size:"icon",disabled:!m.trim(),onClick:()=>R(v.value??[]),children:e.jsx(q,{className:"h-4 w-4"})})]})]})}),e.jsx(C,{})]})}),k&&e.jsx(j,{control:o.control,name:"billingEmails",render:({field:v,fieldState:w})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"Billing Emails"]}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:I(w)+" flex flex-wrap gap-2 mb-2 rounded-md",children:v.value?.map((P,B)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 pr-1",children:[P,e.jsx("button",{type:"button",onClick:()=>U(v.value??[],B),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ue,{className:"h-3 w-3"})})]},B))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{value:A,onChange:P=>u(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),J(v.value??[]))},placeholder:"Add billing email",type:"email"}),e.jsx(E,{type:"button",variant:"outline",size:"icon",disabled:!A.trim(),onClick:()=>J(v.value??[]),children:e.jsx(q,{className:"h-4 w-4"})})]})]})}),e.jsx(C,{})]})})]})}),e.jsx(Ye,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(E,{type:"submit",disabled:r||Object.keys(o.formState.dirtyFields).length===0,children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})})]})}const Jt="createContract",Qt=()=>{const[{fetching:s},n]=pe(un),t=y.useCallback(async a=>{const l=`Error creating new contract for client[${a.input.clientId}]`,i=`${Jt}-${a.input.clientId}`;O.loading("Creating contract",{id:i});try{const c=await n(a);je(c,l,i)&&O.success("Success",{id:i,description:`Contract for client ${a.input.clientId} was successfully created`})}catch(c){console.error(`${l}: ${c}`),O.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{creating:s,createContract:t}},Yt="updateContract",Zt=()=>{const[{fetching:s},n]=pe(mn),t=y.useCallback(async a=>{const l=`Error updating contract ID [${a.contractId}]`,i=`${Yt}-${a.contractId}`;O.loading("Updating contract",{id:i});try{const c=await n(a),r=je(c,l,i,"updateContract");if(r)return O.success("Success",{id:i,description:"Contract updated"}),r.updateContract}catch(c){console.error(`${l}: ${c}`),O.error("Error",{id:i,description:l,duration:1e5,closeButton:!0})}},[n]);return{updating:s,updateContract:t}},ea=Le({id:Ue().optional(),startDate:us("Start date is required"),endDate:us("End date is required"),po:V().optional(),paymentAmount:bs().min(0,"Payment amount must be non-negative"),paymentCurrency:ae(Object.values(ls),"Currency is required"),productType:ae(Object.values(As)).optional(),msCloudLink:Is().optional().or(Ds("")),billingCycle:ae(Object.values(be)).optional(),subscriptionPlan:ae(Object.values(Te)).optional(),isActive:hn(),defaultRemark:V().optional(),defaultDocumentType:ae(Object.values(de))}),Ns={startDate:"",endDate:"",po:void 0,paymentAmount:0,paymentCurrency:ls.Usd,productType:As.Hive,msCloudLink:void 0,billingCycle:be.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:de.Proforma};function sa({clientId:s,contract:n,onDone:t}){const[a,l]=y.useState(!1),[i,c]=y.useState(null),{updateContract:r,updating:o}=Zt(),{createContract:d,creating:h}=Qt(),m=Ie({resolver:Oe(ea),defaultValues:n||Ns});y.useEffect(()=>{n&&(c(n),m.reset({startDate:n.startDate,endDate:n.endDate,po:n.po,paymentAmount:n.paymentAmount,paymentCurrency:n.paymentCurrency,productType:n.productType,msCloudLink:n.msCloudLink,billingCycle:n.billingCycle,subscriptionPlan:n.subscriptionPlan,isActive:n.isActive,defaultRemark:n.defaultRemark,defaultDocumentType:n.defaultDocumentType}),l(!0))},[n,m]);const x=()=>{c(null),m.reset(Ns),l(!0)},A=y.useCallback(async u=>{if(i)await r({contractId:i.id,input:{amount:{raw:u.paymentAmount,currency:u.paymentCurrency},billingCycle:u.billingCycle,documentType:u.defaultDocumentType,endDate:Ne(new Date(u.endDate),"yyyy-MM-dd"),isActive:u.isActive,msCloud:u.msCloudLink,plan:u.subscriptionPlan,product:u.productType,purchaseOrder:u.po,remarks:u.defaultRemark,startDate:Ne(new Date(u.startDate),"yyyy-MM-dd")}});else{if(!u.billingCycle){m.setError("billingCycle",{message:"Billing cycle is required"});return}await d({input:{clientId:s,amount:{raw:u.paymentAmount,currency:u.paymentCurrency},billingCycle:u.billingCycle,documentType:u.defaultDocumentType,endDate:Ne(new Date(u.endDate),"yyyy-MM-dd"),isActive:u.isActive,msCloud:u.msCloudLink,plan:u.subscriptionPlan,product:u.productType,purchaseOrder:u.po,remarks:u.defaultRemark,startDate:Ne(new Date(u.startDate),"yyyy-MM-dd")}})}l(!1),c(null),t?.()},[i,t,d,r,s,m]);return e.jsxs(Pe,{open:a,onOpenChange:l,children:[e.jsx(ss,{asChild:!0,children:e.jsxs(E,{size:"sm",onClick:x,children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"New Contract"]})}),e.jsxs(Be,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ns,{children:[e.jsx(ts,{children:i?"Edit Contract":"Create New Contract"}),e.jsx(as,{children:i?"Update contract details":"Add a new contract with all required details"})]}),e.jsx(Ae,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(A),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e.jsx(j,{control:m.control,name:"po",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"PO Number"}),e.jsx(N,{children:e.jsx(T,{placeholder:"PO-2024-001",...u})}),e.jsx(C,{})]})})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:m.control,name:"startDate",render:({field:{onChange:u,...p}})=>e.jsxs(g,{children:[e.jsx(f,{children:"Start Date"}),e.jsx(N,{children:e.jsx(T,{type:"date",...p,onInput:S=>u(S)})}),e.jsx(C,{})]})}),e.jsx(j,{control:m.control,name:"endDate",render:({field:{onChange:u,...p}})=>e.jsxs(g,{children:[e.jsx(f,{children:"End Date"}),e.jsx(N,{children:e.jsx(T,{type:"date",...p,onInput:S=>u(S)})}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(j,{control:m.control,name:"paymentAmount",render:({field:u})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsx(f,{children:"Payment Amount"}),e.jsx(N,{children:e.jsx(T,{type:"number",placeholder:"24000",...u,onChange:p=>{u.onChange(p?.target.value?Number(p?.target.value):void 0)}})}),e.jsx(C,{})]})}),e.jsx(j,{control:m.control,name:"paymentCurrency",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Currency"}),e.jsxs(re,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(N,{children:e.jsx(ie,{children:e.jsx(le,{})})}),e.jsx(ce,{children:Object.values(ls).map(p=>e.jsx(oe,{value:p,children:p},p))})]}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:m.control,name:"productType",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Product Type"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Cloud Services",...u})}),e.jsx(C,{})]})}),e.jsx(j,{control:m.control,name:"billingCycle",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Billing Cycle"}),e.jsxs(re,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(N,{children:e.jsx(ie,{children:e.jsx(le,{})})}),e.jsx(ce,{children:Object.values(be).map(p=>e.jsx(oe,{value:p,children:Ps(p)},p))})]}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:m.control,name:"subscriptionPlan",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Subscription Plan"}),e.jsx(N,{children:e.jsxs(re,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(N,{children:e.jsx(ie,{children:e.jsx(le,{})})}),e.jsx(ce,{children:Object.values(Te).map(p=>e.jsx(oe,{value:p,children:Bs(p)},p))})]})}),e.jsx(C,{})]})}),e.jsx(j,{control:m.control,name:"isActive",render:({field:u})=>e.jsxs(g,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(f,{className:"text-base",children:"Active Status"})}),e.jsx(N,{children:e.jsx(Y,{checked:u.value,onCheckedChange:u.onChange})})]})})]}),e.jsx(j,{control:m.control,name:"msCloudLink",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"MS Cloud Link"}),e.jsx(N,{children:e.jsx(T,{type:"url",placeholder:"https://portal.azure.com/contract-id",...u})}),e.jsx(C,{})]})}),e.jsx(j,{control:m.control,name:"defaultDocumentType",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Document Type"}),e.jsxs(re,{onValueChange:u.onChange,defaultValue:u.value,children:[e.jsx(N,{children:e.jsx(ie,{children:e.jsx(le,{})})}),e.jsx(ce,{children:Object.values(de).map(p=>e.jsx(oe,{value:p,children:rs(p)},p))})]}),e.jsx(C,{})]})}),e.jsx(j,{control:m.control,name:"defaultRemark",render:({field:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Remark"}),e.jsx(N,{children:e.jsx(Ke,{placeholder:"Enter default remark for this contract...",rows:3,...u})}),e.jsx(C,{})]})})]}),e.jsxs(is,{children:[e.jsx(E,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(E,{type:"submit",disabled:h||o,children:i?"Update Contract":"Create Contract"})]})]})})]})]})}function na(s){return{id:s.id,po:s.purchaseOrder??void 0,startDate:s.startDate,endDate:s.endDate,paymentAmount:s.amount.raw,paymentCurrency:s.amount.currency,productType:s.product??void 0,billingCycle:s.billingCycle,msCloudLink:s.msCloud?.toString(),isActive:s.isActive,subscriptionPlan:s.plan??void 0,defaultRemark:s.remarks??void 0,defaultDocumentType:s.documentType??void 0}}function ta({clientId:s}){const[n,t]=y.useState(null),[{data:a,fetching:l},i]=we({query:xn,variables:{clientId:s}}),c=a?.contractsByClient??[];return l?e.jsx("div",{children:"Loading contracts..."}):e.jsxs(G,{children:[e.jsx(W,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(K,{children:"Contracts"}),e.jsx(H,{children:"Current and past contracts sorted by start date"})]}),e.jsx(sa,{clientId:s,contract:n,onDone:i})]})}),e.jsx(X,{className:"space-y-4",children:c.map(r=>{const o=!!r.isActive;return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:r.product}),e.jsx(Z,{variant:o?"default":"secondary",children:r.isActive?"Active":"Inactive"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:r.id})]}),e.jsx(E,{variant:"ghost",size:"sm",onClick:()=>t(na(r)),children:e.jsx(Zn,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(pn,{className:"h-3 w-3"}),"Contract Period"]}),e.jsxs("p",{className:"text-sm font-medium",children:[new Date(r.startDate).toLocaleDateString()," →"," ",new Date(r.endDate).toLocaleDateString()]})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"PO Number"}),e.jsx("p",{className:"text-sm font-medium font-mono",children:r.purchaseOrder})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Payment"}),e.jsx("p",{className:"text-sm font-medium",children:jn(r.amount.raw,r.amount.currency)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing Cycle"}),e.jsx("p",{className:"text-sm font-medium",children:Ps(r.billingCycle)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscription Plan"}),e.jsx("p",{className:"text-sm font-medium",children:r.plan?Bs(r.plan):"N/A"})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Document Type"}),e.jsx("p",{className:"text-sm font-medium",children:rs(r.documentType)})]})]}),r.remarks&&e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remark"}),e.jsx("p",{className:"text-sm",children:r.remarks})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.msCloud&&e.jsx(E,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:r.msCloud.toString(),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(gn,{className:"h-4 w-4 mr-2"}),"MS Cloud",e.jsx(fn,{className:"h-3 w-3 ml-1"})]})})})]},r.id)})})]})}function aa({businessId:s}){return e.jsxs(G,{children:[e.jsx(W,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(K,{children:"Documents"}),e.jsx(H,{children:"Invoices, proformas, receipts, and other accounting documents"})]})})}),e.jsx(X,{children:e.jsx(vn,{businessId:s,linkedDocumentIds:[],limit:1e3})})]})}const ra=[{id:"hive",name:"Hive",description:"Schema registry, analytics, metrics and gateway for GraphQL federation and other GraphQL APIs",status:"disconnected",lastSync:"Never"},{id:"slack",name:"Slack",description:"Team communication and notifications",status:"disconnected",lastSync:"Never"},{id:"retool",name:"Retool",description:"Internal tools and dashboards",status:"disconnected",lastSync:"Never"},{id:"linear",name:"Linear",description:"Issue tracking and project management",status:"disconnected",lastSync:"Never"},{id:"workflowy",name:"Workflowy",description:"Task management and note taking",status:"disconnected",lastSync:"Never"}];function ia({data:s}){const n=De(Cn,s),[{data:t,fetching:a},l]=we({query:yn,variables:{clientId:n?.id??""},pause:!n?.clientInfo?.greenInvoiceId||!n?.id}),{updateClient:i}=Fs(),c=y.useCallback((o,d)=>{if(!n?.id)return;const h={};h[d]=o,i({businessId:n?.id,fields:h})},[n?.id,i]);y.useEffect(()=>{n?.clientInfo?.greenInvoiceId&&n?.id&&l()},[n?.clientInfo?.greenInvoiceId,n?.id,l]);const r=t?.greenInvoiceClient;return e.jsxs(G,{children:[e.jsx(W,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(K,{children:"Integrations"}),e.jsx(H,{children:"Connected external services and providers"})]}),e.jsxs(E,{size:"sm",children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),"Add Integration"]})]})}),e.jsx(X,{className:"space-y-6",children:e.jsxs(et,{type:"multiple",defaultValue:["green-invoice"],className:"space-y-4",children:[a?e.jsxs($e,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(D,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-6 w-32"}),e.jsx(D,{className:"h-5 w-5 rounded-full"})]}),e.jsx(D,{className:"h-4 w-64"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-8 w-24"}),e.jsx(D,{className:"h-8 w-8"})]})]})}),e.jsx(Re,{children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-32"}),e.jsx(D,{className:"h-6 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{className:"h-3 w-24"}),e.jsx(D,{className:"h-4 w-full"})]})]})]})]})})]}):e.jsxs($e,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-green-600 flex items-center justify-center text-white font-bold",children:"GI"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Green Invoice"}),e.jsx(xs,{className:"h-5 w-5 text-green-600"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Israeli invoicing system integration"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(la,{id:n?.clientInfo?.greenInvoiceId,provider:"Green Invoice",updateClient:async o=>c(o,"greenInvoiceId")}),e.jsx(hs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Re,{children:r&&e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Business Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Integration ID"}),e.jsx("p",{className:"text-sm font-mono",children:n?.clientInfo?.greenInvoiceId})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Business Name"}),e.jsx("p",{className:"text-sm",children:r.name})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Country"}),e.jsx("p",{className:"text-sm",children:r.country})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"text-sm font-mono",children:r.taxId})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Contact Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(He,{className:"h-3.5 w-3.5"}),"Email Addresses"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.emails?.map((o,d)=>e.jsx("span",{className:"text-sm px-2 py-1 bg-muted rounded",children:o},d))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(ws,{className:"h-3.5 w-3.5"}),"Phone"]}),e.jsx("p",{className:"text-sm font-mono",children:r.phone})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Mobile"}),e.jsx("p",{className:"text-sm font-mono",children:r.mobile})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Fax"}),e.jsx("p",{className:"text-sm font-mono",children:r.fax})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[e.jsx(We,{className:"h-3.5 w-3.5"}),"Address"]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Street Address"}),e.jsx("p",{className:"text-sm",children:r.address})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"City"}),e.jsx("p",{className:"text-sm",children:r.city})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Zip Code"}),e.jsx("p",{className:"text-sm font-mono",children:r.zip})]})]})]})]})})]}),ra.map(o=>e.jsxs($e,{value:o.id,className:"rounded-lg border",children:[e.jsx("div",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-3 flex-1",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:o.name}),o.status==="connected"?e.jsx(xs,{className:"h-4 w-4 text-green-600"}):e.jsx(Nn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{variant:"ghost",size:"sm",onClick:d=>d.stopPropagation(),children:e.jsx(cs,{className:"h-4 w-4"})}),e.jsx(hs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Re,{children:e.jsx("div",{className:"px-4 pb-4 pt-2 border-t",children:e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last sync: "}),e.jsx("span",{className:"font-medium",children:o.lastSync})]})})})]},o.id))]})})]})}function la({id:s,provider:n,updateClient:t}){const[a,l]=y.useState(!1),[i,c]=y.useState(s),r=y.useCallback(async()=>{await t(i),l(!1)},[i,t]);return e.jsxs(Pe,{open:a,onOpenChange:l,children:[e.jsx(ss,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:"sm",onClick:o=>o.stopPropagation(),children:[e.jsx(cs,{className:"h-4 w-4 mr-2"}),"Configure"]})}),e.jsxs(Be,{onClick:o=>o.stopPropagation(),children:[e.jsxs(ns,{children:[e.jsxs(ts,{children:["Configure ",n]}),e.jsxs(as,{children:["Update your ",n," integration settings"]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(bn,{htmlFor:"id",children:[n," ID"]}),e.jsx(T,{id:"id",value:i,onChange:o=>c(o.target.value),placeholder:`Enter ${n} ID`})]})}),e.jsxs(is,{children:[e.jsx(E,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(E,{onClick:r,disabled:!i,children:"Save Changes"})]})]})]})}function ca({businessId:s}){return e.jsxs(G,{children:[e.jsx(W,{className:"flex w-full justify-between items-center",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(K,{children:"Transactions"}),e.jsx(H,{children:"Complete transaction history for this business"})]})})}),e.jsx(X,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(wn,{businessID:s,filter:{}})})})]})}function oa({data:s,refetchBusiness:n}){const t=De(Tn,s),[a,l]=In(),i=a.get("tab")||"contact",c=d=>{l({tab:d})};if(!t)return e.jsx("div",{children:"Business not found"});const r="clientInfo"in t&&!!t.clientInfo,o="adminInfo"in t&&!!t.adminInfo;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(On,{data:t}),e.jsx("main",{className:"container mx-auto px-4 py-6 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs(Dn,{value:i,onValueChange:c,className:"w-full",children:[e.jsxs(An,{className:"grid w-full lg:grid-cols-8 sm:grid-cols-4 grid-cols-8 mb-6 h-auto gap-1 bg-muted/50 p-1",children:[e.jsxs(Q,{value:"contact",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(st,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contact"})]}),e.jsxs(Q,{value:"config",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(cs,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Config"})]}),e.jsxs(Q,{value:"charges",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Charges"})]}),e.jsxs(Q,{value:"transactions",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Sn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Transactions"})]}),e.jsxs(Q,{value:"documents",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(kn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documents"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs(Q,{value:"contracts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(rt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contracts"})]}),e.jsxs(Q,{value:"integrations",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(lt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Integrations"})]})]}),o&&e.jsxs(Q,{value:"admin",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Es,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Admin"})]})]}),e.jsx(z,{value:"contact",className:"mt-0",children:e.jsx(Xt,{data:t,refetchBusiness:n})}),e.jsx(z,{value:"config",className:"mt-0",children:e.jsx(Ut,{data:t,refetchBusiness:n})}),e.jsx(z,{value:"charges",className:"mt-0",children:e.jsx(gt,{businessId:t.id})}),e.jsx(z,{value:"transactions",className:"mt-0",children:e.jsx(ca,{businessId:t.id})}),e.jsx(z,{value:"documents",className:"mt-0",children:e.jsx(aa,{businessId:t.id})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(z,{value:"contracts",className:"mt-0",children:e.jsx(ta,{clientId:t.id})}),e.jsx(z,{value:"integrations",className:"mt-0",children:e.jsx(ia,{data:t})}),e.jsx(z,{value:"charts",className:"mt-0",children:e.jsx(Bt,{})})]}),o&&e.jsx(z,{value:"admin",className:"mt-0",children:e.jsx(jt,{data:t})})]})})]})}function fa(s){return`/businesses/${s}`}const va=()=>{const{businessId:s}=En();let n;try{n=Pn()}catch{}const[{data:t,fetching:a},l]=we({query:Bn,pause:!s||!!n,variables:{businessId:s??""}}),i=n||t;return!n&&a&&!i?.business?e.jsx(Cs,{}):!s||!i?.business?e.jsx("div",{children:"Business not found"}):e.jsx(oa,{data:i.business,refetchBusiness:async()=>l()})};export{va as BusinessScreen,fa as getBusinessHref};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fv as n}from"./index-B84WKwxY.js";function a(o,s,t){return n(o,-s,t)}export{a as s};
|