PageSourceSearch

https://platform.dalseen.sa/assets/PosFullscreen-DNs3eaJb.js

js dalseen.sa collected 2026-10-09 23:46:29 UTC 30,402 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PosPage-5tWCUF6L.js","assets/index-mbu4rngo.js","assets/index-C-eOp8T-.css","assets/ScanField-BP7_8rwb.js","assets/catalog.hooks-CQVwHHu0.js","assets/envelope-BnG_2aCi.js","assets/retail.hooks-CswHdrQ2.js","assets/zfAccess-DxAQOEAz.js","assets/ReceiptComplete-OQDa6zv5.js","assets/SarCurrencyIcon-CMs8AK3j.js","assets/ThermalReceiptShell-BaaeFZtP.js","assets/ZatcaQR-CnCtagXA.js","assets/usePosRegister-JHXj5Hub.js","assets/ManagerOverride-BgC79SMx.js","assets/retailFeatureAccess-CpkTWtdu.js","assets/PosTenderMarks-D62fsZbZ.js","assets/cfd-bus-BVaG7Ufr.js","assets/KhazeenUnknownProductGuide-CY_hCcsf.js","assets/CollapsibleInfoPanel-CVKvYjT7.js","assets/PosProductShelfSkeleton-D4hsg7gg.js","assets/Customer360Drawer-MRfvM7Mh.js","assets/ecomArTerms-PJUqEijj.js","assets/ecomPermAccess-Cali1XQE.js","assets/DineReceiptComplete-N-ij2HNY.js","assets/dineEnumLabels-CE7G1dfl.js","assets/dineTicketDisplay-CLHYdf0x.js","assets/ReceiptDetailDrawer-Vh5uqnUO.js","assets/ReturnPolicyPanel-C3HJI1vw.js","assets/PromptModal-BdXdqgUk.js","assets/ReturnDetailDrawer-CSNPrWj_.js","assets/TransferPayoutCard-CKY__sqV.js","assets/posRef-BQXQ2mqS.js","assets/entityRef-DCRkkasa.js","assets/Tabs-Bjhf8xjg.js","assets/LoyaltyMembershipIssueDialog-pBZ7w29j.js","assets/useConfirmDialog-BmZn0ete.js","assets/occasionLabels-D1tl8HOG.js","assets/useOccasionAlerts-WKdX5NSK.js","assets/ReceiptsPage-4AoOpkB_.js","assets/FilterBar-Cx-Z0aad.js","assets/ResponsiveList-BIrnTzLq.js","assets/Table-C-6tVvHB.js","assets/ListPaginationBar-DZLdPGo3.js","assets/Pagination-D67TwaBd.js","assets/posSurface-B1XuGWOL.js","assets/posListLayout-CTRQwfRR.js","assets/ReturnsPage-VnkSCemz.js","assets/KPI-D8usIAa2.js","assets/RetailOpsLinks-CmJDtZum.js","assets/ReturnsWizardPage-CUpmkQ-3.js","assets/SaudiIbanField-DkkC0v5s.js","assets/SaudiBankMark-D0VzKxP-.js","assets/returnApprovals-CYsReCXj.js","assets/returnPolicy.hooks-DXR-rY_Q.js"])))=>i.map(i=>d[i]);
2import{j as e,B as Se,l as v,m as F,N as _e,A as $,S as ce,u as de,ou as ye,r as i,ov as ke,ow as we,M as me,ap as he,kP as Y,ox as Pe,oy as Ee,oz as Ce,a as U,b6 as Le,c4 as Oe,ed as Re,b5 as Me,bC as h,ez as Ae,I as ne,oA as De,R as oe,a_ as Te,a$ as X,Q as Fe,ef as Ie,m9 as $e,_ as te,at as re}from"./index-mbu4rngo.js";import{S as ze}from"./SiblingNavigate-BRGR9lwS.js";import{C as Be}from"./CloseShiftDialog-Bg1S6MEW.js";import{u as Ve,P as qe,B as Ue,D as He,a as Ge}from"./usePosLandscapeHint-DWsycHL_.js";import{L as fe}from"./ListPaginationBar-DZLdPGo3.js";import{s as ue}from"./StatusBadge-DamnH-sW.js";import{M as ge}from"./ManagerOverride-BgC79SMx.js";import{S as Ze}from"./ShiftClosedBanner-BC0743z7.js";import{N as Qe}from"./NoShiftGate-C6_YJCQr.js";import{R as We}from"./RegisterPicker-DNZCbc_a.js";import{u as Ye}from"./usePosRegister-JHXj5Hub.js";import{P as Je,a as Ke}from"./posSurface-B1XuGWOL.js";import"./navigateIfDifferent-B_QvQzkC.js";import"./SubSectionTabs-Fyhlcqm7.js";/* empty css                         */import"./a4PrintLayout-DW2kyoJa.js";import"./printTenantBranding-BzZAvuY7.js";import"./opsArTerms-B02BN8NN.js";import"./KPI-D8usIAa2.js";import"./PrinterSetupPanel-C5zLrvrW.js";import"./ThermalReceiptShell-BaaeFZtP.js";import"./menuCatalogUtils-CbZ5hm1H.js";import"./SideDrawer-CGBKOaCK.js";import"./Pagination-D67TwaBd.js";function Xe(t,l){const s={cash:{en:"Cash",ar:"نقدًا"},bank:{en:"Bank",ar:"بنك"},wallet:{en:"Wallet",ar:"محفظة"}}[t];return s?l==="ar"?s.ar:s.en:t||"-"}function et(t,l){return t==="partial"?l("Partially paid","مدفوع جزئياً"):t==="open"?l("Unpaid balance","رصيد غير مدفوع"):l("Fully paid","مدفوع بالكامل")}function be({doc:t,loading:l=!1,amount:o,onAmountChange:s,locale:c,t:a,kind:m="collect"}){if(!t)return null;const u=Number(t.outstanding)||0,y=Number(t.paid)||0,C=Number(t.total)||0,g=Number(o),d=Number.isFinite(g)&&g>0&&g<=u+.01,D=d?Math.max(0,+(u-g).toFixed(2)):u,I=d&&D<=.01,x=t.payments||[],L=m==="collect"?t.customer||t.customer_code||"-":(c==="ar"?t.supplier_ar||t.supplier_en:t.supplier_en||t.supplier_ar)||"-";return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:F("card p-3 text-sm flex flex-col gap-2",m==="collect"?"bg-emerald-50/60 border-emerald-100":"bg-rose-50/60 border-rose-100"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold truncate",children:t.ref_no}),e.jsx("div",{className:"text-xs text-ink-500 truncate",children:L})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[e.jsx(Se,{tone:t.settlement==="partial"?"warning":t.status==="overdue"?"danger":"info",children:ue(t.status,c)}),t.settlement&&t.settlement!=="paid"&&e.jsx("span",{className:"text-[10px] text-ink-500",children:et(t.settlement,a)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 pt-2 border-t border-ink-100/80",children:[e.jsx(ee,{label:a("Invoice total","إجمالي الفاتورة"),value:v(C,c)}),e.jsx(ee,{label:a("Paid so far","المدفوع حتى الآن"),value:v(y,c)}),e.jsx(ee,{label:a("Outstanding","المستحق"),value:v(u,c),highlight:!0}),e.jsx(ee,{label:a("Due date","تاريخ الاستحقاق"),value:t.due_on||"-",sub:t.days_overdue>0?a("@n days overdue","@n يوم متأخر").replace("@n",String(t.days_overdue)):t.days_to_due!=null&&t.days_to_due>=0?a("@n days left","@n يوم متبقي").replace("@n",String(t.days_to_due)):null})]}),t.issued_on&&e.jsxs("div",{className:"text-[10px] text-ink-400",children:[a("Issued","صدرت"),": ",t.issued_on,t.payment_count>0&&e.jsxs(e.Fragment,{children:[" · ",t.payment_count," ",a("prior payment(s)","دفعة/دفعات سابقة")]})]})]}),x.length>0&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-ink-400",children:a("Payment history","سجل الدفعات")}),e.jsx("div",{className:"border border-ink-100 rounded-lg overflow-hidden max-h-32 overflow-y-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"bg-ink-50 text-ink-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-start p-2 font-medium",children:a("Date","التاريخ")}),e.jsx("th",{className:"text-start p-2 font-medium",children:a("Method","طريقة الدفع")}),e.jsx("th",{className:"text-end p-2 font-medium",children:a("Amount","المبلغ")})]})}),e.jsx("tbody",{children:x.map(p=>e.jsxs("tr",{className:"border-t border-ink-50",children:[e.jsx("td",{className:"p-2 tabular-nums",children:p.at?_e(p.at,c):"-"}),e.jsx("td",{className:"p-2",children:Xe(p.method,c)}),e.jsx("td",{className:"p-2 text-end font-mono tabular-nums",children:v(p.amount,c)})]}
2,p.id))})]})})]}),l&&e.jsx("div",{className:"text-xs text-ink-400 italic",children:a("Loading payment history…","جاري تحميل سجل الدفعات…")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx($,{size:"sm",variant:"secondary",onClick:()=>s(String(u)),disabled:u<=0,children:a("Pay full balance","دفع الرصيد كاملًا")}),u>1&&e.jsx($,{size:"sm",variant:"ghost",onClick:()=>s(String(+(u/2).toFixed(2))),children:a("Pay half","دفع النصف")})]}),e.jsx(ce,{label:m==="collect"?a("Collection amount (SAR)","مبلغ التحصيل (ر.س)"):a("Payment amount (SAR)","مبلغ الدفع (ر.س)"),type:"number",step:.5,min:0,max:u||void 0,value:o,onChange:p=>s(p.target.value)}),d&&e.jsxs("div",{className:F("card p-3 text-sm flex flex-col gap-1",I?"bg-emerald-50 border-emerald-200":"bg-amber-50 border-amber-200"),children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:I?a("Full settlement","تسوية كاملة"):a("Partial payment","دفعة جزئية")}),e.jsx("span",{className:"font-semibold tabular-nums",children:v(g,c)})]}),!I&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between text-xs text-ink-600",children:[e.jsx("span",{children:a("Remaining after this payment","المتبقي بعد هذه الدفعة")}),e.jsx("span",{className:"font-mono tabular-nums",children:v(D,c)})]}),e.jsx("p",{className:"text-[11px] text-amber-800/90 mt-1",children:m==="collect"?a("Invoice stays open (collect the remaining balance later from Collect.","تبقى الفاتورة مفتوحة) يمكن تحصيل المتبقي لاحقًا من تحصيل."):a("Bill stays open (pay the remaining balance later from Pay.","تبقى فاتورة المورد مفتوحة) يمكن دفع المتبقي لاحقًا من دفع.")})]})]})]})}function ee({label:t,value:l,sub:o,highlight:s}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-ink-400",children:t}),e.jsx("div",{className:F("font-semibold tabular-nums mt-0.5",s&&"text-ink-900"),children:l}),o&&e.jsx("div",{className:"text-[10px] text-rose-600 mt-0.5",children:o})]})}const tt=250,ie=25,xe=[10,25,50];function st({open:t,onClose:l,shift:o}){var q,W;const{t:s,locale:c}=de(),a=ye(),[m,u]=i.useState(""),[y,C]=i.useState(""),[g,d]=i.useState(1),[D,I]=i.useState(ie),[x,L]=i.useState(""),[p,k]=i.useState(""),[A,T]=i.useState(""),[H,N]=i.useState(null),[J,R]=i.useState(!1),O=ke({search:y,page:g,per_page:D},t),S=((q=O.data)==null?void 0:q.items)||[],G=((W=O.data)==null?void 0:W.meta)||{},z=G.total??S.length,Z=Number(G.per_page||D||ie),b=Math.max(1,Math.ceil(z/Z)),K=Math.min(g,b),M=we(x,t&&!!x),j=i.useMemo(()=>M.data||S.find(r=>r.id===x)||null,[M.data,S,x]);if(i.useEffect(()=>{t&&(u(""),C(""),d(1),L(""),k(""),T(""),N(null))},[t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>{C(m.trim()),d(1)},tt);return()=>clearTimeout(r)},[t,m]),i.useEffect(()=>{g>b&&d(b)},[g,b]),i.useEffect(()=>{j&&p===""&&k(String(j.outstanding??""))},[j,p]),!o)return null;const w=Number(p),P=(j==null?void 0:j.outstanding)??0,E=Number.isFinite(w)&&w>0&&w<=P+.01,_=+((Number(o.expected_cash)||0)+(E?w:0)).toFixed(2),Q=E&&w>=P-.01,B=async()=>{await a.mutateAsync({shift_id:o.id,invoice_id:x,amount:w,reason_code:"CUSTOMER_DEBT",notes:A.trim()}),l==null||l()},V=()=>{if(N(null),!x){N(Y("Pick an invoice to collect.","اختر فاتورة للتحصيل."));return}if(!E){N(Y("Enter a valid amount up to the outstanding balance.","أدخل مبلغًا صالحًا حتى الرصيد المستحق."));return}if(A.trim()===""){N(Y("Notes are required for every cash movement.","الملاحظات مطلوبة لكل حركة نقد."));return}R(!0)};return e.jsxs(e.Fragment,{children:[e.jsx(ge,{open:J,intent:{kind:"cash.out",en:`${s("AR collection","تحصيل ذمم")}: ${v(w,"en")}${Q?" (full)":" (partial)"}`,ar:`${s("AR collection","تحصيل ذمم")}: ${v(w,"ar")}${Q?" (كامل)":" (جزئي)"}`,amount:w},onApprove:async()=>{R(!1);try{await B()}catch(r){N(r)}},onCancel:()=>R(!1)}),e.jsxs(me,{open:t,onClose:l,size:"lg",title:s("Collect customer debt","تحصيل ذمة عميل"),footer:e.jsxs(e.Fragment,{children:[e.jsx($,{variant:"secondary",onClick:l,children:s("Cancel","إلغاء")}),e.jsx($,{variant:"primary",onClick:V,loading:a.isPending,disabled:!x||!E||A.trim()==="",children:Q?s("Record full collection","تسجيل تحصيل كامل"):s("Record partial collection","تسجيل تحصيل جزئي")})]}),children:[H&&e.jsx("div",{className:"mb-3",children:e.jsx(he,{error:H})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"card p-3 bg-ink-50/50 text-sm flex flex-col gap-1",children:e.jsxs("div",{className:"flex justify-between font-semibold",children:[e.jsx("span",{children:s("Expected drawer now","الدرج المتوقع حالياً")}),e.jsx("span",{className:"tabular-nums",children:v(o.expected_cash,c)})]})}),e.jsx(ce,{label:s("Search invoice or customer","بحث فاتورة أو عميل"),value:m,onChange:r=>u(r.target.value),placeholder:s("Ref no, customer name…","رقم الفاتورة، اسم العميل…")}),e.jsxs("div",{className:"flex flex-col gap-1 max-h-36 overflow-y-auto border border-ink-100 rounded-lg",children:[O.isLoading&&e.jsx("div",{className:"p-3 text-xs text-ink-400",children:s("Loading…","جاري التحميل…")}),!O.isLoading&&S.length===0&&e.jsx("div",{className:"p-3 text-xs text-ink-400 italic",children:s("No open invoices found. Issue an invoice in Accounting → Sell first.","لا توجد فواتير مفتوحة. أنشئ فاتورة من المحاسبة ← المبيعات أولًا.")}),S.map(r=>e.jsxs("label",{className:F("flex items-start gap-2 p-2 cursor-pointer border-b border-ink-50 last:border-0",x===r.id?"bg-emerald-50":"hover:bg-ink-50"),children:[e.jsx("input",{type:"radio",name:"invoice",checked:x===r.id,onChange:()=>{L(r.id),k(String(r.outstanding??""))},className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:r.ref_no}),e.jsx("div",{className:"text-[11px] text-ink-500 truncate",children:r.customer||r.customer_code||"-"}),e.jsxs("div",{className:"text-[10px] text-ink-400 mt-0.5",children:[s("Paid","مدفوع"),": ",v(r.paid,c)," · ",r.due_on?`${s("Due","مستحق")}: ${r.due_on}`:"",r.payment_count>0?` · ${r.payment_count} ${s("payments","دفعات")}`:""]})]}),e.jsxs("div",{className:"text-end shrink-0",children:[e.jsx("div",{className:"text-xs font-mono tabular-nums font-semibold",children:v(r.outstanding,c)}),e.jsx("div",{className:"text-[10px] text-ink-400",children:ue(r.status,c)})]})]},r.id))]}),e.jsx(fe,{className:"rounded-lg border border-ink-100 bg-ink-50/40 px-3 py-2 text-xs",isLoading:O.isFetching,page:K,pageCount:b,total:z,pageSize:Z,pageSizeOptions:xe,rowsPerPageLabel:s("Invoices per page","فواتير في الصفحة"),onPageSizeChange:r=>{const n=xe.includes(r)?r:ie;I(n),d(1)},onPageChange:r=>d(Math.min(Math.max(1,Number(r)||1),b)),onFirst:()=>d(1),onPrev:()=>d(r=>Math.max(1,r-1)),onNext:()=>d(r=>Math.min(b,r+1)),onLast:()=>d(b)}),j&&e.jsx(be,{doc:j,loading:M.isLoading&&!M.data,amount:p,onAmountChange:k,locale:c,t:s,kind:"collect"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs text-ink-500",children:s("Notes (required)","الملاحظات (مطلوب)")}),e.jsx("textarea",{value:A,onChange:r=>T(r.target.value),rows:2,maxLength:500,placeholder:s("Customer paid existing receivable in cash","دفع العميل ذمّة قائمة نقدًا"),className:"text-sm border border-ink-200 rounded px-2 py-1.5 outline-none focus:border-ink-900"})]}),E&&e.jsxs("div",{className:"card p-3 text-sm flex items-center justify-between bg-emerald-50 border-emerald-200",children:[e.jsx("span",{children:s("Expected drawer after","الدرج المتوقع بعد الحركة")}),e.jsxs("span",{className:"font-semibold tabular-nums",children:["→ ",v(_,c)]})]})]})]})]})}const at=250,le=25,pe=[10,25,50];function nt({open:t,onClose:l,shift:o}){var W,r;const{t:s,locale:c}=de(),a=Pe(),[m,u]=i.useState(""),[y,C]=i.useState(""),[g,d]=i.useState(1),[D,I]=i.useState(le),[x,L]=i.useState(""),[p,k]=i.useState(""),[A,T]=i.useState(""),[H,N]=i.useState(null),[J,R]=i.useState(!1),O=Ee({search:y,page:g,per_page:D},t),S=((W=O.data)==null?void 0:W.items)||[],G=((r=O.data)==null?void 0:r.meta)||{},z=G.total??S.length,Z=Number(G.per_page||D||le),b=Math.max(1,Math.ceil(z/Z)),K=Math.min(g,b),M=Ce(x,t&&!!x),j=i.useMemo(()=>M.data||S.find(n=>n.id===x)||null,[M.data,S,x]);if(i.useEffect(()=>{t&&(u(""),C(""),d(1),L(""),k(""),T(""),N(null))},[t]),i.useEffect(()=>{if(!t)return;const n=setTimeout(()=>{C(m.trim()),d(1)},at);return()=>clearTimeout(n)},[t,m]),i.useEffect(()=>{g>b&&d(b)},[g,b]),i.useEffect(()=>{j&&p===""&&k(String(j.outstanding??""))},[j,p]),!o)return null;const w=n=>(c==="ar"?n.supplier_ar||n.supplier_en:n.supplier_en||n.supplier_ar)||"-",P=Number(p),E=(j==null?void 0:j.outstanding)??0,_=Number.isFinite(P)&&P>
20&&P<=E+.01,Q=+((Number(o.expected_cash)||0)-(_?P:0)).toFixed(2),B=_&&P>=E-.01,V=async()=>{await a.mutateAsync({shift_id:o.id,bill_id:x,amount:P,reason_code:"SUPPLIER_SETTLEMENT",notes:A.trim()}),l==null||l()},q=()=>{if(N(null),!x){N(Y("Pick a bill to pay.","اختر فاتورة مورد للدفع."));return}if(!_){N(Y("Enter a valid amount up to the outstanding balance.","أدخل مبلغًا صالحًا حتى الرصيد المستحق."));return}if(A.trim()===""){N(Y("Notes are required for every cash movement.","الملاحظات مطلوبة لكل حركة نقد."));return}R(!0)};return e.jsxs(e.Fragment,{children:[e.jsx(ge,{open:J,intent:{kind:"cash.out",en:`${s("Supplier payment","دفع مورد")}: ${v(P,"en")}${B?" (full)":" (partial)"}`,ar:`${s("Supplier payment","دفع مورد")}: ${v(P,"ar")}${B?" (كامل)":" (جزئي)"}`,amount:P},onApprove:async()=>{R(!1);try{await V()}catch(n){N(n)}},onCancel:()=>R(!1)}),e.jsxs(me,{open:t,onClose:l,size:"lg",title:s("Pay supplier from drawer","دفع مورد من الدرج"),footer:e.jsxs(e.Fragment,{children:[e.jsx($,{variant:"secondary",onClick:l,children:s("Cancel","إلغاء")}),e.jsx($,{variant:"primary",onClick:q,loading:a.isPending,disabled:!x||!_||A.trim()==="",children:B?s("Record full payment","تسجيل دفع كامل"):s("Record partial payment","تسجيل دفع جزئي")})]}),children:[H&&e.jsx("div",{className:"mb-3",children:e.jsx(he,{error:H})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"card p-3 bg-ink-50/50 text-sm flex flex-col gap-1",children:e.jsxs("div",{className:"flex justify-between font-semibold",children:[e.jsx("span",{children:s("Expected drawer now","الدرج المتوقع حالياً")}),e.jsx("span",{className:"tabular-nums",children:v(o.expected_cash,c)})]})}),e.jsx(ce,{label:s("Search bill or supplier","بحث فاتورة أو مورد"),value:m,onChange:n=>u(n.target.value),placeholder:s("Ref no, supplier name…","رقم الفاتورة، اسم المورد…")}),e.jsxs("div",{className:"flex flex-col gap-1 max-h-36 overflow-y-auto border border-ink-100 rounded-lg",children:[O.isLoading&&e.jsx("div",{className:"p-3 text-xs text-ink-400",children:s("Loading…","جاري التحميل…")}),!O.isLoading&&S.length===0&&e.jsx("div",{className:"p-3 text-xs text-ink-400 italic",children:s("No open bills found. Bills are created from inventory receiving or Accounting → Spend.","لا توجد فواتير موردين مفتوحة. تُنشأ من استلام المخزون أو المحاسبة ← المصروفات.")}),S.map(n=>e.jsxs("label",{className:F("flex items-start gap-2 p-2 cursor-pointer border-b border-ink-50 last:border-0",x===n.id?"bg-rose-50":"hover:bg-ink-50"),children:[e.jsx("input",{type:"radio",name:"bill",checked:x===n.id,onChange:()=>{L(n.id),k(String(n.outstanding??""))},className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:n.ref_no}),e.jsx("div",{className:"text-[11px] text-ink-500 truncate",children:w(n)}),e.jsxs("div",{className:"text-[10px] text-ink-400 mt-0.5",children:[s("Paid","مدفوع"),": ",v(n.paid,c)," · ",n.due_on?`${s("Due","مستحق")}: ${n.due_on}`:"",n.payment_count>0?` · ${n.payment_count} ${s("payments","دفعات")}`:""]})]}),e.jsxs("div",{className:"text-end shrink-0",children:[e.jsx("div",{className:"text-xs font-mono tabular-nums font-semibold",children:v(n.outstanding,c)}),e.jsx("div",{className:"text-[10px] text-ink-400",children:ue(n.status,c)})]})]},n.id))]}),e.jsx(fe,{className:"rounded-lg border border-ink-100 bg-ink-50/40 px-3 py-2 text-xs",isLoading:O.isFetching,page:K,pageCount:b,total:z,pageSize:Z,pageSizeOptions:pe,rowsPerPageLabel:s("Bills per page","فواتير في الصفحة"),onPageSizeChange:n=>{const se=pe.includes(n)?n:le;I(se),d(1)},onPageChange:n=>d(Math.min(Math.max(1,Number(n)||1),b)),onFirst:()=>d(1),onPrev:()=>d(n=>Math.max(1,n-1)),onNext:()=>d(n=>Math.min(b,n+1)),onLast:()=>d(b)}),j&&e.jsx(be,{doc:j,loading:M.isLoading&&!M.data,amount:p,onAmountChange:k,locale:c,t:s,kind:"pay"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs text-ink-500",children:s("Notes (required)","الملاحظات (مطلوب)")}),e.jsx("textarea",{value:A,onChange:n=>T(n.target.value),rows:2,maxLength:500,placeholder:s("Supplier settled in cash from drawer","تسوية مورد نقدًا من الدرج"),className:"text-sm border border-ink-200 rounded px-2 py-1.5 outline-none focus:border-ink-900"})]}),_&&e.jsxs("div",{className:"card p-3 text-sm flex items-center justify-between bg-rose-50 border-rose-200",children:[e.jsx("span",{children:s("Expected drawer after","الدرج المتوقع بعد الحركة")}),e.jsxs("span",{className:"font-semibold tabular-nums",children:["→ ",v(Q,c)]})]})]})]})]})}function rt(t,l,o=document){if(!/^\/pos(?:\/|$)/.test(t||""))return!1;const s=l==="ar",c=t.replace(/\/+$/,"").split("/")[2],a={receipts:["Receipts","الإيصالات"],returns:["Returns","المرتجعات"]},m=["receipts","returns"].includes(c)?a[c]:["Point of sale","نقطة البيع"];o.title=`${m[s?1:0]} | ${s?"دال سين":"DAL SEEN"}`,o.documentElement.lang=s?"ar":"en",o.documentElement.dir=s?"rtl":"ltr",o.head.querySelectorAll(['meta[name="description"]','meta[name="keywords"]','meta[property^="og:"]','meta[name^="twitter:"]','link[rel="canonical"]','link[rel="alternate"][hreflang]','script[type="application/ld+json"]'].join(",")).forEac
2h(y=>y.remove());let u=o.head.querySelector('meta[name="robots"]');return u||(u=o.createElement("meta"),u.name="robots",o.head.appendChild(u)),o.head.querySelectorAll('meta[name="robots"]').forEach(y=>{y.content="noindex, nofollow, noarchive"}),!0}function it(t,l){i.useLayoutEffect(()=>{rt(t,l);const o=document.title;return()=>{document.title===o&&(document.title=l==="ar"?"دال سين":"DAL SEEN")}},[t,l])}const je=i.lazy(()=>te(()=>import("./PosPage-5tWCUF6L.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),lt=i.lazy(()=>te(()=>import("./ReceiptsPage-4AoOpkB_.js"),__vite__mapDeps([38,1,2,39,40,41,42,43,6,7,26,11,27,28,31,32,44,45]))),ot=i.lazy(()=>te(()=>import("./ReturnsPage-VnkSCemz.js"),__vite__mapDeps([46,1,2,47,39,40,41,42,43,6,7,29,30,11,31,32,48,18,44,45]))),ct=i.lazy(()=>te(()=>import("./ReturnsWizardPage-CUpmkQ-3.js"),__vite__mapDeps([49,1,2,50,51,30,43,52,53,5,6,7,13,8,9,10,11,27,15,19])));function dt({branchShiftLoading:t,hasBranchShift:l,canManageDrawer:o,onOpenShift:s,actionLabel:c,keepSellMounted:a}){const m=U(g=>g.can),u=m("pos.sales.create"),y=m("pos.sales.view")||m("pos.sales.create"),C=m("pos.sales.view")||m("pos.returns.create");return u?t?e.jsx(oe,{}):l?a?null:e.jsx(je,{active:!0}):e.jsx(Qe,{canManageDrawer:o,onOpenShift:o?s:void 0,actionLabel:c}):y?e.jsx(re,{to:"receipts",replace:!0}):C?e.jsx(re,{to:"returns",replace:!0}):e.jsx(re,{to:"/app/retail/hub",replace:!0})}function Dt(){const{t,locale:l,isRtl:o}=de(),s=U(f=>f.user),c=U(f=>f.role),a=U(f=>f.branch),m=U(f=>f.tenant),u=U(f=>f.setLocale),y=U(f=>f.can("devices.manage")),C=Le(),g=Oe(),{registerId:d,setRegisterId:D,registers:I,registersLoading:x}=Ye({surface:"retail"}),{branchShift:L,hasBranchShift:p,shiftIsMine:k,shiftDuration:A,canManageDrawer:T,canOperateDrawer:H,branchShiftLoading:N}=Re(d),[J,R]=i.useState(!1),[O,S]=i.useState(!1),[G,z]=i.useState(!1),[Z,b]=i.useState(!1),[K,M]=i.useState(!1),[j,w]=i.useState(!1),[P,E]=i.useState(!1),_=U(f=>f.can),Q=_("pos.sales.create"),B=Me();it(B.pathname,l);const V=/\/pos\/?$/.test(B.pathname),q=Q&&p&&!N,W=!V||!q,r=c==="cashier",n=$e();Ve("pos");const se=i.useMemo(()=>[{to:"",label:h(t,"hubPillarSell"),icon:"spark",end:!0,show:()=>_("pos.sales.create")},{to:"receipts",label:h(t,"hubPillarReceipts"),icon:"doc",show:()=>_("pos.sales.view")||_("pos.sales.create")},{to:"returns",label:h(t,"hubPillarReturns"),icon:"incident",show:()=>_("pos.sales.view")||_("pos.returns.create")}].filter(ae=>ae.show()),[t,_]),ve=async()=>{if(E(!1),r){await g.mutateAsync(),C("/login",{replace:!0});return}if(window.opener){try{window.close()}catch{C("/app/retail/sell",{replace:!0})}return}C("/app/retail/sell",{replace:!0})},Ne=()=>E(!0);return e.jsx(Je.Provider,{value:Ke.FULLSCREEN,children:e.jsx(qe,{children:e.jsxs("div",{lang:l,dir:o?"rtl":"ltr",className:"fixed inset-0 bg-ink-50 flex flex-col",children:[e.jsxs("header",{className:F("min-h-14 px-3 py-2 flex flex-wrap xl:flex-nowrap items-center gap-2 bg-white border-b-2 border-retail shadow-sm shrink-0",n&&"gap-2"),children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0 rounded-xl border border-ink-100 bg-white pe-2",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-ink-900 text-white grid place-items-center font-bold text-sm",children:"D"}),e.jsxs("div",{className:"leading-tight hidden lg:block",children:[e.jsx("div",{className:"font-semibold text-xs",children:(m==null?void 0:m.name)||"DAL SEEN"}),e.jsx("div",{className:"text-[10px] text-retail-strong uppercase tracking-widest font-semibold",children:h(t,"retail_pos")})]})]}),e.jsx("nav",{className:"flex items-center gap-1 rounded-xl border border-ink-200 bg-ink-50/90 p-1 shrink-0","aria-label":h(t,"pos_sections"),children:se.map(f=>e.jsxs(Ae,{to:f.to,end:f.end,"aria-label":f.label,className:({isActive:ae})=>F("inline-flex h-9 items-center justify-center gap-1.5 rounded-lg px-3 text-sm transition whitespace-nowrap",n&&"mobile-touch-pos",ae?"bg-retail-strong text-white font-semibold shadow-sm":"text-ink-600 hover:bg-white hover:text-ink-900"),children:[e.jsx(ne,{name:f.icon,size:14}),e.jsx("span",{className:"hidden md:inline",children:f.label})]},f.to||"sell"))}),e.jsx("div",{className:"flex-1 min-w-0"}),e.jsxs("div",{className:"order-last flex w-full min-w-0 items-center justify-between gap-1 rounded-full border border-ink-100 bg-ink-50/80 p-1 shrink-0 lg:order-none lg:w-auto lg:justify-start",children:[e.jsx(We,{registers:I,registerId:d,onChange:D,loading:x,className:"w-[min(8.75rem,38vw)] shrink-0 lg:w-[min(8.75rem,24vw)]"}),e.jsx(Ue,{tone:"retail",branchShift:L,shiftDuration:A,isMine:k,canManageDrawer:T,canOperateDrawer:H,onOpenShift:()=>R(!0),onCloseShift:()=>S(!0),onDrawerMove:()=>z(!0),onArCollection:()=>b(!0),onSupplierPayment:()=>M(!0)}),y&&e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"inline-flex h-8 items-center gap-1 rounded-full bg-white px-2 text-[11px] font-semibold text-ink-700 shadow-sm ring-1 ring-ink-100 transition hover:bg-ink-100 shrink-0",title:h(t,"printer_setup"),children:[e.jsx(ne,{name:"printer",size:12}),e.jsx("span",{className:"hidden xl:inline",children:h(t,"printers")})]})]}),e.jsxs("div",{className:"hidden min-w-0 items-center gap-2 rounded-full border border-ink-100 bg-white px-1.5 py-1 text-xs text-ink-500 shadow-sm sm:flex",children:[e.jsx("span",{className:"md:hidden truncate max-w-[88px] font-medium text-ink-700",children:l==="ar"?(a==null?void 0:a.name_ar)||(a==null?void 0:a.name_en):(a==null?void 0:a.name_en)||(a==null?void 0:a.name_ar)}),e.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[e.jsx(De,{}),e.jsx("span",{className:"text-ink-300",children:"·"}),e.jsx("span",{className:"truncate font-medium",children:l==="ar"?s==null?void 0:s.name_ar:s==null?void 0:s.name_en})]})]}),e.jsx("button",{onClick:()=>u(l==="en"?"ar":"en"),className:F("grid h-9 min-w-9 place-items-center rounded-xl border border-ink-100 bg-white px-2 text-xs font-semibold text-ink-600 hover:bg-ink-50 hover:text-ink-900 shrink-0",n&&"mobile-touch-pos"),title:h(t,"toggle_language"),"aria-label":h(t,"toggle_language"),children:l==="en"?"ع":"EN"}),e.jsxs("button",{onClick:Ne,className:F("inline-flex h-9 items-center gap-1.5 rounded-xl border border-ink-100 bg-white px-2 text-xs text-ink-500 hover:bg-ink-50 hover:text-ink-900 shrink-0",n&&"mobile-touch-pos"),title:r?h(t,"sign_out"):h(t,"exit_pos"),
2children:[e.jsx(ne,{name:"close",size:14}),e.jsx("span",{className:"hidden sm:inline",children:h(t,"exit")})]})]}),!p&&!N&&e.jsx(Ze,{canManageDrawer:T,onOpenShift:()=>R(!0),actionLabel:h(t,"actionOpenDrawerShift")}),e.jsx("main",{className:"flex-1 min-h-0 overflow-hidden p-2 sm:p-3",children:e.jsxs("div",{className:"relative h-full min-h-0",children:[q&&e.jsx("div",{className:F("h-full min-h-0",!V&&"hidden"),"aria-hidden":!V,children:e.jsx(i.Suspense,{fallback:e.jsx(oe,{}),children:e.jsx(je,{active:V})})}),W&&e.jsx("div",{className:"h-full min-h-0",children:e.jsx(i.Suspense,{fallback:e.jsx(oe,{}),children:e.jsxs(Te,{children:[e.jsx(X,{index:!0,element:e.jsx(dt,{branchShiftLoading:N,hasBranchShift:p,canManageDrawer:T,onOpenShift:()=>R(!0),actionLabel:h(t,"actionOpenDrawerShift"),keepSellMounted:q})}),e.jsx(X,{path:"receipts",element:e.jsx(lt,{})}),e.jsx(X,{path:"returns",element:e.jsx(ot,{})}),e.jsx(X,{path:"returns/new",element:e.jsx(Fe,{permission:"pos.returns.create",children:e.jsx("div",{className:"h-full min-h-0 overflow-y-auto overscroll-y-contain",children:e.jsx(ct,{})})})}),e.jsx(X,{path:"*",element:e.jsx(ze,{to:"",replace:!0})})]})})})]})}),e.jsx(Ie,{open:J,onClose:()=>R(!1),defaultRegisterId:d}),e.jsx(Be,{open:O,onClose:()=>S(!1),shift:L}),e.jsx(He,{open:G,onClose:()=>z(!1),shift:L}),e.jsx(st,{open:Z,onClose:()=>b(!1),shift:L}),e.jsx(nt,{open:K,onClose:()=>M(!1),shift:L}),e.jsx(me,{open:P,onClose:()=>E(!1),size:"sm",title:r?h(t,"sign_out_2"):h(t,"exit_pos_2"),footer:e.jsxs(e.Fragment,{children:[e.jsx($,{variant:"secondary",onClick:()=>E(!1),children:h(t,"cancel")}),p&&T&&k&&e.jsx($,{variant:"ghost",onClick:()=>{E(!1),S(!0)},children:h(t,"close_shift_first")}),e.jsx($,{variant:p&&k?"danger":"primary",onClick:ve,loading:g.isPending,children:r?h(t,"sign_out"):h(t,"exit")})]}),children:e.jsx("div",{className:"text-sm text-ink-500",children:p&&k?t("Your shift is still open. Close the shift first so the drawer count is recorded: or sign out anyway and close it next time.","وردتك ما زالت مفتوحة. أغلق الوردية أولاً لتسجيل عدّ الدرج: أو سجّل الخروج وأكمل الإغلاق لاحقاً."):r?h(t,"you_ll_be_signed_out_and_returned_to_the_login_s"):h(t,"you_ll_go_back_to_the_pos_launcher")})}),y&&e.jsx(Ge,{context:"retail",open:j,onClose:()=>w(!1)})]})})})}export{Dt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.