Files
tehran_taj/apps/user-app-v2/dist/assets/LoginRegisterView-YXS01jJu.js
T
mahmoodandClaude Sonnet 5.5 6514b05d18 fix(money,orders): wage/gram-debt parity, atomic document confirm, expert edit, made-to-order, QA fixes
- Rial wage and gram-debt arithmetic matched to the reference; order corrections keep debt in sync
- Document confirm/un-confirm is a compare-and-swap (no double-applied cache under concurrency)
- Settlement document and expert inputs validated (400 instead of 500)
- Expert: edit / activate-deactivate own customers, adjust raw weights only
- Made-to-order flow in the app, PreOrder.quantity migration
- Order grids: customer column, sort keys; panel select search; pre-order quantity save
- Rebuilt release artifacts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 18:09:02 +03:30

2 lines
15 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as R,h as x,W as q,o as te,b as _,c as b,w as H,X as se,e as a,f as z,g as D,F as j,r as ae,j as E,D as J,Y as ne,S as oe,E as Z,p as o,C as f,m as c,s as N,B as le,t as C,Z as re,R as L,O as P,v as M,z as K,$ as U,i as ue,_ as G,I as T,a0 as W}from"./index-6E0fX61D.js";import{P as X}from"./PageBar-HEcoSwjE.js";import{a as Y,F,I as B,T as ie}from"./index-C6v9FxiB.js";import"./isEqual-4qLLVpCV.js";import"./FormItemContext-i27DxbTo.js";import"./classCallCheck-BINKwNli.js";import"./raf-nDFcuFT6.js";const ce={class:"otp-single-input"},de=["type","placeholder","disabled"],pe={key:0},me=["innerHTML"],ve=R({__name:"SingleOtpInput",props:{inputType:{default:"tel"},value:{},separator:{},focus:{type:Boolean},inputClasses:{},shouldAutoFocus:{type:Boolean},isLastChild:{type:Boolean},placeholder:{},disabled:{type:Boolean}},emits:["on-change","on-keydown","on-paste","on-focus","on-blur"],setup(l,{emit:k}){const u=l,y=k,r=x(u.value||""),s=x(null),h=()=>(r.value=r.value.toString(),r.value.length>1&&(r.value=r.value.slice(0,1)),y("on-change",r.value)),d=i=>i>=48&&i<=57||i>=96&&i<=105,n=i=>{u.disabled&&i.preventDefault();const v=i||window.event,g=v.which?v.which:v.keyCode;d(g)||[8,9,13,37,39,46,86].includes(g)?y("on-keydown",i):v.preventDefault()},m=i=>y("on-paste",i),w=()=>(s.value.select(),y("on-focus")),O=()=>y("on-blur");return q(()=>u.value,(i,v)=>{i!==v&&(r.value=i??"")}),q(()=>u.focus,(i,v)=>{v!==i&&s.value&&u.focus&&(s.value.focus(),s.value.select())}),te(()=>{s.value&&u.focus&&u.shouldAutoFocus&&(s.value.focus(),s.value.select())}),(i,v)=>(_(),b("div",ce,[H(a("input",{type:l.inputType,placeholder:l.placeholder,disabled:l.disabled,ref_key:"input",ref:s,min:"0",max:"9",maxlength:"1",pattern:"[0-9]","onUpdate:modelValue":v[0]||(v[0]=g=>r.value=g),class:z(l.inputClasses),onInput:h,onKeydown:n,onPaste:m,onFocus:w,onBlur:O},null,42,de),[[se,r.value]]),!l.isLastChild&&l.separator?(_(),b("span",pe,[a("span",{innerHTML:l.separator},null,8,me)])):D("",!0)]))}}),_e={class:"flex ltr justify-around w-full"},fe=8,ge=37,he=39,ye=46,be=R({__name:"OtpInput",props:{defaultFocus:{type:Boolean},numInputs:{default:4},separator:{},inputClasses:{},inputType:{},shouldAutoFocus:{type:Boolean,default:!1},placeholder:{},disabled:{type:Boolean,default:!1}},emits:["on-change","on-complete"],setup(l,{emit:k}){const u=l,y=k,r=x(0),s=x([]),h=x([]),d=e=>{u.defaultFocus&&e<u.numInputs&&!s.value[e]?r.value=s.value.length:r.value=e},n=()=>{r.value=-1},m=()=>s.value.join("").length===u.numInputs?y("on-complete",s.value.join("")):"Wait until the user enters the required number of characters",w=e=>{r.value=Math.max(Math.min(u.numInputs-1,e),0)},O=()=>w(r.value+1),i=()=>w(r.value-1),v=e=>{h.value=Object.assign([],s.value),typeof e=="string"&&e===""?s.value.splice(r.value,1):s.value[r.value]=e,h.value.join("")!==s.value.join("")&&(y("on-change",s.value.join("")),m())},g=e=>{var V;e.preventDefault();const I=(((V=e.clipboardData)==null?void 0:V.getData("text/plain"))??"").slice(0,u.numInputs-r.value).split("");if(u.inputType==="number"&&!I.join("").match(/^\d+$/))return"Invalid pasted data";const A=s.value.slice(0,r.value).concat(I);return A.slice(0,u.numInputs).forEach((Q,ee)=>{s.value[ee]=Q}),w(A.slice(0,u.numInputs).length),m()},t=e=>{v(e),O()},p=e=>{switch(e.keyCode){case fe:e.preventDefault(),v(""),i();break;case ye:e.preventDefault(),v("");break;case ge:e.preventDefault(),i();break;case he:e.preventDefault(),O();break}};return(e,$)=>(_(),b("div",null,[a("div",_e,[(_(!0),b(j,null,ae(l.numInputs,(I,S)=>(_(),E(ve,{key:S,focus:r.value===S,value:s.value[S],separator:l.separator,"input-type":l.inputType,"input-classes":l.inputClasses,"is-last-child":S===l.numInputs-1,"should-auto-focus":l.shouldAutoFocus,placeholder:l.placeholder,disabled:l.disabled,onOnChange:t,onOnKeydown:p,onOnPaste:g,onOnFocus:A=>d(S),onOnBlur:n},null,8,["focus","value","separator","input-type","input-classes","is-last-child","should-auto-focus","placeholder","disabled","onOnFocus"]))),128))])]))}}),ke=l=>` مقدار ${l} نا معتبر است `,we=l=>({pattern:/^(\+98|0098|98|0)?9\d{9}$/g,message:ke(l)}),xe=l=>({required:!0,message:` لطفا ${l} را وارد کنید `}),$e={class:"auth"},Ce={class:"auth__intro"},Ie=["alt"],Oe={class:"auth__title"},Se={class:"auth__sub"},Fe={class:"auth__card"},Te={key:0,class:"auth__timer"},Be={key:1,class:"auth__timer"},De=["disabled"],Ee={class:"auth__switch"},Ae=R({__name:"LoginView",emits:["register"],setup(l,{emit:k}){const u=k,y=J(),r=ne(),s=oe(),h=P({username:void 0}),d=P({step:1,loading:!1,defaultFocus:!1});function n(p){return(p??"").replace(/[۰-۹]/g,e=>String(e.charCodeAt(0)-1776)).replace(/[٠-٩]/g,e=>String(e.charCodeAt(0)-1632)).replace(/\D/g,"").slice(0,11)}const m=x(0),w=()=>{m.value>0&&setTimeout(()=>{m.value>0&&(m.value-=1,w())},1e3)},O=async()=>{var p;try{d.loading=!0,await M.requestOtp(String(h.username??"")),d.step=2,m.value=120,w(),d.defaultFocus=!0,await K(),await K(),(p=document.querySelector(".auth__otp .otp-input"))==null||p.focus()}catch(e){const $=e instanceof Error&&/\((?:429|404|403)\)/.test(e.message)?v(e):null;U.error($??"خطا در ارسال کد. لطفاً دوباره تلاش کنید.")}finally{d.loading=!1}},i=async p=>{try{d.loading=!0;const e=await M.verifyOtp(String(h.username??""),p),{token:$,customer:I}=e;if(s.login($,I.id,I.mobile),e.iamBootstrapUrl){window.location.assign(e.iamBootstrapUrl);return}try{const A=await M.getExpertIdentity();s.setSalesExpert(A.isSalesExpert)}catch{s.setSalesExpert(!1)}const S=typeof r.query.redirect=="string"?r.query.redirect:void 0;await y.replace(S??{name:"home"}),U.success("با موفقیت وارد شدید")}catch(e){U.error(e instanceof Error&&/\(429\)/.test(e.message)?v(e)??"تعداد تلاش‌ها بیش از حد مجاز است.":"کد وارد شده صحیح نیست")}finally{d.loading=!1}};function v(p){const e=p.message.match(/\{.*\}/);if(!e)return null;try{const $=JSON.parse(e[0]);return typeof $.message=="string"?$.message:null}catch{return null}}const g=p=>p<10?"0"+p:p,t=ue(()=>d.step===1?"دریافت رمز عبور":"دریافت مجدد رمز عبور");return(p,e)=>{const $=Z("container");return _(),b("div",$e,[o(X,{title:"ورود","back-to":"home"}),o($,{class:"auth__body"},{default:f(()=>[a("section",Ce,[a("img",{class:"auth__logo",src:le,alt:c(N).name},null,8,Ie),a("h2",Oe,"ورود به "+C(c(N).name),1),a("p",Se,C(d.step===1?"شماره موبایل خود را وارد کنید":"رمز یکبارمصرف را وارد کنید"),1)]),a("section",Fe,[d.step===2?(_(),b(j,{key:0},[o(be,{class:"auth__otp","input-classes":"otp-input",inputType:"tel","num-inputs":4,"should-auto-focus":!0,defaultFocus:d.defaultFocus,onOnComplete:i},null,8,["defaultFocus"]),m.value>0?(_(),b("p",Te," امکان دریافت مجدد رمز در "+C(g(m.value))+" ثانیه دیگر ",1)):(_(),b("p",Be,"برای دریافت رمز عبور مجدد تلاش کنید"))],64)):D("",!0),o(c(Y),{model:h,layout:"vertical",onFinish:O,class:"auth__form"},{default:f(()=>[H(o(c(F),{name:"username",label:"تلفن همراه",rules:[c(xe)("تلفن همراه"),c(we)("تلفن همراه")]},{default:f(()=>[o(c(B),{value:h.username,type:"tel",inputmode:"numeric",maxlength:11,placeholder:"09123456789",autocomplete:"tel","onUpdate:value":e[0]||(e[0]=I=>h.username=n(I))},null,8,["value"])]),_:1},8,["rules"]),[[re,d.step===1]]),a("button",{type:"submit",class:z(["auth__cta",{"is-loading":d.loading}]),disabled:d.loading||m.value>0&&d.step===2},C(t.value),11,De)]),_:1},8,["model"])]),a("p",Ee,[e[2]||(e[2]=L(" اگر ثبت نام نکرده‌اید ",-1)),a("button",{type:"button",onClick:e[1]||(e[1]=I=>u("register",!0))},"ثبت نام کنید")])]),_:1})])}}}),Re=G(Ae,[["__scopeId","data-v-07e8321b"]]),Le={class:"reg"},Me={class:"reg__doneMark","aria-hidden":"true"},Ue={class:"reg__doneText"},ze={class:"reg__ltr"},Pe={class:"reg__doneActions"},je={class:"reg__head"},Ve=["aria-valuenow"],qe={class:"reg__stepLabel"},Ne={class:"reg__title"},Ke={class:"reg__sub"},We={key:"s1",class:"reg__fields"},He={class:"reg__row"},Je={key:"s2",class:"reg__fields"},Ze={class:"reg__note"},Ge={class:"reg__footer"},Xe={class:"reg__footerInner"},Ye=["disabled"],Qe={key:0,class:"reg__spinner keep-motion","aria-hidden":"true"},et={key:0,class:"reg__switch"},tt=R({__name:"RegisterView",emits:["register"],setup(l,{emit:k}){const u=k,y=J(),r=x(),s=x(1),h=x(!1),d=x(!1),n=P({fname:void 0,lname:void 0,mobile:void 0,store_name:void 0,phone:void 0,city:void 0,address:void 0}),m=g=>({required:!0,whitespace:!0,message:`لطفاً ${g} را وارد کنید`});function w(g){return(g??"").replace(/[۰-۹]/g,t=>String(t.charCodeAt(0)-1776)).replace(/[٠-٩]/g,t=>String(t.charCodeAt(0)-1632)).replace(/\D/g,"")}function O(){d.value?y.push({name:"home"}):s.value===2?s.value=1:u("register",!1)}async function i(){if(s.value===1){s.value=2,window.scrollTo({top:0,behavior:"smooth"});return}try{h.value=!0,await M.register({fname:String(n.fname??""),lname:String(n.lname??""),mobile:String(n.mobile??""),store_name:String(n.store_name??""),phone:String(n.phone??""),address:String(n.address??""),city:String(n.city??"")}),d.value=!0,window.scrollTo({top:0})}catch(g){U.error(v(g)??"خطا در ثبت اطلاعات. لطفاً دوباره تلاش کنید.")}finally{h.value=!1}}function v(g){const t=g instanceof Error?g.message.match(/\{.*\}/):null;if(!t)return null;try{const p=JSON.parse(t[0]);return Array.isArray(p.message)?p.message[0]??null:p.message??null}catch{return null}}return(g,t)=>{const p=Z("container");return _(),b("div",Le,[o(X,{title:"ثبت نام","back-action":O}),o(W,{name:"reg-fade",mode:"out-in"},{default:f(()=>[d.value?(_(),E(p,{key:"done",class:"reg__body reg__done"},{default:f(()=>[a("div",Me,[t[10]||(t[10]=a("span",{class:"reg__doneRing"},null,-1)),o(T,{icon:"vuesax-linear:tick-circle",size:"40"})]),t[12]||(t[12]=a("h2",{class:"reg__doneTitle"},"درخواست شما ثبت شد",-1)),a("p",Ue,[L(" اطلاعات فروشگاه "+C(n.store_name)+" برای کارشناسان ما ارسال شد. پس از بررسی و تایید، می‌توانید با شماره ",1),a("span",ze,C(n.mobile),1),t[11]||(t[11]=L(" وارد شوید. ",-1))]),a("div",Pe,[a("button",{type:"button",class:"reg__cta",onClick:t[0]||(t[0]=e=>c(y).push({name:"home"}))},"بازگشت به صفحه اصلی"),a("button",{type:"button",class:"reg__ghost",onClick:t[1]||(t[1]=e=>u("register",!1))},"رفتن به صفحه ورود")])]),_:1})):(_(),E(p,{key:"form",class:"reg__body"},{default:f(()=>[a("header",je,[a("div",{class:"reg__steps",role:"progressbar","aria-valuenow":s.value,"aria-valuemin":"1","aria-valuemax":"2"},[t[13]||(t[13]=a("span",{class:"reg__seg is-on"},null,-1)),a("span",{class:z(["reg__seg",{"is-on":s.value===2}])},null,2)],8,Ve),a("p",qe,"مرحله "+C(s.value===1?"۱":"۲")+" از ۲",1),a("h2",Ne,C(s.value===1?"اطلاعات شما":"اطلاعات فروشگاه"),1),a("p",Ke,C(s.value===1?"برای ساخت حساب فروشگاه، ابتدا خودتان را معرفی کنید.":"این اطلاعات برای ارسال سفارش و تایید حساب استفاده می‌شود."),1)]),o(c(Y),{ref_key:"formRef",ref:r,model:n,layout:"vertical",class:"reg__form",onFinish:i},{default:f(()=>[o(W,{name:s.value===2?"reg-next":"reg-prev",mode:"out-in"},{default:f(()=>[s.value===1?(_(),b("div",We,[a("div",He,[o(c(F),{name:"fname",label:"نام",rules:[m("نام خود")]},{default:f(()=>[o(c(B),{value:n.fname,"onUpdate:value":t[2]||(t[2]=e=>n.fname=e),placeholder:"مثلاً علی",autocomplete:"given-name",enterkeyhint:"next"},null,8,["value"])]),_:1},8,["rules"]),o(c(F),{name:"lname",label:"نام خانوادگی",rules:[m("نام خانوادگی")]},{default:f(()=>[o(c(B),{value:n.lname,"onUpdate:value":t[3]||(t[3]=e=>n.lname=e),placeholder:"مثلاً محمدی",autocomplete:"family-name",enterkeyhint:"next"},null,8,["value"])]),_:1},8,["rules"])]),o(c(F),{name:"mobile",label:"شماره موبایل",rules:[m("شماره موبایل"),{pattern:/^09\d{9}$/,message:"شماره موبایل باید ۱۱ رقم و با ۰۹ شروع شود"}],extra:"کد ورود به این شماره پیامک می‌شود."},{default:f(()=>[o(c(B),{value:n.mobile,class:"reg__num",type:"tel",inputmode:"numeric",maxlength:11,placeholder:"09123456789",autocomplete:"tel",enterkeyhint:"next","onUpdate:value":t[4]||(t[4]=e=>n.mobile=w(e))},{prefix:f(()=>[o(T,{icon:"vuesax-linear:mobile",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"])])):(_(),b("div",Je,[o(c(F),{name:"store_name",label:"نام فروشگاه",rules:[m("نام فروشگاه")]},{default:f(()=>[o(c(B),{value:n.store_name,"onUpdate:value":t[5]||(t[5]=e=>n.store_name=e),placeholder:"مثلاً گالری طلای آفتاب",autocomplete:"organization",enterkeyhint:"next"},{prefix:f(()=>[o(T,{icon:"vuesax-linear:shop",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"]),o(c(F),{name:"phone",label:"تلفن فروشگاه",rules:[m("تلفن فروشگاه"),{pattern:/^(0\d{10}|\d{8})$/,message:"تلفن را با کد شهر وارد کنید، مثلاً 02112345678"}]},{default:f(()=>[o(c(B),{value:n.phone,class:"reg__num",type:"tel",inputmode:"numeric",maxlength:11,placeholder:"02112345678",autocomplete:"tel-national",enterkeyhint:"next","onUpdate:value":t[6]||(t[6]=e=>n.phone=w(e))},{prefix:f(()=>[o(T,{icon:"vuesax-linear:call",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"]),o(c(F),{name:"city",label:"شهر",rules:[m("شهر")]},{default:f(()=>[o(c(B),{value:n.city,"onUpdate:value":t[7]||(t[7]=e=>n.city=e),placeholder:"مثلاً تهران",autocomplete:"address-level2",enterkeyhint:"next"},{prefix:f(()=>[o(T,{icon:"vuesax-linear:buildings",size:"18"})]),_:1},8,["value"])]),_:1},8,["rules"]),o(c(F),{name:"address",label:"آدرس پستی",rules:[m("آدرس فروشگاه")]},{default:f(()=>[o(c(ie),{value:n.address,"onUpdate:value":t[8]||(t[8]=e=>n.address=e),rows:3,placeholder:"خیابان، کوچه، پلاک، واحد",autocomplete:"street-address"},null,8,["value"])]),_:1},8,["rules"]),a("div",Ze,[o(T,{icon:"vuesax-linear:shield-tick",size:"18"}),t[14]||(t[14]=a("span",null,"حساب شما پس از بررسی اطلاعات توسط کارشناسان فعال می‌شود.",-1))])]))]),_:1},8,["name"]),a("footer",Ge,[a("div",Xe,[a("button",{type:"submit",class:z(["reg__cta",{"is-loading":h.value}]),disabled:h.value},[h.value?(_(),b("span",Qe)):D("",!0),a("span",null,C(s.value===1?"ادامه":h.value?"در حال ثبت…":"ثبت درخواست"),1),s.value===1?(_(),E(T,{key:1,icon:"vuesax-linear:arrow-left",size:"18"})):D("",!0)],10,Ye),s.value===1?(_(),b("p",et,[t[15]||(t[15]=L(" حساب دارید؟ ",-1)),a("button",{type:"button",onClick:t[9]||(t[9]=e=>u("register",!1))},"وارد شوید")])):D("",!0)])])]),_:1},8,["model"])]),_:1}))]),_:1})])}}}),st=G(tt,[["__scopeId","data-v-609b9316"]]),ct=R({__name:"LoginRegisterView",setup(l){const k=x(!1),u=y=>k.value=y;return(y,r)=>(_(),b(j,null,[k.value?D("",!0):(_(),E(Re,{key:0,onRegister:u})),k.value?(_(),E(st,{key:1,onRegister:u})):D("",!0)],64))}});export{ct as default};