2 lines
6.2 KiB
JavaScript
2 lines
6.2 KiB
JavaScript
import{_ as E}from"./BasicModal.vue_vue_type_style_index_0_lang-e958db4a.js";import{_ as R}from"./BasicInput.vue_vue_type_style_index_0_lang-07e89296.js";import{_ as $,u as P}from"./useBaseTable-89d1aacb.js";import{_ as A}from"./button.vue_vue_type_style_index_0_lang-191f5704.js";import{I as y}from"./Icon-119151dd.js";import{t as O}from"./useDataTime-59b033a0.js";import{_ as q,I 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 L,G as F,D as f}from"./index-b83d6d0d.js";import{M as G}from"./index-1cd5c0d2.js";import{I as H}from"./index-c1e4380b.js";import{T as g}from"./shallowequal-edc0445d.js";import"./index-ff385697.js";import"./vnode-0ebe7df2.js";import"./styleChecker-1135ece5.js";import"./_plugin-vue_export-helper-8145279e.js";import"./usePrice-bc935b83.js";import"./fa_IR-a69f9606.js";import"./toArray-2505e2fa.js";import"./FormItemContext-29f2be27.js";import"./pickAttrs-bae23be8.js";import"./useState-cf08b50c.js";import"./lodash-47741477.js";import"./index-7b7f3d69.js";import"./isPlainObject-e729189d.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-b2720d57.js"),["assets/buildSupabaseQuery-b2720d57.js","assets/index-b83d6d0d.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}=H,[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){G.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?"نمایØ
|