Files
tehran_taj/apps/user-app/dist/assets/SingleProduct-Bo-ynxSe.js
T
s.esmaeiliandClaude Opus 5 f71fd5bfe1 feat(apps): sales-expert screens in both apps + v2 admin home slider (D21, APP-02)
Both expert screens are built in user-app and user-app-v2, with byte-identical
template and script and a per-app style block only — verified by diffing
everything above <style>:

  ChildOrdersView  "سفارش مشتریان"  — legacy ChildOrders.vue. Keeps the
    reference's title, search, infinite paging, and per-card item count, total
    weight, customer name and the fixed «تحویل مسئول فروش» chip (the endpoint
    only returns that status, ApiMobileController:766).
  CustomerChoiceView "لیست مشتریان" — legacy customerChoice.vue. Keeps its
    title, per-search re-query and the reference's choice to LIST inactive
    customers (its active() scope is commented out at :187).

Reachable from inside the app, not just by URL: routes carry the reference's own
paths and names, the dashboard grows the two entries only for an expert (v1 as
tiles, v2 as its own rows), and a router guard sends an ordinary customer back
to their dashboard. None of that is relied on for safety — the server scopes
both endpoints on the AdminUser id in the token and answers 403 otherwise.

Not ported, both recorded in D21: the act-as api_token minting (:197-201) and
the child-order edit drawer, which recomputed an order's money from client-sent
values. The card opens a read-only summary instead.

APP-02 fixed: user-app-v2 gained getHomeSlider and now prefers admin-configured
slides, keeping its category-derived hero as the fallback and its own design.

Session stores stay byte-identical across the apps.
build 5/5, jest 45/45, expert login 36/36, apps smoke 43/43, typecheck clean.

[ref: henza_pwa/src/views/user/src/components/ChildOrders.vue, customerChoice.vue]
[ref: henza_pwa/src/router/index.ts:171-188]

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

2 lines
14 KiB
JavaScript

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