Files
tehran_tala/apps/user-app/dist/assets/ChildOrdersView-IOZFDMoh.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
5.1 KiB
JavaScript

import{d as R,o as U,a as $,c as r,k as a,s as f,u as N,g as l,q as j,i as d,b as e,F as P,r as M,f as y,I,t as n,v as T,E as q,_ as A}from"./index-zU76P609.js";import{P as L}from"./PageBar-BNTdgQIH.js";import{a as G}from"./Spinner.vue_vue_type_style_index_0_lang-8IfA4lPE.js";import{S as H}from"./SearchInput-DKDqPKX6.js";import{j as J}from"./filters-CLL9nGZ2.js";import{D as K}from"./index-BL4GBXwx.js";import{P as Q}from"./index-CJgwp52_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./classCallCheck-BeQXLUEU.js";const W={class:"cho"},X={class:"cho__barExtra"},Y={class:"cho__list"},Z=["onClick"],ee={class:"cho__top"},se={class:"cho__left"},te={class:"cho__num"},oe={class:"cho__meta"},ne={class:"cho__strong"},le={class:"cho__right"},ae={class:"cho__meta"},ie={class:"cho__strong"},re={class:"cho__bottom"},de={class:"cho__customer"},ue={key:0,class:"cho__more"},ce={key:1,class:"cho__empty"},_e={key:2,class:"cho__empty"},ve={key:0,class:"cho__detail"},he={class:"cho__detailTitle"},fe={class:"cho__rows"},me={class:"cho__row"},pe={class:"cho__row"},ge={dir:"ltr"},ye={class:"cho__row"},we={dir:"ltr"},be={class:"cho__row"},ke={class:"cho__row"},xe=R({__name:"ChildOrdersView",setup(Ce){const u=l([]),c=l(!1),w=l(!1),m=l(!1),b=l(null),k=l(1),p=l(!0),g=l(!1),i=l(null);function O(t){const s=Number(t??0);return Number.isFinite(s)?s.toFixed(3):"0.000"}async function x(){if(!(c.value||!p.value)){c.value=!0,m.value=!1;try{const t=await j.getExpertChildOrders(k.value,b.value),s=t.rows??[];u.value=[...u.value,...s],s.length<(t.limit??20)?p.value=!1:k.value+=1}catch{m.value=!0,p.value=!1}finally{c.value=!1}}}function S(){u.value=[],k.value=1,p.value=!0,m.value=!1}async function C(){S(),await x()}async function B(t){b.value=t!=null&&t.trim()?t.trim():null,await C()}async function D(){await C(),w.value=!1}function E(t){i.value=t,g.value=!0}const V=l(null);let _=null;return U(async()=>{await x(),typeof IntersectionObserver<"u"&&(_=new IntersectionObserver(t=>{t.some(s=>s.isIntersecting)&&x()}),V.value&&_.observe(V.value))}),$(()=>_==null?void 0:_.disconnect()),(t,s)=>{const F=T("container");return d(),r("div",W,[a(L,{title:"سفارشات مشتریان","back-to":"userPage::hasSubRoute"},{below:f(()=>[e("div",X,[a(H,{onSearch:B,"place-holder":"جستجو"})])]),_:1}),a(G,{spinning:c.value&&!u.value.length,tip:"درحال دریافت اطلاعات"},{default:f(()=>[a(N(Q),{modelValue:w.value,"onUpdate:modelValue":s[0]||(s[0]=o=>w.value=o),onRefresh:D},{default:f(()=>[a(F,{class:"cho__body"},{default:f(()=>[u.value.length?(d(),r(P,{key:0},[e("div",Y,[(d(!0),r(P,null,M(u.value,o=>{var v,h;return d(),r("article",{key:o.id,class:"cho__card",onClick:z=>E(o)},[e("div",ee,[e("div",se,[e("div",te,[s[3]||(s[3]=e("span",{class:"cho__muted"},"سفارش :",-1)),q(" "+n(o.orderNumber),1)]),e("div",oe,[e("span",ne,n(((v=o.items)==null?void 0:v.length)??0),1),s[4]||(s[4]=e("span",{class:"cho__unit"},"آیتم",-1))])]),e("div",le,[s[6]||(s[6]=e("span",{class:"cho__status"},"تحویل مسئول فروش",-1)),e("div",ae,[e("span",ie,n(O(o.w)),1),s[5]||(s[5]=e("span",{class:"cho__unit"},"گرم",-1))])])]),s[7]||(s[7]=e("div",{class:"cho__divider"},null,-1)),e("div",re,[e("div",de," نام مشتری : "+n(((h=o.customer)==null?void 0:h.name)??"—"),1),a(I,{icon:"vuesax-linear:arrow-left-1",size:"20"})])],8,Z)}),128))]),c.value?(d(),r("div",ue,"در حال دریافت…")):y("",!0)],64)):c.value?y("",!0):(d(),r("section",ce,[a(I,{icon:"vuesax-linear:box",size:"26"}),e("p",null,n(b.value?"سفارشی با این مشخصات پیدا نشد.":"هنوز سفارشی ثبت نشده است."),1)])),m.value?(d(),r("section",_e,[a(I,{icon:"vuesax-linear:danger",size:"26"}),s[8]||(s[8]=e("p",null,"دریافت اطلاعات با خطا روبه‌رو شد.",-1)),e("button",{type:"button",class:"cho__retry",onClick:C},"تلاش دوباره")])):y("",!0),e("div",{ref_key:"sentinel",ref:V,class:"cho__sentinel"},null,512)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["spinning"]),a(N(K),{open:g.value,"onUpdate:open":s[2]||(s[2]=o=>g.value=o),placement:"bottom",height:"auto",closable:!1,"body-style":{padding:"0"}},{default:f(()=>{var o,v,h;return[i.value?(d(),r("div",ve,[e("h2",he,n(i.value.orderNumber),1),e("dl",fe,[e("div",me,[s[9]||(s[9]=e("dt",null,"نام مشتری",-1)),e("dd",null,n(((o=i.value.customer)==null?void 0:o.name)??"—"),1)]),e("div",pe,[s[10]||(s[10]=e("dt",null,"شماره تماس",-1)),e("dd",ge,n(((v=i.value.customer)==null?void 0:v.mobile)??"—"),1)]),e("div",ye,[s[11]||(s[11]=e("dt",null,"وزن کل",-1)),e("dd",we,n(O(i.value.w))+" گرم",1)]),e("div",be,[s[12]||(s[12]=e("dt",null,"تعداد آیتم‌ها",-1)),e("dd",null,n(((h=i.value.items)==null?void 0:h.length)??0),1)]),e("div",ke,[s[13]||(s[13]=e("dt",null,"تاریخ ثبت",-1)),e("dd",null,n(N(J)(i.value.createdAt)),1)]),s[14]||(s[14]=e("div",{class:"cho__row"},[e("dt",null,"وضعیت"),e("dd",null,"تحویل مسئول فروش")],-1))]),e("button",{type:"button",class:"cho__close",onClick:s[1]||(s[1]=z=>g.value=!1)},"بستن")])):y("",!0)]}),_:1},8,["open"])])}}}),Fe=A(xe,[["__scopeId","data-v-844d21d4"]]);export{Fe as default};