Files
machartaa_admin_dist/dist/assets/index-6efd721f.js
T

2 lines
13 KiB
JavaScript
Raw Normal View History

2026-06-01 18:38:29 +03:30
import{_ as A,u as F}from"./useBaseTable-13b436e1.js";import{_ as S}from"./button.vue_vue_type_style_index_0_lang-851afdd8.js";import{I as U,u as O}from"./Icon-04c02c0b.js";import{M as N}from"./index-5dc3a2fa.js";import{d as I,h as V,o as v,i as q,w as _,a as y,J as $,k as T,c as x,t as P,b as m,G as M,j as h,aa as Y,_ as z,I as w,r as H,P as G,D as f,g as C}from"./index-82b07f49.js";import{_ as J}from"./BasicInput.vue_vue_type_style_index_0_lang-5aefde0f.js";import{F as L,_ as B}from"./index-2a5d6560.js";import{m as Q}from"./index-7e5faec0.js";import{T as R}from"./shallowequal-17b27246.js";import"./_plugin-vue_export-helper-f81f33f1.js";import"./vnode-007df887.js";import"./useState-e0a5bff5.js";import"./FormItemContext-f4f190fd.js";import"./BasicModal.vue_vue_type_style_index_0_lang-a547157a.js";import"./index-1f61ecf5.js";import"./Col-5d52aed9.js";import"./index-c6d6dccd.js";import"./isPlainObject-f3a46277.js";import"./index-d634ff29.js";import"./pickAttrs-b9acd388.js";import"./toArray-e3bbd719.js";import"./usePrice-7afab779.js";const W={class:"flex items-center justify-between"},X={key:1},Z={key:2},K={class:"flex items-center gap-2"},ee={class:"flex text-gray-400 items-center gap-2"},te={key:0,class:"flex items-center gap-2"},se={key:0},ae={key:0},re=I({__name:"Modal",props:{centered:{type:Boolean,default:!0},wrapClassName:{default:""},cancelText:{default:"انصراف"},okText:{default:"بستن"},okButtonProps:{default:{}},cancelButtonProps:{default:{}},okType:{default:"primary"},showCancel:{type:Boolean,default:!0},showOk:{type:Boolean,default:!0},title:{default:""},maskClosable:{type:Boolean,default:!1}},setup(a){const t=a,{prefixCls:s}=O("base-model"),{emit:e}=Y(),r=V(()=>`${s} ${t.wrapClassName}`);function l(o){e("cancel",o),e("update:visible",!1)}function d(o){e("ok",o)}return(o,n)=>{const i=S,c=N;return v(),q(c,{centered:t.centered,wrapClassName:h(r),"mask-closable":t.maskClosable},{title:_(()=>[y("div",W,[y("div",null,[o.$slots.title?$(o.$slots,"title",{key:0}):T("",!0),t.title?(v(),x("span",X,P(t.title),1)):(v(),x("span",Z," "))]),y("div",K,[y("div",ee,[m(U,{icon:"vuesax-linear:add",class:"rotate-45 cursor-pointer",onClick:l})])])])]),footer:_(()=>[o.$slots.footer?T("",!0):(v(),x("div",te,[t.showOk?(v(),q(i,M({key:0,type:t.okType},o.okButtonProps,{onClick:d}),{default:_(()=>[o.$slots.okText?$(o.$slots,"okText",{key:1}):(v(),x("span",se,P(t.okText),1))]),_:3},16,["type"])):T("",!0),t.showCancel?(v(),q(i,M({key:1},o.cancelButtonProps,{onClick:l}),{default:_(()=>[o.$slots.cancelText?$(o.$slots,"cancelText",{key:1}):(v(),x("span",ae,P(t.cancelText),1))]),_:3},16)):T("",!0)])),$(o.$slots,"footer")]),default:_(()=>[$(o.$slots,"default")]),_:3},8,["centered","wrapClassName","mask-closable"])}}});const oe=async a=>{const{TableEngineRequest:t}=await z(()=>import("./buildSupabaseQuery-4056c4b8.js"),["assets/buildSupabaseQuery-4056c4b8.js","assets/index-82b07f49.js","assets/index-f86b861c.css"]),s={...a};!s.sort&&!s.order&&(s.order="-created_at");const e=await t(s,"users");try{if(Array.isArray(e==null?void 0:e.rows)){const r=e.rows.map(l=>({id:l.id??null,first_name:l.first_name||"",last_name:l.last_name||"",phone:l.phone||"",fname:l.first_name||"",lname:l.last_name||"",mobile:l.phone||"",...l}));return{...e,rows:r}}}catch(r){console.log("[getMembersTable] normalize error:",r)}return e},j=async a=>{const{data:t,error:s}=await w.from("users").select("*").eq("id",a).single();if(s)throw s;return{id:t.id??null,first_name:t.first_name||"",last_name:t.last_name||"",phone:t.phone||"",fname:t.first_name||"",lname:t.last_name||"",mobile:t.phone||"",...t}},ne=async a=>{const t={};a.first_name&&a.first_name.trim()!==""&&(t.first_name=a.first_name.trim()),a.last_name&&a.last_name.trim()!==""&&(t.last_name=a.last_name.trim()),a.phone&&a.phone.trim()!==""&&(t.phone=a.phone.trim());const{data:s,error:e}=await w.from("users").select("id, user_id").order("created_at",{ascending:!1}).limit(100);if(e||!s||s.length===0)throw new Error("برای ایجاد کاربر جدید، حداقل یک کاربر باید در سیستم وجود