FinancePage-D44VkPQp.js 36 KB

1
  1. import{i as e}from"./chunk-aKtaBQYM.js";import{C as t,O as n,T as r,a as i,w as a}from"./client-D5sDHQfN.js";import{n as o}from"./QueryClientProvider-RTEea2Mk.js";import{t as s}from"./useQuery-CGtzNsic.js";import{t as c}from"./useMutation-Kl2cmi_r.js";import{n as ee,t as te}from"./chevrons-right-_Nd5b9N0.js";import{n as ne}from"./ToastContext-DKTQgyG5.js";import{n as re}from"./AuthContext-F8QHEqr7.js";import{i as l,n as u,t as d}from"./Card-BehSIsEQ.js";import{t as f}from"./Button-D71ID444.js";import{v as p}from"./date-G9KUauqz.js";import{Bn as ie,Dt as ae,Vn as oe,cn as se,ht as ce,zt as le}from"./index-nsyp3RII.js";var ue=t(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),de=t(`clock-3`,[[`path`,{d:`M12 6v6h4`,key:`135r8i`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),fe=t(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),m=e(n(),1),h=a(),g=/\[(aborted|failed|cancelled):\s*([^\]]*)\]/i;function pe(e){if(!e)return{isPartial:!1,partialType:null,cleanedDescription:null};let t=e.match(g);if(!t)return{isPartial:!1,partialType:null,cleanedDescription:e};let n=e.replace(t[0],``).trim();return{isPartial:!0,partialType:t[1].toLowerCase(),cleanedDescription:n||null}}function me(e,t){if(!e)return`-`;let n=p(e);return n?n.toLocaleString(t):e}function he(e){let t=e.trim();if(!t)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function ge(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}T${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}`}var _=`w-full px-3 py-2 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:outline-none focus:ring-1 focus:ring-bambu-green`,v=`block text-sm font-medium text-white mb-1`,y=`px-4 py-3 text-left text-bambu-gray font-medium`,b=`px-4 py-3 align-top text-white`;function x({title:e,onClose:t,children:n,size:i=`md`}){let{t:a}=r();return(0,h.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,h.jsxs)(`div`,{className:`w-full ${i===`sm`?`max-w-xl`:i===`lg`?`max-w-6xl`:`max-w-4xl`} overflow-hidden rounded-lg border border-bambu-dark-tertiary bg-bambu-dark-secondary`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between border-b border-bambu-dark-tertiary px-4 py-3`,children:[(0,h.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:e}),(0,h.jsx)(f,{size:`sm`,variant:`secondary`,onClick:t,children:a(`common.close`,`Close`)})]}),(0,h.jsx)(`div`,{className:`max-h-[75vh] overflow-auto p-4`,children:n})]})})}function S(){let{t:e,i18n:t}=r(),{hasPermission:n,user:a}=re(),{showToast:p}=ne(),g=o(),S=n(`cost_centers:read_own`),C=n(`cost_centers:read_all`),_e=n(`cost_centers:create`),w=n(`cost_centers:modify`),T=n(`cost_centers:modify`),E=n(`cost_centers:modify`),D=n(`cost_centers:modify`),O=n(`users:read_slim`)||n(`users:read`),ve=C||_e||w||T||E||D,ye=S||ve,k=ye,[be,xe]=(0,m.useState)(``),[A,Se]=(0,m.useState)(`monthly`),[Ce,we]=(0,m.useState)(``),[j,Te]=(0,m.useState)(null),[Ee,De]=(0,m.useState)(`deposit`),[Oe,ke]=(0,m.useState)(``),[Ae,je]=(0,m.useState)(``),[Me,Ne]=(0,m.useState)(null),[M,N]=(0,m.useState)(null),[P,Pe]=(0,m.useState)(null),[Fe,Ie]=(0,m.useState)(!0),[F,I]=(0,m.useState)(0),[L,Le]=(0,m.useState)(`all`),[R,Re]=(0,m.useState)(`all`),[ze,Be]=(0,m.useState)(!1),[Ve,He]=(0,m.useState)(!1),[Ue,We]=(0,m.useState)(!1),[z,Ge]=(0,m.useState)(!1),[B,Ke]=(0,m.useState)(`personal`),[V,qe]=(0,m.useState)(null),[Je,Ye]=(0,m.useState)(``),[Xe,H]=(0,m.useState)(`monthly`),[Ze,U]=(0,m.useState)(``),[Qe,W]=(0,m.useState)(!1),[$e,et]=(0,m.useState)(null),[tt,nt]=(0,m.useState)(null),[rt,it]=(0,m.useState)(null),[at,ot]=(0,m.useState)(``),[st,ct]=(0,m.useState)(``),[lt,ut]=(0,m.useState)(!1),[dt,ft]=(0,m.useState)(null),[pt,mt]=(0,m.useState)(null),[ht,gt]=(0,m.useState)(``),[_t,vt]=(0,m.useState)(``),[yt,bt]=(0,m.useState)(ge(new Date)),[G,xt]=(0,m.useState)(null),[St,Ct]=(0,m.useState)(null),wt=C||_e||w||T||D&&O||E&&O;(0,m.useEffect)(()=>{wt||Ke(`personal`)},[wt]);let{data:Tt,isLoading:Et}=s({queryKey:[`finance`,`me`,`balance`],queryFn:i.getMyBalance,enabled:S}),{data:Dt}=s({queryKey:[`ui-flags`],queryFn:i.getUiFlags}),{data:Ot,isLoading:kt}=s({queryKey:[`finance`,`me`,`transactions`,50,F],queryFn:()=>i.getMyTransactions(50,F),enabled:S}),{data:At,isLoading:jt}=s({queryKey:[`finance`,`transactions`,50,F],queryFn:()=>i.getAllTransactions(50,F),enabled:B===`admin`&&C}),{data:K,isLoading:Mt}=s({queryKey:[`finance`,`cost-centers`,B],queryFn:()=>B===`admin`&&ve?i.listCostCenters(!0):i.getMyCostCenters(),enabled:k}),{data:q}=s({queryKey:[`users`,`slim`],queryFn:i.getUsersSlim,enabled:O&&(k||D||E)}),{data:J}=s({queryKey:[`finance`,`cost-center`,M],queryFn:()=>i.getCostCenter(M),enabled:E&&M!=null});(0,m.useEffect)(()=>{!q||q.length===0||j!=null&&q.some(e=>e.id===j)||Te(q[0].id)},[q,j]),(0,m.useEffect)(()=>{if(!E)return;let e=(K||[]).filter(e=>!e.is_private);if(e.length===0){N(null);return}M!=null&&e.some(e=>e.id===M)||N(e[0].id)},[E,K,M]),(0,m.useEffect)(()=>{if(!E||!q||q.length===0)return;let e=new Set((J?.members||[]).map(e=>e.user_id)),t=q.find(t=>!e.has(t.id));Pe(t?t.id:null)},[E,q,J]),(0,m.useEffect)(()=>{if(!z)return;let e=K||[];if(e.length===0){qe(null);return}V!=null&&e.some(e=>e.id===V)||qe(e[0].id)},[z,V,K]),(0,m.useEffect)(()=>{if(!z||V==null)return;let e=(K||[]).find(e=>e.id===V);if(e){if(Ye(e.name),e.budget_mode===`total`){H(`total`),U(e.total_budget==null?``:String(e.total_budget));return}H(`monthly`),U(e.monthly_budget==null?``:String(e.monthly_budget))}},[z,V,K]);let Nt=c({mutationFn:()=>i.createCostCenter({name:be.trim(),total_budget:A===`total`?he(Ce):null,monthly_budget:A===`monthly`?he(Ce):null,is_active:!0}),onSuccess:()=>{g.invalidateQueries({queryKey:[`finance`]}),xe(``),we(``),p(e(`finance.createdCostCenter`,`Cost center created`))},onError:t=>{p(t.message||e(`finance.createCostCenterFailed`,`Failed to create cost center`),`error`)}}),Pt=c({mutationFn:({costCenterId:e,value:t,mode:n})=>i.updateCostCenterBudgets(e,{total_budget:n===`total`?he(t):null,monthly_budget:n===`monthly`?he(t):null})}),Ft=c({mutationFn:({costCenterId:e,name:t})=>i.updateCostCenter(e,{name:t})}),It=c({mutationFn:e=>i.deleteCostCenter(e)}),Lt=c({mutationFn:e=>i.deleteTransaction(e),onSuccess:()=>{g.invalidateQueries({queryKey:[`finance`]}),p(e(`finance.transactionDeleted`,`Transaction deleted`))},onError:t=>{p(t.message||e(`finance.deleteTransactionFailed`,`Failed to delete transaction`),`error`)}}),Rt=c({mutationFn:e=>i.editTransaction(e.transactionId,e.data),onSuccess:()=>{g.invalidateQueries({queryKey:[`finance`]}),p(e(`finance.transactionEdited`,`Transaction updated and ledger recalculated`)),W(!1)},onError:t=>{p(t.message||e(`finance.editTransactionFailed`,`Failed to edit transaction`),`error`)}}),zt=c({mutationFn:e=>i.createManualPrint(e),onSuccess:()=>{g.invalidateQueries({queryKey:[`finance`]}),p(e(`finance.manualPrintCreated`,`Manual print charge added and ledger recalculated`)),ut(!1),ft(null),mt(null),gt(``),vt(``),bt(ge(new Date))},onError:t=>{p(t.message||e(`finance.manualPrintFailed`,`Failed to create manual print`),`error`)}}),Bt=c({mutationFn:e=>i.depositUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),Vt=c({mutationFn:e=>i.withdrawUserBalance(e.userId,{amount:e.amount,description:e.description,cost_center_id:e.costCenterId??null})}),Ht=c({mutationFn:e=>i.upsertCostCenterMember(e.costCenterId,{user_id:e.userId,can_print:e.canPrint}),onSuccess:()=>{g.invalidateQueries({queryKey:[`finance`]}),p(e(`finance.memberSaved`,`Member saved`))},onError:t=>{p(t.message||e(`finance.memberSaveFailed`,`Failed to save member`),`error`)}}),Ut=c({mutationFn:e=>i.removeCostCenterMember(e.costCenterId,e.userId),onSuccess:()=>{g.invalidateQueries({queryKey:[`finance`]}),p(e(`finance.memberRemoved`,`Member removed`))},onError:t=>{p(t.message||e(`finance.memberRemoveFailed`,`Failed to remove member`),`error`)}}),Wt=Bt.isPending||Vt.isPending,Gt=()=>{if(!be.trim()){p(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}Nt.mutate()},Kt=async()=>{if(V==null){p(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}let t=Je.trim();if(!t){p(e(`finance.costCenterNameRequired`,`Cost center name is required`),`error`);return}try{w&&await Ft.mutateAsync({costCenterId:V,name:t}),T&&await Pt.mutateAsync({costCenterId:V,mode:Xe,value:Ze}),g.invalidateQueries({queryKey:[`finance`]}),p(e(`finance.costCenterUpdated`,`Cost center updated`)),Ge(!1)}catch(t){p(t.message||e(`finance.costCenterUpdateFailed`,`Failed to update cost center`),`error`)}},qt=e=>{let t=(K||[]).find(t=>t.id===e);t&&(qe(t.id),Ye(t.name),t.budget_mode===`total`?(H(`total`),U(t.total_budget==null?``:String(t.total_budget))):(H(`monthly`),U(t.monthly_budget==null?``:String(t.monthly_budget))),Ge(!0))},Jt=async()=>{if(G)try{await It.mutateAsync(G.id),g.invalidateQueries({queryKey:[`finance`]}),M===G.id&&N(null),p(e(`finance.costCenterDeleted`,`Cost center deleted`))}catch(t){p(t.message||e(`finance.costCenterDeleteFailed`,`Failed to delete cost center`),`error`)}finally{xt(null)}},Yt=()=>{St!=null&&Lt.mutate(St,{onSettled:()=>Ct(null)})},Xt=e=>{et(e.id),nt(e.user_id),it(e.cost_center_id),ot(String(e.amount)),ct(e.description||``),W(!0)},Zt=async()=>{if($e==null)return;let t=at?Number.parseFloat(at):null;if(t!==null&&!Number.isFinite(t)){p(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}Rt.mutate({transactionId:$e,data:{user_id:tt||void 0,cost_center_id:rt||null,amount:t??void 0,description:st||void 0}})},Qt=async()=>{if(dt==null){p(e(`finance.userRequired`,`Please select a user`),`error`);return}if(pt==null){p(e(`finance.costCenterRequired`,`Please select a cost center`),`error`);return}let t=ht?Number.parseFloat(ht):null;if(t===null||!Number.isFinite(t)){p(e(`finance.amountInvalid`,`Amount must be a valid number`),`error`);return}t=Math.abs(t),zt.mutate({user_id:dt,cost_center_id:pt,amount:t,description:_t||void 0,created_at:yt?new Date(yt).toISOString():void 0})},$t=async()=>{if(j==null){p(e(`finance.userRequired`,`Please select a user`),`error`);return}let t=Number.parseFloat(Oe);if(!Number.isFinite(t)||t<=0){p(e(`finance.amountMustBePositive`,`Amount must be greater than zero`),`error`);return}let n={userId:j,amount:t,description:Ae.trim()||void 0,costCenterId:Me};try{Ee===`deposit`?await Bt.mutateAsync(n):await Vt.mutateAsync(n),g.invalidateQueries({queryKey:[`finance`]}),ke(``),je(``),p(Ee===`deposit`?e(`finance.depositSuccess`,`Deposit successful`):e(`finance.withdrawSuccess`,`Withdrawal successful`))}catch(t){p(t.message||e(`finance.adjustmentFailed`,`Wallet adjustment failed`),`error`)}},en=()=>{if(M==null){p(e(`finance.selectCostCenter`,`Please select a cost center`),`error`);return}if(P==null){p(e(`finance.noEligibleUsers`,`No eligible users available`),`error`);return}Ht.mutate({costCenterId:M,userId:P,canPrint:Fe})},tn=e=>{M!=null&&Ut.mutate({costCenterId:M,userId:e})},Y=ce(Dt?.currency||`USD`),X=(0,m.useMemo)(()=>[...q||[]].sort((e,t)=>e.username.localeCompare(t.username)),[q]),nn=(0,m.useMemo)(()=>{let e=new Map;for(let t of X)e.set(t.id,t.username);return e},[X]),rn=(0,m.useMemo)(()=>{let e=new Set((J?.members||[]).map(e=>e.user_id));return X.filter(t=>!e.has(t.id))},[X,J]),an=B===`admin`&&C?At:Ot,Z=B===`admin`&&C?jt:kt,Q=(0,m.useMemo)(()=>an?.items??[],[an?.items]),on=an?.total??0,sn=Math.max(1,Math.ceil(on/50)),cn=(0,m.useMemo)(()=>Q.filter(e=>!(L!==`all`&&e.transaction_type!==L||R!==`all`&&e.cost_center_id!==R)),[Q,L,R]),ln=Math.floor(F/50)+1,$=B===`admin`,un=t=>t===`deposit`?e(`finance.deposit`):t===`withdraw`?e(`finance.withdraw`):t===`print_charge`?e(`finance.printCharge`):t,dn=t=>t==null?e(`finance.deletedUser`,`Deleted user`):nn.get(t)||(a?.id===t&&a.username?a.username:e(`finance.userWithId`,`User #{{id}}`,{id:t})),fn=t=>t.budget_limit==null||t.budget_available==null?e(`finance.unlimited`,`Unlimited`):`${Y}${t.budget_available.toFixed(2)}/${Y}${t.budget_limit.toFixed(2)}`;return ye?(0,h.jsxs)(`div`,{className:`p-4 md:p-8 space-y-8`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(fe,{className:`h-6 w-6 text-bambu-green`}),(0,h.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,h.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)}),(0,h.jsx)(`p`,{className:`text-xs text-bambu-gray mt-1 max-w-2xl`,children:e(`finance.budgetPolicyHint`,`Account balances track costs. Printing is limited only by the selected cost center budget; without a budget, printing is unlimited.`)})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-2 lg:items-end`,children:[wt&&(0,h.jsxs)(`div`,{className:`inline-flex overflow-hidden rounded border border-bambu-dark-tertiary`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>Ke(`personal`),className:`px-3 py-1.5 text-sm ${B===`personal`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.personalView`,`Personal view`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>Ke(`admin`),className:`px-3 py-1.5 text-sm ${B===`admin`?`bg-bambu-green text-black font-medium`:`bg-bambu-dark text-bambu-gray`}`,children:e(`finance.adminView`,`Admin view`)})]}),B===`admin`&&wt&&(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-2 lg:justify-end`,children:[_e&&(0,h.jsx)(f,{size:`sm`,variant:`secondary`,onClick:()=>Be(!0),children:e(`finance.createCostCenter`,`Create cost center`)}),D&&O&&(0,h.jsx)(f,{size:`sm`,variant:`secondary`,onClick:()=>He(!0),children:e(`finance.adjustWallet`,`Adjust wallet`)}),D&&O&&(0,h.jsx)(f,{size:`sm`,variant:`secondary`,onClick:()=>ut(!0),children:e(`finance.addManualPrint`,`Add manual print`)}),E&&O&&(0,h.jsx)(f,{size:`sm`,variant:`secondary`,onClick:()=>We(!0),children:e(`finance.manageMembers`,`Manage cost center members`)})]})]})]}),(0,h.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2 xl:grid-cols-3`,children:[(0,h.jsxs)(d,{children:[(0,h.jsxs)(l,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,h.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.currentBalance`,`Personal account balance`)}),(0,h.jsx)(fe,{className:`w-4 h-4 text-bambu-green/90`})]}),(0,h.jsx)(u,{className:`pt-1`,children:(0,h.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Et?e(`common.loading`,`Loading...`):`${Y}${(Tt?.balance??0).toFixed(2)}`})})]}),(0,h.jsxs)(d,{children:[(0,h.jsxs)(l,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,h.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:B===`admin`?e(`finance.transactions`,`Transactions`):e(`finance.personalTransactions`,`Personal transactions`)}),(0,h.jsx)(de,{className:`w-4 h-4 text-blue-400`})]}),(0,h.jsx)(u,{className:`pt-1`,children:(0,h.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Z?`-`:on})})]}),(0,h.jsxs)(d,{children:[(0,h.jsxs)(l,{className:`flex flex-row items-center justify-between pb-2`,children:[(0,h.jsx)(`span`,{className:`text-sm text-bambu-gray`,children:e(`finance.costCenters`,`Cost centers`)}),(0,h.jsx)(ue,{className:`w-4 h-4 text-orange-400`})]}),(0,h.jsx)(u,{className:`pt-1`,children:(0,h.jsx)(`p`,{className:`text-3xl font-semibold text-white leading-tight`,children:Mt?`-`:K?.length??0})})]})]}),ze&&_e&&(0,h.jsx)(x,{title:e(`finance.createCostCenter`,`Create cost center`),size:`md`,onClose:()=>Be(!1),children:(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenterName`,`Name`)}),(0,h.jsx)(`input`,{type:`text`,value:be,onChange:e=>xe(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:_})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.budgetType`,`Budget type`)}),(0,h.jsxs)(`select`,{value:A,onChange:e=>Se(e.target.value),className:_,children:[(0,h.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,h.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:A===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,h.jsx)(`input`,{type:`number`,step:`0.01`,value:Ce,onChange:e=>we(e.target.value),placeholder:`0.00`,className:_})]})]}),(0,h.jsx)(f,{className:`min-w-[180px]`,onClick:Gt,disabled:Nt.isPending,children:Nt.isPending?e(`common.saving`,`Saving...`):e(`finance.create`,`Create`)})]})}),Ve&&D&&O&&(0,h.jsx)(x,{title:e(`finance.adjustWallet`,`Adjust wallet`),size:`md`,onClose:()=>He(!1),children:(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.selectUser`,`Select user`)}),(0,h.jsx)(`select`,{value:j??``,onChange:e=>Te(e.target.value?Number(e.target.value):null),className:_,children:(X||[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.username},e.id))})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.transactionType`,`Type`)}),(0,h.jsxs)(`select`,{value:Ee,onChange:e=>De(e.target.value),className:_,children:[(0,h.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`,`Deposit`)}),(0,h.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`,`Withdraw`)})]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.amount`,`Amount`)}),(0,h.jsx)(`input`,{type:`number`,step:`0.01`,min:`0`,value:Oe,onChange:e=>ke(e.target.value),placeholder:`0.00`,className:_})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenters`,`Cost centers`)}),(0,h.jsxs)(`select`,{value:Me??``,onChange:e=>Ne(e.target.value?Number(e.target.value):null),className:_,children:[(0,h.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`No cost center`)}),(K||[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`common.description`,`Description`)}),(0,h.jsx)(`input`,{type:`text`,value:Ae,onChange:e=>je(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:_})]}),(0,h.jsx)(f,{className:`min-w-[180px]`,onClick:$t,disabled:Wt,children:Wt?e(`common.saving`,`Saving...`):e(`finance.applyAdjustment`,`Apply adjustment`)})]})}),Ue&&E&&O&&(0,h.jsx)(x,{title:e(`finance.manageMembers`,`Manage cost center members`),size:`lg`,onClose:()=>We(!1),children:(0,h.jsxs)(`div`,{className:`space-y-5`,children:[(0,h.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenters`,`Cost centers`)}),(0,h.jsx)(`select`,{value:M??``,onChange:e=>N(e.target.value?Number(e.target.value):null),className:_,children:(K||[]).filter(e=>!e.is_private).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.selectUser`,`Select user`)}),(0,h.jsxs)(`select`,{value:P??``,onChange:e=>Pe(e.target.value?Number(e.target.value):null),className:_,children:[(0,h.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user`)}),rn.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-bambu-dark-tertiary bg-bambu-dark-secondary px-3 py-2`,children:[(0,h.jsx)(`input`,{id:`memberCanPrint`,type:`checkbox`,checked:Fe,onChange:e=>Ie(e.target.checked),className:`rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green`}),(0,h.jsx)(`label`,{htmlFor:`memberCanPrint`,className:`text-sm text-bambu-gray`,children:e(`finance.memberCanPrint`,`Member can print`)})]}),(0,h.jsx)(`div`,{className:`flex items-end`,children:(0,h.jsx)(f,{className:`min-w-[180px]`,onClick:en,disabled:Ht.isPending||P==null,children:Ht.isPending?e(`common.saving`,`Saving...`):e(`finance.addMember`,`Add member`)})})]}),(0,h.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,h.jsx)(`th`,{className:y,children:e(`common.name`,`Name`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.canPrint`,`Can print`)}),(0,h.jsx)(`th`,{className:y,children:e(`common.actions`,`Actions`)})]})}),(0,h.jsxs)(`tbody`,{children:[(J?.members||[]).map(t=>(0,h.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,h.jsx)(`td`,{className:b,children:X.find(e=>e.id===t.user_id)?.username||`User ${t.user_id}`}),(0,h.jsx)(`td`,{className:b,children:t.can_print?e(`common.yes`,`Yes`):e(`common.no`,`No`)}),(0,h.jsx)(`td`,{className:b,children:(0,h.jsx)(f,{size:`sm`,variant:`danger`,onClick:()=>tn(t.user_id),disabled:Ut.isPending,children:e(`common.remove`,`Remove`)})})]},t.id)),(J?.members||[]).length===0&&(0,h.jsx)(`tr`,{children:(0,h.jsx)(`td`,{colSpan:3,className:`py-3 text-bambu-gray`,children:e(`finance.noMembers`,`No members assigned.`)})})]})]})})]})}),z&&(w||T)&&(0,h.jsx)(x,{title:e(`finance.editCostCenter`,`Edit cost center`),size:`md`,onClose:()=>Ge(!1),children:(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenterName`,`Name`)}),(0,h.jsx)(`input`,{type:`text`,value:Je,onChange:e=>Ye(e.target.value),placeholder:e(`finance.costCenterName`,`Name`),className:_,disabled:!w})]}),(0,h.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.budgetType`,`Budget type`)}),(0,h.jsxs)(`select`,{value:Xe,onChange:e=>H(e.target.value),className:_,disabled:!T,children:[(0,h.jsx)(`option`,{value:`monthly`,children:e(`finance.monthlyBudget`,`Monthly budget`)}),(0,h.jsx)(`option`,{value:`total`,children:e(`finance.totalBudget`,`Total budget`)})]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:Xe===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):e(`finance.totalBudget`,`Total budget`)}),(0,h.jsx)(`input`,{type:`number`,step:`0.01`,value:Ze,onChange:e=>U(e.target.value),placeholder:`0.00`,className:_,disabled:!T})]})]}),(0,h.jsx)(f,{className:`min-w-[180px]`,onClick:Kt,disabled:Ft.isPending||Pt.isPending||V==null,children:Ft.isPending||Pt.isPending?e(`common.saving`,`Saving...`):e(`common.save`,`Save`)})]})}),(0,h.jsxs)(`div`,{className:`grid gap-6 ${k&&S?`xl:grid-cols-2`:``}`,children:[k&&(0,h.jsxs)(d,{children:[(0,h.jsxs)(l,{children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.myCostCenters`,`My cost centers`)}),(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.costCentersHint`,`Review budget limits and keep costs under control`)})]}),(0,h.jsxs)(u,{className:`space-y-3`,children:[Mt&&(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!Mt&&(!K||K.length===0)&&(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noCostCenters`,`No cost centers found.`)}),!Mt&&K&&K.length>0&&(0,h.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,h.jsx)(`th`,{className:y,children:e(`common.name`,`Name`)}),$&&(0,h.jsx)(`th`,{className:y,children:e(`finance.owner`,`Owner`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.balance`,`Account balance`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.budget`,`Budget`)}),$&&(0,h.jsx)(`th`,{className:y,children:e(`common.actions`,`Actions`)})]})}),(0,h.jsx)(`tbody`,{children:K.map(t=>{let n=w||T,r=!t.is_private&&w;return(0,h.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,h.jsx)(`td`,{className:b,children:t.name}),$&&(0,h.jsx)(`td`,{className:b,children:t.is_private?dn(t.owner_user_id):e(`finance.shared`,`Shared`)}),(0,h.jsxs)(`td`,{className:b,children:[Y,t.total_balance.toFixed(2)]}),(0,h.jsx)(`td`,{className:b,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,h.jsx)(`span`,{children:fn(t)}),(0,h.jsx)(`span`,{className:`text-xs text-bambu-gray`,children:t.budget_mode===`monthly`?e(`finance.monthlyBudget`,`Monthly budget`):t.budget_mode===`total`?e(`finance.totalBudget`,`Total budget`):e(`finance.noBudget`,`No budget`)})]})}),$&&(0,h.jsx)(`td`,{className:b,children:(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(f,{size:`sm`,variant:`ghost`,onClick:()=>qt(t.id),disabled:!n,title:n?e(`common.edit`,`Edit`):e(`finance.cannotEditPrivateCostCenter`,`Private cost centers cannot be edited here`),className:`p-1.5 sm:p-2`,children:(0,h.jsx)(se,{className:`w-4 h-4`})}),r&&(0,h.jsx)(f,{size:`sm`,variant:`ghost`,onClick:()=>xt({id:t.id,name:t.name}),disabled:It.isPending,title:e(`common.delete`,`Delete`),className:`text-red-400 hover:text-red-300 hover:bg-red-500/10 p-1.5 sm:p-2`,children:(0,h.jsx)(le,{className:`w-4 h-4`})})]})})]},t.id)})})]})})]})]}),S&&(0,h.jsxs)(d,{children:[(0,h.jsxs)(l,{children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:e(`finance.recentTransactions`,`Recent transactions`)}),(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray mt-1`,children:e(`finance.transactionsHint`,`Filter by type and cost center, then navigate pages`)})]}),(0,h.jsxs)(u,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] items-end`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.transactionType`,`Type`)}),(0,h.jsxs)(`select`,{value:L,onChange:e=>Le(e.target.value),className:_,children:[(0,h.jsx)(`option`,{value:`all`,children:e(`finance.allTypes`)}),(0,h.jsx)(`option`,{value:`deposit`,children:e(`finance.deposit`)}),(0,h.jsx)(`option`,{value:`withdraw`,children:e(`finance.withdraw`)}),(0,h.jsx)(`option`,{value:`print_charge`,children:e(`finance.printCharge`)})]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenters`,`Cost centers`)}),(0,h.jsxs)(`select`,{value:R,onChange:e=>Re(e.target.value===`all`?`all`:Number(e.target.value)),className:_,children:[(0,h.jsx)(`option`,{value:`all`,children:e(`finance.allCostCenters`)}),(K||[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),Z&&(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`common.loading`,`Loading...`)}),!Z&&(!Q||Q.length===0)&&(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactions`,`No transactions available.`)}),!Z&&Q.length>0&&cn.length===0&&(0,h.jsx)(`p`,{className:`text-sm text-bambu-gray`,children:e(`finance.noTransactionsForFilter`,`No transactions match the selected filters.`)}),!Z&&cn.length>0&&(0,h.jsx)(`div`,{className:`overflow-auto rounded-lg border border-bambu-dark-tertiary`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray`,children:[(0,h.jsx)(`th`,{className:y,children:e(`common.date`,`Date`)}),$&&(0,h.jsx)(`th`,{className:y,children:e(`common.user`,`User`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.costCenter`,`Cost center`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.transactionType`,`Type`)}),(0,h.jsx)(`th`,{className:y,children:e(`common.description`,`Description`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.amount`,`Amount`)}),(0,h.jsx)(`th`,{className:y,children:e(`finance.balanceAfter`,`Balance after`)}),$&&(0,h.jsx)(`th`,{className:y,children:e(`common.actions`,`Actions`)})]})}),(0,h.jsx)(`tbody`,{children:cn.map(n=>{let r=n.amount>=0,i=n.cost_center_id==null?null:(K||[]).find(e=>e.id===n.cost_center_id),a=n.user_id==null?e(`finance.noUser`,`No user`):nn.get(n.user_id)||e(`finance.userWithId`,`User #{{id}}`,{id:n.user_id}),o=n.transaction_type===`print_charge`?pe(n.description??null):null,s=o?.isPartial??!1;return(0,h.jsxs)(`tr`,{className:`border-b border-bambu-dark-tertiary/60 text-white`,children:[(0,h.jsx)(`td`,{className:b,children:me(n.created_at,t.language)}),$&&(0,h.jsx)(`td`,{className:b,children:a}),(0,h.jsx)(`td`,{className:b,children:i?.name||`-`}),(0,h.jsx)(`td`,{className:b,children:(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,h.jsx)(`span`,{children:un(n.transaction_type)}),s&&(0,h.jsx)(`span`,{className:`rounded border border-yellow-500/40 bg-yellow-500/10 px-2 py-0.5 text-[11px] text-yellow-300`,children:o&&o.partialType?e(`finance.partialStatus.${o.partialType}`,o.partialType):e(`finance.partial`,`Partial`)})]})}),(0,h.jsx)(`td`,{className:b,children:(o?.cleanedDescription??n.description)||`-`}),(0,h.jsxs)(`td`,{className:`${b} ${r?`text-green-400`:`text-red-400`}`,children:[r?`+`:`-`,Y,Math.abs(n.amount).toFixed(2)]}),(0,h.jsx)(`td`,{className:b,children:n.balance_after==null?`-`:`${n.balance_after<0?`-`:``}${Y}${Math.abs(n.balance_after).toFixed(2)}`}),$&&(0,h.jsx)(`td`,{className:b,children:(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(f,{size:`sm`,variant:`secondary`,onClick:()=>Xt(n),disabled:Rt.isPending,children:(0,h.jsx)(se,{className:`w-4 h-4`})}),(0,h.jsx)(f,{size:`sm`,variant:`danger`,onClick:()=>Ct(n.id),disabled:Lt.isPending,children:(0,h.jsx)(le,{className:`w-4 h-4`})})]})})]},n.id)})})]})}),!Z&&cn.length>0&&(0,h.jsx)(`div`,{className:`flex justify-end pt-2 lg:pt-0`,children:(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>I(0),disabled:F===0||Z,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.first`,`First`),children:(0,h.jsx)(ee,{className:`w-4 h-4`})}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>I(e=>Math.max(0,e-50)),disabled:F===0||Z,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.prev`,`Previous`),children:(0,h.jsx)(ie,{className:`w-4 h-4`})}),(0,h.jsx)(`span`,{className:`text-bambu-gray px-1 whitespace-nowrap`,children:e(`finance.pageNumberOf`,`Page {{page}} of {{total}}`,{page:ln,total:sn})}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>I(e=>e+50),disabled:Z||ln>=sn,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.next`,`Next`),children:(0,h.jsx)(oe,{className:`w-4 h-4`})}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>I(Math.max(0,(sn-1)*50)),disabled:Z||ln>=sn,className:`p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,"aria-label":e(`finance.last`,`Last`),children:(0,h.jsx)(te,{className:`w-4 h-4`})})]})})]})]}),Qe&&$e!==null&&(0,h.jsx)(x,{title:e(`finance.editTransaction`,`Edit Transaction`),onClose:()=>W(!1),size:`md`,children:(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`common.user`,`User`)}),(0,h.jsxs)(`select`,{className:_,value:tt||``,onChange:e=>nt(e.target.value?Number(e.target.value):null),children:[(0,h.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),X.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenter`,`Cost center (optional)`)}),(0,h.jsxs)(`select`,{className:_,value:rt||``,onChange:e=>it(e.target.value?Number(e.target.value):null),children:[(0,h.jsx)(`option`,{value:``,children:e(`finance.noCostCenter`,`Personal (no cost center)`)}),(K||[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.amount`,`Amount`)}),(0,h.jsx)(`input`,{type:`number`,step:`0.01`,className:_,value:at,onChange:e=>ot(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 10.50`)})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`common.description`,`Description`)}),(0,h.jsx)(`textarea`,{className:`${_} resize-none`,rows:3,value:st,onChange:e=>ct(e.target.value),placeholder:e(`finance.manualAdjustmentExample`,`e.g., Manual adjustment`)})]}),(0,h.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,h.jsx)(f,{variant:`secondary`,onClick:()=>W(!1),children:e(`common.cancel`,`Cancel`)}),(0,h.jsx)(f,{onClick:Zt,disabled:Rt.isPending,children:e(`common.save`,`Save`)})]})]})}),lt&&(0,h.jsx)(x,{title:e(`finance.addManualPrint`,`Add manual print`),onClose:()=>ut(!1),size:`md`,children:(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`common.user`,`User`)}),(0,h.jsxs)(`select`,{className:_,value:dt||``,onChange:e=>ft(e.target.value?Number(e.target.value):null),children:[(0,h.jsx)(`option`,{value:``,children:e(`finance.selectUser`,`Select user...`)}),X.map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.username},e.id))]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.costCenter`,`Cost center`)}),(0,h.jsxs)(`select`,{className:_,value:pt||``,onChange:e=>mt(e.target.value?Number(e.target.value):null),children:[(0,h.jsx)(`option`,{value:``,children:e(`finance.selectCostCenter`,`Select cost center...`)}),(K||[]).map(e=>(0,h.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`finance.amount`,`Amount`)}),(0,h.jsx)(`input`,{type:`number`,step:`0.01`,className:_,value:ht,onChange:e=>gt(e.target.value),placeholder:e(`finance.amountExample`,`e.g., 4.00`)})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`common.description`,`Description`)}),(0,h.jsx)(`input`,{type:`text`,value:_t,onChange:e=>vt(e.target.value),placeholder:e(`finance.descriptionOptional`,`Description (optional)`),className:_})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`label`,{className:v,children:e(`common.date`,`Date`)}),(0,h.jsx)(`input`,{type:`datetime-local`,value:yt,onChange:e=>bt(e.target.value),className:_})]}),(0,h.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4`,children:[(0,h.jsx)(f,{variant:`secondary`,onClick:()=>ut(!1),children:e(`common.cancel`,`Cancel`)}),(0,h.jsx)(f,{onClick:Qt,disabled:zt.isPending,children:zt.isPending?e(`common.saving`,`Saving...`):e(`finance.addManualPrint`,`Add manual print`)})]})]})}),G&&(0,h.jsx)(ae,{title:e(`common.delete`,`Delete`),message:e(`finance.confirmDeleteCostCenter`,`Delete cost center "{{name}}"?`,{name:G.name}),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:It.isPending,onConfirm:Jt,onCancel:()=>xt(null)}),St!=null&&(0,h.jsx)(ae,{title:e(`finance.deleteTransaction`,`Delete transaction`),message:e(`finance.deleteTransactionConfirm`,`Delete this transaction? Balances will be recalculated automatically.`),confirmText:e(`common.delete`,`Delete`),variant:`danger`,isLoading:Lt.isPending,onConfirm:Yt,onCancel:()=>Ct(null)})]})]}):(0,h.jsxs)(`div`,{className:`p-4 md:p-8 space-y-6`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(fe,{className:`h-6 w-6 text-bambu-green`}),(0,h.jsx)(`h1`,{className:`text-2xl font-bold text-white`,children:e(`finance.title`,`Finance`)})]}),(0,h.jsx)(`div`,{children:(0,h.jsx)(`p`,{className:`text-bambu-gray mt-2 max-w-2xl`,children:e(`finance.subtitle`,`Wallet, personal transactions, and cost centers`)})}),(0,h.jsx)(d,{children:(0,h.jsx)(u,{className:`py-8 text-center text-bambu-gray`,children:e(`finance.noAccess`,`You do not have permission to view finance data.`)})})]})}export{S as FinancePage};