2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{_ as O}from"./BasicMainCard-870e6a2f.js";import{_ as Y}from"./BasicModal.vue_vue_type_style_index_0_lang-726d71cc.js";import{_ as H}from"./button.vue_vue_type_style_index_0_lang-25794594.js";import{_ as Q,a as X,u as Z}from"./useBaseTable-54b44400.js";import{_ as V}from"./BasicInput.vue_vue_type_style_index_0_lang-d9dc6382.js";import{_ as ee}from"./BasicTextArea.vue_vue_type_style_index_0_lang-65d10079.js";import{I as te}from"./Icon-b81ad543.js";import{t as A,a as ne}from"./useDataTime-6fbd057f.js";import{I as B,d as ae,g as w,r as se,h as re,x as oe,o as v,c as f,b as h,w as x,j as T,G as ie,a as n,t as r,e as m,k as b,D as I}from"./index-4139499d.js";import{g as le}from"./convert-67c23be8.js";import{T as U}from"./index-32f1bdce.js";import{T as ue}from"./shallowequal-26ff1c74.js";import"./_plugin-vue_export-helper-c6b863a5.js";import"./index-1f06eb35.js";import"./Col-8e46ddda.js";import"./vnode-b177b857.js";import"./isPlainObject-ae5f6084.js";import"./index-975727f6.js";import"./index-3fee3d89.js";import"./pickAttrs-782832e8.js";import"./FormItemContext-dfbd6afd.js";import"./index-862849ae.js";import"./toArray-92f12fb1.js";import"./useState-ec2259f2.js";import"./index-23976fcd.js";import"./index-9520c8d4.js";import"./usePrice-7afab779.js";import"./useRefs-5fd4ee0f.js";const _e=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:t=>t.record.index+1},{title:"نام",dataIndex:"first_name",key:"first_name",filterField:"first_name",customRender:t=>[t.record.first_name,t.record.last_name].filter(Boolean).join(" ")||t.record.user_name||"—"},{title:"موبایل",dataIndex:"user_phone",key:"user_phone",filterField:"user_phone"},{title:"استان",dataIndex:"province",key:"province",filterField:"province"},{title:"وضعیت پرداخت",dataIndex:"payment_status_label",key:"payment_status_label",filterField:"payment_status_label"},{title:"مرحله",dataIndex:"current_step_label",key:"current_step_label",filterField:"current_step_label"},{title:"ثبتنام",dataIndex:"registration_status_label",key:"registration_status_label",filterField:"registration_status_label"},{title:"تاریخ",dataIndex:"created_at",key:"created_at",type:"DateTime",filterField:"created_at",customRender:t=>A(t.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center",width:90}],ce={landing:"صفحه پرداخت",form_1:"اطلاعات فردی",form_2:"اطلاعات والدین",form_3:"تواناییها",form_4:"درباره خودت",form_5:"عکس",form_6:"ویدئو",form_7:"تأیید والدین",review:"بازبینی",submitted:"ثبت نهایی"},de={pending:"در انتظار",paid:"پرداخت شده",failed:"ناموفق",cancelled:"لغو شده"};function pe(t,s){const a=Array.isArray(t.users)?t.users[0]:t.users,o=(a==null?void 0:a.name)||[a==null?void 0:a.first_name,a==null?void 0:a.last_name].filter(Boolean).join(" ").trim()||"—";return{...t,index:s,user_name:o,user_phone:(a==null?void 0:a.phone)||t.phone||"—",current_step_label:ce[t.current_step]||t.current_step,payment_status_label:de[t.payment_status]||t.payment_status,registration_status_label:t.registration_status==="submitted"?"تکمیل شده":"پیشنویس"}}function L(t,s){switch(s){case"first_name":return[t.first_name,t.last_name,t.user_name].filter(Boolean).join(" ");case"user_phone":return t.user_phone||t.phone||"";default:return t[s]}}function me(t){return t==null||t===""?null:t}function ve(t,s,a){if(me(s)===null)return!0;if(typeof t=="string"&&/^\d{4}-\d{2}-\d{2}/.test(t)&&!Number.isNaN(Date.parse(t))){const l=new Date(t).getTime(),_=new Date(s).getTime();if(Number.isNaN(_))return String(t||"").toLowerCase().includes(String(s).toLowerCase());switch(a){case"eq":return l===_;case"not":case"neq":return l!==_;case"gt":return l>_;case"gte":return l>=_;case"lt":return l<_;case"lte":return l<=_;default:return String(t||"").toLowerCase().includes(String(s).toLowerCase())}}const d=String(t??"").toLowerCase(),e=String(s).toLowerCase();switch(a){case"eq":return d===e;case"not":case"neq":return d!==e;case"gt":return Number(t)>Number(s);case"gte":return Number(t)>=Number(s);case"lt":return Number(t)<Number(s);case"lte":return Number(t)<=Number(s);case"has":case"like":return d.includes(e);case"sw":return d.startsWith(e);case"ew":return d.endsWith(e);case"nn":return t!=null&&String(t).trim()!=="";case"in":return(Array.isArray(s)?s:String(s).split(",").map(_=>_.trim())).some(_=>d.includes(String(_).toLowerCase()));default:return!0}}function fe(t,s){if(!(s!=null&&s.length))return t;const a=s.filter(o=>o.field&&!o.hidden);return a.length?t.filter(o=>a.every(y=>{const d=L(o,y.field);return ve(d,y.value,y.op)})):t}function he(t,s){if(!(s!=null&&s.trim()))return t;const a=s.trim().toLowerCase();return t.filter(o=>(o.first_name||"").toLowerCase().includes(a)||(o.last_name||"").toLowerCase().includes(a)||(o.phone||"").toLowerCase().includes(a)||(o.city||"").toLowerCase().includes(a)||(o.province||"").toLowerCase().includes(a)||(o.user_name||"").toLowerCase().includes(a)||(o.user_phone||"").toLowerCase().includes(a)||(o.payment_status_label||"").toLowerCase().includes(a)||(o.current_step_label||"").toLowerCase().includes(a)||(o.registration_status_label||"").toLowerCase().includes(a))}function ge(t,s){const a=[...t],{sort:o,order:y}=s;if(o!=null&&o.key){const d=o.order==="asc";return a.sort((e,l)=>{const _=L(e,o.key),g=L(l,o.key);return _<g?d?-1:1:_>g?d?1:-1:0}),a}if(y){const d=!y.startsWith("-"),e=y.replace(/^[-+]/,"");return a.sort((l,_)=>{const g=L(l,e),k=L(_,e);return g<k?d?-1:1:g>k?d?1:-1:0}),a}return a.sort((d,e)=>{const l=d.created_at?new Date(d.created_at).getTime():0;return(e.created_at?new Date(e.created_at).getTime():0)-l}),a}async function be(t){const{limit:s=20,page:a=1,search:o,filters:y}=t,{data:d,error:e}=await B.from("choir_registrations").select("*, users(name, phone, first_name, last_name)").order("created_at",{ascending:!1});if(e)throw e;let l=(d||[]).map((c,C)=>pe(c,C));l=he(l,o),l=fe(l,y),l=ge(l,t);const _=l.length,g=(a-1)*s;return{rows:l.slice(g,g+s).map((c,C)=>({...c,index:g+C})),total:_,query:{...t,total:_,page:a,limit:s}}}async function ye(){const{data:t,error:s}=await B.from("choir_registration_config").select("*").eq("id",1).maybeSingle();if(s)throw s;return t}async function xe(t){const{data:s,error:a}=await B.from("choir_registration_config").upsert({id:1,...t,updated_at:new Date().toISOString()}).select().single();if(a)throw a;return s}async function ke(t){const{data:s,error:a}=await B.from("choir_registrations").select("*, users(name, phone, first_name, last_name)").eq("id",t).single();if(a)throw a;return s}const we=n("div",{class:"mb-4"},[n("h2",null,"لیست ثبتنام گروه سرود")],-1),Ce=n("span",null,"جزئیات",-1),Te={class:"max-w-2xl space-y-4 py-2"},Le=n("div",{class:"mb-1 text-sm text-gray-600"},"کد embed آپارات (معرفی)",-1),Se=n("div",{class:"mb-1 text-sm text-gray-600"},"کد embed آپارات (راهنمای آپلود)",-1),Ne=n("div",{class:"mb-1 text-sm text-gray-600"},"متن بالای دکمه بارگذاری ویدیو",-1),Be={class:"mb-1 text-sm text-gray-600"},De=n("div",{class:"mb-1 text-sm text-gray-600"},"متن قوانین",-1),Ie={class:"flex items-center gap-2"},Fe=n("span",null,"ثبتنام باز است",-1),Re={key:0,class:"text-sm space-y-2 leading-7"},je=n("b",null,"نام:",-1),Ue={key:0},Ae=n("b",null,"پایه / مدرسه:",-1),$e=n("b",null,"محل:",-1),qe={key:0},Pe={key:1},Ee={key:2},Me=n("b",null,"تولد:",-1),ze=n("b",null,"جنسیت:",-1),Ke=n("p",{class:"font-700 mt-3"},"اطلاعات والدین",-1),We=n("b",null,"پدر:",-1),Je=n("b",null,"مادر:",-1),Ge={key:0},Oe=n("b",null,"تماس اضطراری:",-1),Ye=n("p",{class:"font-700 mt-3"},"تواناییها",-1),He=n("b",null,"سابقه گروه سرود:",-1),Qe={key:1,class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Xe=n("b",null,"اجرای صحنه:",-1),Ze={key:2,class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},Ve=n("b",null,"کلاس موسیقی:",-1),et={key:3,class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},tt=n("b",null,"نوازندگی:",-1),nt=n("b",null,"سازها:",-1),at=n("b",null,"علاقهمندیها:",-1),st=n("p",{class:"font-700 mt-3"},"درباره هنرجو",-1),rt=n("b",null,"علاقهمندیها:",-1),ot=n("p",null,[n("b",null,"دلیل عضویت:")],-1),it={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},lt=n("p",null,[n("b",null,"آرزوی آینده:")],-1),ut={class:"whitespace-pre-wrap bg-gray-50 p-2 rounded"},_t=n("b",null,"پرداخت:",-1),ct=n("b",null,"مرحله:",-1),dt={key:4,class:"font-700 mt-3"},pt={key:5,class:"flex items-center gap-2"},mt=n("b",null,"عکس:",-1),vt={key:6,class:"flex items-center gap-2"},ft=n("b",null,"ویدیو:",-1),ht={key:7,class:"font-700 mt-3"},gt={key:8},bt=n("b",null,"نام والد:",-1),yt={key:9},xt=n("b",null,"تاریخ تأیید:",-1),kt={class:"flex justify-center"},wt=["src"],Ct=["src"],Vt=ae({__name:"index",setup(t){const s=U,a=U.TabPane,o=w("list"),[y]=Z(),d=w(!1),e=w(null),l=w(!1),_=w("photo"),g=w(""),k=w(!1),c=se({intro_aparat_embed_code:"",upload_guide_aparat_embed_code:"",video_upload_note_text:"",price_rial:499e4,terms_text:"",is_registration_open:!0}),C=re(()=>Math.round(Number(c.price_rial||0)/10).toLocaleString("fa-IR")),$={columns:_e,api:be,defaultPageLimit:20};async function q(u){try{e.value=await ke(u.id),d.value=!0}catch(i){I.error((i==null?void 0:i.message)||"خطا")}}function S(u){return u===!0?"بله":u===!1?"خیر":"—"}function P(u){return u?ne(u):"—"}function E(u){return u?A(u):"—"}function F(u){if(!e.value)return;const i=u==="photo"?e.value.photo_url:e.value.video_url;i&&(_.value=u,g.value=le(i),l.value=!0)}async function M(){const u=await ye();u&&(c.intro_aparat_embed_code=u.intro_aparat_embed_code||"",c.upload_guide_aparat_embed_code=u.upload_guide_aparat_embed_code||"",c.video_upload_note_text=u.video_upload_note_text||"",c.price_rial=u.price_rial??499e4,c.terms_text=u.terms_text||"",c.is_registration_open=u.is_registration_open!==!1)}async function z(){k.value=!0;try{await xe({...c,price_rial:Number(c.price_rial)}),I.success("تنظیمات ذخیره شد")}catch(u){I.error((u==null?void 0:u.message)||"خطا")}finally{k.value=!1}}return oe(M),(u,i)=>{const K=Q,N=ee,W=V,J=X,D=H,R=Y,G=O;return v(),f("div",null,[h(G,null,{default:x(()=>[h(T(s),{activeKey:o.value,"onUpdate:activeKey":i[6]||(i[6]=p=>o.value=p)},{default:x(()=>[h(T(a),{key:"list",tab:"ثبتنامها"},{default:x(()=>[we,h(K,ie($,{onRegister:T(y)}),{action:x(({record:p})=>[h(T(ue),{class:"cursor-pointer"},{title:x(()=>[Ce]),default:x(()=>[h(te,{icon:"vuesax-linear:eye",color:"#1D4ED8",onClick:j=>q(p)},null,8,["onClick"])]),_:2},1024)]),_:1},16,["onRegister"])]),_:1}),h(T(a),{key:"settings",tab:"تنظیمات صفحه"},{default:x(()=>[n("div",Te,[n("div",null,[Le,h(N,{value:c.intro_aparat_embed_code,"onUpdate:value":i[0]||(i[0]=p=>c.intro_aparat_embed_code=p),placeholder:"کد embed از آپارات",rows:3},null,8,["value"])]),n("div",null,[Se,h(N,{value:c.upload_guide_aparat_embed_code,"onUpdate:value":i[1]||(i[1]=p=>c.upload_guide_aparat_embed_code=p),placeholder:"کد embed از آپارات",rows:3},null,8,["value"])]),n("div",null,[Ne,h(N,{value:c.video_upload_note_text,"onUpdate:value":i[2]||(i[2]=p=>c.video_upload_note_text=p),placeholder:"اختیاری — اگر خالی باشد در فرم نمایش داده نمیشود",rows:3},null,8,["value"])]),n("div",null,[n("div",Be,"مبلغ (ریال) — نمایش تومان: "+r(C.value),1),h(W,{value:c.price_rial,"onUpdate:value":i[3]||(i[3]=p=>c.price_rial=p),type:"number"},null,8,["value"])]),n("div",null,[De,h(N,{value:c.terms_text,"onUpdate:value":i[4]||(i[4]=p=>c.terms_text=p),rows:4},null,8,["value"])]),n("div",Ie,[h(J,{value:c.is_registration_open,"onUpdate:value":i[5]||(i[5]=p=>c.is_registration_open=p)},null,8,["value"]),Fe]),h(D,{type:"primary",loading:k.value,onClick:z},{default:x(()=>[m("ذخیره تنظیمات")]),_:1},8,["loading"])])]),_:1})]),_:1},8,["activeKey"]),h(R,{visible:d.value,"onUpdate:visible":i[9]||(i[9]=p=>d.value=p),title:"جزئیات ثبتنام",width:"90%",footer:null},{default:x(()=>{var p;return[e.value?(v(),f("div",Re,[n("p",null,[je,m(" "+r(e.value.first_name)+" "+r(e.value.last_name)+" ",1),e.value.preferred_name?(v(),f("span",Ue," ("+r(e.value.preferred_name)+")",1)):b("",!0)]),n("p",null,[Ae,m(" "+r(e.value.grade_level||"—")+" — "+r(e.value.school||"—"),1)]),n("p",null,[$e,m(" "+r(e.value.province)+" / "+r(e.value.city)+" ",1),e.value.neighborhood?(v(),f("span",qe," — "+r(e.value.neighborhood),1)):e.value.tehran_district?(v(),f("span",Pe," — "+r(e.value.tehran_district),1)):e.value.village?(v(),f("span",Ee," — "+r(e.value.village),1)):b("",!0)]),n("p",null,[Me,m(" "+r(P(e.value.birth_date)),1)]),n("p",null,[ze,m(" "+r(e.value.gender==="male"?"پسر":e.value.gender==="female"?"دختر":"—"),1)]),Ke,n("p",null,[We,m(" "+r(e.value.father_name||"—")+" — "+r(e.value.father_phone||"—")+" — "+r(e.value.father_job||"—"),1)]),n("p",null,[Je,m(" "+r(e.value.mother_name||"—")+" — "+r(e.value.mother_phone||"—")+" — "+r(e.value.mother_job||"—"),1)]),e.value.emergency_phone?(v(),f("p",Ge,[Oe,m(" "+r(e.value.emergency_phone),1)])):b("",!0),Ye,n("p",null,[He,m(" "+r(S(e.value.had_choir_experience)),1)]),e.value.choir_experience?(v(),f("pre",Qe,r(e.value.choir_experience),1)):b("",!0),n("p",null,[Xe,m(" "+r(S(e.value.had_stage_performance)),1)]),e.value.stage_performance_details?(v(),f("pre",Ze,r(e.value.stage_performance_details),1)):b("",!0),n("p",null,[Ve,m(" "+r(S(e.value.had_music_class)),1)]),e.value.training_courses?(v(),f("pre",et,r(e.value.training_courses),1)):b("",!0),n("p",null,[tt,m(" "+r(S(e.value.plays_instrument)),1)]),n("p",null,[nt,m(" "+r((e.value.instruments||[]).join("، ")||"—"),1)]),n("p",null,[at,m(" "+r((e.value.activity_interests||[]).join("، ")||"—"),1)]),st,n("p",null,[rt,m(" "+r([e.value.interest_1,e.value.interest_2,e.value.interest_3].filter(Boolean).join("، ")||"—"),1)]),ot,n("pre",it,r(e.value.why_join||"—"),1),lt,n("pre",ut,r(e.value.future_wish||"—"),1),n("p",null,[_t,m(" "+r(e.value.payment_status)+" — "+r((p=e.value.final_price)==null?void 0:p.toLocaleString("fa-IR"))+" ریال",1)]),n("p",null,[ct,m(" "+r(e.value.current_step)+" — "+r(e.value.registration_status),1)]),e.value.photo_url||e.value.video_url?(v(),f("p",dt,"فایلهای ارسالی")):b("",!0),e.value.photo_url?(v(),f("div",pt,[mt,h(D,{size:"small",type:"link",onClick:i[7]||(i[7]=j=>F("photo"))},{default:x(()=>[m("مشاهده عکس")]),_:1})])):b("",!0),e.value.video_url?(v(),f("div",vt,[ft,h(D,{size:"small",type:"link",onClick:i[8]||(i[8]=j=>F("video"))},{default:x(()=>[m("مشاهده ویدیو")]),_:1})])):b("",!0),e.value.parent_consent_name?(v(),f("p",ht,"تأیید والدین")):b("",!0),e.value.parent_consent_name?(v(),f("p",gt,[bt,m(" "+r(e.value.parent_consent_name),1)])):b("",!0),e.value.parent_consent_at?(v(),f("p",yt,[xt,m(" "+r(E(e.value.parent_consent_at)),1)])):b("",!0)])):b("",!0)]}),_:1},8,["visible"]),h(R,{visible:l.value,"onUpdate:visible":i[10]||(i[10]=p=>l.value=p),title:_.value==="photo"?"عکس هنرجو":"ویدیوی هنرجو",width:"90%",footer:null},{default:x(()=>[n("div",kt,[_.value==="photo"&&g.value?(v(),f("img",{key:0,src:g.value,alt:"عکس هنرجو",class:"max-w-full max-h-[70vh] rounded-lg object-contain"},null,8,wt)):_.value==="video"&&g.value?(v(),f("video",{key:1,src:g.value,controls:"",class:"w-full max-h-[70vh] rounded-lg bg-black"},null,8,Ct)):b("",!0)])]),_:1},8,["visible","title"])]),_:1})])}}});export{Vt as default};
|