Files
machartaa_admin_dist/dist/assets/index-2758d3b6.js
T
2026-06-03 19:51:45 +03:30

2 lines
13 KiB
JavaScript

import{_ as G}from"./BasicMainCard-8123d7a5.js";import{_ as O}from"./BasicModal.vue_vue_type_style_index_0_lang-078ddd77.js";import{_ as Y}from"./button.vue_vue_type_style_index_0_lang-147050b5.js";import{_ as H,a as Q,u as W}from"./useBaseTable-e905173e.js";import{_ as X}from"./BasicInput.vue_vue_type_style_index_0_lang-f3e17581.js";import{_ as Z}from"./BasicTextArea.vue_vue_type_style_index_0_lang-856c5942.js";import{I as ee}from"./Icon-e19b6c6c.js";import{t as N,a as te}from"./useDataTime-2f3b2841.js";import{I as B,d as ae,g as b,r as ne,h as se,x as oe,o as u,c as d,b as c,w as f,j as w,G as le,a as t,t as a,e as _,k as v,D as R}from"./index-c6a4e685.js";import{g as ie}from"./convert-67c23be8.js";import{T as D}from"./index-b6b0f56b.js";import{T as re}from"./shallowequal-ee0267e4.js";import"./_plugin-vue_export-helper-58b6e008.js";import"./index-252f8dad.js";import"./Col-8b3564ce.js";import"./vnode-977fe706.js";import"./isPlainObject-a663ca44.js";import"./index-d3f71215.js";import"./index-334d46a3.js";import"./pickAttrs-e8130b6d.js";import"./FormItemContext-6df15dff.js";import"./index-03a51284.js";import"./toArray-5f8c3051.js";import"./useState-08abbf84.js";import"./index-4608391b.js";import"./index-633a27e5.js";import"./usePrice-7afab779.js";import"./useRefs-63b38e0f.js";const _e=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:o=>o.record.index+1},{title:"نام",dataIndex:"first_name",key:"first_name",customRender:o=>[o.record.first_name,o.record.last_name].filter(Boolean).join(" ")||o.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:o=>N(o.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center",width:90}],ue={landing:"صفحه پرداخت",form_1:"اطلاعات فردی",form_2:"اطلاعات والدین",form_3:"توانایی‌ها",form_4:"درباره خودت",form_5:"عکس",form_6:"ویدئو",form_7:"تأیید والدین",review:"بازبینی",submitted:"ثبت نهایی"},de={pending:"در انتظار",paid:"پرداخت شده",failed:"ناموفق",cancelled:"لغو شده"};function ce(o,p){const i=Array.isArray(o.users)?o.users[0]:o.users,h=(i==null?void 0:i.name)||[i==null?void 0:i.first_name,i==null?void 0:i.last_name].filter(Boolean).join(" ").trim()||"—";return{...o,index:p,user_name:h,user_phone:(i==null?void 0:i.phone)||o.phone||"—",current_step_label:ue[o.current_step]||o.current_step,payment_status_label:de[o.payment_status]||o.payment_status,registration_status_label:o.registration_status==="submitted"?"تکمیل شده":"پیش‌نویس"}}async function pe(o){const{limit:p=20,page:i=1,search:h}=o,{data:I,error:y}=await B.from("choir_registrations").select("*, users(name, phone, first_name, last_name)").order("created_at",{ascending:!1});if(y)throw y;let e=(I||[]).map((m,n)=>ce(m,n));if(h!=null&&h.trim()){const m=h.trim().toLowerCase();e=e.filter(n=>(n.first_name||"").toLowerCase().includes(m)||(n.last_name||"").toLowerCase().includes(m)||(n.phone||"").toLowerCase().includes(m)||(n.city||"").toLowerCase().includes(m)||(n.user_name||"").toLowerCase().includes(m)||(n.user_phone||"").toLowerCase().includes(m))}const x=e.length,g=(i-1)*p;return{rows:e.slice(g,g+p).map((m,n)=>({...m,index:g+n})),total:x,query:{...o,total:x,page:i,limit:p}}}async function me(){const{data:o,error:p}=await B.from("choir_registration_config").select("*").eq("id",1).maybeSingle();if(p)throw p;return o}async function ve(o){const{data:p,error:i}=await B.from("choir_registration_config").upsert({id:1,...o,updated_at:new Date().toISOString()}).select().single();if(i)throw i;return p}async function fe(o){const{data:p,error:i}=await B.from("choir_registrations").select("*, users(name, phone, first_name, last_name)").eq("id",o).single();if(i)throw i;return p}const he=t("div",{class:"mb-4"},[t("h2",null,"لیست ثبت‌نام گروه سرود")],-1),ge=t("span",null,"جزئیات",-1),be={class:"max-w-2xl space-y-4 py-2"},ye=t("div",{class:"mb-1 text-sm text-gray-600"},"کد embed آپارات (معرفی)",-1),xe=t("div",{class:"mb-1 text-sm text-gray-600"},"کد embed آپارات (راهنمای آپلود)",-1),ke=t("div",{class:"mb-1 text-sm text-gray-600"},"متن بالای دکمه بارگذاری ویدیو",-1),we={class:"mb-1 text-sm text-gray-600"},Ce=t("div",{class:"mb-1 text-sm text-gray-600"},"متن قوانین",-1),Te={class:"flex items-center gap-2"},Be=t("span",null,"ثبت‌نام باز است",-1),Ie={key:0,class:"text-sm space-y-2 leading-7"},Le=t("b",null,"نام:",-1),Re={key:0},Se=t("b",null,"پایه / مدرسه:",-1),je=t("b",null,"محل:",-1),Ue={key:0},De={key:1},Ne={key:2},$e=t("b",null,"تولد:",-1),Ae=t("b",null,"جنسیت:",-1),Pe=t("p",{class:"font-700 mt-3"},"اطلاعات والدین",-1),Ee=t("b",null,"پدر:",-1),Me=t("b",null,"مادر:",-1),Ve={key:0},qe=t("b",null,"تماس اضطراری:",-1),Ke=t("p",{class:"font-700 mt-3"},"توانایی‌ها",-1),ze=t("b",null,"سابقه گروه سرود:",-1),Je={key:1,class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Fe=t("b",null,"اجرای صحنه:",-1),Ge={key:2,class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Oe=t("b",null,"کلاس موسیقی:",-1),Ye={key:3,class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},He=t("b",null,"نوازندگی:",-1),Qe=t("b",null,"سازها:",-1),We=t("b",null,"علاقه‌مندی‌ها:",-1),Xe=t("p",{class:"font-700 mt-3"},"درباره هنرجو",-1),Ze=t("b",null,"علاقه‌مندی‌ها:",-1),et=t("p",null,[t("b",null,"دلیل عضویت:")],-1),tt={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},at=t("p",null,[t("b",null,"آرزوی آینده:")],-1),nt={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},st=t("b",null,"پرداخت:",-1),ot=t("b",null,"مرحله:",-1),lt={key:4,class:"font-700 mt-3"},it={key:5,class:"flex items-center gap-2"},rt=t("b",null,"عکس:",-1),_t={key:6,class:"flex items-center gap-2"},ut=t("b",null,"ویدیو:",-1),dt={key:7,class:"font-700 mt-3"},ct={key:8},pt=t("b",null,"نام والد:",-1),mt={key:9},vt=t("b",null,"تاریخ تأیید:",-1),ft={class:"flex justify-center"},ht=["src"],gt=["src"],Ot=ae({__name:"index",setup(o){const p=D,i=D.TabPane,h=b("list"),[I]=W(),y=b(!1),e=b(null),x=b(!1),g=b("photo"),k=b(""),m=b(!1),n=ne({intro_aparat_embed_code:"",upload_guide_aparat_embed_code:"",video_upload_note_text:"",price_rial:499e4,terms_text:"",is_registration_open:!0}),$=se(()=>Math.round(Number(n.price_rial||0)/10).toLocaleString("fa-IR")),A={columns:_e,api:pe,defaultPageLimit:20};async function P(l){try{e.value=await fe(l.id),y.value=!0}catch(s){R.error((s==null?void 0:s.message)||"خطا")}}function C(l){return l===!0?"بله":l===!1?"خیر":"—"}function E(l){return l?te(l):"—"}function M(l){return l?N(l):"—"}function S(l){if(!e.value)return;const s=l==="photo"?e.value.photo_url:e.value.video_url;s&&(g.value=l,k.value=ie(s),x.value=!0)}async function V(){const l=await me();l&&(n.intro_aparat_embed_code=l.intro_aparat_embed_code||"",n.upload_guide_aparat_embed_code=l.upload_guide_aparat_embed_code||"",n.video_upload_note_text=l.video_upload_note_text||"",n.price_rial=l.price_rial??499e4,n.terms_text=l.terms_text||"",n.is_registration_open=l.is_registration_open!==!1)}async function q(){m.value=!0;try{await ve({...n,price_rial:Number(n.price_rial)}),R.success("تنظیمات ذخیره شد")}catch(l){R.error((l==null?void 0:l.message)||"خطا")}finally{m.value=!1}}return oe(V),(l,s)=>{const K=H,T=Z,z=X,J=Q,L=Y,j=O,F=G;return u(),d("div",null,[c(F,null,{default:f(()=>[c(w(p),{activeKey:h.value,"onUpdate:activeKey":s[6]||(s[6]=r=>h.value=r)},{default:f(()=>[c(w(i),{key:"list",tab:"ثبت‌نام‌ها"},{default:f(()=>[he,c(K,le(A,{onRegister:w(I)}),{action:f(({record:r})=>[c(w(re),{class:"cursor-pointer"},{title:f(()=>[ge]),default:f(()=>[c(ee,{icon:"vuesax-linear:eye",color:"#1D4ED8",onClick:U=>P(r)},null,8,["onClick"])]),_:2},1024)]),_:1},16,["onRegister"])]),_:1}),c(w(i),{key:"settings",tab:"تنظیمات صفحه"},{default:f(()=>[t("div",be,[t("div",null,[ye,c(T,{value:n.intro_aparat_embed_code,"onUpdate:value":s[0]||(s[0]=r=>n.intro_aparat_embed_code=r),placeholder:"کد embed از آپارات",rows:3},null,8,["value"])]),t("div",null,[xe,c(T,{value:n.upload_guide_aparat_embed_code,"onUpdate:value":s[1]||(s[1]=r=>n.upload_guide_aparat_embed_code=r),placeholder:"کد embed از آپارات",rows:3},null,8,["value"])]),t("div",null,[ke,c(T,{value:n.video_upload_note_text,"onUpdate:value":s[2]||(s[2]=r=>n.video_upload_note_text=r),placeholder:"اختیاری — اگر خالی باشد در فرم نمایش داده نمی‌شود",rows:3},null,8,["value"])]),t("div",null,[t("div",we,"مبلغ (ریال) — نمایش تومان: "+a($.value),1),c(z,{value:n.price_rial,"onUpdate:value":s[3]||(s[3]=r=>n.price_rial=r),type:"number"},null,8,["value"])]),t("div",null,[Ce,c(T,{value:n.terms_text,"onUpdate:value":s[4]||(s[4]=r=>n.terms_text=r),rows:4},null,8,["value"])]),t("div",Te,[c(J,{value:n.is_registration_open,"onUpdate:value":s[5]||(s[5]=r=>n.is_registration_open=r)},null,8,["value"]),Be]),c(L,{type:"primary",loading:m.value,onClick:q},{default:f(()=>[_("ذخیره تنظیمات")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["activeKey"]),c(j,{visible:y.value,"onUpdate:visible":s[9]||(s[9]=r=>y.value=r),title:"جزئیات ثبت‌نام",width:"90%",footer:null},{default:f(()=>{var r;return[e.value?(u(),d("div",Ie,[t("p",null,[Le,_(" "+a(e.value.first_name)+" "+a(e.value.last_name)+" ",1),e.value.preferred_name?(u(),d("span",Re," ("+a(e.value.preferred_name)+")",1)):v("",!0)]),t("p",null,[Se,_(" "+a(e.value.grade_level||"—")+" — "+a(e.value.school||"—"),1)]),t("p",null,[je,_(" "+a(e.value.province)+" / "+a(e.value.city)+" ",1),e.value.neighborhood?(u(),d("span",Ue," — "+a(e.value.neighborhood),1)):e.value.tehran_district?(u(),d("span",De," — "+a(e.value.tehran_district),1)):e.value.village?(u(),d("span",Ne," — "+a(e.value.village),1)):v("",!0)]),t("p",null,[$e,_(" "+a(E(e.value.birth_date)),1)]),t("p",null,[Ae,_(" "+a(e.value.gender==="male"?"پسر":e.value.gender==="female"?"دختر":"—"),1)]),Pe,t("p",null,[Ee,_(" "+a(e.value.father_name||"—")+" — "+a(e.value.father_phone||"—")+" — "+a(e.value.father_job||"—"),1)]),t("p",null,[Me,_(" "+a(e.value.mother_name||"—")+" — "+a(e.value.mother_phone||"—")+" — "+a(e.value.mother_job||"—"),1)]),e.value.emergency_phone?(u(),d("p",Ve,[qe,_(" "+a(e.value.emergency_phone),1)])):v("",!0),Ke,t("p",null,[ze,_(" "+a(C(e.value.had_choir_experience)),1)]),e.value.choir_experience?(u(),d("pre",Je,a(e.value.choir_experience),1)):v("",!0),t("p",null,[Fe,_(" "+a(C(e.value.had_stage_performance)),1)]),e.value.stage_performance_details?(u(),d("pre",Ge,a(e.value.stage_performance_details),1)):v("",!0),t("p",null,[Oe,_(" "+a(C(e.value.had_music_class)),1)]),e.value.training_courses?(u(),d("pre",Ye,a(e.value.training_courses),1)):v("",!0),t("p",null,[He,_(" "+a(C(e.value.plays_instrument)),1)]),t("p",null,[Qe,_(" "+a((e.value.instruments||[]).join("، ")||"—"),1)]),t("p",null,[We,_(" "+a((e.value.activity_interests||[]).join("، ")||"—"),1)]),Xe,t("p",null,[Ze,_(" "+a([e.value.interest_1,e.value.interest_2,e.value.interest_3].filter(Boolean).join("، ")||"—"),1)]),et,t("pre",tt,a(e.value.why_join||"—"),1),at,t("pre",nt,a(e.value.future_wish||"—"),1),t("p",null,[st,_(" "+a(e.value.payment_status)+" — "+a((r=e.value.final_price)==null?void 0:r.toLocaleString("fa-IR"))+" ریال",1)]),t("p",null,[ot,_(" "+a(e.value.current_step)+" — "+a(e.value.registration_status),1)]),e.value.photo_url||e.value.video_url?(u(),d("p",lt,"فایل‌های ارسالی")):v("",!0),e.value.photo_url?(u(),d("div",it,[rt,c(L,{size:"small",type:"link",onClick:s[7]||(s[7]=U=>S("photo"))},{default:f(()=>[_("مشاهده عکس")]),_:1})])):v("",!0),e.value.video_url?(u(),d("div",_t,[ut,c(L,{size:"small",type:"link",onClick:s[8]||(s[8]=U=>S("video"))},{default:f(()=>[_("مشاهده ویدیو")]),_:1})])):v("",!0),e.value.parent_consent_name?(u(),d("p",dt,"تأیید والدین")):v("",!0),e.value.parent_consent_name?(u(),d("p",ct,[pt,_(" "+a(e.value.parent_consent_name),1)])):v("",!0),e.value.parent_consent_at?(u(),d("p",mt,[vt,_(" "+a(M(e.value.parent_consent_at)),1)])):v("",!0)])):v("",!0)]}),_:1},8,["visible"]),c(j,{visible:x.value,"onUpdate:visible":s[10]||(s[10]=r=>x.value=r),title:g.value==="photo"?"عکس هنرجو":"ویدیوی هنرجو",width:"90%",footer:null},{default:f(()=>[t("div",ft,[g.value==="photo"&&k.value?(u(),d("img",{key:0,src:k.value,alt:"عکس هنرجو",class:"max-w-full max-h-[70vh] rounded-lg object-contain"},null,8,ht)):g.value==="video"&&k.value?(u(),d("video",{key:1,src:k.value,controls:"",class:"w-full max-h-[70vh] rounded-lg bg-black"},null,8,gt)):v("",!0)])]),_:1},8,["visible","title"])]),_:1})])}}});export{Ot as default};