Files
machartaa_admin_dist/dist/assets/index-0226748a.js
T
2026-07-15 17:50:32 +03:30

3 lines
14 KiB
JavaScript

import{_ as ke}from"./BasicMainCard-b5ec3265.js";import{_ as Se}from"./button.vue_vue_type_style_index_0_lang-f45a0e84.js";import{d as Ce,q as Ie,u as qe,g as r,r as Ee,h as ie,E as Fe,v as ze,P as Be,o as s,c as l,b as i,w as $,a,t as m,e as ce,F as h,n as C,j as d,k as M,V as I,aM as q,D as f,O as Ue,M as Te,N as $e,p as Me,i as Pe}from"./index-4ed3ac6f.js";import{i as Re}from"./index-30e9b5a1.js";import{I as P}from"./Icon-1df01939.js";import{k as Le,l as je,m as Ae,n as Ne,o as De,p as Ve,q as Oe}from"./stepChallenge-40c4bec5.js";import{a as We,g as Ke}from"./convert-2ad76038.js";import{I as He}from"./index-9cf626d0.js";import{a as re}from"./index-e2784e5a.js";import{S as Xe}from"./index-59052094.js";import{_ as Ge}from"./index-82e6dde3.js";import{T as Je}from"./index-da74a8b6.js";import{_ as Qe}from"./_plugin-vue_export-helper-63226944.js";import"./index-793108ce.js";import"./index-a875f6da.js";import"./Col-a5f65985.js";import"./styleChecker-8552d8dc.js";import"./isPlainObject-28bd6686.js";import"./vnode-89c9e7cb.js";import"./FormItemContext-2461cbab.js";import"./isSymbol-affa2e59.js";import"./useState-8f767204.js";import"./useRefs-68a2914e.js";import"./_flatRest-1f22619a.js";import"./css-aae66f86.js";import"./DialogWrap-576e3f01.js";import"./pickAttrs-5db0ba14.js";import"./LeftOutlined-61414320.js";import"./index-23a87c32.js";import"./index-a14f73db.js";import"./toArray-7ead3702.js";const x=E=>(Te("data-v-e04ccdf5"),E=E(),$e(),E),Ye={class:"feedback-page"},Ze={class:"feedback-page__inner"},et={class:"feedback-page__header"},tt=x(()=>a("div",{class:"text-sm text-gray-500 mb-1"},"بازخوردهای چالش",-1)),at={class:"text-lg font-semibold m-0"},ot={class:"feedback-layout"},st={class:"feedback-menu"},nt=["onClick"],lt={class:"feedback-content"},it={key:0,class:"py-16 flex justify-center"},ct={key:0,class:"text-center text-gray-500 py-12"},rt={key:0,class:"step-feedback-desc mb-4"},dt={class:"space-y-4"},ut={class:"flex flex-wrap items-center justify-between gap-3"},mt=x(()=>a("h3",{class:"m-0 text-base font-semibold"},"پیشنهاد و انتقاد",-1)),pt=x(()=>a("p",{class:"text-sm text-gray-500 m-0"}," پیام‌هایی که کاربران در پایان چالش نوشته‌اند. ",-1)),_t={class:"space-y-4"},vt={class:"flex flex-wrap items-center justify-between gap-3"},ht=x(()=>a("h3",{class:"m-0 text-base font-semibold"},"بازخورد متنی",-1)),ft={class:"space-y-4"},yt={class:"flex flex-wrap items-center justify-between gap-3"},gt=x(()=>a("h3",{class:"m-0 text-base font-semibold"},"عکس",-1)),xt={key:0,class:"text-center text-gray-500 py-12"},bt={key:1,class:"photo-grid"},wt={class:"photo-card__body"},kt=["title"],St={class:"text-[11px] text-gray-500 mt-0.5 truncate",dir:"ltr"},Ct=["onClick"],It={class:"space-y-4"},qt={class:"flex flex-wrap items-center justify-between gap-3"},Et=x(()=>a("h3",{class:"m-0 text-base font-semibold"},"صوت ضبط‌شده",-1)),Ft={key:0,class:"voice-player-row"},zt=["src"],Bt=["onClick"],Ut={class:"space-y-4"},Tt={class:"flex flex-wrap items-center justify-between gap-3"},$t=x(()=>a("h3",{class:"m-0 text-base font-semibold"},"سوال چندگزینه‌ای",-1)),Mt={key:0,class:"text-center text-gray-500 py-12"},Pt={class:"mcq-block__question"},Rt={class:"font-semibold text-base"},Lt={class:"text-xs text-gray-500 mt-1"},jt={class:"mcq-block__grid"},At={class:"mcq-block__table"},Nt={class:"mcq-block__chart"},Dt={class:"mcq-legend"},Vt={class:"truncate"},Ot={class:"shrink-0 text-gray-600"},Wt=Ce({__name:"index",setup(E){const w=He.Search,F=Je,de=re,ue=re.TabPane,me=Ie(),pe=qe(),p=Number(me.params.challengeId),Y=r(""),R=r(!0),u=r("text"),b=r(""),z=r([]),L=r(""),j=r(""),A=r(""),N=r(""),D=r(""),V=r([]),B=r([]),O=r([]),k=r([]),Z=r([]),c=Ee({text:!1,photo:!1,voice:!1,mcq:!1,completion:!1}),W=new Map,U=new Map,ee=ie(()=>z.value.find(e=>String(e.id)===b.value)||null),_=ie(()=>{const e=Number(b.value);return Number.isFinite(e)&&e>0?e:null}),_e=[{key:"text",label:"بازخورد متنی",icon:"vuesax-linear:document-text"},{key:"photo",label:"عکس",icon:"vuesax-linear:gallery"},{key:"voice",label:"صوت ضبط‌شده",icon:"vuesax-linear:microphone-2"},{key:"mcq",label:"سوال چندگزینه‌ای",icon:"vuesax-linear:task-square"},{key:"completion",label:"پیشنهاد و انتقاد",icon:"vuesax-linear:message-text"}],ve=[{title:"ردیف",dataIndex:"index",key:"index",width:70,align:"center"},{title:"نام کاربر",dataIndex:"user_name",key:"user_name"},{title:"شماره موبایل",dataIndex:"user_phone",key:"user_phone",width:140},{title:"متن بازخورد",dataIndex:"feedback_text",key:"feedback_text"}],he=[{title:"ردیف",dataIndex:"index",key:"index",width:70,align:"center"},{title:"نام کاربر",dataIndex:"user_name",key:"user_name"},{title:"شماره موبایل",dataIndex:"user_phone",key:"user_phone",width:140},{title:"پیشنهاد و انتقاد",dataIndex:"feedback_text",key:"feedback_text"}],fe=[{title:"ردیف",dataIndex:"index",key:"index",width:70,align:"center"},{title:"نام کاربر",dataIndex:"user_name",key:"user_name"},{title:"شماره موبایل",dataIndex:"user_phone",key:"user_phone",width:140},{title:"صوت ضبط‌شده کاربر",key:"voice"}],ye=[{title:"ردیف",dataIndex:"index",key:"index",width:60,align:"center"},{title:"نام کاربر",dataIndex:"user_name",key:"user_name"},{title:"شماره موبایل",dataIndex:"user_phone",key:"user_phone",width:120},{title:"پاسخ",dataIndex:"answer_label",key:"answer_label"}];function ge(e,o){o instanceof HTMLElement?W.set(e,o):W.delete(e)}function T(e,o="image"){return e?e.startsWith("http://")||e.startsWith("https://")?e:o==="audio"?We(e):Ke(e):""}function te(){pe.push({name:"stepChallengesMain",query:{tab:"progress"}})}async function ae(e,o,y="image"){var g;try{const v=T(e,y);if(!v){f.error("آدرس فایل معتبر نیست");return}const t=await fetch(v);if(!t.ok)throw new Error("download failed");const n=await t.blob(),ne=((g=e.split(".").pop())==null?void 0:g.split("?")[0])||"bin",le=URL.createObjectURL(n),S=document.createElement("a");S.href=le,S.download=`${o}.${ne}`,document.body.appendChild(S),S.click(),S.remove(),URL.revokeObjectURL(le)}catch{window.open(T(e,y),"_blank")}}function oe(){U.forEach(e=>e.dispose()),U.clear()}function xe(){oe();const e=["#2563EB","#16A34A","#F59E0B","#DC2626","#7C3AED","#0891B2","#DB2777"];for(const o of k.value){const y=W.get(o.step_id);if(!y)continue;const g=Re(y);U.set(o.step_id,g);const v=(o.option_stats||[]).map((t,n)=>({name:t.label||`گزینه ${t.optionIndex+1}`,value:t.count,itemStyle:{color:e[n%e.length]}}));g.setOption({textStyle:{fontFamily:"iran-sans"},tooltip:{trigger:"item",textStyle:{fontFamily:"iran-sans"},formatter:t=>{const n=t.percent??0;return`${t.name}<br/>${t.value} نفر · ${n}%`}},legend:{orient:"horizontal",bottom:0,type:"scroll",textStyle:{fontFamily:"iran-sans"}},series:[{name:"آمار گزینه‌ها",type:"pie",radius:"65%",center:["50%","45%"],avoidLabelOverlap:!0,itemStyle:{borderRadius:4,borderColor:"#fff",borderWidth:2},label:{show:!0,fontFamily:"iran-sans",formatter:`{b}
{c} نفر ({d}%)`},labelLine:{show:!0},emphasis:{label:{show:!0,fontSize:14,fontWeight:"bold",fontFamily:"iran-sans"},itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.15)"}},data:v.length?v:[{name:"بدون پاسخ",value:0,itemStyle:{color:"#E5E7EB"}}]}]})}}async function K(){if(!_.value){V.value=[];return}c.text=!0;try{V.value=await Le(p,L.value,_.value)}catch(e){f.error(e.message||"خطا در بارگذاری بازخورد متنی")}finally{c.text=!1}}async function H(){if(!_.value){B.value=[];return}c.photo=!0;try{B.value=await je(p,j.value,_.value)}catch(e){f.error(e.message||"خطا در بارگذاری عکس‌ها")}finally{c.photo=!1}}async function X(){if(!_.value){O.value=[];return}c.voice=!0;try{O.value=await Ae(p,A.value,_.value)}catch(e){f.error(e.message||"خطا در بارگذاری صوت‌ها")}finally{c.voice=!1}}async function G(){if(!_.value){k.value=[];return}c.mcq=!0;try{k.value=await Ne(p,N.value,_.value),await Ue(),xe()}catch(e){f.error(e.message||"خطا در بارگذاری سوالات چندگزینه‌ای")}finally{c.mcq=!1}}async function J(){c.completion=!0;try{Z.value=await De(p,D.value)}catch(e){f.error(e.message||"خطا در بارگذاری پیشنهاد و انتقاد")}finally{c.completion=!1}}async function Q(e){e==="text"&&await K(),e==="photo"&&await H(),e==="voice"&&await X(),e==="mcq"&&await G(),e==="completion"&&await J()}async function be(){await Q(u.value)}async function we(){if(!p){f.error("شناسه چالش نامعتبر است"),te();return}R.value=!0;try{const[e,o]=await Promise.all([Ve(p),Oe(p)]);Y.value=(e==null?void 0:e.title)||"",z.value=o,b.value=o.length?String(o[0].id):"",b.value&&await Q(u.value)}catch(e){f.error(e.message||"خطا در بارگذاری صفحه")}finally{R.value=!1}}Fe(u,e=>{Q(e)});function se(){U.forEach(e=>e.resize())}return ze(()=>{we(),window.addEventListener("resize",se)}),Be(()=>{window.removeEventListener("resize",se),oe()}),(e,o)=>{const y=Se,g=ke;return s(),l("div",Ye,[i(g,null,{default:$(()=>{var v;return[a("div",Ze,[a("div",et,[a("div",null,[tt,a("h2",at,m(Y.value||"—"),1)]),i(y,{onClick:te},{default:$(()=>[i(P,{icon:"vuesax-linear:arrow-right",class:"ml-1"}),ce(" بازگشت به پیشرفت کاربران ")]),_:1})]),a("div",ot,[a("aside",st,[(s(),l(h,null,C(_e,t=>a("button",{key:t.key,type:"button",class:Me(["feedback-menu__item",{"feedback-menu__item--active":u.value===t.key}]),onClick:n=>u.value=t.key},[i(P,{icon:t.icon,class:"text-lg"},null,8,["icon"]),a("span",null,m(t.label),1)],10,nt)),64))]),a("section",lt,[R.value?(s(),l("div",it,[i(d(Xe),{size:"large"})])):(s(),l(h,{key:1},[z.value.length?(s(),l(h,{key:1},[u.value!=="completion"?(s(),l(h,{key:0},[i(d(de),{activeKey:b.value,"onUpdate:activeKey":o[0]||(o[0]=t=>b.value=t),class:"step-feedback-tabs",onChange:be},{default:$(()=>[(s(!0),l(h,null,C(z.value,t=>(s(),Pe(d(ue),{key:String(t.id),tab:t.label},null,8,["tab"]))),128))]),_:1},8,["activeKey"]),(v=ee.value)!=null&&v.description?(s(),l("div",rt,m(ee.value.description),1)):M("",!0)],64)):M("",!0),I(a("div",dt,[a("div",ut,[mt,i(d(w),{value:D.value,"onUpdate:value":o[1]||(o[1]=t=>D.value=t),placeholder:"جستجو بر اساس نام، موبایل یا متن","allow-clear":"",class:"max-w-sm",onSearch:J,onPressEnter:J},null,8,["value"])]),pt,i(d(F),{columns:he,"data-source":Z.value,loading:c.completion,pagination:{pageSize:10,showSizeChanger:!0},"row-key":"id",bordered:"",size:"middle"},null,8,["data-source","loading"])],512),[[q,u.value==="completion"]]),I(a("div",_t,[a("div",vt,[ht,i(d(w),{value:L.value,"onUpdate:value":o[2]||(o[2]=t=>L.value=t),placeholder:"جستجو بر اساس نام، موبایل یا متن","allow-clear":"",class:"max-w-sm",onSearch:K,onPressEnter:K},null,8,["value"])]),i(d(F),{columns:ve,"data-source":V.value,loading:c.text,pagination:{pageSize:10,showSizeChanger:!0},"row-key":"id",bordered:"",size:"middle"},null,8,["data-source","loading"])],512),[[q,u.value==="text"]]),I(a("div",ft,[a("div",yt,[gt,i(d(w),{value:j.value,"onUpdate:value":o[3]||(o[3]=t=>j.value=t),placeholder:"جستجو بر اساس نام یا شماره موبایل","allow-clear":"",class:"max-w-sm",onSearch:H,onPressEnter:H},null,8,["value"])]),!B.value.length&&!c.photo?(s(),l("div",xt," عکسی برای این مرحله ثبت نشده است. ")):(s(),l("div",bt,[(s(!0),l(h,null,C(B.value,t=>(s(),l("div",{key:t.id,class:"photo-card"},[i(d(Ge),{src:T(t.photo_url,"image"),preview:{mask:"پیش‌نمایش"},class:"photo-card__image"},null,8,["src"]),a("div",wt,[a("div",{class:"font-semibold text-xs truncate",title:t.user_name},m(t.user_name),9,kt),a("div",St,m(t.user_phone||"—"),1),a("button",{type:"button",class:"photo-card__download",title:"دانلود",onClick:n=>ae(t.photo_url,`photo-${t.id}`,"image")},[i(P,{icon:"vuesax-linear:document-download"}),ce(" دانلود ")],8,Ct)])]))),128))]))],512),[[q,u.value==="photo"]]),I(a("div",It,[a("div",qt,[Et,i(d(w),{value:A.value,"onUpdate:value":o[4]||(o[4]=t=>A.value=t),placeholder:"جستجو بر اساس نام یا شماره موبایل","allow-clear":"",class:"max-w-sm",onSearch:X,onPressEnter:X},null,8,["value"])]),i(d(F),{columns:fe,"data-source":O.value,loading:c.voice,pagination:{pageSize:10,showSizeChanger:!0},"row-key":"id",bordered:"",size:"middle"},{bodyCell:$(({column:t,record:n})=>[t.key==="voice"?(s(),l("div",Ft,[a("audio",{src:T(n.voice_url,"audio"),controls:"",preload:"metadata",class:"voice-player"},null,8,zt),a("button",{type:"button",class:"voice-download-btn",title:"دانلود",onClick:ne=>ae(n.voice_url,`voice-${n.id}`,"audio")},[i(P,{icon:"vuesax-linear:document-download"})],8,Bt)])):M("",!0)]),_:1},8,["data-source","loading"])],512),[[q,u.value==="voice"]]),I(a("div",Ut,[a("div",Tt,[$t,i(d(w),{value:N.value,"onUpdate:value":o[5]||(o[5]=t=>N.value=t),placeholder:"جستجو بر اساس نام یا شماره موبایل","allow-clear":"",class:"max-w-sm",onSearch:G,onPressEnter:G},null,8,["value"])]),!k.value.length&&!c.mcq?(s(),l("div",Mt," سوال چندگزینه‌ای برای این مرحله تعریف نشده یا پاسخی ثبت نشده است. ")):M("",!0),(s(!0),l(h,null,C(k.value,t=>(s(),l("div",{key:t.step_id,class:"mcq-block"},[a("div",Pt,[a("div",Rt,m(t.question),1),a("div",Lt,"تعداد پاسخ‌ها: "+m(t.total_answers),1)]),a("div",jt,[a("div",At,[i(d(F),{columns:ye,"data-source":t.answers,pagination:{pageSize:8,showSizeChanger:!0},"row-key":"id",bordered:"",size:"small"},null,8,["data-source"])]),a("div",Nt,[a("div",{ref_for:!0,ref:n=>ge(t.step_id,n),class:"mcq-chart"},null,512),a("div",Dt,[(s(!0),l(h,null,C(t.option_stats,n=>(s(),l("div",{key:n.optionIndex,class:"mcq-legend__item"},[a("span",Vt,m(n.label||`گزینه ${n.optionIndex+1}`),1),a("span",Ot,m(n.count)+" نفر · "+m(n.percent)+"٪",1)]))),128))])])])]))),128))],512),[[q,u.value==="mcq"]])],64)):(s(),l("div",ct," مرحله‌ای برای این چالش تعریف نشده است. "))],64))])])])]}),_:1})])}}});const ka=Qe(Wt,[["__scopeId","data-v-e04ccdf5"]]);export{ka as default};