ptechcore_ui 1.0.19 → 1.0.20

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
@@ -110,10 +110,10 @@ var Buttons_default = PrimaryButton;
110
110
 
111
111
  // src/components/common/Modals.tsx
112
112
  var import_jsx_runtime2 = require("react/jsx-runtime");
113
- var Modal = ({ title, description, width, open, onClose, children }) => {
113
+ var Modal = ({ title, description, width = "max-w-lg", open, onClose, children }) => {
114
114
  if (!open) return null;
115
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `bg-white rounded-lg pt-4 px-6 mx-4 `, children: [
116
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex justify-between items-start mb-6", children: [
115
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `bg-white rounded-lg p-6 mx-4 w-full ${width}`, children: [
116
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex justify-between items-start mb-6", children: [
117
117
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
118
118
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { className: "text-xl font-semibold text-tuatara flex items-center space-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: title }) }),
119
119
  description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-sm text-gray-600 mt-1", children: description })
@@ -128,7 +128,7 @@ var Modal = ({ title, description, width, open, onClose, children }) => {
128
128
  }
129
129
  )
130
130
  ] }),
131
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto mb-1", children })
131
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto", children })
132
132
  ] }) });
133
133
  };
134
134
  var Modals_default = Modal;
@@ -291,7 +291,91 @@ var FileInput = ({
291
291
  // src/components/layout/ModernDoubleSidebarLayout.tsx
292
292
  var import_react5 = __toESM(require("react"), 1);
293
293
  var import_react_router_dom3 = require("react-router-dom");
294
- var import_lucide_react2 = require("lucide-react");
294
+ var import_lucide_react3 = require("lucide-react");
295
+
296
+ // src/assets/modules-icons/crm-blue.svg
297
+ var crm_blue_default = "./crm-blue-5IUN7OWK.svg";
298
+
299
+ // src/assets/modules-icons/crmwhite.svg
300
+ var crmwhite_default = "./crmwhite-T4YVRCBY.svg";
301
+
302
+ // src/assets/modules-icons/marketingblue.svg
303
+ var marketingblue_default = "./marketingblue-M22Q2RVP.svg";
304
+
305
+ // src/assets/modules-icons/marketingblanc.svg
306
+ var marketingblanc_default = "./marketingblanc-VGLH2RYX.svg";
307
+
308
+ // src/assets/modules-icons/facilityblue.svg
309
+ var facilityblue_default = "./facilityblue-OSJ76HN4.svg";
310
+
311
+ // src/assets/modules-icons/facilityblanc.svg
312
+ var facilityblanc_default = "./facilityblanc-X2W5XOZF.svg";
313
+
314
+ // src/assets/modules-icons/security_managementblue.svg
315
+ var security_managementblue_default = "./security_managementblue-KPYN5QPS.svg";
316
+
317
+ // src/assets/modules-icons/security_managementblanc.svg
318
+ var security_managementblanc_default = "./security_managementblanc-44CBK332.svg";
319
+
320
+ // src/assets/modules-icons/thriveblue.svg
321
+ var thriveblue_default = "./thriveblue-MFDIWYWF.svg";
322
+
323
+ // src/assets/modules-icons/thriveblanc.svg
324
+ var thriveblanc_default = "./thriveblanc-C7YX45XG.svg";
325
+
326
+ // src/assets/modules-icons/wiseblues.svg
327
+ var wiseblues_default = "./wiseblues-MMOO253P.svg";
328
+
329
+ // src/assets/modules-icons/wiseblancs.svg
330
+ var wiseblancs_default = "./wiseblancs-W2M4CRXV.svg";
331
+
332
+ // src/assets/modules-icons/sopblues.svg
333
+ var sopblues_default = "./sopblues-MKSGDFK2.svg";
334
+
335
+ // src/assets/modules-icons/sopblancs.svg
336
+ var sopblancs_default = "./sopblancs-LQYRWDFF.svg";
337
+
338
+ // src/assets/modules-icons/invoicingblue.svg
339
+ var invoicingblue_default = "./invoicingblue-PGDRJHUT.svg";
340
+
341
+ // src/assets/modules-icons/invoicingblanc.svg
342
+ var invoicingblanc_default = "./invoicingblanc-OG4REEEI.svg";
343
+
344
+ // src/assets/modules-icons/accountingblue.svg
345
+ var accountingblue_default = "./accountingblue-KJT2COTJ.svg";
346
+
347
+ // src/assets/modules-icons/accountingblanc.svg
348
+ var accountingblanc_default = "./accountingblanc-HXO7ZL5C.svg";
349
+
350
+ // src/assets/modules-icons/assetblue.svg
351
+ var assetblue_default = "./assetblue-QVU5HCMT.svg";
352
+
353
+ // src/assets/modules-icons/assetblanc.svg
354
+ var assetblanc_default = "./assetblanc-G4JYFDCR.svg";
355
+
356
+ // src/assets/modules-icons/financeblue.svg
357
+ var financeblue_default = "./financeblue-C6ARC7XB.svg";
358
+
359
+ // src/assets/modules-icons/financeblanc.svg
360
+ var financeblanc_default = "./financeblanc-FFBP6VCU.svg";
361
+
362
+ // src/assets/modules-icons/collection_litigationblue.svg
363
+ var collection_litigationblue_default = "./collection_litigationblue-UNGB33BF.svg";
364
+
365
+ // src/assets/modules-icons/collection_litigationblanc.svg
366
+ var collection_litigationblanc_default = "./collection_litigationblanc-7NRNT2NJ.svg";
367
+
368
+ // src/assets/modules-icons/procurementblue.svg
369
+ var procurementblue_default = "./procurementblue-KXLG2CW4.svg";
370
+
371
+ // src/assets/modules-icons/procurementblanc.svg
372
+ var procurementblanc_default = "./procurementblanc-C3K6S2GP.svg";
373
+
374
+ // src/assets/modules-icons/human_capitalblue.svg
375
+ var human_capitalblue_default = "./human_capitalblue-IGF53KXL.svg";
376
+
377
+ // src/assets/modules-icons/human_capitalblanc.svg
378
+ var human_capitalblanc_default = "./human_capitalblanc-44P3SKKG.svg";
295
379
 
296
380
  // src/utils/utils.ts
297
381
  var import_clsx = require("clsx");
@@ -752,6 +836,28 @@ var AuthServices = {
752
836
  logout: () => FetchApi.post(`${API_BASE_URL}logout/`)
753
837
  };
754
838
 
839
+ // src/services/VendorServices.ts
840
+ var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
841
+ var VendorServices = {
842
+ createVendor: (data, token) => {
843
+ const payload = { ...data };
844
+ if (!payload.logo) {
845
+ delete payload.logo;
846
+ }
847
+ return FetchApi.post(`${VENDORS_API_URL}`, payload, token);
848
+ },
849
+ getVendor: (id, token) => FetchApi.get(`${VENDORS_API_URL}${id}/`, token),
850
+ getVendors: (token, params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`, token),
851
+ updateVendor: (id, data, token) => {
852
+ const payload = { ...data };
853
+ if (!payload.logo) {
854
+ delete payload.logo;
855
+ }
856
+ return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload, token);
857
+ },
858
+ deleteVendor: (id, token) => FetchApi.delete(`${VENDORS_API_URL}${id}/`, token)
859
+ };
860
+
755
861
  // src/contexts/SessionContext.tsx
756
862
  var import_jsx_runtime5 = require("react/jsx-runtime");
757
863
  var SessionContext = (0, import_react2.createContext)(void 0);
@@ -769,6 +875,47 @@ var SessionProvider = ({ children }) => {
769
875
  const saved_center_id = localStorage.getItem("active_center_id") || "";
770
876
  const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
771
877
  const [showAuthModal, setShowAuthModal] = (0, import_react2.useState)(false);
878
+ (0, import_react2.useEffect)(() => {
879
+ const params = new URLSearchParams(window.location.search);
880
+ const tkn = params.get("tkn");
881
+ if (tkn) {
882
+ localStorage.setItem("token", tkn);
883
+ setToken(tkn);
884
+ window.history.replaceState({}, document.title, window.location.pathname);
885
+ }
886
+ }, []);
887
+ const [vendors, setVendors] = (0, import_react2.useState)(() => {
888
+ const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
889
+ const cached = sessionStorage.getItem(cacheKey);
890
+ return cached ? JSON.parse(cached) : [];
891
+ });
892
+ const [loadingVendors, setLoadingVendors] = (0, import_react2.useState)(false);
893
+ const loadVendors = async () => {
894
+ if (!token) {
895
+ console.error("Vous devez etre connect\xE9 pour voir les organisations");
896
+ return;
897
+ }
898
+ try {
899
+ setLoadingVendors(true);
900
+ const result = await VendorServices.getVendors(token, { business_entity_id: activeBusinessEntity?.id });
901
+ setVendors(result.data);
902
+ const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
903
+ sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
904
+ } catch (error) {
905
+ console.error(error);
906
+ } finally {
907
+ setLoadingVendors(false);
908
+ }
909
+ };
910
+ (0, import_react2.useEffect)(() => {
911
+ const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
912
+ const cached = sessionStorage.getItem(cacheKey);
913
+ if (!cached) {
914
+ loadVendors();
915
+ } else {
916
+ setVendors(JSON.parse(cached));
917
+ }
918
+ }, [activeBusinessEntity?.id]);
772
919
  (0, import_react2.useEffect)(() => {
773
920
  const storedToken = localStorage.getItem("token");
774
921
  if (storedToken) {
@@ -788,6 +935,7 @@ var SessionProvider = ({ children }) => {
788
935
  AuthServices.getUserInformations(token).then((res) => {
789
936
  const result = res;
790
937
  if (result.success === true) {
938
+ console.log("USER LOGGED", result.data.user);
791
939
  setLoggedUser(result.data.user);
792
940
  setActiveBusinessEntity(result.data.user.centers_access.find((item) => parseInt(item.id) === parseInt(saved_center_id)) || result.data.user.centers_access[0] || null);
793
941
  } else {
@@ -812,7 +960,12 @@ var SessionProvider = ({ children }) => {
812
960
  login,
813
961
  logout,
814
962
  showAuthModal,
815
- setShowAuthModal
963
+ setShowAuthModal,
964
+ vendors,
965
+ setVendors,
966
+ loadingVendors,
967
+ setLoadingVendors,
968
+ loadVendors
816
969
  }, children });
817
970
  };
818
971
 
@@ -845,6 +998,7 @@ var UserServices = {
845
998
 
846
999
  // src/contexts/ToastContext.tsx
847
1000
  var import_react3 = require("react");
1001
+ var import_lucide_react = require("lucide-react");
848
1002
  var import_jsx_runtime6 = require("react/jsx-runtime");
849
1003
  var ToastContext = (0, import_react3.createContext)(void 0);
850
1004
  var useToast = () => {
@@ -856,6 +1010,11 @@ var useToast = () => {
856
1010
  };
857
1011
  var ToastProvider = ({ children }) => {
858
1012
  const [toasts, setToasts] = (0, import_react3.useState)([]);
1013
+ const [confirmState, setConfirmState] = (0, import_react3.useState)({
1014
+ isOpen: false,
1015
+ options: null,
1016
+ resolve: null
1017
+ });
859
1018
  const generateId = () => {
860
1019
  return Date.now().toString(36) + Math.random().toString(36).substr(2);
861
1020
  };
@@ -888,6 +1047,26 @@ var ToastProvider = ({ children }) => {
888
1047
  const info = (0, import_react3.useCallback)((message, duration) => {
889
1048
  addToast({ message, type: "info", duration });
890
1049
  }, [addToast]);
1050
+ const confirm2 = (0, import_react3.useCallback)((options) => {
1051
+ return new Promise((resolve) => {
1052
+ const normalizedOptions = typeof options === "string" ? { message: options } : options;
1053
+ setConfirmState({
1054
+ isOpen: true,
1055
+ options: normalizedOptions,
1056
+ resolve
1057
+ });
1058
+ });
1059
+ }, []);
1060
+ const handleConfirm = (0, import_react3.useCallback)((result) => {
1061
+ if (confirmState.resolve) {
1062
+ confirmState.resolve(result);
1063
+ }
1064
+ setConfirmState({
1065
+ isOpen: false,
1066
+ options: null,
1067
+ resolve: null
1068
+ });
1069
+ }, [confirmState.resolve]);
891
1070
  const value = {
892
1071
  toasts,
893
1072
  addToast,
@@ -895,9 +1074,77 @@ var ToastProvider = ({ children }) => {
895
1074
  success,
896
1075
  error,
897
1076
  warning,
898
- info
1077
+ info,
1078
+ confirm: confirm2
1079
+ };
1080
+ const getConfirmTypeStyles = (type) => {
1081
+ switch (type) {
1082
+ case "danger":
1083
+ return {
1084
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.AlertCircle, { className: "w-6 h-6 text-red-500" }),
1085
+ confirmBtnClass: "bg-red-600 hover:bg-red-700 text-white"
1086
+ };
1087
+ case "warning":
1088
+ return {
1089
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.AlertTriangle, { className: "w-6 h-6 text-amber-500" }),
1090
+ confirmBtnClass: "bg-amber-600 hover:bg-amber-700 text-white"
1091
+ };
1092
+ case "info":
1093
+ default:
1094
+ return {
1095
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.HelpCircle, { className: "w-6 h-6 text-blue-500" }),
1096
+ confirmBtnClass: "bg-blue-600 hover:bg-blue-700 text-white"
1097
+ };
1098
+ }
899
1099
  };
900
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ToastContext.Provider, { value, children });
1100
+ const typeStyles = confirmState.options ? getConfirmTypeStyles(confirmState.options.type) : getConfirmTypeStyles();
1101
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ToastContext.Provider, { value, children: [
1102
+ children,
1103
+ confirmState.isOpen && confirmState.options && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center", children: [
1104
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1105
+ "div",
1106
+ {
1107
+ className: "absolute inset-0 bg-black/50 backdrop-blur-sm",
1108
+ onClick: () => handleConfirm(false)
1109
+ }
1110
+ ),
1111
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative bg-white rounded-xl shadow-2xl max-w-md w-full mx-4 overflow-hidden animate-in fade-in zoom-in duration-200", children: [
1112
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start gap-4 p-6 pb-4", children: [
1113
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex-shrink-0 p-2 rounded-full bg-gray-100", children: typeStyles.icon }),
1114
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 min-w-0", children: [
1115
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: confirmState.options.title || "Confirmation" }),
1116
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mt-2 text-sm text-gray-600 whitespace-pre-wrap", children: confirmState.options.message })
1117
+ ] }),
1118
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1119
+ "button",
1120
+ {
1121
+ onClick: () => handleConfirm(false),
1122
+ className: "flex-shrink-0 p-1 rounded-lg hover:bg-gray-100 transition-colors",
1123
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.X, { className: "w-5 h-5 text-gray-400" })
1124
+ }
1125
+ )
1126
+ ] }),
1127
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex justify-end gap-3 px-6 py-4 bg-gray-50 border-t border-gray-100", children: [
1128
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1129
+ "button",
1130
+ {
1131
+ onClick: () => handleConfirm(false),
1132
+ className: "px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",
1133
+ children: confirmState.options.cancelText || "Annuler"
1134
+ }
1135
+ ),
1136
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1137
+ "button",
1138
+ {
1139
+ onClick: () => handleConfirm(true),
1140
+ className: `px-4 py-2 text-sm font-medium rounded-lg transition-colors ${typeStyles.confirmBtnClass}`,
1141
+ children: confirmState.options.confirmText || "Confirmer"
1142
+ }
1143
+ )
1144
+ ] })
1145
+ ] })
1146
+ ] })
1147
+ ] });
901
1148
  };
902
1149
 
903
1150
  // src/pages/ApprovalPreviewAnswer.tsx
@@ -911,7 +1158,7 @@ var RewiseBasicCard = ({ title, children }) => /* @__PURE__ */ (0, import_jsx_ru
911
1158
  ] });
912
1159
 
913
1160
  // src/pages/ApprovalPreviewAnswer.tsx
914
- var import_lucide_react = require("lucide-react");
1161
+ var import_lucide_react2 = require("lucide-react");
915
1162
  var import_react_router_dom2 = require("react-router-dom");
916
1163
 
917
1164
  // src/services/ApprovalServices.ts
@@ -1003,7 +1250,7 @@ var ApprovalAnswerModal = ({ answer_id, link_token, object_detail }) => {
1003
1250
  }
1004
1251
  };
1005
1252
  if (loading) {
1006
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RewiseBasicCard, { title: "Approbation - Pr\xE9visualisation", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) });
1253
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RewiseBasicCard, { title: "Approbation - Pr\xE9visualisation", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) });
1007
1254
  } else {
1008
1255
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ApprovalPreviewAnswer, { loadCase: loadData, answerId, caseData });
1009
1256
  }
@@ -1047,7 +1294,7 @@ var ApprovalAnswerPage = () => {
1047
1294
  };
1048
1295
  const pageTitle = caseData?.title || "Approbation - Pr\xE9visualisation";
1049
1296
  if (loading) {
1050
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RewiseBasicCard, { title: "Approbation - Pr\xE9visualisation", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) });
1297
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RewiseBasicCard, { title: "Approbation - Pr\xE9visualisation", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) });
1051
1298
  } else {
1052
1299
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "min-h-screen w-full bg-gray-100 mx-auto p-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "min-h-screen max-w-7xl mx-auto p-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1053
1300
  RewiseBasicCard,
@@ -1120,7 +1367,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1120
1367
  switch (answer) {
1121
1368
  case "approved":
1122
1369
  return {
1123
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.CheckCircle, { className: "w-5 h-5 text-green-600" }),
1370
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-5 h-5 text-green-600" }),
1124
1371
  label: "Approuv\xE9",
1125
1372
  bgColor: "bg-green-50",
1126
1373
  textColor: "text-green-700",
@@ -1128,7 +1375,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1128
1375
  };
1129
1376
  case "refused":
1130
1377
  return {
1131
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.XCircle, { className: "w-5 h-5 text-red-600" }),
1378
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-5 h-5 text-red-600" }),
1132
1379
  label: "Refus\xE9",
1133
1380
  bgColor: "bg-red-50",
1134
1381
  textColor: "text-red-700",
@@ -1136,7 +1383,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1136
1383
  };
1137
1384
  case "suggest-correction":
1138
1385
  return {
1139
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Edit, { className: "w-5 h-5 text-orange-600" }),
1386
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-5 h-5 text-orange-600" }),
1140
1387
  label: "Correction sugg\xE9r\xE9e",
1141
1388
  bgColor: "bg-orange-50",
1142
1389
  textColor: "text-orange-700",
@@ -1145,7 +1392,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1145
1392
  case "waiting":
1146
1393
  default:
1147
1394
  return {
1148
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Clock, { className: "w-5 h-5 text-gray-500" }),
1395
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Clock, { className: "w-5 h-5 text-gray-500" }),
1149
1396
  label: "En attente",
1150
1397
  bgColor: "bg-gray-50",
1151
1398
  textColor: "text-gray-700",
@@ -1163,7 +1410,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1163
1410
  "div",
1164
1411
  {
1165
1412
  className: `w-10 h-10 rounded-full ${statusDisplay.bgColor} border-2 ${statusDisplay.borderColor} flex items-center justify-center`,
1166
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.User, { className: `w-5 h-5 ${statusDisplay.textColor}` })
1413
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.User, { className: `w-5 h-5 ${statusDisplay.textColor}` })
1167
1414
  }
1168
1415
  ) }),
1169
1416
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex-1 min-w-0 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `p-3 rounded-lg border ${statusDisplay.borderColor} ${statusDisplay.bgColor}`, children: [
@@ -1177,10 +1424,10 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1177
1424
  userEmail && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-gray-600 truncate mb-2", children: userEmail }),
1178
1425
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2 mb-1", children: [
1179
1426
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `w-5 h-5 rounded-full bg-white border ${statusDisplay.borderColor} flex items-center justify-center`, children: [
1180
- approval.answer === "approved" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.CheckCircle, { className: "w-3 h-3 text-green-600" }),
1181
- approval.answer === "refused" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.XCircle, { className: "w-3 h-3 text-red-600" }),
1182
- approval.answer === "suggest-correction" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Edit, { className: "w-3 h-3 text-orange-600" }),
1183
- approval.answer === "waiting" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Clock, { className: "w-3 h-3 text-gray-500" })
1427
+ approval.answer === "approved" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-3 h-3 text-green-600" }),
1428
+ approval.answer === "refused" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-3 h-3 text-red-600" }),
1429
+ approval.answer === "suggest-correction" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-3 h-3 text-orange-600" }),
1430
+ approval.answer === "waiting" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Clock, { className: "w-3 h-3 text-gray-500" })
1184
1431
  ] }) }),
1185
1432
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `text-xs font-medium ${statusDisplay.textColor}`, children: statusDisplay.label })
1186
1433
  ] }),
@@ -1205,17 +1452,17 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1205
1452
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lg:col-span-4 space-y-6 ", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "p-4 border bg-gray-50 border-gray-200 rounded-lg", children: [
1206
1453
  caseData?.requester && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-3", children: [
1207
1454
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("h3", { className: "text-lg font-semibold text-[#191919] flex items-center gap-2", children: [
1208
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Send, { className: "w-5 h-5 text-[#6A8A82]" }),
1455
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Send, { className: "w-5 h-5 text-[#6A8A82]" }),
1209
1456
  "Demandeur"
1210
1457
  ] }),
1211
1458
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex gap-3", children: [
1212
1459
  (caseData.verifications && caseData.verifications.length > 0 || caseData.validations && caseData.validations.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute left-[19px] top-[40px] bottom-[-24px] w-0.5 bg-gray-300" }),
1213
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "relative flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-10 h-10 rounded-full bg-blue-50 border-2 border-blue-200 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.User, { className: "w-5 h-5 text-blue-700" }) }) }),
1460
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "relative flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-10 h-10 rounded-full bg-blue-50 border-2 border-blue-200 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.User, { className: "w-5 h-5 text-blue-700" }) }) }),
1214
1461
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex-1 min-w-0 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "p-3 rounded-lg border border-blue-200 bg-blue-50", children: [
1215
1462
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-medium text-sm text-[#191919] block mb-1", children: `${caseData.requester.first_name} ${caseData.requester.last_name}`.trim() }),
1216
1463
  caseData.requester.email && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-gray-600 truncate", children: caseData.requester.email }),
1217
1464
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mt-2 mb-1 flex items-center gap-2", children: [
1218
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w-5 h-5 rounded-full bg-white border border-blue-200 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Send, { className: "w-3 h-3 text-blue-600" }) }),
1465
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "w-5 h-5 rounded-full bg-white border border-blue-200 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Send, { className: "w-3 h-3 text-blue-600" }) }),
1219
1466
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-xs text-blue-700 font-medium", children: [
1220
1467
  "Demande cr\xE9\xE9e le ",
1221
1468
  new Date(caseData.created_at || "").toLocaleDateString("fr-FR", {
@@ -1230,7 +1477,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1230
1477
  ] }),
1231
1478
  caseData?.verifications && caseData.verifications.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-3", children: [
1232
1479
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("h3", { className: "text-lg font-semibold text-[#191919] flex items-center gap-2", children: [
1233
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.FileText, { className: "w-5 h-5 text-[#6A8A82]" }),
1480
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.FileText, { className: "w-5 h-5 text-[#6A8A82]" }),
1234
1481
  "V\xE9rifications (",
1235
1482
  caseData.verifications.length,
1236
1483
  ")"
@@ -1246,7 +1493,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1246
1493
  ] }),
1247
1494
  caseData?.validations && caseData.validations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-3", children: [
1248
1495
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("h3", { className: "text-lg font-semibold text-[#191919] flex items-center gap-2", children: [
1249
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.CheckCircle, { className: "w-5 h-5 text-[#6A8A82]" }),
1496
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-5 h-5 text-[#6A8A82]" }),
1250
1497
  "Validations (",
1251
1498
  caseData.validations.length,
1252
1499
  ")"
@@ -1256,7 +1503,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1256
1503
  ) })
1257
1504
  ] }),
1258
1505
  (!caseData?.verifications || caseData.verifications.length === 0) && (!caseData?.validations || caseData.validations.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "text-center py-8 text-gray-500", children: [
1259
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.AlertCircle, { className: "w-12 h-12 mx-auto mb-3 text-gray-400" }),
1506
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.AlertCircle, { className: "w-12 h-12 mx-auto mb-3 text-gray-400" }),
1260
1507
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm", children: "Aucune approbation requise" })
1261
1508
  ] })
1262
1509
  ] }) }),
@@ -1286,7 +1533,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1286
1533
  dangerouslySetInnerHTML: { __html: caseData.html_content }
1287
1534
  }
1288
1535
  ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "text-center py-12 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
1289
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Eye, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
1536
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Eye, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
1290
1537
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[#767676]", children: "Aucun aper\xE7u disponible" })
1291
1538
  ] })
1292
1539
  ] }) }),
@@ -1298,7 +1545,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1298
1545
  disabled: submitting || caseData?.status !== "waiting",
1299
1546
  classname: "flex items-center gap-2",
1300
1547
  children: [
1301
- submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.XCircle, { className: "w-4 h-4" }),
1548
+ submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-4 h-4" }),
1302
1549
  "Refuser"
1303
1550
  ]
1304
1551
  }
@@ -1310,7 +1557,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1310
1557
  disabled: submitting || caseData?.status !== "waiting",
1311
1558
  classname: "flex items-center gap-2",
1312
1559
  children: [
1313
- submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Edit, { className: "w-4 h-4" }),
1560
+ submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-4 h-4" }),
1314
1561
  "Sugg\xE9rer une correction"
1315
1562
  ]
1316
1563
  }
@@ -1322,7 +1569,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1322
1569
  disabled: submitting || caseData?.status !== "waiting",
1323
1570
  classname: "flex items-center gap-2",
1324
1571
  children: [
1325
- submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Check, { className: "w-4 h-4" }),
1572
+ submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { className: "w-4 h-4" }),
1326
1573
  "Accepter"
1327
1574
  ]
1328
1575
  }
@@ -1343,7 +1590,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1343
1590
  onClick: closeNoteModal,
1344
1591
  disabled: submitting,
1345
1592
  className: "text-gray-500 hover:text-[#6A8A82] transition-colors",
1346
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.X, { className: "w-5 h-5" })
1593
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { className: "w-5 h-5" })
1347
1594
  }
1348
1595
  )
1349
1596
  ] }),
@@ -1381,12 +1628,12 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1381
1628
  disabled: submitting || currentAction === "suggest" && !note.trim(),
1382
1629
  classname: "flex items-center gap-2",
1383
1630
  children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1384
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Loader, { className: "w-4 h-4 animate-spin" }),
1631
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-4 h-4 animate-spin" }),
1385
1632
  "Traitement..."
1386
1633
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1387
- currentAction === "approve" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Check, { className: "w-4 h-4" }),
1388
- currentAction === "reject" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.XCircle, { className: "w-4 h-4" }),
1389
- currentAction === "suggest" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Edit, { className: "w-4 h-4" }),
1634
+ currentAction === "approve" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { className: "w-4 h-4" }),
1635
+ currentAction === "reject" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-4 h-4" }),
1636
+ currentAction === "suggest" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-4 h-4" }),
1390
1637
  "Confirmer"
1391
1638
  ] })
1392
1639
  }
@@ -1399,11 +1646,86 @@ var ApprovalPreviewAnswer_default = ApprovalPreviewAnswer;
1399
1646
 
1400
1647
  // src/components/layout/ModernDoubleSidebarLayout.tsx
1401
1648
  var import_jsx_runtime9 = require("react/jsx-runtime");
1649
+ var MODULE_URLS = {
1650
+ production: {
1651
+ wiseConnect: "https://rewise.praedium-tech.com/admin/crm/trade-strategy/lead-insight/",
1652
+ wiseReach: "https://rewise.praedium-tech.com/admin/marketing/dashboard/",
1653
+ wiseOps: "https://wisefm.praedium-tech.com/",
1654
+ wiseGuard: "https://rewise.praedium-tech.com/admin/security/dashboard/",
1655
+ wiseThrive: "https://rewise.praedium-tech.com/admin/thrive/scorecard/dashboard/financial/",
1656
+ wiseView: "https://reporting.rewise.praedium-tech.com/",
1657
+ wiseProcess: "https://rewise.praedium-tech.com/workspace/sop-connect/",
1658
+ wiseBill: "https://rewise.praedium-tech.com/admin/invoicing/insight/summary/",
1659
+ wiseBooks: "https://rewise.praedium-tech.com/admin/accounting/client/invoice-queue/",
1660
+ wiseAsset: "#",
1661
+ wiseCash: "https://rewise.praedium-tech.com/admin/finance/dashboard/",
1662
+ wiseCollect: "https://rewise.praedium-tech.com/admin/recovery/collection/dashboard/",
1663
+ wiseProcure: "https://rewise.praedium-tech.com/admin/procurement/dashboard/one/",
1664
+ wiseHR: "https://rewise.praedium-tech.com/admin/human-capital/dashboard/"
1665
+ },
1666
+ development: {
1667
+ wiseConnect: "http://localhost:5173/admin/crm/trade-strategy/lead-insight/",
1668
+ wiseReach: "http://localhost:5173/admin/marketing/dashboard/",
1669
+ wiseOps: "http://localhost:5174/",
1670
+ wiseGuard: "http://localhost:5173/admin/security/dashboard/",
1671
+ wiseThrive: "http://localhost:5173/admin/thrive/scorecard/dashboard/financial/",
1672
+ wiseView: "http://localhost:5175/",
1673
+ wiseProcess: "http://localhost:5173/workspace/sop-connect/",
1674
+ wiseBill: "http://localhost:5173/admin/invoicing/insight/summary/",
1675
+ wiseBooks: "http://localhost:5173/admin/accounting/client/invoice-queue/",
1676
+ wiseAsset: "#",
1677
+ wiseCash: "http://localhost:5173/admin/finance/dashboard/",
1678
+ wiseCollect: "http://localhost:5173/admin/recovery/collection/dashboard/",
1679
+ wiseProcure: "http://localhost:5173/admin/procurement/dashboard/one/",
1680
+ wiseHR: "http://localhost:5173/admin/human-capital/dashboard/"
1681
+ }
1682
+ };
1683
+ var getModuleUrls = (token) => {
1684
+ const env = localStorage.getItem("env") || "prod";
1685
+ const urls = env === "localhost" ? MODULE_URLS.development : MODULE_URLS.production;
1686
+ return {
1687
+ ...urls,
1688
+ wiseOps: token ? `${urls.wiseOps}?tkn=${token}` : urls.wiseOps
1689
+ };
1690
+ };
1691
+ var MODULE_CODE_MAP = {
1692
+ "CRM": "WiseConnect",
1693
+ "MARKETING": "WiseReach",
1694
+ "FACILITY": "WiseOps",
1695
+ "SECURITY": "WiseGuard",
1696
+ "THRIVE": "WiseThrive",
1697
+ "BI": "WiseView",
1698
+ "SOP": "WiseProcess",
1699
+ "BILLING": "WiseBill",
1700
+ "ACCOUNTING": "WiseBooks",
1701
+ "ASSET": "WiseAsset",
1702
+ "FINANCE": "WiseCash",
1703
+ "COLLECTION": "WiseCollect",
1704
+ "PURCHASE": "WiseProcure",
1705
+ "HR": "WiseHR"
1706
+ };
1402
1707
  var RewiseLayout = ({ children, module_name = "Rewise", module_description = "Description du module", primaryMenuItems, secondaryMenuItems }) => {
1403
1708
  const location = (0, import_react_router_dom3.useLocation)();
1404
1709
  const navigate = (0, import_react_router_dom3.useNavigate)();
1405
1710
  const { theme, themeType, setTheme } = useTheme();
1406
- const { loggedUser, activeBusinessEntity, setActiveBusinessEntity } = useSession();
1711
+ const { loggedUser, token, activeBusinessEntity, setActiveBusinessEntity } = useSession();
1712
+ const moduleUrls = getModuleUrls(token || void 0);
1713
+ const getOrganizationModules = () => {
1714
+ if (!activeBusinessEntity) return [];
1715
+ const org = activeBusinessEntity.organization;
1716
+ if (typeof org === "object" && org !== null && "modules" in org) {
1717
+ return org.modules || [];
1718
+ }
1719
+ return [];
1720
+ };
1721
+ const organizationModules = getOrganizationModules();
1722
+ const organizationModuleCodes = organizationModules.map((m) => m.code);
1723
+ const isModuleAccessible = (moduleName) => {
1724
+ if (organizationModules.length === 0) return true;
1725
+ const moduleCode = Object.entries(MODULE_CODE_MAP).find(([_, name]) => name === moduleName)?.[0];
1726
+ if (!moduleCode) return true;
1727
+ return organizationModuleCodes.includes(moduleCode);
1728
+ };
1407
1729
  const [primaryCollapsed, setPrimaryCollapsed] = (0, import_react5.useState)(false);
1408
1730
  const [secondaryCollapsed, setSecondaryCollapsed] = (0, import_react5.useState)(false);
1409
1731
  const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react5.useState)(false);
@@ -1413,6 +1735,31 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1413
1735
  const [showUserMenu, setShowUserMenu] = (0, import_react5.useState)(false);
1414
1736
  const [showThemeMenu, setShowThemeMenu] = (0, import_react5.useState)(false);
1415
1737
  const [showCenterMenu, setShowCenterMenu] = (0, import_react5.useState)(false);
1738
+ const [showModulesMenu, setShowModulesMenu] = (0, import_react5.useState)(false);
1739
+ const [currentSlide, setCurrentSlide] = (0, import_react5.useState)(0);
1740
+ const slides = [
1741
+ {
1742
+ title: "Rappel \u2013 Gestion des jours de cong\xE9",
1743
+ content: "Pensez \xE0 planifier vos cong\xE9s \xE0 l'avance via votre espace personnel. Les demandes seront trait\xE9es selon les priorit\xE9s op\xE9rationnelles de chaque d\xE9partement."
1744
+ },
1745
+ {
1746
+ title: "Nouveau \u2013 Mise \xE0 jour des proc\xE9dures",
1747
+ content: "Les nouvelles proc\xE9dures de validation sont maintenant disponibles. Consultez votre manuel utilisateur pour plus d'informations sur les changements."
1748
+ },
1749
+ {
1750
+ title: "Important \u2013 Formation obligatoire",
1751
+ content: "Tous les employ\xE9s doivent compl\xE9ter la formation s\xE9curit\xE9 avant la fin du mois. Inscrivez-vous d\xE8s maintenant sur la plateforme de formation."
1752
+ }
1753
+ ];
1754
+ const nextSlide = () => {
1755
+ setCurrentSlide((prev) => (prev + 1) % slides.length);
1756
+ };
1757
+ const prevSlide = () => {
1758
+ setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length);
1759
+ };
1760
+ const goToSlide = (index) => {
1761
+ setCurrentSlide(index);
1762
+ };
1416
1763
  const [showApprovalModal, setShowApprovalModal] = (0, import_react5.useState)(false);
1417
1764
  const [approvalAnswerDetail, setApprovalAnswerDetail] = (0, import_react5.useState)(null);
1418
1765
  const [caseData, setCaseData] = (0, import_react5.useState)(null);
@@ -1436,6 +1783,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1436
1783
  setShowNotifications(false);
1437
1784
  setShowUserMenu(false);
1438
1785
  setShowThemeMenu(false);
1786
+ setShowModulesMenu(false);
1439
1787
  setMobileMenuOpen(false);
1440
1788
  }
1441
1789
  };
@@ -1544,7 +1892,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1544
1892
  className: "text-[var(--color-sidebar-text-secondary)] hover:text-[var(--color-sidebar-text)] transition-colors",
1545
1893
  "aria-label": primaryCollapsed ? "D\xE9velopper le menu" : "R\xE9duire le menu",
1546
1894
  "aria-expanded": !primaryCollapsed,
1547
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.ChevronLeft, { className: cn(
1895
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLeft, { className: cn(
1548
1896
  "w-5 h-5 transition-transform",
1549
1897
  primaryCollapsed && "rotate-180"
1550
1898
  ) })
@@ -1600,7 +1948,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1600
1948
  "flex items-center gap-3",
1601
1949
  primaryCollapsed && "justify-center"
1602
1950
  ), children: [
1603
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.User, { className: "w-5 h-5 text-[var(--color-background)]" }) }),
1951
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.User, { className: "w-5 h-5 text-[var(--color-background)]" }) }),
1604
1952
  !primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1", children: [
1605
1953
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--color-sidebar-text)]", children: loggedUser?.first_name && loggedUser?.last_name ? `${loggedUser.first_name} ${loggedUser.last_name}` : loggedUser?.username || "Utilisateur" }),
1606
1954
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-sidebar-text-secondary)]", children: loggedUser?.email || "email@example.com" })
@@ -1616,7 +1964,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1616
1964
  onClick: () => setSecondaryCollapsed(false),
1617
1965
  className: "hidden lg:flex items-center justify-center w-12 h-full bg-[var(--color-background)] border-r border-[var(--color-border)] hover:bg-[var(--color-surface-hover)] transition-colors",
1618
1966
  "aria-label": "Ouvrir le sous-menu",
1619
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.ChevronRight, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
1967
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
1620
1968
  }
1621
1969
  ),
1622
1970
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
@@ -1637,7 +1985,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1637
1985
  onClick: () => setSecondaryCollapsed(!secondaryCollapsed),
1638
1986
  className: "text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)] flex-shrink-0",
1639
1987
  "aria-label": secondaryCollapsed ? "D\xE9velopper le sous-menu" : "R\xE9duire le sous-menu",
1640
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.ChevronLeft, { className: cn(
1988
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLeft, { className: cn(
1641
1989
  "w-4 h-4 transition-transform",
1642
1990
  secondaryCollapsed && "rotate-180"
1643
1991
  ) })
@@ -1712,7 +2060,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1712
2060
  onClick: () => setMobileMenuOpen(false),
1713
2061
  className: "text-[var(--color-sidebar-text-secondary)]",
1714
2062
  "aria-label": "Fermer le menu",
1715
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.X, { className: "w-6 h-6" })
2063
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.X, { className: "w-6 h-6" })
1716
2064
  }
1717
2065
  )
1718
2066
  ] }),
@@ -1790,7 +2138,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1790
2138
  onClick: () => setMobileMenuOpen(true),
1791
2139
  className: "lg:hidden text-[var(--color-text-primary)]",
1792
2140
  "aria-label": "Ouvrir le menu mobile",
1793
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Menu, { className: "w-6 h-6" })
2141
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Menu, { className: "w-6 h-6" })
1794
2142
  }
1795
2143
  ),
1796
2144
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1799,7 +2147,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1799
2147
  className: "hidden sm:flex items-center gap-2 text-sm",
1800
2148
  "aria-label": "Fil d'Ariane",
1801
2149
  children: getBreadcrumbs().map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react5.default.Fragment, { children: [
1802
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.ChevronRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }),
2150
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }),
1803
2151
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1804
2152
  "button",
1805
2153
  {
@@ -1815,7 +2163,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1815
2163
  }
1816
2164
  ),
1817
2165
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative max-w-md flex-1 hidden lg:block", children: [
1818
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-tertiary)] w-5 h-5" }),
2166
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-tertiary)] w-5 h-5" }),
1819
2167
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1820
2168
  "input",
1821
2169
  {
@@ -1831,6 +2179,17 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1831
2179
  ] })
1832
2180
  ] }),
1833
2181
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
2182
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2183
+ "button",
2184
+ {
2185
+ onClick: () => setShowModulesMenu(!showModulesMenu),
2186
+ className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2187
+ title: "Acc\xE8s aux modules",
2188
+ "aria-label": "Menu des modules",
2189
+ "aria-expanded": showModulesMenu,
2190
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.LayoutGrid, { className: "w-5 h-5 text-[var(--color-text-secondary)]" })
2191
+ }
2192
+ ) }),
1834
2193
  loggedUser?.centers_access && loggedUser.centers_access.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
1835
2194
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1836
2195
  "button",
@@ -1841,9 +2200,9 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1841
2200
  "aria-label": "S\xE9lecteur de centre",
1842
2201
  "aria-expanded": showCenterMenu,
1843
2202
  children: [
1844
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Building2, { className: "w-4 h-4 text-[var(--color-primary)]" }),
2203
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Building2, { className: "w-4 h-4 text-[var(--color-primary)]" }),
1845
2204
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)] hidden sm:block", children: loggedUser.centers_access.find((c) => c.id === activeBusinessEntity?.id)?.legal_name || "S\xE9lectionner" }),
1846
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.ChevronRight, { className: cn(
2205
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { className: cn(
1847
2206
  "w-4 h-4 text-[var(--color-text-tertiary)] transition-transform",
1848
2207
  showCenterMenu && "rotate-90"
1849
2208
  ) })
@@ -1872,7 +2231,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1872
2231
  ),
1873
2232
  role: "menuitem",
1874
2233
  children: [
1875
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Building2, { className: cn(
2234
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Building2, { className: cn(
1876
2235
  "w-5 h-5",
1877
2236
  selectedCenterId === center.id ? "text-[var(--color-primary)]" : "text-[var(--color-text-tertiary)]"
1878
2237
  ) }),
@@ -1900,7 +2259,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1900
2259
  title: "Changer le th\xE8me",
1901
2260
  "aria-label": "S\xE9lecteur de th\xE8me",
1902
2261
  "aria-expanded": showThemeMenu,
1903
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Palette, { className: "w-5 h-5 text-[var(--color-text-secondary)]" })
2262
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Palette, { className: "w-5 h-5 text-[var(--color-text-secondary)]" })
1904
2263
  }
1905
2264
  ),
1906
2265
  showThemeMenu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1970,7 +2329,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1970
2329
  )
1971
2330
  ] }),
1972
2331
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center px-3 py-1.5 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)]", children: [
1973
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.DollarSign, { className: "w-4 h-4 text-[var(--color-primary)] mr-2" }),
2332
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.DollarSign, { className: "w-4 h-4 text-[var(--color-primary)] mr-2" }),
1974
2333
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: "FCFA" })
1975
2334
  ] }),
1976
2335
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
@@ -1982,7 +2341,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1982
2341
  "aria-label": `Notifications ${notifications.filter((n) => !n.read).length > 0 ? `(${notifications.filter((n) => !n.read).length} non lues)` : ""}`,
1983
2342
  "aria-expanded": showNotifications,
1984
2343
  children: [
1985
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Bell, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
2344
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Bell, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
1986
2345
  notifications.filter((n) => !n.read).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute top-1 right-1 w-2 h-2 bg-[var(--color-error)] rounded-full" })
1987
2346
  ]
1988
2347
  }
@@ -2032,7 +2391,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2032
2391
  className: "flex items-center gap-2 p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2033
2392
  "aria-label": "Menu utilisateur",
2034
2393
  "aria-expanded": showUserMenu,
2035
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-8 h-8 bg-[var(--color-primary)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.User, { className: "w-4 h-4 text-[var(--color-background)]" }) })
2394
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-8 h-8 bg-[var(--color-primary)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.User, { className: "w-4 h-4 text-[var(--color-background)]" }) })
2036
2395
  }
2037
2396
  ),
2038
2397
  showUserMenu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -2048,7 +2407,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2048
2407
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
2049
2408
  role: "menuitem",
2050
2409
  children: [
2051
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.User, { className: "w-4 h-4" }),
2410
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.User, { className: "w-4 h-4" }),
2052
2411
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "Mon profil" })
2053
2412
  ]
2054
2413
  }
@@ -2063,7 +2422,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2063
2422
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
2064
2423
  role: "menuitem",
2065
2424
  children: [
2066
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Settings, { className: "w-4 h-4" }),
2425
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Settings, { className: "w-4 h-4" }),
2067
2426
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "Param\xE8tres" })
2068
2427
  ]
2069
2428
  }
@@ -2074,7 +2433,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2074
2433
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
2075
2434
  role: "menuitem",
2076
2435
  children: [
2077
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.HelpCircle, { className: "w-4 h-4" }),
2436
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.HelpCircle, { className: "w-4 h-4" }),
2078
2437
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "Aide" })
2079
2438
  ]
2080
2439
  }
@@ -2086,7 +2445,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2086
2445
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] text-[var(--color-error)] transition-colors",
2087
2446
  role: "menuitem",
2088
2447
  children: [
2089
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.LogOut, { className: "w-4 h-4" }),
2448
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.LogOut, { className: "w-4 h-4" }),
2090
2449
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "D\xE9connexion" })
2091
2450
  ]
2092
2451
  }
@@ -2109,6 +2468,223 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2109
2468
  }
2110
2469
  )
2111
2470
  ] }),
2471
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2472
+ Modals_default,
2473
+ {
2474
+ title: "Modules REWISE",
2475
+ description: "Acc\xE9dez rapidement \xE0 tous les modules",
2476
+ width: "max-w-6xl",
2477
+ open: showModulesMenu,
2478
+ onClose: () => setShowModulesMenu(false),
2479
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-6", children: [
2480
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4 lg:items-stretch", children: [
2481
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-[3] bg-[#D3E1F2] rounded-lg p-5 relative min-h-[160px]", children: [
2482
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-lg font-semibold text-gray-800 mb-2 pr-8 line-clamp-2", children: slides[currentSlide].title }),
2483
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-gray-600 text-sm leading-relaxed line-clamp-3", children: slides[currentSlide].content }),
2484
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2485
+ "button",
2486
+ {
2487
+ onClick: prevSlide,
2488
+ className: "absolute left-2 top-1/2 transform -translate-y-1/2 w-6 h-6 bg-white/80 rounded-full flex items-center justify-center hover:bg-white transition-colors text-gray-600",
2489
+ children: "\u2039"
2490
+ }
2491
+ ),
2492
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2493
+ "button",
2494
+ {
2495
+ onClick: nextSlide,
2496
+ className: "absolute right-2 top-1/2 transform -translate-y-1/2 w-6 h-6 bg-white/80 rounded-full flex items-center justify-center hover:bg-white transition-colors text-gray-600",
2497
+ children: "\u203A"
2498
+ }
2499
+ ),
2500
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute bottom-3 left-1/2 transform -translate-x-1/2 flex space-x-2", children: slides.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2501
+ "button",
2502
+ {
2503
+ onClick: () => goToSlide(index),
2504
+ className: `w-2 h-2 rounded-full transition-colors ${index === currentSlide ? "bg-red-600" : "bg-white"}`
2505
+ },
2506
+ index
2507
+ )) })
2508
+ ] }),
2509
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-[1] bg-white border border-gray-200 rounded-lg overflow-hidden flex flex-col", children: [
2510
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bg-red-600 text-white px-4 py-2 flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "font-semibold text-sm text-center", children: "Mes alertes" }) }),
2511
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "p-3 space-y-2 flex-1 overflow-y-auto", children: notifications.filter((n) => !n.read).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-center text-gray-500 text-xs", children: "Aucune alerte" }) }) : notifications.filter((n) => !n.read).slice(0, 5).map((notif) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2512
+ "div",
2513
+ {
2514
+ className: "bg-gray-50 border border-gray-200 rounded p-2 cursor-pointer hover:bg-gray-100",
2515
+ onClick: () => markNotificationAsRead(notif.id),
2516
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start space-x-2", children: [
2517
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Bell, { className: "w-3 h-3 text-gray-500 mt-0.5 flex-shrink-0" }),
2518
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 min-w-0", children: [
2519
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h4", { className: "font-medium text-xs text-gray-800 truncate", children: notif.title }),
2520
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-gray-600 line-clamp-1", children: notif.message })
2521
+ ] })
2522
+ ] })
2523
+ },
2524
+ notif.id
2525
+ )) })
2526
+ ] })
2527
+ ] }),
2528
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col lg:flex-row gap-6", children: [
2529
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 bg-white border border-gray-200 rounded-lg p-4 shadow-sm", children: [
2530
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Op\xE9rations" }),
2531
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-3", children: [
2532
+ { name: "WiseConnect", icon: crm_blue_default, iconWhite: crmwhite_default, url: moduleUrls.wiseConnect },
2533
+ { name: "WiseReach", icon: marketingblue_default, iconWhite: marketingblanc_default, url: moduleUrls.wiseReach },
2534
+ { name: "WiseOps", icon: facilityblue_default, iconWhite: facilityblanc_default, url: moduleUrls.wiseOps },
2535
+ { name: "WiseGuard", icon: security_managementblue_default, iconWhite: security_managementblanc_default, url: moduleUrls.wiseGuard }
2536
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2537
+ "button",
2538
+ {
2539
+ onClick: () => {
2540
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2541
+ setShowModulesMenu(false);
2542
+ },
2543
+ className: "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2544
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2545
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2546
+ "img",
2547
+ {
2548
+ src: module2.icon,
2549
+ alt: module2.name,
2550
+ className: "w-12 h-12 mb-2 group-hover:hidden"
2551
+ }
2552
+ ),
2553
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2554
+ "img",
2555
+ {
2556
+ src: module2.iconWhite,
2557
+ alt: module2.name,
2558
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2559
+ }
2560
+ ),
2561
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800 group-hover:text-white", children: module2.name })
2562
+ ] })
2563
+ },
2564
+ module2.name
2565
+ )) })
2566
+ ] }),
2567
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 bg-white border border-gray-200 rounded-lg p-4 shadow-sm", children: [
2568
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Performance" }),
2569
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-3", children: [
2570
+ { name: "WiseThrive", icon: thriveblue_default, iconWhite: thriveblanc_default, url: moduleUrls.wiseThrive },
2571
+ { name: "WiseView", icon: wiseblues_default, iconWhite: wiseblancs_default, url: moduleUrls.wiseView },
2572
+ { name: "WiseProcess", icon: sopblues_default, iconWhite: sopblancs_default, url: moduleUrls.wiseProcess }
2573
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2574
+ "button",
2575
+ {
2576
+ onClick: () => {
2577
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2578
+ setShowModulesMenu(false);
2579
+ },
2580
+ className: "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2581
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2582
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2583
+ "img",
2584
+ {
2585
+ src: module2.icon,
2586
+ alt: module2.name,
2587
+ className: "w-12 h-12 mb-2 group-hover:hidden"
2588
+ }
2589
+ ),
2590
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2591
+ "img",
2592
+ {
2593
+ src: module2.iconWhite,
2594
+ alt: module2.name,
2595
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2596
+ }
2597
+ ),
2598
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800 group-hover:text-white", children: module2.name })
2599
+ ] })
2600
+ },
2601
+ module2.name
2602
+ )) })
2603
+ ] })
2604
+ ] }),
2605
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-white border border-gray-200 rounded-lg p-4 shadow-sm", children: [
2606
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Fonctions Support" }),
2607
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4", children: [
2608
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-[5] bg-gray-50 rounded-lg p-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-5 gap-3", children: [
2609
+ { name: "WiseBill", icon: invoicingblue_default, iconWhite: invoicingblanc_default, url: moduleUrls.wiseBill },
2610
+ { name: "WiseBooks", icon: accountingblue_default, iconWhite: accountingblanc_default, url: moduleUrls.wiseBooks },
2611
+ { name: "WiseAsset", icon: assetblue_default, iconWhite: assetblanc_default, url: moduleUrls.wiseAsset },
2612
+ { name: "WiseCash", icon: financeblue_default, iconWhite: financeblanc_default, url: moduleUrls.wiseCash },
2613
+ { name: "WiseCollect", icon: collection_litigationblue_default, iconWhite: collection_litigationblanc_default, url: moduleUrls.wiseCollect }
2614
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2615
+ "button",
2616
+ {
2617
+ onClick: () => {
2618
+ if (module2.url !== "#") {
2619
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2620
+ }
2621
+ setShowModulesMenu(false);
2622
+ },
2623
+ className: cn(
2624
+ "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2625
+ module2.url === "#" && "opacity-50 cursor-not-allowed hover:bg-gray-100"
2626
+ ),
2627
+ disabled: module2.url === "#",
2628
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2629
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2630
+ "img",
2631
+ {
2632
+ src: module2.icon,
2633
+ alt: module2.name,
2634
+ className: cn("w-12 h-12 mb-2", module2.url !== "#" && "group-hover:hidden")
2635
+ }
2636
+ ),
2637
+ module2.url !== "#" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2638
+ "img",
2639
+ {
2640
+ src: module2.iconWhite,
2641
+ alt: module2.name,
2642
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2643
+ }
2644
+ ),
2645
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn("text-sm font-medium text-gray-800", module2.url !== "#" && "group-hover:text-white"), children: module2.name })
2646
+ ] })
2647
+ },
2648
+ module2.name
2649
+ )) }) }),
2650
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-[2] bg-gray-50 rounded-lg p-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 gap-3", children: [
2651
+ { name: "WiseProcure", icon: procurementblue_default, iconWhite: procurementblanc_default, url: moduleUrls.wiseProcure },
2652
+ { name: "WiseHR", icon: human_capitalblue_default, iconWhite: human_capitalblanc_default, url: moduleUrls.wiseHR }
2653
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2654
+ "button",
2655
+ {
2656
+ onClick: () => {
2657
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2658
+ setShowModulesMenu(false);
2659
+ },
2660
+ className: "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2661
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2662
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2663
+ "img",
2664
+ {
2665
+ src: module2.icon,
2666
+ alt: module2.name,
2667
+ className: "w-12 h-12 mb-2 group-hover:hidden"
2668
+ }
2669
+ ),
2670
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2671
+ "img",
2672
+ {
2673
+ src: module2.iconWhite,
2674
+ alt: module2.name,
2675
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2676
+ }
2677
+ ),
2678
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800 group-hover:text-white", children: module2.name })
2679
+ ] })
2680
+ },
2681
+ module2.name
2682
+ )) }) })
2683
+ ] })
2684
+ ] })
2685
+ ] })
2686
+ }
2687
+ ),
2112
2688
  showApprovalModal && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2113
2689
  Modals_default,
2114
2690
  {
@@ -2132,7 +2708,7 @@ var ModernDoubleSidebarLayout_default = RewiseLayout;
2132
2708
 
2133
2709
  // src/components/ui/Toast.tsx
2134
2710
  var import_react6 = require("react");
2135
- var import_lucide_react3 = require("lucide-react");
2711
+ var import_lucide_react4 = require("lucide-react");
2136
2712
  var import_jsx_runtime10 = require("react/jsx-runtime");
2137
2713
  var ToastItem = ({ toast }) => {
2138
2714
  const { removeToast } = useToast();
@@ -2151,13 +2727,13 @@ var ToastItem = ({ toast }) => {
2151
2727
  const getIcon = () => {
2152
2728
  switch (toast.type) {
2153
2729
  case "success":
2154
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.CheckCircle, { className: "w-5 h-5 text-green-600" });
2730
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle, { className: "w-5 h-5 text-green-600" });
2155
2731
  case "error":
2156
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.XCircle, { className: "w-5 h-5 text-red-600" });
2732
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.XCircle, { className: "w-5 h-5 text-red-600" });
2157
2733
  case "warning":
2158
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.AlertTriangle, { className: "w-5 h-5 text-yellow-600" });
2734
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.AlertTriangle, { className: "w-5 h-5 text-yellow-600" });
2159
2735
  case "info":
2160
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Info, { className: "w-5 h-5 text-blue-600" });
2736
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Info, { className: "w-5 h-5 text-blue-600" });
2161
2737
  }
2162
2738
  };
2163
2739
  const getBackgroundColor = () => {
@@ -2190,7 +2766,7 @@ var ToastItem = ({ toast }) => {
2190
2766
  {
2191
2767
  onClick: handleClose,
2192
2768
  className: "flex-shrink-0 ml-4 text-gray-400 hover:text-gray-600 transition-colors",
2193
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.X, { className: "w-4 h-4" })
2769
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "w-4 h-4" })
2194
2770
  }
2195
2771
  )
2196
2772
  ]
@@ -2204,7 +2780,7 @@ var ToastContainer = () => {
2204
2780
  var Toast_default = ToastContainer;
2205
2781
 
2206
2782
  // src/components/common/Pages.tsx
2207
- var import_lucide_react4 = require("lucide-react");
2783
+ var import_lucide_react5 = require("lucide-react");
2208
2784
  var import_react7 = require("react");
2209
2785
  var import_jsx_runtime11 = require("react/jsx-runtime");
2210
2786
  var Pages = ({
@@ -2239,7 +2815,7 @@ var Pages = ({
2239
2815
  onClick: () => setSidebarOpen(!sidebarOpen),
2240
2816
  className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2241
2817
  "aria-label": sidebarOpen ? "R\xE9duire" : "Ouvrir",
2242
- children: sidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.ChevronLeft, { className: "w-5 h-5" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Menu, { className: "w-5 h-5" })
2818
+ children: sidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.ChevronLeft, { className: "w-5 h-5" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Menu, { className: "w-5 h-5" })
2243
2819
  }
2244
2820
  )
2245
2821
  ] }) }),
@@ -2260,11 +2836,11 @@ var Pages = ({
2260
2836
  ) }),
2261
2837
  sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "p-4 border-t border-[var(--color-border)]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "space-y-2", children: [
2262
2838
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { className: "w-full px-3 py-2 bg-[var(--color-background)] rounded-lg text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] transition-colors flex items-center gap-2", children: [
2263
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Download, { className: "w-4 h-4" }),
2839
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Download, { className: "w-4 h-4" }),
2264
2840
  "Exporter le plan"
2265
2841
  ] }),
2266
2842
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { className: "w-full px-3 py-2 bg-[var(--color-background)] rounded-lg text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] transition-colors flex items-center gap-2", children: [
2267
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Settings, { className: "w-4 h-4" }),
2843
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Settings, { className: "w-4 h-4" }),
2268
2844
  "Configuration"
2269
2845
  ] })
2270
2846
  ] }) })
@@ -2274,19 +2850,363 @@ var Pages = ({
2274
2850
  var Pages_default = Pages;
2275
2851
 
2276
2852
  // src/components/common/FDrawer.tsx
2277
- var import_react8 = require("react");
2853
+ var import_react8 = __toESM(require("react"), 1);
2278
2854
  var import_react_router_dom4 = require("react-router-dom");
2279
- var import_lucide_react5 = require("lucide-react");
2855
+ var import_lucide_react6 = require("lucide-react");
2280
2856
  var import_jsx_runtime12 = require("react/jsx-runtime");
2281
- var FDrawer = ({
2282
- children,
2283
- apiEndpoint,
2284
- columns,
2285
- actions,
2286
- ordering,
2287
- toggle
2857
+ var ExcelImportModal = ({
2858
+ isOpen,
2859
+ onClose,
2860
+ importEndpoint,
2861
+ importFields,
2862
+ onSuccess
2288
2863
  }) => {
2289
- const navigate = (0, import_react_router_dom4.useNavigate)();
2864
+ const { activeBusinessEntity, token } = useSession();
2865
+ const fileInputRef = (0, import_react8.useRef)(null);
2866
+ const [file, setFile] = (0, import_react8.useState)(null);
2867
+ const [columnMapping, setColumnMapping] = (0, import_react8.useState)([]);
2868
+ const [loading, setLoading] = (0, import_react8.useState)(false);
2869
+ const [errors, setErrors] = (0, import_react8.useState)([]);
2870
+ const [importResults, setImportResults] = (0, import_react8.useState)(null);
2871
+ const [currentStep, setCurrentStep] = (0, import_react8.useState)(1);
2872
+ const allFields = [...importFields.required, ...importFields.optional];
2873
+ const handleFileChange = (event) => {
2874
+ const selectedFile = event.target.files?.[0];
2875
+ if (selectedFile) {
2876
+ if (!selectedFile.name.match(/\.(xlsx|xls)$/)) {
2877
+ setErrors(["Veuillez s\xE9lectionner un fichier Excel (.xlsx ou .xls)"]);
2878
+ return;
2879
+ }
2880
+ setFile(selectedFile);
2881
+ setErrors([]);
2882
+ setImportResults(null);
2883
+ setColumnMapping([]);
2884
+ setCurrentStep(2);
2885
+ }
2886
+ };
2887
+ const addMappingRow = () => {
2888
+ const newLetter = String.fromCharCode(65 + columnMapping.length);
2889
+ setColumnMapping([...columnMapping, { letter: newLetter, field: "" }]);
2890
+ };
2891
+ const removeMappingRow = (index) => {
2892
+ setColumnMapping(columnMapping.filter((_, i) => i !== index));
2893
+ };
2894
+ const updateMappingLetter = (index, letter) => {
2895
+ const newMapping = [...columnMapping];
2896
+ newMapping[index].letter = letter.toUpperCase();
2897
+ setColumnMapping(newMapping);
2898
+ };
2899
+ const updateMappingField = (index, field) => {
2900
+ const newMapping = [...columnMapping];
2901
+ newMapping[index].field = field;
2902
+ setColumnMapping(newMapping);
2903
+ };
2904
+ const validateMapping = () => {
2905
+ const mappedFields = columnMapping.map((m) => m.field).filter((f) => f);
2906
+ const requiredFields = importFields.required.map((f) => f.value);
2907
+ const missingRequired = requiredFields.filter((field) => !mappedFields.includes(field));
2908
+ if (missingRequired.length > 0) {
2909
+ const missingLabels = missingRequired.map(
2910
+ (field) => allFields.find((f) => f.value === field)?.label || field
2911
+ );
2912
+ setErrors([`Champs obligatoires manquants : ${missingLabels.join(", ")}`]);
2913
+ return false;
2914
+ }
2915
+ const duplicates = mappedFields.filter(
2916
+ (field, index) => mappedFields.indexOf(field) !== index && field !== ""
2917
+ );
2918
+ if (duplicates.length > 0) {
2919
+ const duplicateLabels = [...new Set(duplicates)].map(
2920
+ (field) => allFields.find((f) => f.value === field)?.label || field
2921
+ );
2922
+ setErrors([`Champs en double : ${duplicateLabels.join(", ")}`]);
2923
+ return false;
2924
+ }
2925
+ setErrors([]);
2926
+ return true;
2927
+ };
2928
+ const executeImport = async () => {
2929
+ if (!validateMapping()) return;
2930
+ if (!file) return;
2931
+ setLoading(true);
2932
+ try {
2933
+ const formData = new FormData();
2934
+ formData.append("excel_file", file);
2935
+ const mapping = {};
2936
+ columnMapping.forEach(({ letter, field }) => {
2937
+ if (field) {
2938
+ mapping[letter] = field;
2939
+ }
2940
+ });
2941
+ formData.append("column_mapping", JSON.stringify(mapping));
2942
+ const response = await fetch(`${API_URL}${importEndpoint}?business_entity_id=${activeBusinessEntity?.id}`, {
2943
+ method: "POST",
2944
+ headers: {
2945
+ "Authorization": `token ${token}`
2946
+ },
2947
+ body: formData
2948
+ });
2949
+ const result = await response.json();
2950
+ if (result.success) {
2951
+ setImportResults(result);
2952
+ setCurrentStep(3);
2953
+ } else {
2954
+ setErrors([result.message?.default || "Erreur lors de l'importation"]);
2955
+ if (result.errors) {
2956
+ const errorMessages = Object.values(result.errors).flat();
2957
+ setErrors((prev) => [...prev, ...errorMessages]);
2958
+ }
2959
+ }
2960
+ } catch (error) {
2961
+ console.error("Erreur:", error);
2962
+ setErrors(["Une erreur est survenue lors de l'importation"]);
2963
+ } finally {
2964
+ setLoading(false);
2965
+ }
2966
+ };
2967
+ const resetModal = () => {
2968
+ setFile(null);
2969
+ setColumnMapping([]);
2970
+ setErrors([]);
2971
+ setImportResults(null);
2972
+ setCurrentStep(1);
2973
+ if (fileInputRef.current) {
2974
+ fileInputRef.current.value = "";
2975
+ }
2976
+ };
2977
+ const handleClose = () => {
2978
+ resetModal();
2979
+ onClose();
2980
+ };
2981
+ const handleSuccess = () => {
2982
+ if (onSuccess) onSuccess();
2983
+ handleClose();
2984
+ };
2985
+ if (!isOpen) return null;
2986
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
2987
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 bg-black/50", onClick: handleClose }),
2988
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative bg-white rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-hidden", children: [
2989
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between p-4 border-b border-gray-200", children: [
2990
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-3", children: [
2991
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.FileSpreadsheet, { className: "h-6 w-6 text-green-600" }),
2992
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { className: "text-lg font-semibold text-gray-800", children: "Importation Excel" }),
2993
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-sm text-gray-500", children: [
2994
+ "\xC9tape ",
2995
+ currentStep,
2996
+ "/3"
2997
+ ] })
2998
+ ] }),
2999
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: handleClose, className: "p-1 hover:bg-gray-100 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { className: "h-5 w-5 text-gray-500" }) })
3000
+ ] }),
3001
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex justify-center py-4 border-b border-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center gap-2", children: [1, 2, 3].map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react8.default.Fragment, { children: [
3002
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(
3003
+ "w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors",
3004
+ currentStep >= step ? "bg-[var(--color-primary)] text-white" : "bg-gray-200 text-gray-500"
3005
+ ), children: currentStep > step ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.CheckCircle2, { className: "h-5 w-5" }) : step }),
3006
+ index < 2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(
3007
+ "w-12 h-1 rounded",
3008
+ currentStep > step ? "bg-[var(--color-primary)]" : "bg-gray-200"
3009
+ ) })
3010
+ ] }, step)) }) }),
3011
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-6 overflow-y-auto max-h-[60vh]", children: [
3012
+ errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-4 p-4 bg-red-50 border border-red-200 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-start gap-2", children: [
3013
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.AlertCircle, { className: "h-5 w-5 text-red-500 mt-0.5" }),
3014
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-red-700", children: error }, index)) })
3015
+ ] }) }),
3016
+ currentStep === 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center py-8", children: [
3017
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.FileSpreadsheet, { className: "h-16 w-16 text-green-500 mx-auto mb-4" }),
3018
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-medium text-gray-800 mb-2", children: "S\xE9lectionner un fichier Excel" }),
3019
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-gray-500 mb-6", children: "Formats accept\xE9s : .xlsx, .xls" }),
3020
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3021
+ "input",
3022
+ {
3023
+ ref: fileInputRef,
3024
+ type: "file",
3025
+ accept: ".xlsx,.xls",
3026
+ onChange: handleFileChange,
3027
+ className: "block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-medium file:bg-[var(--color-primary)] file:text-white hover:file:bg-[var(--color-primary-dark)] cursor-pointer"
3028
+ }
3029
+ ),
3030
+ file && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-4 p-3 bg-blue-50 rounded-lg text-left", children: [
3031
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-sm text-blue-800", children: [
3032
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Fichier s\xE9lectionn\xE9 :" }),
3033
+ " ",
3034
+ file.name
3035
+ ] }),
3036
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-xs text-blue-600", children: [
3037
+ "Taille : ",
3038
+ (file.size / 1024 / 1024).toFixed(2),
3039
+ " MB"
3040
+ ] })
3041
+ ] })
3042
+ ] }),
3043
+ currentStep === 2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
3044
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
3045
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-medium text-gray-800", children: "Configuration du mapping" }),
3046
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3047
+ "button",
3048
+ {
3049
+ type: "button",
3050
+ onClick: addMappingRow,
3051
+ className: "flex items-center gap-1 px-3 py-1.5 bg-[var(--color-primary)] text-white rounded-lg text-sm hover:bg-[var(--color-primary-dark)]",
3052
+ children: [
3053
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Plus, { className: "h-4 w-4" }),
3054
+ " Ajouter"
3055
+ ]
3056
+ }
3057
+ )
3058
+ ] }),
3059
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-4 p-3 bg-amber-50 border border-amber-200 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-sm text-amber-800", children: [
3060
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Instructions :" }),
3061
+ " Associez chaque lettre de colonne Excel au champ correspondant. Les champs marqu\xE9s d'un (*) sont obligatoires."
3062
+ ] }) }),
3063
+ columnMapping.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center py-8", children: [
3064
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-gray-500 mb-4", children: 'Cliquez sur "Ajouter" pour commencer le mapping' }),
3065
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3066
+ "button",
3067
+ {
3068
+ type: "button",
3069
+ onClick: addMappingRow,
3070
+ className: "flex items-center gap-2 mx-auto px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50",
3071
+ children: [
3072
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Plus, { className: "h-4 w-4" }),
3073
+ " Ajouter la premi\xE8re colonne"
3074
+ ]
3075
+ }
3076
+ )
3077
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-3", children: columnMapping.map((mapping, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-3", children: [
3078
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w-20", children: [
3079
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "block text-xs text-gray-500 mb-1", children: "Colonne" }),
3080
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3081
+ "input",
3082
+ {
3083
+ type: "text",
3084
+ value: mapping.letter,
3085
+ onChange: (e) => updateMappingLetter(index, e.target.value),
3086
+ className: "w-full px-3 py-2 border border-gray-300 rounded-lg text-center uppercase",
3087
+ maxLength: 2
3088
+ }
3089
+ )
3090
+ ] }),
3091
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-1", children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "block text-xs text-gray-500 mb-1", children: "Champ correspondant" }),
3093
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3094
+ "select",
3095
+ {
3096
+ value: mapping.field,
3097
+ onChange: (e) => updateMappingField(index, e.target.value),
3098
+ className: "w-full px-3 py-2 border border-gray-300 rounded-lg bg-white",
3099
+ children: [
3100
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "-- S\xE9lectionner un champ --" }),
3101
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("optgroup", { label: "Champs obligatoires", children: importFields.required.map((field) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: field.value, children: field.label }, field.value)) }),
3102
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("optgroup", { label: "Champs optionnels", children: importFields.optional.map((field) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: field.value, children: field.label }, field.value)) })
3103
+ ]
3104
+ }
3105
+ )
3106
+ ] }),
3107
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3108
+ "button",
3109
+ {
3110
+ type: "button",
3111
+ onClick: () => removeMappingRow(index),
3112
+ className: "p-2 text-red-500 hover:bg-red-50 rounded-lg mt-5",
3113
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Trash2, { className: "h-4 w-4" })
3114
+ }
3115
+ )
3116
+ ] }, index)) }),
3117
+ columnMapping.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between mt-6 pt-4 border-t border-gray-200", children: [
3118
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3119
+ "button",
3120
+ {
3121
+ type: "button",
3122
+ onClick: () => setCurrentStep(1),
3123
+ className: "px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg",
3124
+ children: "Retour"
3125
+ }
3126
+ ),
3127
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3128
+ "button",
3129
+ {
3130
+ type: "button",
3131
+ onClick: executeImport,
3132
+ disabled: loading,
3133
+ className: "flex items-center gap-2 px-4 py-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)] disabled:opacity-50",
3134
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3135
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full" }),
3136
+ "Importation..."
3137
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3138
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Upload, { className: "h-4 w-4" }),
3139
+ "Lancer l'importation"
3140
+ ] })
3141
+ }
3142
+ )
3143
+ ] })
3144
+ ] }),
3145
+ currentStep === 3 && importResults && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center py-4", children: [
3146
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.CheckCircle2, { className: "h-16 w-16 text-green-500 mx-auto mb-4" }),
3147
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-medium text-gray-800 mb-6", children: "Importation termin\xE9e !" }),
3148
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-4 gap-4 mb-6", children: [
3149
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-blue-50 rounded-lg", children: [
3150
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-blue-600", children: importResults.results.total_rows }),
3151
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-blue-800", children: "Lignes lues" })
3152
+ ] }),
3153
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-green-50 rounded-lg", children: [
3154
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-green-600", children: importResults.results.saved_rows }),
3155
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-green-800", children: "Import\xE9es" })
3156
+ ] }),
3157
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-amber-50 rounded-lg", children: [
3158
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-amber-600", children: importResults.results.processed_rows - importResults.results.saved_rows }),
3159
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-amber-800", children: "Ignor\xE9es" })
3160
+ ] }),
3161
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-red-50 rounded-lg", children: [
3162
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-red-600", children: importResults.results.errors_count || 0 }),
3163
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-red-800", children: "Erreurs" })
3164
+ ] })
3165
+ ] }),
3166
+ importResults.data?.import_summary?.validation_errors && importResults.data.import_summary.validation_errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg text-left", children: [
3167
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "font-medium text-amber-800 mb-2", children: "Erreurs de validation :" }),
3168
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "text-sm text-amber-700 space-y-1", children: importResults.data.import_summary.validation_errors.slice(0, 5).map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { children: [
3169
+ "Ligne ",
3170
+ error.row,
3171
+ " : ",
3172
+ Object.entries(error.errors).map(
3173
+ ([field, messages]) => `${field}: ${messages.join(", ")}`
3174
+ ).join("; ")
3175
+ ] }, index)) }),
3176
+ importResults.data.import_summary.validation_errors.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-xs text-amber-600 mt-2", children: [
3177
+ "... et ",
3178
+ importResults.data.import_summary.validation_errors.length - 5,
3179
+ " autres erreurs"
3180
+ ] })
3181
+ ] }),
3182
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3183
+ "button",
3184
+ {
3185
+ type: "button",
3186
+ onClick: handleSuccess,
3187
+ className: "px-6 py-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)]",
3188
+ children: "Terminer"
3189
+ }
3190
+ )
3191
+ ] })
3192
+ ] })
3193
+ ] })
3194
+ ] });
3195
+ };
3196
+ var FDrawer = ({
3197
+ children,
3198
+ apiEndpoint,
3199
+ columns,
3200
+ actions,
3201
+ ordering,
3202
+ toggle,
3203
+ importEndpoint,
3204
+ importFields,
3205
+ onBulkDelete,
3206
+ onDuplicate,
3207
+ title
3208
+ }) => {
3209
+ const navigate = (0, import_react_router_dom4.useNavigate)();
2290
3210
  const [searchParams] = (0, import_react_router_dom4.useSearchParams)();
2291
3211
  const location = (0, import_react_router_dom4.useLocation)();
2292
3212
  const allParams = Object.fromEntries([...searchParams]);
@@ -2305,6 +3225,59 @@ var FDrawer = ({
2305
3225
  current_page: null
2306
3226
  });
2307
3227
  const [searchQuery, setSearchQuery] = (0, import_react8.useState)("");
3228
+ const [debouncedSearchQuery, setDebouncedSearchQuery] = (0, import_react8.useState)("");
3229
+ const searchTimeoutRef = (0, import_react8.useRef)(null);
3230
+ const [showFilterPanel, setShowFilterPanel] = (0, import_react8.useState)(false);
3231
+ const filterPanelRef = (0, import_react8.useRef)(null);
3232
+ const [showImportModal, setShowImportModal] = (0, import_react8.useState)(false);
3233
+ const [showMoreOptions, setShowMoreOptions] = (0, import_react8.useState)(false);
3234
+ const moreOptionsRef = (0, import_react8.useRef)(null);
3235
+ const [selectionMode, setSelectionMode] = (0, import_react8.useState)(false);
3236
+ const [selectedItems, setSelectedItems] = (0, import_react8.useState)([]);
3237
+ const [showColumnsPanel, setShowColumnsPanel] = (0, import_react8.useState)(false);
3238
+ const [visibleColumns, setVisibleColumns] = (0, import_react8.useState)(columns.map((c) => c.key));
3239
+ const columnsPanelRef = (0, import_react8.useRef)(null);
3240
+ const [density, setDensity] = (0, import_react8.useState)("normal");
3241
+ const [isFullscreen, setIsFullscreen] = (0, import_react8.useState)(false);
3242
+ const tableContainerRef = (0, import_react8.useRef)(null);
3243
+ (0, import_react8.useEffect)(() => {
3244
+ if (searchTimeoutRef.current) {
3245
+ clearTimeout(searchTimeoutRef.current);
3246
+ }
3247
+ searchTimeoutRef.current = setTimeout(() => {
3248
+ setDebouncedSearchQuery(searchQuery);
3249
+ }, 400);
3250
+ return () => {
3251
+ if (searchTimeoutRef.current) {
3252
+ clearTimeout(searchTimeoutRef.current);
3253
+ }
3254
+ };
3255
+ }, [searchQuery]);
3256
+ (0, import_react8.useEffect)(() => {
3257
+ setFilters((prev) => ({ ...prev, global_search: debouncedSearchQuery, page: 1 }));
3258
+ }, [debouncedSearchQuery]);
3259
+ (0, import_react8.useEffect)(() => {
3260
+ const handleClickOutside = (event) => {
3261
+ if (filterPanelRef.current && !filterPanelRef.current.contains(event.target)) {
3262
+ setShowFilterPanel(false);
3263
+ }
3264
+ if (moreOptionsRef.current && !moreOptionsRef.current.contains(event.target)) {
3265
+ setShowMoreOptions(false);
3266
+ }
3267
+ if (columnsPanelRef.current && !columnsPanelRef.current.contains(event.target)) {
3268
+ setShowColumnsPanel(false);
3269
+ }
3270
+ };
3271
+ document.addEventListener("mousedown", handleClickOutside);
3272
+ return () => document.removeEventListener("mousedown", handleClickOutside);
3273
+ }, []);
3274
+ (0, import_react8.useEffect)(() => {
3275
+ const handleFullscreenChange = () => {
3276
+ setIsFullscreen(!!document.fullscreenElement);
3277
+ };
3278
+ document.addEventListener("fullscreenchange", handleFullscreenChange);
3279
+ return () => document.removeEventListener("fullscreenchange", handleFullscreenChange);
3280
+ }, []);
2308
3281
  const makeFilters = () => columns.reduce((acc, item) => {
2309
3282
  acc[item.formule ? `${item.search_name}__icontains` : `${item.key}__icontains`] = "";
2310
3283
  return acc;
@@ -2334,7 +3307,13 @@ var FDrawer = ({
2334
3307
  }
2335
3308
  };
2336
3309
  (0, import_react8.useEffect)(() => {
2337
- const params = new URLSearchParams(filters).toString();
3310
+ const cleanFilters = {};
3311
+ Object.entries(filters).forEach(([key, value]) => {
3312
+ if (value !== "" && value !== null && value !== void 0) {
3313
+ cleanFilters[key] = String(value);
3314
+ }
3315
+ });
3316
+ const params = new URLSearchParams(cleanFilters).toString();
2338
3317
  setQueryURL(`${API_URL}${apiEndpoint}?${params}`);
2339
3318
  navigate(`${location.pathname}?${params}`);
2340
3319
  }, [filters]);
@@ -2363,116 +3342,456 @@ var FDrawer = ({
2363
3342
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2364
3343
  "input",
2365
3344
  {
2366
- type: "number",
2367
- placeholder: "Min",
2368
- className: "border border-gray-300 rounded-lg p-3 w-1/2",
2369
- onChange: (e) => handleChange(`${column.key}_min`, e.target.value)
3345
+ type: "number",
3346
+ placeholder: "Min",
3347
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3348
+ onChange: (e) => handleChange(`${column.key}_min`, e.target.value)
3349
+ }
3350
+ ),
3351
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3352
+ "input",
3353
+ {
3354
+ type: "number",
3355
+ placeholder: "Max",
3356
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3357
+ onChange: (e) => handleChange(`${column.key}_max`, e.target.value)
3358
+ }
3359
+ )
3360
+ ] });
3361
+ case "date":
3362
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex w-full gap-1", children: [
3363
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3364
+ "input",
3365
+ {
3366
+ type: "date",
3367
+ placeholder: "Du",
3368
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3369
+ onChange: (e) => handleChange(`${column.key}_from`, e.target.value)
3370
+ }
3371
+ ),
3372
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3373
+ "input",
3374
+ {
3375
+ type: "date",
3376
+ placeholder: "Au",
3377
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3378
+ onChange: (e) => handleChange(`${column.key}_to`, e.target.value)
3379
+ }
3380
+ )
3381
+ ] });
3382
+ default:
3383
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3384
+ "input",
3385
+ {
3386
+ id: column.key,
3387
+ type: column.type,
3388
+ className: "border border-gray-300 rounded-md p-1",
3389
+ onChange: (e) => handleChange(column.key, e.target.value)
3390
+ }
3391
+ );
3392
+ }
3393
+ };
3394
+ const renderLine = (item) => columns.map((column) => {
3395
+ let cellContent = column.formule ? column.formule(item) : item[column.key];
3396
+ if (column.type === "date" && item[column.key])
3397
+ cellContent = new Date(item[column.key]).toLocaleDateString();
3398
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: cellContent }, column.key);
3399
+ });
3400
+ const handleExport = async () => {
3401
+ try {
3402
+ const exportParams = new URLSearchParams(filters);
3403
+ exportParams.set("export", "true");
3404
+ exportParams.set("all", "true");
3405
+ const exportURL = `${API_URL}${apiEndpoint}?${exportParams.toString()}`;
3406
+ const response = await fetch(exportURL, {
3407
+ method: "GET",
3408
+ headers: {
3409
+ "Authorization": `token ${token}`
3410
+ }
3411
+ });
3412
+ if (!response.ok) throw new Error("Erreur lors de l'export");
3413
+ const blob = await response.blob();
3414
+ const url = window.URL.createObjectURL(blob);
3415
+ const a = document.createElement("a");
3416
+ a.href = url;
3417
+ a.download = `export_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.xlsx`;
3418
+ document.body.appendChild(a);
3419
+ a.click();
3420
+ window.URL.revokeObjectURL(url);
3421
+ document.body.removeChild(a);
3422
+ } catch (error) {
3423
+ console.error("Erreur export:", error);
3424
+ }
3425
+ };
3426
+ const handlePrint = () => {
3427
+ const printContent = document.getElementById("fdrawer-table");
3428
+ if (!printContent) return;
3429
+ const printWindow = window.open("", "_blank");
3430
+ if (!printWindow) return;
3431
+ printWindow.document.write(`
3432
+ <html>
3433
+ <head>
3434
+ <title>Impression</title>
3435
+ <style>
3436
+ body { font-family: Arial, sans-serif; padding: 20px; }
3437
+ table { width: 100%; border-collapse: collapse; }
3438
+ th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
3439
+ th { background-color: #f5f5f5; font-weight: bold; }
3440
+ tr:nth-child(even) { background-color: #fafafa; }
3441
+ @media print {
3442
+ @page { margin: 1cm; }
3443
+ }
3444
+ </style>
3445
+ </head>
3446
+ <body>
3447
+ ${printContent.outerHTML}
3448
+ </body>
3449
+ </html>
3450
+ `);
3451
+ printWindow.document.close();
3452
+ printWindow.print();
3453
+ };
3454
+ const resetFilters = () => {
3455
+ const cleanFilters = {
3456
+ ...makeFilters(),
3457
+ business_entity_id: activeBusinessEntity?.id ?? null,
3458
+ order_by: order_by ?? "id",
3459
+ page: 1,
3460
+ global_search: ""
3461
+ };
3462
+ setFilters(cleanFilters);
3463
+ setSearchQuery("");
3464
+ setShowFilterPanel(false);
3465
+ };
3466
+ const getActiveFiltersCount = () => {
3467
+ let count = 0;
3468
+ Object.entries(filters).forEach(([key, value]) => {
3469
+ if (value && key !== "business_entity_id" && key !== "order_by" && key !== "page" && key !== "global_search") {
3470
+ count++;
3471
+ }
3472
+ });
3473
+ return count;
3474
+ };
3475
+ const activeFiltersCount = getActiveFiltersCount();
3476
+ const toggleSelectItem = (id) => {
3477
+ setSelectedItems(
3478
+ (prev) => prev.includes(id) ? prev.filter((i) => i !== id) : [...prev, id]
3479
+ );
3480
+ };
3481
+ const toggleSelectAll = () => {
3482
+ if (selectedItems.length === data.length) {
3483
+ setSelectedItems([]);
3484
+ } else {
3485
+ setSelectedItems(data.map((item) => item.id));
3486
+ }
3487
+ };
3488
+ const clearSelection = () => {
3489
+ setSelectedItems([]);
3490
+ setSelectionMode(false);
3491
+ };
3492
+ const handleBulkDelete = async () => {
3493
+ if (!onBulkDelete || selectedItems.length === 0) return;
3494
+ if (confirm(`Voulez-vous vraiment supprimer ${selectedItems.length} \xE9l\xE9ment(s) ?`)) {
3495
+ try {
3496
+ await onBulkDelete(selectedItems);
3497
+ clearSelection();
3498
+ getDataFilter();
3499
+ } catch (error) {
3500
+ console.error("Erreur lors de la suppression group\xE9e:", error);
3501
+ }
3502
+ }
3503
+ };
3504
+ const handleDuplicate = async (item) => {
3505
+ if (!onDuplicate) return;
3506
+ try {
3507
+ await onDuplicate(item);
3508
+ getDataFilter();
3509
+ } catch (error) {
3510
+ console.error("Erreur lors de la duplication:", error);
3511
+ }
3512
+ };
3513
+ const toggleColumnVisibility = (key) => {
3514
+ setVisibleColumns(
3515
+ (prev) => prev.includes(key) ? prev.filter((k) => k !== key) : [...prev, key]
3516
+ );
3517
+ };
3518
+ const toggleFullscreen = () => {
3519
+ if (!tableContainerRef.current) return;
3520
+ if (!document.fullscreenElement) {
3521
+ tableContainerRef.current.requestFullscreen();
3522
+ } else {
3523
+ document.exitFullscreen();
3524
+ }
3525
+ };
3526
+ const getDensityClasses = () => {
3527
+ switch (density) {
3528
+ case "compact":
3529
+ return { cell: "px-3 py-1", text: "text-xs" };
3530
+ case "comfortable":
3531
+ return { cell: "px-8 py-5", text: "text-base" };
3532
+ default:
3533
+ return { cell: "px-6 py-4", text: "text-sm" };
3534
+ }
3535
+ };
3536
+ const densityClasses = getDensityClasses();
3537
+ const visibleColumnsData = columns.filter((col) => visibleColumns.includes(col.key));
3538
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3539
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-4 mb-4", children: [
3540
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-1 min-w-64", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
3541
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" }),
3542
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3543
+ "input",
3544
+ {
3545
+ type: "text",
3546
+ placeholder: "Rechercher sur tous les champs...",
3547
+ className: "w-full pl-10 pr-10 py-2 border border-[#d1d7de] rounded-lg focus:ring-2 focus:ring-[#78a6d2] focus:border-transparent",
3548
+ value: searchQuery,
3549
+ onChange: (e) => setSearchQuery(e.target.value)
3550
+ }
3551
+ ),
3552
+ searchQuery && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3553
+ "button",
3554
+ {
3555
+ type: "button",
3556
+ onClick: () => setSearchQuery(""),
3557
+ className: "absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",
3558
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { className: "h-4 w-4" })
3559
+ }
3560
+ )
3561
+ ] }) }),
3562
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", ref: filterPanelRef, children: [
3563
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: () => setShowFilterPanel(!showFilterPanel), type: "button", children: [
3564
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Filter, { className: "h-4 w-4 mr-2" }),
3565
+ "Filtres",
3566
+ activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-2 bg-white text-[var(--color-primary)] rounded-full px-2 py-0.5 text-xs font-bold", children: activeFiltersCount }),
3567
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ChevronDown, { className: cn("h-4 w-4 ml-1 transition-transform", showFilterPanel && "rotate-180") })
3568
+ ] }),
3569
+ showFilterPanel && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "absolute right-0 mt-2 w-[400px] bg-white rounded-lg shadow-xl border border-gray-200 z-50 max-h-[70vh] overflow-y-auto", children: [
3570
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 border-b border-gray-200 flex items-center justify-between", children: [
3571
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "font-semibold text-gray-800", children: "Filtres avanc\xE9s" }),
3572
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3573
+ "button",
3574
+ {
3575
+ type: "button",
3576
+ onClick: resetFilters,
3577
+ className: "text-sm text-blue-600 hover:text-blue-800",
3578
+ children: "R\xE9initialiser"
3579
+ }
3580
+ )
3581
+ ] }),
3582
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-4 space-y-4", children: columns.filter((col) => col.filterable).map((column) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-1", children: [
3583
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "block text-sm font-medium text-gray-700", children: column.label }),
3584
+ renderColumnFilter(column)
3585
+ ] }, column.key)) }),
3586
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-4 border-t border-gray-200 flex justify-end gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3587
+ "button",
3588
+ {
3589
+ type: "button",
3590
+ onClick: () => setShowFilterPanel(false),
3591
+ className: "px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg",
3592
+ children: "Fermer"
3593
+ }
3594
+ ) })
3595
+ ] })
3596
+ ] }),
3597
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: handleExport, type: "button", children: [
3598
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Download, { className: "h-4 w-4 mr-2" }),
3599
+ "Exporter"
3600
+ ] }),
3601
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: handlePrint, type: "button", children: [
3602
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Printer, { className: "h-4 w-4 mr-2" }),
3603
+ "Imprimer"
3604
+ ] }),
3605
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", ref: moreOptionsRef, children: [
3606
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: () => setShowMoreOptions(!showMoreOptions), type: "button", children: [
3607
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Settings2, { className: "h-4 w-4 mr-2" }),
3608
+ "Plus",
3609
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ChevronDown, { className: cn("h-4 w-4 ml-1 transition-transform", showMoreOptions && "rotate-180") })
3610
+ ] }),
3611
+ showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-xl border border-gray-200 z-50 py-2", children: [
3612
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3613
+ "button",
3614
+ {
3615
+ type: "button",
3616
+ onClick: () => {
3617
+ getDataFilter();
3618
+ setShowMoreOptions(false);
3619
+ },
3620
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
3621
+ children: [
3622
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.RefreshCw, { className: "h-4 w-4" }),
3623
+ "Actualiser les donn\xE9es"
3624
+ ]
3625
+ }
3626
+ ),
3627
+ importEndpoint && importFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3628
+ "button",
3629
+ {
3630
+ type: "button",
3631
+ onClick: () => {
3632
+ setShowImportModal(true);
3633
+ setShowMoreOptions(false);
3634
+ },
3635
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
3636
+ children: [
3637
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Upload, { className: "h-4 w-4" }),
3638
+ "Importer depuis Excel"
3639
+ ]
3640
+ }
3641
+ ),
3642
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-2" }),
3643
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3644
+ "button",
3645
+ {
3646
+ type: "button",
3647
+ onClick: () => {
3648
+ setSelectionMode(!selectionMode);
3649
+ setShowMoreOptions(false);
3650
+ },
3651
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
3652
+ children: [
3653
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.SquareIcon, { className: "h-4 w-4" }),
3654
+ selectionMode ? "D\xE9sactiver la s\xE9lection" : "Mode s\xE9lection multiple"
3655
+ ]
2370
3656
  }
2371
3657
  ),
2372
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2373
- "input",
3658
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3659
+ "button",
2374
3660
  {
2375
- type: "number",
2376
- placeholder: "Max",
2377
- className: "border border-gray-300 rounded-lg p-3 w-1/2",
2378
- onChange: (e) => handleChange(`${column.key}_max`, e.target.value)
3661
+ type: "button",
3662
+ onClick: () => {
3663
+ setShowColumnsPanel(true);
3664
+ setShowMoreOptions(false);
3665
+ },
3666
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
3667
+ children: [
3668
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Columns3, { className: "h-4 w-4" }),
3669
+ "G\xE9rer les colonnes"
3670
+ ]
3671
+ }
3672
+ ),
3673
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-2" }),
3674
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "px-4 py-2", children: [
3675
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs font-medium text-gray-500 mb-2", children: "Densit\xE9 d'affichage" }),
3676
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex gap-1", children: ["compact", "normal", "comfortable"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3677
+ "button",
3678
+ {
3679
+ type: "button",
3680
+ onClick: () => setDensity(mode),
3681
+ className: cn(
3682
+ "flex-1 px-2 py-1 text-xs rounded transition-colors",
3683
+ density === mode ? "bg-[var(--color-primary)] text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200"
3684
+ ),
3685
+ children: mode === "compact" ? "Compact" : mode === "normal" ? "Normal" : "Large"
3686
+ },
3687
+ mode
3688
+ )) })
3689
+ ] }),
3690
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-2" }),
3691
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3692
+ "button",
3693
+ {
3694
+ type: "button",
3695
+ onClick: () => {
3696
+ toggleFullscreen();
3697
+ setShowMoreOptions(false);
3698
+ },
3699
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
3700
+ children: [
3701
+ isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Minimize2, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Maximize2, { className: "h-4 w-4" }),
3702
+ isFullscreen ? "Quitter le plein \xE9cran" : "Plein \xE9cran"
3703
+ ]
2379
3704
  }
2380
3705
  )
2381
- ] });
2382
- case "date":
2383
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex w-full gap-1", children: [
3706
+ ] })
3707
+ ] })
3708
+ ] }),
3709
+ showColumnsPanel && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
3710
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 bg-black/30", onClick: () => setShowColumnsPanel(false) }),
3711
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative bg-white rounded-xl shadow-2xl w-full max-w-md", ref: columnsPanelRef, children: [
3712
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between p-4 border-b border-gray-200", children: [
3713
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "font-semibold text-gray-800", children: "Colonnes visibles" }),
3714
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: () => setShowColumnsPanel(false), className: "p-1 hover:bg-gray-100 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { className: "h-5 w-5 text-gray-500" }) })
3715
+ ] }),
3716
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-4 max-h-[60vh] overflow-y-auto", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "flex items-center gap-3 py-2 cursor-pointer hover:bg-gray-50 px-2 rounded", children: [
2384
3717
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2385
3718
  "input",
2386
3719
  {
2387
- type: "date",
2388
- placeholder: "Du",
2389
- className: "border border-gray-300 rounded-lg p-3 w-1/2",
2390
- onChange: (e) => handleChange(`${column.key}_from`, e.target.value)
3720
+ type: "checkbox",
3721
+ checked: visibleColumns.includes(column.key),
3722
+ onChange: () => toggleColumnVisibility(column.key),
3723
+ className: "w-4 h-4 text-[var(--color-primary)] rounded border-gray-300"
2391
3724
  }
2392
3725
  ),
3726
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-sm text-gray-700", children: column.label })
3727
+ ] }, column.key)) }),
3728
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 border-t border-gray-200 flex justify-between", children: [
2393
3729
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2394
- "input",
3730
+ "button",
2395
3731
  {
2396
- type: "date",
2397
- placeholder: "Au",
2398
- className: "border border-gray-300 rounded-lg p-3 w-1/2",
2399
- onChange: (e) => handleChange(`${column.key}_to`, e.target.value)
3732
+ type: "button",
3733
+ onClick: () => setVisibleColumns(columns.map((c) => c.key)),
3734
+ className: "text-sm text-blue-600 hover:text-blue-800",
3735
+ children: "Tout afficher"
3736
+ }
3737
+ ),
3738
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3739
+ "button",
3740
+ {
3741
+ type: "button",
3742
+ onClick: () => setShowColumnsPanel(false),
3743
+ className: "px-4 py-2 bg-[var(--color-primary)] text-white rounded-lg text-sm",
3744
+ children: "Fermer"
2400
3745
  }
2401
3746
  )
2402
- ] });
2403
- default:
2404
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2405
- "input",
3747
+ ] })
3748
+ ] })
3749
+ ] }),
3750
+ selectionMode && selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg flex items-center justify-between", children: [
3751
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-sm font-medium text-blue-800", children: [
3752
+ selectedItems.length,
3753
+ " \xE9l\xE9ment(s) s\xE9lectionn\xE9(s)"
3754
+ ] }) }),
3755
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
3756
+ onBulkDelete && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3757
+ "button",
2406
3758
  {
2407
- id: column.key,
2408
- type: column.type,
2409
- className: "border border-gray-300 rounded-md p-1",
2410
- onChange: (e) => handleChange(column.key, e.target.value)
3759
+ type: "button",
3760
+ onClick: handleBulkDelete,
3761
+ className: "px-3 py-1.5 bg-red-500 text-white rounded-lg text-sm flex items-center gap-2 hover:bg-red-600",
3762
+ children: [
3763
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Trash2, { className: "h-4 w-4" }),
3764
+ "Supprimer"
3765
+ ]
2411
3766
  }
2412
- );
2413
- }
2414
- };
2415
- const renderLine = (item) => columns.map((column) => {
2416
- let cellContent = column.formule ? column.formule(item) : item[column.key];
2417
- if (column.type === "date" && item[column.key])
2418
- cellContent = new Date(item[column.key]).toLocaleDateString();
2419
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: cellContent }, column.key);
2420
- });
2421
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2422
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-4", children: [
2423
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-1 min-w-64", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
2424
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" }),
3767
+ ),
2425
3768
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2426
- "input",
3769
+ "button",
2427
3770
  {
2428
- type: "text",
2429
- placeholder: "Rechercher une demande...",
2430
- className: "w-full pl-10 pr-4 py-2 border border-[#d1d7de] rounded-lg focus:ring-2 focus:ring-[#78a6d2] focus:border-transparent",
2431
- value: searchQuery,
2432
- onChange: (e) => setSearchQuery(e.target.value)
3771
+ type: "button",
3772
+ onClick: clearSelection,
3773
+ className: "px-3 py-1.5 bg-gray-200 text-gray-700 rounded-lg text-sm hover:bg-gray-300",
3774
+ children: "Annuler"
2433
3775
  }
2434
3776
  )
2435
- ] }) }),
2436
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2437
- Buttons_default,
2438
- {
2439
- onClick: () => {
2440
- },
2441
- children: [
2442
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Filter, { className: "h-4 w-4 mr-2" }),
2443
- "Filtres"
2444
- ]
2445
- }
2446
- ),
2447
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2448
- Buttons_default,
2449
- {
2450
- onClick: () => {
2451
- },
2452
- children: [
2453
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Download, { className: "h-4 w-4 mr-2" }),
2454
- "Exporter"
2455
- ]
2456
- }
2457
- ),
2458
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2459
- Buttons_default,
2460
- {
2461
- onClick: () => {
2462
- },
2463
- children: [
2464
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Printer, { className: "h-4 w-4 mr-2" }),
2465
- "Imprimer"
2466
- ]
2467
- }
2468
- )
3777
+ ] })
2469
3778
  ] }),
2470
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: "w-full", children: [
3779
+ loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--color-primary)]" }) }),
3780
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: tableContainerRef, className: cn("bg-white", isFullscreen && "p-4"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { id: "fdrawer-table", className: "w-full", children: [
2471
3781
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "bg-gray-50", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { children: [
2472
- columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("th", { className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider relative", scope: "col", children: [
3782
+ selectionMode && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: cn(densityClasses.cell, "text-left text-xs font-medium text-gray-500 uppercase tracking-wider"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3783
+ "input",
3784
+ {
3785
+ type: "checkbox",
3786
+ checked: selectedItems.length === data.length && data.length > 0,
3787
+ onChange: toggleSelectAll,
3788
+ className: "w-4 h-4 text-[var(--color-primary)] rounded border-gray-300"
3789
+ }
3790
+ ) }),
3791
+ visibleColumnsData.map((column) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("th", { className: cn(densityClasses.cell, "text-left text-xs font-medium text-gray-500 uppercase tracking-wider relative"), scope: "col", children: [
2473
3792
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex align-center items-center gap-2", children: [
2474
3793
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { onClick: () => setShowFilters(showFilters === column.key ? "" : column.key), children: column.label }),
2475
- column.sortable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
3794
+ column.sortable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
2476
3795
  ] }),
2477
3796
  showOrdering === column.key && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute left-6 mt-2 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-80 overflow-y-auto", role: "menu", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-2", children: [
2478
3797
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2487,7 +3806,7 @@ var FDrawer = ({
2487
3806
  className: cn("w-full flex items-center gap-3 px-3 py-1 border-b rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors", order_by === column.key && "bg-[var(--color-primary-light)]"),
2488
3807
  role: "menuitem",
2489
3808
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-left flex-1 flex items-center gap-2", children: [
2490
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ArrowUpAZ, { className: "h-4 w-4" }),
3809
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ArrowUpAZ, { className: "h-4 w-4" }),
2491
3810
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: cn("text-sm font-medium", order_by === column.key ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"), children: "Croissant" })
2492
3811
  ] })
2493
3812
  }
@@ -2504,7 +3823,7 @@ var FDrawer = ({
2504
3823
  className: cn("w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors", order_by === `-${column.key}` && "bg-[var(--color-primary-light)]"),
2505
3824
  role: "menuitem",
2506
3825
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-left flex-1 flex items-center gap-2", children: [
2507
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ArrowDownAZ, { className: "h-4 w-4" }),
3826
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ArrowDownAZ, { className: "h-4 w-4" }),
2508
3827
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: cn("text-sm font-medium", order_by === `-${column.key}` ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"), children: "D\xE9croissant" })
2509
3828
  ] })
2510
3829
  }
@@ -2515,30 +3834,86 @@ var FDrawer = ({
2515
3834
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "pb-3 px-4", children: renderColumnFilter(column) })
2516
3835
  ] })
2517
3836
  ] }, column.key)),
2518
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider" })
3837
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: cn(densityClasses.cell, "text-left text-xs font-medium text-gray-500 uppercase tracking-wider") })
2519
3838
  ] }) }),
2520
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "bg-white divide-y divide-gray-200", children: data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { className: "hover:bg-gray-50 cursor-pointer", children: [
2521
- renderLine(item),
2522
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-right text-sm font-medium", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
2523
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2524
- "button",
2525
- {
2526
- type: "button",
2527
- onClick: () => setDropdownOpen(dropdownOpen === item.id ? null : item.id),
2528
- className: "p-1 rounded-full hover:bg-gray-100 transition-colors",
2529
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.MoreVertical, { className: "w-4 h-4 text-gray-400" })
2530
- }
3839
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "bg-white divide-y divide-gray-200", children: data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3840
+ "tr",
3841
+ {
3842
+ className: cn(
3843
+ "hover:bg-gray-50 cursor-pointer",
3844
+ selectionMode && selectedItems.includes(item.id) && "bg-blue-50"
2531
3845
  ),
2532
- dropdownOpen === item.id && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "fixed right-3 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-10", children: actions.map(
2533
- (action, index) => action.navigate ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_router_dom4.Link, { to: action.navigate, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { onClick: () => {
2534
- action.onclick(item);
2535
- setDropdownOpen(null);
2536
- }, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index)
2537
- ) })
2538
- ] }) })
2539
- ] }, item.id)) })
2540
- ] }),
2541
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pagination, { reponseDetail, setQueryURL, filters: [filters, setFilters] })
3846
+ children: [
3847
+ selectionMode && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: cn(densityClasses.cell, "whitespace-nowrap", densityClasses.text, "text-gray-500"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3848
+ "input",
3849
+ {
3850
+ type: "checkbox",
3851
+ checked: selectedItems.includes(item.id),
3852
+ onChange: () => toggleSelectItem(item.id),
3853
+ className: "w-4 h-4 text-[var(--color-primary)] rounded border-gray-300"
3854
+ }
3855
+ ) }),
3856
+ visibleColumnsData.map((column) => {
3857
+ let cellContent = column.formule ? column.formule(item) : item[column.key];
3858
+ if (column.type === "date" && item[column.key])
3859
+ cellContent = new Date(item[column.key]).toLocaleDateString();
3860
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: cn(densityClasses.cell, "whitespace-nowrap", densityClasses.text, "text-gray-500"), children: cellContent }, column.key);
3861
+ }),
3862
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: cn(densityClasses.cell, "whitespace-nowrap text-right", densityClasses.text, "font-medium"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
3863
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3864
+ "button",
3865
+ {
3866
+ type: "button",
3867
+ onClick: () => setDropdownOpen(dropdownOpen === item.id ? null : item.id),
3868
+ className: "p-1 rounded-full hover:bg-gray-100 transition-colors",
3869
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.MoreVertical, { className: "w-4 h-4 text-gray-400" })
3870
+ }
3871
+ ),
3872
+ dropdownOpen === item.id && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fixed right-3 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-10", children: [
3873
+ actions.map(
3874
+ (action, index) => action.navigate ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_router_dom4.Link, { to: action.navigate, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { onClick: () => {
3875
+ action.onclick && action.onclick(item);
3876
+ setDropdownOpen(null);
3877
+ }, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index)
3878
+ ),
3879
+ onDuplicate && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3880
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-1" }),
3881
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3882
+ "button",
3883
+ {
3884
+ onClick: () => {
3885
+ handleDuplicate(item);
3886
+ setDropdownOpen(null);
3887
+ },
3888
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2",
3889
+ children: [
3890
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Copy, { className: "h-4 w-4" }),
3891
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "Dupliquer" })
3892
+ ]
3893
+ }
3894
+ )
3895
+ ] })
3896
+ ] })
3897
+ ] }) })
3898
+ ]
3899
+ },
3900
+ item.id
3901
+ )) })
3902
+ ] }) }),
3903
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pagination, { reponseDetail, setQueryURL, filters: [filters, setFilters] }),
3904
+ importEndpoint && importFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3905
+ ExcelImportModal,
3906
+ {
3907
+ isOpen: showImportModal,
3908
+ onClose: () => setShowImportModal(false),
3909
+ importEndpoint,
3910
+ importFields,
3911
+ onSuccess: () => {
3912
+ setShowImportModal(false);
3913
+ getDataFilter();
3914
+ }
3915
+ }
3916
+ )
2542
3917
  ] });
2543
3918
  };
2544
3919
  var Pagination = ({
@@ -2615,7 +3990,7 @@ var import_react10 = require("react");
2615
3990
 
2616
3991
  // src/components/common/SearchableSelect.tsx
2617
3992
  var import_react9 = require("react");
2618
- var import_lucide_react6 = require("lucide-react");
3993
+ var import_lucide_react7 = require("lucide-react");
2619
3994
  var import_jsx_runtime13 = require("react/jsx-runtime");
2620
3995
  var SearchableSelect = ({
2621
3996
  options,
@@ -2700,11 +4075,11 @@ var SearchableSelect = ({
2700
4075
  onClick: handleClear,
2701
4076
  className: "text-gray-400 hover:text-gray-600",
2702
4077
  type: "button",
2703
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.X, { size: 16 })
4078
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.X, { size: 16 })
2704
4079
  }
2705
4080
  ),
2706
4081
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2707
- import_lucide_react6.ChevronDown,
4082
+ import_lucide_react7.ChevronDown,
2708
4083
  {
2709
4084
  size: 16,
2710
4085
  className: `text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
@@ -2717,7 +4092,7 @@ var SearchableSelect = ({
2717
4092
  isOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg", children: [
2718
4093
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "p-3 border-b border-gray-200 flex", children: [
2719
4094
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative w-full", children: [
2720
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" }),
4095
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" }),
2721
4096
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2722
4097
  "input",
2723
4098
  {
@@ -2738,7 +4113,7 @@ var SearchableSelect = ({
2738
4113
  disabled,
2739
4114
  className: "px-3 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
2740
4115
  title: "Rafra\xEEchir la liste",
2741
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.RefreshCw, { className: `w-4 h-4 ${disabled ? "animate-spin" : ""}` })
4116
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.RefreshCw, { className: `w-4 h-4 ${disabled ? "animate-spin" : ""}` })
2742
4117
  }
2743
4118
  ),
2744
4119
  addElement && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -2748,7 +4123,7 @@ var SearchableSelect = ({
2748
4123
  onClick: addElement,
2749
4124
  className: "px-3 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
2750
4125
  title: "Rafra\xEEchir la liste",
2751
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.Plus, { className: "w-4 h-4" })
4126
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Plus, { className: "w-4 h-4" })
2752
4127
  }
2753
4128
  )
2754
4129
  ] }),
@@ -2776,7 +4151,7 @@ var SearchableSelect = ({
2776
4151
  };
2777
4152
 
2778
4153
  // src/components/common/ApprovalWorkflow.tsx
2779
- var import_lucide_react7 = require("lucide-react");
4154
+ var import_lucide_react8 = require("lucide-react");
2780
4155
  var import_jsx_runtime14 = require("react/jsx-runtime");
2781
4156
  var ApprovalWorkflow = ({
2782
4157
  process,
@@ -3080,7 +4455,7 @@ var ApprovalWorkflow = ({
3080
4455
  )
3081
4456
  ] }),
3082
4457
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "overflow-x-auto", children: stages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "text-center py-6 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
3083
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Users, { className: "w-8 h-8 text-[#767676] mx-auto mb-4" }),
4458
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Users, { className: "w-8 h-8 text-[#767676] mx-auto mb-4" }),
3084
4459
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-lg font-medium text-[#191919] mb-2", children: "Aucune personne ajout\xE9e" }),
3085
4460
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[#767676] mb-4", children: 'Cliquez sur le bouton "Ajouter une personne" pour commencer' })
3086
4461
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "w-full border-collapse", children: [
@@ -3112,7 +4487,7 @@ var ApprovalWorkflow = ({
3112
4487
  ] });
3113
4488
  };
3114
4489
  if (loading) {
3115
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RewiseBasicCard, { title, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) });
4490
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RewiseBasicCard, { title, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) });
3116
4491
  }
3117
4492
  const renderTabContent = () => {
3118
4493
  switch (activeTab) {
@@ -3139,7 +4514,7 @@ var ApprovalWorkflow = ({
3139
4514
  type: "button",
3140
4515
  classname: "flex items-center gap-2",
3141
4516
  children: [
3142
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Ban, { className: "w-4 h-4" }),
4517
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Ban, { className: "w-4 h-4" }),
3143
4518
  canceling ? "Annulation..." : "Annuler la demande"
3144
4519
  ]
3145
4520
  }
@@ -3152,7 +4527,7 @@ var ApprovalWorkflow = ({
3152
4527
  type: "button",
3153
4528
  classname: "flex items-center gap-2",
3154
4529
  children: [
3155
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.RotateCcw, { className: "w-4 h-4" }),
4530
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.RotateCcw, { className: "w-4 h-4" }),
3156
4531
  restarting ? "Red\xE9marrage..." : "Recommencer"
3157
4532
  ]
3158
4533
  }
@@ -3191,15 +4566,15 @@ var ApprovalWorkflow = ({
3191
4566
  dangerouslySetInnerHTML: { __html: caseData.html_content }
3192
4567
  }
3193
4568
  ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "text-center py-12 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
3194
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Eye, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
4569
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Eye, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
3195
4570
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[#767676]", children: "Aucun aper\xE7u disponible" })
3196
4571
  ] })
3197
4572
  ] }) });
3198
4573
  case "history":
3199
4574
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-6", children: [
3200
4575
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-lg font-semibold text-[#191919]", children: "Historique des versions" }),
3201
- loadingHistory ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) : history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "text-center py-12 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
3202
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.History, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
4576
+ loadingHistory ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Loader, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) : history.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "text-center py-12 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
4577
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.History, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
3203
4578
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[#767676]", children: "Aucun historique disponible" })
3204
4579
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "space-y-4", children: history.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "border border-[#D9D9D9] rounded-lg p-4 bg-white hover:shadow-md transition-shadow", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex-1", children: [
3205
4580
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [
@@ -3289,7 +4664,7 @@ var ApprovalWorkflow = ({
3289
4664
  onClick: () => setActiveTab("workflow"),
3290
4665
  className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "workflow" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
3291
4666
  children: [
3292
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.FileText, { className: "w-4 h-4" }),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.FileText, { className: "w-4 h-4" }),
3293
4668
  "Workflow"
3294
4669
  ]
3295
4670
  }
@@ -3300,7 +4675,7 @@ var ApprovalWorkflow = ({
3300
4675
  onClick: () => setActiveTab("preview"),
3301
4676
  className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "preview" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
3302
4677
  children: [
3303
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Eye, { className: "w-4 h-4" }),
4678
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Eye, { className: "w-4 h-4" }),
3304
4679
  "Aper\xE7u"
3305
4680
  ]
3306
4681
  }
@@ -3311,7 +4686,7 @@ var ApprovalWorkflow = ({
3311
4686
  onClick: () => setActiveTab("history"),
3312
4687
  className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "history" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
3313
4688
  children: [
3314
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.History, { className: "w-4 h-4" }),
4689
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.History, { className: "w-4 h-4" }),
3315
4690
  "Historique"
3316
4691
  ]
3317
4692
  }
@@ -3336,7 +4711,7 @@ var ApprovalWorkflow = ({
3336
4711
  {
3337
4712
  className: "text-gray-500 hover:text-[#6A8A82] transition-colors",
3338
4713
  onClick: () => window.history.back(),
3339
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.X, { className: "w-5 h-5" })
4714
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.X, { className: "w-5 h-5" })
3340
4715
  }
3341
4716
  )
3342
4717
  ] }),
@@ -3391,7 +4766,7 @@ var StageRow = ({
3391
4766
  onClick: onRemove,
3392
4767
  className: "text-[#B85450] hover:text-red-700 transition-colors",
3393
4768
  title: "Supprimer",
3394
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Trash2, { className: "w-4 h-4" })
4769
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Trash2, { className: "w-4 h-4" })
3395
4770
  }
3396
4771
  ) }),
3397
4772
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "border border-gray-300 px-4 py-2 text-center", children: index + 1 }),
@@ -3513,7 +4888,7 @@ var AddStageButton = ({
3513
4888
  onClick: () => setShowModal(true),
3514
4889
  classname: "gap-2",
3515
4890
  children: [
3516
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Plus, { className: "w-4 h-4" }),
4891
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Plus, { className: "w-4 h-4" }),
3517
4892
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Ajouter une personne" })
3518
4893
  ]
3519
4894
  }
@@ -3757,29 +5132,7 @@ var useAlert = () => {
3757
5132
  };
3758
5133
 
3759
5134
  // src/components/common/CommonSelect.tsx
3760
- var import_react76 = require("react");
3761
-
3762
- // src/services/VendorServices.ts
3763
- var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
3764
- var VendorServices = {
3765
- createVendor: (data, token) => {
3766
- const payload = { ...data };
3767
- if (!payload.logo) {
3768
- delete payload.logo;
3769
- }
3770
- return FetchApi.post(`${VENDORS_API_URL}`, payload, token);
3771
- },
3772
- getVendor: (id, token) => FetchApi.get(`${VENDORS_API_URL}${id}/`, token),
3773
- getVendors: (token, params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`, token),
3774
- updateVendor: (id, data, token) => {
3775
- const payload = { ...data };
3776
- if (!payload.logo) {
3777
- delete payload.logo;
3778
- }
3779
- return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload, token);
3780
- },
3781
- deleteVendor: (id, token) => FetchApi.delete(`${VENDORS_API_URL}${id}/`, token)
3782
- };
5135
+ var import_react102 = require("react");
3783
5136
 
3784
5137
  // dist/index.js
3785
5138
  var import_jsx_runtime17 = require("react/jsx-runtime");
@@ -3788,7 +5141,7 @@ var import_react_router_dom5 = require("react-router-dom");
3788
5141
  var import_jsx_runtime19 = require("react/jsx-runtime");
3789
5142
  var import_react12 = __toESM(require("react"), 1);
3790
5143
  var import_react_router_dom6 = require("react-router-dom");
3791
- var import_lucide_react8 = require("lucide-react");
5144
+ var import_lucide_react9 = require("lucide-react");
3792
5145
  var import_clsx2 = require("clsx");
3793
5146
  var import_tailwind_merge2 = require("tailwind-merge");
3794
5147
  var import_react13 = require("react");
@@ -3796,28 +5149,29 @@ var import_jsx_runtime20 = require("react/jsx-runtime");
3796
5149
  var import_react14 = require("react");
3797
5150
  var import_jsx_runtime21 = require("react/jsx-runtime");
3798
5151
  var import_react15 = require("react");
5152
+ var import_lucide_react10 = require("lucide-react");
3799
5153
  var import_jsx_runtime22 = require("react/jsx-runtime");
3800
5154
  var import_react16 = require("react");
3801
5155
  var import_jsx_runtime23 = require("react/jsx-runtime");
3802
- var import_lucide_react9 = require("lucide-react");
5156
+ var import_lucide_react11 = require("lucide-react");
3803
5157
  var import_react_router_dom7 = require("react-router-dom");
3804
5158
  var import_jsx_runtime24 = require("react/jsx-runtime");
3805
5159
  var import_jsx_runtime25 = require("react/jsx-runtime");
3806
5160
  var import_react17 = require("react");
3807
- var import_lucide_react10 = require("lucide-react");
5161
+ var import_lucide_react12 = require("lucide-react");
3808
5162
  var import_jsx_runtime26 = require("react/jsx-runtime");
3809
- var import_lucide_react11 = require("lucide-react");
5163
+ var import_lucide_react13 = require("lucide-react");
3810
5164
  var import_react18 = require("react");
3811
5165
  var import_jsx_runtime27 = require("react/jsx-runtime");
3812
- var import_react19 = require("react");
5166
+ var import_react19 = __toESM(require("react"), 1);
3813
5167
  var import_react_router_dom8 = require("react-router-dom");
3814
- var import_lucide_react12 = require("lucide-react");
5168
+ var import_lucide_react14 = require("lucide-react");
3815
5169
  var import_jsx_runtime28 = require("react/jsx-runtime");
3816
5170
  var import_react20 = require("react");
3817
5171
  var import_react21 = require("react");
3818
- var import_lucide_react13 = require("lucide-react");
5172
+ var import_lucide_react15 = require("lucide-react");
3819
5173
  var import_jsx_runtime29 = require("react/jsx-runtime");
3820
- var import_lucide_react14 = require("lucide-react");
5174
+ var import_lucide_react16 = require("lucide-react");
3821
5175
  var import_jsx_runtime30 = require("react/jsx-runtime");
3822
5176
  var import_react22 = require("react");
3823
5177
  var import_jsx_runtime31 = require("react/jsx-runtime");
@@ -3829,7 +5183,7 @@ var import_react_router_dom9 = require("react-router-dom");
3829
5183
  var import_jsx_runtime35 = require("react/jsx-runtime");
3830
5184
  var import_react24 = __toESM(require("react"), 1);
3831
5185
  var import_react_router_dom10 = require("react-router-dom");
3832
- var import_lucide_react15 = require("lucide-react");
5186
+ var import_lucide_react17 = require("lucide-react");
3833
5187
  var import_clsx3 = require("clsx");
3834
5188
  var import_tailwind_merge3 = require("tailwind-merge");
3835
5189
  var import_react25 = require("react");
@@ -3840,25 +5194,25 @@ var import_react27 = require("react");
3840
5194
  var import_jsx_runtime38 = require("react/jsx-runtime");
3841
5195
  var import_react28 = require("react");
3842
5196
  var import_jsx_runtime39 = require("react/jsx-runtime");
3843
- var import_lucide_react16 = require("lucide-react");
5197
+ var import_lucide_react18 = require("lucide-react");
3844
5198
  var import_react_router_dom11 = require("react-router-dom");
3845
5199
  var import_jsx_runtime40 = require("react/jsx-runtime");
3846
5200
  var import_jsx_runtime41 = require("react/jsx-runtime");
3847
5201
  var import_react29 = require("react");
3848
- var import_lucide_react17 = require("lucide-react");
5202
+ var import_lucide_react19 = require("lucide-react");
3849
5203
  var import_jsx_runtime42 = require("react/jsx-runtime");
3850
- var import_lucide_react18 = require("lucide-react");
5204
+ var import_lucide_react20 = require("lucide-react");
3851
5205
  var import_react30 = require("react");
3852
5206
  var import_jsx_runtime43 = require("react/jsx-runtime");
3853
5207
  var import_react31 = require("react");
3854
5208
  var import_react_router_dom12 = require("react-router-dom");
3855
- var import_lucide_react19 = require("lucide-react");
5209
+ var import_lucide_react21 = require("lucide-react");
3856
5210
  var import_jsx_runtime44 = require("react/jsx-runtime");
3857
5211
  var import_react32 = require("react");
3858
5212
  var import_react33 = require("react");
3859
- var import_lucide_react20 = require("lucide-react");
5213
+ var import_lucide_react22 = require("lucide-react");
3860
5214
  var import_jsx_runtime45 = require("react/jsx-runtime");
3861
- var import_lucide_react21 = require("lucide-react");
5215
+ var import_lucide_react23 = require("lucide-react");
3862
5216
  var import_jsx_runtime46 = require("react/jsx-runtime");
3863
5217
  var import_react34 = require("react");
3864
5218
  var import_jsx_runtime47 = require("react/jsx-runtime");
@@ -3870,7 +5224,7 @@ var import_react_router_dom13 = require("react-router-dom");
3870
5224
  var import_jsx_runtime51 = require("react/jsx-runtime");
3871
5225
  var import_react36 = __toESM(require("react"), 1);
3872
5226
  var import_react_router_dom14 = require("react-router-dom");
3873
- var import_lucide_react22 = require("lucide-react");
5227
+ var import_lucide_react24 = require("lucide-react");
3874
5228
  var import_clsx4 = require("clsx");
3875
5229
  var import_tailwind_merge4 = require("tailwind-merge");
3876
5230
  var import_react37 = require("react");
@@ -3881,25 +5235,25 @@ var import_react39 = require("react");
3881
5235
  var import_jsx_runtime54 = require("react/jsx-runtime");
3882
5236
  var import_react40 = require("react");
3883
5237
  var import_jsx_runtime55 = require("react/jsx-runtime");
3884
- var import_lucide_react23 = require("lucide-react");
5238
+ var import_lucide_react25 = require("lucide-react");
3885
5239
  var import_react_router_dom15 = require("react-router-dom");
3886
5240
  var import_jsx_runtime56 = require("react/jsx-runtime");
3887
5241
  var import_jsx_runtime57 = require("react/jsx-runtime");
3888
5242
  var import_react41 = require("react");
3889
- var import_lucide_react24 = require("lucide-react");
5243
+ var import_lucide_react26 = require("lucide-react");
3890
5244
  var import_jsx_runtime58 = require("react/jsx-runtime");
3891
- var import_lucide_react25 = require("lucide-react");
5245
+ var import_lucide_react27 = require("lucide-react");
3892
5246
  var import_react42 = require("react");
3893
5247
  var import_jsx_runtime59 = require("react/jsx-runtime");
3894
5248
  var import_react43 = require("react");
3895
5249
  var import_react_router_dom16 = require("react-router-dom");
3896
- var import_lucide_react26 = require("lucide-react");
5250
+ var import_lucide_react28 = require("lucide-react");
3897
5251
  var import_jsx_runtime60 = require("react/jsx-runtime");
3898
5252
  var import_react44 = require("react");
3899
5253
  var import_react45 = require("react");
3900
- var import_lucide_react27 = require("lucide-react");
5254
+ var import_lucide_react29 = require("lucide-react");
3901
5255
  var import_jsx_runtime61 = require("react/jsx-runtime");
3902
- var import_lucide_react28 = require("lucide-react");
5256
+ var import_lucide_react30 = require("lucide-react");
3903
5257
  var import_jsx_runtime62 = require("react/jsx-runtime");
3904
5258
  var import_react46 = require("react");
3905
5259
  var import_jsx_runtime63 = require("react/jsx-runtime");
@@ -3911,7 +5265,7 @@ var import_react_router_dom17 = require("react-router-dom");
3911
5265
  var import_jsx_runtime67 = require("react/jsx-runtime");
3912
5266
  var import_react48 = __toESM(require("react"), 1);
3913
5267
  var import_react_router_dom18 = require("react-router-dom");
3914
- var import_lucide_react29 = require("lucide-react");
5268
+ var import_lucide_react31 = require("lucide-react");
3915
5269
  var import_clsx5 = require("clsx");
3916
5270
  var import_tailwind_merge5 = require("tailwind-merge");
3917
5271
  var import_react49 = require("react");
@@ -3922,25 +5276,25 @@ var import_react51 = require("react");
3922
5276
  var import_jsx_runtime70 = require("react/jsx-runtime");
3923
5277
  var import_react52 = require("react");
3924
5278
  var import_jsx_runtime71 = require("react/jsx-runtime");
3925
- var import_lucide_react30 = require("lucide-react");
5279
+ var import_lucide_react32 = require("lucide-react");
3926
5280
  var import_react_router_dom19 = require("react-router-dom");
3927
5281
  var import_jsx_runtime72 = require("react/jsx-runtime");
3928
5282
  var import_jsx_runtime73 = require("react/jsx-runtime");
3929
5283
  var import_react53 = require("react");
3930
- var import_lucide_react31 = require("lucide-react");
5284
+ var import_lucide_react33 = require("lucide-react");
3931
5285
  var import_jsx_runtime74 = require("react/jsx-runtime");
3932
- var import_lucide_react32 = require("lucide-react");
5286
+ var import_lucide_react34 = require("lucide-react");
3933
5287
  var import_react54 = require("react");
3934
5288
  var import_jsx_runtime75 = require("react/jsx-runtime");
3935
5289
  var import_react55 = require("react");
3936
5290
  var import_react_router_dom20 = require("react-router-dom");
3937
- var import_lucide_react33 = require("lucide-react");
5291
+ var import_lucide_react35 = require("lucide-react");
3938
5292
  var import_jsx_runtime76 = require("react/jsx-runtime");
3939
5293
  var import_react56 = require("react");
3940
5294
  var import_react57 = require("react");
3941
- var import_lucide_react34 = require("lucide-react");
5295
+ var import_lucide_react36 = require("lucide-react");
3942
5296
  var import_jsx_runtime77 = require("react/jsx-runtime");
3943
- var import_lucide_react35 = require("lucide-react");
5297
+ var import_lucide_react37 = require("lucide-react");
3944
5298
  var import_jsx_runtime78 = require("react/jsx-runtime");
3945
5299
  var import_react58 = require("react");
3946
5300
  var import_jsx_runtime79 = require("react/jsx-runtime");
@@ -3952,7 +5306,7 @@ var import_react_router_dom21 = require("react-router-dom");
3952
5306
  var import_jsx_runtime83 = require("react/jsx-runtime");
3953
5307
  var import_react60 = __toESM(require("react"), 1);
3954
5308
  var import_react_router_dom22 = require("react-router-dom");
3955
- var import_lucide_react36 = require("lucide-react");
5309
+ var import_lucide_react38 = require("lucide-react");
3956
5310
  var import_clsx6 = require("clsx");
3957
5311
  var import_tailwind_merge6 = require("tailwind-merge");
3958
5312
  var import_react61 = require("react");
@@ -3963,25 +5317,25 @@ var import_react63 = require("react");
3963
5317
  var import_jsx_runtime86 = require("react/jsx-runtime");
3964
5318
  var import_react64 = require("react");
3965
5319
  var import_jsx_runtime87 = require("react/jsx-runtime");
3966
- var import_lucide_react37 = require("lucide-react");
5320
+ var import_lucide_react39 = require("lucide-react");
3967
5321
  var import_react_router_dom23 = require("react-router-dom");
3968
5322
  var import_jsx_runtime88 = require("react/jsx-runtime");
3969
5323
  var import_jsx_runtime89 = require("react/jsx-runtime");
3970
5324
  var import_react65 = require("react");
3971
- var import_lucide_react38 = require("lucide-react");
5325
+ var import_lucide_react40 = require("lucide-react");
3972
5326
  var import_jsx_runtime90 = require("react/jsx-runtime");
3973
- var import_lucide_react39 = require("lucide-react");
5327
+ var import_lucide_react41 = require("lucide-react");
3974
5328
  var import_react66 = require("react");
3975
5329
  var import_jsx_runtime91 = require("react/jsx-runtime");
3976
5330
  var import_react67 = require("react");
3977
5331
  var import_react_router_dom24 = require("react-router-dom");
3978
- var import_lucide_react40 = require("lucide-react");
5332
+ var import_lucide_react42 = require("lucide-react");
3979
5333
  var import_jsx_runtime92 = require("react/jsx-runtime");
3980
5334
  var import_react68 = require("react");
3981
5335
  var import_react69 = require("react");
3982
- var import_lucide_react41 = require("lucide-react");
5336
+ var import_lucide_react43 = require("lucide-react");
3983
5337
  var import_jsx_runtime93 = require("react/jsx-runtime");
3984
- var import_lucide_react42 = require("lucide-react");
5338
+ var import_lucide_react44 = require("lucide-react");
3985
5339
  var import_jsx_runtime94 = require("react/jsx-runtime");
3986
5340
  var import_react70 = require("react");
3987
5341
  var import_jsx_runtime95 = require("react/jsx-runtime");
@@ -3989,18 +5343,108 @@ var import_jsx_runtime96 = require("react/jsx-runtime");
3989
5343
  var import_react71 = require("react");
3990
5344
  var import_jsx_runtime97 = require("react/jsx-runtime");
3991
5345
  var import_jsx_runtime98 = require("react/jsx-runtime");
3992
- var import_react72 = require("react");
5346
+ var import_react_router_dom25 = require("react-router-dom");
3993
5347
  var import_jsx_runtime99 = require("react/jsx-runtime");
5348
+ var import_react72 = __toESM(require("react"), 1);
5349
+ var import_react_router_dom26 = require("react-router-dom");
5350
+ var import_lucide_react45 = require("lucide-react");
5351
+ var import_clsx7 = require("clsx");
5352
+ var import_tailwind_merge7 = require("tailwind-merge");
5353
+ var import_react73 = require("react");
3994
5354
  var import_jsx_runtime100 = require("react/jsx-runtime");
5355
+ var import_react74 = require("react");
3995
5356
  var import_jsx_runtime101 = require("react/jsx-runtime");
3996
- var import_react73 = require("react");
5357
+ var import_react75 = require("react");
3997
5358
  var import_jsx_runtime102 = require("react/jsx-runtime");
5359
+ var import_react76 = require("react");
3998
5360
  var import_jsx_runtime103 = require("react/jsx-runtime");
5361
+ var import_lucide_react46 = require("lucide-react");
5362
+ var import_react_router_dom27 = require("react-router-dom");
3999
5363
  var import_jsx_runtime104 = require("react/jsx-runtime");
4000
- var import_react74 = require("react");
4001
5364
  var import_jsx_runtime105 = require("react/jsx-runtime");
5365
+ var import_react77 = require("react");
5366
+ var import_lucide_react47 = require("lucide-react");
4002
5367
  var import_jsx_runtime106 = require("react/jsx-runtime");
5368
+ var import_lucide_react48 = require("lucide-react");
5369
+ var import_react78 = require("react");
4003
5370
  var import_jsx_runtime107 = require("react/jsx-runtime");
5371
+ var import_react79 = require("react");
5372
+ var import_react_router_dom28 = require("react-router-dom");
5373
+ var import_lucide_react49 = require("lucide-react");
5374
+ var import_jsx_runtime108 = require("react/jsx-runtime");
5375
+ var import_react80 = require("react");
5376
+ var import_react81 = require("react");
5377
+ var import_lucide_react50 = require("lucide-react");
5378
+ var import_jsx_runtime109 = require("react/jsx-runtime");
5379
+ var import_lucide_react51 = require("lucide-react");
5380
+ var import_jsx_runtime110 = require("react/jsx-runtime");
5381
+ var import_react82 = require("react");
5382
+ var import_jsx_runtime111 = require("react/jsx-runtime");
5383
+ var import_jsx_runtime112 = require("react/jsx-runtime");
5384
+ var import_react83 = require("react");
5385
+ var import_jsx_runtime113 = require("react/jsx-runtime");
5386
+ var import_jsx_runtime114 = require("react/jsx-runtime");
5387
+ var import_react_router_dom29 = require("react-router-dom");
5388
+ var import_jsx_runtime115 = require("react/jsx-runtime");
5389
+ var import_react84 = __toESM(require("react"), 1);
5390
+ var import_react_router_dom30 = require("react-router-dom");
5391
+ var import_lucide_react52 = require("lucide-react");
5392
+ var import_clsx8 = require("clsx");
5393
+ var import_tailwind_merge8 = require("tailwind-merge");
5394
+ var import_react85 = require("react");
5395
+ var import_jsx_runtime116 = require("react/jsx-runtime");
5396
+ var import_react86 = require("react");
5397
+ var import_jsx_runtime117 = require("react/jsx-runtime");
5398
+ var import_react87 = require("react");
5399
+ var import_jsx_runtime118 = require("react/jsx-runtime");
5400
+ var import_react88 = require("react");
5401
+ var import_jsx_runtime119 = require("react/jsx-runtime");
5402
+ var import_lucide_react53 = require("lucide-react");
5403
+ var import_react_router_dom31 = require("react-router-dom");
5404
+ var import_jsx_runtime120 = require("react/jsx-runtime");
5405
+ var import_jsx_runtime121 = require("react/jsx-runtime");
5406
+ var import_react89 = require("react");
5407
+ var import_lucide_react54 = require("lucide-react");
5408
+ var import_jsx_runtime122 = require("react/jsx-runtime");
5409
+ var import_lucide_react55 = require("lucide-react");
5410
+ var import_react90 = require("react");
5411
+ var import_jsx_runtime123 = require("react/jsx-runtime");
5412
+ var import_react91 = require("react");
5413
+ var import_react_router_dom32 = require("react-router-dom");
5414
+ var import_lucide_react56 = require("lucide-react");
5415
+ var import_jsx_runtime124 = require("react/jsx-runtime");
5416
+ var import_react92 = require("react");
5417
+ var import_react93 = require("react");
5418
+ var import_lucide_react57 = require("lucide-react");
5419
+ var import_jsx_runtime125 = require("react/jsx-runtime");
5420
+ var import_lucide_react58 = require("lucide-react");
5421
+ var import_jsx_runtime126 = require("react/jsx-runtime");
5422
+ var import_react94 = require("react");
5423
+ var import_jsx_runtime127 = require("react/jsx-runtime");
5424
+ var import_jsx_runtime128 = require("react/jsx-runtime");
5425
+ var import_react95 = require("react");
5426
+ var import_jsx_runtime129 = require("react/jsx-runtime");
5427
+ var import_jsx_runtime130 = require("react/jsx-runtime");
5428
+ var import_react96 = require("react");
5429
+ var import_jsx_runtime131 = require("react/jsx-runtime");
5430
+ var import_jsx_runtime132 = require("react/jsx-runtime");
5431
+ var import_jsx_runtime133 = require("react/jsx-runtime");
5432
+ var import_react97 = require("react");
5433
+ var import_jsx_runtime134 = require("react/jsx-runtime");
5434
+ var import_jsx_runtime135 = require("react/jsx-runtime");
5435
+ var import_jsx_runtime136 = require("react/jsx-runtime");
5436
+ var import_react98 = require("react");
5437
+ var import_jsx_runtime137 = require("react/jsx-runtime");
5438
+ var import_jsx_runtime138 = require("react/jsx-runtime");
5439
+ var import_jsx_runtime139 = require("react/jsx-runtime");
5440
+ var import_react99 = require("react");
5441
+ var import_jsx_runtime140 = require("react/jsx-runtime");
5442
+ var import_jsx_runtime141 = require("react/jsx-runtime");
5443
+ var import_jsx_runtime142 = require("react/jsx-runtime");
5444
+ var import_react100 = require("react");
5445
+ var import_jsx_runtime143 = require("react/jsx-runtime");
5446
+ var import_jsx_runtime144 = require("react/jsx-runtime");
5447
+ var import_jsx_runtime145 = require("react/jsx-runtime");
4004
5448
  var PrimaryButton2 = ({
4005
5449
  loading = false,
4006
5450
  children,
@@ -4018,10 +5462,10 @@ var PrimaryButton2 = ({
4018
5462
  }
4019
5463
  );
4020
5464
  var Buttons_default2 = PrimaryButton2;
4021
- var Modal2 = ({ title, description, width, open, onClose, children }) => {
5465
+ var Modal2 = ({ title, description, width = "max-w-lg", open, onClose, children }) => {
4022
5466
  if (!open) return null;
4023
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `bg-white rounded-lg pt-4 px-6 mx-4 `, children: [
4024
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between items-start mb-6", children: [
5467
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `bg-white rounded-lg p-6 mx-4 w-full ${width}`, children: [
5468
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between items-start mb-6", children: [
4025
5469
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
4026
5470
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: "text-xl font-semibold text-tuatara flex items-center space-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: title }) }),
4027
5471
  description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-gray-600 mt-1", children: description })
@@ -4036,7 +5480,7 @@ var Modal2 = ({ title, description, width, open, onClose, children }) => {
4036
5480
  }
4037
5481
  )
4038
5482
  ] }),
4039
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto mb-1", children })
5483
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto", children })
4040
5484
  ] }) });
4041
5485
  };
4042
5486
  var Modals_default2 = Modal2;
@@ -4088,13 +5532,13 @@ var ADDRESS_IP2 = chooseEnv2 === "prod" ? "back.rewise.praeduim-tech.com" : "loc
4088
5532
  var ADDRESS_IP_URL2 = chooseEnv2 === "prod" ? `https://${ADDRESS_IP2}/` : `http://${ADDRESS_IP2}/`;
4089
5533
  var API_URL2 = `${ADDRESS_IP_URL2}api`;
4090
5534
  var API_BASE_URL3 = `${API_URL2}/core/auth/`;
5535
+ var VENDORS_API_URL2 = `${API_URL2}/accounting/vendors/`;
4091
5536
  var SessionContext2 = (0, import_react14.createContext)(void 0);
4092
5537
  var API_BASE_URL22 = `${API_URL2}/core/auth/`;
4093
5538
  var USERS_API_URL2 = `${API_URL2}/core/users/`;
4094
5539
  var ToastContext2 = (0, import_react15.createContext)(void 0);
4095
5540
  var APPROVAL_API_URL2 = `${API_URL2}/approvals/cases/`;
4096
5541
  var AlertContext2 = (0, import_react22.createContext)(void 0);
4097
- var VENDORS_API_URL2 = `${API_URL2}/accounting/vendors/`;
4098
5542
  var ThemeContext22 = (0, import_react25.createContext)(void 0);
4099
5543
  var chooseEnv22 = localStorage.getItem("env") ?? "prod";
4100
5544
  var ADDRESS_IP22 = chooseEnv22 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
@@ -4109,8 +5553,9 @@ var APPROVAL_API_URL22 = `${API_URL22}/approvals/cases/`;
4109
5553
  var AlertContext22 = (0, import_react34.createContext)(void 0);
4110
5554
  var VENDORS_API_URL22 = `${API_URL22}/accounting/vendors/`;
4111
5555
  var ThemeContext222 = (0, import_react37.createContext)(void 0);
4112
- var ADDRESS_IP222 = "localhost:8000";
4113
- var ADDRESS_IP_URL222 = `http://${ADDRESS_IP222}/`;
5556
+ var chooseEnv222 = localStorage.getItem("env") ?? "prod";
5557
+ var ADDRESS_IP222 = chooseEnv222 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
5558
+ var ADDRESS_IP_URL222 = chooseEnv222 === "prod" ? `https://${ADDRESS_IP222}/` : `http://${ADDRESS_IP222}/`;
4114
5559
  var API_URL222 = `${ADDRESS_IP_URL222}api`;
4115
5560
  var API_BASE_URL322 = `${API_URL222}/core/auth/`;
4116
5561
  var SessionContext222 = (0, import_react38.createContext)(void 0);
@@ -4121,8 +5566,9 @@ var APPROVAL_API_URL222 = `${API_URL222}/approvals/cases/`;
4121
5566
  var AlertContext222 = (0, import_react46.createContext)(void 0);
4122
5567
  var VENDORS_API_URL222 = `${API_URL222}/accounting/vendors/`;
4123
5568
  var ThemeContext2222 = (0, import_react49.createContext)(void 0);
4124
- var ADDRESS_IP2222 = "localhost:8000";
4125
- var ADDRESS_IP_URL2222 = `http://${ADDRESS_IP2222}/`;
5569
+ var chooseEnv2222 = localStorage.getItem("env") ?? "prod";
5570
+ var ADDRESS_IP2222 = chooseEnv2222 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
5571
+ var ADDRESS_IP_URL2222 = chooseEnv2222 === "prod" ? `https://${ADDRESS_IP2222}/` : `http://${ADDRESS_IP2222}/`;
4126
5572
  var API_URL2222 = `${ADDRESS_IP_URL2222}api`;
4127
5573
  var API_BASE_URL3222 = `${API_URL2222}/core/auth/`;
4128
5574
  var SessionContext2222 = (0, import_react50.createContext)(void 0);
@@ -4143,26 +5589,58 @@ var USERS_API_URL22222 = `${API_URL22222}/core/users/`;
4143
5589
  var ToastContext22222 = (0, import_react63.createContext)(void 0);
4144
5590
  var APPROVAL_API_URL22222 = `${API_URL22222}/approvals/cases/`;
4145
5591
  var AlertContext22222 = (0, import_react70.createContext)(void 0);
4146
- var URI = `${API_URL2222}/core/departments/`;
4147
- var URI2 = `${API_URL2222}/accounting/profit-or-cost-center/`;
4148
- var COST_URI = `${API_URL2222}/accounting/cost-center/`;
4149
- var PROFIT_URI = `${API_URL2222}/accounting/profit-center/`;
4150
- var URI3 = `${API_URL222}/core/departments/`;
4151
- var URI4 = `${API_URL222}/accounting/profit-or-cost-center/`;
4152
- var COST_URI2 = `${API_URL222}/accounting/cost-center/`;
4153
- var PROFIT_URI2 = `${API_URL222}/accounting/profit-center/`;
4154
- var URI5 = `${API_URL22}/core/departments/`;
4155
- var URI6 = `${API_URL22}/accounting/profit-or-cost-center/`;
4156
- var COST_URI3 = `${API_URL22}/accounting/cost-center/`;
4157
- var PROFIT_URI3 = `${API_URL22}/accounting/profit-center/`;
4158
- var URI7 = `${API_URL2}/core/departments/`;
4159
- var URI8 = `${API_URL2}/accounting/profit-or-cost-center/`;
4160
- var COST_URI4 = `${API_URL2}/accounting/cost-center/`;
4161
- var PROFIT_URI4 = `${API_URL2}/accounting/profit-center/`;
5592
+ var VENDORS_API_URL22222 = `${API_URL22222}/accounting/vendors/`;
5593
+ var ThemeContext222222 = (0, import_react73.createContext)(void 0);
5594
+ var ADDRESS_IP222222 = "localhost:8000";
5595
+ var ADDRESS_IP_URL222222 = `http://${ADDRESS_IP222222}/`;
5596
+ var API_URL222222 = `${ADDRESS_IP_URL222222}api`;
5597
+ var API_BASE_URL322222 = `${API_URL222222}/core/auth/`;
5598
+ var SessionContext222222 = (0, import_react74.createContext)(void 0);
5599
+ var API_BASE_URL2222222 = `${API_URL222222}/core/auth/`;
5600
+ var USERS_API_URL222222 = `${API_URL222222}/core/users/`;
5601
+ var ToastContext222222 = (0, import_react75.createContext)(void 0);
5602
+ var APPROVAL_API_URL222222 = `${API_URL222222}/approvals/cases/`;
5603
+ var AlertContext222222 = (0, import_react82.createContext)(void 0);
5604
+ var VENDORS_API_URL222222 = `${API_URL222222}/accounting/vendors/`;
5605
+ var ThemeContext2222222 = (0, import_react85.createContext)(void 0);
5606
+ var ADDRESS_IP2222222 = "localhost:8000";
5607
+ var ADDRESS_IP_URL2222222 = `http://${ADDRESS_IP2222222}/`;
5608
+ var API_URL2222222 = `${ADDRESS_IP_URL2222222}api`;
5609
+ var API_BASE_URL3222222 = `${API_URL2222222}/core/auth/`;
5610
+ var SessionContext2222222 = (0, import_react86.createContext)(void 0);
5611
+ var API_BASE_URL22222222 = `${API_URL2222222}/core/auth/`;
5612
+ var USERS_API_URL2222222 = `${API_URL2222222}/core/users/`;
5613
+ var ToastContext2222222 = (0, import_react87.createContext)(void 0);
5614
+ var APPROVAL_API_URL2222222 = `${API_URL2222222}/approvals/cases/`;
5615
+ var AlertContext2222222 = (0, import_react94.createContext)(void 0);
5616
+ var URI = `${API_URL222222}/core/departments/`;
5617
+ var URI2 = `${API_URL222222}/accounting/profit-or-cost-center/`;
5618
+ var COST_URI = `${API_URL222222}/accounting/cost-center/`;
5619
+ var PROFIT_URI = `${API_URL222222}/accounting/profit-center/`;
5620
+ var URI3 = `${API_URL22222}/core/departments/`;
5621
+ var URI4 = `${API_URL22222}/accounting/profit-or-cost-center/`;
5622
+ var COST_URI2 = `${API_URL22222}/accounting/cost-center/`;
5623
+ var PROFIT_URI2 = `${API_URL22222}/accounting/profit-center/`;
5624
+ var URI5 = `${API_URL2222}/core/departments/`;
5625
+ var URI6 = `${API_URL2222}/accounting/profit-or-cost-center/`;
5626
+ var COST_URI3 = `${API_URL2222}/accounting/cost-center/`;
5627
+ var PROFIT_URI3 = `${API_URL2222}/accounting/profit-center/`;
5628
+ var URI7 = `${API_URL222}/core/departments/`;
5629
+ var URI8 = `${API_URL222}/accounting/profit-or-cost-center/`;
5630
+ var COST_URI4 = `${API_URL222}/accounting/cost-center/`;
5631
+ var PROFIT_URI4 = `${API_URL222}/accounting/profit-center/`;
5632
+ var URI9 = `${API_URL22}/core/departments/`;
5633
+ var URI10 = `${API_URL22}/accounting/profit-or-cost-center/`;
5634
+ var COST_URI5 = `${API_URL22}/accounting/cost-center/`;
5635
+ var PROFIT_URI5 = `${API_URL22}/accounting/profit-center/`;
5636
+ var URI11 = `${API_URL2}/core/departments/`;
5637
+ var URI12 = `${API_URL2}/accounting/profit-or-cost-center/`;
5638
+ var COST_URI6 = `${API_URL2}/accounting/cost-center/`;
5639
+ var PROFIT_URI6 = `${API_URL2}/accounting/profit-center/`;
4162
5640
 
4163
5641
  // src/components/common/FormVendor.tsx
4164
- var import_react75 = require("react");
4165
- var import_jsx_runtime108 = require("react/jsx-runtime");
5642
+ var import_react101 = require("react");
5643
+ var import_jsx_runtime146 = require("react/jsx-runtime");
4166
5644
  var MinimalVendorForm = ({
4167
5645
  isOpen,
4168
5646
  onClose,
@@ -4171,13 +5649,13 @@ var MinimalVendorForm = ({
4171
5649
  refresh = () => {
4172
5650
  }
4173
5651
  }) => {
4174
- const [formData, setFormData] = (0, import_react75.useState)(object || {
5652
+ const [formData, setFormData] = (0, import_react101.useState)(object || {
4175
5653
  from_module: from ?? null,
4176
5654
  legal_name: "",
4177
5655
  trading_name: ""
4178
5656
  });
4179
- const [errors, setErrors] = (0, import_react75.useState)({});
4180
- const [loading, setLoading] = (0, import_react75.useState)(false);
5657
+ const [errors, setErrors] = (0, import_react101.useState)({});
5658
+ const [loading, setLoading] = (0, import_react101.useState)(false);
4181
5659
  const { token } = useSession();
4182
5660
  const { success, error: showError } = useToast();
4183
5661
  const handleInputChange = (e) => {
@@ -4236,7 +5714,7 @@ var MinimalVendorForm = ({
4236
5714
  }
4237
5715
  };
4238
5716
  if (!isOpen) return null;
4239
- return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
5717
+ return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
4240
5718
  Modals_default2,
4241
5719
  {
4242
5720
  title: "Ajouter un fournisseur",
@@ -4244,9 +5722,9 @@ var MinimalVendorForm = ({
4244
5722
  description: ``,
4245
5723
  open: isOpen,
4246
5724
  onClose,
4247
- children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("form", { onSubmit: handleSubmit, className: "p-", children: [
4248
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
4249
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
5725
+ children: /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("form", { onSubmit: handleSubmit, className: "p-", children: [
5726
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
5727
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
4250
5728
  TextInput2,
4251
5729
  {
4252
5730
  label: "Raison sociale",
@@ -4258,7 +5736,7 @@ var MinimalVendorForm = ({
4258
5736
  onChange: handleInputChange
4259
5737
  }
4260
5738
  ),
4261
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
5739
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
4262
5740
  TextInput2,
4263
5741
  {
4264
5742
  label: "Nom commercial",
@@ -4269,8 +5747,8 @@ var MinimalVendorForm = ({
4269
5747
  }
4270
5748
  )
4271
5749
  ] }) }),
4272
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex justify-between pt-6 mt-8", children: [
4273
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
5750
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "flex justify-between pt-6 mt-8", children: [
5751
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
4274
5752
  "button",
4275
5753
  {
4276
5754
  type: "button",
@@ -4279,7 +5757,7 @@ var MinimalVendorForm = ({
4279
5757
  children: "Annuler"
4280
5758
  }
4281
5759
  ),
4282
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
5760
+ /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
4283
5761
  Buttons_default2,
4284
5762
  {
4285
5763
  type: "button",
@@ -4295,43 +5773,43 @@ var MinimalVendorForm = ({
4295
5773
  };
4296
5774
 
4297
5775
  // src/services/DepartmentServices.ts
4298
- var URI9 = `${API_URL}/core/departments/`;
5776
+ var URI13 = `${API_URL}/core/departments/`;
4299
5777
  var DepartmentServices = {
4300
- create: (data) => FetchApi.post(`${URI9}`, data),
4301
- get: (id) => FetchApi.get(`${URI9}${id}/`),
4302
- list: (params) => FetchApi.get(`${URI9}?${new URLSearchParams(params).toString()}`),
4303
- update: (id, data) => FetchApi.put(`${URI9}${id}/`, data),
4304
- delete: (id) => FetchApi.delete(`${URI9}${id}/`)
5778
+ create: (data) => FetchApi.post(`${URI13}`, data),
5779
+ get: (id) => FetchApi.get(`${URI13}${id}/`),
5780
+ list: (params) => FetchApi.get(`${URI13}?${new URLSearchParams(params).toString()}`),
5781
+ update: (id, data) => FetchApi.put(`${URI13}${id}/`, data),
5782
+ delete: (id) => FetchApi.delete(`${URI13}${id}/`)
4305
5783
  };
4306
5784
 
4307
5785
  // src/services/ProfitCostsServices.ts
4308
- var URI10 = `${API_URL}/accounting/profit-or-cost-center/`;
4309
- var COST_URI5 = `${API_URL}/accounting/cost-center/`;
5786
+ var URI14 = `${API_URL}/accounting/profit-or-cost-center/`;
5787
+ var COST_URI7 = `${API_URL}/accounting/cost-center/`;
4310
5788
  var CostServices = {
4311
- create: (data) => FetchApi.post(`${COST_URI5}`, data),
4312
- get: (id) => FetchApi.get(`${COST_URI5}${id}/`),
4313
- list: (params) => FetchApi.get(`${COST_URI5}?${new URLSearchParams(params).toString()}`),
4314
- update: (id, data) => FetchApi.put(`${COST_URI5}${id}/`, data),
4315
- delete: (id) => FetchApi.delete(`${COST_URI5}${id}/`)
5789
+ create: (data) => FetchApi.post(`${COST_URI7}`, data),
5790
+ get: (id) => FetchApi.get(`${COST_URI7}${id}/`),
5791
+ list: (params) => FetchApi.get(`${COST_URI7}?${new URLSearchParams(params).toString()}`),
5792
+ update: (id, data) => FetchApi.put(`${COST_URI7}${id}/`, data),
5793
+ delete: (id) => FetchApi.delete(`${COST_URI7}${id}/`)
4316
5794
  };
4317
- var PROFIT_URI5 = `${API_URL}/accounting/profit-center/`;
5795
+ var PROFIT_URI7 = `${API_URL}/accounting/profit-center/`;
4318
5796
 
4319
5797
  // src/components/common/CommonSelect.tsx
4320
- var import_jsx_runtime109 = require("react/jsx-runtime");
5798
+ var import_jsx_runtime147 = require("react/jsx-runtime");
4321
5799
  var SelectVendor = ({
4322
5800
  value,
4323
5801
  onSelect
4324
5802
  }) => {
4325
- const [showModal, setShowModal] = (0, import_react76.useState)(false);
4326
- const [selectedVendor, setSelectedVendor] = (0, import_react76.useState)(null);
5803
+ const [showModal, setShowModal] = (0, import_react102.useState)(false);
5804
+ const [selectedVendor, setSelectedVendor] = (0, import_react102.useState)(null);
4327
5805
  const { token, activeBusinessEntity } = useSession();
4328
- const [vendors, setVendors] = (0, import_react76.useState)(() => {
5806
+ const [vendors, setVendors] = (0, import_react102.useState)(() => {
4329
5807
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
4330
5808
  const cached = sessionStorage.getItem(cacheKey);
4331
5809
  return cached ? JSON.parse(cached) : [];
4332
5810
  });
4333
- const [loadingVendors, setLoadingVendors] = (0, import_react76.useState)(false);
4334
- (0, import_react76.useEffect)(() => {
5811
+ const [loadingVendors, setLoadingVendors] = (0, import_react102.useState)(false);
5812
+ (0, import_react102.useEffect)(() => {
4335
5813
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
4336
5814
  const cached = sessionStorage.getItem(cacheKey);
4337
5815
  if (!cached) {
@@ -4369,9 +5847,9 @@ var SelectVendor = ({
4369
5847
  sessionStorage.removeItem(cacheKey);
4370
5848
  loadVendors();
4371
5849
  };
4372
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { children: [
4373
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
4374
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
5850
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { children: [
5851
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
5852
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
4375
5853
  SearchableSelect,
4376
5854
  {
4377
5855
  value,
@@ -4387,8 +5865,8 @@ var SelectVendor = ({
4387
5865
  },
4388
5866
  "fourni" + value
4389
5867
  ),
4390
- loadingVendors && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des fournisseurs..." }),
4391
- showModal && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
5868
+ loadingVendors && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des fournisseurs..." }),
5869
+ showModal && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
4392
5870
  MinimalVendorForm,
4393
5871
  {
4394
5872
  object: selectedVendor,
@@ -4405,13 +5883,13 @@ var SelectUser = ({
4405
5883
  onSelect
4406
5884
  }) => {
4407
5885
  const { token, activeBusinessEntity } = useSession();
4408
- const [users, setUsers] = (0, import_react76.useState)(() => {
5886
+ const [users, setUsers] = (0, import_react102.useState)(() => {
4409
5887
  const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
4410
5888
  const cached = sessionStorage.getItem(cacheKey);
4411
5889
  return cached ? JSON.parse(cached) : [];
4412
5890
  });
4413
- const [loading, setLoading] = (0, import_react76.useState)(false);
4414
- (0, import_react76.useEffect)(() => {
5891
+ const [loading, setLoading] = (0, import_react102.useState)(false);
5892
+ (0, import_react102.useEffect)(() => {
4415
5893
  const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
4416
5894
  const cached = sessionStorage.getItem(cacheKey);
4417
5895
  if (!cached) {
@@ -4447,19 +5925,19 @@ var SelectUser = ({
4447
5925
  return users.map((user) => ({
4448
5926
  value: user.id,
4449
5927
  label: `${user.first_name} ${user.last_name}`,
4450
- content: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex-1", children: [
4451
- /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "font-medium text-gray-900", children: [
5928
+ content: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex-1", children: [
5929
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "font-medium text-gray-900", children: [
4452
5930
  user.first_name,
4453
5931
  " ",
4454
5932
  user.last_name
4455
5933
  ] }),
4456
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "text-sm text-gray-500", children: user.email })
5934
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "text-sm text-gray-500", children: user.email })
4457
5935
  ] }) })
4458
5936
  }));
4459
5937
  };
4460
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { children: [
4461
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
4462
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
5938
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { children: [
5939
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
5940
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
4463
5941
  SearchableSelect,
4464
5942
  {
4465
5943
  value,
@@ -4472,7 +5950,7 @@ var SelectUser = ({
4472
5950
  },
4473
5951
  "user" + value
4474
5952
  ),
4475
- loading && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
5953
+ loading && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
4476
5954
  ] });
4477
5955
  };
4478
5956
  var SelectDepartment = ({
@@ -4480,13 +5958,13 @@ var SelectDepartment = ({
4480
5958
  onSelect
4481
5959
  }) => {
4482
5960
  const { token, activeBusinessEntity } = useSession();
4483
- const [departments, setDepartments] = (0, import_react76.useState)(() => {
5961
+ const [departments, setDepartments] = (0, import_react102.useState)(() => {
4484
5962
  const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
4485
5963
  const cached = sessionStorage.getItem(cacheKey);
4486
5964
  return cached ? JSON.parse(cached) : [];
4487
5965
  });
4488
- const [loading, setLoading] = (0, import_react76.useState)(false);
4489
- (0, import_react76.useEffect)(() => {
5966
+ const [loading, setLoading] = (0, import_react102.useState)(false);
5967
+ (0, import_react102.useEffect)(() => {
4490
5968
  const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
4491
5969
  const cached = sessionStorage.getItem(cacheKey);
4492
5970
  if (!cached) {
@@ -4522,9 +6000,9 @@ var SelectDepartment = ({
4522
6000
  label: dept.name
4523
6001
  }));
4524
6002
  };
4525
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { children: [
4526
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
4527
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
6003
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { children: [
6004
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
6005
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
4528
6006
  SearchableSelect,
4529
6007
  {
4530
6008
  value,
@@ -4537,7 +6015,7 @@ var SelectDepartment = ({
4537
6015
  },
4538
6016
  "dept" + value
4539
6017
  ),
4540
- loading && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
6018
+ loading && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
4541
6019
  ] });
4542
6020
  };
4543
6021
  var SelectCostCenter = ({
@@ -4545,13 +6023,13 @@ var SelectCostCenter = ({
4545
6023
  onSelect
4546
6024
  }) => {
4547
6025
  const { token, activeBusinessEntity } = useSession();
4548
- const [costCenters, setCostCenters] = (0, import_react76.useState)(() => {
6026
+ const [costCenters, setCostCenters] = (0, import_react102.useState)(() => {
4549
6027
  const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
4550
6028
  const cached = sessionStorage.getItem(cacheKey);
4551
6029
  return cached ? JSON.parse(cached) : [];
4552
6030
  });
4553
- const [loading, setLoading] = (0, import_react76.useState)(false);
4554
- (0, import_react76.useEffect)(() => {
6031
+ const [loading, setLoading] = (0, import_react102.useState)(false);
6032
+ (0, import_react102.useEffect)(() => {
4555
6033
  const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
4556
6034
  const cached = sessionStorage.getItem(cacheKey);
4557
6035
  if (!cached) {
@@ -4585,18 +6063,18 @@ var SelectCostCenter = ({
4585
6063
  return costCenters.map((center) => ({
4586
6064
  value: center.id,
4587
6065
  label: `${center.code ? `[${center.code}] ` : ""}${center.name}`,
4588
- content: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex-1", children: [
4589
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "font-medium text-gray-900", children: center.name }),
4590
- center.code && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "text-sm text-gray-500", children: [
6066
+ content: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "flex-1", children: [
6067
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "font-medium text-gray-900", children: center.name }),
6068
+ center.code && /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "text-sm text-gray-500", children: [
4591
6069
  "Code: ",
4592
6070
  center.code
4593
6071
  ] })
4594
6072
  ] }) })
4595
6073
  }));
4596
6074
  };
4597
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { children: [
4598
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
4599
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
6075
+ return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { children: [
6076
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
6077
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
4600
6078
  SearchableSelect,
4601
6079
  {
4602
6080
  value,
@@ -4609,12 +6087,12 @@ var SelectCostCenter = ({
4609
6087
  },
4610
6088
  "cost" + value
4611
6089
  ),
4612
- loading && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
6090
+ loading && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
4613
6091
  ] });
4614
6092
  };
4615
6093
 
4616
6094
  // src/components/common/Choices.tsx
4617
- var import_jsx_runtime110 = require("react/jsx-runtime");
6095
+ var import_jsx_runtime148 = require("react/jsx-runtime");
4618
6096
  var CHOICES = {
4619
6097
  INVOICE_TYPES: [
4620
6098
  { value: "sale", label: { fr: "Vente", en: "Sale", default: "Sale" } },
@@ -4872,7 +6350,7 @@ var InvoiceTypeSelector = ({
4872
6350
  value: item.value,
4873
6351
  label: item.label[language]
4874
6352
  }));
4875
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6353
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
4876
6354
  SearchableSelect,
4877
6355
  {
4878
6356
  value,
@@ -4895,7 +6373,7 @@ var PaymentMethodSelector = ({
4895
6373
  value: item.value,
4896
6374
  label: item.label[language]
4897
6375
  }));
4898
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6376
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
4899
6377
  SearchableSelect,
4900
6378
  {
4901
6379
  value,
@@ -4918,7 +6396,7 @@ var TemplateFNESelector = ({
4918
6396
  value: item.value,
4919
6397
  label: item.label[language]
4920
6398
  }));
4921
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6399
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
4922
6400
  SearchableSelect,
4923
6401
  {
4924
6402
  value,
@@ -4941,7 +6419,7 @@ var ForeignCurrencySelector = ({
4941
6419
  value: item.value,
4942
6420
  label: item.label[language]
4943
6421
  }));
4944
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6422
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
4945
6423
  SearchableSelect,
4946
6424
  {
4947
6425
  value,
@@ -4965,7 +6443,7 @@ var TaxSelector = ({
4965
6443
  value: item.value,
4966
6444
  label: item.label[language]
4967
6445
  }));
4968
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6446
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
4969
6447
  SearchableSelect,
4970
6448
  {
4971
6449
  value,
@@ -4993,7 +6471,7 @@ var LegalFormSelector = ({
4993
6471
  value: item.value,
4994
6472
  label: item.label[language] ?? item.label.default
4995
6473
  }));
4996
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6474
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
4997
6475
  SearchableSelect,
4998
6476
  {
4999
6477
  value,
@@ -5016,7 +6494,7 @@ var CountrySelector = ({
5016
6494
  value: item.value,
5017
6495
  label: item.label[language]
5018
6496
  }));
5019
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
6497
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
5020
6498
  SearchableSelect,
5021
6499
  {
5022
6500
  value,