ptechcore_ui 1.0.69 → 1.0.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -142,8 +142,10 @@ __export(index_exports, {
142
142
  SelectClient: () => SelectClient,
143
143
  SelectCostCenter: () => SelectCostCenter,
144
144
  SelectCountry: () => SelectCountry,
145
+ SelectDas: () => SelectDas,
145
146
  SelectDepartment: () => SelectDepartment,
146
147
  SelectInput: () => SelectInput,
148
+ SelectLeadNeed: () => SelectLeadNeed,
147
149
  SelectLegalForm: () => SelectLegalForm,
148
150
  SelectUnit: () => SelectUnit,
149
151
  SelectUser: () => SelectUser,
@@ -5352,6 +5354,26 @@ var CostServices = {
5352
5354
  };
5353
5355
  var PROFIT_URI = `${API_URL}/accounting/profit-center/`;
5354
5356
 
5357
+ // src/services/CrmServices.ts
5358
+ var TARGET_RETAILER_URI = `${API_URL}/crm/target-retailers/`;
5359
+ var DAS_URI = `${API_URL}/crm/das/`;
5360
+ var DasServices = {
5361
+ create: (data) => FetchApi.post(`${DAS_URI}`, data),
5362
+ get: (id) => FetchApi.get(`${DAS_URI}${id}/`),
5363
+ list: (params) => FetchApi.get(`${DAS_URI}?${new URLSearchParams(params).toString()}`),
5364
+ update: (id, data) => FetchApi.put(`${DAS_URI}${id}/`, data),
5365
+ delete: (id) => FetchApi.delete(`${DAS_URI}${id}/`)
5366
+ };
5367
+ var OTHER_COST_URI = `${API_URL}/crm/other-costs/`;
5368
+ var LEAD_NEED_URI = `${API_URL}/crm/lead-needs/`;
5369
+ var LeadNeedServices = {
5370
+ create: (data) => FetchApi.post(`${LEAD_NEED_URI}`, data),
5371
+ get: (id) => FetchApi.get(`${LEAD_NEED_URI}${id}/`),
5372
+ list: (params) => FetchApi.get(`${LEAD_NEED_URI}?${new URLSearchParams(params).toString()}`),
5373
+ update: (id, data) => FetchApi.put(`${LEAD_NEED_URI}${id}/`, data),
5374
+ delete: (id) => FetchApi.delete(`${LEAD_NEED_URI}${id}/`)
5375
+ };
5376
+
5355
5377
  // src/components/common/CommonSelect.tsx
5356
5378
  var import_jsx_runtime16 = require("react/jsx-runtime");
5357
5379
  var SelectVendor = ({
@@ -6340,6 +6362,148 @@ var SelectClient = ({
6340
6362
  loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des clients..." })
6341
6363
  ] });
6342
6364
  };
6365
+ var SelectDas = ({
6366
+ value,
6367
+ onSelect,
6368
+ allowClear,
6369
+ onRemove,
6370
+ label = "S\xE9lectionner un DAS"
6371
+ }) => {
6372
+ const { token, activeBusinessEntity } = useSession();
6373
+ const [dasList, setDasList] = (0, import_react10.useState)(() => {
6374
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6375
+ const cached = sessionStorage.getItem(cacheKey);
6376
+ return cached ? JSON.parse(cached) : [];
6377
+ });
6378
+ const [loading, setLoading] = (0, import_react10.useState)(false);
6379
+ (0, import_react10.useEffect)(() => {
6380
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6381
+ const cached = sessionStorage.getItem(cacheKey);
6382
+ if (!cached) {
6383
+ loadDas();
6384
+ } else {
6385
+ setDasList(JSON.parse(cached));
6386
+ }
6387
+ }, [activeBusinessEntity?.id]);
6388
+ const getDasOptions = () => {
6389
+ return dasList.filter((das) => das.id !== void 0).map((das) => ({
6390
+ value: das.id,
6391
+ label: `${das.code_das ? `[${das.code_das}] ` : ""}${das.name || "Sans nom"}`,
6392
+ object: das
6393
+ }));
6394
+ };
6395
+ const loadDas = async () => {
6396
+ if (!token) return;
6397
+ try {
6398
+ setLoading(true);
6399
+ const result = await DasServices.list({ business_entity_id: activeBusinessEntity?.id });
6400
+ if (result.data) {
6401
+ setDasList(result.data);
6402
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6403
+ sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
6404
+ }
6405
+ } catch (error) {
6406
+ console.error(error);
6407
+ } finally {
6408
+ setLoading(false);
6409
+ }
6410
+ };
6411
+ const handleRefresh = () => {
6412
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6413
+ sessionStorage.removeItem(cacheKey);
6414
+ loadDas();
6415
+ };
6416
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
6417
+ label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
6418
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6419
+ SearchableSelect,
6420
+ {
6421
+ value,
6422
+ options: getDasOptions(),
6423
+ placeholder: "S\xE9lectionner un DAS...",
6424
+ searchPlaceholder: "Rechercher...",
6425
+ onSelect,
6426
+ disabled: loading,
6427
+ refresh: handleRefresh,
6428
+ allowClear,
6429
+ onRemove
6430
+ },
6431
+ "das" + value
6432
+ ),
6433
+ loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des DAS..." })
6434
+ ] });
6435
+ };
6436
+ var SelectLeadNeed = ({
6437
+ value,
6438
+ onSelect,
6439
+ allowClear,
6440
+ onRemove,
6441
+ label = "S\xE9lectionner un besoin"
6442
+ }) => {
6443
+ const { token, activeBusinessEntity } = useSession();
6444
+ const [leadNeeds, setLeadNeeds] = (0, import_react10.useState)(() => {
6445
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6446
+ const cached = sessionStorage.getItem(cacheKey);
6447
+ return cached ? JSON.parse(cached) : [];
6448
+ });
6449
+ const [loading, setLoading] = (0, import_react10.useState)(false);
6450
+ (0, import_react10.useEffect)(() => {
6451
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6452
+ const cached = sessionStorage.getItem(cacheKey);
6453
+ if (!cached) {
6454
+ loadLeadNeeds();
6455
+ } else {
6456
+ setLeadNeeds(JSON.parse(cached));
6457
+ }
6458
+ }, [activeBusinessEntity?.id]);
6459
+ const getLeadNeedOptions = () => {
6460
+ return leadNeeds.filter((leadNeed) => leadNeed.id !== void 0).map((leadNeed) => ({
6461
+ value: leadNeed.id,
6462
+ label: `${leadNeed.name || "Sans nom"}${leadNeed.type ? ` (${leadNeed.type})` : ""}`,
6463
+ object: leadNeed
6464
+ }));
6465
+ };
6466
+ const loadLeadNeeds = async () => {
6467
+ if (!token) return;
6468
+ try {
6469
+ setLoading(true);
6470
+ const result = await LeadNeedServices.list({ business_entity_id: activeBusinessEntity?.id });
6471
+ if (result.data) {
6472
+ setLeadNeeds(result.data);
6473
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6474
+ sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
6475
+ }
6476
+ } catch (error) {
6477
+ console.error(error);
6478
+ } finally {
6479
+ setLoading(false);
6480
+ }
6481
+ };
6482
+ const handleRefresh = () => {
6483
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6484
+ sessionStorage.removeItem(cacheKey);
6485
+ loadLeadNeeds();
6486
+ };
6487
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
6488
+ label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
6489
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6490
+ SearchableSelect,
6491
+ {
6492
+ value,
6493
+ options: getLeadNeedOptions(),
6494
+ placeholder: "S\xE9lectionner un besoin...",
6495
+ searchPlaceholder: "Rechercher...",
6496
+ onSelect,
6497
+ disabled: loading,
6498
+ refresh: handleRefresh,
6499
+ allowClear,
6500
+ onRemove
6501
+ },
6502
+ "leadneed" + value
6503
+ ),
6504
+ loading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des besoins..." })
6505
+ ] });
6506
+ };
6343
6507
 
6344
6508
  // src/components/common/FileManager/FileManager.tsx
6345
6509
  var import_react17 = require("react");
@@ -19430,14 +19594,6 @@ var import_jsx_runtime84 = require("react/jsx-runtime");
19430
19594
  // src/pages/parameters/CrmParametersPage.tsx
19431
19595
  var import_react66 = require("react");
19432
19596
  var import_lucide_react62 = require("lucide-react");
19433
-
19434
- // src/services/CrmServices.ts
19435
- var TARGET_RETAILER_URI = `${API_URL}/crm/target-retailers/`;
19436
- var DAS_URI = `${API_URL}/crm/das/`;
19437
- var OTHER_COST_URI = `${API_URL}/crm/other-costs/`;
19438
- var LEAD_NEED_URI = `${API_URL}/crm/lead-needs/`;
19439
-
19440
- // src/pages/parameters/CrmParametersPage.tsx
19441
19597
  var import_jsx_runtime85 = require("react/jsx-runtime");
19442
19598
 
19443
19599
  // src/pages/parameters/email-template-editor/EmailTemplateEditorPage.tsx
@@ -33877,8 +34033,10 @@ var PriceScheduleServices = {
33877
34033
  SelectClient,
33878
34034
  SelectCostCenter,
33879
34035
  SelectCountry,
34036
+ SelectDas,
33880
34037
  SelectDepartment,
33881
34038
  SelectInput,
34039
+ SelectLeadNeed,
33882
34040
  SelectLegalForm,
33883
34041
  SelectUnit,
33884
34042
  SelectUser,
package/dist/index.d.cts CHANGED
@@ -1062,6 +1062,8 @@ declare const SelectAccount: React.FC<SelectAccountProps>;
1062
1062
  declare const SelectCountry: React.FC<SelectProps$1>;
1063
1063
  declare const SelectLegalForm: React.FC<SelectProps$1>;
1064
1064
  declare const SelectClient: React.FC<SelectProps$1>;
1065
+ declare const SelectDas: React.FC<SelectProps$1>;
1066
+ declare const SelectLeadNeed: React.FC<SelectProps$1>;
1065
1067
 
1066
1068
  interface SelectProps {
1067
1069
  value?: any;
@@ -3492,4 +3494,4 @@ declare function VariablePanel({ categories }: VariablePanelProps): react_jsx_ru
3492
3494
 
3493
3495
  declare const DEFAULT_VARIABLE_CATEGORIES: VariableCategory[];
3494
3496
 
3495
- export { ACCOUNT_TYPE_LABELS, API_URL, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, AddSLAEvaluationModal, AddSLAIndicatorModal, type AddSupplierPricePayload, Alert, AlertProvider, AlertsManagementModal, type ApiResponse, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AttachmentUploader, type AttachmentUploaderProps, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, Badge, type BalanceType, Breadcrumb, BudgetPage, type BulkEvaluationItem, BulkSLAEvaluationModal, CHOICES, CONTRACT_NOTE_TYPE_OPTIONS, CONTRACT_STATUS_OPTIONS, CONTRACT_TYPE_OPTIONS, CURRENCY_OPTIONS, CardBody, CardHeader, type CatalogueProduct, type CatalogueProductListItem, type CatalogueProductListResponse, CatalogueProductSelector, CatalogueProductServices, type CatalogueSupplierPrice, type CatalogueSupplierPriceListResponse, CatalogueSupplierPriceServices, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, ContextMenu, type ContextMenuAction, type ContextMenuPosition, type Contract$1 as Contract, ContractForm, type ContractListResponse, ContractModal, type ContractNote, type ContractNoteType, ContractReportsModal, ContractServices, type ContractStatus, type ContractType, ContractsPage, CountrySelector, type CreateBulkEvaluationPayload, type CreateCatalogueProductPayload, type CreateContractNotePayload, type CreateContractPayload, type CreatePriceScheduleItemPayload, type CreateSLAEvaluationPayload, type CreateSLAIndicatorPayload, CrmWorkspace, DEFAULT_VARIABLE_CATEGORIES, DURATION_UNIT_OPTIONS, DataTable, DateInput, DocumentFooter, DocumentHeader, type DocumentType, type DurationUnit, EmailTemplateEditor, type EmailTemplateEditorProps, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, type FMServiceType, type FMSite, FM_SERVICE_LABELS, FM_SLA_TEMPLATES, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileCard, FileGrid, FileInput, type FileItem, FileList, FileManager, type FileManagerContextValue, type FileManagerProps, FileManagerProvider, type FileManagerTexts, FolderTree, ForeignCurrencySelector, FormClient, FormPurchaseRequest, FormVendor, type FromModule, HRConnectPage, type HomologationConfig, HomologationConfigServices, type HomologationRejectionPayload, type HomologationRequestPayload, type HomologationStatus, HtmlExportPanel, INCOTERM_OPTIONS, type Incoterm, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MEASUREMENT_FREQUENCY_OPTIONS, type MeasurementFrequency, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, type PriceScheduleItem, type PriceScheduleItemListResponse, PriceScheduleServices, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, type ProductDocument, ProductDocumentServices, type ProductNote, ProductNoteServices, type ProductSpecification, type ProductStatus, type ProductType, type PurchaseRequest, type PurchaseRequestItem, PurchaseRequestServices, type PurchaseRequestStatus, PurchaseRequestsPage, PurchaseWorkspace, RISK_LEVEL_OPTIONS, type RecentActivity, RewiseBasicCard, RewiseCard, RewiseLayout, type RiskLevel, RootFileManager, type SLACategory, type SLADashboard, type SLAEvaluation, SLAEvaluationForm, type SLAEvaluationListResponse, SLAEvaluationServices, type SLAEvaluationSession, type SLAEvaluationSessionListResponse, SLAEvaluationSessionServices, type SLAIndicator, SLAIndicatorForm, type SLAIndicatorListResponse, SLAIndicatorServices, SLAManagementModal, type SLAStatus, type SLATemplate, SLA_CATEGORY_OPTIONS, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectCountry, SelectDepartment, SelectInput, SelectLegalForm, SelectUnit, SelectUser, SelectVendor, type SelectedProductLine, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, type TEditorConfiguration, type Tab, Tabs, type TabsProps, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TemplatePreview, type TemplateVariable, TextInput, type Theme, type ThemeColors, type ThemeContextValue, ThemeProvider, type ThemeType, ToastContainer, ToastProvider, Toolbar, TotalsSection, type Unit, UnitServices, type UpdateCatalogueProductPayload, type UpdateContractPayload, type UrgencyLevel, type UseFileManagerApiReturn, type User$1 as User, UserServices, type VariableCategory, VariablePanel, type Vendor, type VendorListResponse, VendorServices, ViewContractContent, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, defaultTheme, exportToHtml, fileManagerApi, findFolderById, formatCurrency, formatDate, formatDateFR, formatDateTime, formatFileSize, getAllFolders, getAllSLATemplates, getDefaultSLATemplates, getFileExtension, getFileIcon, getFileIconColor, getMimeTypeFromExtension, getRecommendedPenaltyCap, getSLATemplatesForServices, getThemeCSSVariables, isImageFile, numberToWords, themes, useAlert, useFileManager, useFileManagerApi, usePermissions, useRootFileManagerApi, useSession, useTheme, useToast };
3497
+ export { ACCOUNT_TYPE_LABELS, API_URL, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, AddSLAEvaluationModal, AddSLAIndicatorModal, type AddSupplierPricePayload, Alert, AlertProvider, AlertsManagementModal, type ApiResponse, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AttachmentUploader, type AttachmentUploaderProps, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, Badge, type BalanceType, Breadcrumb, BudgetPage, type BulkEvaluationItem, BulkSLAEvaluationModal, CHOICES, CONTRACT_NOTE_TYPE_OPTIONS, CONTRACT_STATUS_OPTIONS, CONTRACT_TYPE_OPTIONS, CURRENCY_OPTIONS, CardBody, CardHeader, type CatalogueProduct, type CatalogueProductListItem, type CatalogueProductListResponse, CatalogueProductSelector, CatalogueProductServices, type CatalogueSupplierPrice, type CatalogueSupplierPriceListResponse, CatalogueSupplierPriceServices, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, ContextMenu, type ContextMenuAction, type ContextMenuPosition, type Contract$1 as Contract, ContractForm, type ContractListResponse, ContractModal, type ContractNote, type ContractNoteType, ContractReportsModal, ContractServices, type ContractStatus, type ContractType, ContractsPage, CountrySelector, type CreateBulkEvaluationPayload, type CreateCatalogueProductPayload, type CreateContractNotePayload, type CreateContractPayload, type CreatePriceScheduleItemPayload, type CreateSLAEvaluationPayload, type CreateSLAIndicatorPayload, CrmWorkspace, DEFAULT_VARIABLE_CATEGORIES, DURATION_UNIT_OPTIONS, DataTable, DateInput, DocumentFooter, DocumentHeader, type DocumentType, type DurationUnit, EmailTemplateEditor, type EmailTemplateEditorProps, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, type FMServiceType, type FMSite, FM_SERVICE_LABELS, FM_SLA_TEMPLATES, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileCard, FileGrid, FileInput, type FileItem, FileList, FileManager, type FileManagerContextValue, type FileManagerProps, FileManagerProvider, type FileManagerTexts, FolderTree, ForeignCurrencySelector, FormClient, FormPurchaseRequest, FormVendor, type FromModule, HRConnectPage, type HomologationConfig, HomologationConfigServices, type HomologationRejectionPayload, type HomologationRequestPayload, type HomologationStatus, HtmlExportPanel, INCOTERM_OPTIONS, type Incoterm, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MEASUREMENT_FREQUENCY_OPTIONS, type MeasurementFrequency, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, type PriceScheduleItem, type PriceScheduleItemListResponse, PriceScheduleServices, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, type ProductDocument, ProductDocumentServices, type ProductNote, ProductNoteServices, type ProductSpecification, type ProductStatus, type ProductType, type PurchaseRequest, type PurchaseRequestItem, PurchaseRequestServices, type PurchaseRequestStatus, PurchaseRequestsPage, PurchaseWorkspace, RISK_LEVEL_OPTIONS, type RecentActivity, RewiseBasicCard, RewiseCard, RewiseLayout, type RiskLevel, RootFileManager, type SLACategory, type SLADashboard, type SLAEvaluation, SLAEvaluationForm, type SLAEvaluationListResponse, SLAEvaluationServices, type SLAEvaluationSession, type SLAEvaluationSessionListResponse, SLAEvaluationSessionServices, type SLAIndicator, SLAIndicatorForm, type SLAIndicatorListResponse, SLAIndicatorServices, SLAManagementModal, type SLAStatus, type SLATemplate, SLA_CATEGORY_OPTIONS, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectCountry, SelectDas, SelectDepartment, SelectInput, SelectLeadNeed, SelectLegalForm, SelectUnit, SelectUser, SelectVendor, type SelectedProductLine, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, type TEditorConfiguration, type Tab, Tabs, type TabsProps, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TemplatePreview, type TemplateVariable, TextInput, type Theme, type ThemeColors, type ThemeContextValue, ThemeProvider, type ThemeType, ToastContainer, ToastProvider, Toolbar, TotalsSection, type Unit, UnitServices, type UpdateCatalogueProductPayload, type UpdateContractPayload, type UrgencyLevel, type UseFileManagerApiReturn, type User$1 as User, UserServices, type VariableCategory, VariablePanel, type Vendor, type VendorListResponse, VendorServices, ViewContractContent, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, defaultTheme, exportToHtml, fileManagerApi, findFolderById, formatCurrency, formatDate, formatDateFR, formatDateTime, formatFileSize, getAllFolders, getAllSLATemplates, getDefaultSLATemplates, getFileExtension, getFileIcon, getFileIconColor, getMimeTypeFromExtension, getRecommendedPenaltyCap, getSLATemplatesForServices, getThemeCSSVariables, isImageFile, numberToWords, themes, useAlert, useFileManager, useFileManagerApi, usePermissions, useRootFileManagerApi, useSession, useTheme, useToast };
package/dist/index.d.ts CHANGED
@@ -1062,6 +1062,8 @@ declare const SelectAccount: React.FC<SelectAccountProps>;
1062
1062
  declare const SelectCountry: React.FC<SelectProps$1>;
1063
1063
  declare const SelectLegalForm: React.FC<SelectProps$1>;
1064
1064
  declare const SelectClient: React.FC<SelectProps$1>;
1065
+ declare const SelectDas: React.FC<SelectProps$1>;
1066
+ declare const SelectLeadNeed: React.FC<SelectProps$1>;
1065
1067
 
1066
1068
  interface SelectProps {
1067
1069
  value?: any;
@@ -3492,4 +3494,4 @@ declare function VariablePanel({ categories }: VariablePanelProps): react_jsx_ru
3492
3494
 
3493
3495
  declare const DEFAULT_VARIABLE_CATEGORIES: VariableCategory[];
3494
3496
 
3495
- export { ACCOUNT_TYPE_LABELS, API_URL, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, AddSLAEvaluationModal, AddSLAIndicatorModal, type AddSupplierPricePayload, Alert, AlertProvider, AlertsManagementModal, type ApiResponse, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AttachmentUploader, type AttachmentUploaderProps, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, Badge, type BalanceType, Breadcrumb, BudgetPage, type BulkEvaluationItem, BulkSLAEvaluationModal, CHOICES, CONTRACT_NOTE_TYPE_OPTIONS, CONTRACT_STATUS_OPTIONS, CONTRACT_TYPE_OPTIONS, CURRENCY_OPTIONS, CardBody, CardHeader, type CatalogueProduct, type CatalogueProductListItem, type CatalogueProductListResponse, CatalogueProductSelector, CatalogueProductServices, type CatalogueSupplierPrice, type CatalogueSupplierPriceListResponse, CatalogueSupplierPriceServices, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, ContextMenu, type ContextMenuAction, type ContextMenuPosition, type Contract$1 as Contract, ContractForm, type ContractListResponse, ContractModal, type ContractNote, type ContractNoteType, ContractReportsModal, ContractServices, type ContractStatus, type ContractType, ContractsPage, CountrySelector, type CreateBulkEvaluationPayload, type CreateCatalogueProductPayload, type CreateContractNotePayload, type CreateContractPayload, type CreatePriceScheduleItemPayload, type CreateSLAEvaluationPayload, type CreateSLAIndicatorPayload, CrmWorkspace, DEFAULT_VARIABLE_CATEGORIES, DURATION_UNIT_OPTIONS, DataTable, DateInput, DocumentFooter, DocumentHeader, type DocumentType, type DurationUnit, EmailTemplateEditor, type EmailTemplateEditorProps, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, type FMServiceType, type FMSite, FM_SERVICE_LABELS, FM_SLA_TEMPLATES, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileCard, FileGrid, FileInput, type FileItem, FileList, FileManager, type FileManagerContextValue, type FileManagerProps, FileManagerProvider, type FileManagerTexts, FolderTree, ForeignCurrencySelector, FormClient, FormPurchaseRequest, FormVendor, type FromModule, HRConnectPage, type HomologationConfig, HomologationConfigServices, type HomologationRejectionPayload, type HomologationRequestPayload, type HomologationStatus, HtmlExportPanel, INCOTERM_OPTIONS, type Incoterm, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MEASUREMENT_FREQUENCY_OPTIONS, type MeasurementFrequency, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, type PriceScheduleItem, type PriceScheduleItemListResponse, PriceScheduleServices, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, type ProductDocument, ProductDocumentServices, type ProductNote, ProductNoteServices, type ProductSpecification, type ProductStatus, type ProductType, type PurchaseRequest, type PurchaseRequestItem, PurchaseRequestServices, type PurchaseRequestStatus, PurchaseRequestsPage, PurchaseWorkspace, RISK_LEVEL_OPTIONS, type RecentActivity, RewiseBasicCard, RewiseCard, RewiseLayout, type RiskLevel, RootFileManager, type SLACategory, type SLADashboard, type SLAEvaluation, SLAEvaluationForm, type SLAEvaluationListResponse, SLAEvaluationServices, type SLAEvaluationSession, type SLAEvaluationSessionListResponse, SLAEvaluationSessionServices, type SLAIndicator, SLAIndicatorForm, type SLAIndicatorListResponse, SLAIndicatorServices, SLAManagementModal, type SLAStatus, type SLATemplate, SLA_CATEGORY_OPTIONS, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectCountry, SelectDepartment, SelectInput, SelectLegalForm, SelectUnit, SelectUser, SelectVendor, type SelectedProductLine, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, type TEditorConfiguration, type Tab, Tabs, type TabsProps, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TemplatePreview, type TemplateVariable, TextInput, type Theme, type ThemeColors, type ThemeContextValue, ThemeProvider, type ThemeType, ToastContainer, ToastProvider, Toolbar, TotalsSection, type Unit, UnitServices, type UpdateCatalogueProductPayload, type UpdateContractPayload, type UrgencyLevel, type UseFileManagerApiReturn, type User$1 as User, UserServices, type VariableCategory, VariablePanel, type Vendor, type VendorListResponse, VendorServices, ViewContractContent, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, defaultTheme, exportToHtml, fileManagerApi, findFolderById, formatCurrency, formatDate, formatDateFR, formatDateTime, formatFileSize, getAllFolders, getAllSLATemplates, getDefaultSLATemplates, getFileExtension, getFileIcon, getFileIconColor, getMimeTypeFromExtension, getRecommendedPenaltyCap, getSLATemplatesForServices, getThemeCSSVariables, isImageFile, numberToWords, themes, useAlert, useFileManager, useFileManagerApi, usePermissions, useRootFileManagerApi, useSession, useTheme, useToast };
3497
+ export { ACCOUNT_TYPE_LABELS, API_URL, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, AddSLAEvaluationModal, AddSLAIndicatorModal, type AddSupplierPricePayload, Alert, AlertProvider, AlertsManagementModal, type ApiResponse, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AttachmentUploader, type AttachmentUploaderProps, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, Badge, type BalanceType, Breadcrumb, BudgetPage, type BulkEvaluationItem, BulkSLAEvaluationModal, CHOICES, CONTRACT_NOTE_TYPE_OPTIONS, CONTRACT_STATUS_OPTIONS, CONTRACT_TYPE_OPTIONS, CURRENCY_OPTIONS, CardBody, CardHeader, type CatalogueProduct, type CatalogueProductListItem, type CatalogueProductListResponse, CatalogueProductSelector, CatalogueProductServices, type CatalogueSupplierPrice, type CatalogueSupplierPriceListResponse, CatalogueSupplierPriceServices, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, ContextMenu, type ContextMenuAction, type ContextMenuPosition, type Contract$1 as Contract, ContractForm, type ContractListResponse, ContractModal, type ContractNote, type ContractNoteType, ContractReportsModal, ContractServices, type ContractStatus, type ContractType, ContractsPage, CountrySelector, type CreateBulkEvaluationPayload, type CreateCatalogueProductPayload, type CreateContractNotePayload, type CreateContractPayload, type CreatePriceScheduleItemPayload, type CreateSLAEvaluationPayload, type CreateSLAIndicatorPayload, CrmWorkspace, DEFAULT_VARIABLE_CATEGORIES, DURATION_UNIT_OPTIONS, DataTable, DateInput, DocumentFooter, DocumentHeader, type DocumentType, type DurationUnit, EmailTemplateEditor, type EmailTemplateEditorProps, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, type FMServiceType, type FMSite, FM_SERVICE_LABELS, FM_SLA_TEMPLATES, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileCard, FileGrid, FileInput, type FileItem, FileList, FileManager, type FileManagerContextValue, type FileManagerProps, FileManagerProvider, type FileManagerTexts, FolderTree, ForeignCurrencySelector, FormClient, FormPurchaseRequest, FormVendor, type FromModule, HRConnectPage, type HomologationConfig, HomologationConfigServices, type HomologationRejectionPayload, type HomologationRequestPayload, type HomologationStatus, HtmlExportPanel, INCOTERM_OPTIONS, type Incoterm, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MEASUREMENT_FREQUENCY_OPTIONS, type MeasurementFrequency, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, type PriceScheduleItem, type PriceScheduleItemListResponse, PriceScheduleServices, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, type ProductDocument, ProductDocumentServices, type ProductNote, ProductNoteServices, type ProductSpecification, type ProductStatus, type ProductType, type PurchaseRequest, type PurchaseRequestItem, PurchaseRequestServices, type PurchaseRequestStatus, PurchaseRequestsPage, PurchaseWorkspace, RISK_LEVEL_OPTIONS, type RecentActivity, RewiseBasicCard, RewiseCard, RewiseLayout, type RiskLevel, RootFileManager, type SLACategory, type SLADashboard, type SLAEvaluation, SLAEvaluationForm, type SLAEvaluationListResponse, SLAEvaluationServices, type SLAEvaluationSession, type SLAEvaluationSessionListResponse, SLAEvaluationSessionServices, type SLAIndicator, SLAIndicatorForm, type SLAIndicatorListResponse, SLAIndicatorServices, SLAManagementModal, type SLAStatus, type SLATemplate, SLA_CATEGORY_OPTIONS, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectCountry, SelectDas, SelectDepartment, SelectInput, SelectLeadNeed, SelectLegalForm, SelectUnit, SelectUser, SelectVendor, type SelectedProductLine, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, type TEditorConfiguration, type Tab, Tabs, type TabsProps, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TemplatePreview, type TemplateVariable, TextInput, type Theme, type ThemeColors, type ThemeContextValue, ThemeProvider, type ThemeType, ToastContainer, ToastProvider, Toolbar, TotalsSection, type Unit, UnitServices, type UpdateCatalogueProductPayload, type UpdateContractPayload, type UrgencyLevel, type UseFileManagerApiReturn, type User$1 as User, UserServices, type VariableCategory, VariablePanel, type Vendor, type VendorListResponse, VendorServices, ViewContractContent, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, defaultTheme, exportToHtml, fileManagerApi, findFolderById, formatCurrency, formatDate, formatDateFR, formatDateTime, formatFileSize, getAllFolders, getAllSLATemplates, getDefaultSLATemplates, getFileExtension, getFileIcon, getFileIconColor, getMimeTypeFromExtension, getRecommendedPenaltyCap, getSLATemplatesForServices, getThemeCSSVariables, isImageFile, numberToWords, themes, useAlert, useFileManager, useFileManagerApi, usePermissions, useRootFileManagerApi, useSession, useTheme, useToast };
package/dist/index.js CHANGED
@@ -5174,6 +5174,26 @@ var CostServices = {
5174
5174
  };
5175
5175
  var PROFIT_URI = `${API_URL}/accounting/profit-center/`;
5176
5176
 
5177
+ // src/services/CrmServices.ts
5178
+ var TARGET_RETAILER_URI = `${API_URL}/crm/target-retailers/`;
5179
+ var DAS_URI = `${API_URL}/crm/das/`;
5180
+ var DasServices = {
5181
+ create: (data) => FetchApi.post(`${DAS_URI}`, data),
5182
+ get: (id) => FetchApi.get(`${DAS_URI}${id}/`),
5183
+ list: (params) => FetchApi.get(`${DAS_URI}?${new URLSearchParams(params).toString()}`),
5184
+ update: (id, data) => FetchApi.put(`${DAS_URI}${id}/`, data),
5185
+ delete: (id) => FetchApi.delete(`${DAS_URI}${id}/`)
5186
+ };
5187
+ var OTHER_COST_URI = `${API_URL}/crm/other-costs/`;
5188
+ var LEAD_NEED_URI = `${API_URL}/crm/lead-needs/`;
5189
+ var LeadNeedServices = {
5190
+ create: (data) => FetchApi.post(`${LEAD_NEED_URI}`, data),
5191
+ get: (id) => FetchApi.get(`${LEAD_NEED_URI}${id}/`),
5192
+ list: (params) => FetchApi.get(`${LEAD_NEED_URI}?${new URLSearchParams(params).toString()}`),
5193
+ update: (id, data) => FetchApi.put(`${LEAD_NEED_URI}${id}/`, data),
5194
+ delete: (id) => FetchApi.delete(`${LEAD_NEED_URI}${id}/`)
5195
+ };
5196
+
5177
5197
  // src/components/common/CommonSelect.tsx
5178
5198
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
5179
5199
  var SelectVendor = ({
@@ -6162,6 +6182,148 @@ var SelectClient = ({
6162
6182
  loading && /* @__PURE__ */ jsx16("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des clients..." })
6163
6183
  ] });
6164
6184
  };
6185
+ var SelectDas = ({
6186
+ value,
6187
+ onSelect,
6188
+ allowClear,
6189
+ onRemove,
6190
+ label = "S\xE9lectionner un DAS"
6191
+ }) => {
6192
+ const { token, activeBusinessEntity } = useSession();
6193
+ const [dasList, setDasList] = useState10(() => {
6194
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6195
+ const cached = sessionStorage.getItem(cacheKey);
6196
+ return cached ? JSON.parse(cached) : [];
6197
+ });
6198
+ const [loading, setLoading] = useState10(false);
6199
+ useEffect8(() => {
6200
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6201
+ const cached = sessionStorage.getItem(cacheKey);
6202
+ if (!cached) {
6203
+ loadDas();
6204
+ } else {
6205
+ setDasList(JSON.parse(cached));
6206
+ }
6207
+ }, [activeBusinessEntity?.id]);
6208
+ const getDasOptions = () => {
6209
+ return dasList.filter((das) => das.id !== void 0).map((das) => ({
6210
+ value: das.id,
6211
+ label: `${das.code_das ? `[${das.code_das}] ` : ""}${das.name || "Sans nom"}`,
6212
+ object: das
6213
+ }));
6214
+ };
6215
+ const loadDas = async () => {
6216
+ if (!token) return;
6217
+ try {
6218
+ setLoading(true);
6219
+ const result = await DasServices.list({ business_entity_id: activeBusinessEntity?.id });
6220
+ if (result.data) {
6221
+ setDasList(result.data);
6222
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6223
+ sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
6224
+ }
6225
+ } catch (error) {
6226
+ console.error(error);
6227
+ } finally {
6228
+ setLoading(false);
6229
+ }
6230
+ };
6231
+ const handleRefresh = () => {
6232
+ const cacheKey = `das_cache_${activeBusinessEntity?.id || "default"}`;
6233
+ sessionStorage.removeItem(cacheKey);
6234
+ loadDas();
6235
+ };
6236
+ return /* @__PURE__ */ jsxs12("div", { children: [
6237
+ label && /* @__PURE__ */ jsx16("div", { className: "flex justify-between", children: /* @__PURE__ */ jsx16("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
6238
+ /* @__PURE__ */ jsx16(
6239
+ SearchableSelect,
6240
+ {
6241
+ value,
6242
+ options: getDasOptions(),
6243
+ placeholder: "S\xE9lectionner un DAS...",
6244
+ searchPlaceholder: "Rechercher...",
6245
+ onSelect,
6246
+ disabled: loading,
6247
+ refresh: handleRefresh,
6248
+ allowClear,
6249
+ onRemove
6250
+ },
6251
+ "das" + value
6252
+ ),
6253
+ loading && /* @__PURE__ */ jsx16("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des DAS..." })
6254
+ ] });
6255
+ };
6256
+ var SelectLeadNeed = ({
6257
+ value,
6258
+ onSelect,
6259
+ allowClear,
6260
+ onRemove,
6261
+ label = "S\xE9lectionner un besoin"
6262
+ }) => {
6263
+ const { token, activeBusinessEntity } = useSession();
6264
+ const [leadNeeds, setLeadNeeds] = useState10(() => {
6265
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6266
+ const cached = sessionStorage.getItem(cacheKey);
6267
+ return cached ? JSON.parse(cached) : [];
6268
+ });
6269
+ const [loading, setLoading] = useState10(false);
6270
+ useEffect8(() => {
6271
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6272
+ const cached = sessionStorage.getItem(cacheKey);
6273
+ if (!cached) {
6274
+ loadLeadNeeds();
6275
+ } else {
6276
+ setLeadNeeds(JSON.parse(cached));
6277
+ }
6278
+ }, [activeBusinessEntity?.id]);
6279
+ const getLeadNeedOptions = () => {
6280
+ return leadNeeds.filter((leadNeed) => leadNeed.id !== void 0).map((leadNeed) => ({
6281
+ value: leadNeed.id,
6282
+ label: `${leadNeed.name || "Sans nom"}${leadNeed.type ? ` (${leadNeed.type})` : ""}`,
6283
+ object: leadNeed
6284
+ }));
6285
+ };
6286
+ const loadLeadNeeds = async () => {
6287
+ if (!token) return;
6288
+ try {
6289
+ setLoading(true);
6290
+ const result = await LeadNeedServices.list({ business_entity_id: activeBusinessEntity?.id });
6291
+ if (result.data) {
6292
+ setLeadNeeds(result.data);
6293
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6294
+ sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
6295
+ }
6296
+ } catch (error) {
6297
+ console.error(error);
6298
+ } finally {
6299
+ setLoading(false);
6300
+ }
6301
+ };
6302
+ const handleRefresh = () => {
6303
+ const cacheKey = `lead_needs_cache_${activeBusinessEntity?.id || "default"}`;
6304
+ sessionStorage.removeItem(cacheKey);
6305
+ loadLeadNeeds();
6306
+ };
6307
+ return /* @__PURE__ */ jsxs12("div", { children: [
6308
+ label && /* @__PURE__ */ jsx16("div", { className: "flex justify-between", children: /* @__PURE__ */ jsx16("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
6309
+ /* @__PURE__ */ jsx16(
6310
+ SearchableSelect,
6311
+ {
6312
+ value,
6313
+ options: getLeadNeedOptions(),
6314
+ placeholder: "S\xE9lectionner un besoin...",
6315
+ searchPlaceholder: "Rechercher...",
6316
+ onSelect,
6317
+ disabled: loading,
6318
+ refresh: handleRefresh,
6319
+ allowClear,
6320
+ onRemove
6321
+ },
6322
+ "leadneed" + value
6323
+ ),
6324
+ loading && /* @__PURE__ */ jsx16("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des besoins..." })
6325
+ ] });
6326
+ };
6165
6327
 
6166
6328
  // src/components/common/FileManager/FileManager.tsx
6167
6329
  import { useState as useState15 } from "react";
@@ -19524,14 +19686,6 @@ import {
19524
19686
  Edit as Edit7,
19525
19687
  Trash2 as Trash214
19526
19688
  } from "lucide-react";
19527
-
19528
- // src/services/CrmServices.ts
19529
- var TARGET_RETAILER_URI = `${API_URL}/crm/target-retailers/`;
19530
- var DAS_URI = `${API_URL}/crm/das/`;
19531
- var OTHER_COST_URI = `${API_URL}/crm/other-costs/`;
19532
- var LEAD_NEED_URI = `${API_URL}/crm/lead-needs/`;
19533
-
19534
- // src/pages/parameters/CrmParametersPage.tsx
19535
19689
  import { Fragment as Fragment19, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
19536
19690
 
19537
19691
  // src/pages/parameters/email-template-editor/EmailTemplateEditorPage.tsx
@@ -34123,8 +34277,10 @@ export {
34123
34277
  SelectClient,
34124
34278
  SelectCostCenter,
34125
34279
  SelectCountry,
34280
+ SelectDas,
34126
34281
  SelectDepartment,
34127
34282
  SelectInput,
34283
+ SelectLeadNeed,
34128
34284
  SelectLegalForm,
34129
34285
  SelectUnit,
34130
34286
  SelectUser,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptechcore_ui",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",