1import{v as se,r as c,s as x,g as y,j as e,B as j,C as S,a as b,t as w}from"./index-DxOFb5q5.js";import{W as I,u as pe,M as je}from"./MainLayout-DtU_Llqf.js";import{I as p}from"./input-CVbPUMku.js";import{L as o}from"./label-7GxXTAVW.js";import{T as _e}from"./textarea-Cmvr5DnJ.js";import{S as J,a as K,b as Q,c as U,d as H}from"./select-D5UGUo-D.js";import{T as te,a as ae,b as T,c as h,d as ne,e as l}from"./table-ME1uwNKv.js";import{D as ie,b as re,c as ce,d as oe,e as le}from"./dialog-DgwIDP3O.js";import{B as de}from"./badge-CVZMAyjp.js";import{S as B}from"./status-toggle-BRxwWpld.js";import{T as ge,a as ve,b as X,c as Y}from"./tabs-CzMufvm2.js";import{S as Z}from"./searchable-select-Dys54PhJ.js";import{P as me}from"./plus-uyLhkU53.js";import{P as fe}from"./pencil-wz2U88f-.js";import{T as xe}from"./trash-2-BoOxGfMY.js";import{L as ye}from"./layers-BvOYfWe-.js";import{M as Ne}from"./map-pin-DO_jsuWP.js";import{S as ee}from"./star-DvvDXrHg.js";import{S as Ce}from"./search-G0uOToOP.js";import{P as we}from"./pen-lY2r311h.js";import"./scroll-area-DnopRVtP.js";import"./index-BcIIhdSh.js";import"./index-BdQq_4o_.js";import"./index-Cqq0Q2R_.js";import"./command-BFn5ANfh.js";import"./index-Dcw69aED.js";import"./Combination-DCNPHtSM.js";import"./menu-QlHo9vH9.js";import"./chevron-right-D6QjocKi.js";import"./chevron-left-RCei6Rf9.js";import"./shield-check-1hkJMTyG.js";import"./database-bp7Ljsd-.js";import"./package-D2mOB_oX.js";import"./ruler-BrO1m_xd.js";import"./store-CwRfK_Md.js";import"./building-2-r7iwwscV.js";import"./landmark-C-TTWCoH.js";import"./file-text-COWAn2T6.js";import"./receipt-BQ0dEskx.js";import"./refresh-cw-svEfoL48.js";import"./file-spreadsheet-CNeCmKU4.js";import"./chart-column-CLiCXUYS.js";import"./activity-CNN2ocS3.js";import"./wallet-DGGNcBKF.js";import"./eye-Dlshx1uz.js";import"./trending-up-B0aavs3A.js";import"./settings-HOD_H3QC.js";import"./users-BVKd5H-E.js";import"./history-nIzksNKw.js";import"./chevron-down-CWi4njHw.js";import"./dropdown-menu-CjAirWC6.js";import"./check-DzIagfLA.js";import"./bell-CD0XGSIW.js";import"./external-link-tmSrGh37.js";
1import"./separator-DEBCOVBC.js";import"./message-square-DgTO1qZn.js";import"./format-C8WnnBHU.js";import"./ar-CbFYuq6n.js";import"./send-Cg1_2Arg.js";import"./circle-check-big-Qz15irJg.js";import"./circle-alert-B2fp0-Vk.js";import"./useQuery-M3eWlJAa.js";import"./globe-DnaTgzo2.js";import"./shopping-cart-z_8fiYSq.js";import"./index-BdK6m1Wq.js";import"./zap-DG0OwecT.js";import"./AnnouncementCard-C0NUbBSm.js";import"./megaphone-D4JgWOFE.js";import"./index-CoAPzOtZ.js";import"./popover-BSng_8EV.js";const Se=()=>{const{tenantId:D}=se(),[g,N]=c.useState([]),[L,P]=c.useState([]),[V,G]=c.useState(!0),[M,_]=c.useState(!1),[k,v]=c.useState(null),[n,u]=c.useState({code:"",name:"",description:"",inventory_account_id:"",adjustment_account_id:"",is_active:!0}),f=c.useMemo(()=>L.map(t=>({value:t.id,label:`${t.code} - ${t.name}`,searchTerms:`${t.code} ${t.name}`})),[L]);c.useEffect(()=>{D&&d()},[D]);const d=async()=>{try{const[t,i]=await Promise.all([x.from("inventory_posting_groups").select("*").order("code"),x.from("accounts").select("id, code, name").eq("is_active",!0).order("code")]);if(t.error)throw t.error;if(i.error)throw i.error;N(t.data||[]),P(i.data||[])}catch(t){console.error("Error fetching data:",t),y.error("خطأ ÙÙ Ø¬ÙØ¨ Ø§ÙØ¨ÙØ§ÙØ§Øª")}finally{G(!1)}},W=t=>{t?(v(t),u({code:t.code,name:t.name,description:t.description||"",inventory_account_id:t.inventory_account_id||"",adjustment_account_id:t.adjustment_account_id||"",is_active:t.is_active})):(v(null),u({code:"",name:"",description:"",inventory_account_id:"",adjustment_account_id:"",is_active:!0})),_(!0)},$=t=>{const i=L.find(C=>C.id===t);return i?{code:i.code,name:i.name}:{code:null,name:null}},R=async()=>{try{if(!n.code||!n.name){y.error("Ø§ÙØ±Ø¬Ø§Ø¡ إدخا٠اÙÙÙØ¯ ÙØ§ÙاسÙ
");return}const t=n.inventory_account_id?$(n.inventory_account_id):{code:null,name:null},i=n.adjustment_account_id?$(n.adjustment_account_id):{code:null,name:null},C={code:n.code,name:n.name,description:n.description||null,inventory_account_id:n.inventory_account_id||null,inventory_account_code:t.code,inventory_account_name:t.name,adjustment_account_id:n.adjustment_account_id||null,adjustment_account_code:i.code,adjustment_account_name:i.name,is_active:n.is_active,tenant_id:D};if(k){const{tenant_id:E,...q}=C,{error:O}=await x.from("inventory_posting_groups").update(q).eq("id",k.id);if(O)throw O;y.success("تÙ
ØªØØ¯ÙØ« Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙ Ø¨ÙØ¬Ø§Ø")}else{const{error:E}=await x.from("inventory_posting_groups").insert(C);if(E)throw E;y.success("تÙ
Ø¥Ø¶Ø§ÙØ© Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙ Ø¨ÙØ¬Ø§Ø")}_(!1),d()}catch(t){console.error("Error saving group:",t),y.error(t.message||"خطأ ÙÙ ØÙظ Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙ")}},a=async t=>{if(confirm("ÙÙ Ø£ÙØª Ù
ØªØ£ÙØ¯ Ù
Ù ØØ°Ù Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙØ"))try{const{error:i}=await x.from("inventory_posting_groups").delete().eq("id",t);if(i)throw i;y.success("تÙ
ØØ°Ù Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙ Ø¨ÙØ¬Ø§Ø"),d()}catch(i){console.error("Error deleting group:",i),y.error(i.message||"خطأ ÙÙ ØØ°Ù Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙ")}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(I,{className:"w-5 h-5 text-primary"}),"Ù
جÙ
ÙØ¹Ø§Øª ترØÙ٠اÙÙ
خزÙÙ"]}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"ربط اÙÙ
خزÙÙ Ø¨ØØ³Ø§Ø¨Ø§Øª اÙÙ
خزÙÙ ÙØ§ÙتسÙÙØ§Øª"})]}),e.jsxs(j,{onClick:()=>W(),className:"gap-2",children:[e.jsx(me,{className:"w-4 h-4"}),"Ø¥Ø¶Ø§ÙØ© Ù
جÙ
ÙØ¹Ø©"]})]}),e.jsx(S,{children:e.jsx(b,{className:"p-0",children:V?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Ø¬Ø§Ø±Ù Ø§ÙØªØÙ
ÙÙ..."}):g.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ÙØ§ ØªÙØ¬Ø¯ Ù
جÙ
ÙØ¹Ø§Øª Ù
خزÙÙ"}):e.jsxs(te,{children:[e.jsx(ae,{children:e.jsxs(T,{children:[e.jsx(h,{className:"text-right",children:"اÙÙÙØ¯"}),e.jsx(h,{className:"text-right",children:"Ø§ÙØ§Ø³Ù
"}),e.jsx(h,{className:"text-right",children:"ØØ³Ø§Ø¨ اÙÙ
خزÙÙ"}),e.jsx(h,{className:"text-right",children:"ØØ³Ø§Ø¨ Ø§ÙØªØ³ÙÙØ§Øª"}),e.jsx(h,{className:"text-right",children:"Ø§ÙØØ§ÙØ©"}),e.jsx(h,{className:"text-right w-24",children:"Ø§ÙØ¥Ø¬Ø±Ø§Ø¡Ø§Øª"})]})}),e.jsx(ne,{children:g.map(t=>e.jsxs(T,{children:[e.jsx(l,{className:"font-mono font-medium",children:t.code}),e.jsx(l,{className:"font-medium",children:t.name}),e.jsx(l,{className:"text-sm text-muted-foreground",children:t.inventory_account_code?`${t.inventory_account_code} - ${t.inventory_account_name}`:"-"}),e.jsx(l,{className:"text-sm text-muted-foreground",children:t.adjustment_account_code?`${t.adjustment_account_code} - ${t.adjustment_account_name}`:"-"}),e.jsx(l,{children:e.jsx(de,{variant:t.is_active?"default":"secondary",children:t.is_active?"ÙØ´Ø·":"ØºÙØ± ÙØ´Ø·"})}),e.jsx(l,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>W(t),children:e.jsx(fe,{className:"w-4 h-4"})}),e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>a(t.id),children:e.jsx(xe,{className:"w-4 h-4 text-destructive"})})]})})]},t.id))})]})})}),e.jsx(ie,{open:M,onOpenChange:_,children:e.jsxs(re,{className:"max-w-lg",children:[e.jsx(ce,{children:e.jsx(oe,{children:k?"تعدÙÙ Ù
جÙ
ÙØ¹Ø© اÙÙ
خزÙÙ":"Ø¥Ø¶Ø§ÙØ© Ù
جÙ
ÙØ¹Ø© Ù
خزÙÙ Ø¬Ø¯ÙØ¯Ø©"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"اÙÙÙØ¯ *"}),e.jsx(p,{value:n.code,onChange:t=>u({...n,code:t.target.value}),placeholder:"INV"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"Ø§ÙØ§Ø³Ù
*"}),e.jsx(p,{value:n.name,onChange:t=>u({...n,name:t.target.value}),placeholder:"Ù
خزÙ٠عاÙ
"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"اÙÙØµÙ"}),e.jsx(p,{value:n.description,onChange:t=>u({...n,description:t.target.value}),placeholder:"ÙØµÙ اÙÙ
جÙ
ÙØ¹Ø©"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"ØØ³Ø§Ø¨ اÙÙ
خزÙÙ"}),e.jsx(Z,{options:f,value:n.inventory_account_id,onValueChange:t=>u({...n,inventory_account_id:t}),placeholder:"اختر ØØ³Ø§Ø¨ اÙÙ
خزÙÙ",searchPlaceholder:"Ø§Ø¨ØØ« Ø¨Ø§ÙØ§Ø³Ù
أ٠رÙÙ
Ø§ÙØØ³Ø§Ø¨...",emptyMessage:"ÙØ§ ØªÙØ¬Ø¯ ØØ³Ø§Ø¨Ø§Øª"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"ØØ³Ø§Ø¨ تسÙÙØ§Øª اÙÙ
خزÙÙ"}),e.jsx(Z,{options:f,value:n.adjustment_account_id,onValueChange:t=>
1u({...n,adjustment_account_id:t}),placeholder:"اختر ØØ³Ø§Ø¨ Ø§ÙØªØ³ÙÙØ§Øª",searchPlaceholder:"Ø§Ø¨ØØ« Ø¨Ø§ÙØ§Ø³Ù
أ٠رÙÙ
Ø§ÙØØ³Ø§Ø¨...",emptyMessage:"ÙØ§ ØªÙØ¬Ø¯ ØØ³Ø§Ø¨Ø§Øª"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(o,{children:"Ø§ÙØØ§ÙØ©"}),e.jsx(B,{checked:n.is_active,onCheckedChange:t=>u({...n,is_active:t})})]})]}),e.jsxs(le,{children:[e.jsx(j,{variant:"outline",onClick:()=>_(!1),children:"Ø¥ÙØºØ§Ø¡"}),e.jsx(j,{onClick:R,children:"ØÙظ"})]})]})})]})},Rs=()=>{var z;const{t:D}=pe(),{tenantId:g}=se(),[N,L]=c.useState([]),[P,V]=c.useState([]),[G,M]=c.useState(!0),[_,k]=c.useState(""),[v,n]=c.useState("all"),[u,f]=c.useState(!1),[d,W]=c.useState(null),[$,R]=c.useState("warehouses"),[a,t]=c.useState({code:"",name:"",name_en:"",description:"",address:"",city:"",country:"Ø§ÙØ³Ø¹ÙØ¯ÙØ©",inventory_posting_group_id:"",is_default:!1,is_active:!0});c.useEffect(()=>{g&&i()},[g]);const i=async()=>{M(!0);try{const[s,r]=await Promise.all([x.from("warehouses").select("*").order("code"),x.from("inventory_posting_groups").select("*").eq("is_active",!0).order("name")]);s.data&&L(s.data),r.data&&V(r.data)}catch(s){console.error("Error fetching data:",s),w({title:"خطأ Ù٠تØÙ
ÙÙ Ø§ÙØ¨ÙØ§ÙØ§Øª",variant:"destructive"})}finally{M(!1)}},C=()=>{t({code:"",name:"",name_en:"",description:"",address:"",city:"",country:"Ø§ÙØ³Ø¹ÙØ¯ÙØ©",inventory_posting_group_id:"",is_default:!1,is_active:!0})},E=async()=>{if(!g)return"WH-000001";try{const{data:s,error:r}=await x.from("warehouses").select("code").eq("tenant_id",g).like("code","WH-%").order("code",{ascending:!1}).limit(1);if(r)throw r;if(s&&s.length>0){const A=s[0].code.match(/WH-(\d+)/);if(A){const ue=parseInt(A[1],10)+1;return`WH-${String(ue).padStart(6,"0")}`}}return"WH-000001"}catch(s){return console.error("Error generating code:",s),"WH-000001"}},q=async s=>{if(C(),s)W(s),t({code:s.code,name:s.name,name_en:s.name_en||"",description:s.description||"",address:s.address||"",city:s.city||"",country:s.country||"Ø§ÙØ³Ø¹ÙØ¯ÙØ©",inventory_posting_group_id:s.inventory_posting_group_id||"",is_default:s.is_default,is_active:s.is_active});else{W(null);const r=await E();t(m=>({...m,code:r}))}f(!0)},O=async()=>{if(!a.code.trim()||!a.name.trim()){w({title:"Ø§ÙØ±Ø¬Ø§Ø¡ إدخا٠اÙÙÙØ¯ ÙØ§ÙاسÙ
",variant:"destructive"});return}try{const s=P.find(m=>m.id===a.inventory_posting_group_id),r={code:a.code,name:a.name,name_en:a.name_en||null,description:a.description||null,address:a.address||null,city:a.city||null,country:a.country||null,inventory_posting_group_id:a.inventory_posting_group_id||null,inventory_posting_group_code:(s==null?void 0:s.code)||null,inventory_posting_group_name:(s==null?void 0:s.name)||null,is_default:a.is_default,is_active:a.is_active};if(a.is_default&&await x.from("warehouses").update({is_default:!1}).neq("id",(d==null?void 0:d.id)||""),d){const{error:m}=await x.from("warehouses").update(r).eq("id",d.id);if(m)throw m}else{const{error:m}=await x.from("warehouses").insert({...r,tenant_id:g});if(m)throw m}w({title:d?"تÙ
ØªØØ¯ÙØ« اÙÙ
Ø³ØªÙØ¯Ø¹":"تÙ
Ø¥Ø¶Ø§ÙØ© اÙÙ
Ø³ØªÙØ¯Ø¹"}),f(!1),i()}catch(s){console.error("Error saving warehouse:",s),w({title:"خطأ ÙÙ ØÙظ اÙÙ
Ø³ØªÙØ¯Ø¹",description:s.message,variant:"destructive"})}},he=async s=>{if(confirm("ÙÙ Ø£ÙØª Ù
ØªØ£ÙØ¯ Ù
Ù ØØ°Ù ÙØ°Ø§ اÙÙ
Ø³ØªÙØ¯Ø¹Ø"))try{const{error:r}=await x.from("warehouses").delete().eq("id",s);if(r)throw r;w({title:"تÙ
ØØ°Ù اÙÙ
Ø³ØªÙØ¯Ø¹"}),i()}catch(r){console.error("Error deleting warehouse:",r),w({title:"خطأ ÙÙ ØØ°Ù اÙÙ
Ø³ØªÙØ¯Ø¹",description:r.message,variant:"destructive"})}},F=N.filter(s=>{const r=s.code.toLowerCase().includes(_.toLowerCase())||s.name.toLowerCase().includes(_.toLowerCase())||s.name_en&&s.name_en.toLowerCase().includes(_.toLowerCase()),m=v==="all"||(v==="__none__"?!s.inventory_posting_group_id:s.inventory_posting_group_id===v);return r&&m});return e.jsx(je,{title:D("warehouses.title"),children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(I,{className:"w-7 h-7 text-primary"}),"إدارة اÙÙ
Ø³ØªÙØ¯Ø¹Ø§Øª"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"إدارة اÙÙ
Ø³ØªÙØ¯Ø¹Ø§Øª ÙÙ
جÙ
ÙØ¹Ø§Øª ترØÙ٠اÙÙ
خزÙÙ"})]})}),e.jsxs(ge,{value:$,onValueChange:R,className:"w-full",children:[e.jsxs(ve,{className:"grid w-full max-w-md grid-cols-2",children:[e.jsxs(X,{value:"warehouses",className:"gap-2",children:[e.jsx(I,{className:"w-4 h-4"}),"اÙÙ
Ø³ØªÙØ¯Ø¹Ø§Øª"]}),e.jsxs(X,{value:"posting-groups",className:"gap-2",children:[e.jsx(ye,{className:"w-4 h-4"}),"Ù
جÙ
ÙØ¹Ø§Øª Ø§ÙØªØ±ØÙÙ"]})]}),e.jsxs(Y,{value:"warehouses",className:"space-y-6 mt-6",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs(j,{onClick:()=>q(),className:"gap-2",children:[e.jsx(me,{className:"w-4 h-4"}),"Ø¥Ø¶Ø§ÙØ© Ù
Ø³ØªÙØ¯Ø¹"]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(S,{children:e.jsx(b,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"إجÙ
اÙ٠اÙÙ
Ø³ØªÙØ¯Ø¹Ø§Øª"}),e.jsx("p",{className:"text-2xl font-bold",children:N.length})]}),e.jsx(I,{className:"w-8 h-8 text-primary opacity-80"})]})})}),e.jsx(S,{children:e.jsx(b,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Ù
Ø³ØªÙØ¯Ø¹Ø§Øª ÙØ´Ø·Ø©"}),e.jsx("p",{className:"text-2xl font-bold",children:N.filter(s=>s.is_active).length})]}),e.jsx(Ne,{className:"w-8 h-8 text-green-500 opacity-80"})]})})}),e.jsx(S,{children:e.jsx(b,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"اÙÙ
Ø³ØªÙØ¯Ø¹ Ø§ÙØ§ÙتراضÙ"}),e.jsx("p",{className:"text-lg font-bold truncate",children:((z=N.find(s=>s.is_default))==null?void 0:z.name)||"ØºÙØ± Ù
ØØ¯Ø¯"})]}),e.jsx(ee,{className:"w-8 h-8 text-yellow-500 opacity-80"})]})})})]}),e.jsx(S,{children:e.jsx(b,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ce,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(p,{placeholder:"Ø¨ØØ« باÙÙÙØ¯ Ø£Ù Ø§ÙØ§Ø³Ù
...",value:_,onCh
1ange:s=>k(s.target.value),className:"pr-10"})]}),e.jsxs(J,{value:v,onValueChange:n,children:[e.jsx(K,{className:"w-full sm:w-56",children:e.jsx(Q,{placeholder:"Ù
جÙ
ÙØ¹Ø© ترØÙ٠اÙÙ
خزÙÙ"})}),e.jsxs(U,{children:[e.jsx(H,{value:"all",children:"ÙÙ Ù
جÙ
ÙØ¹Ø§Øª Ø§ÙØªØ±ØÙÙ"}),e.jsx(H,{value:"__none__",children:"بدÙÙ Ù
جÙ
ÙØ¹Ø© ترØÙÙ"}),P.map(s=>e.jsxs(H,{value:s.id,children:[s.code," - ",s.name]},s.id))]})]})]})})}),e.jsx(S,{children:e.jsx(b,{className:"p-0",children:e.jsxs(te,{children:[e.jsx(ae,{children:e.jsxs(T,{children:[e.jsx(h,{className:"text-right",children:"اÙÙÙØ¯"}),e.jsx(h,{className:"text-right",children:"Ø§ÙØ§Ø³Ù
"}),e.jsx(h,{className:"text-right",children:"اÙÙ
دÙÙØ©"}),e.jsx(h,{className:"text-right",children:"Ù
جÙ
ÙØ¹Ø© Ø§ÙØªØ±ØÙÙ"}),e.jsx(h,{className:"text-right",children:"Ø§ÙØØ§ÙØ©"}),e.jsx(h,{className:"text-right w-24",children:"Ø§ÙØ¥Ø¬Ø±Ø§Ø¡Ø§Øª"})]})}),e.jsx(ne,{children:G?e.jsx(T,{children:e.jsx(l,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"Ø¬Ø§Ø±Ù Ø§ÙØªØÙ
ÙÙ..."})}):F.length===0?e.jsx(T,{children:e.jsx(l,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"ÙØ§ ØªÙØ¬Ø¯ Ù
Ø³ØªÙØ¯Ø¹Ø§Øª"})}):F.map(s=>e.jsxs(T,{children:[e.jsx(l,{className:"font-mono font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.code,s.is_default&&e.jsx(ee,{className:"w-4 h-4 text-yellow-500 fill-yellow-500"})]})}),e.jsx(l,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.name}),s.name_en&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.name_en})]})}),e.jsx(l,{children:s.city||"-"}),e.jsx(l,{children:s.inventory_posting_group_name||"-"}),e.jsx(l,{children:e.jsx(de,{variant:s.is_active?"default":"secondary",children:s.is_active?"ÙØ´Ø·":"ØºÙØ± ÙØ´Ø·"})}),e.jsx(l,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>q(s),children:e.jsx(we,{className:"w-4 h-4"})}),e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>he(s.id),children:e.jsx(xe,{className:"w-4 h-4 text-destructive"})})]})})]},s.id))})]})})})]}),e.jsx(Y,{value:"posting-groups",className:"mt-6",children:e.jsx(Se,{})})]}),e.jsx(ie,{open:u,onOpenChange:f,children:e.jsxs(re,{className:"max-w-2xl",children:[e.jsx(ce,{children:e.jsxs(oe,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"w-5 h-5"}),d?"تعدÙÙ Ù
Ø³ØªÙØ¯Ø¹":"Ø¥Ø¶Ø§ÙØ© Ù
Ø³ØªÙØ¯Ø¹ Ø¬Ø¯ÙØ¯"]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"اÙÙÙØ¯ *"}),e.jsx(p,{value:a.code,onChange:s=>t({...a,code:s.target.value}),placeholder:"WH-001"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"Ù
جÙ
ÙØ¹Ø© ترØÙ٠اÙÙ
خزÙÙ"}),e.jsxs(J,{value:a.inventory_posting_group_id||"__none__",onValueChange:s=>t({...a,inventory_posting_group_id:s==="__none__"?"":s}),children:[e.jsx(K,{children:e.jsx(Q,{placeholder:"اختر اÙÙ
جÙ
ÙØ¹Ø©"})}),e.jsxs(U,{children:[e.jsx(H,{value:"__none__",children:"ØºÙØ± Ù
ØØ¯Ø¯"}),P.map(s=>e.jsxs(H,{value:s.id,children:[s.name," (",s.code,")"]},s.id))]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"Ø§ÙØ§Ø³Ù
Ø¨Ø§ÙØ¹Ø±Ø¨Ù *"}),e.jsx(p,{value:a.name,onChange:s=>t({...a,name:s.target.value}),placeholder:"اÙÙ
Ø³ØªÙØ¯Ø¹ Ø§ÙØ±Ø¦ÙسÙ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"Ø§ÙØ§Ø³Ù
Ø¨Ø§ÙØ¥ÙجÙÙØ²Ù"}),e.jsx(p,{value:a.name_en,onChange:s=>t({...a,name_en:s.target.value}),placeholder:"Main Warehouse",dir:"ltr"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"اÙÙØµÙ"}),e.jsx(_e,{value:a.description,onChange:s=>t({...a,description:s.target.value}),placeholder:"ÙØµÙ اÙÙ
Ø³ØªÙØ¯Ø¹...",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"Ø§ÙØ¹ÙÙØ§Ù"}),e.jsx(p,{value:a.address,onChange:s=>t({...a,address:s.target.value}),placeholder:"عÙÙØ§Ù اÙÙ
Ø³ØªÙØ¯Ø¹"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"اÙÙ
دÙÙØ©"}),e.jsx(p,{value:a.city,onChange:s=>t({...a,city:s.target.value}),placeholder:"Ø§ÙØ±Ùاض"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{children:"Ø§ÙØ¯ÙÙØ©"}),e.jsx(p,{value:a.country,onChange:s=>t({...a,country:s.target.value}),placeholder:"Ø§ÙØ³Ø¹ÙØ¯ÙØ©"})]})]}),e.jsxs("div",{className:"flex items-center gap-6 pt-2",children:[e.jsx(B,{checked:a.is_default,onCheckedChange:s=>t({...a,is_default:s}),activeLabel:"Ø§ÙØªØ±Ø§Ø¶Ù",inactiveLabel:"ØºÙØ± Ø§ÙØªØ±Ø§Ø¶Ù"}),e.jsx(B,{checked:a.is_active,onCheckedChange:s=>t({...a,is_active:s}),activeLabel:"ÙØ´Ø·",inactiveLabel:"ØºÙØ± ÙØ´Ø·"})]})]}),e.jsxs(le,{children:[e.jsx(j,{variant:"outline",onClick:()=>f(!1),children:"Ø¥ÙØºØ§Ø¡"}),e.jsx(j,{onClick:O,children:d?"ØªØØ¯ÙØ«":"Ø¥Ø¶Ø§ÙØ©"})]})]})})]})})};export{Rs 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.