Files
machartaa_admin_dist/dist/assets/index-7cd21466.js
T

2 lines
8.6 KiB
JavaScript
Raw Normal View History

2026-06-01 18:38:29 +03:30
import{_ as J}from"./BasicMainCard-f5011b39.js";import{_ as G}from"./BasicModal.vue_vue_type_style_index_0_lang-a547157a.js";import{_ as X}from"./BasicInput.vue_vue_type_style_index_0_lang-5aefde0f.js";import{_ as K,u as Q}from"./useBaseTable-13b436e1.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-851afdd8.js";import{I as P}from"./Icon-04c02c0b.js";import{t as Z}from"./useDataTime-10f46d84.js";import{_ as ee,I as S,d as te,g as b,o as U,c as D,b as r,w as f,a as s,e as ae,G as se,j as T,k as R,z as oe,t as ie,D as g,H as z}from"./index-82b07f49.js";import{_ as le}from"./TextPreview.vue_vue_type_script_setup_true_lang-38b465eb.js";import{M as ne}from"./index-5dc3a2fa.js";import{S as re}from"./index-1f61ecf5.js";import{I as ce}from"./index-c6d6dccd.js";import{T as E}from"./shallowequal-17b27246.js";import{U as ue}from"./index-0f0f5d8d.js";import"./_plugin-vue_export-helper-f81f33f1.js";import"./index-ad11eb53.js";import"./index-a4d2dbbb.js";import"./Col-5d52aed9.js";import"./vnode-007df887.js";import"./useState-e0a5bff5.js";import"./useRefs-e9385981.js";import"./isPlainObject-f3a46277.js";import"./usePrice-7afab779.js";import"./index-7e5faec0.js";import"./toArray-e3bbd719.js";import"./FormItemContext-f4f190fd.js";import"./pickAttrs-b9acd388.js";import"./index-d634ff29.js";import"./index-2a5d6560.js";const de=[{title:"ردیÙ�",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:o=>o.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"توضیحات",dataIndex:"description",key:"description",slot:"description"},{title:"تصویر",dataIndex:"src_img",key:"src_img",customRender:o=>o.record.src_img||"-"},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:o=>Z(o.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}];async function me(o){const{data:p,error:c}=await S.from("images_book").insert([o]).select();if(c)throw c;return p}async function pe(o,p){const{data:c,error:d}=await S.from("images_book").update(p).eq("id",o).select();if(d)throw d;return c}async function _e(o){const{error:p}=await S.from("images_book").delete().eq("id",o);if(p)throw p}async function fe(o){const{TableEngineRequest:p}=await ee(()=>import("./buildSupabaseQuery-4056c4b8.js"),["assets/buildSupabaseQuery-4056c4b8.js","assets/index-82b07f49.js","assets/index-f86b861c.css"]),c={...o};!c.sort&&!c.order&&(c.order="-id");const d=await p(c,"images_book");try{if(Array.isArray(d==null?void 0:d.rows)){const $=c.page||1,k=c.limit||200,w=($-1)*k,I=d.rows.map((u,v)=>({id:u.id,title:u.title??null,description:u.description??null,src_img:u.src_img??null,created_at:u.created_at??"",index:w+v,...u}));return{...d,rows:I}}}catch($){console.log("[getImagesBookTable] normalize error:",$)}return d}const ge={class:"flex justify-between items-center mb-4"},ve=s("h2",null,"تصاویر کتاب",-1),he={class:"gap-2 flex justify-center"},xe=s("span",null,"حذÙ�",-1),ye=s("span",null,"ویرایش",-1),be={class:"space-y-4 relative"},ke={key:0,class:"absolute inset-0 bg-white/60 z-10 flex items-center justify-center"},we=s("div",{class:"mb-1 text-sm text-gray-600"},"عنوان",-1),Ie=s("div",{class:"mb-1 text-sm text-gray-600"},"توضیحات",-1),Be=s("div",{class:"mb-1 text-sm text-gray-600"},"آپلود تصویر",-1),Te={key:0},$e=s("div",null,"آپلود تصویر",-1),Ce={key:0,class:"mt-1"},Me={class:"h-2 rounded bg-gray-200 overflow-hidden"},Ue={class:"text-xs text-gray-700 font-semibold text-center mt-1"},lt=te({__name:"index",setup(o){const{TextArea:p}=ce,[c,d]=Q(),$=b({columns:de,api:fe,defaultPageLimit:20}),k=b(!1),w=b(!1),I=b(null),u=b([]),v=b(0),h=b(0),_=b({title:null,description:null,src_img:null});function N(){u.value=[],w.value=!1,I.value=null,_.value={title:null,description:null,src_img:null},k.value=!0}function q(){k.value=!1}function O(a){return a.type.startsWith("image/")?a.size/1024/1024<5?!0:(g.error("حجم تصویر باید کمتر از 5MB باشد!"),!1):(g.error("Ù�قط Ù�ایل‌های Ø