- Rial wage and gram-debt arithmetic matched to the reference; order corrections keep debt in sync - Document confirm/un-confirm is a compare-and-swap (no double-applied cache under concurrency) - Settlement document and expert inputs validated (400 instead of 500) - Expert: edit / activate-deactivate own customers, adjust raw weights only - Made-to-order flow in the app, PreOrder.quantity migration - Order grids: customer column, sort keys; panel select search; pre-order quantity save - Rebuilt release artifacts Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
import{d as K,S as Y,y as j,h as f,K as $,A as J,o as Q,z as W,c as u,p as t,C,m as i,s as D,T as F,D as X,O as Z,v as L,b as _,I as n,f as O,n as y,e as s,t as c,R as ss,g as T,B as es,F as as,i as I,E as ts,_ as os}from"./index-6E0fX61D.js";import{A as ns}from"./AppPullRefresh-B0f-tYJA.js";import{P as is}from"./PageBar-HEcoSwjE.js";import{R as rs}from"./RateStrip-BM0cz1ET.js";import{p as ls}from"./filters-CmtC5ctw.js";import{D as ds}from"./index-BRKIhLwl.js";import"./KeyCode-CJkaCAgc.js";import"./classCallCheck-BINKwNli.js";import"./raf-nDFcuFT6.js";const us={class:"dash"},_s={key:1,class:"dash__exitSpacer","aria-hidden":"true"},hs={class:"dash__heroHead"},cs={class:"dash__heroIdentity"},ps={class:"dash__heroName"},vs={class:"dash__heroMobile"},fs={class:"dash__heroBalance"},ms={class:"dash__heroFigure"},bs={class:"dash__heroNum"},ws={class:"dash__heroDebt"},ys={class:"dash__heroHead"},gs={class:"dash__heroIdentity"},xs={class:"dash__heroMobile"},ks={class:"dash__heroPending"},Cs=["alt"],Is={class:"dash__rowIcon","aria-hidden":"true"},zs={class:"dash__rowChevron","aria-hidden":"true"},Ss={class:"dash__rowIcon","aria-hidden":"true"},$s={class:"dash__rowChevron","aria-hidden":"true"},Ds={class:"dash__rowIcon","aria-hidden":"true"},Ls={class:"dash__rowText"},Ts={class:"dash__rowChevron","aria-hidden":"true"},Bs={class:"dash__rowIcon","aria-hidden":"true"},Es={class:"dash__rowChevron","aria-hidden":"true"},Ns={class:"dash__rowIcon","aria-hidden":"true"},Rs={class:"dash__rowChevron","aria-hidden":"true"},Ps={class:"dash__rowIcon","aria-hidden":"true"},Vs={class:"dash__rowChevron","aria-hidden":"true"},Fs={class:"dash__rowIcon","aria-hidden":"true"},Os={class:"dash__rowChevron","aria-hidden":"true"},As={class:"dash__rowIcon","aria-hidden":"true"},Ms={class:"dash__rowChevron","aria-hidden":"true"},Us={class:"dash__rowIcon","aria-hidden":"true"},qs={class:"dash__rowChevron","aria-hidden":"true"},Gs={class:"dash__rowIcon","aria-hidden":"true"},Hs={class:"dash__rowChevron","aria-hidden":"true"},Ks={class:"dash__choice"},Ys=70,js=K({__name:"DashboardView",setup(Js){const r=X(),l=Y(),m=j(),d=f(m.peek($.profile)??null),B=f(m.peek($.goldPrice)??null),g=f(m.peek($.customButton)??null),z=f(!1),b=f(!1),A=I(()=>{const a=g.value;return!!(a!=null&&a.enabled&&a.title.trim()&&a.link.trim())});function M(){var e,v;const a=(v=(e=g.value)==null?void 0:e.link)==null?void 0:v.trim();a&&window.open(a,"_blank","noopener,noreferrer")}const E=I(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),U=I(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),q=I(()=>{const a=U.value;return Number.isFinite(a)?a.toLocaleString("fa-IR",{maximumFractionDigits:3}):"۰"}),p=Z({notify:!1,loginNotify:!1});function h(a){if(!l.isLoggedIn){p.loginNotify=!0;return}a===0&&r.push({name:"ordersList"}),a===1&&r.push({name:"transactionsList"}),a===2&&r.push({name:"profileData"}),a===3&&r.push({name:"favoritesList"}),a===4&&r.push({name:"ChildOrder"}),a===5&&r.push({name:"customerChoice"}),a===6&&r.push({name:"report"}),a===7&&(x.value=!0)}const x=f(!1);function N(a){x.value=!1,r.push({name:a})}async function G(){p.notify=!1;try{await L.endSharedSession()}catch{}let a=null;try{a=(await L.ssoLogoutUrl()).logout_url}catch{a=null}if(l.logout(),sessionStorage.removeItem("gb_iam_sso_checked"),a){window.location.assign(a);return}r.push({name:"home"})}async function k(){b.value=!1;const[a,e,v]=await Promise.allSettled([l.isLoggedIn?m.me({force:!0}):Promise.resolve(null),m.goldPrice({force:!0}),m.customButton({force:!0})]);a.status==="fulfilled"?(d.value=a.value,b.value=!1):(b.value=l.isLoggedIn&&!d.value,console.log(a.reason)),B.value=e.status==="fulfilled"?e.value:null,v.status==="fulfilled"&&(g.value=v.value)}async function H(){try{await k()}finally{z.value=!1}}async function R(){if(l.isLoggedIn)try{const a=await L.getExpertIdentity();l.setSalesExpert(a.isSalesExpert)}catch{}}let P=!1;J(()=>{P&&(k(),R()),P=!0});let V=!1;const S=f(V);function w(a){return{"--reveal-delay":`${a*Ys}ms`}}return Q(async()=>{R(),await k(),!S.value&&(await W(),requestAnimationFrame(()=>{S.value=!0,V=!0}))}),(a,e)=>{const v=ts("container");return _(),u("div",us,[t(is,{title:"میز کار",back:!1},{trailing:C(()=>[i(l).isLoggedIn?(_(),u("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:e[0]||(e[0]=o=>p.notify=!0)},[t(n,{icon:"vuesax-linear:logout",size:"18"})])):(_(),u("span",_s))]),_:1}),t(ns,{modelValue:z.value,"onUpdate:modelValue":e[11]||(e[11]=o=>z.value=o),onRefresh:H},{default:C(()=>[t(v,{class:O(["dash__body",{"is-revealed":S.value}])},{default:C(()=>[i(l).isLoggedIn&&d.value?(_(),u("section",{key:0,class:"dash__hero dash__reveal",style:y(w(0))},[s("header",hs,[s("div",cs,[s("span",ps,c(d.value.fullName),1),s("span",vs,c(i(l).mobile),1)]),s("span",{class:O(["dash__heroSeal",E.value?"is-debtor":"is-creditor"])},c(E.value?"بدهکار":"بستانکار"),3)]),s("div",fs,[s("div",ms,[s("span",bs,c(q.value),1),e[18]||(e[18]=s("span",{class:"dash__heroUnit"},"گرم",-1))]),e[19]||(e[19]=s("span",{class:"dash__heroEyebrow"},"موجودی طلا",-1))]),s("div",ws,[e[21]||(e[21]=s("span",{class:"dash__heroDebtLabel"},"بدهی ریالی",-1)),s("b",null,[ss(c(i(ls)(d.value.fiatDebtRial))+" ",1),e[20]||(e[20]=s("i",null,"ریال",-1))])])],4)):i(l).isLoggedIn?(_(),u("section",{key:1,class:"dash__hero dash__hero--pending dash__reveal",style:y(w(0))},[s("header",ys,[s("div",gs,[e[22]||(e[22]=s("span",{class:"dash__heroName"},"حساب شما",-1)),s("span",xs,c(i(l).mobile),1)])]),s("p",ks,c(b.value?"موجودی الان در دسترس نیست. دوباره تلاش کنید.":"در حال دریافت موجودی…"),1),b.value?(_(),u("button",{key:0,type:"button",class:"dash__heroRetry",onClick:k}," تلاش دوباره ")):T("",!0)],4)):(_(),u("section",{key:2,class:"dash__hero dash__invite dash__reveal",style:y(w(0))},[s("img",{class:"dash__inviteLogo",src:es,alt:i(D).name},null,8,Cs),s("button",{type:"button",class:"dash__inviteCta",onClick:e[1]||(e[1]=o=>i(r).push({name:"login"}))}," ورود / ثبتنام ")],4)),s("section",{class:"dash__rows dash__reveal",style:y(w(1))},[s("button",{type:"button",class:"dash__row",onClick:e[2]||(e[2]=o=>h(0))},[s("span",Is,[t(n,{icon:"vuesax-linear:box",size:"18"})]),e[23]||(e[23]=s("span",{class:"dash__rowText"},[s("b",null,"سفارشات")],-1)),s("span",zs,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),s("button",{type:"button",class:"dash__row",onClick:e[3]||(e[3]=o=>h(1))},[s("span",Ss,[t(n,{icon:"vuesax-linear:receipt-text",size:"18"})]),e[24]||(e[24]=s("span",{class:"dash__rowText"},[s("b",null,"اسناد")],-1)),s("span",$s,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),A.value?(_(),u("button",{key:0,type:"button",class:"dash__row",onClick:M},[s("span",Ds,[t(n,{icon:"vuesax-linear:link-2",size:"18"})]),s("span",Ls,[s("b",null,c(g.value.title.trim()),1)]),s("span",Ts,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])])):T("",!0),s("button",{type:"button",class:"dash__row",onClick:e[4]||(e[4]=o=>h(2))},[s("span",Bs,[t(n,{icon:"vuesax-linear:user",size:"18"})]),e[25]||(e[25]=s("span",{class:"dash__rowText"},[s("b",null,"پروفایل")],-1)),s("span",Es,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),s("button",{type:"button",class:"dash__row",onClick:e[5]||(e[5]=o=>h(3))},[s("span",Ns,[t(n,{icon:"vuesax-linear:heart",size:"18"})]),e[26]||(e[26]=s("span",{class:"dash__rowText"},[s("b",null,"علاقمندی")],-1)),s("span",Rs,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),s("button",{type:"button",class:"dash__row",onClick:e[6]||(e[6]=o=>h(7))},[s("span",Ps,[t(n,{icon:"vuesax-linear:3d-cube-scan",size:"18"})]),e[27]||(e[27]=s("span",{class:"dash__rowText"},[s("b",null,"سفارش ساخت")],-1)),s("span",Vs,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),s("button",{type:"button",class:"dash__row",onClick:e[7]||(e[7]=o=>h(6))},[s("span",Fs,[t(n,{icon:"vuesax-linear:chart-2",size:"18"})]),e[28]||(e[28]=s("span",{class:"dash__rowText"},[s("b",null,"گزارش")],-1)),s("span",Os,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),s("button",{type:"button",class:"dash__row",onClick:e[8]||(e[8]=o=>i(r).push({name:"appearanceSettings"}))},[s("span",As,[t(n,{icon:"vuesax-linear:brush",size:"18"})]),e[29]||(e[29]=s("span",{class:"dash__rowText"},[s("b",null,"تنظیمات ظاهری")],-1)),s("span",Ms,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),i(l).isSalesExpert?(_(),u(as,{key:1},[s("button",{type:"button",class:"dash__row",onClick:e[9]||(e[9]=o=>h(4))},[s("span",Us,[t(n,{icon:"vuesax-linear:box-tick",size:"18"})]),e[30]||(e[30]=s("span",{class:"dash__rowText"},[s("b",null,"سفارش مشتریان")],-1)),s("span",qs,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])]),s("button",{type:"button",class:"dash__row",onClick:e[10]||(e[10]=o=>h(5))},[s("span",Gs,[t(n,{icon:"vuesax-linear:profile-2user",size:"18"})]),e[31]||(e[31]=s("span",{class:"dash__rowText"},[s("b",null,"مشتریان من")],-1)),s("span",Hs,[t(n,{icon:"vuesax-linear:arrow-left-1",size:"16"})])])],64)):T("",!0)],4),t(rs,{quote:B.value,class:"dash__rate dash__reveal",style:y(w(2))},null,8,["quote","style"])]),_:1},8,["class"])]),_:1},8,["modelValue"]),t(F,{show:p.notify,"onUpdate:show":e[12]||(e[12]=o=>p.notify=o),art:"logout",title:"آیا می خواهید از برنامه خارج شوید؟",description:`برای استفاده دوباره از امکانات ${i(D).name}، باید دوباره وارد حساب کاربری خود شوید.`,"confirm-text":"بله","cancel-text":"بی خیال",onConfirm:G},null,8,["show","description"]),t(F,{show:p.loginNotify,"onUpdate:show":e[13]||(e[13]=o=>p.loginNotify=o),art:"login",title:"ابتدا وارد حساب کاربری شوید",description:`برای دسترسی به تمامی امکانات نرم افزار ${i(D).name}، گزینه ورود/ثبت نام را لمس کنید و در صورت نداشتن حساب کاربری، ثبت نام نمایید.`,"confirm-text":"ورود/ثبت نام","cancel-text":"بیخیال",onConfirm:e[14]||(e[14]=o=>i(r).push({name:"login"}))},null,8,["show","description"]),t(i(ds),{visible:x.value,"onUpdate:visible":e[17]||(e[17]=o=>x.value=o),placement:"bottom",height:"auto",closable:!1,"body-style":{padding:"0"}},{default:C(()=>[s("div",Ks,[s("button",{type:"button",class:"dash__choiceBtn",onClick:e[15]||(e[15]=o=>N("makeOrderList"))},"ثبت سفارش"),s("button",{type:"button",class:"dash__choiceBtn is-quiet",onClick:e[16]||(e[16]=o=>N("makeOrderStatus"))},"مشاهده سفارش")])]),_:1},8,["visible"])])}}}),ne=os(js,[["__scopeId","data-v-6e3a0cdd"]]);export{ne as default};
|