Files
machartaa_admin_dist/dist/assets/index-3ac46e41.js
T

2 lines
18 KiB
JavaScript
Raw Normal View History

2026-07-04 17:32:23 +03:30
import{_ as xe}from"./BasicMainCard-eb9343e9.js";import{_ as we}from"./BasicModal.vue_vue_type_style_index_0_lang-4effc2b1.js";import{_ as be}from"./BasicTextArea.vue_vue_type_style_index_0_lang-5d6def92.js";import{_ as Se,a as Ie,u as Q}from"./useBaseTable-c909e392.js";import{_ as ke}from"./BasicInput.vue_vue_type_style_index_0_lang-4069ac1c.js";import{_ as Ce}from"./button.vue_vue_type_style_index_0_lang-a7c15404.js";import{H as y,_ as Ue,d as Te,g as A,A as Me,o as $,c as B,b as c,w as m,j as S,a as s,e as z,G as Y,t as V,k as W,y as Re,F as Ae,n as qe,D as C,L as Pe,M as $e,I as Be}from"./index-14c3003c.js";import{f as Z,b as Ee,c as De,d as Le,e as Fe,t as Oe,M as ne,g as Ne}from"./supabaseTableQuery-95762ff3.js";import{t as K}from"./useDataTime-e4f5bf79.js";import{I as O}from"./Icon-f0620776.js";import{e as ee,g as te}from"./convert-67c23be8.js";import{T as se}from"./index-031faeaf.js";import{M as je}from"./index-77af8dcc.js";import{S as ze}from"./index-43497ac0.js";import{S as ae}from"./fa_IR-245a648a.js";import{T as H}from"./shallowequal-a5ad9c9b.js";import{U as Ve}from"./index-e494544d.js";import{_ as We}from"./_plugin-vue_export-helper-9d873422.js";import"./index-8e611dfd.js";import"./index-785693d7.js";import"./Col-006339a7.js";import"./styleChecker-569634cf.js";import"./vnode-0d5a6b01.js";import"./isPlainObject-c274713e.js";import"./index-866e6f6b.js";import"./FormItemContext-8fd31893.js";import"./useState-f0d82672.js";import"./lodash-3dfbaf74.js";import"./css-e89e37f1.js";import"./DialogWrap-0c54c10f.js";import"./pickAttrs-c4f5e9cb.js";import"./index-96a49d7d.js";import"./toArray-f191f093.js";import"./usePrice-bc935b83.js";import"./useRefs-47c5d0d5.js";import"./_flatRest-3e64feef.js";import"./index-7e1e4415.js";function re(e,i){return i.map((o,n)=>({challenge_id:e,step_order:n+1,description:o.description,duration_seconds:Math.max(1,Math.round(Number(o.duration_minutes)*60)),aparat_embed_code:o.aparat_embed_code||null,punishment_description:o.punishment_description,requires_photo_upload:!!o.requires_photo_upload}))}async function He(e){const{data:i,error:o}=await y.from("step_challenges").select("*").eq("id",e).single();if(o)throw o;const{data:n,error:u}=await y.from("step_challenge_steps").select("*").eq("challenge_id",e).order("step_order",{ascending:!0});if(u)throw u;return{...i,steps:(n||[]).map(l=>({...l,duration_minutes:Math.round((l.duration_seconds||60)/60)}))}}async function Ke(e,i){const{data:o,error:n}=await y.from("step_challenges").insert([{title:e.title,character_image_url:e.character_image_url,show:e.show??!1,access_type:e.access_type??"free",sort_order:e.sort_order??0,owner_id:i||null}]).select().single();if(n)throw n;const u=re(o.id,e.steps),{error:l}=await y.from("step_challenge_steps").insert(u);if(l)throw l;return o}async function Ge(e,i){const{error:o}=await y.from("step_challenges").update({title:i.title,character_image_url:i.character_image_url,show:i.show??!1,access_type:i.access_type??"free",sort_order:i.sort_order??0,updated_at:new Date().toISOString()}).eq("id",e);if(o)throw o;const{error:n}=await y.from("step_challenge_steps").delete().eq("challenge_id",e);if(n)throw n;const u=re(e,i.steps),{error:l}=await y.from("step_challenge_steps").insert(u);if(l)throw l;return{id:e}}async function Je(e){const{error:i}=await y.from("step_challenges").delete().eq("id",e);if(i)throw i}async function Xe(e,i){const{data:o,error:n}=await y.from("step_challenges").update({...i,updated_at:new Date().toISOString()}).eq("id",e).select();if(n)throw n;return o}async function Qe(e){const{TableEngineRequest:i}=await Ue(()=>import("./buildSupabaseQuery-267b483f.js"),["assets/buildSupabaseQuery-267b483f.js","assets/index-14c3003c.js","assets/index-210d4b6a.css","assets/supabaseTableQuery-95762ff3.js"]),o={...e};!o.sort&&!o.order&&(o.order="-id");const n=await i(o,"step_challenges");try{if(Array.isArray(n==null?void 0:n.rows)){const u=n.rows,l=u.map(I=>I.id).filter(Boolean);let U={};if(l.length>0){const{data:I}=await y.from("step_challenge_steps").select("id, challenge_id, step_order, duration_seconds").in("