2026-08-18 16:19:11 +03:30
|
|
|
import{_ as de}from"./BasicMainCard-0ad7dc72.js";import{_ as pe}from"./BasicModal.vue_vue_type_style_index_0_lang-4b1d1ef5.js";import{_ as me}from"./BasicTextArea.vue_vue_type_style_index_0_lang-32fdba83.js";import{_ as _e}from"./BasicInput.vue_vue_type_style_index_0_lang-f043e831.js";import{_ as ve,u as fe}from"./useBaseTable-f8894810.js";import{_ as ge}from"./button.vue_vue_type_style_index_0_lang-bc3a48f6.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-24cdd011.js";import{t as Me}from"./useDataTime-4be5c5cf.js";import{I as q}from"./Icon-767d2866.js";import{e as T,g as N}from"./convert-2ad76038.js";import{_ as Ie}from"./TextPreview.vue_vue_type_script_setup_true_lang-630b180a.js";import{M as Se}from"./index-5eb1b262.js";import{T as Y}from"./isSymbol-e7ce9b5a.js";import{S as $e}from"./index-d68d1b34.js";import{U as W}from"./index-5477dee9.js";import"./Grid-ce03674d.js";import"./index-bcc6b780.js";import"./_plugin-vue_export-helper-06d65383.js";import"./shallowequal-59945f6f.js";import"./index-4057f476.js";import"./vnode-562ae89f.js";import"./index-fec9c5bc.js";import"./useState-bb6abd58.js";import"./useRefs-2bd76cbf.js";import"./_flatRest-28f96ed6.js";import"./isMobile-e2e89480.js";import"./omit-08db5ef5.js";import"./index-ef7f0d13.js";import"./Col-8ec8a751.js";import"./styleChecker-aeb3f501.js";import"./isPlainObject-25081d35.js";import"./index-942dc2ed.js";import"./SearchOutlined-3570b8ac.js";import"./FormItemContext-a07e1be1.js";import"./index-cbf3fafb.js";import"./usePrice-bc935b83.js";import"./updateLocale-58c30845.js";import"./index-bc659f42.js";import"./useMemo-5fb6706d.js";import"./lodash-3126ec34.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-5acaa0f7.js";import"./index-3078e65c.js";import"./Badge-aa4916ac.js";import"./isNumeric-3f69e2aa.js";import"./index-38d9344c.js";import"./index-39621559.js";import"./index-093e137a.js";import"./DialogWrap-4e2453b1.js";import"./pickAttrs-64381c06.js";import"./css-aae66f86.js";import"./index-0ceac0d6.js";import"./toArray-e3c28da8.js";import"./index-559e3814.js";import"./textUtils-c37780ad.js";import"./index-3867b2dc.js";import"./index-9df579ce.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-856791d4.js"),["assets/buildSupabaseQuery-856791d4.js","assets/index-24cdd011.js","assets/index-a54d32f7.css","assets/supabaseTableQuery-8ab5665d.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)
|