Files
tehran_taj/apps/user-app-v2/dist/assets/ProfileView-0NoXEFuQ.js
T
mahmoodandClaude Sonnet 5.5 0b973f9e46 fix(app): re-check the sales-expert flag on every dashboard visit
The "سفارش مشتریان" / "مشتریان من" entries are shown from session.isSalesExpert,
which was fetched from /expert/whoami only once, at sign-in. A slow or failed
request (silently swallowed) left the flag false until the next login, so an
expert saw a customer-only menu. The dashboard now asks again on mount and on
every re-activation, and keeps the current value when the request fails.

Rebuilds user-app and user-app-v2 dist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 10:23:08 +03:30

2 lines
4.2 KiB
JavaScript

import{d as L,S as w,y as F,h as _,K as g,o as M,c as n,p as r,C as $,E as O,b as i,e,I as k,t as a,g as c,f as v,R as T,m as U,i as m,D as z,_ as A}from"./index-BIZGiNHX.js";import{P as K}from"./PageBar-Zk5iCdG_.js";import{S}from"./SectionHead-BXWvaNpt.js";const W={class:"prof"},H={class:"prof__identity"},J={class:"prof__avatar","aria-hidden":"true"},Y={class:"prof__name"},j={key:0,class:"prof__mobile"},q={key:0,class:"prof__block"},G={class:"prof__specs"},Q={class:"prof__spec"},X={class:"prof__spec"},Z={class:"prof__spec"},ee={class:"prof__spec"},se={key:1,class:"prof__block"},te={class:"prof__specs"},oe={class:"prof__spec"},le={class:"prof__spec"},ae={key:2,class:"prof__block"},ne={key:3,class:"prof__empty"},ie=L({__name:"ProfileView",setup(re){const b={UNVERIFIED:"احراز نشده",STEP_ONE_SUBMITTED:"مرحله اول ثبت شده",STEP_TWO_SUBMITTED:"مرحله دوم ثبت شده",VERIFIED:"تایید شده",REJECTED:"رد شده"},h=w(),d=F(),o=_(d.peek(g.profile)??null),p=_(!1),C=m(()=>{var s;return((s=o.value)==null?void 0:s.verificationStep)==="VERIFIED"}),R=m(()=>{var t;const s=(t=o.value)==null?void 0:t.verificationStep;return!!s&&s!=="VERIFIED"&&s!=="STEP_TWO_SUBMITTED"}),D=z(),l=_(d.peek(g.balance)??null),f=_(!1),u=s=>Number(s??0),E=s=>u(s)>0?"بدهکار":u(s)<0?"بستانکار":"",y=s=>u(s)>0?"is-debt":u(s)<0?"is-credit":"",V=s=>`${Math.abs(u(s)).toLocaleString("fa-IR",{maximumFractionDigits:3})} گرم`,B=s=>`${Math.abs(u(s)).toLocaleString("fa-IR")} ریال`,N=m(()=>{const s=l.value;if(!(s!=null&&s.at))return"";const t=new Date(s.at).toLocaleString("fa-IR",{dateStyle:"short",timeStyle:"short"});return s.source==="stored"?`آخرین مانده‌ی ثبت‌شده — ${t}`:`از ${s.provider??"حسابداری"} — ${t}`});async function P(){f.value=!l.value;try{l.value=await d.accountingBalance({force:!0})}catch{l.value=null}finally{f.value=!1}}return M(async()=>{if(h.isLoggedIn){P(),p.value=!o.value;try{o.value=await d.me({force:!0})}finally{p.value=!1}}}),(s,t)=>{const x=O("container");return i(),n("div",W,[r(K,{title:"اطلاعات کاربری","back-to":"userPage::hasSubRoute"}),r(x,{class:"prof__body"},{default:$(()=>{var I;return[e("section",H,[e("div",J,[r(k,{icon:"vuesax-linear:user",size:"30"})]),e("h2",Y,a(((I=o.value)==null?void 0:I.fullName)??"—"),1),o.value?(i(),n("p",j,a(o.value.mobile),1)):c("",!0),o.value?(i(),n("span",{key:1,class:v(["prof__seal",C.value?"is-ok":"is-pending"])},a(b[o.value.verificationStep]??o.value.verificationStep),3)):c("",!0)]),o.value?(i(),n("section",q,[r(S,{title:"مشخصات",subtitle:"اطلاعات ثبت‌شده حساب شما"}),e("dl",G,[e("div",Q,[t[1]||(t[1]=e("dt",null,"نام و نام خانوادگی",-1)),e("dd",null,a(o.value.fullName),1)]),e("div",X,[t[2]||(t[2]=e("dt",null,"تلفن همراه",-1)),e("dd",null,a(o.value.mobile),1)]),e("div",Z,[t[3]||(t[3]=e("dt",null,"کد ملی",-1)),e("dd",null,a(o.value.nationalCode||"-"),1)]),e("div",ee,[t[4]||(t[4]=e("dt",null,"وضعیت احراز هویت",-1)),e("dd",null,a(b[o.value.verificationStep]??o.value.verificationStep),1)])])])):c("",!0),l.value&&l.value.source!=="none"?(i(),n("section",se,[r(S,{title:"مانده‌ی حساب",subtitle:N.value},null,8,["subtitle"]),e("dl",te,[e("div",oe,[t[5]||(t[5]=e("dt",null,"مانده‌ی طلا",-1)),e("dd",{class:v(y(l.value.gold))},[T(a(V(l.value.gold))+" ",1),e("small",null,a(E(l.value.gold)),1)],2)]),e("div",le,[t[6]||(t[6]=e("dt",null,"مانده‌ی ریالی",-1)),e("dd",{class:v(y(l.value.rial))},[T(a(B(l.value.rial))+" ",1),e("small",null,a(E(l.value.rial)),1)],2)])])])):f.value?(i(),n("section",ae,[r(S,{title:"مانده‌ی حساب",subtitle:"در حال دریافت از حسابداری…"}),t[7]||(t[7]=e("div",{class:"prof__specs prof__skeleton"},null,-1))])):p.value?c("",!0):(i(),n("section",ne,[r(k,{icon:"vuesax-linear:user",size:"26"}),t[8]||(t[8]=e("p",null,"اطلاعات حساب در دسترس نیست.",-1))])),R.value?(i(),n("button",{key:4,type:"button",class:"prof__complete",onClick:t[0]||(t[0]=ue=>U(D).push({name:"completeProfile"}))}," تکمیل پروفایل ")):c("",!0)]}),_:1})])}}}),pe=A(ie,[["__scopeId","data-v-a61d0c61"]]);export{pe as default};