Files
tehran_tala/apps/user-app-v2/dist/assets/SingleProduct-Efr6JUR3.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
14 KiB
JavaScript

import{d as he,al as De,a as ke,f as l,c as o,b as t,n as Fe,F as G,r as Q,t as u,e as c,A as Me,i as z,am as fe,g as m,h as n,_ as xe,p as Ve,m as Ce,G as Be,C as Ae,u as w,j as L,s as $,l as d,I as _,D as O,an as Le,a4 as ge,T as Ue,x as Xe,v as Ee}from"./index-DXb_5IMH.js";import{a as Ne}from"./Spinner.vue_vue_type_style_index_0_lang-BMAAb8Yk.js";import{_ as je}from"./NotifyVant.vue_vue_type_script_setup_true_lang-BSUvwK_b.js";import{_ as Ge}from"./DialogVant.vue_vue_type_style_index_0_lang-CUUHObAn.js";import{a as Qe,i as He,u as We}from"./cartStore-CZKOLMrO.js";import{l as Je}from"./dialogEmpty1-Caw7F5KL.js";const Ke=["src","alt"],Ye={key:0,class:"gs__counter"},ye=.18,Ze=6,et=he({__name:"GallerySlider",props:fe({slides:{},alt:{},fit:{default:"cover"},showCounter:{type:Boolean,default:!1}},{index:{default:0},indexModifiers:{}}),emits:fe(["tap"],["update:index"]),setup(v,{emit:x}){const h=v,f=De(v,"index"),P=x,F=n(()=>h.fit==="contain"?"gs__img--contain":"gs__img--cover"),S=m(null),r=m(!1),C=m(0);let b=null,R=0,g=0;function M(a){var k;if(h.slides.length<2||b!==null)return;const y=S.value;y&&(b=a.pointerId,R=a.clientX,g=y.getBoundingClientRect().width||1,C.value=0,r.value=!0,(k=y.setPointerCapture)==null||k.call(y,a.pointerId))}function U(a){!r.value||a.pointerId!==b||(C.value=a.clientX-R)}function X(){if(!r.value)return;const a=C.value,y=a/g;r.value=!1,b=null,C.value=0,y<=-ye&&f.value<h.slides.length-1?f.value++:y>=ye&&f.value>0&&f.value--,Math.abs(a)<=Ze&&P("tap")}function H(a){a.pointerId===b&&X()}function p(a){a.pointerId===b&&(r.value=!1,b=null,C.value=0)}function W(){}function J(a){f.value=a}const E=n(()=>{const a=-f.value*100,y=g?C.value/g*100:0;return{transform:`translate3d(${a+y}%, 0, 0)`,transition:r.value?"none":void 0}});return ke(()=>{if(b!==null&&S.value)try{S.value.releasePointerCapture(b)}catch{}}),(a,y)=>(l(),o("div",{ref_key:"root",ref:S,class:z(["gs",{"is-dragging":r.value}]),onPointerdown:M,onPointermove:U,onPointerup:H,onPointercancel:p,onClick:W},[t("div",{class:"gs__track",style:Fe(E.value)},[(l(!0),o(G,null,Q(v.slides,k=>(l(),o("div",{key:k,class:"gs__cell"},[t("img",{src:k,alt:v.alt,class:z(["gs__img",F.value]),draggable:"false"},null,10,Ke)]))),128))],4),v.showCounter&&v.slides.length>1?(l(),o("div",Ye,u(f.value+1)+"/"+u(v.slides.length),1)):c("",!0),Me(a.$slots,"dots",{index:f.value,go:J},void 0,!0)],34))}}),me=xe(et,[["__scopeId","data-v-c30d71a6"]]);function tt(v){const x=m(!1),h=m(!1),f=m(!1),P=m(null);return{loading:x,flag:h,notFound:f,productRef:P,load:async()=>{x.value=!0;try{const r=(await Ve.listProducts()).find(C=>C.id===v)??null;P.value=r,f.value=!r,h.value=!0}catch(S){console.log(S)}finally{x.value=!1}}}}const st=Ce("favorites",{state:()=>({ids:[]}),actions:{toggle(v){const x=this.ids.indexOf(v);x===-1?this.ids.push(v):this.ids.splice(x,1)},isFavorite(v){return this.ids.includes(v)}}}),be={colors:[],brands:[],ciny_id:[],limit_percent:[],limit_gram:[],has_discount:!1,text:void 0,cats:void 0,page:0},lt=Ce("filters",{state:()=>({query:{...be}}),actions:{reset(){this.query={...be}}}});function at(){return localStorage.getItem("appToken")}const nt={class:"pd__controls"},ot={class:"pd__headerTitle"},it={class:"pd__controlsEnd"},ut={key:0,class:"pd__roundBadge"},rt={class:"pd__gallery"},dt={key:0,class:"pd__rail"},ct=["aria-label","onClick"],vt={key:1,class:"pd__stage pd__stage--empty"},_t={key:2,class:"pd__expand","aria-hidden":"true"},pt={class:"pd__scroll"},ft={class:"pd__sheet"},gt={class:"pd__eyebrow"},yt={class:"pd__eyebrowText"},mt={class:"pd__head"},bt={class:"pd__headMain"},ht={class:"pd__title"},kt={key:0,class:"pd__code"},xt={class:"pd__figures"},Ct={class:"pd__figure"},wt={class:"pd__figureValue"},Pt={key:0,class:"pd__figure pd__figure--accent"},St={class:"pd__figureValue"},It={key:0,class:"pd__chips no-scrollbar"},Tt=["disabled","onClick"],$t={key:1,class:"pd__block"},zt={class:"pd__block"},Ot={class:"pd__specs"},Rt={class:"pd__spec"},qt={key:0,class:"pd__spec"},Dt={key:1,class:"pd__spec"},Ft={key:2,class:"pd__spec"},Mt={key:3,class:"pd__spec"},Vt={class:"pd__bar"},Bt={key:0,class:"pd__qty"},At={class:"pd__qtyValue"},Lt=["aria-label"],Ut={class:"pd__pillText"},Xt=["disabled"],Et={key:0,class:"pd__previewCounter"},Nt={key:1,class:"pd__previewThumbs no-scrollbar"},jt=["aria-label","onClick"],Gt=["src","alt"],Qt=["src"],Ht=56,Wt=he({__name:"SingleProduct",props:{id:{}},emits:["closeDrawer"],setup(v,{emit:x}){const h=v,f=x,P=Xe(),F=st(),S=lt(),r=Qe(),C=()=>{f("closeDrawer"),P.currentRoute.value.name==="singleProduct"&&P.back()},b=m(!1),R=m(!1),g=m(0),M=m(!1),U=m(null),X=m(!1);function H(){var A;const s=U.value;if(!s)return;const e=((A=s.querySelector(".pd__gallery"))==null?void 0:A.clientHeight)??0;X.value=s.scrollTop>Math.max(e-Ht,0)}const p=tt(h.id),W=p.loading,J=p.flag,E={id:h.id,title:"",description:null,variants:[],images:[],category:null,brand:null,collections:[]},a=n(()=>We(p.productRef.value??E)),y=n(()=>a.value.id.value),k=n(()=>a.value.title.value),ne=n(()=>a.value.productCode.value),K=n(()=>a.value.variants.value),V=n({get:()=>a.value.selectedVariant.value,set:s=>a.value.selectedVariant.value=s}),oe=n(()=>a.value.min_gram.value),Y=n(()=>a.value.wage.value),Z=n(()=>a.value.qty.value),ie=n(()=>a.value.isPreOrder.value),ee=n(()=>a.value.is_exist.value),te=n(()=>{var s;return((s=p.productRef.value)==null?void 0:s.description)??""}),we=n(()=>te.value.length>120),ue=n(()=>{var s,e;return((e=(s=p.productRef.value)==null?void 0:s.category)==null?void 0:e.id)??""}),B=n(()=>{var s,e;return((e=(s=p.productRef.value)==null?void 0:s.category)==null?void 0:e.title)??""}),re=n(()=>{var s,e;return((e=(s=p.productRef.value)==null?void 0:s.brand)==null?void 0:e.title)??""}),se=n(()=>{var s;return(((s=p.productRef.value)==null?void 0:s.images.length)??0)>0}),I=n(()=>{var s;return((s=p.productRef.value)==null?void 0:s.images.map(e=>e.url))??[]});Be(I,s=>{g.value>s.length-1&&(g.value=0)});const N=m(!1);function Pe(){se.value&&(N.value=!0,document.body.style.overflow="hidden")}function de(){N.value=!1,document.body.style.overflow=""}const ce=n(()=>{const s=Y.value;return s==null?"":s%1===0?String(s):s.toFixed(2)}),Se=n(()=>Z.value>0?`${Z.value} عدد موجود`:ie.value?"پیش‌سفارش":"ناموجود"),Ie=n(()=>Z.value>0?"is-in":ie.value?"is-pre":"is-out"),q=n(()=>{var s,e;return{vid:((s=V.value)==null?void 0:s.id)??"",note:null,pid:((e=p.productRef.value)==null?void 0:e.id)??h.id,product:p.productRef.value??E,qty:1}}),ve=n(()=>r.isInCart(q.value)),j=n(()=>r.find_index(q.value)),D=n(()=>j.value>-1?r.items[j.value].qty:0),_e=n(()=>r.maxQty(q.value)),Te=n(()=>_e.value===null||D.value<_e.value),$e=()=>{Te.value&&r.updateFeild(D.value+1,j.value,q.value,"qty")},ze=()=>{if(D.value<=1){r.remove(q.value);return}r.updateFeild(D.value-1,j.value,q.value,"qty")},pe=s=>He(s),Oe=()=>{r.addToCart(q.value)&&(b.value=!0)},Re=s=>{s.stopPropagation(),F.toggle(h.id)},qe=()=>{ue.value&&(S.query.cats=[ue.value],f("closeDrawer"),P.push({name:"search"}))};return Ae(async()=>{await p.load()}),ke(()=>{N.value&&(document.body.style.overflow="")}),(s,e)=>{const A=Ee("router-link");return w(J)&&w(p).productRef.value?(l(),L(Ne,{key:0,spinning:w(W),tip:"درحال دریافت اطلاعات"},{default:$(()=>[t("article",{class:"pd",ref_key:"scroller",ref:U,onScrollPassive:H},[t("header",{class:z(["pd__header",{"is-solid":X.value}])},[t("div",nt,[t("button",{type:"button",class:"pd__round","aria-label":"بازگشت",onClick:C},[d(_,{icon:"vuesax-linear:arrow-right-1",size:"18"})]),t("h2",ot,u(k.value),1),t("div",it,[t("button",{type:"button",class:z(["pd__round",{"is-on":w(F).isFavorite(y.value)}]),"aria-label":"علاقه‌مندی",onClick:Re},[d(_,{icon:w(F).isFavorite(y.value)?"vuesax-linear:heart-fill":"vuesax-linear:heart",size:"18"},null,8,["icon"])],2),d(A,{class:"pd__round",to:{name:"cart"},"aria-label":"سبد خرید"},{default:$(()=>[d(_,{icon:"vuesax-linear:bag-2",size:"18"}),w(r).items.length?(l(),o("span",ut,u(w(r).items.length),1)):c("",!0)]),_:1})])])],2),t("div",rt,[se.value?(l(),L(me,{key:0,index:g.value,"onUpdate:index":e[0]||(e[0]=i=>g.value=i),slides:I.value,alt:k.value,class:"pd__stage",onTap:Pe},{dots:$(({index:i,go:T})=>[I.value.length>1?(l(),o("div",dt,[(l(!0),o(G,null,Q(I.value,(le,ae)=>(l(),o("button",{key:le,type:"button",class:z(["pd__railDot",{"is-on":ae===i}]),"aria-label":`تصویر ${ae+1}`,onClick:ge(Kt=>T(ae),["stop"])},null,10,ct))),128))])):c("",!0)]),_:1},8,["index","slides","alt"])):(l(),o("div",vt,[d(_,{icon:"vuesax-linear:diamonds",size:"27"})])),se.value?(l(),o("span",_t,[d(_,{icon:"vuesax-linear:maximize-4",size:"15"})])):c("",!0)]),t("div",pt,[t("div",ft,[e[18]||(e[18]=t("div",{class:"pd__grip","aria-hidden":"true"},null,-1)),t("div",gt,[t("span",yt,u(B.value||"محصول"),1),t("span",{class:z(["pd__stock",Ie.value])},[e[8]||(e[8]=t("span",{class:"pd__stockDot","aria-hidden":"true"},null,-1)),O(" "+u(Se.value),1)],2)]),t("header",mt,[t("div",bt,[t("h1",ht,u(k.value),1),ne.value?(l(),o("p",kt,u(ne.value),1)):c("",!0)]),t("div",xt,[t("div",Ct,[t("span",wt,u(oe.value),1),e[9]||(e[9]=t("span",{class:"pd__figureLabel"},"گرم",-1))]),Y.value!=null?(l(),o("div",Pt,[t("span",St,u(ce.value)+"٪",1),e[10]||(e[10]=t("span",{class:"pd__figureLabel"},"اجرت",-1))])):c("",!0)])]),K.value&&K.value.length>1?(l(),o("section",It,[(l(!0),o(G,null,Q(K.value,i=>{var T;return l(),o("button",{key:i.id,type:"button",class:z(["pd__chip",{"is-on":((T=V.value)==null?void 0:T.id)===i.id,"is-out":!pe(i)}]),disabled:!pe(i),onClick:le=>V.value=i},u(i.title),11,Tt)}),128))])):c("",!0),te.value?(l(),o("section",$t,[e[11]||(e[11]=t("h2",{class:"pd__blockTitle"},"توضیحات",-1)),t("p",{class:z(["pd__body",{"is-clamped":!M.value}])},u(te.value),3),we.value?(l(),o("button",{key:0,type:"button",class:"pd__more",onClick:e[1]||(e[1]=i=>M.value=!M.value)},u(M.value?"بستن":"ادامه مطلب"),1)):c("",!0)])):c("",!0),t("section",zt,[e[17]||(e[17]=t("h2",{class:"pd__blockTitle"},"مشخصات",-1)),t("dl",Ot,[t("div",Rt,[t("dt",null,[d(_,{icon:"vuesax-linear:weight",size:"15"}),e[12]||(e[12]=O(" وزن",-1))]),t("dd",null,u(oe.value)+" گرم",1)]),Y.value!=null?(l(),o("div",qt,[t("dt",null,[d(_,{icon:"vuesax-linear:percentage-square",size:"15"}),e[13]||(e[13]=O(" اجرت",-1))]),t("dd",null,u(ce.value)+"٪",1)])):c("",!0),V.value?(l(),o("div",Dt,[t("dt",null,[d(_,{icon:"vuesax-linear:diamonds",size:"15"}),e[14]||(e[14]=O(" تنوع",-1))]),t("dd",null,u(V.value.title),1)])):c("",!0),B.value?(l(),o("div",Ft,[t("dt",null,[d(_,{icon:"vuesax-linear:category",size:"15"}),e[15]||(e[15]=O(" دسته‌بندی",-1))]),t("dd",null,u(B.value),1)])):c("",!0),re.value?(l(),o("div",Mt,[t("dt",null,[d(_,{icon:"vuesax-linear:shop",size:"15"}),e[16]||(e[16]=O(" برند",-1))]),t("dd",null,u(re.value),1)])):c("",!0)])])])]),t("div",Vt,[ve.value?(l(),o("div",Bt,[t("button",{type:"button",class:"pd__qtyBtn","aria-label":"افزایش",onClick:$e},[d(_,{icon:"vuesax-linear:add",size:"15"})]),t("span",At,u(D.value),1),t("button",{type:"button",class:"pd__qtyBtn","aria-label":D.value===1?"حذف":"کاهش",onClick:ze},[d(_,{icon:D.value===1?"vuesax-linear:trash":"vuesax-linear:minus",size:"15"},null,8,["icon"])],8,Lt)])):B.value?(l(),o("button",{key:1,type:"button",class:"pd__pill",onClick:qe},[d(_,{icon:"vuesax-linear:category",size:"17"}),t("span",Ut,u(B.value),1)])):c("",!0),ve.value?(l(),L(A,{key:3,class:"pd__cta",to:{name:"cart"}},{default:$(()=>[d(_,{icon:"vuesax-linear:bag-2",size:"17"}),e[19]||(e[19]=O(" مشاهده سبد خرید ",-1))]),_:1})):(l(),o("button",{key:2,type:"button",class:"pd__cta",disabled:!ee.value,onClick:e[2]||(e[2]=i=>w(at)()?Oe():R.value=!0)},[ee.value?(l(),L(_,{key:0,icon:"vuesax-linear:bag-2",size:"17"})):c("",!0),O(" "+u(ee.value?"افزودن به سفارش":"ناموجود"),1)],8,Xt))])],544),(l(),L(Le,{to:"body"},[d(Ue,{name:"pd-preview"},{default:$(()=>[N.value?(l(),o("div",{key:0,class:"pd__preview",onClick:ge(de,["self"])},[t("button",{type:"button",class:"pd__previewClose","aria-label":"بستن",onClick:de},[d(_,{icon:"vuesax-linear:add",size:"20"})]),I.value.length>1?(l(),o("div",Et,u(g.value+1)+" / "+u(I.value.length),1)):c("",!0),d(me,{index:g.value,"onUpdate:index":e[3]||(e[3]=i=>g.value=i),slides:I.value,alt:k.value,class:"pd__previewStage",fit:"contain"},null,8,["index","slides","alt"]),I.value.length>1?(l(),o("div",Nt,[(l(!0),o(G,null,Q(I.value,(i,T)=>(l(),o("button",{key:i,type:"button",class:z(["pd__previewThumb",{"is-on":T===g.value}]),"aria-label":`تصویر ${T+1}`,onClick:le=>g.value=T},[t("img",{src:i,alt:`${k.value} ${T+1}`,draggable:"false"},null,8,Gt)],10,jt))),128))])):c("",!0)])):c("",!0)]),_:1})])),d(je,{timeOut:3e3,modelValue:b.value,"onUpdate:modelValue":e[4]||(e[4]=i=>b.value=i),color:"background-color: #14161A"},{default:$(()=>[...e[20]||(e[20]=[t("div",{class:"font-bold text-right mb-2"},"ثبت سفارش",-1),t("div",null,"محصول با موفقیت به سبد خرید افزوده شد",-1)])]),_:1},8,["modelValue"]),d(Ge,{timeOut:-1,show:R.value,"onUpdate:show":e[7]||(e[7]=i=>R.value=i),closeOnClickOverlay:!0},{img:$(()=>[t("img",{src:w(Je),alt:"",class:"opacity-80"},null,8,Qt)]),title:$(()=>[...e[21]||(e[21]=[t("div",{class:"p-8 text-justify"}," برای دسترسی به تمامی امکانات نرم افزار منتزر، ابتدا گزینه ورود/ثبت نام را لمس کنید و در صورت نداشتن حساب کاربری، ثبت نام نمایید. ",-1)])]),button:$(()=>[t("div",{class:"text-center font-bold",onClick:e[5]||(e[5]=i=>w(P).push({name:"login"}))},"ورود/ثبت نام"),t("div",{class:"text-center",onClick:e[6]||(e[6]=i=>R.value=!1)},"بیخیال")]),_:1},8,["show"])]),_:1},8,["spinning"])):c("",!0)}}}),Jt=xe(Wt,[["__scopeId","data-v-3f316a84"]]),as=Object.freeze(Object.defineProperty({__proto__:null,default:Jt},Symbol.toStringTag,{value:"Module"}));export{Jt as S,st as a,as as b,lt as u};