Files
hedena_gold/apps/user-app-v2/dist/assets/DashboardView-BTOUUwpE.js
T

2 lines
8.7 KiB
JavaScript
Raw Normal View History

import{d as U,S as O,y as q,h as m,K as N,A as G,o as H,z as K,c as u,p as t,C,m as i,s as k,T,D as Y,O as j,v as I,b as _,I as o,f as R,n as b,e as s,t as p,R as J,g as P,B as Q,F as W,i as z,E as X,_ as Z}from"./index-D8i4h-PU.js";import{A as ss}from"./AppPullRefresh-DK9DbvVA.js";import{P as es}from"./PageBar-BBMNYL0j.js";import{R as as}from"./RateStrip-yK7NvWwz.js";import{p as ts}from"./filters-qWhZyCzD.js";const os={class:"dash"},ns={key:1,class:"dash__exitSpacer","aria-hidden":"true"},is={class:"dash__heroHead"},rs={class:"dash__heroIdentity"},ls={class:"dash__heroName"},ds={class:"dash__heroMobile"},us={class:"dash__heroBalance"},_s={class:"dash__heroFigure"},hs={class:"dash__heroNum"},cs={class:"dash__heroDebt"},ps={class:"dash__heroHead"},vs={class:"dash__heroIdentity"},fs={class:"dash__heroMobile"},ms={class:"dash__heroPending"},bs=["alt"],ws={class:"dash__rowIcon","aria-hidden":"true"},gs={class:"dash__rowChevron","aria-hidden":"true"},ys={class:"dash__rowIcon","aria-hidden":"true"},xs={class:"dash__rowChevron","aria-hidden":"true"},Cs={class:"dash__rowIcon","aria-hidden":"true"},ks={class:"dash__rowChevron","aria-hidden":"true"},Is={class:"dash__rowIcon","aria-hidden":"true"},zs={class:"dash__rowChevron","aria-hidden":"true"},Ss={class:"dash__rowIcon","aria-hidden":"true"},Ls={class:"dash__rowChevron","aria-hidden":"true"},Ds={class:"dash__rowIcon","aria-hidden":"true"},$s={class:"dash__rowChevron","aria-hidden":"true"},Es={class:"dash__rowIcon","aria-hidden":"true"},Ns={class:"dash__rowChevron","aria-hidden":"true"},Ts={class:"dash__rowIcon","aria-hidden":"true"},Rs={class:"dash__rowChevron","aria-hidden":"true"},Ps=70,Vs=U({__name:"DashboardView",setup(Fs){const l=Y(),r=O(),w=q(),d=m(w.peek(N.profile)??null),S=m(w.peek(N.goldPrice)??null),y=m(!1),v=m(!1),L=z(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),V=z(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),F=z(()=>{const a=V.value;return Number.isFinite(a)?a.toLocaleString("fa-IR",{maximumFractionDigits:3}):"۰"}),h=j({notify:!1,loginNotify:!1});function c(a){if(!r.isLoggedIn){h.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 A(){h.notify=!1;try{await I.endSharedSession()}catch{}let a=null;try{a=(await I.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 g(){v.value=!1;const[a,e]=await Promise.allSettled([r.isLoggedIn?w.me({force:!0}):Promise.resolve(null),w.goldPrice({force:!0})]);a.status==="fulfilled"?(d.value=a.value,v.value=!1):(v.value=r.isLoggedIn&&!d.value,console.log(a.reason)),S.value=e.status==="fulfilled"?e.value:null}async function B(){try{await g()}finally{y.value=!1}}async function D(){if(r.isLoggedIn)try{const a=await I.getExpertIdentity();r.setSalesExpert(a.isSalesExpert)}catch{}}let $=!1;G(()=>{$&&(g(),D()),$=!0});let E=!1;const x=m(E);function f(a){return{"--reveal-delay":`${a*Ps}ms`}}return H(async()=>{D(),await g(),!x.value&&(await K(),requestAnimationFrame(()=>{x.value=!0,E=!0}))}),(a,e)=>{const M=X("container");return _(),u("div",os,[t(es,{title:"میز کار",back:!1},{trailing:C(()=>[i(r).isLoggedIn?(_(),u("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:e[0]||(e[0]=n=>h.notify=!0)},[t(o,{icon:"vuesax-linear:logout",size:"18"})])):(_(),u("span",ns))]),_:1}),t(ss,{modelValue:y.value,"onUpdate:modelValue":e[10]||(e[10]=n=>y.value=n),onRefresh:B},{default:C(()=>[t(M,{class:R(["dash__body",{"is-revealed":x.value}])},{default:C(()=>[i(r).isLoggedIn&&d.value?(_(),u("section",{key:0,class:"dash__hero dash__reveal",style:b(f(0))},[s("header",is,[s("div",rs,[s("span",ls,p(d.value.fullName),1),s("span",ds,p(i(r).mobile),1)]),s("span",{class:R(["dash__heroSeal",L.value?"is-debtor":"is-creditor"])},p(L.value?"بدهکار":"بستانک