PageSourceSearch

https://platform.dalseen.sa/assets/CommercialQuotesPage-DByqs7tZ.js

js dalseen.sa collected 2026-10-09 23:47:23 UTC 6,635 bytes, 1 lines download raw bytes

1import{u as U,b6 as z,a as Q,r as n,O as M,e5 as V,j as t,aO as E,m as y,S as W,T as Y,A as N,I as G,E as H,L as q,l as J,B as I,w as X,z as Z,n as u}from"./index-mbu4rngo.js";import{C as ee,Q as te,a as ae}from"./QuoteComposerDrawer-DjVvRJYs.js";import{C as se,b as ne}from"./CommercialKpiStrip-zn9-ObEl.js";import{u as ie,s as le,f as re,m as oe,i as ce,a as me}from"./CrmShell-jLiq9f6h.js";import{Q as p,c as L,a as de}from"./commercialCrmTerms-4xq0qVAJ.js";import"./commercialDocumentPdf-Dn7qhGNj.js";import"./openApiDocument-5Wjys7wS.js";import"./SiblingNavigate-BRGR9lwS.js";import"./navigateIfDifferent-B_QvQzkC.js";import"./PlatformPageHeader-v9IdG0yn.js";import"./PageHeader-Bx5JqCoI.js";import"./KpiSkeleton-CaZsxaxO.js";import"./useCrmBoardPrefs-C7TbLF4l.js";const ue=[{id:"all",en:"All",ar:"الكل"},{id:"open",en:"Open",ar:"مفتوح"},{id:"awaiting",en:"Awaiting tenant",ar:"بانتظار المنشأة"},{id:"won",en:"Won",ar:"فوز"},{id:"lost",en:"Lost / expired",ar:"خسارة / منتهي"}];function _e(){const{t:a,locale:s}=U(),w=z(),S=Q(e=>e.can("platform.commercial_quotes.view")),k=Q(e=>e.can("platform.commercial_quotes.manage")),[x,O]=n.useState("all"),[d,h]=n.useState("all"),[f,A]=n.useState(""),[P,g]=n.useState(!1),[$,v]=n.useState(null),[B,b]=n.useState(!1),[F,_]=n.useState(null),[j]=M(),i=V({},{enabled:S}),l=ie(i.data),D=n.useMemo(()=>le(l),[l]),r=n.useMemo(()=>{let e=re(l,{search:f,status:x});return d!=="all"&&(e=e.filter(c=>oe(c,d))),e},[l,f,x,d]),o=(e=null)=>{v(e),g(!0)},K=e=>{_(e),v(null),g(!0),b(!1)};return n.useEffect(()=>{const e=()=>o(null);return window.addEventListener("crm:open-quote-composer",e),()=>window.removeEventListener("crm:open-quote-composer",e)},[]),n.useEffect(()=>{j.get("view")==="awaiting"&&h("awaiting")},[j]),S?t.jsxs("div",{className:"flex flex-col gap-4",children:[j.get("view")==="awaiting"&&t.jsxs("div",{className:"card px-4 py-3 flex flex-wrap items-center justify-between gap-2 border-amber-200 bg-amber-50/60 text-sm text-amber-900",children:[t.jsx("span",{children:a("Quotes sent and awaiting tenant decision.","عروض مُرسلة وبانتظار قرار المنشأة.")}),t.jsx("button",{type:"button",className:"text-xs font-medium underline",onClick:()=>{h("all"),w("quotes",{replace:!0})},children:a("Show all quotes","عرض كل العروض")})]}),t.jsx(se,{tiles:ne(D,a,s),locale:s,loading:i.isLoading}),t.jsxs("div",{className:"card p-3 flex flex-col gap-3",children:[t.jsx("div",{className:"flex flex-wrap items-center gap-2",children:ue.map(e=>t.jsx("button",{type:"button",onClick:()=>h(e.id),className:y("px-3 py-1.5 rounded-lg text-xs font-medium transition",d===e.id?"bg-ink-900 text-white":"text-ink-600 hover:bg-ink-50"),children:s==="ar"?e.ar:e.en},e.id))}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(W,{value:f,onChange:e=>A(e.target.value),placeholder:a("Search title or tenant…","ابحث بالعنوان أو المنشأة…"),className:"flex-1 min-w-[200px]"}),t.jsxs(Y,{value:x,onChange:e=>O(e.target.value),className:"w-40",children:[t.jsx("option",{value:"all",children:a("All statuses","كل الحالات")}),Object.keys(p).map(e=>t.jsx("option",{value:e,children:L(p,e,s)},e))]}),k&&t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:()=>b(!0),children:a("Template library","مكتبة القوالب")}),t.jsxs(N,{variant:"primary",onClick:()=>o(null),children:[t.jsx(G,{name:"plus",size:14,className:"me-1"}),a("New quote","عرض جديد")]})]})]})]}),i.isError&&t.jsx(H,{error:i.error,onRetry:()=>i.refetch()}),!i.isLoading&&r.length===0&&t.jsx(E,{title:a("No quotes yet","لا توجد عروض بعد"),body:a("Draft a package for a tenant, send it for review, and a contract activates when they accept.","أعد مسودة عرض للمنشأة، أرسلها للمراجعة، ويُفعّل العقد عند القبول."),cta:k?t.jsx(N,{variant:"primary",onClick:()=>o(null),children:a("Create first quote","أنشئ أول عرض")}):null}),r.length>0&&t.jsxs("div",{className:"flex flex-col gap-3",children:[r.map(e=>{var T;const c=ce(e.valid_until,e.status),C=!c&&me(e.valid_until),R=s==="ar"&&e.t
1itle_ar||e.title_en;return t.jsxs("div",{className:y("card p-4 flex flex-col gap-3 hover:border-ink-300 transition cursor-pointer",C&&"border-amber-200 bg-amber-50/20",c&&e.status==="sent"&&"border-rose-200 bg-rose-50/20"),onClick:()=>o(e.id),onKeyDown:m=>m.key==="Enter"&&o(e.id),role:"button",tabIndex:0,children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"font-semibold text-ink-900 truncate",children:R}),e.tenant&&t.jsx(q,{to:`../relationships/${e.tenant.id}`,onClick:m=>m.stopPropagation(),className:"text-xs text-ink-600 hover:underline mt-0.5 inline-block",children:s==="ar"&&e.tenant.business_ar||e.tenant.business_en})]}),t.jsx("div",{className:"text-end shrink-0",children:t.jsxs("div",{className:"flex flex-col items-end gap-1",children:[t.jsx("div",{className:"font-mono font-semibold tabular-nums",children:J(e.total,s)}),t.jsx(I,{tone:de(p,e.status),dot:!0,children:L(p,e.status,s)}),e.has_terms&&t.jsx(I,{tone:"neutral",children:a("T&C attached","شروط مرفقة")})]})})]}),t.jsx(ee,{status:e.status,hasContract:!!e.contract_id,compact:!0}),t.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-ink-600",children:[e.sent_at&&t.jsxs("span",{children:[a("Sent","أُرسل")," ",X(e.sent_at,s)]}),e.valid_until&&t.jsxs("span",{className:y(c&&"text-rose-600 font-medium",C&&"text-amber-700 font-medium"),children:[a("Valid until","صالح حتى")," ",Z(e.valid_until,s),C&&` · ${a("Soon","قريبًا")}`]}),((T=e.created_by)==null?void 0:T.name)&&t.jsxs("span",{children:[a("By","بواسطة")," ",e.created_by.name]}),e.contract_id&&t.jsx(q,{to:"../contracts",onClick:m=>m.stopPropagation(),className:"text-emerald-700 font-medium hover:underline",children:a("View contract","عرض العقد")})]})]},e.id)}),t.jsx("div",{className:"text-xs text-ink-600 text-end",children:a(`${u(r.length,s)} of ${u(l.length,s)} quotes`,`${u(r.length,s)} من ${u(l.length,s)} عرض`)})]}),t.jsx(te,{open:P,onClose:()=>{g(!1),v(null)},quoteId:$,initialTemplate:F,onInitialTemplateApplied:()=>_(null)}),t.jsx(ae,{open:B,onClose:()=>b(!1),onUseTemplate:K})]}):t.jsx(E,{title:a("Quotes unavailable","العروض غير متاحة"),body:a("You do not have permission to view commercial quotes.","لا تملك صلاحية عرض العروض التجارية.")})}export{_e 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.