Files
nademitex_user/dist/assets/crm-CtglbPsN.js
T

1 line
3.6 KiB
JavaScript

import{mt as e}from"./BasicIcon-C6boaehV.js";import{n as t,o as n,t as r}from"./http-BC1hNfZ4.js";var i=[{id:`trousers`,title:`پارچه‌های شلواری`,subtitle:`مشاهده محصولات`},{id:`suit`,title:`پارچه‌های کت‌شلواری`,subtitle:`مشاهده محصولات`},{id:`shirt`,title:`پارچه‌های پیراهنی`,subtitle:`مشاهده محصولات`}],a=[{id:`summer`,title:`تابستانه`,description:`سبک، خنک و مناسب فصل گرم`},{id:`winter`,title:`زمستانه`,description:`گرم و مناسب فصل سرد`},{id:`all_season`,title:`چهارفصل`,description:`مناسب استفاده در بیشتر فصل‌های سال`}];function o(){return{usage:i,seasons:a}}var s=`سرویس واسطه روی سرور فعال نیست. پس از migrate و deploy سرور دوباره تلاش کنید.`;async function c(e,n){try{return await t(e,n)}catch(e){throw e instanceof r&&(e.status===404||e.status===501)?new r(e.status,s):e}}async function l(){try{return await t(`/catalog/categories`)}catch{try{return await t(`/products/meta/categories`)}catch{return o()}}}async function u(e){return t(`/products`,{query:{activeOnly:!0,categoryId:e?.categoryId,season:e?.season,catalogId:e?.catalogId,companyId:e?.companyId}})}async function d(e){return t(`/banners`,{query:{slot:e}})}async function f(){return c(`/agent/profile`)}async function p(e){return c(`/agent/customers`,{query:e})}async function m(e){return c(`/agent/customers`,{method:`POST`,body:e})}async function h(e){return c(`/agent/customers/${e}`)}async function g(e){return c(`/agent/meetings`,{method:`POST`,body:e})}async function _(e){return c(`/agent/reminders`,{query:{filter:e}})}async function v(e){return c(`/agent/reminders/${e}`)}async function y(e,t=!0){return c(`/agent/reminders/${e}/complete`,{method:`PATCH`,body:{completed:t}})}async function b(e){return c(`/agent/reminders`,{method:`POST`,body:e})}function x(e){return{id:e.id,name:e.name,code:e.code,categoryId:e.categoryId||e.usageCategory||`other`,season:e.season||`all_season`,widthCm:e.widthCm??150,composition:e.composition??``,weightGrams:e.weightGrams,weaveType:e.weaveType,colors:e.colors?.length?e.colors:[`#6b7280`],colorImages:e.colorImages,tags:e.tags??[],isNew:!!e.isNew,imageUrl:e.imageUrl||e.colorImages?.find(Boolean)||e.imageUrls?.[0],imageUrls:e.imageUrls,subtitle:e.subtitle,rollMeters:e.rollMeters??50,companyId:e.companyId,catalogId:e.catalogId,catalogCode:e.catalogCode,catalogName:e.catalogName,color:e.color,minMeterage:e.minMeterage??30,orderMultiplier:e.orderMultiplier??10,basePrice:e.basePrice??void 0}}var S=n(`crm`,()=>{let n=e(!1),r=e(null),i=e(null),a=e([]),o=e([]),s=e([]),c=e([]),d=e([]);async function S(){let e=await l();return s.value=e.usage,c.value=e.seasons,e}async function C(e){let t=await u(e);return d.value=t.map(x),d.value}async function w(e){return x(await t(`/products/${e}`))}async function T(){return i.value=await f(),i.value}async function E(e){return a.value=await p(e),a.value}async function D(e){return await h(e)}async function O(e){return g(e)}async function k(e){return m(e)}async function A(e){return o.value=await _(e),o.value}async function j(e){return v(e)}async function M(e){return y(e,!0)}async function N(e){return b(e)}return{loading:n,error:r,agentProfile:i,customers:a,reminders:o,usageCategories:s,seasonCategories:c,browseProducts:d,loadCategories:S,loadBrowseProducts:C,loadProductById:w,loadAgentProfile:T,loadCustomers:E,loadCustomerDetail:D,submitMeeting:O,registerCustomer:k,loadReminders:A,loadReminderDetail:j,markReminderComplete:M,createReminder:N}});export{i as a,a as i,f as n,d as r,S as t};