Files
nademitex_user/dist/assets/ProfileView-BEFhPFrR.js
T
2026-09-20 18:10:33 +03:30

1 line
10 KiB
JavaScript

import{D as e,E as t,Et as n,G as r,J as i,Kt as ee,M as a,N as o,O as s,P as c,T as l,Xt as u,Yt as d,Z as f,b as p,g as te,j as ne,t as m,vt as h,w as g}from"./_plugin-vue_export-helper-Bo3WtfwJ.js";import{l as re,t as _}from"./BasicIcon-BXxbbWA_.js";import{o as v,r as ie}from"./format-C72AoJ2H.js";import{O as ae,S as oe,c as se,d as ce,o as le,r as ue,s as y,u as b}from"./index-Bs_brTvG.js";import{r as x,t as S}from"./constants-DXXK14Zz.js";import{t as C}from"./PageSkeleton-DHtB6RUa.js";import{n as w,t as T}from"./crm-Cbr1tRzB.js";import{t as E}from"./IconHeart-Be5RRWq4.js";var D={class:`page profile-page`},O={class:`page__scroll page__scroll--with-nav profile-scroll`},k={class:`hero`},A={class:`hero__pin`},j={class:`hero__top mobile-only`},M=[`aria-label`],N={class:`hero__meta`},P={key:0},F={key:1,class:`level-pill`},I={class:`hero__desk-actions desktop-only-flex`},L={class:`profile-sheet`},R={key:0,class:`panel`},z={class:`panel__head`},B={class:`panel__period`},V={class:`stats`},H={class:`stat-card`},U={class:`stat-card__text`},de={class:`stat-card__value`},fe={class:`stat-card__icon stat-card__icon--orders`},pe={class:`stat-card`},me={class:`stat-card__text`},he={class:`stat-card__value`},ge={class:`stat-card__icon stat-card__icon--customers`},_e={class:`stat-card`},ve={class:`stat-card__text`},ye={class:`stat-card__value`},be={class:`stat-card__icon stat-card__icon--profit`},xe={class:`stat-card`},Se={class:`stat-card__text`},Ce={class:`stat-card__value`},we={class:`stat-card__icon stat-card__icon--sales`},Te={key:1,class:`loyalty`},Ee={class:`loyalty__row`},De={class:`loyalty__text`},Oe={class:`loyalty__text-next`},ke={class:`loyalty__bar`},Ae={class:`quick-section`},je={class:`quick-grid`},Me=[`onClick`],Ne={class:`quick-item__icon`},Pe={class:`orders-box`},Fe={class:`section-head`},Ie=[`onClick`,`onKeydown`],Le={class:`order-row__meta`},Re={class:`order-row__date`},ze={class:`order-row__title`},Be={key:0,class:`order-row__customer`},Ve={class:`price-section`},He={class:`price-card`},Ue={class:`price-card__body`},We={class:`price-card__info`},W=m(c({__name:`MobileProfilePage`,setup(c){let m={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=te(),G=se(),K=ce(),Ge=T(),q=b(),J=h(null),Y=h(m),X=h(!1),Ke=[{id:`add-customer`,label:`ثبت مشتری جدید`,to:`/customers`,icon:`vuesax-linear:add`},{id:`orders`,label:`سفارش‌ها`,to:`/orders`,icon:`vuesax-linear:document-text`},{id:`customers`,label:`مشتریان من`,to:`/customers`,icon:`vuesax-linear:people`},{id:`reports`,label:`گزارش‌ها`,to:`/reminders`,icon:`vuesax-linear:chart-2`},{id:`catalog`,label:`درخواست کالیته`,to:`/categories`,icon:`vuesax-linear:box-1`},{id:`pricing`,label:`قیمت‌گذاری`,to:`/categories`,icon:`vuesax-linear:money-4`}],qe=[{id:`orders`,label:`سفارش‌ها`,to:`/orders`,icon:`vuesax-linear:document-text`},{id:`categories`,label:`دسته‌بندی`,to:`/categories`,icon:`vuesax-linear:element-3`},{id:`products`,label:`محصولات`,to:`/products`,icon:`vuesax-linear:box-search`},{id:`favorites`,label:`علاقه‌مندی‌ها`,to:`/favorites`,useHeart:!0},{id:`order-status`,label:`وضعیت سفارش`,to:`/orders/latest-status`,icon:`vuesax-linear:timer-1`},{id:`catalog`,label:`درخواست کالیته`,to:`/categories`,icon:`vuesax-linear:box-1`}],Je=g(()=>G.isAgent?Ke:qe),Ye=g(()=>[...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?ie(e.createdAt):``,customer:e.companyName||``,statusLabel:S[e.status]||e.status,statusTone:n}})),Z=g(()=>G.fullName||`کاربر`),Q=g(()=>J.value?.code||G.user?.agentCode||`—`),Xe=g(()=>G.isAgent?`کد واسطه`:`کد مشتری`),$=g(()=>J.value?.levelLabel||G.user?.levelLabel||`برنزی`),Ze=g(()=>J.value?.nextLevelLabel||G.user?.nextLevelLabel||`نقره‌ای`),Qe=g(()=>J.value?.pointsToNext??G.user?.pointsToNext??0),$e=g(()=>J.value?.periodLabel||`۳۰ روز اخیر`),et=g(()=>J.value?.customersCount??0),tt=g(()=>J.value?.ordersCount??K.orders.length),nt=g(()=>J.value?.salesVolumeToman??0),rt=g(()=>J.value?.profitToman??0),it=g(()=>J.value?.levelProgress??G.user?.levelProgress??0),at=g(()=>q.unreadCount>9?`9+`:String(q.unreadCount)),ot=g(()=>Y.value.basePrice??m.basePrice??0);return r(async()=>{X.value=!0;try{if(q.hydrate(),G.isAgent)try{J.value=await w()}catch{J.value=null}try{let e=(await Ge.loadBrowseProducts())[0];Y.value=e?{...m,...e,basePrice:e.basePrice??m.basePrice}:m}catch{Y.value=m}K.orders.length||await K.hydrate()}finally{X.value=!1}}),(r,c)=>(i(),s(`div`,D,[l(`div`,O,[l(`header`,k,[l(`div`,A,[l(`div`,j,[l(`button`,{type:`button`,class:`icon-btn`,"aria-label":`تنظیمات`,onClick:c[0]||=e=>n(W).push(`/profile/display`)},[o(oe,{size:20,color:`#ffffff`})]),c[5]||=l(`h1`,null,`پروفایل من`,-1),l(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اعلان‌ها`,onClick:c[1]||=e=>n(W).push(`/profile/notifications`)},[o(y,{size:20,color:`#ffffff`}),n(q).hasUnread?(i(),s(`span`,{key:0,class:`icon-btn__badge`,"aria-label":`${n(q).unreadCount} اعلان خوانده‌نشده`},u(at.value),9,M)):e(``,!0)])]),o(ue,{class:`hero__avatar`,src:n(G).user?.avatarUrl,initials:Z.value.charAt(0),size:84},null,8,[`src`,`initials`])]),l(`div`,N,[l(`h2`,null,u(Z.value),1),n(G).isAgent?(i(),s(`p`,P,u(Xe.value)+`: `+u(Q.value),1)):e(``,!0),n(G).isAgent?(i(),s(`span`,F,[c[6]||=l(`svg`,{class:`level-pill__crown`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[l(`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(` سطح: `+u($.value),1)])):e(``,!0)]),l(`div`,I,[l(`button`,{type:`button`,class:`hero__desk-btn`,onClick:c[2]||=e=>n(W).push(`/profile/edit`)},` ویرایش اطلاعات `)])]),l(`div`,L,[X.value?(i(),t(C,{key:0,variant:`profile`})):(i(),s(p,{key:1},[n(G).isAgent?(i(),s(`section`,R,[l(`div`,z,[c[7]||=l(`h3`,null,`خلاصه عملکرد`,-1),l(`span`,B,[a(u($e.value)+` `,1),o(_,{icon:`vuesax-linear:arrow-down`,size:14,"stroke-width":1.5})])]),l(`div`,V,[l(`div`,H,[l(`div`,U,[c[8]||=l(`span`,{class:`stat-card__label`},`سفارش‌ها`,-1),l(`strong`,de,u(n(v)(tt.value)),1),c[9]||=l(`em`,{class:`stat-card__hint`},`سفارش`,-1)]),l(`span`,fe,[o(ae,{size:18})])]),l(`div`,pe,[l(`div`,me,[c[10]||=l(`span`,{class:`stat-card__label`},`مشتریان من`,-1),l(`strong`,he,u(n(v)(et.value)),1),c[11]||=l(`em`,{class:`stat-card__hint`},`مشتری فعال`,-1)]),l(`span`,ge,[o(_,{icon:`vuesax-linear:people`,size:18,"stroke-width":1.5})])]),l(`div`,_e,[l(`div`,ve,[c[12]||=l(`span`,{class:`stat-card__label`},`سود شما (ریال)`,-1),l(`strong`,ye,u(n(v)(rt.value)),1),c[13]||=l(`em`,{class:`stat-card__hint`},`تومان`,-1)]),l(`span`,be,[o(_,{icon:`vuesax-linear:chart-2`,size:18,"stroke-width":1.5})])]),l(`div`,xe,[l(`div`,Se,[c[14]||=l(`span`,{class:`stat-card__label`},`حجم فروش (ریال)`,-1),l(`strong`,Ce,u(n(v)(nt.value)),1),c[15]||=l(`em`,{class:`stat-card__hint`},`تومان`,-1)]),l(`span`,we,[o(_,{icon:`vuesax-linear:wallet`,size:18,"stroke-width":1.5})])])])])):e(``,!0),n(G).isAgent?(i(),s(`section`,Te,[l(`div`,Ee,[c[16]||=ne(`<div class="loyalty__crown" aria-hidden="true" data-v-ea7c4592><svg viewBox="0 0 48 48" width="40" height="40" data-v-ea7c4592><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-ea7c4592></path><path fill="#C9A227" d="M10 36h28v3H10z" data-v-ea7c4592></path><circle cx="24" cy="28" r="3" fill="#F7E7A1" data-v-ea7c4592></circle></svg></div>`,1),l(`p`,De,[l(`span`,null,`شما در سطح `+u($.value)+` قرار دارید.`,1),l(`span`,Oe,` تا سطح `+u(Ze.value)+` فقط `+u(n(v)(Qe.value))+` تومان فروش دیگر نیاز دارید. `,1)])]),l(`div`,ke,[l(`span`,{style:d({width:`${Math.min(100,Math.max(0,it.value))}%`})},null,4)])])):e(``,!0),l(`section`,Ae,[c[17]||=l(`h3`,{class:`section-title`},`دسترسی سریع`,-1),l(`div`,je,[(i(!0),s(p,null,f(Je.value,r=>(i(),s(`button`,{key:r.id,type:`button`,class:`quick-item`,onClick:e=>n(W).push(r.to)},[l(`span`,Ne,[r.useHeart?(i(),t(E,{key:0,size:22,color:`var(--color-primary)`})):r.icon?(i(),t(_,{key:1,icon:r.icon,size:22,"stroke-width":1.5},null,8,[`icon`])):e(``,!0)]),a(` `+u(r.label),1)],8,Me))),128))])]),l(`section`,Pe,[l(`div`,Fe,[c[18]||=l(`h3`,null,`آخرین سفارش‌ها`,-1),l(`button`,{type:`button`,class:`link`,onClick:c[3]||=e=>n(W).push(`/orders`)},`مشاهده همه`)]),(i(!0),s(p,null,f(Ye.value,t=>(i(),s(`article`,{key:t.id,class:`order-row`,role:`button`,tabindex:`0`,onClick:e=>n(W).push({path:`/order`,query:{id:t.id}}),onKeydown:re(e=>n(W).push({path:`/order`,query:{id:t.id}}),[`enter`])},[l(`div`,Le,[l(`span`,Re,u(t.date),1),l(`strong`,ze,u(t.title),1),t.customer?(i(),s(`p`,Be,`مشتری: `+u(t.customer),1)):e(``,!0)]),l(`span`,{class:ee([`tone`,`tone--${t.statusTone}`])},u(t.statusLabel),3),o(le,{size:16,class:`order-row__chevron`})],40,Ie))),128)),l(`button`,{type:`button`,class:`orders-all`,onClick:c[4]||=e=>n(W).push(`/orders`)},` مشاهده همه سفارش‌ها `)]),l(`section`,Ve,[c[19]||=l(`h3`,{class:`section-title`},`قیمت‌های پایه (نمونه)`,-1),l(`div`,He,[l(`div`,Ue,[l(`div`,We,[l(`strong`,null,u(Y.value.name),1),l(`p`,null,`کد: `+u(Y.value.code),1),l(`p`,null,`عرض: `+u(n(v)(Y.value.widthCm))+` سانتی‌متر`,1),l(`p`,null,`رنگ‌ها: `+u(n(v)(Y.value.colors.length))+` رنگ`,1)]),l(`div`,{class:`price-card__image`,style:d(Y.value.imageUrl?{backgroundImage:`url(${Y.value.imageUrl})`}:void 0)},null,4)]),l(`footer`,null,`قیمت پایه به شما: `+u(n(v)(ot.value))+` تومان / متر`,1)])])],64))])])]))}}),[[`__scopeId`,`data-v-ea7c4592`]]),G=c({__name:`ProfileView`,setup(e){return(e,n)=>(i(),t(W))}});export{G as default};