@atyaio/ledgr-web 0.1.1 → 0.1.2
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/dist/assets/badge-DCLlsDNI.js +55 -0
- package/dist/assets/{breakdown-D9nBrbad.js → breakdown-B7xclB2-.js} +1 -1
- package/dist/assets/{categories-B7jajln6.js → categories-C9LvkWNc.js} +1 -1
- package/dist/assets/{color-picker-DLlr-Cq6.js → color-picker-DUPZPbk3.js} +1 -1
- package/dist/assets/{custom-cell-Wgh3D7lb.js → custom-cell-DOJAsRPW.js} +1 -1
- package/dist/assets/data-BX7xFZfR.js +1 -0
- package/dist/assets/{download-CIyMPSgr.js → download-gNHw92Vi.js} +1 -1
- package/dist/assets/expenses-Ct1Tk3pC.js +1 -0
- package/dist/assets/index-B9WjaP25.js +31 -0
- package/dist/assets/index-YWd9JGBA.css +2 -0
- package/dist/assets/insights-C0cl4vss.js +1 -0
- package/dist/assets/integrations-CueFg-5F.js +1 -0
- package/dist/assets/{ledger-toolbar-yj0u4-Rm.js → ledger-toolbar-B_Gbv5Ws.js} +1 -1
- package/dist/assets/{media-Cr7juL5w.js → media-D6XgVZ7M.js} +1 -1
- package/dist/assets/{menu-BDGd2JUq.js → menu-C-8r2BNA.js} +1 -1
- package/dist/assets/{money-Ch2MLu6J.js → money-OFUBQ3gl.js} +1 -1
- package/dist/assets/{money-input-C8ZuBxvX.js → money-input-DQaEauAw.js} +1 -1
- package/dist/assets/{overview-Ddn6RbvU.js → overview-CZMXeLeG.js} +1 -1
- package/dist/assets/payments-D9NCfpzJ.js +1 -0
- package/dist/assets/project-CYHaWZqH.js +1 -0
- package/dist/assets/{pull-shift-sheet-DTwTC0rg.js → pull-shift-sheet-BaOiY46Z.js} +1 -1
- package/dist/assets/queries-CxLQqNqz.js +1 -0
- package/dist/assets/recurring-e7X3okBc.js +1 -0
- package/dist/assets/revenue-TPYHnUaW.js +1 -0
- package/dist/assets/{search-jkqZqVJy.js → search-CnrmI1BH.js} +1 -1
- package/dist/assets/settings-mDly_aVZ.js +4 -0
- package/dist/assets/{shift-sales-B0yokKuf.js → shift-sales-BpOCNuGY.js} +1 -1
- package/dist/assets/stakeholders-DzTfUHX0.js +1 -0
- package/dist/assets/{star-cwF2fEe6.js → star-DZj1Tpai.js} +1 -1
- package/dist/assets/{table-DQsx5_iN.js → table-QAdUTXQz.js} +1 -1
- package/dist/assets/{tooltip-CKyX36D7.js → tooltip-CYNpGhCZ.js} +7 -7
- package/dist/index.html +8 -8
- package/package.json +2 -2
- package/dist/assets/badge-BTiDEJlh.js +0 -55
- package/dist/assets/data-DLjPdfYn.js +0 -1
- package/dist/assets/expenses-DglPf9Hj.js +0 -1
- package/dist/assets/index-B3RS60Xw.css +0 -2
- package/dist/assets/index-DOwVPfdT.js +0 -31
- package/dist/assets/insights-C_lA_1Ig.js +0 -1
- package/dist/assets/integrations-C4NPnoJ4.js +0 -1
- package/dist/assets/payments-q8beCPp-.js +0 -1
- package/dist/assets/project-Bgpq3nFR.js +0 -1
- package/dist/assets/queries-IGiwF8nF.js +0 -1
- package/dist/assets/recurring-xqowgQWt.js +0 -1
- package/dist/assets/revenue-CB8ggUDa.js +0 -1
- package/dist/assets/settings-DJ670Ax6.js +0 -4
- package/dist/assets/stakeholders-wioC2mrf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ft as e,h as t,m as n,n as r,v as i,y as a}from"./badge-DCLlsDNI.js";import{E as o}from"./queries-CxLQqNqz.js";import{n as s}from"./project-CYHaWZqH.js";import{t as c}from"./breakdown-B7xclB2-.js";var l=e();function u(e,t){return new Intl.NumberFormat(t,{maximumFractionDigits:Number.isInteger(e)?0:2}).format(e)}function d({sales:e,compact:n}){let{t:o}=i(),{money:d,locale:p}=s(),m=e.totals.netMinor,h=e.payments.filter(e=>e.pulled),g=e.payments.filter(e=>!e.pulled&&e.amountMinor!==0);return(0,l.jsxs)(`div`,{className:`space-y-4`,children:[(0,l.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,l.jsx)(f,{label:o(`Receipts`),value:`${e.totals.receipts}${e.totals.refunds?` · ${o(`{n} refunds`,{n:e.totals.refunds})}`:``}`}),(0,l.jsx)(f,{label:o(`Items sold`),value:u(e.totals.quantity,p)}),(0,l.jsx)(f,{label:o(`Net sales`),value:d(m,{compact:!0}),hint:e.totals.costMinor?o(`cost {amount}`,{amount:d(e.totals.costMinor,{compact:!0})}):void 0})]}),(h.length>0||g.length>0)&&(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[h.map(e=>(0,l.jsxs)(r,{tone:`revenue`,children:[e.name,` · `,d(e.amountMinor,{compact:!0})]},e.paymentTypeId)),g.map(e=>(0,l.jsx)(`span`,{title:o(`Not pulled into the ledger`),children:(0,l.jsxs)(r,{className:`opacity-80`,children:[e.name,` · `,d(e.amountMinor,{compact:!0})]})},e.paymentTypeId))]}),e.payouts.length>0&&(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`label mb-1.5`,children:[o(`Cash pay-outs`),` `,(0,l.jsxs)(`span`,{className:`num text-ink-3 font-normal normal-case tracking-normal`,children:[`−`,d(e.totals.paidOutMinor,{compact:!0}),e.totals.payoutsSubtracted?` · ${o(`taken off the cash amount`)}`:` · ${o(`not subtracted`)}`]})]}),(0,l.jsx)(`ul`,{className:`divide-y divide-line rounded-[12px] border border-line overflow-hidden`,children:e.payouts.map((e,t)=>(0,l.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-1.5 text-[13px]`,children:[(0,l.jsx)(`span`,{dir:`auto`,className:`flex-1 min-w-0 truncate`,children:e.comment??o(`Pay-out`)}),(0,l.jsxs)(`span`,{className:`num text-ink-2 shrink-0`,children:[`−`,d(e.amountMinor)]})]},t))})]}),e.byCategory.length>1&&(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`label mb-2`,children:o(`By category`)}),(0,l.jsx)(c,{max:6,items:e.byCategory.map((e,t)=>({id:e.name||null,name:e.name||o(`Uncategorised`),color:a[t%a.length],amountMinor:e.netMinor,pct:e.pct,count:Math.round(e.quantity)})),emptyLabel:o(`No sales`)})]}),(0,l.jsx)(`div`,{className:`label`,children:o(`Items`)}),(0,l.jsxs)(`ul`,{className:t(`divide-y divide-line rounded-[12px] border border-line overflow-hidden`,n&&`max-h-[320px] overflow-y-auto`),children:[e.lines.map((e,t)=>(0,l.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`num w-10 text-end text-[13px] text-ink-3 shrink-0`,children:[u(e.quantity,p),`×`]}),(0,l.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,l.jsxs)(`span`,{dir:`auto`,className:`block text-[13.5px] font-medium truncate`,children:[e.itemName,e.variantName?(0,l.jsxs)(`span`,{className:`text-ink-3 font-normal`,children:[` · `,e.variantName]}):null]}),e.categoryName&&(0,l.jsx)(`span`,{className:`block text-[11.5px] text-ink-3 truncate`,children:e.categoryName})]}),(0,l.jsxs)(`span`,{className:`text-end shrink-0`,children:[(0,l.jsx)(`span`,{className:`num block text-[13.5px] font-medium`,children:d(e.netMinor)}),m>0&&(0,l.jsxs)(`span`,{className:`num block text-[11px] text-ink-3`,children:[Math.round(e.netMinor/m*100),`%`]})]})]},`${e.externalItemId??e.itemName}-${e.variantName??``}-${t}`)),!e.lines.length&&(0,l.jsx)(`li`,{className:`px-3 py-6 text-center text-[13px] text-ink-3`,children:o(`No item lines on these receipts.`)})]})]})}function f({label:e,value:t,hint:n}){return(0,l.jsxs)(`div`,{className:`rounded-[12px] bg-sunken px-3 py-2 min-w-0`,children:[(0,l.jsx)(`div`,{className:`text-[11px] uppercase tracking-wide text-ink-3 truncate`,children:e}),(0,l.jsx)(`div`,{className:`num text-[15px] font-semibold truncate`,children:t}),n&&(0,l.jsx)(`div`,{className:`text-[11px] text-ink-3 truncate`,children:n})]})}function p({shiftId:e}){let{t}=i(),r=o(e);return r.isPending?(0,l.jsx)(`div`,{className:`py-6 flex justify-center`,children:(0,l.jsx)(n,{className:`size-5`})}):r.isError?(0,l.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:t(`Could not load the shift sales.`)}):(0,l.jsx)(d,{sales:r.data,compact:!0})}export{d as n,u as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e,F as t,_t as n,c as r,d as i,ft as a,g as o,h as s,l as c,mt as l,n as u,o as d,p as f,s as p,t as m,v as h,y as g}from"./badge-DCLlsDNI.js";import{D as _,O as v,T as y,c as b,n as x,s as S,w as C}from"./queries-CxLQqNqz.js";import{n as w}from"./project-CYHaWZqH.js";import{n as T}from"./table-QAdUTXQz.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./menu-C-8r2BNA.js";import{i as M,o as N,r as P,s as F}from"./media-D6XgVZ7M.js";import{b as I,c as L,d as R,f as z,h as B,i as V,k as H,l as U,m as W,p as G,u as K}from"./index-B9WjaP25.js";import{t as q}from"./format-GDcQVAp4.js";import{t as J}from"./color-picker-DUPZPbk3.js";import{t as Y}from"./money-OFUBQ3gl.js";import{t as ee}from"./custom-cell-DOJAsRPW.js";var X={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};X.node;var Z=o(X),Q=n(l(),1),$=a();function te({open:t,onClose:n,stakeholder:r,suggestedShare:i}){let{t:a}=h(),o=B(),{create:s,update:c}=_(),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`0`),[b,x]=(0,Q.useState)(!0),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(g[0]),[O,k]=(0,Q.useState)({}),[A,j]=(0,Q.useState)({});(0,Q.useEffect)(()=>{t&&(j({}),u(r?.name??``),f(r?.nameAr??``),m(r?.email??``),y(String(r?.sharePercent??i??0)),x(r?.active??!0),C(r?.joinedAt??``),T(r?.notes??``),D(r?.color??g[0]),k(r?.customFields??{}))},[t,r,i]);let I=Number(v),V=l.trim().length>0&&Number.isFinite(I)&&I>=0&&I<=100,H=s.isPending||c.isPending,U=async()=>{let t={name:l.trim(),nameAr:d.trim()||null,email:p.trim()||null,sharePercent:I,active:b,joinedAt:S||null,notes:w.trim()||null,color:E,customFields:O};try{r?await c.mutateAsync({id:r.id,...t}):await s.mutateAsync(t),o.success(a(r?`Stakeholder updated`:`Stakeholder added`)),n()}catch(t){t instanceof e&&t.code===`CUSTOM_FIELDS`&&Array.isArray(t.details)&&j(Object.fromEntries(t.details.map(e=>[e.key,e.message]))),o.error(a(`Could not save`),W(t))}};return(0,$.jsx)(R,{open:t,onClose:n,title:a(r?`Edit stakeholder`:`New stakeholder`),description:a(`Ownership share drives default expense splits and profit distribution.`),footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(z,{variant:`ghost`,size:`md`,onClick:n,className:`max-md:hidden`,children:a(`Cancel`)}),(0,$.jsx)(z,{variant:`primary`,size:`lg`,onClick:U,loading:H,disabled:!V,className:`w-full md:w-auto`,children:a(r?`Save changes`:`Add stakeholder`)})]}),children:(0,$.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),V&&U()},children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-3 items-end`,children:[(0,$.jsx)(P,{label:a(`Name`),required:!0,children:(0,$.jsx)(M,{value:l,onChange:e=>u(e.target.value),autoFocus:!r})}),(0,$.jsx)(J,{value:E,onChange:D})]}),(0,$.jsx)(P,{label:a(`Arabic name`),hint:a(`optional`),children:(0,$.jsx)(M,{lang:`ar`,dir:`rtl`,value:d,onChange:e=>f(e.target.value)})}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(P,{label:a(`Ownership share`),required:!0,hint:`%`,children:(0,$.jsx)(M,{mono:!0,type:`number`,step:`0.01`,min:0,max:100,value:v,onChange:e=>y(e.target.value)})}),(0,$.jsx)(P,{label:a(`Joined`),children:(0,$.jsx)(M,{mono:!0,type:`date`,value:S,onChange:e=>C(e.target.value)})})]}),(0,$.jsx)(P,{label:a(`Email`),children:(0,$.jsx)(M,{type:`email`,value:p,onChange:e=>m(e.target.value),placeholder:a(`Optional`)})}),(0,$.jsx)(F,{checked:b,onChange:x,label:a(`Active partner`),description:a(b?`Included in ownership splits and distribution`:`Kept for history, excluded from new splits`)}),(0,$.jsx)(P,{label:a(`Notes`),children:(0,$.jsx)(N,{value:w,onChange:e=>T(e.target.value),placeholder:a(`Optional`)})}),(0,$.jsx)(L,{entity:`stakeholder`,values:O,onChange:k,errors:A})]})})}function ne(){let{t:e}=h(),[n,r]=H(),a=n.get(`tab`)||`ownership`,o=e=>r(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n.delete(`page`),n},{replace:!0}),c=v(),[l,u]=(0,Q.useState)(void 0),[d,p]=(0,Q.useState)({open:!1}),m=c.data?.shareTotal??0,g=t(100-m);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(i,{title:e(`Stakeholders`),subtitle:c.data?(0,$.jsxs)($.Fragment,{children:[e(`{n} active partners`,{n:c.data.items.filter(e=>e.active).length}),` · `,e(`ownership`),` `,(0,$.jsx)(`span`,{className:s(`num font-medium`,Math.abs(g)>.01?`text-warning`:`text-ink`),children:q(m,2)})]}):e(`Loading…`),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(z,{variant:`secondary`,size:`sm`,className:`rounded-full`,icon:(0,$.jsx)(Z,{className:`size-4 rtl-flip`}),onClick:()=>p({open:!0}),children:e(`Record settlement`)}),(0,$.jsx)(z,{variant:`primary`,size:`sm`,className:`rounded-full`,icon:(0,$.jsx)(I,{className:`size-4`}),onClick:()=>u(null),children:e(`New stakeholder`)})]})}),c.data&&Math.abs(g)>.01&&c.data.items.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-[14px] bg-warning/10 px-4 py-3 text-[13.5px]`,children:[e(`Ownership adds up to`),` `,(0,$.jsx)(`span`,{className:`num font-medium`,children:q(m,2)}),`. `,e(`Splits use the active total, but you probably want 100%.`),` `,g>0?e(`{pct}% is unassigned.`,{pct:g.toFixed(2)}):e(`It is {pct}% over.`,{pct:Math.abs(g).toFixed(2)})]}),(0,$.jsx)(f,{className:`mb-4`,value:a,onChange:o,items:[{id:`ownership`,label:e(`Ownership`)},{id:`balances`,label:e(`Balances`)},{id:`settlements`,label:e(`Settlements`)},{id:`distribution`,label:e(`Profit`)}]}),a===`ownership`&&(0,$.jsx)(re,{onEdit:e=>u(e)}),a===`balances`&&(0,$.jsx)(ie,{onSettle:e=>p({open:!0,prefill:e})}),a===`settlements`&&(0,$.jsx)(ae,{onEdit:e=>p({open:!0,settlement:e})}),a===`distribution`&&(0,$.jsx)(oe,{}),(0,$.jsx)(te,{open:l!==void 0,onClose:()=>u(void 0),stakeholder:l??null,suggestedShare:l===null?Math.max(0,g):void 0}),(0,$.jsx)(V,{open:d.open,onClose:()=>p({open:!1}),settlement:d.settlement,prefill:d.prefill})]})}function re({onEdit:e}){let{t,name:n,label:i}=h(),a=v(),o=S(`stakeholder`),{remove:s}=_(),l=B(),{date:f}=w(),[g,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[C,T]=(0,Q.useState)(null),M=o.data?.items??[];if(a.isPending)return(0,$.jsx)(c,{});let N=a.data?.items??[],P=Math.max(a.data?.shareTotal??0,100);return(0,$.jsxs)($.Fragment,{children:[N.length>0&&(0,$.jsxs)(`div`,{className:`card p-4 md:p-5 mb-4`,children:[(0,$.jsx)(`div`,{className:`label mb-2`,children:t(`Cap table`)}),(0,$.jsx)(`div`,{className:`flex h-8 rounded-[10px] overflow-hidden bg-sunken gap-[2px]`,children:N.filter(e=>e.active&&e.sharePercent>0).map(e=>(0,$.jsx)(`div`,{className:`h-full flex items-center justify-center text-[12px] font-semibold text-white overflow-hidden`,style:{width:`${e.sharePercent/P*100}%`,background:e.color},title:`${n(e)} ${e.sharePercent}%`,children:(0,$.jsx)(`span`,{className:`truncate px-1.5`,children:e.sharePercent>=12?`${n(e).split(` `)[0]} ${e.sharePercent}%`:e.sharePercent>=6?`${e.sharePercent}%`:``})},e.id))})]}),(0,$.jsxs)(d,{flush:!0,children:[!N.length&&(0,$.jsx)(p,{title:t(`No stakeholders yet`),description:t(`Add the partners and their ownership percentage.`)}),(0,$.jsx)(`ul`,{className:`divide-y divide-line`,children:N.map(i=>(0,$.jsxs)(`li`,{className:`flex items-center`,children:[(0,$.jsx)(r,{className:`flex-1`,leading:(0,$.jsx)(m,{name:n(i),color:i.color,size:40}),title:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[n(i),!i.active&&(0,$.jsx)(u,{children:t(`inactive`)})]}),subtitle:[i.email,i.joinedAt?t(`since {date}`,{date:f(i.joinedAt)}):null].filter(Boolean).join(` · `)||t(`No contact details`),trailing:(0,$.jsxs)(`span`,{className:`num text-[17px] font-semibold`,children:[i.sharePercent.toFixed(i.sharePercent%1?2:0),`%`]}),onClick:()=>T(i)}),(0,$.jsx)(`div`,{className:`pe-3`,children:(0,$.jsx)(j,{trigger:()=>(0,$.jsx)(`button`,{type:`button`,className:`size-9 inline-flex items-center justify-center rounded-full text-ink-3 hover:text-ink hover:bg-card-hover`,"aria-label":t(`Actions`),children:(0,$.jsx)(k,{className:`size-4`})}),children:n=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{icon:(0,$.jsx)(E,{}),onClick:()=>{n(),e(i)},children:t(`Edit`)}),(0,$.jsx)(A,{}),(0,$.jsx)(O,{icon:(0,$.jsx)(D,{}),danger:!0,onClick:()=>{n(),x(!1),y(i)},children:t(`Remove`)})]})})})]},i.id))})]}),(0,$.jsx)(K,{open:!!C,onClose:()=>T(null),title:C?n(C):``,description:C?`${t(`{pct}% ownership`,{pct:C.sharePercent})} · ${C.active?t(`active`):t(`inactive`)}`:``,footer:C&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(z,{variant:`danger`,size:`md`,onClick:()=>{x(!1),y(C)},children:t(`Remove`)}),(0,$.jsx)(z,{variant:`primary`,size:`md`,onClick:()=>{e(C),T(null)},children:t(`Edit`)})]}),children:C&&(0,$.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-[14px]`,children:[(0,$.jsx)(`dt`,{className:`text-ink-3`,children:t(`Email`)}),(0,$.jsx)(`dd`,{children:C.email??`—`}),(0,$.jsx)(`dt`,{className:`text-ink-3`,children:t(`Joined`)}),(0,$.jsx)(`dd`,{children:C.joinedAt?f(C.joinedAt):`—`}),M.map(e=>(0,$.jsxs)(`span`,{className:`contents`,children:[(0,$.jsx)(`dt`,{className:`text-ink-3`,children:i(e)}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(ee,{def:e,value:C.customFields?.[e.key]})})]},e.id)),C.notes&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-ink-3`,children:t(`Notes`)}),(0,$.jsx)(`dd`,{className:`whitespace-pre-wrap`,children:C.notes})]})]})}),(0,$.jsx)(U,{open:!!g,onClose:()=>y(null),onConfirm:async()=>{if(g)try{await s.mutateAsync({id:g.id,force:b}),l.success(t(`Stakeholder removed`)),y(null),x(!1),T(null)}catch(e){e.code===`HAS_RECORDS`&&x(!0),l.error(t(`Could not remove`),W(e))}},loading:s.isPending,confirmLabel:t(b?`Remove anyway`:`Remove`),title:t(`Remove {name}?`,{name:g?n(g):``}),description:t(b?`This stakeholder has expense splits, payments or settlements. Removing them deletes their split rows and un-assigns what they paid. Prefer marking them inactive.`:`If they have history you will be asked to confirm again. Consider marking them inactive instead.`)})]})}function ie({onSettle:e}){let{t,name:n}=h(),{range:r}=G(),{money:i}=w(),a=x(r.from,r.to);if(a.isPending)return(0,$.jsx)(c,{});if(a.isError)return(0,$.jsx)(p,{title:t(`Could not load balances`),description:a.error.message});let o=a.data,l=Math.max(1,...o.balances.map(e=>Math.abs(e.netMinor)));return(0,$.jsxs)(`div`,{className:`grid grid-cols-1 xl:grid-cols-3 gap-4`,children:[(0,$.jsxs)(d,{className:`xl:col-span-2`,title:t(`Who owes whom`),subtitle:t(`Expenses {total} in this period · company paid {pool}`,{total:i(o.totalExpenseMinor,{compact:!0}),pool:i(o.poolPaidMinor,{compact:!0})})+` · `+t(`Only expenses a partner paid out of pocket count here`),flush:!0,children:[(0,$.jsx)(`ul`,{className:`divide-y divide-line`,children:o.balances.map(e=>(0,$.jsxs)(`li`,{className:`px-4 md:px-5 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.stakeholderId===`pool`?(0,$.jsx)(`span`,{className:`size-10 rounded-full border border-dashed border-line-strong inline-flex items-center justify-center text-[12px] text-ink-3 shrink-0`,children:t(`Co`)}):(0,$.jsx)(m,{name:n(e),color:e.color,size:40}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`text-[14.5px] font-medium truncate`,children:[e.stakeholderId===`pool`?t(e.name):n(e),e.stakeholderId!==`pool`&&(0,$.jsxs)(`span`,{className:`num text-[12.5px] text-ink-3 font-normal`,children:[` · `,e.sharePercent,`%`]})]}),(0,$.jsxs)(`div`,{className:`text-[12.5px] text-ink-3 truncate`,children:[t(`Share {share} · paid {paid}`,{share:i(e.owedMinor,{compact:!0}),paid:i(e.paidMinor,{compact:!0})}),e.settledOutMinor||e.settledInMinor?` · ${t(`settled {out} / {in}`,{out:i(e.settledOutMinor,{compact:!0}),in:i(e.settledInMinor,{compact:!0})})}`:``]})]}),(0,$.jsxs)(`div`,{className:`text-end shrink-0`,children:[(0,$.jsx)(Y,{minor:e.netMinor,tone:`flow`,signed:!0,className:`text-[15px] font-semibold block`}),(0,$.jsx)(`span`,{className:`text-[11.5px] text-ink-3`,children:e.netMinor>0?t(`is owed`):e.netMinor<0?t(`owes`):t(`settled`)})]})]}),(0,$.jsxs)(`div`,{className:`relative h-1.5 mt-2.5 ms-[52px]`,children:[(0,$.jsx)(`span`,{className:`absolute left-1/2 top-0 bottom-0 w-px bg-line-strong`}),(0,$.jsx)(`span`,{className:s(`absolute top-0 bottom-0 rounded-full`,e.netMinor>=0?`left-1/2 bg-good/70`:`right-1/2 bg-critical/70`),style:{width:`${Math.abs(e.netMinor)/l*50}%`}})]})]},e.stakeholderId))}),(0,$.jsx)(`p`,{className:`px-4 md:px-5 py-3 text-[12.5px] text-ink-3 border-t border-line`,children:t(`Net = paid − share of expenses + settlements paid − settlements received. The company row is the shared account. All rows sum to zero.`)})]}),(0,$.jsx)(d,{title:t(`Settle up`),subtitle:t(`Fewest transfers to clear everything`),flush:!0,children:o.suggestions.length?(0,$.jsx)(`ul`,{className:`divide-y divide-line`,children:o.suggestions.map((r,i)=>(0,$.jsxs)(`li`,{className:`px-4 md:px-5 py-3 flex items-center gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`text-[14px] flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-medium truncate`,children:r.fromStakeholderId===`pool`?t(r.fromName):n({name:r.fromName,nameAr:r.fromNameAr})}),(0,$.jsx)(Z,{className:`size-4 text-ink-3 shrink-0 rtl-flip`}),(0,$.jsx)(`span`,{className:`font-medium truncate`,children:r.toStakeholderId===`pool`?t(r.toName):n({name:r.toName,nameAr:r.toNameAr})})]}),(0,$.jsx)(Y,{minor:r.amountMinor,className:`text-[16px] font-semibold`})]}),(0,$.jsx)(z,{size:`sm`,variant:`soft`,className:`rounded-full`,onClick:()=>e(r),children:t(`Record`)})]},i))}):(0,$.jsx)(p,{title:t(`All square`),description:t(`Nobody owes anyone for this period.`)})})]})}function ae({onEdit:e}){let{t,name:n}=h(),{range:i}=G(),{date:a}=w(),[o,s]=H(),l=Number(o.get(`page`)??`1`)||1,u=y((0,Q.useMemo)(()=>({from:i.from,to:i.to,page:l,pageSize:50}),[i,l])),{remove:f}=C(),g=B(),[_,v]=(0,Q.useState)(null);return(0,$.jsxs)(d,{flush:!0,children:[u.isPending&&(0,$.jsx)(c,{}),u.data&&!u.data.items.length&&(0,$.jsx)(p,{title:t(`No settlements`),description:t(`Record one from the Balances tab when a partner pays someone back.`)}),(0,$.jsx)(`ul`,{className:`divide-y divide-line`,children:u.data?.items.map(i=>(0,$.jsxs)(`li`,{className:`flex items-center`,children:[(0,$.jsx)(r,{className:`flex-1`,leading:i.from&&(0,$.jsx)(m,{name:n(i.from),color:i.from.color,size:40}),title:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[i.from?n(i.from):``,(0,$.jsx)(Z,{className:`size-4 text-ink-3 rtl-flip`}),i.to?n(i.to):t(`Company`)]}),subtitle:[a(i.date),i.note].filter(Boolean).join(` · `),trailing:(0,$.jsx)(Y,{minor:i.amountMinor,className:`text-[15px] font-semibold`})}),(0,$.jsx)(`div`,{className:`pe-3`,children:(0,$.jsx)(j,{trigger:()=>(0,$.jsx)(`button`,{type:`button`,className:`size-9 inline-flex items-center justify-center rounded-full text-ink-3 hover:text-ink hover:bg-card-hover`,"aria-label":t(`Actions`),children:(0,$.jsx)(k,{className:`size-4`})}),children:n=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(O,{icon:(0,$.jsx)(E,{}),onClick:()=>{n(),e(i)},children:t(`Edit`)}),(0,$.jsx)(A,{}),(0,$.jsx)(O,{icon:(0,$.jsx)(D,{}),danger:!0,onClick:()=>{n(),v(i)},children:t(`Delete`)})]})})})]},i.id))}),u.data&&(0,$.jsx)(T,{page:u.data.page,pageSize:u.data.pageSize,total:u.data.total,onPage:e=>s(t=>{let n=new URLSearchParams(t);return n.set(`page`,String(e)),n},{replace:!0})}),(0,$.jsx)(U,{open:!!_,onClose:()=>v(null),onConfirm:async()=>{try{await f.mutateAsync(_.id),g.success(t(`Settlement deleted`)),v(null)}catch(e){g.error(t(`Delete failed`),W(e))}},loading:f.isPending,title:t(`Delete this settlement?`)})]})}function oe(){let{t:e,name:t}=h(),{range:n}=G(),{money:r}=w(),i=b(n.from,n.to);if(i.isPending)return(0,$.jsx)(c,{});if(i.isError)return(0,$.jsx)(p,{title:e(`Could not load distribution`),description:i.error.message});let a=i.data;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:[{l:`Revenue`,v:a.revenueMinor,signed:!1},{l:`Expenses`,v:a.expenseMinor,signed:!1},{l:`Profit`,v:a.profitMinor,signed:!0}].map(t=>(0,$.jsxs)(`div`,{className:`card p-4`,children:[(0,$.jsx)(`div`,{className:`label`,children:e(t.l)}),(0,$.jsx)(`div`,{className:s(`num text-[18px] md:text-[22px] font-semibold mt-1 tracking-tight`,t.signed&&t.v<0&&`text-critical`),children:r(t.v,{signed:t.signed,compact:!0})})]},t.l))}),(0,$.jsxs)(d,{title:e(`Each partner's share`),subtitle:e(`By current ownership · shares total {pct}`,{pct:q(a.shareTotal,2)}),flush:!0,children:[(0,$.jsxs)(`ul`,{className:`divide-y divide-line`,children:[a.items.map(n=>(0,$.jsxs)(`li`,{className:`px-4 md:px-5 py-3 flex items-center gap-3`,children:[(0,$.jsx)(m,{name:t(n),color:n.color,size:40}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`text-[14.5px] font-medium truncate`,children:[t(n),` `,(0,$.jsxs)(`span`,{className:`num text-[12.5px] text-ink-3 font-normal`,children:[n.sharePercent,`%`]})]}),(0,$.jsx)(`div`,{className:`text-[12.5px] text-ink-3 truncate`,children:e(`Revenue {rev} · expenses {exp}`,{rev:r(n.revenueShareMinor,{compact:!0}),exp:r(n.expenseShareMinor,{compact:!0})})})]}),(0,$.jsxs)(`div`,{className:`text-end`,children:[(0,$.jsx)(Y,{minor:n.profitShareMinor,tone:`flow`,signed:!0,className:`text-[15px] font-semibold block`}),(0,$.jsx)(`span`,{className:`text-[11.5px] text-ink-3`,children:e(`profit share`)})]})]},n.stakeholderId)),!a.items.length&&(0,$.jsx)(`li`,{children:(0,$.jsx)(p,{title:e(`No active stakeholders`)})})]}),(0,$.jsx)(`p`,{className:`px-4 md:px-5 py-3 text-[12.5px] text-ink-3 border-t border-line`,children:e(`Uses current ownership shares for the selected period. Individual expense splits are snapshots and may differ if ownership changed.`)})]})]})}export{ne as StakeholdersPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e}from"./badge-
|
|
1
|
+
import{g as e}from"./badge-DCLlsDNI.js";var t={name:`archive-restore`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]};t.node;var n=e(t),r={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};r.node;var i=e(r),a={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};a.node;var o=e(a);export{i as n,n as r,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ft as e,g as t,h as n,v as r}from"./badge-DCLlsDNI.js";var i={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};i.node;var a=t(i),o={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};o.node;var s=t(o),c={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};c.node;var l=t(c),u=e();function d({className:e,children:t,...r}){return(0,u.jsx)(`div`,{className:`overflow-x-auto`,children:(0,u.jsx)(`table`,{className:n(`w-full border-collapse text-[14px]`,e),...r,children:t})})}function f({className:e,children:t,align:r=`left`,sortable:i,sorted:o,onSort:c,...d}){let f=o===`asc`?s:o===`desc`?a:l;return(0,u.jsx)(`th`,{className:n(`label h-10 px-4 border-b border-line bg-card sticky top-0 z-[1] whitespace-nowrap font-medium`,r===`right`&&`text-end`,r===`center`&&`text-center`,i&&`cursor-pointer select-none hover:text-ink`,e),onClick:i?c:void 0,"aria-sort":o?o===`asc`?`ascending`:`descending`:void 0,...d,children:(0,u.jsxs)(`span`,{className:n(`inline-flex items-center gap-1`,r===`right`&&`flex-row-reverse`),children:[t,i&&(0,u.jsx)(f,{className:n(`size-3.5`,o?`text-accent`:`text-ink-4`)})]})})}function p({className:e,children:t,align:r=`left`,...i}){return(0,u.jsx)(`td`,{className:n(`h-12 px-4 border-b border-line align-middle`,r===`right`&&`text-end`,r===`center`&&`text-center`,e),...i,children:t})}function m({className:e,selected:t,children:r,...i}){return(0,u.jsx)(`tr`,{className:n(`row-hover transition-colors last:[&>td]:border-b-0`,t&&`bg-accent-soft/60`,e),...i,children:r})}function h({colSpan:e,children:t}){return(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:e,className:`h-36 text-center text-ink-3 text-[14px]`,children:t})})}function g({page:e,pageSize:t,total:n,onPage:i}){let{t:a}=r(),o=Math.max(1,Math.ceil(n/t)),s=n===0?0:(e-1)*t+1,c=Math.min(n,e*t);return n<=t?null:(0,u.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 h-12 border-t border-line text-[13px] text-ink-3`,children:[(0,u.jsx)(`span`,{className:`num`,children:a(`{from}–{to} of {total}`,{from:s,to:c,total:n})}),(0,u.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,u.jsx)(`button`,{type:`button`,className:`h-8 px-3 rounded-[9px] hover:bg-card-hover disabled:opacity-40 font-medium`,disabled:e<=1,onClick:()=>i(e-1),children:a(`Prev`)}),(0,u.jsxs)(`span`,{className:`num px-1`,children:[e,` / `,o]}),(0,u.jsx)(`button`,{type:`button`,className:`h-8 px-3 rounded-[9px] hover:bg-card-hover disabled:opacity-40 font-medium`,disabled:e>=o,onClick:()=>i(e+1),children:a(`Next`)})]})]})}export{f as a,p as i,g as n,m as o,d as r,a as s,h as t};
|