2 lines
8.2 KiB
JavaScript
2 lines
8.2 KiB
JavaScript
import{d as M,R as U,x as A,h as w,K as $,aQ as B,o as q,y as O,c as p,e as s,m as i,p as a,g as D,A as c,S as N,B as G,M as K,b as f,f as L,n as x,t as v,Q,I as o,F as Y,i as C,C as j,T as H,_ as J}from"./index-Dix5E69r.js";import{R as W}from"./RateStrip-DNkf4pQZ.js";import{p as X}from"./filters-BusXLJwu.js";import{P as Z,L as I}from"./index-SdBtyzhh.js";const ss={class:"dash"},es={class:"dash__bar"},as={class:"dash__barInner"},os={class:"dash__heroTop"},ns={class:"dash__heroIdentity"},ts={class:"dash__heroName"},ls={class:"dash__heroMobile"},is={class:"dash__heroFigure"},rs={class:"dash__heroNum"},us={class:"dash__heroUnit"},ds={class:"dash__heroDebt"},_s={class:"dash__inviteIcon","aria-hidden":"true"},cs={class:"dash__rowIcon","aria-hidden":"true"},vs={class:"dash__rowIcon","aria-hidden":"true"},ps={class:"dash__rowIcon","aria-hidden":"true"},fs={class:"dash__rowIcon","aria-hidden":"true"},hs={class:"dash__rowIcon","aria-hidden":"true"},ms={class:"dash__rowIcon","aria-hidden":"true"},bs={class:"dash__rowIcon","aria-hidden":"true"},ws={class:"dash__rowIcon","aria-hidden":"true"},xs=70,ys=M({__name:"DashboardView",setup(gs){const l=G(),_=U(),h=A(),r=w(h.peek($.profile)??null),T=w(h.peek($.goldPrice)??null),y=w(!1),g=C(()=>r.value?parseFloat(r.value.goldDebtGrams)>0:!1),R=C(()=>g.value?"بدهکار":"بستانکار"),V=C(()=>r.value?Math.abs(parseFloat(r.value.goldDebtGrams)):0),u=K({notify:!1,loginNotify:!1});function d(n){if(!_.isLoggedIn){u.loginNotify=!0;return}n===0&&l.push({name:"ordersList"}),n===1&&l.push({name:"transactionsList"}),n===2&&l.push({name:"profileData"}),n===3&&l.push({name:"favoritesList"}),n===4&&l.push({name:"ChildOrder"}),n===5&&l.push({name:"customerChoice"}),n===6&&l.push({name:"report"})}async function P(){u.notify=!1;let n=null;try{n=(await H.ssoLogoutUrl()).logout_url}catch{n=null}if(_.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),n){window.location.assign(n);return}l.push({name:"home"})}async function k(n=!1){const[e,b]=await Promise.allSettled([_.isLoggedIn?h.me({force:!0}):Promise.resolve(null),h.goldPrice({force:n})]);e.status==="fulfilled"?r.value=e.value:console.log(e.reason),T.value=b.status==="fulfilled"?b.value:null}async function E(){await k(!0),y.value=!1}let F=!1;B(()=>{F&&k(),F=!0});let S=!1;const z=w(S);function m(n){return{"--reveal-delay":`${n*xs}ms`}}return q(async()=>{await k(),!z.value&&(await O(),requestAnimationFrame(()=>{z.value=!0,S=!0}))}),(n,e)=>{const b=j("container");return f(),p("div",ss,[s("header",es,[s("div",as,[e[14]||(e[14]=s("span",{class:"dash__brand"},"میز کار",-1)),i(_).isLoggedIn?(f(),p("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:e[0]||(e[0]=t=>u.notify=!0)},[a(o,{icon:"vuesax-linear:logout",size:"18"})])):D("",!0)])]),a(i(Z),{modelValue:y.value,"onUpdate:modelValue":e[10]||(e[10]=t=>y.value=t),onRefresh:E},{pulling:c(()=>[a(i(I),{size:"18"})]),loosing:c(()=>[a(i(I),{size:"18"})]),loading:c(()=>[a(i(I),{size:"18"})]),success:c(()=>[...e[15]||(e[15]=[s("span",null,null,-1)])]),default:c(()=>[a(b,{class:L(["dash__body",{"is-revealed":z.value}])},{default:c(()=>[r.value?(f(),p("section",{key:0,class:"dash__hero dash__reveal",style:x(m(0))},[s("div",os,[s("div",ns,[s("span",ts,v(r.value.fullName),1),s("span",ls,v(i(_).mobile),1)]),s("span",{class:L(["dash__heroSeal",g.value?"is-debtor":"is-creditor"])},v(g.value?"بدهکار":"بستانکار"),3)]),s("div",is,[s("span",rs,v(V.value),1),s("span",us,"گرم "+v(R.value),1)]),s("div",ds,[e[17]||(e[17]=s("span",null,"بدهی ریالی",-1)),s("b",null,[Q(v(i(X)(r.value.fiatDebtRial))+" ",1),e[16]||(e[16]=s("i",null,"ریال",-1))])])],4)):(f(),p("section",{key:1,class:"dash__invite dash__reveal",style:x(m(0))},[s("div",_s,[a(o,{icon:"vuesax-linear:security-user",size:"22",color:"#fff"})]),e[18]||(e[18]=s("h3",null,"حساب گرمی شما",-1)),e[19]||(e[19]=s("p",null,"برای دیدن موجودی، سفارشها و اسناد خود وارد شوید.",-1)),s("button",{type:"button",class:"dash__inviteCta",onClick:e[1]||(e[1]=t=>i(l).push({
|