D20: OTP_MASTER_CODE login bypass read only from the environment, disabled when unset, audited on every use, with a boot banner while armed. SMS no longer aborts the boot in production — it warns and declines silently, so no message can stop an operation. D19: port Utility::faTOen onto admin-entered mobiles (before the uniqueness lookup, which could previously be bypassed with Persian digits), and the create-only welcome SMS, byte-identical to the reference and fire-and-forget. user-app-v2 was missing the cart stock ceiling entirely: capQty/maxQty, the un-orderable guard and the qty clamp are ported, leaving v2's own design intact. The two cart stores are now byte-identical. isVariantOrderable and the orderable-first default selection ported too. jest 45/45; typecheck clean on api, admin-panel, user-app, user-app-v2. [ref: henza_server/app/Http/Controllers/Adm/AdminController.php:333,348,364,378-387] [ref: henza_server/app/Models/Utility.php:26] Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2 lines
7.7 KiB
JavaScript
2 lines
7.7 KiB
JavaScript
import{d as B,l as L,i as r,c,b as e,u as a,w as E,k as i,I as y,t as m,f as C,E as h,h as P,_ as N,G as T,o as G,s as l,x as V,g as F,C as R,F as M,r as Q,L as z,y as W,q as j,v as H}from"./index-DAH9biZS.js";import{l as X}from"./dialogEmpty1-Caw7F5KL.js";import{P as A}from"./PageBar-LUK1_bA9.js";import{a as J}from"./Spinner.vue_vue_type_style_index_0_lang-V0MPrlo2.js";import{_ as U}from"./DialogVant.vue_vue_type_style_index_0_lang-C5L98I2P.js";import{a as O,u as K}from"./cartStore-fT_Tbpm4.js";import{D as Y}from"./index-C1LmW9W3.js";import{P as Z}from"./index-VkUE5Js-.js";import{F as tt,T as et,a as st}from"./index-CPQtCaRL.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./classCallCheck-CSZsSBLe.js";import"./FormItemContext-DwqRsrU-.js";const ot="/assets/dialogEmpty4-Bh_UXocp.svg",at={class:"ci"},nt={class:"ci__art"},it=["alt"],lt={key:1,class:"ci__artEmpty","aria-hidden":"true"},rt={class:"ci__main"},ct={class:"ci__title"},dt={class:"ci__meta"},ut={class:"ci__weight"},_t={key:0,class:"ci__wage"},mt={class:"ci__row"},pt={class:"ci__qty"},vt=["disabled"],yt={class:"ci__qtyValue"},ft={key:0,class:"ci__noteText"},gt=B({__name:"CartItem",props:{value:{}},emits:["note"],setup(u,{emit:b}){const n=u,w=b,d=O(),v=d.find_index(n.value),s=P(()=>d.maxQty(n.value)),_=P(()=>s.value===null||n.value.qty<s.value),$=()=>{_.value&&d.updateFeild(n.value.qty+1,v,n.value,"qty")},I=()=>{d.updateFeild(n.value.qty-1,v,n.value,"qty")},{image:x,title:k,selectedVariant:f,wage:t}=K(n.value.product,d.variant(n.value)),g=P(()=>{const p=t.value;return p==null?"":p%1===0?String(p):p.toFixed(2)});return(p,o)=>{var D;const q=L("lazy");return r(),c("article",at,[e("div",nt,[a(x)?E((r(),c("img",{key:0,alt:a(k)},null,8,it)),[[q,a(x)]]):(r(),c("div",lt,[i(y,{icon:"vuesax-linear:diamonds",size:"20"})]))]),e("div",rt,[e("h3",ct,m(a(k)),1),e("div",dt,[e("span",ut,m((D=a(f))==null?void 0:D.rashWeightGrams)+" گرم",1),a(t)!=null?(r(),c("span",_t,"اجرت "+m(g.value)+"٪",1)):C("",!0)]),e("div",mt,[e("div",pt,[e("button",{type:"button",class:"ci__qtyBtn","aria-label":"افزودن",disabled:!_.value,onClick:$},[i(y,{icon:"vuesax-linear:add",size:"16"})],8,vt),e("span",yt,m(u.value.qty),1),u.value.qty===1?(r(),c("button",{key:0,type:"button",class:"ci__qtyBtn ci__qtyBtn--danger","aria-label":"حذف",onClick:o[0]||(o[0]=S=>a(d).remove(u.value))},[i(y,{icon:"vuesax-linear:trash",size:"16"})])):(r(),c("button",{key:1,type:"button",class:"ci__qtyBtn","aria-label":"کاهش",onClick:I},[i(y,{icon:"vuesax-linear:minus",size:"16"})]))]),e("button",{type:"button",class:"ci__note",onClick:o[1]||(o[1]=S=>w("note",a(v)))},[i(y,{icon:"vuesax-linear:note-text",size:"15"}),h(" "+m(!u.value.note||u.value.note===""?"توضیحات":"ویرایش توضیحات"),1)])]),u.value.note?(r(),c("p",ft,m(u.value.note),1)):C("",!0)])])}}}),bt=N(gt,[["__scopeId","data-v-52807f97"]]),wt={class:"cart"},xt={key:0,class:"cart__items"},kt={key:1,class:"cart__empty"},ht={key:1,class:"cart__done"},Ct={class:"cart__doneIcon","aria-hidden":"true"},$t={class:"cart__doneSub"},It={key:0,class:"cart__bar"},qt={class:"cart__barInner"},Pt={class:"cart__total"},Vt={class:"cart__totalValue"},zt={class:"sheet"},Dt={class:"sheet__title"},Ft=["src"],Rt=["src"],Ut=B({__name:"CartView",setup(u){const b=W(),n=O(),w=T(),d=F(!1),v=F(!1),s=R({loadingPage:!1,showPopUp:!1,step:1,notify:!1,orderID:"",tempRowIndex:-1,tempRow:{product:void 0}}),_=R({note:void 0}),$=()=>{n.updateFeild(_.note,s.tempRowIndex,s.tempRow,"note"),s.showPopUp=!1,_.note=void 0,s.tempRow={product:void 0}},I=async()=>{await b.push({name:"ordersList"}),s.step=1},x=async()=>{if(s.notify=!1,!w.customerId){d.value=!0;return}try{s.loadingPage=!0;const f=await j.createOrder({customerId:w.customerId,items:n.items.map(t=>{const g=n.variant(t);return{productVariantId:t.vid,quantity:t.qty,wagePercent:g?parseFloat(g.defaultWagePercent):0}})});s.orderID=f.orderNumber,s.step=2,n.clear()}catch(f){console.log(f)}finally{s.loadingPage=!1}};async function k(){await n.init(),v.value=!1}return G(async()=>{await n.init()}),(f,t)=>{var p;const g=H("container");return r(),c("div",wt,[i(A,{title:"سبد خرید","back-to":"home"}),i(J,{spinning:s.loadingPage,tip:"درحال دریافت اطلاعات"},{default:l(()=>[i(g,{class:"cart__body"},{default:l(()=>[s.step===1?(r(),V(a(Z),{key:0,modelValue:v.value,"onUpdate:modelValue":t[1]||(t[1]=o=>v.value=o),onRefresh:k},{pulling:l(()=>[i(a(z),{size:"18"})]),loosing:l(()=>[i(a(z),{size:"18"})]),loading:l(()=>[i(a(z),{size:"18"})]),success:l(()=>[...t[10]||(t[10]=[e("span",null,null,-1)])]),default:l(()=>[a(n).items.length?(r(),c("div",xt,[(r(!0),c(M,null,Q(a(n).items,o=>(r(),V(bt,{key:o.pid+o.vid,value:o,onNote:q=>{s.tempRow=o,s.showPopUp=!0,s.tempRowIndex=q,_.note=o.note??void 0}},null,8,["value","onNote"]))),128))])):(r(),c("section",kt,[i(y,{icon:"vuesax-linear:bag-2",size:"26"}),t[11]||(t[11]=e("p",null,"سبد خرید شما خالی است.",-1)),e("button",{type:"button",class:"cart__emptyCta",onClick:t[0]||(t[0]=o=>a(b).push({name:"home"}))}," دیدن محصولات ")]))]),_:1},8,["modelValue"])):(r(),c("section",ht,[e("div",Ct,[i(y,{icon:"vuesax-linear:tick-circle",size:"30"})]),t[13]||(t[13]=e("h2",{class:"cart__doneTitle"},"سفارش شما ثبت شد",-1)),e("p",$t,[t[12]||(t[12]=h(" شماره سفارش ",-1)),e("b",null,m(s.orderID),1)]),t[14]||(t[14]=e("p",{class:"cart__doneHint"},"برای پیگیری وضعیت، به فهرست سفارشها مراجعه کنید.",-1)),e("button",{type:"button",class:"cart__doneCta",onClick:I},"فهرست سفارشها")]))]),_:1})]),_:1},8,["spinning"]),a(n).items.length>0&&s.step===1?(r(),c("div",It,[e("div",qt,[e("div",Pt,[t[16]||(t[16]=e("span",{class:"cart__totalLabel"},"جمع وزن",-1)),e("span",Vt,[h(m(a(n).total())+" ",1),t[15]||(t[15]=e("i",null,"گرم",-1))])]),e("button",{type:"button",class:"cart__submit",onClick:t[2]||(t[2]=o=>s.notify=!0)},"ثبت نهایی سفارش")])])):C("",!0),(p=s.tempRow)!=null&&p.product?(r(),V(a(Y),{key:1,visible:s.showPopUp,"onUpdate:visible":t[4]||(t[4]=o=>s.showPopUp=o),placement:"bottom",closable:!1,height:"300px",class:"rtl",bodyStyle:{padding:0}},{default:l(()=>[e("div",zt,[e("h3",Dt,"توضیح برای "+m(s.tempRow.product.title),1),i(a(st),{model:_,name:"noteForm",layout:"vertical",autocomplete:"off",onFinish:$},{default:l(()=>[i(a(tt),{"has-feedback":"",name:"note"},{default:l(()=>[i(a(et),{value:_.note,"onUpdate:value":t[3]||(t[3]=o=>_.note=o),rows:4,placeholder:"مثلاً سایز یا جزئیات سفارش"},null,8,["value"])]),_:1}),t[17]||(t[17]=e("button",{type:"submit",class:"sheet__cta"},"ثبت توضیحات",-1))]),_:1},8,["model"])])]),_:1},8,["visible"])):C("",!0),i(U,{timeOut:-1,show:s.notify,"onUpdate:show":t[6]||(t[6]=o=>s.notify=o),closeOnClickOverlay:!0},{img:l(()=>[e("img",{src:a(ot),alt:"",class:"opacity-70"},null,8,Ft)]),title:l(()=>[...t[18]||(t[18]=[h("آیا مطمئن به ثبت سفارش هستید ؟",-1)])]),button:l(()=>[e("div",{class:"text-center text-[#1C2D56]",onClick:x},"بله"),e("div",{class:"text-center text-[#6b7280]",onClick:t[5]||(t[5]=o=>s.notify=!1)},"بی خیال")]),_:1},8,["show"]),i(U,{timeOut:-1,show:d.value,"onUpdate:show":t[9]||(t[9]=o=>d.value=o),closeOnClickOverlay:!0},{img:l(()=>[e("img",{src:a(X),alt:"",class:"opacity-80"},null,8,Rt)]),title:l(()=>[...t[19]||(t[19]=[e("div",{class:"p-8 text-justify"},"برای ثبت سفارش ابتدا باید وارد حساب کاربری خود شوید.",-1)])]),button:l(()=>[e("div",{class:"text-center text-[#1C2D56]",onClick:t[7]||(t[7]=o=>a(b).push({name:"login"}))},"ورود/ثبت نام"),e("div",{class:"text-center text-danger",onClick:t[8]||(t[8]=o=>d.value=!1)},"بیخیال")]),_:1},8,["show"])])}}}),Ht=N(Ut,[["__scopeId","data-v-32f4b537"]]);export{Ht as default};
|