Files
tehran_taj/apps/user-app-v2/dist/assets/DashboardView-D-g2Xx7S.js
T

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as J,U as Q,y as X,h as c,K as L,A as Z,o as ss,z as M,c as u,p as a,C as g,m as i,s as D,W as O,D as es,P as ts,v as B,b as _,I as n,f as A,n as y,e,t as p,T as as,g as T,B as os,F as ns,i as z,E as is,_ as ls}from"./index-Bykh8nbZ.js";import{A as rs}from"./AppPullRefresh-D0jzzVYl.js";import{P as ds}from"./PageBar-CwAs_H2k.js";import{R as us}from"./RateStrip-B6CNyWoT.js";import{p as _s}from"./filters-DkaYCcJY.js";import{D as q}from"./index-BNXQdVHk.js";import"./KeyCode-B4-nyHI0.js";import"./classCallCheck-zD9zMNqH.js";import"./raf-nDFcuFT6.js";const hs={class:"dash"},cs={key:1,class:"dash__exitSpacer","aria-hidden":"true"},ps={class:"dash__heroHead"},vs={class:"dash__heroIdentity"},fs={class:"dash__heroName"},ms={class:"dash__heroMobile"},bs={class:"dash__heroBalance"},ys={class:"dash__heroFigure"},ws={class:"dash__heroNum"},gs={class:"dash__heroDebt"},xs={class:"dash__heroHead"},ks={class:"dash__heroIdentity"},Cs={class:"dash__heroMobile"},Is={class:"dash__heroPending"},zs=["alt"],Ss={class:"dash__bannerIcon","aria-hidden":"true"},$s={class:"dash__bannerText"},Ls={class:"dash__bannerChevron","aria-hidden":"true"},Ds={class:"dash__rowIcon","aria-hidden":"true"},Bs={class:"dash__rowChevron","aria-hidden":"true"},Ts={class:"dash__rowIcon","aria-hidden":"true"},Es={class:"dash__rowChevron","aria-hidden":"true"},Ns={class:"dash__rowIcon","aria-hidden":"true"},Fs={class:"dash__rowChevron","aria-hidden":"true"},Ps={class:"dash__rowIcon","aria-hidden":"true"},Rs={class:"dash__rowChevron","aria-hidden":"true"},Vs={class:"dash__rowIcon","aria-hidden":"true"},Us={class:"dash__rowChevron","aria-hidden":"true"},Ms={class:"dash__rowIcon","aria-hidden":"true"},Os={class:"dash__rowChevron","aria-hidden":"true"},As={class:"dash__rowIcon","aria-hidden":"true"},qs={class:"dash__rowChevron","aria-hidden":"true"},Gs={class:"dash__rowIcon","aria-hidden":"true"},Hs={class:"dash__rowChevron","aria-hidden":"true"},Ks={class:"dash__rowIcon","aria-hidden":"true"},Ws={class:"dash__rowChevron","aria-hidden":"true"},Ys={class:"dash__choice"},js={class:"dash__choice"},Js=70,Qs=J({__name:"DashboardView",setup(Xs){const l=es(),r=Q(),m=X(),d=c(m.peek(L.profile)??null),E=c(m.peek(L.goldPrice)??null),x=c(m.peek(L.customButton)??null),S=c(!1),w=c(!1),G=z(()=>{const t=x.value;return(t==null?void 0:t.audience)==="loggedIn"&&!r.isLoggedIn?!1:!!(t!=null&&t.enabled&&t.title.trim()&&t.link.trim())});function H(){var s,f;const t=(f=(s=x.value)==null?void 0:s.link)==null?void 0:f.trim();t&&window.open(t,"_blank","noopener,noreferrer")}const N=z(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),K=z(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),W=z(()=>{const t=K.value;return Number.isFinite(t)?t.toLocaleString("fa-IR",{maximumFractionDigits:3}):"۰"}),v=ts({notify:!1,loginNotify:!1});function h(t){if(!r.isLoggedIn){v.loginNotify=!0;return}t===0&&l.push({name:"ordersList"}),t===1&&l.push({name:"transactionsList"}),t===2&&l.push({name:"profileData"}),t===3&&l.push({name:"favoritesList"}),t===4&&l.push({name:"ChildOrder"}),t===5&&l.push({name:"customerChoice"}),t===6&&l.push({name:"report"}),t===7&&(k.value=!0),t===8&&(C.value=!0)}const k=c(!1);function F(t){k.value=!1,l.push({name:t})}const C=c(!1);function P(t){C.value=!1;const s=t==="surveyFeed"?"/surveys":"/surveys/mine";M(()=>{l.push(s).catch(()=>{window.location.assign(s)})})}async function Y(){v.notify=!1;try{await B.endSharedSession()}catch{}let t=null;try{t=(await B.ssoLogoutUrl()).logout_url}catch{t=null}if(r.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),t){window.location.assign(t);return}l.push({name:"home"})}async function I(){w.value=!1;const[t,s,f]=await Promise.allSettled([r.isLoggedIn?m.me({force:!0}):Promise.resolve(null),m.goldPrice({force:!0}),m.customButton({force:!0})]);t.status==="fulfilled"?(d.value=t.value,w.value=!1):(w.value=r.isLoggedIn&&!d.value,console.log(t.reason)),E.value=s.status==="fulfilled"?s.value:null,f.status==="fulfilled"&&(x.value=f.value)}async function j(){try{await I()}finally{S.value=!1}}async function R(){if(r.isLoggedIn)try{const t=await B.getExpertIdentity();r.setSalesExpert(t.isSalesExpert)}catch{}}let V=!1;Z(()=>{V&&(I(),R()),V=!0});let U=!1;const $=c(U);function b(t){return{"--reveal-delay":`${t*Js}ms`}}return ss(async()=>{R(),await I(),!$.value&&(await M(),requestAnimationFrame(()=>{$.value=!0,U=!0}))}),(t,s)=>{const f=is("container");return _(),u("div",hs,[a(ds,{title:"میز کار","back-to":"home"},{trailing:g(()=>[i(r).isLoggedIn?(_(),u("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:s[0]||(s[0]=o=>v.notify=!0)},[a(n,{icon:"vuesax-linear:logout",size:"18"})])):(_(),u("span",cs))]),_:1}),a(rs,{modelValue:S.value,"onUpdate:modelValue":s[11]||(s[11]=o=>S.value=o),onRefresh:j},{default:g(()=>[a(f,{class:A(["dash__body",{"is-revealed":$.value}])},{default:g(()=>[i(r).isLoggedIn&&d.value?(_(),u("section",{key:0,class:"dash__hero dash__reveal",style:y(b(0))},[e("header",ps,[e("div",vs,[e("span",fs,p(d.value.fullName),1),e("span",ms,p(i(r).mobile),1)]),e("span",{class:A(["dash__heroSeal",N.value?"is-debtor":"is-creditor"])},p(N.value?"بدهکار":"بستانکار"),3)]),e("div",bs,[e("div",ys,[e("span",ws,p(W.value),1),s[21]||(s[21]=e("span",{class:"dash__heroUnit"},"گرم",-1))]),s[22]||(s[22]=e("span",{class:"dash__heroEyebrow"},"موجودی طلا",-1))]),e("div",gs,[s[24]||(s[24]=e("span",{class:"dash__heroDebtLabel"},"بدهی ریالی",-1)),e("b",null,[as(p(i(_s)(d.value.fiatDebtRial))+" ",1),s[23]||(s[23]=e("i",null,"ریال",-1))])])],4)):i(r).isLoggedIn?(_(),u("section",{key:1,class:"dash__hero dash__hero--pending dash__reveal",style:y(b(0))},[e("header",xs,[e("div",ks,[s[25]||(s[25]=e("span",{class:"dash__heroName"},"حساب شما",-1)),e("span",Cs,p(i(r).mobile),1)])]),e("p",Is,p(w.value?"موجودی الان در دسترس نیست. دوباره تلاش کنید.":"در حال دریافت موجودی…"),1),w.value?(_(),u("button",{key:0,type:"button",class:"dash__heroRetry",onClick:I}," تلاش دوباره ")):T("",!0)],4)):(_(),u("section",{key:2,class:"dash__hero dash__invite dash__reveal",style:y(b(0))},[e("img",{class:"dash__inviteLogo",src:os,alt:i(D).name},null,8,zs),e("button",{type:"button",class:"dash__inviteCta",onClick:s[1]||(s[1]=o=>i(l).push({name:"login"}))}," ورود / ثبت‌نام ")],4)),G.value?(_(),u("button",{key:3,type:"button",class:"dash__banner dash__reveal",style:y(b(1)),onClick:H},[e("span",Ss,[a(n,{icon:"vuesax-linear:link-2",size:"18"})]),e("span",$s,[e("b",null,p(x.value.title.trim()),1)]),e("span",Ls,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])],4)):T("",!0),e("section",{class:"dash__rows dash__reveal",style:y(b(1))},[e("button",{type:"button",class:"dash__row",onClick:s[2]||(s[2]=o=>h(0))},[e("span",Ds,[a(n,{icon:"vuesax-linear:box",size:"18"})]),s[26]||(s[26]=e("span",{class:"dash__rowText"},[e("b",null,"سفارشات")],-1)),e("span",Bs,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[3]||(s[3]=o=>h(1))},[e("span",Ts,[a(n,{icon:"vuesax-linear:receipt-text",size:"18"})]),s[27]||(s[27]=e("span",{class:"dash__rowText"},[e("b",null,"اسناد")],-1)),e("span",Es,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[4]||(s[4]=o=>h(2))},[e("span",Ns,[a(n,{icon:"vuesax-linear:user",size:"18"})]),s[28]||(s[28]=e("span",{class:"dash__rowText"},[e("b",null,"پروفایل")],-1)),e("span",Fs,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[5]||(s[5]=o=>h(3))},[e("span",Ps,[a(n,{icon:"vuesax-linear:heart",size:"18"})]),s[29]||(s[29]=e("span",{class:"dash__rowText"},[e("b",null,"علاقمندی")],-1)),e("span",Rs,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[6]||(s[6]=o=>h(8))},[e("span",Vs,[a(n,{icon:"vuesax-linear:like-1",size:"18"})]),s[30]||(s[30]=e("span",{class:"dash__rowText"},[e("b",null,"نظرسنجی طرح")],-1)),e("span",Us,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[7]||(s[7]=o=>h(6))},[e("span",Ms,[a(n,{icon:"vuesax-linear:chart-2",size:"18"})]),s[31]||(s[31]=e("span",{class:"dash__rowText"},[e("b",null,"گزارش")],-1)),e("span",Os,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[8]||(s[8]=o=>i(l).push({name:"appearanceSettings"}))},[e("span",As,[a(n,{icon:"vuesax-linear:brush",size:"18"})]),s[32]||(s[32]=e("span",{class:"dash__rowText"},[e("b",null,"تنظیمات ظاهری")],-1)),e("span",qs,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),i(r).isSalesExpert?(_(),u(ns,{key:0},[e("button",{type:"button",class:"dash__row",onClick:s[9]||(s[9]=o=>h(4))},[e("span",Gs,[a(n,{icon:"vuesax-linear:box-tick",size:"18"})]),s[33]||(s[33]=e("span",{class:"dash__rowText"},[e("b",null,"سفارش مشتریان")],-1)),e("span",Hs,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),e("button",{type:"button",class:"dash__row",onClick:s[10]||(s[10]=o=>h(5))},[e("span",Ks,[a(n,{icon:"vuesax-linear:profile-2user",size:"18"})]),s[34]||(s[34]=e("span",{class:"dash__rowText"},[e("b",null,"مشتریان من")],-1)),e("span",Ws,[a(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])])],64)):T("",!0)],4),a(us,{quote:E.value,class:"dash__rate dash__reveal",style:y(b(2))},null,8,["quote","style"])]),_:1},8,["class"])]),_:1},8,["modelValue"]),a(O,{show:v.notify,"onUpdate:show":s[12]||(s[12]=o=>v.notify=o),art:"logout",title:"آیا می خواهید از برنامه خارج شوید؟",description:`برای استفاده دوباره از امکانات ${i(D).name}، باید دوباره وارد حساب کاربری خود شوید.`,"confirm-text":"بله","cancel-text":"بی خیال",onConfirm:Y},null,8,["show","description"]),a(O,{show:v.loginNotify,"onUpdate:show":s[13]||(s[13]=o=>v.loginNotify=o),art:"login",title:"ابتدا وارد حساب کاربری شوید",description:`برای دسترسی به تمامی امکانات نرم افزار ${i(D).name}، گزینه ورود/ثبت نام را لمس کنید و در صورت نداشتن حساب کاربری، ثبت نام نمایید.`,"confirm-text":"ورود/ثبت نام","cancel-text":"بیخیال",onConfirm:s[14]||(s[14]=o=>i(l).push({name:"login"}))},null,8,["show","description"]),a(i(q),{visible:k.value,"onUpdate:visible":s[17]||(s[17]=o=>k.value=o),placement:"bottom",height:"auto",closable:!1,"body-style":{padding:"0"}},{default:g(()=>[e("div",Ys,[e("button",{type:"button",class:"dash__choiceBtn",onClick:s[15]||(s[15]=o=>F("makeOrderList"))},"ثبت سفارش"),e("button",{type:"button",class:"dash__choiceBtn is-quiet",onClick:s[16]||(s[16]=o=>F("makeOrderStatus"))},"مشاهده سفارش")])]),_:1},8,["visible"]),a(i(q),{visible:C.value,"onUpdate:visible":s[20]||(s[20]=o=>C.value=o),placement:"bottom",height:"auto",closable:!1,"body-style":{padding:"0"}},{default:g(()=>[e("div",js,[e("button",{type:"button",class:"dash__choiceBtn",onClick:s[18]||(s[18]=o=>P("surveyFeed"))},"رأی به طرح‌ها"),e("button",{type:"button",class:"dash__choiceBtn is-quiet",onClick:s[19]||(s[19]=o=>P("surveyMine"))},"ثبت / طرح‌های من")])]),_:1},8,["visible"])])}}}),re=ls(Qs,[["__scopeId","data-v-024f05b5"]]);export{re as default};