Files
tehran_tala/apps/user-app-v2/dist/assets/DashboardView-CruAApJN.js
T

2 lines
8.2 KiB
JavaScript
Raw Normal View History

import{d as B,S as M,x as q,h as b,K as F,z as A,o as O,y as G,c as p,e as s,m as i,p as a,g as D,B as c,T as $,C as K,N as Y,b as f,f as N,n as w,t as v,R as j,I as t,F as H,i as z,D as J,s as L,_ as Q}from"./index-Fj5Qv9qV.js";import{R as W}from"./RateStrip-DnEwhro4.js";import{p as X}from"./filters-CF2i06Nn.js";import{P as Z,L as C}from"./index-DQTQmdnT.js";const ss={class:"dash"},es={class:"dash__bar"},as={class:"dash__barInner"},os={class:"dash__heroTop"},ts={class:"dash__heroIdentity"},ns={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=B({__name:"DashboardView",setup(gs){const l=K(),_=M(),h=q(),r=b(h.peek(F.profile)??null),I=b(h.peek(F.goldPrice)??null),x=b(!1),y=z(()=>r.value?parseFloat(r.value.goldDebtGrams)>0:!1),R=z(()=>y.value?"بدهکار":"بستانکار"),V=z(()=>r.value?Math.abs(parseFloat(r.value.goldDebtGrams)):0),u=Y({notify:!1,loginNotify:!1});function d(o){if(!_.isLoggedIn){u.loginNotify=!0;return}o===0&&l.push({name:"ordersList"}),o===1&&l.push({name:"transactionsList"}),o===2&&l.push({name:"profileData"}),o===3&&l.push({name:"favoritesList"}),o===4&&l.push({name:"ChildOrder"}),o===5&&l.push({name:"customerChoice"}),o===6&&l.push({name:"report"})}async function P(){u.notify=!1;try{await L.endSharedSession()}catch{}let o=null;try{o=(await L.ssoLogoutUrl()).logout_url}catch{o=null}if(_.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),o){window.location.assign(o);return}l.push({name:"home"})}async function g(){const[o,e]=await Promise.allSettled([_.isLoggedIn?h.me({force:!0}):Promise.resolve(null),h.goldPrice({force:!0})]);o.status==="fulfilled"?r.value=o.value:console.log(o.reason),I.value=e.status==="fulfilled"?e.value:null}async function E(){await g(),x.value=!1}let S=!1;A(()=>{S&&g(),S=!0});let T=!1;const k=b(T);function m(o){return{"--reveal-delay":`${o*xs}ms`}}return O(async()=>{await g(),!k.value&&(await G(),requestAnimationFrame(()=>{k.value=!0,T=!0}))}),(o,e)=>{const U=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]=n=>u.notify=!0)},[a(t,{icon:"vuesax-linear:logout",size:"18"})])):D("",!0)])]),a(i(Z),{modelValue:x.value,"onUpdate:modelValue":e[10]||(e[10]=n=>x.value=n),onRefresh:E},{pulling:c(()=>[a(i(C),{size:"18"})]),loosing:c(()=>[a(i(C),{size:"18"})]),loading:c(()=>[a(i(C),{size:"18"})]),success:c(()=>[...e[15]||(e[15]=[s("span",null,null,-1)])]),default:c(()=>[a(U,{class:N(["dash__body",{"is-revealed":k.value}])},{default:c(()=>[r.value?(f(),p("section",{key:0,class:"dash__hero dash__reveal",style:w(m(0))},[s("div",os,[s("div",ts,[s("span",ns,v(r.value.fullName),1),s("span",ls,v(i(_).mobile),1)]),s("span",{class:N(["dash__heroSeal",y.value?"is-debtor":"is-creditor"])},v(y.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,[j(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:w(m(0))},[s("div",_s,[a(t,{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__inviteCt