2026-07-04 21:19:56 +03:30
|
|
|
import{_ as E}from"./BasicModal.vue_vue_type_style_index_0_lang-d1e6a59e.js";import{_ as R}from"./BasicInput.vue_vue_type_style_index_0_lang-35ed6fd8.js";import{_ as $,u as P}from"./useBaseTable-f680a0e2.js";import{_ as A}from"./button.vue_vue_type_style_index_0_lang-e0dea8bb.js";import{I as y}from"./Icon-199a922a.js";import{t as O}from"./useDataTime-bbfc6d86.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-caf247db.js";import{M as F}from"./index-688f073d.js";import{I as G}from"./index-01e8bf20.js";import{T as g}from"./shallowequal-1ad8252c.js";import"./index-70e9e671.js";import"./vnode-20d5d74c.js";import"./styleChecker-477bfa11.js";import"./_plugin-vue_export-helper-438caba9.js";import"./usePrice-bc935b83.js";import"./fa_IR-3fc10d80.js";import"./toArray-ad006c19.js";import"./FormItemContext-d53141ed.js";import"./pickAttrs-d5fdda1c.js";import"./useState-74071817.js";import"./lodash-f5ffd720.js";import"./css-bff3ffda.js";import"./DialogWrap-7b83b14e.js";import"./index-7a128151.js";import"./isPlainObject-16f1bdfa.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-3f921c3d.js"),["assets/buildSupabaseQuery-3f921c3d.js","assets/index-caf247db.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)
|