Files

2 lines
8.6 KiB
JavaScript
Raw Permalink Normal View History

2026-10-25 22:46:21 +03:30
import{d as M,S as U,y as O,h as m,K as $,A as q,o as G,z as H,c as u,p as a,C,m as i,s as k,T as N,D as K,O as Y,b as _,I as t,f as T,n as b,e as s,t as p,R as j,g as R,B as J,F as Q,i as I,E as W,v as P,_ as X}from"./index-CbxkvvkI.js";import{A as Z}from"./AppPullRefresh-C6gq5cvS.js";import{P as ss}from"./PageBar-BaL3tkja.js";import{R as es}from"./RateStrip-DIQwrfG1.js";import{p as as}from"./filters-D3RAgBI7.js";const os={class:"dash"},ts={key:1,class:"dash__exitSpacer","aria-hidden":"true"},ns={class:"dash__heroHead"},is={class:"dash__heroIdentity"},rs={class:"dash__heroName"},ls={class:"dash__heroMobile"},ds={class:"dash__heroBalance"},us={class:"dash__heroFigure"},_s={class:"dash__heroNum"},hs={class:"dash__heroDebt"},cs={class:"dash__heroHead"},ps={class:"dash__heroIdentity"},vs={class:"dash__heroMobile"},fs={class:"dash__heroPending"},ms=["alt"],bs={class:"dash__rowIcon","aria-hidden":"true"},ws={class:"dash__rowChevron","aria-hidden":"true"},gs={class:"dash__rowIcon","aria-hidden":"true"},ys={class:"dash__rowChevron","aria-hidden":"true"},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__rowChevron","aria-hidden":"true"},Ds={class:"dash__rowIcon","aria-hidden":"true"},Ls={class:"dash__rowChevron","aria-hidden":"true"},$s={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=M({__name:"DashboardView",setup(Es){const r=K(),l=U(),w=O(),d=m(w.peek($.profile)??null),z=m(w.peek($.goldPrice)??null),y=m(!1),v=m(!1),S=I(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),V=I(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),E=I(()=>{const o=V.value;return Number.isFinite(o)?o.toLocaleString("fa-IR",{maximumFractionDigits:3}):"۰"}),h=Y({notify:!1,loginNotify:!1});function c(o){if(!l.isLoggedIn){h.loginNotify=!0;return}o===0&&r.push({name:"ordersList"}),o===1&&r.push({name:"transactionsList"}),o===2&&r.push({name:"profileData"}),o===3&&r.push({name:"favoritesList"}),o===4&&r.push({name:"ChildOrder"}),o===5&&r.push({name:"customerChoice"}),o===6&&r.push({name:"report"})}async function F(){h.notify=!1;try{await P.endSharedSession()}catch{}let o=null;try{o=(await P.ssoLogoutUrl()).logout_url}catch{o=null}if(l.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),o){window.location.assign(o);return}r.push({name:"home"})}async function g(){v.value=!1;const[o,e]=await Promise.allSettled([l.isLoggedIn?w.me({force:!0}):Promise.resolve(null),w.goldPrice({force:!0})]);o.status==="fulfilled"?(d.value=o.value,v.value=!1):(v.value=l.isLoggedIn&&!d.value,console.log(o.reason)),z.value=e.status==="fulfilled"?e.value:null}async function A(){try{await g()}finally{y.value=!1}}let D=!1;q(()=>{D&&g(),D=!0});let L=!1;const x=m(L);function f(o){return{"--reveal-delay":`${o*Ps}ms`}}return G(async()=>{await g(),!x.value&&(await H(),requestAnimationFrame(()=>{x.value=!0,L=!0}))}),(o,e)=>{const B=W("container");return _(),u("div",os,[a(ss,{title:"میز کار",back:!1},{trailing:C(()=>[i(l).isLoggedIn?(_(),u("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:e[0]||(e[0]=n=>h.notify=!0)},[a(t,{icon:"vuesax-linear:logout",size:"18"})])):(_(),u("span",ts))]),_:1}),a(Z,{modelValue:y.value,"onUpdate:modelValue":e[10]||(e[10]=n=>y.value=n),onRefresh:A},{default:C(()=>[a(B,{class:T(["dash__body",{"is-revealed":x.value}])},{default:C(()=>[i(l).isLoggedIn&&d.value?(_(),u("section",{key:0,class:"dash__hero dash__reveal",style:b(f(0))},[s("header",ns,[s("div",is,[s("span",rs,p(d.value.fullName),1),s("span",ls,p(i(l).mobile),1)]),s("span",{class:T(["dash__heroSeal",S.value?"is-debtor":"is-creditor"])},p(S.value?"بدهکار":"بستانکار"),3)]),s("div",ds,[s("div",us,[s("span",_s,p(E.value),1),e[14]||(e[14]=s("span",{class:"dash__heroUnit"},"گرم",-1))]