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

2 lines
9.4 KiB
JavaScript
Raw Normal View History

import{d as G,S as H,y as K,h as m,K as z,A as Y,o as j,z as J,c as u,p as t,C as S,m as i,s as L,T as P,D as Q,O as W,v as D,b as _,I as o,f as V,n as y,e as s,t as h,R as X,g as $,B as Z,F as ss,i as C,E as es,_ as as}from"./index-CN-v7uYp.js";import{A as ts}from"./AppPullRefresh-D5o9arkH.js";import{P as os}from"./PageBar-DNaPusPm.js";import{R as ns}from"./RateStrip-BeFld7sY.js";import{p as is}from"./filters-C_cKdZcl.js";const rs={class:"dash"},ls={key:1,class:"dash__exitSpacer","aria-hidden":"true"},ds={class:"dash__heroHead"},us={class:"dash__heroIdentity"},_s={class:"dash__heroName"},hs={class:"dash__heroMobile"},cs={class:"dash__heroBalance"},ps={class:"dash__heroFigure"},vs={class:"dash__heroNum"},fs={class:"dash__heroDebt"},ms={class:"dash__heroHead"},ws={class:"dash__heroIdentity"},bs={class:"dash__heroMobile"},ys={class:"dash__heroPending"},gs=["alt"],xs={class:"dash__rowIcon","aria-hidden":"true"},Cs={class:"dash__rowChevron","aria-hidden":"true"},ks={class:"dash__rowIcon","aria-hidden":"true"},Is={class:"dash__rowChevron","aria-hidden":"true"},zs={class:"dash__rowIcon","aria-hidden":"true"},Ss={class:"dash__rowText"},Ls={class:"dash__rowChevron","aria-hidden":"true"},Ds={class:"dash__rowIcon","aria-hidden":"true"},$s={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"},Bs={class:"dash__rowChevron","aria-hidden":"true"},Rs={class:"dash__rowIcon","aria-hidden":"true"},Ps={class:"dash__rowChevron","aria-hidden":"true"},Vs={class:"dash__rowIcon","aria-hidden":"true"},Fs={class:"dash__rowChevron","aria-hidden":"true"},As={class:"dash__rowIcon","aria-hidden":"true"},Ms={class:"dash__rowChevron","aria-hidden":"true"},Us=70,Os=G({__name:"DashboardView",setup(qs){const l=Q(),r=H(),f=K(),d=m(f.peek(z.profile)??null),T=m(f.peek(z.goldPrice)??null),g=m(f.peek(z.customButton)??null),k=m(!1),w=m(!1),F=C(()=>{const a=g.value;return!!(a!=null&&a.enabled&&a.title.trim()&&a.link.trim())});function A(){var e,v;const a=(v=(e=g.value)==null?void 0:e.link)==null?void 0:v.trim();a&&window.open(a,"_blank","noopener,noreferrer")}const E=C(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),M=C(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),U=C(()=>{const a=M.value;return Number.isFinite(a)?a.toLocaleString("fa-IR",{maximumFractionDigits:3}):"۰"}),c=W({notify:!1,loginNotify:!1});function p(a){if(!r.isLoggedIn){c.loginNotify=!0;return}a===0&&l.push({name:"ordersList"}),a===1&&l.push({name:"transactionsList"}),a===2&&l.push({name:"profileData"}),a===3&&l.push({name:"favoritesList"}),a===4&&l.push({name:"ChildOrder"}),a===5&&l.push({name:"customerChoice"}),a===6&&l.push({name:"report"})}async function O(){c.notify=!1;try{await D.endSharedSession()}catch{}let a=null;try{a=(await D.ssoLogoutUrl()).logout_url}catch{a=null}if(r.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),a){window.location.assign(a);return}l.push({name:"home"})}async function x(){w.value=!1;const[a,e,v]=await Promise.allSettled([r.isLoggedIn?f.me({force:!0}):Promise.resolve(null),f.goldPrice({force:!0}),f.customButton({force:!0})]);a.status==="fulfilled"?(d.value=a.value,w.value=!1):(w.value=r.isLoggedIn&&!d.value,console.log(a.reason)),T.value=e.status==="fulfilled"?e.value:null,v.status==="fulfilled"&&(g.value=v.value)}async function q(){try{await x()}finally{k.value=!1}}async function N(){if(r.isLoggedIn)try{const a=await D.getExpertIdentity();r.setSalesExpert(a.isSalesExpert)}catch{}}let B=!1;Y(()=>{B&&(x(),N()),B=!0});let R=!1;const I=m(R);function b(a){return{"--reveal-delay":`${a*Us}ms`}}return j(async()=>{N(),await x(),!I.value&&(await J(),requestAnimationFrame(()=>{I.value=!0,R=!0}))}),(a,e)=>{const v=es("container");return _(),u("div",rs,[t(os,{title:"میز کار",back:!1},{trailing:S(()=>[i(r).isLoggedIn?(_(),u("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:e[0]||(e[0]=n=>c.notify=!0)},[t(o,{icon:"vuesax-linear:logout",size:"18"})])):(_(),u("span",ls))]),_:1}),t(