Files
machartaa_admin_dist/dist/assets/index-1dd6883b.js
T

2 lines
14 KiB
JavaScript
Raw Normal View History

2025-10-29 17:45:27 +03:30
import{_ as O}from"./BasicMainCard-d501e407.js";import{_ as J}from"./BasicModal.vue_vue_type_style_index_0_lang-b92d1e4c.js";import{_ as Y}from"./BasicTextArea.vue_vue_type_style_index_0_lang-0454583f.js";import{_ as G}from"./BasicInput.vue_vue_type_style_index_0_lang-e909762d.js";import{_ as H}from"./BaseTable.vue_vue_type_style_index_0_lang-caaa35ca.js";import{_ as K}from"./button.vue_vue_type_style_index_0_lang-0e3a478f.js";import{a2 as X,a3 as y,d as Z,r as x,Y as ee,i as te,o as T,c as $,b as n,w as h,a as t,e as oe,a4 as ae,L as B,N as A,F as ie,S as se,a0 as g}from"./index-7312ca78.js";import{t as ne}from"./useDataTime-685454fc.js";import{I as S}from"./Icon-341017aa.js";import{u as le}from"./useBaseTable-3aeb2499.js";import{M as re}from"./index-714e1c13.js";import{S as ce}from"./index-4b522017.js";import{U as ue}from"./index-4a22df0c.js";import{T as Q}from"./index-5c48e774.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./index-85e1e9c5.js";import"./index-c49b31ad.js";import"./raf-cfaf51fa.js";import"./colors-27cdf508.js";import"./index-62876483.js";import"./styleChecker-07a76e62.js";import"./useState-481d8721.js";import"./Col-d713445e.js";import"./index-f1caf030.js";import"./debounce-c95867ee.js";import"./usePrefix-2a411a81.js";import"./index-ab7510c4.js";import"./SearchOutlined-2fb2431c.js";import"./EyeOutlined-c61ca85a.js";import"./usePrice-7afab779.js";import"./index-9152d0fd.js";import"./index-13fcb69c.js";import"./pickAttrs-17295ed3.js";import"./CheckOutlined-3960663d.js";import"./objectDestructuringEmpty-24e23e90.js";import"./eagerComputed-9ec39160.js";import"./index-5202258e.js";async function de(r){const{data:p,error:c}=await y.from("matchs").select("*").eq("id",r).single();if(c)throw c;const{data:u,error:l}=await y.from("questions").select("*").eq("match_id",r);if(l)throw l;return{...p,questions:u||[]}}async function me(r){console.log("addMatchWithQuestions payload:",r);const{data:p,error:c}=await y.from("matchs").insert([r.match]).select().single();if(console.log("Match insert result:",{matchData:p,matchError:c}),c)throw console.error("Match insert error:",c),c;for(const u of r.questions){const{data:l,error:f}=await y.from("questions").insert([{match_id:p.id,question:u.question,options:u.options,correct_answer:u.correct_answer}]).select().single();if(f)throw f;console.log("Question created:",l)}return p}async function pe(r,p){const{error:c}=await y.from("matchs").update(p.match).eq("id",r);if(c)throw c;const{data:u}=await y.from("questions").select("id").eq("match_id",r);if(u)for(const l of u)await y.from("questions").delete().eq("id",l.id);for(const l of p.questions){const{data:f,error:M}=await y.from("questions").insert([{match_id:r,question:l.question,options:l.options,correct_answer:l.correct_answer}]).select().single();if(M)throw M;console.log("Question updated:",f)}return{id:r}}async function _e(r){await y.from("questions").delete().eq("match_id",r);const{error:p}=await y.from("matchs").delete().eq("id",r);if(p)throw p}async function ve(r){const{TableEngineRequest:p}=await X(()=>import("./buildSupabaseQuery-fc64a104.js"),["assets/buildSupabaseQuery-fc64a104.js","assets/index-7312ca78.js","assets/index-d933e911.css"]),c={...r};!c.sort&&!c.order&&(c.order="-id");const u=await p(c,"matchs");try{if(Array.isArray(u==null?void 0:u.rows)){const l=c.page||1,f=c.limit||200,M=(l-1)*f,L=u.rows.map((w,b)=>({id:w.id,title:w.title??"",description:w.description??"",created_at:w.created_at??"",index:M+b,...w}));return{...u,rows:L}}}catch(l){console.log("[getMatchTable] normalize error:",l)}return u}const fe=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",fixed:"left",customRender:r=>r.record.index+1},{title:"عنوان",dataIndex:"title",key:"title"},{title:"شرح",dataIndex:"description",key:"description"},{title:"سوالات",dataIndex:"questions",key:"questions",customRender:r=>"سوالات مسابقه"},{title:"تاریخ ایجاد",dataIndex:"created_at",key:"created_at",customRender:r=>ne(r.record.created_at)},{title:"عملیات",dataIndex:"action",key:"ac