Files
machartaa_admin_dist/dist/assets/index-4521dfec.js
T

2 lines
17 KiB
JavaScript
Raw Normal View History

2026-07-26 16:24:36 +03:30
import{_ as de}from"./BasicMainCard-1361ed38.js";import{_ as pe}from"./BasicModal.vue_vue_type_style_index_0_lang-acac591d.js";import{_ as me}from"./BasicTextArea.vue_vue_type_style_index_0_lang-a89d96c8.js";import{_ as _e}from"./BasicInput.vue_vue_type_style_index_0_lang-6c1f4129.js";import{_ as ve,u as fe}from"./useBaseTable-c2761680.js";import{_ as ge}from"./button.vue_vue_type_style_index_0_lang-c37c204f.js";import{_ as he,G,d as xe,g as y,A as ye,v as be,o as I,c as S,b as c,w as b,a as t,e as we,H as ke,j as B,k as R,y as J,t as j,F as Ce,n as Ue,D as P,I as X}from"./index-4dccb174.js";import{t as Me}from"./useDataTime-f3f5ea50.js";import{I as q}from"./Icon-6b61a044.js";import{e as T,g as N}from"./convert-2ad76038.js";import{_ as Ie}from"./TextPreview.vue_vue_type_script_setup_true_lang-243a4d0d.js";import{M as Se}from"./index-a34bba22.js";import{T as Y}from"./isSymbol-80c521a5.js";import{S as $e}from"./index-f08752bf.js";import{U as W}from"./index-bd458d30.js";import"./index-6f4a8a6b.js";import"./index-7a876d00.js";import"./_plugin-vue_export-helper-fc650ede.js";import"./useState-7760581d.js";import"./vnode-8e0d49aa.js";import"./useRefs-b5c660b2.js";import"./_flatRest-00780a2d.js";import"./index-7ce2783e.js";import"./Col-c87d3a9d.js";import"./styleChecker-133e2b1a.js";import"./isPlainObject-819f93b0.js";import"./index-4762b7d8.js";import"./FormItemContext-d26e27b7.js";import"./usePrice-bc935b83.js";import"./updateLocale-72f02bbd.js";import"./index-c7f692d2.js";import"./toArray-8c6d8405.js";import"./pickAttrs-13d22210.js";import"./lodash-0f8911c3.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-c92640b4.js";import"./index-895cd0d7.js";import"./isNumeric-3f69e2aa.js";import"./index-00d83bfc.js";import"./index-8f783c3c.js";import"./index-ce6d92ba.js";import"./LeftOutlined-2d8ca514.js";import"./css-aae66f86.js";import"./DialogWrap-715ad625.js";import"./index-6a54d8cb.js";import"./textUtils-c37780ad.js";import"./index-495b789b.js";async function De(m){console.log("API addChallenge payload:",m);const d={title:m.title,description:m.description,owner_id:m.owner_id,minute:m.minute,score:m.score,image_url:m.image_url||null,clip_url:m.clip_url||null,steps:m.steps||[]};console.log("Supabase insert data:",d);const{data:v,error:_}=await G.from("challenge").insert([d]);if(_)throw console.error("Supabase insert error:",_),_;return console.log("Supabase insert success:",v),v}async function Le(m,d){const{data:v,error:_}=await G.from("challenge").update({title:d.title,description:d.description,owner_id:d.owner_id,minute:d.minute,score:d.score,image_url:d.image_url||null,clip_url:d.clip_url||null,steps:d.steps||[]}).eq("id",m).select();if(_)throw _;return v}async function Pe(m){const{error:d}=await G.from("challenge").delete().eq("id",m);if(d)throw d}async function Te(m){const{TableEngineRequest:d}=await he(()=>import("./buildSupabaseQuery-6c90042d.js"),["assets/buildSupabaseQuery-6c90042d.js","assets/index-4dccb174.js","assets/index-338b63e2.css","assets/supabaseTableQuery-95762ff3.js"]),v={...m};!v.sort&&!v.order&&(v.order="-id");const _=await d(v,"challenge");try{if(Array.isArray(_==null?void 0:_.rows)){const C=v.page||1,w=v.limit||200,$=(C-1)*w,h=_.rows.map((f,M)=>({id:f.id,title:f.title??"",description:f.description??"",steps:f.steps??[],created_at:f.created_at??"",index:$+M,...f}));return{..._,rows:h}}}catch(C){console.log("[getChallengeTable] normalize error:",C)}return _}const Be=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:m=>m.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"شرح",dataIndex:"description",key:"description",slot:"description"},{title:"مراحل",dataIndex:"steps",key:"steps",customRender:m=>{const d=m.record.steps||[];if(d.length===0)return"-";const v=d.reduce((C,w)=>C+(Number(w.minute)||0),0),_=d.reduce((C,w)=>C+(Number(w.score)||0),0);return`${d.length} مرحله / ${v} دقیقه / ${_} امتیاز`}},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:m=>Me(m.record.created_at)},{title