2026-10-10 10:24:53 +03:30
|
|
|
import{d as P,O as E,o as M,x as U,c as v,b as s,m as i,p as a,e as T,z as c,P as $,C as B,g as m,K as q,s as k,f as h,i as D,n as b,t as p,N as G,I as o,F as O,h as z,B as A,_ as K}from"./index-CMIHv7G_.js";import{R as j}from"./RateStrip-B2g51c3V.js";import{p as H}from"./filters-DUQPe6Ym.js";import{P as J,L as C}from"./index-CV0Ebvxy.js";const Q={class:"dash"},W={class:"dash__bar"},X={class:"dash__barInner"},Y={class:"dash__heroTop"},Z={class:"dash__heroIdentity"},ss={class:"dash__heroName"},es={class:"dash__heroMobile"},as={class:"dash__heroFigure"},os={class:"dash__heroNum"},ns={class:"dash__heroUnit"},ts={class:"dash__heroDebt"},ls={class:"dash__inviteIcon","aria-hidden":"true"},is={class:"dash__rowIcon","aria-hidden":"true"},rs={class:"dash__rowIcon","aria-hidden":"true"},us={class:"dash__rowIcon","aria-hidden":"true"},ds={class:"dash__rowIcon","aria-hidden":"true"},_s={class:"dash__rowIcon","aria-hidden":"true"},cs={class:"dash__rowIcon","aria-hidden":"true"},ps={class:"dash__rowIcon","aria-hidden":"true"},vs={class:"dash__rowIcon","aria-hidden":"true"},hs=70,fs=P({__name:"DashboardView",setup(ms){const l=B(),_=E(),r=m(null),w=m(null),x=m(!1),y=z(()=>r.value?parseFloat(r.value.goldDebtGrams)>0:!1),N=z(()=>y.value?"بدهکار":"بستانکار"),L=z(()=>r.value?Math.abs(parseFloat(r.value.goldDebtGrams)):0),u=q({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 S(){u.notify=!1;let n=null;try{n=(await k.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 I(){if(_.isLoggedIn)try{r.value=await k.getMe()}catch(n){console.log(n)}try{w.value=await k.getLatestGoldPrice()}catch{w.value=null}}async function V(){await I(),x.value=!1}let F=!1;const g=m(F);function f(n){return{"--reveal-delay":`${n*hs}ms`}}return M(async()=>{await I(),!g.value&&(await U(),requestAnimationFrame(()=>{g.value=!0,F=!0}))}),(n,e)=>{const R=A("container");return h(),v("div",Q,[s("header",W,[s("div",X,[e[14]||(e[14]=s("span",{class:"dash__brand"},"میز کار",-1)),i(_).isLoggedIn?(h(),v("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"})])):T("",!0)])]),a(i(J),{modelValue:x.value,"onUpdate:modelValue":e[10]||(e[10]=t=>x.value=t),onRefresh:V},{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(R,{class:D(["dash__body",{"is-revealed":g.value}])},{default:c(()=>[r.value?(h(),v("section",{key:0,class:"dash__hero dash__reveal",style:b(f(0))},[s("div",Y,[s("div",Z,[s("span",ss,p(r.value.fullName),1),s("span",es,p(i(_).mobile),1)]),s("span",{class:D(["dash__heroSeal",y.value?"is-debtor":"is-creditor"])},p(y.value?"بدهکار":"بستانکار"),3)]),s("div",as,[s("span",os,p(L.value),1),s("span",ns,"گرم "+p(N.value),1)]),s("div",ts,[e[17]||(e[17]=s("span",null,"بدهی ریالی",-1)),s("b",null,[G(p(i(H)(r.value.fiatDebtRial))+" ",1),e[16]||(e[16]=s("i",null,"ریال",-1))])])],4)):(h(),v("section",{key:1,class:"dash__invite dash__reveal",style:b(f(0))},[s("div",ls,[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({name:"login"}))}," ورود / ثبتنام ")],4)),s("section",{class:"dash__rows dash__reveal",style:b(f(1))},[s("button",{type:"button",class:"dash__row",onClick:e[2]||(e[2]=t=>d(0))},[s("span",
|