Files
machartaa_admin_dist/dist/assets/index-49ac09f1.js
T

2 lines
14 KiB
JavaScript
Raw Normal View History

2025-10-29 17:45:27 +03:30
import{_ as K}from"./BasicMainCard-d501e407.js";import{_ as Q}from"./BasicModal.vue_vue_type_style_index_0_lang-b92d1e4c.js";import{_ as X}from"./BasicTextArea.vue_vue_type_style_index_0_lang-0454583f.js";import{_ as Z}from"./BasicInput.vue_vue_type_style_index_0_lang-e909762d.js";import{_ as ee}from"./BaseTable.vue_vue_type_style_index_0_lang-caaa35ca.js";import{_ as te}from"./button.vue_vue_type_style_index_0_lang-0e3a478f.js";import{a2 as se,a3 as V,d as ae,r as b,Y as ie,i as oe,o as I,c as S,b as l,w as g,a as s,e as le,a4 as ne,L as $,N as B,F as re,S as ce,a0 as w}from"./index-7312ca78.js";import{t as ue}from"./useDataTime-685454fc.js";import{I as L}from"./Icon-341017aa.js";import{u as de}from"./useBaseTable-3aeb2499.js";import{M as pe}from"./index-714e1c13.js";import{T as z}from"./index-5c48e774.js";import{S as me}from"./index-4b522017.js";import{U as A}from"./index-4a22df0c.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./index-85e1e9c5.js";import"./index-c49b31ad.js";import"./raf-cfaf51fa.js";import"./colors-27cdf508.js";import"./index-62876483.js";import"./styleChecker-07a76e62.js";import"./useState-481d8721.js";import"./Col-d713445e.js";import"./index-f1caf030.js";import"./debounce-c95867ee.js";import"./usePrefix-2a411a81.js";import"./index-ab7510c4.js";import"./SearchOutlined-2fb2431c.js";import"./EyeOutlined-c61ca85a.js";import"./usePrice-7afab779.js";import"./index-9152d0fd.js";import"./index-13fcb69c.js";import"./pickAttrs-17295ed3.js";import"./CheckOutlined-3960663d.js";import"./objectDestructuringEmpty-24e23e90.js";import"./eagerComputed-9ec39160.js";import"./index-5202258e.js";async function _e(r){console.log("API addChallenge payload:",r);const n={title:r.title,description:r.description,owner_id:r.owner_id,minute:r.minute,score:r.score,image_url:r.image_url||null,clip_url:r.clip_url||null,steps:r.steps||[]};console.log("Supabase insert data:",n);const{data:_,error:p}=await V.from("challenge").insert([n]);if(p)throw console.error("Supabase insert error:",p),p;return console.log("Supabase insert success:",_),_}async function ve(r,n){const{data:_,error:p}=await V.from("challenge").update({title:n.title,description:n.description,owner_id:n.owner_id,minute:n.minute,score:n.score,image_url:n.image_url||null,clip_url:n.clip_url||null,steps:n.steps||[]}).eq("id",r).select();if(p)throw p;return _}async function fe(r){const{error:n}=await V.from("challenge").delete().eq("id",r);if(n)throw n}async function he(r){const{TableEngineRequest:n}=await se(()=>import("./buildSupabaseQuery-fc64a104.js"),["assets/buildSupabaseQuery-fc64a104.js","assets/index-7312ca78.js","assets/index-d933e911.css"]),_={...r};!_.sort&&!_.order&&(_.order="-id");const p=await n(_,"challenge");try{if(Array.isArray(p==null?void 0:p.rows)){const x=_.page||1,h=_.limit||200,C=(x-1)*h,v=p.rows.map((U,E)=>({id:U.id,title:U.title??"",description:U.description??"",steps:U.steps??[],created_at:U.created_at??"",index:C+E,...U}));return{...p,rows:v}}}catch(x){console.log("[getChallengeTable] normalize error:",x)}return p}const ge=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",fixed:"left",customRender:r=>r.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"شرح",dataIndex:"description",key:"description"},{title:"مراحل",dataIndex:"steps",key:"steps",customRender:r=>{const n=r.record.steps||[];if(n.length===0)return"-";const _=n.reduce((x,h)=>x+(Number(h.minute)||0),0),p=n.reduce((x,h)=>x+(Number(h.score)||0),0);return`${n.length} مرحله / ${_} دقیقه / ${p} امتیاز`}},{title:"تاریخ ایجاد",dataIndex:"created_at",key:"created_at",customRender:r=>ue(r.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],xe={class:"flex justify-between items-center mb-4"},ye=s("h2",null,"چالش ها",-1),be={class:"gap-2 flex justify-center"},we=s("span",null,"حذف",-1),ke=s("span",null,"ویرایش",-1),Ce={class:"space-y-4 relative"},Ue={key:0,class:"absolute inset-0 bg-white/60 z-10 flex items-center j