2 lines
9.0 KiB
JavaScript
2 lines
9.0 KiB
JavaScript
import{_ as E}from"./BasicMainCard-6dd48f47.js";import{_ as M}from"./BasicModal.vue_vue_type_style_index_0_lang-c60160bb.js";import{_ as V}from"./button.vue_vue_type_style_index_0_lang-4dc9d3e9.js";import{_ as j,a as q,u as K}from"./useBaseTable-c7721a03.js";import{_ as F}from"./BasicInput.vue_vue_type_style_index_0_lang-cb979b48.js";import{_ as G}from"./BasicTextArea.vue_vue_type_style_index_0_lang-bb001247.js";import{I as J}from"./Icon-83dbbbe4.js";import{t as O}from"./useDataTime-7a9ebe02.js";import{I as k,d as Y,g as x,r as z,h as H,x as Q,o as b,c as h,b as _,w as m,j as y,G as W,a as e,t as r,e as f,k as w,D as B}from"./index-9a17e55b.js";import{T as L}from"./index-f08856bb.js";import{T as X}from"./shallowequal-5f876352.js";import"./_plugin-vue_export-helper-09135f79.js";import"./index-58b0d53e.js";import"./Col-dc7ee55f.js";import"./vnode-0a46e202.js";import"./isPlainObject-7dd54c5e.js";import"./index-26298d7e.js";import"./index-d5d26f82.js";import"./pickAttrs-0804445f.js";import"./FormItemContext-101590b9.js";import"./index-4182a454.js";import"./toArray-c5dd79c4.js";import"./useState-6ac08ff3.js";import"./index-369204e0.js";import"./index-e6e78cc4.js";import"./usePrice-7afab779.js";import"./useRefs-707c512d.js";const Z=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:a=>a.record.index+1},{title:"نام",dataIndex:"first_name",key:"first_name",customRender:a=>[a.record.first_name,a.record.last_name].filter(Boolean).join(" ")||a.record.user_name||"—"},{title:"موبایل",dataIndex:"user_phone",key:"user_phone"},{title:"استان",dataIndex:"province",key:"province"},{title:"وضعیت پرداخت",dataIndex:"payment_status_label",key:"payment_status_label"},{title:"مرحله",dataIndex:"current_step_label",key:"current_step_label"},{title:"ثبتنام",dataIndex:"registration_status_label",key:"registration_status_label"},{title:"تاریخ",dataIndex:"created_at",key:"created_at",customRender:a=>O(a.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center",width:90}],ee={landing:"صفحه پرداخت",form_1:"فرم اطلاعات",form_2:"بارگذاری ویدیو",review:"بازبینی",submitted:"ثبت نهایی"},te={pending:"در انتظار",paid:"پرداخت شده",failed:"ناموفق",cancelled:"لغو شده"};function ae(a,l){const s=Array.isArray(a.users)?a.users[0]:a.users,p=(s==null?void 0:s.name)||[s==null?void 0:s.first_name,s==null?void 0:s.last_name].filter(Boolean).join(" ").trim()||"—";return{...a,index:l,user_name:p,user_phone:(s==null?void 0:s.phone)||a.phone||"—",current_step_label:ee[a.current_step]||a.current_step,payment_status_label:te[a.payment_status]||a.payment_status,registration_status_label:a.registration_status==="submitted"?"تکمیل شده":"پیشنویس"}}async function se(a){const{limit:l=20,page:s=1,search:p}=a,{data:C,error:g}=await k.from("choir_registrations").select("*, users(name, phone, first_name, last_name)").order("created_at",{ascending:!1});if(g)throw g;let t=(C||[]).map((u,d)=>ae(u,d));if(p!=null&&p.trim()){const u=p.trim().toLowerCase();t=t.filter(d=>(d.first_name||"").toLowerCase().includes(u)||(d.last_name||"").toLowerCase().includes(u)||(d.phone||"").toLowerCase().includes(u)||(d.city||"").toLowerCase().includes(u)||(d.user_name||"").toLowerCase().includes(u)||(d.user_phone||"").toLowerCase().includes(u))}const v=t.length,n=(s-1)*l;return{rows:t.slice(n,n+l).map((u,d)=>({...u,index:n+d})),total:v,query:{...a,total:v,page:s,limit:l}}}async function ne(){const{data:a,error:l}=await k.from("choir_registration_config").select("*").eq("id",1).maybeSingle();if(l)throw l;return a}async function ie(a){const{data:l,error:s}=await k.from("choir_registration_config").upsert({id:1,...a,updated_at:new Date().toISOString()}).select().single();if(s)throw s;return l}async function oe(a){const{data:l,error:s}=await k.from("choir_registrations").select("*, users(name, phone, first_name, last_name)").eq("id",a).single();if(s)throw s;return l}const re=e("div",{class:"mb-4"},[e("h2",null,"لیست ثبتنام گروه سرود")],-1),le=e("span",null,"جزئیات",-1),_e={class:"max-w-2xl space-y-4 py-2"},ce=e("div",{class:"mb-1 text-sm text-gray-600"},"کد embed آپارات (معرفی)",-1),ue=e("div",{class:"mb-1 text-sm text-gray-600"},"کد embed آپارات (راهنمای آپلود)",-1),de={class:"mb-1 text-sm text-gray-600"},pe=e("div",{class:"mb-1 text-sm text-gray-600"},"متن قوانین",-1),me={class:"flex items-center gap-2"},fe=e("span",null,"ثبتنام باز است",-1),ge={key:0,class:"text-sm space-y-2 leading-7"},ve=e("b",null,"نام:",-1),be=e("b",null,"تماس:",-1),he=e("b",null,"محل:",-1),ye={key:0},xe={key:1},we=e("b",null,"تولد:",-1),ke=e("b",null,"جنسیت:",-1),Ce=e("b",null,"پرداخت:",-1),Ie=e("b",null,"مرحله:",-1),Be=e("p",null,[e("b",null,"سوابق سرود:")],-1),Te={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Le=e("p",null,[e("b",null,"سوابق موسیقی:")],-1),Re={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Se=e("b",null,"سازها:",-1),Ae=e("p",null,[e("b",null,"دورهها:")],-1),De={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Ne={key:0},Pe=e("b",null,"ویدیو:",-1),Ue=["href"],ct=Y({__name:"index",setup(a){const l=L,s=L.TabPane,p=x("list"),[C]=K(),g=x(!1),t=x(null),v=x(!1),n=z({intro_aparat_embed_code:"",upload_guide_aparat_embed_code:"",price_rial:499e4,terms_text:"",is_registration_open:!0}),T=H(()=>Math.round(Number(n.price_rial||0)/10).toLocaleString("fa-IR")),u={columns:Z,api:se,defaultPageLimit:20};async function d(c){try{t.value=await oe(c.id),g.value=!0}catch(i){B.error((i==null?void 0:i.message)||"خطا")}}async function R(){const c=await ne();c&&(n.intro_aparat_embed_code=c.intro_aparat_embed_code||"",n.upload_guide_aparat_embed_code=c.upload_guide_aparat_embed_code||"",n.price_rial=c.price_rial??499e4,n.terms_text=c.terms_text||"",n.is_registration_open=c.is_registration_open!==!1)}async function S(){v.value=!0;try{await ie({...n,price_rial:Number(n.price_rial)}),B.success("تنظیمات ذخیره شد")}catch(c){B.error((c==null?void 0:c.message)||"خطا")}finally{v.value=!1}}return Q(R),(c,i)=>{const A=j,I=G,D=F,N=q,P=V,U=M,$=E;return b(),h("div",null,[_($,null,{default:m(()=>[_(y(l),{activeKey:p.value,"onUpdate:activeKey":i[5]||(i[5]=o=>p.value=o)},{default:m(()=>[_(y(s),{key:"list",tab:"ثبتنامها"},{default:m(()=>[re,_(A,W(u,{onRegister:y(C)}),{action:m(({record:o})=>[_(y(X),{class:"cursor-pointer"},{title:m(()=>[le]),default:m(()=>[_(J,{icon:"vuesax-linear:eye",color:"#1D4ED8",onClick:$e=>d(o)},null,8,["onClick"])]),_:2},1024)]),_:1},16,["onRegister"])]),_:1}),_(y(s),{key:"settings",tab:"تنظیمات صفحه"},{default:m(()=>[e("div",_e,[e("div",null,[ce,_(I,{value:n.intro_aparat_embed_code,"onUpdate:value":i[0]||(i[0]=o=>n.intro_aparat_embed_code=o),placeholder:"کد embed از آپارات",rows:3},null,8,["value"])]),e("div",null,[ue,_(I,{value:n.upload_guide_aparat_embed_code,"onUpdate:value":i[1]||(i[1]=o=>n.upload_guide_aparat_embed_code=o),placeholder:"کد embed از آپارات",rows:3},null,8,["value"])]),e("div",null,[e("div",de,"مبلغ (ریال) — نمایش تومان: "+r(T.value),1),_(D,{value:n.price_rial,"onUpdate:value":i[2]||(i[2]=o=>n.price_rial=o),type:"number"},null,8,["value"])]),e("div",null,[pe,_(I,{value:n.terms_text,"onUpdate:value":i[3]||(i[3]=o=>n.terms_text=o),rows:4},null,8,["value"])]),e("div",me,[_(N,{value:n.is_registration_open,"onUpdate:value":i[4]||(i[4]=o=>n.is_registration_open=o)},null,8,["value"]),fe]),_(P,{type:"primary",loading:v.value,onClick:S},{default:m(()=>[f("ذخیره تنظیمات")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["activeKey"]),_(U,{visible:g.value,"onUpdate:visible":i[6]||(i[6]=o=>g.value=o),title:"جزئیات ثبتنام",width:"90%",footer:null},{default:m(()=>{var o;return[t.value?(b(),h("div",ge,[e("p",null,[ve,f(" "+r(t.value.first_name)+" "+r(t.value.last_name),1)]),e("p",null,[be,f(" "+r(t.value.phone),1)]),e("p",null,[he,f(" "+r(t.value.province)+" / "+r(t.value.city)+" ",1),t.value.tehran_district?(b(),h("span",ye," — "+r(t.value.tehran_district),1)):w("",!0),t.value.village?(b(),h("span",xe," — "+r(t.value.village),1)):w("",!0)]),e("p",null,[we,f(" "+r(t.value.birth_date||"—"),1)]),e("p",null,[ke,f(" "+r(t.value.gender==="male"?"مرد":t.value.gender==="female"?"زن":"—"),1)]),e("p",null,[Ce,f(" "+r(t.value.payment_status)+" — "+r((o=t.value.final_price)==null?void 0:o.toLocaleString("fa-IR"))+" ریال",1)]),e("p",null,[Ie,f(" "+r(t.value.current_step)+" — "+r(t.value.registration_status),1)]),Be,e("pre",Te,r(t.value.choir_experience||"—"),1),Le,e("pre",Re,r(t.value.music_experience||"—"),1),e("p",null,[Se,f(" "+r((t.value.instruments||[]).join("، ")||"—"),1)]),Ae,e("pre",De,r(t.value.training_courses||"—"),1),t.value.video_url?(b(),h("p",Ne,[Pe,e("a",{href:t.value.video_url,target:"_blank",rel:"noopener"},"مشاهده ویدیو",8,Ue)])):w("",!0)])):w("",!0)]}),_:1},8,["visible"])]),_:1})])}}});export{ct as default};
|