Files
machartaa_admin_dist/dist/assets/index-0e41d1ce.js
T

2 lines
6.2 KiB
JavaScript
Raw Normal View History

2026-06-27 17:35:34 +03:30
import{_ as E}from"./BasicModal.vue_vue_type_style_index_0_lang-d37c1f01.js";import{_ as R}from"./BasicInput.vue_vue_type_style_index_0_lang-aa217a59.js";import{_ as $,u as P}from"./useBaseTable-5854ed19.js";import{_ as A}from"./button.vue_vue_type_style_index_0_lang-110418ce.js";import{I as y}from"./Icon-53c563d2.js";import{t as O}from"./useDataTime-4b2700c1.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-b43045cf.js";import{M as F}from"./index-1e0b33f2.js";import{I as G}from"./index-b94f9b16.js";import{T as g}from"./shallowequal-18e8473a.js";import"./index-6f54d687.js";import"./vnode-96240c5a.js";import"./styleChecker-0c8ed500.js";import"./_plugin-vue_export-helper-d47eb12d.js";import"./usePrice-bc935b83.js";import"./fa_IR-2461e941.js";import"./toArray-8f75a9bb.js";import"./FormItemContext-a080d4f0.js";import"./pickAttrs-5ae7ff2e.js";import"./useState-ace49857.js";import"./lodash-7fcfac04.js";import"./index-6e92857b.js";import"./isPlainObject-8c91e78f.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-ab49e3fb.js"),["assets/buildSupabaseQuery-ab49e3fb.js","assets/index-b43045cf.js","assets/index-d288f4d5.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?"نمایØ