2026-06-23 17:53:22 +03:30
|
|
|
import{_ as E}from"./BasicModal.vue_vue_type_style_index_0_lang-4d1ea47f.js";import{_ as R}from"./BasicInput.vue_vue_type_style_index_0_lang-67d273ea.js";import{_ as $,u as P}from"./useBaseTable-d1301015.js";import{_ as A}from"./button.vue_vue_type_style_index_0_lang-6ea65175.js";import{I as y}from"./Icon-2e314594.js";import{t as O}from"./useDataTime-111e8cc7.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 f}from"./index-eebfe383.js";import{M as F}from"./index-431d5343.js";import{I as G}from"./index-2cb7a225.js";import{T as g}from"./shallowequal-2c046990.js";import"./index-f7f60d5d.js";import"./vnode-796e6450.js";import"./styleChecker-63305807.js";import"./_plugin-vue_export-helper-d79e14d1.js";import"./usePrice-bc935b83.js";import"./fa_IR-c04e2295.js";import"./toArray-6174fc09.js";import"./FormItemContext-7e98c0c3.js";import"./pickAttrs-ed2aa5c0.js";import"./useState-80f6f092.js";import"./lodash-669ae2a6.js";import"./index-3eb1599e.js";import"./isPlainObject-e67232f0.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-ca1b6752.js"),["assets/buildSupabaseQuery-ca1b6752.js","assets/index-eebfe383.js","assets/index-f59f1398.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 p=i.page||1,u=i.limit||20,m=(p-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(p){console.error("[getMusicMachartaVideosTable]",p)}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),Ve=N({__name:"index",setup(a){const{TextArea:n}=G,[i,o]=P(),p=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),f.success("ØØ°Ù� شد"),o()}})}async function C(s){await W(s.id,s.show===!1),f.success(s.show===!1?"نمایØ
|