Files
machartaa_admin_dist/dist/assets/index-bf361ce9.js
T

2 lines
16 KiB
JavaScript
Raw Normal View History

2026-06-03 19:51:45 +03:30
import{_ as de}from"./BasicMainCard-8123d7a5.js";import{_ as pe}from"./BasicModal.vue_vue_type_style_index_0_lang-078ddd77.js";import{_ as me}from"./BasicTextArea.vue_vue_type_style_index_0_lang-856c5942.js";import{_ as _e}from"./BasicInput.vue_vue_type_style_index_0_lang-f3e17581.js";import{_ as ve,u as fe}from"./useBaseTable-e905173e.js";import{_ as ge}from"./button.vue_vue_type_style_index_0_lang-147050b5.js";import{_ as he,I as G,d as xe,g as y,A as ye,x as be,o as I,c as S,b as c,w as b,a as t,e as we,G as ke,j as B,k as R,z as J,t as j,F as Ce,p as Ue,D as P,H as X}from"./index-c6a4e685.js";import{t as Me}from"./useDataTime-2f3b2841.js";import{I as q}from"./Icon-e19b6c6c.js";import{e as T,g as N}from"./convert-67c23be8.js";import{_ as Ie}from"./TextPreview.vue_vue_type_script_setup_true_lang-b411baa3.js";import{M as Se}from"./index-334d46a3.js";import{S as $e}from"./index-d3f71215.js";import{T as Y}from"./shallowequal-ee0267e4.js";import{U as W}from"./index-cb3f2111.js";import"./_plugin-vue_export-helper-58b6e008.js";import"./index-252f8dad.js";import"./index-b6b0f56b.js";import"./Col-8b3564ce.js";import"./vnode-977fe706.js";import"./useState-08abbf84.js";import"./useRefs-63b38e0f.js";import"./isPlainObject-a663ca44.js";import"./index-4608391b.js";import"./FormItemContext-6df15dff.js";import"./usePrice-7afab779.js";import"./index-03a51284.js";import"./toArray-5f8c3051.js";import"./pickAttrs-e8130b6d.js";import"./index-633a27e5.js";import"./index-e3fdf3f3.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-6e0d527d.js"),["assets/buildSupabaseQuery-6e0d527d.js","assets/index-c6a4e685.js","assets/index-2e613fc8.css"]),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:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],Re={class:"flex justify-between items-center mb-4"},qe=t("h2",null,"چالش ها",-1),Ae={class:"gap-2 flex justify-center"},ze=t("span",null,"حذÙ�",-1),Ve=t("span",null,"ویرایش",-1),Ne={class:"space-y-4 relative"},Oe={key:0,class:"absolute inset-0 bg-white/60 z-10 flex items-center justify-center"},Fe=t("div",{class:"mb-1 text-sm text-gray-600"},"عنوان چالش",-1),He=t("div",{class:"mb-1 text-sm text-gray-600"},"Ø´Ø