Files
machartaa_admin_dist/dist/assets/index-1dad3800.js
T

2 lines
8.6 KiB
JavaScript
Raw Normal View History

2026-06-02 20:08:47 +03:30
import{_ as J}from"./BasicMainCard-6dd48f47.js";import{_ as G}from"./BasicModal.vue_vue_type_style_index_0_lang-c60160bb.js";import{_ as X}from"./BasicInput.vue_vue_type_style_index_0_lang-cb979b48.js";import{_ as K,u as Q}from"./useBaseTable-c7721a03.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-4dc9d3e9.js";import{I as P}from"./Icon-83dbbbe4.js";import{t as Z}from"./useDataTime-7a9ebe02.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-9a17e55b.js";import{_ as le}from"./TextPreview.vue_vue_type_script_setup_true_lang-d2a051b6.js";import{M as ne}from"./index-d5d26f82.js";import{S as re}from"./index-26298d7e.js";import{I as ce}from"./index-369204e0.js";import{T as E}from"./shallowequal-5f876352.js";import{U as ue}from"./index-b78b7a1c.js";import"./_plugin-vue_export-helper-09135f79.js";import"./index-58b0d53e.js";import"./index-f08856bb.js";import"./Col-dc7ee55f.js";import"./vnode-0a46e202.js";import"./useState-6ac08ff3.js";import"./useRefs-707c512d.js";import"./isPlainObject-7dd54c5e.js";import"./usePrice-7afab779.js";import"./index-4182a454.js";import"./toArray-c5dd79c4.js";import"./FormItemContext-101590b9.js";import"./pickAttrs-0804445f.js";import"./index-e6e78cc4.js";import"./index-dad403b6.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-dba94894.js"),["assets/buildSupabaseQuery-dba94894.js","assets/index-9a17e55b.js","assets/index-33951367.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("Ù�قط Ù�ایل‌های Ø