1 line
3.8 KiB
JavaScript
1 line
3.8 KiB
JavaScript
import{nt as e}from"./_plugin-vue_export-helper-1xMDlcEE.js";import{n as t}from"./pinia-BK9B9Wwf.js";import{n,t as r}from"./http-CU_N-R2R.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,t){try{return await n(e,t)}catch(e){throw e instanceof r&&(e.status===404||e.status===501)?new r(e.status,s):e}}async function l(){try{return await n(`/catalog/categories`)}catch{try{return await n(`/products/meta/categories`)}catch{return o()}}}async function u(e){return n(`/products`,{query:{activeOnly:!0,categoryId:e?.categoryId,season:e?.season,catalogId:e?.catalogId,companyId:e?.companyId}})}async function d(e){return n(`/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,t){return c(`/agent/customers/${e}`,{method:`PATCH`,body:t})}async function g(e){return c(`/agent/customers/${e}`)}async function _(e){return c(`/agent/meetings`,{method:`POST`,body:e})}async function v(e){return c(`/agent/reminders`,{query:{filter:e}})}async function y(e){return c(`/agent/reminders/${e}`)}async function b(e,t=!0){return c(`/agent/reminders/${e}/complete`,{method:`PATCH`,body:{completed:t}})}async function x(e){return c(`/agent/reminders`,{method:`POST`,body:e})}function S(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 C=t(`crm`,()=>{let t=e(!1),r=e(null),i=e(null),a=e([]),o=e([]),s=e([]),c=e([]),d=e([]);async function C(){let e=await l();return s.value=e.usage,c.value=e.seasons,e}async function w(e){let t=await u(e);return d.value=t.map(S),d.value}async function T(e){return S(await n(`/products/${e}`))}async function E(){return i.value=await f(),i.value}async function D(e){return a.value=await p(e),a.value}async function O(e){return await g(e)}async function k(e){return _(e)}async function A(e){return m(e)}async function j(e,t){return h(e,t)}async function M(e){return o.value=await v(e),o.value}async function N(e){return y(e)}async function P(e){return b(e,!0)}async function F(e){return x(e)}return{loading:t,error:r,agentProfile:i,customers:a,reminders:o,usageCategories:s,seasonCategories:c,browseProducts:d,loadCategories:C,loadBrowseProducts:w,loadProductById:T,loadAgentProfile:E,loadCustomers:D,loadCustomerDetail:O,submitMeeting:k,registerCustomer:A,updateCustomer:j,loadReminders:M,loadReminderDetail:N,markReminderComplete:P,createReminder:F}});export{a,v as i,f as n,i as o,d as r,C as t}; |