Files
tehran_taj/apps/user-app-v2/dist/assets/DashboardView-C3lU4F1i.js
T
s.esmaeiliandClaude Opus 5 3f549f1749 parity(apps+api): report + report/detail on the internal ledger [ref: henza_pwa views/report]
Ports "گزارش" end to end (D24), the last missing app page.

In the reference this feature computes nothing: Customer\TahesabController
proxies an external accounting system (hesab.henzagold.com and a bare IP at
31.7.68.147:3030) with TLS verification disabled, a bearer token hardcoded in
the source and a URL-embedded secret, keyed on Customer.mcode. The target has
no such system and no mcode, so per the owner's option الف this is built on our
own ledger with no external connection.

API — customer/me/report{,/detail,/balances,/:id}
- one row per CONFIRMED ledger entry with the running gold and rial balance
  after it, newest first as the reference displayed it
- only confirmed entries count, the same rule the cached
  Customer.goldDebtGrams/fiatDebtRial follow, so the statement's closing
  balance agrees with the figure shown everywhere else in the app
- fields the target has no source for (foreign currency, نام کارساخته,
  جنس فلز, the external system's internal ids) are null/zero and the UI OMITS
  the row rather than rendering a fabricated value (REP-01)

SEC-16, NOT ported: the reference's detail($id) took the factor code from the
URL and performed no ownership check at all — it never consults auth() — so any
signed-in customer could read any other customer's document by guessing a code.
Here the id is only a filter on top of a customerId scope from the token.
Tested in both directions.

Apps (both, template+script byte-identical, per-app styling only)
- ReportView with the reference's two tabs, its card rows and its «جزئیات»
  modal; ReportDocument for one document
- routes /report and /report/detail, the latter opening the second tab
- dashboard entry (v1 tile, v2 row), shown to every signed-in customer since
  the reference's hasMCode() gate has no target equivalent

Verified: build 5/5 · jest 45/45 · report 40/40 (new) ·
complete-profile 38/38 · apps smoke 43/43 · typecheck clean on all four apps.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 01:49:49 +03:30

2 lines
7.8 KiB
JavaScript

import{d as E,E as F,o as M,q as P,c,b as s,u as n,l as t,e as D,s as l,g as h,B as U,p as $,f,i as T,n as b,t as v,D as N,I as o,F as q,L as C,x as B,h as k,v as G,_ as j}from"./index-DXb_5IMH.js";import{R as W}from"./RateStrip-CJV3GCXo.js";import{_ as L}from"./DialogVant.vue_vue_type_style_index_0_lang-CUUHObAn.js";import{l as H}from"./dialogEmpty1-Caw7F5KL.js";import{p as J}from"./filters-CLL9nGZ2.js";import{P as K}from"./index-vn5WboLr.js";import"./_commonjsHelpers-Cpj98o6Y.js";const Q="/assets/dialogEmpty5-DWebUDaI.svg",X={class:"dash"},Y={class:"dash__bar"},Z={class:"dash__barInner"},ss={class:"dash__heroTop"},es={class:"dash__heroIdentity"},ts={class:"dash__heroName"},as={class:"dash__heroMobile"},os={class:"dash__heroFigure"},ns={class:"dash__heroNum"},ls={class:"dash__heroUnit"},is={class:"dash__heroDebt"},rs={class:"dash__inviteIcon","aria-hidden":"true"},us={class:"dash__rowIcon","aria-hidden":"true"},ds={class:"dash__rowIcon","aria-hidden":"true"},_s={class:"dash__rowIcon","aria-hidden":"true"},ps={class:"dash__rowIcon","aria-hidden":"true"},vs={class:"dash__rowIcon","aria-hidden":"true"},cs={class:"dash__rowIcon","aria-hidden":"true"},fs={class:"dash__rowIcon","aria-hidden":"true"},ms=["src"],hs=["src"],bs=70,xs=E({__name:"DashboardView",setup(ys){const i=B(),p=F(),d=h(null),x=h(null),y=h(!1),g=k(()=>d.value?parseFloat(d.value.goldDebtGrams)>0:!1),V=k(()=>g.value?"بدهکار":"بستانکار"),A=k(()=>d.value?Math.abs(parseFloat(d.value.goldDebtGrams)):0),u=U({notify:!1,loginNotify:!1});function _(r){if(!p.isLoggedIn){u.loginNotify=!0;return}r===0&&i.push({name:"ordersList"}),r===1&&i.push({name:"transactionsList"}),r===2&&i.push({name:"profileData"}),r===3&&i.push({name:"favoritesList"}),r===4&&i.push({name:"ChildOrder"}),r===5&&i.push({name:"customerChoice"}),r===6&&i.push({name:"report"})}function S(){p.logout(),u.notify=!1,i.push({name:"home"})}async function z(){p.isLoggedIn&&(d.value=await $.getMe());try{x.value=await $.getLatestGoldPrice()}catch{x.value=null}}async function O(){await z(),y.value=!1}let I=!1;const w=h(I);function m(r){return{"--reveal-delay":`${r*bs}ms`}}return M(async()=>{await z(),!w.value&&(await P(),requestAnimationFrame(()=>{w.value=!0,I=!0}))}),(r,e)=>{const R=G("container");return f(),c("div",X,[s("header",Y,[s("div",Z,[e[15]||(e[15]=s("span",{class:"dash__brand"},"میز کار",-1)),n(p).isLoggedIn?(f(),c("button",{key:0,type:"button",class:"dash__exit","aria-label":"خروج",onClick:e[0]||(e[0]=a=>u.notify=!0)},[t(o,{icon:"vuesax-linear:logout",size:"18"})])):D("",!0)])]),t(n(K),{modelValue:y.value,"onUpdate:modelValue":e[9]||(e[9]=a=>y.value=a),onRefresh:O},{pulling:l(()=>[t(n(C),{size:"18"})]),loosing:l(()=>[t(n(C),{size:"18"})]),loading:l(()=>[t(n(C),{size:"18"})]),success:l(()=>[...e[16]||(e[16]=[s("span",null,null,-1)])]),default:l(()=>[t(R,{class:T(["dash__body",{"is-revealed":w.value}])},{default:l(()=>[d.value?(f(),c("section",{key:0,class:"dash__hero dash__reveal",style:b(m(0))},[s("div",ss,[s("div",es,[s("span",ts,v(d.value.fullName),1),s("span",as,v(n(p).mobile),1)]),s("span",{class:T(["dash__heroSeal",g.value?"is-debtor":"is-creditor"])},v(g.value?"بدهکار":"بستانکار"),3)]),s("div",os,[s("span",ns,v(A.value),1),s("span",ls,"گرم "+v(V.value),1)]),s("div",is,[e[18]||(e[18]=s("span",null,"بدهی ریالی",-1)),s("b",null,[N(v(n(J)(d.value.fiatDebtRial))+" ",1),e[17]||(e[17]=s("i",null,"ریال",-1))])])],4)):(f(),c("section",{key:1,class:"dash__invite dash__reveal",style:b(m(0))},[s("div",rs,[t(o,{icon:"vuesax-linear:security-user",size:"22",color:"#fff"})]),e[19]||(e[19]=s("h3",null,"حساب گرمی شما",-1)),e[20]||(e[20]=s("p",null,"برای دیدن موجودی، سفارش‌ها و اسناد خود وارد شوید.",-1)),s("button",{type:"button",class:"dash__inviteCta",onClick:e[1]||(e[1]=a=>n(i).push({name:"login"}))}," ورود / ثبت‌نام ")],4)),s("section",{class:"dash__rows dash__reveal",style:b(m(1))},[s("button",{type:"button",class:"dash__row",onClick:e[2]||(e[2]=a=>_(0))},[s("span",us,[t(o,{icon:"vuesax-linear:box",size:"18"})]),e[21]||(e[21]=s("span",{class:"dash__rowText"},[s("b",null,"سفارشات"),s("small",null,"پیگیری سفارش‌های شما")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})]),s("button",{type:"button",class:"dash__row",onClick:e[3]||(e[3]=a=>_(1))},[s("span",ds,[t(o,{icon:"vuesax-linear:receipt-text",size:"18"})]),e[22]||(e[22]=s("span",{class:"dash__rowText"},[s("b",null,"اسناد"),s("small",null,"تراکنش‌ها و رسیدهای حساب")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})]),s("button",{type:"button",class:"dash__row",onClick:e[4]||(e[4]=a=>_(2))},[s("span",_s,[t(o,{icon:"vuesax-linear:user",size:"18"})]),e[23]||(e[23]=s("span",{class:"dash__rowText"},[s("b",null,"پروفایل"),s("small",null,"اطلاعات و تنظیمات حساب")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})]),s("button",{type:"button",class:"dash__row",onClick:e[5]||(e[5]=a=>_(3))},[s("span",ps,[t(o,{icon:"vuesax-linear:heart",size:"18"})]),e[24]||(e[24]=s("span",{class:"dash__rowText"},[s("b",null,"علاقمندی"),s("small",null,"محصولات ذخیره‌شده شما")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})]),s("button",{type:"button",class:"dash__row",onClick:e[6]||(e[6]=a=>_(6))},[s("span",vs,[t(o,{icon:"vuesax-linear:chart-2",size:"18"})]),e[25]||(e[25]=s("span",{class:"dash__rowText"},[s("b",null,"گزارش"),s("small",null,"گردش حساب طلایی و ریالی شما")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})]),n(p).isSalesExpert?(f(),c(q,{key:0},[s("button",{type:"button",class:"dash__row",onClick:e[7]||(e[7]=a=>_(4))},[s("span",cs,[t(o,{icon:"vuesax-linear:box-tick",size:"18"})]),e[26]||(e[26]=s("span",{class:"dash__rowText"},[s("b",null,"سفارش مشتریان"),s("small",null,"سفارش‌های مشتریان معرفی‌شده شما")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})]),s("button",{type:"button",class:"dash__row",onClick:e[8]||(e[8]=a=>_(5))},[s("span",fs,[t(o,{icon:"vuesax-linear:profile-2user",size:"18"})]),e[27]||(e[27]=s("span",{class:"dash__rowText"},[s("b",null,"مشتریان من"),s("small",null,"فهرست مشتریان معرفی‌شده شما")],-1)),t(o,{icon:"vuesax-linear:arrow-left-2",size:"16",color:"#8A909C"})])],64)):D("",!0)],4),t(W,{quote:x.value,class:"dash__rate dash__reveal",style:b(m(2))},null,8,["quote","style"])]),_:1},8,["class"])]),_:1},8,["modelValue"]),t(L,{timeOut:-1,show:u.notify,"onUpdate:show":e[11]||(e[11]=a=>u.notify=a),closeOnClickOverlay:!0},{img:l(()=>[s("img",{src:n(Q),alt:"",class:"opacity-70 mb-8"},null,8,ms)]),title:l(()=>[...e[28]||(e[28]=[N("آیا می خواهید از برنامه خارج شوید؟",-1)])]),button:l(()=>[s("div",{class:"text-center text-[#1C2D56]",onClick:S},"بله"),s("div",{class:"text-center text-[#6b7280]",onClick:e[10]||(e[10]=a=>u.notify=!1)},"بی خیال")]),_:1},8,["show"]),t(L,{timeOut:-1,show:u.loginNotify,"onUpdate:show":e[14]||(e[14]=a=>u.loginNotify=a),closeOnClickOverlay:!0},{img:l(()=>[s("img",{src:n(H),alt:"",class:"opacity-80"},null,8,hs)]),title:l(()=>[...e[29]||(e[29]=[s("div",{class:"p-8 text-justify"}," برای دسترسی به تمامی امکانات نرم افزار منتزر، ابتدا گزینه ورود/ثبت نام را لمس کنید و در صورت نداشتن حساب کاربری، ثبت نام نمایید. ",-1)])]),button:l(()=>[s("div",{class:"text-center text-[#1C2D56]",onClick:e[12]||(e[12]=a=>n(i).push({name:"login"}))},"ورود/ثبت نام"),s("div",{class:"text-center text-danger",onClick:e[13]||(e[13]=a=>u.loginNotify=!1)},"بیخیال")]),_:1},8,["show"])])}}}),$s=j(xs,[["__scopeId","data-v-26ecda4a"]]);export{$s as default};