Files
machartaa_admin_dist/dist/assets/index-9669c22b.js
T

2 lines
16 KiB
JavaScript
Raw Normal View History

2026-06-01 18:38:29 +03:30
import{_ as re}from"./BasicMainCard-f5011b39.js";import{_ as ue}from"./BasicModal.vue_vue_type_style_index_0_lang-a547157a.js";import{_ as ce}from"./BasicTextArea.vue_vue_type_style_index_0_lang-5cc0457f.js";import{_ as de}from"./BasicInput.vue_vue_type_style_index_0_lang-5aefde0f.js";import{_ as pe,u as me}from"./useBaseTable-13b436e1.js";import{_ as _e}from"./button.vue_vue_type_style_index_0_lang-851afdd8.js";import{_ as ve,I as j,d as fe,g as b,A as he,x as ge,o as M,c as S,b as c,w,a as t,e as xe,G as ye,j as T,k as B,z as H,t as W,F as be,p as we,D as L,H as P}from"./index-82b07f49.js";import{t as ke}from"./useDataTime-10f46d84.js";import{I as R}from"./Icon-04c02c0b.js";import{_ as Ce}from"./TextPreview.vue_vue_type_script_setup_true_lang-38b465eb.js";import{M as $e}from"./index-5dc3a2fa.js";import{S as Ue}from"./index-1f61ecf5.js";import{T as K}from"./shallowequal-17b27246.js";import{U as J}from"./index-0f0f5d8d.js";import"./_plugin-vue_export-helper-f81f33f1.js";import"./index-ad11eb53.js";import"./index-a4d2dbbb.js";import"./Col-5d52aed9.js";import"./vnode-007df887.js";import"./useState-e0a5bff5.js";import"./useRefs-e9385981.js";import"./isPlainObject-f3a46277.js";import"./index-c6d6dccd.js";import"./FormItemContext-f4f190fd.js";import"./usePrice-7afab779.js";import"./index-7e5faec0.js";import"./toArray-e3bbd719.js";import"./pickAttrs-b9acd388.js";import"./index-d634ff29.js";import"./index-2a5d6560.js";async function Me(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:f,error:_}=await j.from("challenge").insert([d]);if(_)throw console.error("Supabase insert error:",_),_;return console.log("Supabase insert success:",f),f}async function Se(m,d){const{data:f,error:_}=await j.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 f}async function Ie(m){const{error:d}=await j.from("challenge").delete().eq("id",m);if(d)throw d}async function De(m){const{TableEngineRequest:d}=await ve(()=>import("./buildSupabaseQuery-4056c4b8.js"),["assets/buildSupabaseQuery-4056c4b8.js","assets/index-82b07f49.js","assets/index-f86b861c.css"]),f={...m};!f.sort&&!f.order&&(f.order="-id");const _=await d(f,"challenge");try{if(Array.isArray(_==null?void 0:_.rows)){const C=f.page||1,k=f.limit||200,I=(C-1)*k,x=_.rows.map((h,U)=>({id:h.id,title:h.title??"",description:h.description??"",steps:h.steps??[],created_at:h.created_at??"",index:I+U,...h}));return{..._,rows:x}}}catch(C){console.log("[getChallengeTable] normalize error:",C)}return _}const Le=[{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 f=d.reduce((C,k)=>C+(Number(k.minute)||0),0),_=d.reduce((C,k)=>C+(Number(k.score)||0),0);return`${d.length} مرحله / ${f} دقیقه / ${_} امتیاز`}},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:m=>ke(m.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],Te={class:"flex justify-between items-center mb-4"},Be=t("h2",null,"چالش ها",-1),Pe={class:"gap-2 flex justify-center"},Re=t("span",null,"حذف",-1),qe=t("span",null,"ویرایش",-1),Ae={class:"space-y-4 relative"},ze={key:0,class:"absolute inset-0 bg-white/60 z-10 flex items-center justify-center"},Ve=t("div",{class:"mb-1 text-sm text-gray-600"},"عنوان چالش",-1),Ne=t("div",{class:"mb-1 text-sm text-gray-600"},"شرح چالش",-1),Oe={class:"flex justify-center gap-1