Files
machartaa_admin_dist/dist/assets/index-ca35b9d4.js
T

2 lines
8.6 KiB
JavaScript
Raw Normal View History

2026-06-18 20:24:23 +03:30
import{_ as J}from"./BasicMainCard-9d8af607.js";import{_ as G}from"./BasicModal.vue_vue_type_style_index_0_lang-2c965652.js";import{_ as X}from"./BasicInput.vue_vue_type_style_index_0_lang-96e71e2f.js";import{_ as K,u as Q}from"./useBaseTable-e8654654.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-61c18c46.js";import{I as P}from"./Icon-b952e603.js";import{t as Z}from"./useDataTime-6319c12a.js";import{_ as ee,I as S,d as te,g as b,o as D,c as $,b as r,w as f,a as o,e as ae,G as oe,j as B,k as R,y as se,t as ie,D as g,H as le}from"./index-fe7e9f3a.js";import{g as A}from"./convert-67c23be8.js";import{_ as ne}from"./TextPreview.vue_vue_type_script_setup_true_lang-375dd543.js";import{M as re}from"./index-4bebce71.js";import{S as ce}from"./index-c3b05d68.js";import{I as ue}from"./index-6e5ff446.js";import{T as E}from"./shallowequal-84daf276.js";import{U as de}from"./index-207b9df5.js";import"./index-a0d96113.js";import"./index-66219801.js";import"./_plugin-vue_export-helper-84433aaa.js";import"./Col-4a3e6527.js";import"./vnode-4e2eb49f.js";import"./useState-fbb2e402.js";import"./useRefs-f56804c8.js";import"./index-265527df.js";import"./isPlainObject-8df7c091.js";import"./usePrice-bc935b83.js";import"./fa_IR-23a1f71d.js";import"./toArray-1e9f5cfb.js";import"./FormItemContext-b538849a.js";import"./pickAttrs-c6e9cc38.js";import"./lodash-7b4e0250.js";import"./index-63f18912.js";import"./index-9caf69a4.js";const me=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:s=>s.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"توضیحات",dataIndex:"description",key:"description",slot:"description"},{title:"تصویر",dataIndex:"src_img",key:"src_img",customRender:s=>s.record.src_img||"-"},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:s=>Z(s.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}];async function pe(s){const{data:p,error:c}=await S.from("images_book").insert([s]).select();if(c)throw c;return p}async function _e(s,p){const{data:c,error:d}=await S.from("images_book").update(p).eq("id",s).select();if(d)throw d;return c}async function fe(s){const{error:p}=await S.from("images_book").delete().eq("id",s);if(p)throw p}async function ge(s){const{TableEngineRequest:p}=await ee(()=>import("./buildSupabaseQuery-64c97ab8.js"),["assets/buildSupabaseQuery-64c97ab8.js","assets/index-fe7e9f3a.js","assets/index-457f5e42.css","assets/supabaseTableQuery-be932edd.js"]),c={...s};!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 T=c.page||1,k=c.limit||200,w=(T-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(T){console.log("[getImagesBookTable] normalize error:",T)}return d}const ve={class:"flex justify-between items-center mb-4"},he=o("h2",null,"تصاویر کتاب",-1),xe={class:"gap-2 flex justify-center"},ye=o("span",null,"حذف",-1),be=o("span",null,"ویرایش",-1),ke={class:"space-y-4 relative"},we={key:0,class:"absolute inset-0 bg-white/60 z-10 flex items-center justify-center"},Ie=o("div",{class:"mb-1 text-sm text-gray-600"},"عنوان",-1),Be=o("div",{class:"mb-1 text-sm text-gray-600"},"توضیحات",-1),Te=o("div",{class:"mb-1 text-sm text-gray-600"},"آپلود تصویر",-1),Ce={key:0},Me=o("div",null,"آپلود تصویر",-1),Ue={key:0,class:"mt-1"},De={class:"h-2 rounded bg-gray-200 overflow-hidden"},$e={class:"text-xs text-gray-700 font-semibold text-center mt-1"},ut=te({__name:"index",setup(s){const{TextArea:p}=ue,[c,d]=Q(),T=b({columns:me,api:ge,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 z(){k.value=!1}function O(a){return a.type.startsWith