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

1 line
10 KiB
JavaScript

import{At as e,F as t,M as n,Nt as r,Pt as i,_ as a,c as o,d as s,f as c,g as l,h as ee,i as u,k as d,l as f,nt as p,t as te,u as m,ut as h,v as g}from"./_plugin-vue_export-helper-1xMDlcEE.js";import{l as ne,t as _}from"./BasicIcon-Bzeb0Iwd.js";import{o as v,r as re}from"./format-C72AoJ2H.js";import{M as ie,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-3Kv0ngks.js";import{r as x,t as S}from"./constants-DXXK14Zz.js";import{t as C}from"./PageSkeleton-DYdjm4l9.js";import{n as w,t as T}from"./crm-DoYzOa8A.js";import{t as E}from"./IconHeart-CvzbNH_T.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=te(g({__name:`MobileProfilePage`,setup(te){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=ie(),G=se(),K=ce(),Ge=T(),q=b(),J=p(null),Y=p(g),X=p(!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=o(()=>G.isAgent?Ke:qe),Ye=o(()=>[...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?re(e.createdAt):``,customer:e.companyName||``,statusLabel:S[e.status]||e.status,statusTone:n}})),Z=o(()=>G.fullName||`کاربر`),Q=o(()=>J.value?.code||G.user?.agentCode||`—`),Xe=o(()=>G.isAgent?`کد واسطه`:`کد مشتری`),$=o(()=>J.value?.levelLabel||G.user?.levelLabel||`برنزی`),Ze=o(()=>J.value?.nextLevelLabel||G.user?.nextLevelLabel||`نقره‌ای`),Qe=o(()=>J.value?.pointsToNext??G.user?.pointsToNext??0),$e=o(()=>J.value?.periodLabel||`۳۰ روز اخیر`),et=o(()=>J.value?.customersCount??0),tt=o(()=>J.value?.ordersCount??K.orders.length),nt=o(()=>J.value?.salesVolumeToman??0),rt=o(()=>J.value?.profitToman??0),it=o(()=>J.value?.levelProgress??G.user?.levelProgress??0),at=o(()=>q.unreadCount>9?`9+`:String(q.unreadCount)),ot=o(()=>Y.value.basePrice??g.basePrice??0);return d(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?{...g,...e,basePrice:e.basePrice??g.basePrice}:g}catch{Y.value=g}K.orders.length||await K.hydrate()}finally{X.value=!1}}),(o,d)=>(n(),c(`div`,D,[f(`div`,O,[f(`header`,k,[f(`div`,A,[f(`div`,j,[f(`button`,{type:`button`,class:`icon-btn`,"aria-label":`تنظیمات`,onClick:d[0]||=e=>h(W).push(`/profile/display`)},[a(oe,{size:20,color:`#ffffff`})]),d[5]||=f(`h1`,null,`پروفایل من`,-1),f(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اعلان‌ها`,onClick:d[1]||=e=>h(W).push(`/profile/notifications`)},[a(y,{size:20,color:`#ffffff`}),h(q).hasUnread?(n(),c(`span`,{key:0,class:`icon-btn__badge`,"aria-label":`${h(q).unreadCount} اعلان خوانده‌نشده`},i(at.value),9,M)):s(``,!0)])]),a(ue,{class:`hero__avatar`,src:h(G).user?.avatarUrl,initials:Z.value.charAt(0),size:84},null,8,[`src`,`initials`])]),f(`div`,N,[f(`h2`,null,i(Z.value),1),h(G).isAgent?(n(),c(`p`,P,i(Xe.value)+`: `+i(Q.value),1)):s(``,!0),h(G).isAgent?(n(),c(`span`,F,[d[6]||=f(`svg`,{class:`level-pill__crown`,viewBox:`0 0 24 24`,"aria-hidden":`true`},[f(`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),l(` سطح: `+i($.value),1)])):s(``,!0)]),f(`div`,I,[f(`button`,{type:`button`,class:`hero__desk-btn`,onClick:d[2]||=e=>h(W).push(`/profile/edit`)},` ویرایش اطلاعات `)])]),f(`div`,L,[X.value?(n(),m(C,{key:0,variant:`profile`})):(n(),c(u,{key:1},[h(G).isAgent?(n(),c(`section`,R,[f(`div`,z,[d[7]||=f(`h3`,null,`خلاصه عملکرد`,-1),f(`span`,B,[l(i($e.value)+` `,1),a(_,{icon:`vuesax-linear:arrow-down`,size:14,"stroke-width":1.5})])]),f(`div`,V,[f(`div`,H,[f(`div`,U,[d[8]||=f(`span`,{class:`stat-card__label`},`سفارش‌ها`,-1),f(`strong`,de,i(h(v)(tt.value)),1),d[9]||=f(`em`,{class:`stat-card__hint`},`سفارش`,-1)]),f(`span`,fe,[a(ae,{size:18})])]),f(`div`,pe,[f(`div`,me,[d[10]||=f(`span`,{class:`stat-card__label`},`مشتریان من`,-1),f(`strong`,he,i(h(v)(et.value)),1),d[11]||=f(`em`,{class:`stat-card__hint`},`مشتری فعال`,-1)]),f(`span`,ge,[a(_,{icon:`vuesax-linear:people`,size:18,"stroke-width":1.5})])]),f(`div`,_e,[f(`div`,ve,[d[12]||=f(`span`,{class:`stat-card__label`},`سود شما (ریال)`,-1),f(`strong`,ye,i(h(v)(rt.value)),1),d[13]||=f(`em`,{class:`stat-card__hint`},`تومان`,-1)]),f(`span`,be,[a(_,{icon:`vuesax-linear:chart-2`,size:18,"stroke-width":1.5})])]),f(`div`,xe,[f(`div`,Se,[d[14]||=f(`span`,{class:`stat-card__label`},`حجم فروش (ریال)`,-1),f(`strong`,Ce,i(h(v)(nt.value)),1),d[15]||=f(`em`,{class:`stat-card__hint`},`تومان`,-1)]),f(`span`,we,[a(_,{icon:`vuesax-linear:wallet`,size:18,"stroke-width":1.5})])])])])):s(``,!0),h(G).isAgent?(n(),c(`section`,Te,[f(`div`,Ee,[d[16]||=ee(`<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),f(`p`,De,[f(`span`,null,`شما در سطح `+i($.value)+` قرار دارید.`,1),f(`span`,Oe,` تا سطح `+i(Ze.value)+` فقط `+i(h(v)(Qe.value))+` تومان فروش دیگر نیاز دارید. `,1)])]),f(`div`,ke,[f(`span`,{style:r({width:`${Math.min(100,Math.max(0,it.value))}%`})},null,4)])])):s(``,!0),f(`section`,Ae,[d[17]||=f(`h3`,{class:`section-title`},`دسترسی سریع`,-1),f(`div`,je,[(n(!0),c(u,null,t(Je.value,e=>(n(),c(`button`,{key:e.id,type:`button`,class:`quick-item`,onClick:t=>h(W).push(e.to)},[f(`span`,Ne,[e.useHeart?(n(),m(E,{key:0,size:22,color:`var(--color-primary)`})):e.icon?(n(),m(_,{key:1,icon:e.icon,size:22,"stroke-width":1.5},null,8,[`icon`])):s(``,!0)]),l(` `+i(e.label),1)],8,Me))),128))])]),f(`section`,Pe,[f(`div`,Fe,[d[18]||=f(`h3`,null,`آخرین سفارش‌ها`,-1),f(`button`,{type:`button`,class:`link`,onClick:d[3]||=e=>h(W).push(`/orders`)},`مشاهده همه`)]),(n(!0),c(u,null,t(Ye.value,t=>(n(),c(`article`,{key:t.id,class:`order-row`,role:`button`,tabindex:`0`,onClick:e=>h(W).push({path:`/order`,query:{id:t.id}}),onKeydown:ne(e=>h(W).push({path:`/order`,query:{id:t.id}}),[`enter`])},[f(`div`,Le,[f(`span`,Re,i(t.date),1),f(`strong`,ze,i(t.title),1),t.customer?(n(),c(`p`,Be,`مشتری: `+i(t.customer),1)):s(``,!0)]),f(`span`,{class:e([`tone`,`tone--${t.statusTone}`])},i(t.statusLabel),3),a(le,{size:16,class:`order-row__chevron`})],40,Ie))),128)),f(`button`,{type:`button`,class:`orders-all`,onClick:d[4]||=e=>h(W).push(`/orders`)},` مشاهده همه سفارش‌ها `)]),f(`section`,Ve,[d[19]||=f(`h3`,{class:`section-title`},`قیمت‌های پایه (نمونه)`,-1),f(`div`,He,[f(`div`,Ue,[f(`div`,We,[f(`strong`,null,i(Y.value.name),1),f(`p`,null,`کد: `+i(Y.value.code),1),f(`p`,null,`عرض: `+i(h(v)(Y.value.widthCm))+` سانتی‌متر`,1),f(`p`,null,`رنگ‌ها: `+i(h(v)(Y.value.colors.length))+` رنگ`,1)]),f(`div`,{class:`price-card__image`,style:r(Y.value.imageUrl?{backgroundImage:`url(${Y.value.imageUrl})`}:void 0)},null,4)]),f(`footer`,null,`قیمت پایه به شما: `+i(h(v)(ot.value))+` تومان / متر`,1)])])],64))])])]))}}),[[`__scopeId`,`data-v-ea7c4592`]]),G=g({__name:`ProfileView`,setup(e){return(e,t)=>(n(),m(W))}});export{G as default};