Files
machartaa_admin_dist/dist/assets/index-315962b0.js
T

2 lines
6.2 KiB
JavaScript
Raw Normal View History

2026-07-04 17:32:23 +03:30
import{_ as E}from"./BasicModal.vue_vue_type_style_index_0_lang-4effc2b1.js";import{_ as R}from"./BasicInput.vue_vue_type_style_index_0_lang-4069ac1c.js";import{_ as $,u as P}from"./useBaseTable-c909e392.js";import{_ as A}from"./button.vue_vue_type_style_index_0_lang-a7c15404.js";import{I as y}from"./Icon-f0620776.js";import{t as O}from"./useDataTime-e4f5bf79.js";import{_ as q,H as b,d as N,g as v,o as U,c as j,b as l,w as d,e as z,a as c,j as h,t as H,G as L,D as p}from"./index-14c3003c.js";import{M as F}from"./index-77af8dcc.js";import{I as G}from"./index-866e6f6b.js";import{T as g}from"./shallowequal-a5ad9c9b.js";import"./index-43497ac0.js";import"./vnode-0d5a6b01.js";import"./styleChecker-569634cf.js";import"./_plugin-vue_export-helper-9d873422.js";import"./usePrice-bc935b83.js";import"./fa_IR-245a648a.js";import"./toArray-f191f093.js";import"./FormItemContext-8fd31893.js";import"./pickAttrs-c4f5e9cb.js";import"./useState-f0d82672.js";import"./lodash-3dfbaf74.js";import"./css-e89e37f1.js";import"./DialogWrap-0c54c10f.js";import"./index-96a49d7d.js";import"./isPlainObject-c274713e.js";const J=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:a=>a.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"کد embed",dataIndex:"embed_code",key:"embed_code",customRender:a=>a.record.embed_code?"دارد":"-"},{title:"ترتیب",dataIndex:"sort_order",key:"sort_order",align:"center"},{title:"نمایش",dataIndex:"show",key:"show",align:"center",customRender:a=>a.record.show===!1?"مخفی":"نمایش"},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:a=>O(a.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}];async function K(a){const{data:n,error:i}=await b.from("music_macharta_videos").insert([a]).select();if(i)throw i;return n}async function Q(a,n){const{data:i,error:o}=await b.from("music_macharta_videos").update({...n,updated_at:new Date().toISOString()}).eq("id",a).select();if(o)throw o;return i}async function W(a,n){const{data:i,error:o}=await b.from("music_macharta_videos").update({show:n,updated_at:new Date().toISOString()}).eq("id",a).select();if(o)throw o;return i}async function X(a){const{error:n}=await b.from("music_macharta_videos").delete().eq("id",a);if(n)throw n}async function Y(a){const{TableEngineRequest:n}=await q(()=>import("./buildSupabaseQuery-267b483f.js"),["assets/buildSupabaseQuery-267b483f.js","assets/index-14c3003c.js","assets/index-210d4b6a.css","assets/supabaseTableQuery-95762ff3.js"]),i={...a};!i.sort&&!i.order&&(i.sort={key:"sort_order",order:"desc"});const o=await n(i,"music_macharta_videos");try{if(Array.isArray(o==null?void 0:o.rows)){const f=i.page||1,u=i.limit||20,m=(f-1)*u,_=o.rows.map((e,x)=>({...e,title:e.title??"",embed_code:e.embed_code??"",show:e.show??!0,sort_order:e.sort_order??0,index:m+x}));return{...o,rows:_}}}catch(f){console.error("[getMusicMachartaVideosTable]",f)}return o}const Z={class:"h-full"},ee={class:"gap-2 flex justify-center"},te=c("span",null,"حذف",-1),ae=c("span",null,"ویرایش",-1),oe={class:"space-y-4"},se=c("div",{class:"mb-1 text-sm text-gray-600"},"عنوان *",-1),ie=c("div",{class:"mb-1 text-sm text-gray-600"},"ترتیب نمایش",-1),ne=c("div",{class:"mb-1 text-sm text-gray-600"},"کد embed *",-1),Ee=N({__name:"index",setup(a){const{TextArea:n}=G,[i,o]=P(),f=v({columns:J,api:Y,defaultPageLimit:20}),u=v(!1),m=v(!1),_=v(null),e=v({title:"",embed_code:"",show:!0,sort_order:0});function x(){m.value=!1,_.value=null,e.value={title:"",embed_code:"",show:!0,sort_order:0},u.value=!0}function k(){u.value=!1}function T(s){m.value=!0,_.value=s.id,e.value={title:s.title||"",embed_code:s.embed_code||"",show:s.show!==!1,sort_order:s.sort_order??0},u.value=!0}function B(s){F.confirm({title:"حذف ویدیو",content:`آیا از حذف «${s.title}» مطمئن هستید؟`,okText:"حذف",cancelText:"انصراف",onOk:async()=>{await X(s.id),p.success("حذف شد"),o()}})}async function C(s)