Files
machartaa_admin_dist/dist/assets/index-6d6f3510.js
T

2 lines
14 KiB
JavaScript
Raw Normal View History

2025-10-06 15:42:41 +03:30
import{_ as X}from"./BasicMainCard-2872cf6d.js";import{_ as Z}from"./BasicModal.vue_vue_type_style_index_0_lang-a6c32906.js";import{u as ee}from"./usePrefix-9735fafc.js";import{T as te}from"./index-ca849dfb.js";import{d as j,g as se,o as S,c as T,a as t,O as ae,b as u,L as U,W as le,T as oe,a2 as ie,a3 as P,r as w,Y as ne,i as re,w as g,e as E,a4 as ue,N as D,F as ce,S as de,a0 as b}from"./index-be457ac4.js";import{_ as pe}from"./BasicInput.vue_vue_type_style_index_0_lang-121919a6.js";import{_ as me}from"./BaseTable.vue_vue_type_style_index_0_lang-5df22075.js";import{_ as _e}from"./button.vue_vue_type_style_index_0_lang-c48dbf89.js";import{t as ve}from"./useDataTime-b0a2f2c0.js";import{I as L}from"./Icon-7090f2a8.js";import{u as fe}from"./useBaseTable-3aeb2499.js";import{M as he}from"./index-3ad9cba1.js";import{T as N}from"./index-36614f01.js";import{S as ge}from"./index-76934fac.js";import{U as z}from"./index-05d6a702.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./index-2af0d7dc.js";import"./index-3bcb781a.js";import"./raf-cdd2e009.js";import"./colors-a7645274.js";import"./index-387f54bb.js";import"./styleChecker-7765134f.js";import"./useState-508903a0.js";import"./Col-078b7ef2.js";import"./index-253edd80.js";import"./debounce-664d0daa.js";import"./SearchOutlined-68880632.js";import"./EyeOutlined-602323d3.js";import"./usePrice-7afab779.js";import"./index-e8280205.js";import"./index-35ace63f.js";import"./pickAttrs-933e866c.js";import"./CheckOutlined-8f2c289c.js";import"./objectDestructuringEmpty-24e23e90.js";import"./eagerComputed-bf11e1b5.js";import"./index-4a3b7888.js";const xe=j({__name:"BasicTextArea",props:{title:{},value:{},showCount:{type:Boolean},maxlength:{},placeHolder:{}},emits:["update:value"],setup(n,{emit:o}){const d=n,c=se({get(){return d.value},set(f){o("update:value",f)}}),{prefixCls:h}=ee("input-area");return(f,y)=>{const _=te;return S(),T("div",{class:oe([U(h)])},[t("div",null,ae(d.title),1),u(_,{value:U(c),"onUpdate:value":y[0]||(y[0]=x=>le(c)?c.value=x:null),class:"",type:d.type,"show-count":d.showCount,placeHolder:d.placeHolder},null,8,["value","type","show-count","placeHolder"])],2)}}});async function ye(n){console.log("API addChallenge payload:",n);const o={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||[]};console.log("Supabase insert data:",o);const{data:d,error:c}=await P.from("challenge").insert([o]);if(c)throw console.error("Supabase insert error:",c),c;return console.log("Supabase insert success:",d),d}async function we(n,o){const{data:d,error:c}=await P.from("challenge").update({title:o.title,description:o.description,owner_id:o.owner_id,minute:o.minute,score:o.score,image_url:o.image_url||null,clip_url:o.clip_url||null,steps:o.steps||[]}).eq("id",n).select();if(c)throw c;return d}async function be(n){const{error:o}=await P.from("challenge").delete().eq("id",n);if(o)throw o}async function ke(n){const{TableEngineRequest:o}=await ie(()=>import("./buildSupabaseQuery-874444c8.js"),["assets/buildSupabaseQuery-874444c8.js","assets/index-be457ac4.js","assets/index-f708971c.css"]),d={...n};!d.sort&&!d.order&&(d.order="-id");const c=await o(d,"challenge");try{if(Array.isArray(c==null?void 0:c.rows)){const h=d.page||1,f=d.limit||200,y=(h-1)*f,_=c.rows.map((x,A)=>(console.log("[getChallengeTable] sample row with steps:",x),{id:x.id,title:x.title??"",description:x.description??"",steps:x.steps??[],created_at:x.created_at??"",index:y+A,...x}));return{...c,rows:_}}}catch(h){console.log("[getChallengeTable] normalize error:",h)}return c}const Ce=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,customRender:n=>n.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"شرح",dataIndex:"description",key:"description"},{title:"مراحل",dataIndex:"steps",key:"steps",customRender:n=>{const o=n.record.steps||[];if(o.length===0)return"-";const d=o.reduce((h,f)=>h+(Number(f.minute)||0),0),c=o.reduce((h,f)=>h+(Number(f.score)||0),0);return`${o.length} مرحل