Files
nademitex_user/dist/assets/ProfileView-DnQpKT74.js
T

1 line
9.0 KiB
JavaScript

import{A as e,Ct as t,Dt as n,E as ee,Et as r,I as te,J as i,L as a,M as o,N as s,O as c,P as l,Q as u,R as d,X as f,_ as ne,ht as p,j as m,n as re,t as h,wt as ie,z as g}from"./BasicIcon-Bnxm-DKk.js";import{o as _,r as ae}from"./format-C72AoJ2H.js";import{O as oe,S as se,c as ce,d as le,o as ue,r as v,s as y,u as b}from"./index-DB4cQnln.js";import{r as x,t as S}from"./constants-DXXK14Zz.js";import{t as C}from"./PageSkeleton-CpZ7eT1v.js";import{n as w,t as T}from"./crm-CZ7XH3z9.js";var E={class:`page profile-page`},D={class:`page__scroll page__scroll--with-nav profile-scroll`},O={class:`hero`},k={class:`hero__pin`},A={class:`hero__top mobile-only`},j=[`aria-label`],M={class:`hero__meta`},N={class:`level-pill`},P={class:`hero__desk-actions desktop-only-flex`},F={class:`profile-sheet`},I={class:`panel`},L={class:`panel__head`},R={class:`panel__period`},z={class:`stats`},B={class:`stat-card`},V={class:`stat-card__text`},H={class:`stat-card__value`},U={class:`stat-card__icon stat-card__icon--orders`},de={class:`stat-card`},fe={class:`stat-card__text`},pe={class:`stat-card__value`},me={class:`stat-card__icon stat-card__icon--customers`},he={class:`stat-card`},ge={class:`stat-card__text`},_e={class:`stat-card__value`},ve={class:`stat-card__icon stat-card__icon--profit`},ye={class:`stat-card`},be={class:`stat-card__text`},xe={class:`stat-card__value`},Se={class:`stat-card__icon stat-card__icon--sales`},Ce={class:`loyalty`},we={class:`loyalty__row`},Te={class:`loyalty__text`},Ee={class:`loyalty__text-next`},De={class:`loyalty__bar`},Oe={class:`quick-section`},ke={class:`quick-grid`},Ae=[`onClick`],je={class:`quick-item__icon`},Me={class:`orders-box`},Ne={class:`section-head`},Pe=[`onClick`,`onKeydown`],Fe={class:`order-row__meta`},Ie={class:`order-row__date`},Le={class:`order-row__title`},Re={key:0,class:`order-row__customer`},ze={class:`price-section`},Be={class:`price-card`},Ve={class:`price-card__body`},He={class:`price-card__info`},W=re(g({__name:`MobileProfilePage`,setup(re){let g={id:`sample-base-price`,name:`پارچه فاستونی ایتالیایی`,code:`DF-1204`,categoryId:``,season:`all_season`,widthCm:160,composition:``,colors:[`1`,`2`,`3`,`4`,`5`,`6`],tags:[],isNew:!1,rollMeters:0,basePrice:38e4},W=ne(),G=ce(),K=le(),Ue=T(),q=b(),J=p(null),Y=p(g),X=p(!1),We=[{label:`ثبت مشتری جدید`,to:`/customers`,icon:`vuesax-linear:add`},{label:`سفارش‌ها`,to:`/orders`,icon:`vuesax-linear:document-text`},{label:`مشتریان من`,to:`/customers`,icon:`vuesax-linear:people`},{label:`گزارش‌ها`,to:`/reminders`,icon:`vuesax-linear:chart-2`},{label:`درخواست کالیته`,to:`/catalog-request`,icon:`vuesax-linear:category`},{label:`قیمت‌گذاری`,to:`/categories`,icon:`vuesax-linear:money-4`}],Ge=e(()=>[...K.orders].sort((e,t)=>String(t.createdAt).localeCompare(String(e.createdAt))).slice(0,3).map(e=>{let t=x[e.status]??`info`,n=t===`danger`||t===`neutral`?`danger`:t===`success`?`success`:t===`warning`?`warning`:`info`;return{id:e.id,title:`سفارش #${e.orderNumber}`,date:e.createdAt?ae(e.createdAt):``,customer:e.companyName||``,statusLabel:S[e.status]||e.status,statusTone:n}})),Z=e(()=>G.fullName||`کاربر`),Q=e(()=>J.value?.code||G.user?.agentCode||`—`),$=e(()=>J.value?.levelLabel||G.user?.levelLabel||`برنزی`),Ke=e(()=>J.value?.nextLevelLabel||G.user?.nextLevelLabel||`نقره‌ای`),qe=e(()=>J.value?.pointsToNext??G.user?.pointsToNext??0),Je=e(()=>J.value?.periodLabel||`۳۰ روز اخیر`),Ye=e(()=>J.value?.customersCount??0),Xe=e(()=>J.value?.ordersCount??K.orders.length),Ze=e(()=>J.value?.salesVolumeToman??0),Qe=e(()=>J.value?.profitToman??0),$e=e(()=>J.value?.levelProgress??G.user?.levelProgress??0),et=e(()=>q.unreadCount>9?`9+`:String(q.unreadCount)),tt=e(()=>Y.value.basePrice??g.basePrice??0);return i(async()=>{X.value=!0;try{q.hydrate();try{J.value=await w()}catch{J.value=null}try{let e=(await Ue.loadBrowseProducts())[0];Y.value=e?{...g,...e,basePrice:e.basePrice??g.basePrice}:g}catch{Y.value=g}K.orders.length||await K.hydrate()}finally{X.value=!1}}),(e,i)=>(f(),l(`div`,E,[m(`div`,D,[m(`header`,O,[m(`div`,k,[m(`div`,A,[m(`button`,{type:`button`,class:`icon-btn`,"aria-label":`تنظیمات`,onClick:i[0]||=e=>t(W).push(`/profile/display`)},[d(se,{size:20,color:`#ffffff`})]),i[5]||=m(`h1`,null,`پروفایل من`,-1),m(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اعلان‌ها`,onClick:i[1]||=e=>t(W).push(`/profile/notifications`)},[d(y,{size:20,color:`#ffffff`}),t(q).hasUnread?(f(),l(`span`,{key:0,class:`icon-btn__badge`,"aria-label":`${t(q).unreadCount} اعلان خوانده‌نشده`},n(et.value),9,j)):s(``,!0)])]),d(v,{class:`hero__avatar`,src:t(G).user?.avatarUrl,initials:Z.value.charAt(0),size:84},null,8,[`src`,`initials`])]),m(`div`,M,[m(`h2`,null,n(Z.value),1),m(`p`,null,`کد واسطه: `+n(Q.value),1),m(`span`,N,[i[6]||=m(`svg`,{class:`level-pill__crown`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[m(`path`,{fill:`currentColor`,d:`M3.5 17.5h17l-1.2-8.2a1 1 0 0 0-1.5-.7L14 11l-2.5-5.2a1 1 0 0 0-1.8 0L7.2 11 4.2 8.6a1 1 0 0 0-1.5.7L3.5 17.5Zm1.7 1.5h13.6v1.2H5.2V19Z`})],-1),a(` سطح: `+n($.value),1)])]),m(`div`,P,[m(`button`,{type:`button`,class:`hero__desk-btn`,onClick:i[2]||=e=>t(W).push(`/profile/edit`)},` ویرایش اطلاعات `)])]),m(`div`,F,[X.value?(f(),o(C,{key:0,variant:`profile`})):(f(),l(c,{key:1},[m(`section`,I,[m(`div`,L,[i[7]||=m(`h3`,null,`خلاصه عملکرد`,-1),m(`span`,R,[a(n(Je.value)+` `,1),d(h,{icon:`vuesax-linear:arrow-down`,size:14,"stroke-width":1.5})])]),m(`div`,z,[m(`div`,B,[m(`div`,V,[i[8]||=m(`span`,{class:`stat-card__label`},`سفارش‌ها`,-1),m(`strong`,H,n(t(_)(Xe.value)),1),i[9]||=m(`em`,{class:`stat-card__hint`},`سفارش`,-1)]),m(`span`,U,[d(oe,{size:18})])]),m(`div`,de,[m(`div`,fe,[i[10]||=m(`span`,{class:`stat-card__label`},`مشتریان من`,-1),m(`strong`,pe,n(t(_)(Ye.value)),1),i[11]||=m(`em`,{class:`stat-card__hint`},`مشتری فعال`,-1)]),m(`span`,me,[d(h,{icon:`vuesax-linear:people`,size:18,"stroke-width":1.5})])]),m(`div`,he,[m(`div`,ge,[i[12]||=m(`span`,{class:`stat-card__label`},`سود شما (ریال)`,-1),m(`strong`,_e,n(t(_)(Qe.value)),1),i[13]||=m(`em`,{class:`stat-card__hint`},`تومان`,-1)]),m(`span`,ve,[d(h,{icon:`vuesax-linear:chart-2`,size:18,"stroke-width":1.5})])]),m(`div`,ye,[m(`div`,be,[i[14]||=m(`span`,{class:`stat-card__label`},`حجم فروش (ریال)`,-1),m(`strong`,xe,n(t(_)(Ze.value)),1),i[15]||=m(`em`,{class:`stat-card__hint`},`تومان`,-1)]),m(`span`,Se,[d(h,{icon:`vuesax-linear:wallet`,size:18,"stroke-width":1.5})])])])]),m(`section`,Ce,[m(`div`,we,[i[16]||=te(`<div class="loyalty__crown" aria-hidden="true" data-v-febed116><svg viewBox="0 0 48 48" width="40" height="40" data-v-febed116><path fill="#E0C35A" d="M8 34h32l-2.4-16.2a2 2 0 0 0-3-.1L28 24l-4.8-10a2 2 0 0 0-3.6 0L14.8 24 9.4 17.7a2 2 0 0 0-3.1.1L8 34Z" data-v-febed116></path><path fill="#C9A227" d="M10 36h28v3H10z" data-v-febed116></path><circle cx="24" cy="28" r="3" fill="#F7E7A1" data-v-febed116></circle></svg></div>`,1),m(`p`,Te,[m(`span`,null,`شما در سطح `+n($.value)+` قرار دارید.`,1),m(`span`,Ee,` تا سطح `+n(Ke.value)+` فقط `+n(t(_)(qe.value))+` تومان فروش دیگر نیاز دارید. `,1)])]),m(`div`,De,[m(`span`,{style:r({width:`${Math.min(100,Math.max(0,$e.value))}%`})},null,4)])]),m(`section`,Oe,[i[17]||=m(`h3`,{class:`section-title`},`دسترسی سریع`,-1),m(`div`,ke,[(f(),l(c,null,u(We,e=>m(`button`,{key:e.label,type:`button`,class:`quick-item`,onClick:n=>t(W).push(e.to)},[m(`span`,je,[d(h,{icon:e.icon,size:22,"stroke-width":1.5},null,8,[`icon`])]),a(` `+n(e.label),1)],8,Ae)),64))])]),m(`section`,Me,[m(`div`,Ne,[i[18]||=m(`h3`,null,`آخرین سفارش‌ها`,-1),m(`button`,{type:`button`,class:`link`,onClick:i[3]||=e=>t(W).push(`/orders`)},`مشاهده همه`)]),(f(!0),l(c,null,u(Ge.value,e=>(f(),l(`article`,{key:e.id,class:`order-row`,role:`button`,tabindex:`0`,onClick:n=>t(W).push({path:`/order`,query:{id:e.id}}),onKeydown:ee(n=>t(W).push({path:`/order`,query:{id:e.id}}),[`enter`])},[m(`div`,Fe,[m(`span`,Ie,n(e.date),1),m(`strong`,Le,n(e.title),1),e.customer?(f(),l(`p`,Re,`مشتری: `+n(e.customer),1)):s(``,!0)]),m(`span`,{class:ie([`tone`,`tone--${e.statusTone}`])},n(e.statusLabel),3),d(ue,{size:16,class:`order-row__chevron`})],40,Pe))),128)),m(`button`,{type:`button`,class:`orders-all`,onClick:i[4]||=e=>t(W).push(`/orders`)},` مشاهده همه سفارش‌ها `)]),m(`section`,ze,[i[19]||=m(`h3`,{class:`section-title`},`قیمت‌های پایه (نمونه)`,-1),m(`div`,Be,[m(`div`,Ve,[m(`div`,He,[m(`strong`,null,n(Y.value.name),1),m(`p`,null,`کد: `+n(Y.value.code),1),m(`p`,null,`عرض: `+n(t(_)(Y.value.widthCm))+` سانتی‌متر`,1),m(`p`,null,`رنگ‌ها: `+n(t(_)(Y.value.colors.length))+` رنگ`,1)]),m(`div`,{class:`price-card__image`,style:r(Y.value.imageUrl?{backgroundImage:`url(${Y.value.imageUrl})`}:void 0)},null,4)]),m(`footer`,null,`قیمت پایه به شما: `+n(t(_)(tt.value))+` تومان / متر`,1)])])],64))])])]))}}),[[`__scopeId`,`data-v-febed116`]]),G=g({__name:`ProfileView`,setup(e){return(e,t)=>(f(),o(W))}});export{G as default};