Files
nademitex_user/dist/assets/crm-CooNUbmr.js
T
mohmdsdgandCopilot adb6ca47cd fix(auth): secure sessions and app routing
Validate sessions against the API, honor configurable base paths, and route unknown pages to 404. Keep development ports stable so user and admin apps cannot be confused.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-24 20:14:11 +03:30

1 line
3.7 KiB
JavaScript

import{vt as e}from"./_plugin-vue_export-helper-Bo3WtfwJ.js";import{n as t,o as n,t as r}from"./http-CeONvUNq.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,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=n(`crm`,()=>{let n=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 t(`/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:n,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};