2026-06-10 09:58:41 +03:30
|
|
|
|
import{_ as J}from"./BasicMainCard-e2dfb6d9.js";import{_ as G}from"./BasicModal.vue_vue_type_style_index_0_lang-99634238.js";import{_ as X}from"./BasicInput.vue_vue_type_style_index_0_lang-a7d09959.js";import{_ as K,u as Q}from"./useBaseTable-3a4f53a2.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-8765e25f.js";import{I as P}from"./Icon-60e3c304.js";import{t as Z}from"./useDataTime-285e1718.js";import{_ as ee,H as S,d as te,g as b,o as $,c as D,b as r,w as f,a as s,e as ae,E as se,j as B,k as R,y as oe,t as ie,C as g,G as le}from"./index-1beefa05.js";import{g as q}from"./convert-67c23be8.js";import{_ as ne}from"./TextPreview.vue_vue_type_script_setup_true_lang-0082556c.js";import{M as re}from"./index-3f80ad39.js";import{S as ce}from"./index-ef9fcf14.js";import{I as ue}from"./index-4e059fa0.js";import{T as A}from"./shallowequal-357ba472.js";import{U as de}from"./index-9647c637.js";import"./_plugin-vue_export-helper-9bf5ed57.js";import"./index-bd9f46bd.js";import"./index-303d4c99.js";import"./Col-e360614b.js";import"./vnode-974afe87.js";import"./useState-5c0b3be7.js";import"./useRefs-b1b4b2a7.js";import"./isPlainObject-9ae7bad9.js";import"./usePrice-7afab779.js";import"./fa_IR-e37a011e.js";import"./toArray-c0d32b50.js";import"./FormItemContext-fc4201d7.js";import"./pickAttrs-0c8a47ec.js";import"./lodash-b971ee55.js";import"./index-8452369b.js";import"./index-a93218c8.js";const me=[{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 pe(o){const{data:p,error:c}=await S.from("images_book").insert([o]).select();if(c)throw c;return p}async function _e(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 fe(o){const{error:p}=await S.from("images_book").delete().eq("id",o);if(p)throw p}async function ge(o){const{TableEngineRequest:p}=await ee(()=>import("./buildSupabaseQuery-78a7461d.js"),["assets/buildSupabaseQuery-78a7461d.js","assets/index-1beefa05.js","assets/index-5d811526.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 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=s("h2",null,"تصاویر کتاب",-1),xe={class:"gap-2 flex justify-center"},ye=s("span",null,"ØØ°Ù�",-1),be=s("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=s("div",{class:"mb-1 text-sm text-gray-600"},"عنوان",-1),Be=s("div",{class:"mb-1 text-sm text-gray-600"},"ØªÙˆØ¶ÛŒØØ§Øª",-1),Te=s("div",{class:"mb-1 text-sm text-gray-600"},"آپلود تصویر",-1),Ce={key:0},Me=s("div",null,"آپلود تصویر",-1),Ue={key:0,class:"mt-1"},$e={class:"h-2 rounded bg-gray-200 overflow-hidden"},De={class:"text-xs text-gray-700 font-semibold text-center mt-1"},ct=te({__name:"index",setup(o){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("image/")?a.size/1024/1024<5?!0:(g.error("ØØ¬Ù… تصویر بایØ
|