ptechcore_ui 1.0.19 → 1.0.21

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");
@@ -735,6 +819,36 @@ var FetchApi = class {
735
819
  if (!res.ok) throw new Error(await res.text());
736
820
  return res.json();
737
821
  }
822
+ static async uploadFile(url, formData, token) {
823
+ const headers = {};
824
+ const local_token = localStorage.getItem("token");
825
+ if (local_token) {
826
+ headers["Authorization"] = `Token ${local_token}`;
827
+ }
828
+ const res = await fetch(url, {
829
+ method: "POST",
830
+ headers,
831
+ body: formData
832
+ });
833
+ if (!res.ok) throw new Error(await res.text());
834
+ return res.json();
835
+ }
836
+ static async patch(url, payload, token) {
837
+ const headers = {
838
+ "Content-Type": "application/json"
839
+ };
840
+ const local_token = localStorage.getItem("token");
841
+ if (local_token) {
842
+ headers["Authorization"] = `Token ${local_token}`;
843
+ }
844
+ const res = await fetch(url, {
845
+ method: "PATCH",
846
+ headers,
847
+ body: payload ? JSON.stringify(payload) : void 0
848
+ });
849
+ if (!res.ok) throw new Error(await res.text());
850
+ return res.json();
851
+ }
738
852
  };
739
853
 
740
854
  // src/services/AuthServices.ts
@@ -752,6 +866,28 @@ var AuthServices = {
752
866
  logout: () => FetchApi.post(`${API_BASE_URL}logout/`)
753
867
  };
754
868
 
869
+ // src/services/VendorServices.ts
870
+ var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
871
+ var VendorServices = {
872
+ createVendor: (data, token) => {
873
+ const payload = { ...data };
874
+ if (!payload.logo) {
875
+ delete payload.logo;
876
+ }
877
+ return FetchApi.post(`${VENDORS_API_URL}`, payload, token);
878
+ },
879
+ getVendor: (id, token) => FetchApi.get(`${VENDORS_API_URL}${id}/`, token),
880
+ getVendors: (token, params) => FetchApi.get(`${VENDORS_API_URL}?${new URLSearchParams(params).toString()}`, token),
881
+ updateVendor: (id, data, token) => {
882
+ const payload = { ...data };
883
+ if (!payload.logo) {
884
+ delete payload.logo;
885
+ }
886
+ return FetchApi.put(`${VENDORS_API_URL}${id}/`, payload, token);
887
+ },
888
+ deleteVendor: (id, token) => FetchApi.delete(`${VENDORS_API_URL}${id}/`, token)
889
+ };
890
+
755
891
  // src/contexts/SessionContext.tsx
756
892
  var import_jsx_runtime5 = require("react/jsx-runtime");
757
893
  var SessionContext = (0, import_react2.createContext)(void 0);
@@ -769,6 +905,47 @@ var SessionProvider = ({ children }) => {
769
905
  const saved_center_id = localStorage.getItem("active_center_id") || "";
770
906
  const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
771
907
  const [showAuthModal, setShowAuthModal] = (0, import_react2.useState)(false);
908
+ (0, import_react2.useEffect)(() => {
909
+ const params = new URLSearchParams(window.location.search);
910
+ const tkn = params.get("tkn");
911
+ if (tkn) {
912
+ localStorage.setItem("token", tkn);
913
+ setToken(tkn);
914
+ window.history.replaceState({}, document.title, window.location.pathname);
915
+ }
916
+ }, []);
917
+ const [vendors, setVendors] = (0, import_react2.useState)(() => {
918
+ const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
919
+ const cached = sessionStorage.getItem(cacheKey);
920
+ return cached ? JSON.parse(cached) : [];
921
+ });
922
+ const [loadingVendors, setLoadingVendors] = (0, import_react2.useState)(false);
923
+ const loadVendors = async () => {
924
+ if (!token) {
925
+ console.error("Vous devez etre connect\xE9 pour voir les organisations");
926
+ return;
927
+ }
928
+ try {
929
+ setLoadingVendors(true);
930
+ const result = await VendorServices.getVendors(token, { business_entity_id: activeBusinessEntity?.id });
931
+ setVendors(result.data);
932
+ const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
933
+ sessionStorage.setItem(cacheKey, JSON.stringify(result.data));
934
+ } catch (error) {
935
+ console.error(error);
936
+ } finally {
937
+ setLoadingVendors(false);
938
+ }
939
+ };
940
+ (0, import_react2.useEffect)(() => {
941
+ const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
942
+ const cached = sessionStorage.getItem(cacheKey);
943
+ if (!cached) {
944
+ loadVendors();
945
+ } else {
946
+ setVendors(JSON.parse(cached));
947
+ }
948
+ }, [activeBusinessEntity?.id]);
772
949
  (0, import_react2.useEffect)(() => {
773
950
  const storedToken = localStorage.getItem("token");
774
951
  if (storedToken) {
@@ -788,6 +965,7 @@ var SessionProvider = ({ children }) => {
788
965
  AuthServices.getUserInformations(token).then((res) => {
789
966
  const result = res;
790
967
  if (result.success === true) {
968
+ console.log("USER LOGGED", result.data.user);
791
969
  setLoggedUser(result.data.user);
792
970
  setActiveBusinessEntity(result.data.user.centers_access.find((item) => parseInt(item.id) === parseInt(saved_center_id)) || result.data.user.centers_access[0] || null);
793
971
  } else {
@@ -812,7 +990,12 @@ var SessionProvider = ({ children }) => {
812
990
  login,
813
991
  logout,
814
992
  showAuthModal,
815
- setShowAuthModal
993
+ setShowAuthModal,
994
+ vendors,
995
+ setVendors,
996
+ loadingVendors,
997
+ setLoadingVendors,
998
+ loadVendors
816
999
  }, children });
817
1000
  };
818
1001
 
@@ -840,11 +1023,27 @@ var UserServices = {
840
1023
  getuserEntitiesAccess: (id, token) => FetchApi.get(`${API_URL}/core/entities/`, token),
841
1024
  // !!! ce n'est pas la bonne url
842
1025
  // Ajouter un utilisateur à une entité
843
- addUserToEntity: (entityId, userId, token) => FetchApi.post(`${API_URL}/core/entities/${entityId}/users/`, { user_id: userId }, token)
1026
+ addUserToEntity: (entityId, userId, token) => FetchApi.post(`${API_URL}/core/entities/${entityId}/users/`, { user_id: userId }, token),
1027
+ // === Nouvelles méthodes pour le profil utilisateur ===
1028
+ // Mettre à jour le profil de l'utilisateur connecté
1029
+ updateMyProfile: (data) => FetchApi.put(`${USERS_API_URL}me/`, data),
1030
+ // Changer la photo de profil
1031
+ updateProfilePicture: (file) => {
1032
+ const formData = new FormData();
1033
+ formData.append("profile_picture", file);
1034
+ return FetchApi.uploadFile(`${USERS_API_URL}me/upload-picture/`, formData);
1035
+ },
1036
+ // Supprimer la photo de profil
1037
+ deleteProfilePicture: () => FetchApi.delete(`${USERS_API_URL}me/delete-picture/`),
1038
+ // Changer le mot de passe (utilisateur authentifié)
1039
+ changePassword: (data) => FetchApi.post(`${API_BASE_URL2}change-my-password/`, data),
1040
+ // Obtenir le profil de l'utilisateur connecté
1041
+ getMyProfile: () => FetchApi.get(`${USERS_API_URL}me/`)
844
1042
  };
845
1043
 
846
1044
  // src/contexts/ToastContext.tsx
847
1045
  var import_react3 = require("react");
1046
+ var import_lucide_react = require("lucide-react");
848
1047
  var import_jsx_runtime6 = require("react/jsx-runtime");
849
1048
  var ToastContext = (0, import_react3.createContext)(void 0);
850
1049
  var useToast = () => {
@@ -856,14 +1055,20 @@ var useToast = () => {
856
1055
  };
857
1056
  var ToastProvider = ({ children }) => {
858
1057
  const [toasts, setToasts] = (0, import_react3.useState)([]);
1058
+ const [confirmState, setConfirmState] = (0, import_react3.useState)({
1059
+ isOpen: false,
1060
+ options: null,
1061
+ resolve: null
1062
+ });
859
1063
  const generateId = () => {
860
1064
  return Date.now().toString(36) + Math.random().toString(36).substr(2);
861
1065
  };
862
1066
  const addToast = (0, import_react3.useCallback)((toast) => {
863
1067
  const id = generateId();
1068
+ const defaultDuration = toast.type === "error" ? 7e3 : 3e3;
864
1069
  const newToast = {
865
1070
  id,
866
- duration: 5e3,
1071
+ duration: toast.duration ?? defaultDuration,
867
1072
  ...toast
868
1073
  };
869
1074
  setToasts((prev) => [...prev, newToast]);
@@ -888,6 +1093,26 @@ var ToastProvider = ({ children }) => {
888
1093
  const info = (0, import_react3.useCallback)((message, duration) => {
889
1094
  addToast({ message, type: "info", duration });
890
1095
  }, [addToast]);
1096
+ const confirm2 = (0, import_react3.useCallback)((options) => {
1097
+ return new Promise((resolve) => {
1098
+ const normalizedOptions = typeof options === "string" ? { message: options } : options;
1099
+ setConfirmState({
1100
+ isOpen: true,
1101
+ options: normalizedOptions,
1102
+ resolve
1103
+ });
1104
+ });
1105
+ }, []);
1106
+ const handleConfirm = (0, import_react3.useCallback)((result) => {
1107
+ if (confirmState.resolve) {
1108
+ confirmState.resolve(result);
1109
+ }
1110
+ setConfirmState({
1111
+ isOpen: false,
1112
+ options: null,
1113
+ resolve: null
1114
+ });
1115
+ }, [confirmState.resolve]);
891
1116
  const value = {
892
1117
  toasts,
893
1118
  addToast,
@@ -895,9 +1120,77 @@ var ToastProvider = ({ children }) => {
895
1120
  success,
896
1121
  error,
897
1122
  warning,
898
- info
1123
+ info,
1124
+ confirm: confirm2
1125
+ };
1126
+ const getConfirmTypeStyles = (type) => {
1127
+ switch (type) {
1128
+ case "danger":
1129
+ return {
1130
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.AlertCircle, { className: "w-6 h-6 text-red-500" }),
1131
+ confirmBtnClass: "bg-red-600 hover:bg-red-700 text-white"
1132
+ };
1133
+ case "warning":
1134
+ return {
1135
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.AlertTriangle, { className: "w-6 h-6 text-amber-500" }),
1136
+ confirmBtnClass: "bg-amber-600 hover:bg-amber-700 text-white"
1137
+ };
1138
+ case "info":
1139
+ default:
1140
+ return {
1141
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.HelpCircle, { className: "w-6 h-6 text-blue-500" }),
1142
+ confirmBtnClass: "bg-blue-600 hover:bg-blue-700 text-white"
1143
+ };
1144
+ }
899
1145
  };
900
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ToastContext.Provider, { value, children });
1146
+ const typeStyles = confirmState.options ? getConfirmTypeStyles(confirmState.options.type) : getConfirmTypeStyles();
1147
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ToastContext.Provider, { value, children: [
1148
+ children,
1149
+ confirmState.isOpen && confirmState.options && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center", children: [
1150
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1151
+ "div",
1152
+ {
1153
+ className: "absolute inset-0 bg-black/50 backdrop-blur-sm",
1154
+ onClick: () => handleConfirm(false)
1155
+ }
1156
+ ),
1157
+ /* @__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: [
1158
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start gap-4 p-6 pb-4", children: [
1159
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex-shrink-0 p-2 rounded-full bg-gray-100", children: typeStyles.icon }),
1160
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 min-w-0", children: [
1161
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: confirmState.options.title || "Confirmation" }),
1162
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mt-2 text-sm text-gray-600 whitespace-pre-wrap", children: confirmState.options.message })
1163
+ ] }),
1164
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1165
+ "button",
1166
+ {
1167
+ onClick: () => handleConfirm(false),
1168
+ className: "flex-shrink-0 p-1 rounded-lg hover:bg-gray-100 transition-colors",
1169
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.X, { className: "w-5 h-5 text-gray-400" })
1170
+ }
1171
+ )
1172
+ ] }),
1173
+ /* @__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: [
1174
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1175
+ "button",
1176
+ {
1177
+ onClick: () => handleConfirm(false),
1178
+ 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",
1179
+ children: confirmState.options.cancelText || "Annuler"
1180
+ }
1181
+ ),
1182
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1183
+ "button",
1184
+ {
1185
+ onClick: () => handleConfirm(true),
1186
+ className: `px-4 py-2 text-sm font-medium rounded-lg transition-colors ${typeStyles.confirmBtnClass}`,
1187
+ children: confirmState.options.confirmText || "Confirmer"
1188
+ }
1189
+ )
1190
+ ] })
1191
+ ] })
1192
+ ] })
1193
+ ] });
901
1194
  };
902
1195
 
903
1196
  // src/pages/ApprovalPreviewAnswer.tsx
@@ -911,7 +1204,7 @@ var RewiseBasicCard = ({ title, children }) => /* @__PURE__ */ (0, import_jsx_ru
911
1204
  ] });
912
1205
 
913
1206
  // src/pages/ApprovalPreviewAnswer.tsx
914
- var import_lucide_react = require("lucide-react");
1207
+ var import_lucide_react2 = require("lucide-react");
915
1208
  var import_react_router_dom2 = require("react-router-dom");
916
1209
 
917
1210
  // src/services/ApprovalServices.ts
@@ -1003,7 +1296,7 @@ var ApprovalAnswerModal = ({ answer_id, link_token, object_detail }) => {
1003
1296
  }
1004
1297
  };
1005
1298
  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]" }) }) });
1299
+ 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
1300
  } else {
1008
1301
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ApprovalPreviewAnswer, { loadCase: loadData, answerId, caseData });
1009
1302
  }
@@ -1047,7 +1340,7 @@ var ApprovalAnswerPage = () => {
1047
1340
  };
1048
1341
  const pageTitle = caseData?.title || "Approbation - Pr\xE9visualisation";
1049
1342
  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]" }) }) });
1343
+ 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
1344
  } else {
1052
1345
  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
1346
  RewiseBasicCard,
@@ -1120,7 +1413,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1120
1413
  switch (answer) {
1121
1414
  case "approved":
1122
1415
  return {
1123
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.CheckCircle, { className: "w-5 h-5 text-green-600" }),
1416
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-5 h-5 text-green-600" }),
1124
1417
  label: "Approuv\xE9",
1125
1418
  bgColor: "bg-green-50",
1126
1419
  textColor: "text-green-700",
@@ -1128,7 +1421,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1128
1421
  };
1129
1422
  case "refused":
1130
1423
  return {
1131
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.XCircle, { className: "w-5 h-5 text-red-600" }),
1424
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-5 h-5 text-red-600" }),
1132
1425
  label: "Refus\xE9",
1133
1426
  bgColor: "bg-red-50",
1134
1427
  textColor: "text-red-700",
@@ -1136,7 +1429,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1136
1429
  };
1137
1430
  case "suggest-correction":
1138
1431
  return {
1139
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Edit, { className: "w-5 h-5 text-orange-600" }),
1432
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-5 h-5 text-orange-600" }),
1140
1433
  label: "Correction sugg\xE9r\xE9e",
1141
1434
  bgColor: "bg-orange-50",
1142
1435
  textColor: "text-orange-700",
@@ -1145,7 +1438,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1145
1438
  case "waiting":
1146
1439
  default:
1147
1440
  return {
1148
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react.Clock, { className: "w-5 h-5 text-gray-500" }),
1441
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Clock, { className: "w-5 h-5 text-gray-500" }),
1149
1442
  label: "En attente",
1150
1443
  bgColor: "bg-gray-50",
1151
1444
  textColor: "text-gray-700",
@@ -1163,7 +1456,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1163
1456
  "div",
1164
1457
  {
1165
1458
  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}` })
1459
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.User, { className: `w-5 h-5 ${statusDisplay.textColor}` })
1167
1460
  }
1168
1461
  ) }),
1169
1462
  /* @__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 +1470,10 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1177
1470
  userEmail && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-gray-600 truncate mb-2", children: userEmail }),
1178
1471
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2 mb-1", children: [
1179
1472
  /* @__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" })
1473
+ approval.answer === "approved" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-3 h-3 text-green-600" }),
1474
+ approval.answer === "refused" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-3 h-3 text-red-600" }),
1475
+ approval.answer === "suggest-correction" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-3 h-3 text-orange-600" }),
1476
+ approval.answer === "waiting" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Clock, { className: "w-3 h-3 text-gray-500" })
1184
1477
  ] }) }),
1185
1478
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `text-xs font-medium ${statusDisplay.textColor}`, children: statusDisplay.label })
1186
1479
  ] }),
@@ -1205,17 +1498,17 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1205
1498
  /* @__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
1499
  caseData?.requester && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-3", children: [
1207
1500
  /* @__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]" }),
1501
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Send, { className: "w-5 h-5 text-[#6A8A82]" }),
1209
1502
  "Demandeur"
1210
1503
  ] }),
1211
1504
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex gap-3", children: [
1212
1505
  (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" }) }) }),
1506
+ /* @__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
1507
  /* @__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
1508
  /* @__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
1509
  caseData.requester.email && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-xs text-gray-600 truncate", children: caseData.requester.email }),
1217
1510
  /* @__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" }) }),
1511
+ /* @__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
1512
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-xs text-blue-700 font-medium", children: [
1220
1513
  "Demande cr\xE9\xE9e le ",
1221
1514
  new Date(caseData.created_at || "").toLocaleDateString("fr-FR", {
@@ -1230,7 +1523,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1230
1523
  ] }),
1231
1524
  caseData?.verifications && caseData.verifications.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-3", children: [
1232
1525
  /* @__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]" }),
1526
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.FileText, { className: "w-5 h-5 text-[#6A8A82]" }),
1234
1527
  "V\xE9rifications (",
1235
1528
  caseData.verifications.length,
1236
1529
  ")"
@@ -1246,7 +1539,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1246
1539
  ] }),
1247
1540
  caseData?.validations && caseData.validations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-3", children: [
1248
1541
  /* @__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]" }),
1542
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-5 h-5 text-[#6A8A82]" }),
1250
1543
  "Validations (",
1251
1544
  caseData.validations.length,
1252
1545
  ")"
@@ -1256,7 +1549,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1256
1549
  ) })
1257
1550
  ] }),
1258
1551
  (!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" }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.AlertCircle, { className: "w-12 h-12 mx-auto mb-3 text-gray-400" }),
1260
1553
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm", children: "Aucune approbation requise" })
1261
1554
  ] })
1262
1555
  ] }) }),
@@ -1286,7 +1579,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1286
1579
  dangerouslySetInnerHTML: { __html: caseData.html_content }
1287
1580
  }
1288
1581
  ) : /* @__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" }),
1582
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Eye, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
1290
1583
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[#767676]", children: "Aucun aper\xE7u disponible" })
1291
1584
  ] })
1292
1585
  ] }) }),
@@ -1298,7 +1591,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1298
1591
  disabled: submitting || caseData?.status !== "waiting",
1299
1592
  classname: "flex items-center gap-2",
1300
1593
  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" }),
1594
+ 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
1595
  "Refuser"
1303
1596
  ]
1304
1597
  }
@@ -1310,7 +1603,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1310
1603
  disabled: submitting || caseData?.status !== "waiting",
1311
1604
  classname: "flex items-center gap-2",
1312
1605
  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" }),
1606
+ 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
1607
  "Sugg\xE9rer une correction"
1315
1608
  ]
1316
1609
  }
@@ -1322,7 +1615,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1322
1615
  disabled: submitting || caseData?.status !== "waiting",
1323
1616
  classname: "flex items-center gap-2",
1324
1617
  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" }),
1618
+ 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
1619
  "Accepter"
1327
1620
  ]
1328
1621
  }
@@ -1343,7 +1636,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1343
1636
  onClick: closeNoteModal,
1344
1637
  disabled: submitting,
1345
1638
  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" })
1639
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { className: "w-5 h-5" })
1347
1640
  }
1348
1641
  )
1349
1642
  ] }),
@@ -1381,12 +1674,12 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
1381
1674
  disabled: submitting || currentAction === "suggest" && !note.trim(),
1382
1675
  classname: "flex items-center gap-2",
1383
1676
  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" }),
1677
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Loader, { className: "w-4 h-4 animate-spin" }),
1385
1678
  "Traitement..."
1386
1679
  ] }) : /* @__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" }),
1680
+ currentAction === "approve" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { className: "w-4 h-4" }),
1681
+ currentAction === "reject" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-4 h-4" }),
1682
+ currentAction === "suggest" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "w-4 h-4" }),
1390
1683
  "Confirmer"
1391
1684
  ] })
1392
1685
  }
@@ -1399,11 +1692,86 @@ var ApprovalPreviewAnswer_default = ApprovalPreviewAnswer;
1399
1692
 
1400
1693
  // src/components/layout/ModernDoubleSidebarLayout.tsx
1401
1694
  var import_jsx_runtime9 = require("react/jsx-runtime");
1695
+ var MODULE_URLS = {
1696
+ production: {
1697
+ wiseConnect: "https://rewise.praedium-tech.com/admin/crm/trade-strategy/lead-insight/",
1698
+ wiseReach: "https://rewise.praedium-tech.com/admin/marketing/dashboard/",
1699
+ wiseOps: "https://wisefm.praedium-tech.com/",
1700
+ wiseGuard: "https://rewise.praedium-tech.com/admin/security/dashboard/",
1701
+ wiseThrive: "https://rewise.praedium-tech.com/admin/thrive/scorecard/dashboard/financial/",
1702
+ wiseView: "https://reporting.rewise.praedium-tech.com/",
1703
+ wiseProcess: "https://rewise.praedium-tech.com/workspace/sop-connect/",
1704
+ wiseBill: "https://rewise.praedium-tech.com/admin/invoicing/insight/summary/",
1705
+ wiseBooks: "https://rewise.praedium-tech.com/admin/accounting/client/invoice-queue/",
1706
+ wiseAsset: "#",
1707
+ wiseCash: "https://rewise.praedium-tech.com/admin/finance/dashboard/",
1708
+ wiseCollect: "https://rewise.praedium-tech.com/admin/recovery/collection/dashboard/",
1709
+ wiseProcure: "https://rewise.praedium-tech.com/admin/procurement/dashboard/one/",
1710
+ wiseHR: "https://rewise.praedium-tech.com/admin/human-capital/dashboard/"
1711
+ },
1712
+ development: {
1713
+ wiseConnect: "http://localhost:5173/admin/crm/trade-strategy/lead-insight/",
1714
+ wiseReach: "http://localhost:5173/admin/marketing/dashboard/",
1715
+ wiseOps: "http://localhost:5174/",
1716
+ wiseGuard: "http://localhost:5173/admin/security/dashboard/",
1717
+ wiseThrive: "http://localhost:5173/admin/thrive/scorecard/dashboard/financial/",
1718
+ wiseView: "http://localhost:5175/",
1719
+ wiseProcess: "http://localhost:5173/workspace/sop-connect/",
1720
+ wiseBill: "http://localhost:5173/admin/invoicing/insight/summary/",
1721
+ wiseBooks: "http://localhost:5173/admin/accounting/client/invoice-queue/",
1722
+ wiseAsset: "#",
1723
+ wiseCash: "http://localhost:5173/admin/finance/dashboard/",
1724
+ wiseCollect: "http://localhost:5173/admin/recovery/collection/dashboard/",
1725
+ wiseProcure: "http://localhost:5173/admin/procurement/dashboard/one/",
1726
+ wiseHR: "http://localhost:5173/admin/human-capital/dashboard/"
1727
+ }
1728
+ };
1729
+ var getModuleUrls = (token) => {
1730
+ const env = localStorage.getItem("env") || "prod";
1731
+ const urls = env === "localhost" ? MODULE_URLS.development : MODULE_URLS.production;
1732
+ return {
1733
+ ...urls,
1734
+ wiseOps: token ? `${urls.wiseOps}?tkn=${token}` : urls.wiseOps
1735
+ };
1736
+ };
1737
+ var MODULE_CODE_MAP = {
1738
+ "CRM": "WiseConnect",
1739
+ "MARKETING": "WiseReach",
1740
+ "FACILITY": "WiseOps",
1741
+ "SECURITY": "WiseGuard",
1742
+ "THRIVE": "WiseThrive",
1743
+ "BI": "WiseView",
1744
+ "SOP": "WiseProcess",
1745
+ "BILLING": "WiseBill",
1746
+ "ACCOUNTING": "WiseBooks",
1747
+ "ASSET": "WiseAsset",
1748
+ "FINANCE": "WiseCash",
1749
+ "COLLECTION": "WiseCollect",
1750
+ "PURCHASE": "WiseProcure",
1751
+ "HR": "WiseHR"
1752
+ };
1402
1753
  var RewiseLayout = ({ children, module_name = "Rewise", module_description = "Description du module", primaryMenuItems, secondaryMenuItems }) => {
1403
1754
  const location = (0, import_react_router_dom3.useLocation)();
1404
1755
  const navigate = (0, import_react_router_dom3.useNavigate)();
1405
1756
  const { theme, themeType, setTheme } = useTheme();
1406
- const { loggedUser, activeBusinessEntity, setActiveBusinessEntity } = useSession();
1757
+ const { loggedUser, token, activeBusinessEntity, setActiveBusinessEntity } = useSession();
1758
+ const moduleUrls = getModuleUrls(token || void 0);
1759
+ const getOrganizationModules = () => {
1760
+ if (!activeBusinessEntity) return [];
1761
+ const org = activeBusinessEntity.organization;
1762
+ if (typeof org === "object" && org !== null && "modules" in org) {
1763
+ return org.modules || [];
1764
+ }
1765
+ return [];
1766
+ };
1767
+ const organizationModules = getOrganizationModules();
1768
+ const organizationModuleCodes = organizationModules.map((m) => m.code);
1769
+ const isModuleAccessible = (moduleName) => {
1770
+ if (organizationModules.length === 0) return true;
1771
+ const moduleCode = Object.entries(MODULE_CODE_MAP).find(([_, name]) => name === moduleName)?.[0];
1772
+ if (!moduleCode) return true;
1773
+ return organizationModuleCodes.includes(moduleCode);
1774
+ };
1407
1775
  const [primaryCollapsed, setPrimaryCollapsed] = (0, import_react5.useState)(false);
1408
1776
  const [secondaryCollapsed, setSecondaryCollapsed] = (0, import_react5.useState)(false);
1409
1777
  const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react5.useState)(false);
@@ -1413,6 +1781,54 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1413
1781
  const [showUserMenu, setShowUserMenu] = (0, import_react5.useState)(false);
1414
1782
  const [showThemeMenu, setShowThemeMenu] = (0, import_react5.useState)(false);
1415
1783
  const [showCenterMenu, setShowCenterMenu] = (0, import_react5.useState)(false);
1784
+ const [showModulesMenu, setShowModulesMenu] = (0, import_react5.useState)(false);
1785
+ const [showProfileModal, setShowProfileModal] = (0, import_react5.useState)(false);
1786
+ const [showEditProfileModal, setShowEditProfileModal] = (0, import_react5.useState)(false);
1787
+ const [showChangePasswordModal, setShowChangePasswordModal] = (0, import_react5.useState)(false);
1788
+ const [currentSlide, setCurrentSlide] = (0, import_react5.useState)(0);
1789
+ const [editProfileData, setEditProfileData] = (0, import_react5.useState)({
1790
+ first_name: "",
1791
+ last_name: "",
1792
+ email: "",
1793
+ phonenumber: "",
1794
+ job_title: "",
1795
+ department: ""
1796
+ });
1797
+ const [savingProfile, setSavingProfile] = (0, import_react5.useState)(false);
1798
+ const [uploadingPhoto, setUploadingPhoto] = (0, import_react5.useState)(false);
1799
+ const [passwordData, setPasswordData] = (0, import_react5.useState)({
1800
+ current_password: "",
1801
+ new_password: "",
1802
+ confirm_password: ""
1803
+ });
1804
+ const [savingPassword, setSavingPassword] = (0, import_react5.useState)(false);
1805
+ const [showCurrentPassword, setShowCurrentPassword] = (0, import_react5.useState)(false);
1806
+ const [showNewPassword, setShowNewPassword] = (0, import_react5.useState)(false);
1807
+ const [showConfirmPassword, setShowConfirmPassword] = (0, import_react5.useState)(false);
1808
+ const fileInputRef = import_react5.default.useRef(null);
1809
+ const slides = [
1810
+ {
1811
+ title: "Rappel \u2013 Gestion des jours de cong\xE9",
1812
+ 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."
1813
+ },
1814
+ {
1815
+ title: "Nouveau \u2013 Mise \xE0 jour des proc\xE9dures",
1816
+ content: "Les nouvelles proc\xE9dures de validation sont maintenant disponibles. Consultez votre manuel utilisateur pour plus d'informations sur les changements."
1817
+ },
1818
+ {
1819
+ title: "Important \u2013 Formation obligatoire",
1820
+ 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."
1821
+ }
1822
+ ];
1823
+ const nextSlide = () => {
1824
+ setCurrentSlide((prev) => (prev + 1) % slides.length);
1825
+ };
1826
+ const prevSlide = () => {
1827
+ setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length);
1828
+ };
1829
+ const goToSlide = (index) => {
1830
+ setCurrentSlide(index);
1831
+ };
1416
1832
  const [showApprovalModal, setShowApprovalModal] = (0, import_react5.useState)(false);
1417
1833
  const [approvalAnswerDetail, setApprovalAnswerDetail] = (0, import_react5.useState)(null);
1418
1834
  const [caseData, setCaseData] = (0, import_react5.useState)(null);
@@ -1436,6 +1852,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1436
1852
  setShowNotifications(false);
1437
1853
  setShowUserMenu(false);
1438
1854
  setShowThemeMenu(false);
1855
+ setShowModulesMenu(false);
1439
1856
  setMobileMenuOpen(false);
1440
1857
  }
1441
1858
  };
@@ -1507,6 +1924,133 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1507
1924
  showError("Erreur lors du marquage de la notification comme lue");
1508
1925
  }
1509
1926
  };
1927
+ const openEditProfileModal = () => {
1928
+ setEditProfileData({
1929
+ first_name: loggedUser?.first_name || "",
1930
+ last_name: loggedUser?.last_name || "",
1931
+ email: loggedUser?.email || "",
1932
+ phonenumber: loggedUser?.phonenumber || "",
1933
+ job_title: loggedUser?.job_title || "",
1934
+ department: loggedUser?.department || ""
1935
+ });
1936
+ setShowEditProfileModal(true);
1937
+ };
1938
+ const handleSaveProfile = async () => {
1939
+ setSavingProfile(true);
1940
+ try {
1941
+ const response = await UserServices.updateMyProfile(editProfileData);
1942
+ if (response.success) {
1943
+ success("Profil mis \xE0 jour avec succ\xE8s");
1944
+ setShowEditProfileModal(false);
1945
+ window.location.reload();
1946
+ } else {
1947
+ showError(response.message || "Erreur lors de la mise \xE0 jour du profil");
1948
+ }
1949
+ } catch (error) {
1950
+ console.error("Erreur lors de la mise \xE0 jour du profil:", error);
1951
+ showError("Erreur lors de la mise \xE0 jour du profil");
1952
+ } finally {
1953
+ setSavingProfile(false);
1954
+ }
1955
+ };
1956
+ const handlePhotoChange = async (event) => {
1957
+ const file = event.target.files?.[0];
1958
+ if (!file) return;
1959
+ const allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"];
1960
+ if (!allowedTypes.includes(file.type)) {
1961
+ showError("Format de fichier non support\xE9. Utilisez JPG, PNG, GIF ou WebP.");
1962
+ return;
1963
+ }
1964
+ const maxSize = 5 * 1024 * 1024;
1965
+ if (file.size > maxSize) {
1966
+ showError("La taille du fichier ne doit pas d\xE9passer 5 MB");
1967
+ return;
1968
+ }
1969
+ setUploadingPhoto(true);
1970
+ try {
1971
+ const response = await UserServices.updateProfilePicture(file);
1972
+ if (response.success) {
1973
+ success("Photo de profil mise \xE0 jour avec succ\xE8s");
1974
+ window.location.reload();
1975
+ } else {
1976
+ showError(response.message || "Erreur lors du t\xE9l\xE9chargement de la photo");
1977
+ }
1978
+ } catch (error) {
1979
+ console.error("Erreur lors du t\xE9l\xE9chargement de la photo:", error);
1980
+ showError("Erreur lors du t\xE9l\xE9chargement de la photo");
1981
+ } finally {
1982
+ setUploadingPhoto(false);
1983
+ if (fileInputRef.current) {
1984
+ fileInputRef.current.value = "";
1985
+ }
1986
+ }
1987
+ };
1988
+ const handleDeletePhoto = async () => {
1989
+ setUploadingPhoto(true);
1990
+ try {
1991
+ const response = await UserServices.deleteProfilePicture();
1992
+ if (response.success) {
1993
+ success("Photo de profil supprim\xE9e");
1994
+ window.location.reload();
1995
+ } else {
1996
+ showError(response.message || "Erreur lors de la suppression de la photo");
1997
+ }
1998
+ } catch (error) {
1999
+ console.error("Erreur lors de la suppression de la photo:", error);
2000
+ showError("Erreur lors de la suppression de la photo");
2001
+ } finally {
2002
+ setUploadingPhoto(false);
2003
+ }
2004
+ };
2005
+ const openChangePasswordModal = () => {
2006
+ setPasswordData({
2007
+ current_password: "",
2008
+ new_password: "",
2009
+ confirm_password: ""
2010
+ });
2011
+ setShowCurrentPassword(false);
2012
+ setShowNewPassword(false);
2013
+ setShowConfirmPassword(false);
2014
+ setShowChangePasswordModal(true);
2015
+ };
2016
+ const handleChangePassword = async () => {
2017
+ if (!passwordData.current_password) {
2018
+ showError("Veuillez entrer votre mot de passe actuel");
2019
+ return;
2020
+ }
2021
+ if (!passwordData.new_password) {
2022
+ showError("Veuillez entrer un nouveau mot de passe");
2023
+ return;
2024
+ }
2025
+ if (passwordData.new_password.length < 8) {
2026
+ showError("Le nouveau mot de passe doit contenir au moins 8 caract\xE8res");
2027
+ return;
2028
+ }
2029
+ if (passwordData.new_password !== passwordData.confirm_password) {
2030
+ showError("Les mots de passe ne correspondent pas");
2031
+ return;
2032
+ }
2033
+ setSavingPassword(true);
2034
+ try {
2035
+ const response = await UserServices.changePassword(passwordData);
2036
+ if (response.success) {
2037
+ success("Mot de passe chang\xE9 avec succ\xE8s");
2038
+ setShowChangePasswordModal(false);
2039
+ setPasswordData({
2040
+ current_password: "",
2041
+ new_password: "",
2042
+ confirm_password: ""
2043
+ });
2044
+ } else {
2045
+ showError(response.message || "Erreur lors du changement de mot de passe");
2046
+ }
2047
+ } catch (error) {
2048
+ console.error("Erreur lors du changement de mot de passe:", error);
2049
+ showError("Mot de passe actuel incorrect ou erreur serveur");
2050
+ } finally {
2051
+ setSavingPassword(false);
2052
+ }
2053
+ };
1510
2054
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-screen bg-[var(--color-background)] overflow-hidden", children: [
1511
2055
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1512
2056
  "a",
@@ -1544,7 +2088,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1544
2088
  className: "text-[var(--color-sidebar-text-secondary)] hover:text-[var(--color-sidebar-text)] transition-colors",
1545
2089
  "aria-label": primaryCollapsed ? "D\xE9velopper le menu" : "R\xE9duire le menu",
1546
2090
  "aria-expanded": !primaryCollapsed,
1547
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.ChevronLeft, { className: cn(
2091
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLeft, { className: cn(
1548
2092
  "w-5 h-5 transition-transform",
1549
2093
  primaryCollapsed && "rotate-180"
1550
2094
  ) })
@@ -1600,7 +2144,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1600
2144
  "flex items-center gap-3",
1601
2145
  primaryCollapsed && "justify-center"
1602
2146
  ), 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)]" }) }),
2147
+ /* @__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
2148
  !primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1", children: [
1605
2149
  /* @__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
2150
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-sidebar-text-secondary)]", children: loggedUser?.email || "email@example.com" })
@@ -1616,7 +2160,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1616
2160
  onClick: () => setSecondaryCollapsed(false),
1617
2161
  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
2162
  "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)]" })
2163
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
1620
2164
  }
1621
2165
  ),
1622
2166
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
@@ -1637,7 +2181,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1637
2181
  onClick: () => setSecondaryCollapsed(!secondaryCollapsed),
1638
2182
  className: "text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)] flex-shrink-0",
1639
2183
  "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(
2184
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronLeft, { className: cn(
1641
2185
  "w-4 h-4 transition-transform",
1642
2186
  secondaryCollapsed && "rotate-180"
1643
2187
  ) })
@@ -1712,7 +2256,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1712
2256
  onClick: () => setMobileMenuOpen(false),
1713
2257
  className: "text-[var(--color-sidebar-text-secondary)]",
1714
2258
  "aria-label": "Fermer le menu",
1715
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.X, { className: "w-6 h-6" })
2259
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.X, { className: "w-6 h-6" })
1716
2260
  }
1717
2261
  )
1718
2262
  ] }),
@@ -1790,7 +2334,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1790
2334
  onClick: () => setMobileMenuOpen(true),
1791
2335
  className: "lg:hidden text-[var(--color-text-primary)]",
1792
2336
  "aria-label": "Ouvrir le menu mobile",
1793
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Menu, { className: "w-6 h-6" })
2337
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Menu, { className: "w-6 h-6" })
1794
2338
  }
1795
2339
  ),
1796
2340
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1799,7 +2343,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1799
2343
  className: "hidden sm:flex items-center gap-2 text-sm",
1800
2344
  "aria-label": "Fil d'Ariane",
1801
2345
  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)]" }),
2346
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }),
1803
2347
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1804
2348
  "button",
1805
2349
  {
@@ -1815,7 +2359,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1815
2359
  }
1816
2360
  ),
1817
2361
  /* @__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" }),
2362
+ /* @__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
2363
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1820
2364
  "input",
1821
2365
  {
@@ -1831,6 +2375,17 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1831
2375
  ] })
1832
2376
  ] }),
1833
2377
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
2378
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2379
+ "button",
2380
+ {
2381
+ onClick: () => setShowModulesMenu(!showModulesMenu),
2382
+ className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2383
+ title: "Acc\xE8s aux modules",
2384
+ "aria-label": "Menu des modules",
2385
+ "aria-expanded": showModulesMenu,
2386
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.LayoutGrid, { className: "w-5 h-5 text-[var(--color-text-secondary)]" })
2387
+ }
2388
+ ) }),
1834
2389
  loggedUser?.centers_access && loggedUser.centers_access.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
1835
2390
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1836
2391
  "button",
@@ -1841,9 +2396,9 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1841
2396
  "aria-label": "S\xE9lecteur de centre",
1842
2397
  "aria-expanded": showCenterMenu,
1843
2398
  children: [
1844
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Building2, { className: "w-4 h-4 text-[var(--color-primary)]" }),
2399
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Building2, { className: "w-4 h-4 text-[var(--color-primary)]" }),
1845
2400
  /* @__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(
2401
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.ChevronRight, { className: cn(
1847
2402
  "w-4 h-4 text-[var(--color-text-tertiary)] transition-transform",
1848
2403
  showCenterMenu && "rotate-90"
1849
2404
  ) })
@@ -1872,7 +2427,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1872
2427
  ),
1873
2428
  role: "menuitem",
1874
2429
  children: [
1875
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Building2, { className: cn(
2430
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Building2, { className: cn(
1876
2431
  "w-5 h-5",
1877
2432
  selectedCenterId === center.id ? "text-[var(--color-primary)]" : "text-[var(--color-text-tertiary)]"
1878
2433
  ) }),
@@ -1900,7 +2455,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1900
2455
  title: "Changer le th\xE8me",
1901
2456
  "aria-label": "S\xE9lecteur de th\xE8me",
1902
2457
  "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)]" })
2458
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Palette, { className: "w-5 h-5 text-[var(--color-text-secondary)]" })
1904
2459
  }
1905
2460
  ),
1906
2461
  showThemeMenu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1970,7 +2525,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1970
2525
  )
1971
2526
  ] }),
1972
2527
  /* @__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" }),
2528
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.DollarSign, { className: "w-4 h-4 text-[var(--color-primary)] mr-2" }),
1974
2529
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: "FCFA" })
1975
2530
  ] }),
1976
2531
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
@@ -1982,7 +2537,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1982
2537
  "aria-label": `Notifications ${notifications.filter((n) => !n.read).length > 0 ? `(${notifications.filter((n) => !n.read).length} non lues)` : ""}`,
1983
2538
  "aria-expanded": showNotifications,
1984
2539
  children: [
1985
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Bell, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
2540
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Bell, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
1986
2541
  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
2542
  ]
1988
2543
  }
@@ -2032,7 +2587,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2032
2587
  className: "flex items-center gap-2 p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2033
2588
  "aria-label": "Menu utilisateur",
2034
2589
  "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)]" }) })
2590
+ 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
2591
  }
2037
2592
  ),
2038
2593
  showUserMenu && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -2045,10 +2600,14 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2045
2600
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2046
2601
  "button",
2047
2602
  {
2603
+ onClick: () => {
2604
+ setShowProfileModal(true);
2605
+ setShowUserMenu(false);
2606
+ },
2048
2607
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
2049
2608
  role: "menuitem",
2050
2609
  children: [
2051
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.User, { className: "w-4 h-4" }),
2610
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.User, { className: "w-4 h-4" }),
2052
2611
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "Mon profil" })
2053
2612
  ]
2054
2613
  }
@@ -2063,7 +2622,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2063
2622
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
2064
2623
  role: "menuitem",
2065
2624
  children: [
2066
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.Settings, { className: "w-4 h-4" }),
2625
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Settings, { className: "w-4 h-4" }),
2067
2626
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "Param\xE8tres" })
2068
2627
  ]
2069
2628
  }
@@ -2074,7 +2633,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2074
2633
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
2075
2634
  role: "menuitem",
2076
2635
  children: [
2077
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.HelpCircle, { className: "w-4 h-4" }),
2636
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.HelpCircle, { className: "w-4 h-4" }),
2078
2637
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "Aide" })
2079
2638
  ]
2080
2639
  }
@@ -2086,7 +2645,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2086
2645
  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
2646
  role: "menuitem",
2088
2647
  children: [
2089
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.LogOut, { className: "w-4 h-4" }),
2648
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.LogOut, { className: "w-4 h-4" }),
2090
2649
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm", children: "D\xE9connexion" })
2091
2650
  ]
2092
2651
  }
@@ -2109,30 +2668,659 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2109
2668
  }
2110
2669
  )
2111
2670
  ] }),
2112
- showApprovalModal && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2671
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2113
2672
  Modals_default,
2114
2673
  {
2115
- title: "NOTIFICATION D'APPROBATION",
2116
- description: "",
2117
- open: showApprovalModal,
2118
- onClose: () => setShowApprovalModal(false),
2119
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2120
- ApprovalAnswerModal,
2121
- {
2122
- answer_id: approvalAnswerDetail.answer_id,
2123
- link_token: approvalAnswerDetail.link_token,
2124
- object_detail: approvalAnswerDetail.case
2125
- }
2126
- )
2127
- }
2128
- )
2129
- ] });
2130
- };
2131
- var ModernDoubleSidebarLayout_default = RewiseLayout;
2132
-
2674
+ title: "Modules REWISE",
2675
+ description: "Acc\xE9dez rapidement \xE0 tous les modules",
2676
+ width: "max-w-6xl",
2677
+ open: showModulesMenu,
2678
+ onClose: () => setShowModulesMenu(false),
2679
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-6", children: [
2680
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4 lg:items-stretch", children: [
2681
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-[3] bg-[#D3E1F2] rounded-lg p-5 relative min-h-[160px]", children: [
2682
+ /* @__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 }),
2683
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-gray-600 text-sm leading-relaxed line-clamp-3", children: slides[currentSlide].content }),
2684
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2685
+ "button",
2686
+ {
2687
+ onClick: prevSlide,
2688
+ 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",
2689
+ children: "\u2039"
2690
+ }
2691
+ ),
2692
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2693
+ "button",
2694
+ {
2695
+ onClick: nextSlide,
2696
+ 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",
2697
+ children: "\u203A"
2698
+ }
2699
+ ),
2700
+ /* @__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)(
2701
+ "button",
2702
+ {
2703
+ onClick: () => goToSlide(index),
2704
+ className: `w-2 h-2 rounded-full transition-colors ${index === currentSlide ? "bg-red-600" : "bg-white"}`
2705
+ },
2706
+ index
2707
+ )) })
2708
+ ] }),
2709
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-[1] bg-white border border-gray-200 rounded-lg overflow-hidden flex flex-col", children: [
2710
+ /* @__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" }) }),
2711
+ /* @__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)(
2712
+ "div",
2713
+ {
2714
+ className: "bg-gray-50 border border-gray-200 rounded p-2 cursor-pointer hover:bg-gray-100",
2715
+ onClick: () => markNotificationAsRead(notif.id),
2716
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start space-x-2", children: [
2717
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Bell, { className: "w-3 h-3 text-gray-500 mt-0.5 flex-shrink-0" }),
2718
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 min-w-0", children: [
2719
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h4", { className: "font-medium text-xs text-gray-800 truncate", children: notif.title }),
2720
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-gray-600 line-clamp-1", children: notif.message })
2721
+ ] })
2722
+ ] })
2723
+ },
2724
+ notif.id
2725
+ )) })
2726
+ ] })
2727
+ ] }),
2728
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col lg:flex-row gap-6", children: [
2729
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 bg-white border border-gray-200 rounded-lg p-4 shadow-sm", children: [
2730
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Op\xE9rations" }),
2731
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-3", children: [
2732
+ { name: "WiseConnect", icon: crm_blue_default, iconWhite: crmwhite_default, url: moduleUrls.wiseConnect },
2733
+ { name: "WiseReach", icon: marketingblue_default, iconWhite: marketingblanc_default, url: moduleUrls.wiseReach },
2734
+ { name: "WiseOps", icon: facilityblue_default, iconWhite: facilityblanc_default, url: moduleUrls.wiseOps },
2735
+ { name: "WiseGuard", icon: security_managementblue_default, iconWhite: security_managementblanc_default, url: moduleUrls.wiseGuard }
2736
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2737
+ "button",
2738
+ {
2739
+ onClick: () => {
2740
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2741
+ setShowModulesMenu(false);
2742
+ },
2743
+ className: "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2744
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2745
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2746
+ "img",
2747
+ {
2748
+ src: module2.icon,
2749
+ alt: module2.name,
2750
+ className: "w-12 h-12 mb-2 group-hover:hidden"
2751
+ }
2752
+ ),
2753
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2754
+ "img",
2755
+ {
2756
+ src: module2.iconWhite,
2757
+ alt: module2.name,
2758
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2759
+ }
2760
+ ),
2761
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800 group-hover:text-white", children: module2.name })
2762
+ ] })
2763
+ },
2764
+ module2.name
2765
+ )) })
2766
+ ] }),
2767
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 bg-white border border-gray-200 rounded-lg p-4 shadow-sm", children: [
2768
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Performance" }),
2769
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-3", children: [
2770
+ { name: "WiseThrive", icon: thriveblue_default, iconWhite: thriveblanc_default, url: moduleUrls.wiseThrive },
2771
+ { name: "WiseView", icon: wiseblues_default, iconWhite: wiseblancs_default, url: moduleUrls.wiseView },
2772
+ { name: "WiseProcess", icon: sopblues_default, iconWhite: sopblancs_default, url: moduleUrls.wiseProcess }
2773
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2774
+ "button",
2775
+ {
2776
+ onClick: () => {
2777
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2778
+ setShowModulesMenu(false);
2779
+ },
2780
+ className: "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2781
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2782
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2783
+ "img",
2784
+ {
2785
+ src: module2.icon,
2786
+ alt: module2.name,
2787
+ className: "w-12 h-12 mb-2 group-hover:hidden"
2788
+ }
2789
+ ),
2790
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2791
+ "img",
2792
+ {
2793
+ src: module2.iconWhite,
2794
+ alt: module2.name,
2795
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2796
+ }
2797
+ ),
2798
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800 group-hover:text-white", children: module2.name })
2799
+ ] })
2800
+ },
2801
+ module2.name
2802
+ )) })
2803
+ ] })
2804
+ ] }),
2805
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-white border border-gray-200 rounded-lg p-4 shadow-sm", children: [
2806
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Fonctions Support" }),
2807
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4", children: [
2808
+ /* @__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: [
2809
+ { name: "WiseBill", icon: invoicingblue_default, iconWhite: invoicingblanc_default, url: moduleUrls.wiseBill },
2810
+ { name: "WiseBooks", icon: accountingblue_default, iconWhite: accountingblanc_default, url: moduleUrls.wiseBooks },
2811
+ { name: "WiseAsset", icon: assetblue_default, iconWhite: assetblanc_default, url: moduleUrls.wiseAsset },
2812
+ { name: "WiseCash", icon: financeblue_default, iconWhite: financeblanc_default, url: moduleUrls.wiseCash },
2813
+ { name: "WiseCollect", icon: collection_litigationblue_default, iconWhite: collection_litigationblanc_default, url: moduleUrls.wiseCollect }
2814
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2815
+ "button",
2816
+ {
2817
+ onClick: () => {
2818
+ if (module2.url !== "#") {
2819
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2820
+ }
2821
+ setShowModulesMenu(false);
2822
+ },
2823
+ className: cn(
2824
+ "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2825
+ module2.url === "#" && "opacity-50 cursor-not-allowed hover:bg-gray-100"
2826
+ ),
2827
+ disabled: module2.url === "#",
2828
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2829
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2830
+ "img",
2831
+ {
2832
+ src: module2.icon,
2833
+ alt: module2.name,
2834
+ className: cn("w-12 h-12 mb-2", module2.url !== "#" && "group-hover:hidden")
2835
+ }
2836
+ ),
2837
+ module2.url !== "#" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2838
+ "img",
2839
+ {
2840
+ src: module2.iconWhite,
2841
+ alt: module2.name,
2842
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2843
+ }
2844
+ ),
2845
+ /* @__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 })
2846
+ ] })
2847
+ },
2848
+ module2.name
2849
+ )) }) }),
2850
+ /* @__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: [
2851
+ { name: "WiseProcure", icon: procurementblue_default, iconWhite: procurementblanc_default, url: moduleUrls.wiseProcure },
2852
+ { name: "WiseHR", icon: human_capitalblue_default, iconWhite: human_capitalblanc_default, url: moduleUrls.wiseHR }
2853
+ ].map((module2) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2854
+ "button",
2855
+ {
2856
+ onClick: () => {
2857
+ window.open(module2.url, "_blank", "noopener,noreferrer");
2858
+ setShowModulesMenu(false);
2859
+ },
2860
+ className: "group p-4 rounded-lg bg-gray-100 hover:bg-[#4A5568] transition-all duration-200 text-center",
2861
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center", children: [
2862
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2863
+ "img",
2864
+ {
2865
+ src: module2.icon,
2866
+ alt: module2.name,
2867
+ className: "w-12 h-12 mb-2 group-hover:hidden"
2868
+ }
2869
+ ),
2870
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2871
+ "img",
2872
+ {
2873
+ src: module2.iconWhite,
2874
+ alt: module2.name,
2875
+ className: "w-12 h-12 mb-2 hidden group-hover:block"
2876
+ }
2877
+ ),
2878
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-800 group-hover:text-white", children: module2.name })
2879
+ ] })
2880
+ },
2881
+ module2.name
2882
+ )) }) })
2883
+ ] })
2884
+ ] })
2885
+ ] })
2886
+ }
2887
+ ),
2888
+ showApprovalModal && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2889
+ Modals_default,
2890
+ {
2891
+ title: "NOTIFICATION D'APPROBATION",
2892
+ description: "",
2893
+ open: showApprovalModal,
2894
+ onClose: () => setShowApprovalModal(false),
2895
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2896
+ ApprovalAnswerModal,
2897
+ {
2898
+ answer_id: approvalAnswerDetail.answer_id,
2899
+ link_token: approvalAnswerDetail.link_token,
2900
+ object_detail: approvalAnswerDetail.case
2901
+ }
2902
+ )
2903
+ }
2904
+ ),
2905
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2906
+ Modals_default,
2907
+ {
2908
+ title: "Mon Profil",
2909
+ description: "G\xE9rez vos informations personnelles",
2910
+ width: "max-w-2xl",
2911
+ open: showProfileModal,
2912
+ onClose: () => setShowProfileModal(false),
2913
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-6", children: [
2914
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2915
+ "input",
2916
+ {
2917
+ ref: fileInputRef,
2918
+ type: "file",
2919
+ accept: "image/jpeg,image/png,image/gif,image/webp",
2920
+ onChange: handlePhotoChange,
2921
+ className: "hidden"
2922
+ }
2923
+ ),
2924
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col sm:flex-row items-center gap-6 pb-6 border-b border-[var(--color-border)]", children: [
2925
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative group", children: [
2926
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-24 h-24 bg-gradient-to-br from-[var(--color-primary)] to-[var(--color-accent)] rounded-full flex items-center justify-center shadow-lg overflow-hidden", children: uploadingPhoto ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Loader2, { className: "w-8 h-8 text-white animate-spin" }) : loggedUser?.profile_picture ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2927
+ "img",
2928
+ {
2929
+ src: loggedUser.profile_picture,
2930
+ alt: "Photo de profil",
2931
+ className: "w-full h-full rounded-full object-cover"
2932
+ }
2933
+ ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-3xl font-bold text-white", children: [
2934
+ loggedUser?.first_name?.charAt(0) || loggedUser?.username?.charAt(0) || "U",
2935
+ loggedUser?.last_name?.charAt(0) || ""
2936
+ ] }) }),
2937
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "absolute -bottom-1 -right-1 flex gap-1", children: [
2938
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2939
+ "button",
2940
+ {
2941
+ onClick: () => fileInputRef.current?.click(),
2942
+ disabled: uploadingPhoto,
2943
+ className: "w-8 h-8 bg-[var(--color-primary)] border-2 border-[var(--color-background)] rounded-full flex items-center justify-center shadow-md hover:bg-[var(--color-primary-dark)] transition-colors disabled:opacity-50",
2944
+ title: "Changer la photo",
2945
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Camera, { className: "w-4 h-4 text-white" })
2946
+ }
2947
+ ),
2948
+ loggedUser?.profile_picture && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2949
+ "button",
2950
+ {
2951
+ onClick: handleDeletePhoto,
2952
+ disabled: uploadingPhoto,
2953
+ className: "w-8 h-8 bg-red-500 border-2 border-[var(--color-background)] rounded-full flex items-center justify-center shadow-md hover:bg-red-600 transition-colors disabled:opacity-50",
2954
+ title: "Supprimer la photo",
2955
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Trash2, { className: "w-4 h-4 text-white" })
2956
+ }
2957
+ )
2958
+ ] })
2959
+ ] }),
2960
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center sm:text-left flex-1", children: [
2961
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-xl font-bold text-[var(--color-text-primary)]", children: loggedUser?.first_name && loggedUser?.last_name ? `${loggedUser.first_name} ${loggedUser.last_name}` : loggedUser?.username || "Utilisateur" }),
2962
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-[var(--color-text-secondary)] mt-1", children: loggedUser?.job_title || "Membre de l'\xE9quipe" }),
2963
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-center sm:justify-start gap-2 mt-2", children: [
2964
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(
2965
+ "px-2 py-1 text-xs font-medium rounded-full",
2966
+ loggedUser?.is_active ? "bg-green-100 text-green-700" : "bg-gray-100 text-gray-600"
2967
+ ), children: loggedUser?.is_active ? "Actif" : "Inactif" }),
2968
+ loggedUser?.is_staff && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-700", children: "Staff" })
2969
+ ] })
2970
+ ] }),
2971
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2972
+ "button",
2973
+ {
2974
+ onClick: openEditProfileModal,
2975
+ className: "flex items-center gap-2 px-4 py-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)] transition-colors",
2976
+ title: "Modifier le profil",
2977
+ children: [
2978
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Edit3, { className: "w-4 h-4" }),
2979
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium", children: "Modifier" })
2980
+ ]
2981
+ }
2982
+ )
2983
+ ] }),
2984
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
2985
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 p-4 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)]", children: [
2986
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary-light)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Mail, { className: "w-5 h-5 text-[var(--color-primary)]" }) }),
2987
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 min-w-0", children: [
2988
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] uppercase tracking-wide", children: "Email" }),
2989
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)] truncate", children: loggedUser?.email || "Non renseign\xE9" })
2990
+ ] })
2991
+ ] }),
2992
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 p-4 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)]", children: [
2993
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary-light)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Phone, { className: "w-5 h-5 text-[var(--color-primary)]" }) }),
2994
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 min-w-0", children: [
2995
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] uppercase tracking-wide", children: "T\xE9l\xE9phone" }),
2996
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)] truncate", children: loggedUser?.phonenumber || "Non renseign\xE9" })
2997
+ ] })
2998
+ ] }),
2999
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 p-4 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)]", children: [
3000
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary-light)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.User, { className: "w-5 h-5 text-[var(--color-primary)]" }) }),
3001
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 min-w-0", children: [
3002
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] uppercase tracking-wide", children: "Nom d'utilisateur" }),
3003
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)] truncate", children: loggedUser?.username || "Non renseign\xE9" })
3004
+ ] })
3005
+ ] }),
3006
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3 p-4 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)]", children: [
3007
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary-light)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Briefcase, { className: "w-5 h-5 text-[var(--color-primary)]" }) }),
3008
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 min-w-0", children: [
3009
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] uppercase tracking-wide", children: "D\xE9partement" }),
3010
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)] truncate", children: loggedUser?.department || "Non renseign\xE9" })
3011
+ ] })
3012
+ ] })
3013
+ ] }),
3014
+ loggedUser?.centers_access && loggedUser.centers_access.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pt-4 border-t border-[var(--color-border)]", children: [
3015
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("h3", { className: "text-sm font-semibold text-[var(--color-text-primary)] mb-3 flex items-center gap-2", children: [
3016
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Building2, { className: "w-4 h-4 text-[var(--color-primary)]" }),
3017
+ "Centres d'acc\xE8s (",
3018
+ loggedUser.centers_access.length,
3019
+ ")"
3020
+ ] }),
3021
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-wrap gap-2", children: loggedUser.centers_access.map((center) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3022
+ "span",
3023
+ {
3024
+ className: cn(
3025
+ "px-3 py-1.5 text-sm rounded-lg border transition-colors",
3026
+ activeBusinessEntity?.id === center.id ? "bg-[var(--color-primary)] text-white border-[var(--color-primary)]" : "bg-[var(--color-surface)] text-[var(--color-text-secondary)] border-[var(--color-border)] hover:bg-[var(--color-surface-hover)]"
3027
+ ),
3028
+ children: center.legal_name
3029
+ },
3030
+ center.id
3031
+ )) })
3032
+ ] }),
3033
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pt-4 border-t border-[var(--color-border)]", children: [
3034
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("h3", { className: "text-sm font-semibold text-[var(--color-text-primary)] mb-3 flex items-center gap-2", children: [
3035
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Shield, { className: "w-4 h-4 text-[var(--color-primary)]" }),
3036
+ "S\xE9curit\xE9 du compte"
3037
+ ] }),
3038
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
3039
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface)] rounded-lg", children: [
3040
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Derni\xE8re connexion" }),
3041
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: loggedUser?.last_login ? new Date(loggedUser.last_login).toLocaleDateString("fr-FR", {
3042
+ day: "numeric",
3043
+ month: "short",
3044
+ year: "numeric",
3045
+ hour: "2-digit",
3046
+ minute: "2-digit"
3047
+ }) : "Aujourd'hui" })
3048
+ ] }),
3049
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface)] rounded-lg", children: [
3050
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Membre depuis" }),
3051
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: loggedUser?.date_joined ? new Date(loggedUser.date_joined).toLocaleDateString("fr-FR", {
3052
+ day: "numeric",
3053
+ month: "short",
3054
+ year: "numeric"
3055
+ }) : "N/A" })
3056
+ ] })
3057
+ ] }),
3058
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3059
+ "button",
3060
+ {
3061
+ onClick: openChangePasswordModal,
3062
+ className: "mt-4 w-full flex items-center justify-center gap-2 px-4 py-2.5 border border-[var(--color-border)] text-[var(--color-text-secondary)] rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
3063
+ children: [
3064
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Lock, { className: "w-4 h-4" }),
3065
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium", children: "Changer le mot de passe" })
3066
+ ]
3067
+ }
3068
+ )
3069
+ ] })
3070
+ ] })
3071
+ }
3072
+ ),
3073
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3074
+ Modals_default,
3075
+ {
3076
+ title: "Modifier mon profil",
3077
+ description: "Mettez \xE0 jour vos informations personnelles",
3078
+ width: "max-w-lg",
3079
+ open: showEditProfileModal,
3080
+ onClose: () => setShowEditProfileModal(false),
3081
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-4", children: [
3082
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
3083
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3084
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Pr\xE9nom" }),
3085
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3086
+ "input",
3087
+ {
3088
+ type: "text",
3089
+ value: editProfileData.first_name,
3090
+ onChange: (e) => setEditProfileData((prev) => ({ ...prev, first_name: e.target.value })),
3091
+ className: "w-full px-3 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3092
+ placeholder: "Votre pr\xE9nom"
3093
+ }
3094
+ )
3095
+ ] }),
3096
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3097
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Nom" }),
3098
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3099
+ "input",
3100
+ {
3101
+ type: "text",
3102
+ value: editProfileData.last_name,
3103
+ onChange: (e) => setEditProfileData((prev) => ({ ...prev, last_name: e.target.value })),
3104
+ className: "w-full px-3 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3105
+ placeholder: "Votre nom"
3106
+ }
3107
+ )
3108
+ ] })
3109
+ ] }),
3110
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3111
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Email" }),
3112
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3113
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Mail, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3114
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3115
+ "input",
3116
+ {
3117
+ type: "email",
3118
+ value: editProfileData.email,
3119
+ onChange: (e) => setEditProfileData((prev) => ({ ...prev, email: e.target.value })),
3120
+ className: "w-full pl-10 pr-3 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3121
+ placeholder: "votre@email.com"
3122
+ }
3123
+ )
3124
+ ] })
3125
+ ] }),
3126
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3127
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "T\xE9l\xE9phone" }),
3128
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3129
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Phone, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3130
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3131
+ "input",
3132
+ {
3133
+ type: "tel",
3134
+ value: editProfileData.phonenumber,
3135
+ onChange: (e) => setEditProfileData((prev) => ({ ...prev, phonenumber: e.target.value })),
3136
+ className: "w-full pl-10 pr-3 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3137
+ placeholder: "+225 XX XX XX XX"
3138
+ }
3139
+ )
3140
+ ] })
3141
+ ] }),
3142
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3143
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Poste / Titre" }),
3144
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3145
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Briefcase, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3146
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3147
+ "input",
3148
+ {
3149
+ type: "text",
3150
+ value: editProfileData.job_title,
3151
+ onChange: (e) => setEditProfileData((prev) => ({ ...prev, job_title: e.target.value })),
3152
+ className: "w-full pl-10 pr-3 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3153
+ placeholder: "Ex: Responsable Commercial"
3154
+ }
3155
+ )
3156
+ ] })
3157
+ ] }),
3158
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3159
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "D\xE9partement" }),
3160
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3161
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Building2, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3162
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3163
+ "input",
3164
+ {
3165
+ type: "text",
3166
+ value: editProfileData.department,
3167
+ onChange: (e) => setEditProfileData((prev) => ({ ...prev, department: e.target.value })),
3168
+ className: "w-full pl-10 pr-3 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3169
+ placeholder: "Ex: Ventes"
3170
+ }
3171
+ )
3172
+ ] })
3173
+ ] }),
3174
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-end gap-3 pt-4 border-t border-[var(--color-border)]", children: [
3175
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3176
+ "button",
3177
+ {
3178
+ onClick: () => setShowEditProfileModal(false),
3179
+ className: "px-4 py-2 text-sm font-medium text-[var(--color-text-secondary)] bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
3180
+ children: "Annuler"
3181
+ }
3182
+ ),
3183
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3184
+ "button",
3185
+ {
3186
+ onClick: handleSaveProfile,
3187
+ disabled: savingProfile,
3188
+ className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[var(--color-primary)] rounded-lg hover:bg-[var(--color-primary-dark)] transition-colors disabled:opacity-50",
3189
+ children: [
3190
+ savingProfile ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Loader2, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Save, { className: "w-4 h-4" }),
3191
+ savingProfile ? "Enregistrement..." : "Enregistrer"
3192
+ ]
3193
+ }
3194
+ )
3195
+ ] })
3196
+ ] })
3197
+ }
3198
+ ),
3199
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3200
+ Modals_default,
3201
+ {
3202
+ title: "Changer le mot de passe",
3203
+ description: "Entrez votre mot de passe actuel et choisissez un nouveau mot de passe",
3204
+ width: "max-w-md",
3205
+ open: showChangePasswordModal,
3206
+ onClose: () => setShowChangePasswordModal(false),
3207
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-4", children: [
3208
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3209
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Mot de passe actuel" }),
3210
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3211
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Lock, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3212
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3213
+ "input",
3214
+ {
3215
+ type: showCurrentPassword ? "text" : "password",
3216
+ value: passwordData.current_password,
3217
+ onChange: (e) => setPasswordData((prev) => ({ ...prev, current_password: e.target.value })),
3218
+ className: "w-full pl-10 pr-10 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3219
+ placeholder: "Votre mot de passe actuel"
3220
+ }
3221
+ ),
3222
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3223
+ "button",
3224
+ {
3225
+ type: "button",
3226
+ onClick: () => setShowCurrentPassword(!showCurrentPassword),
3227
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-text-tertiary)] hover:text-[var(--color-text-secondary)]",
3228
+ children: showCurrentPassword ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.EyeOff, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Eye, { className: "w-4 h-4" })
3229
+ }
3230
+ )
3231
+ ] })
3232
+ ] }),
3233
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3234
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Nouveau mot de passe" }),
3235
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3236
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Lock, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3237
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3238
+ "input",
3239
+ {
3240
+ type: showNewPassword ? "text" : "password",
3241
+ value: passwordData.new_password,
3242
+ onChange: (e) => setPasswordData((prev) => ({ ...prev, new_password: e.target.value })),
3243
+ className: "w-full pl-10 pr-10 py-2 border border-[var(--color-border)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3244
+ placeholder: "Au moins 8 caract\xE8res"
3245
+ }
3246
+ ),
3247
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3248
+ "button",
3249
+ {
3250
+ type: "button",
3251
+ onClick: () => setShowNewPassword(!showNewPassword),
3252
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-text-tertiary)] hover:text-[var(--color-text-secondary)]",
3253
+ children: showNewPassword ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.EyeOff, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Eye, { className: "w-4 h-4" })
3254
+ }
3255
+ )
3256
+ ] }),
3257
+ passwordData.new_password && passwordData.new_password.length < 8 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-1 text-xs text-red-500", children: "Le mot de passe doit contenir au moins 8 caract\xE8res" })
3258
+ ] }),
3259
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3260
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { className: "block text-sm font-medium text-[var(--color-text-secondary)] mb-1", children: "Confirmer le nouveau mot de passe" }),
3261
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
3262
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Lock, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
3263
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3264
+ "input",
3265
+ {
3266
+ type: showConfirmPassword ? "text" : "password",
3267
+ value: passwordData.confirm_password,
3268
+ onChange: (e) => setPasswordData((prev) => ({ ...prev, confirm_password: e.target.value })),
3269
+ className: cn(
3270
+ "w-full pl-10 pr-10 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:border-transparent bg-[var(--color-background)] text-[var(--color-text-primary)]",
3271
+ passwordData.confirm_password && passwordData.new_password !== passwordData.confirm_password ? "border-red-500" : "border-[var(--color-border)]"
3272
+ ),
3273
+ placeholder: "R\xE9p\xE9tez le nouveau mot de passe"
3274
+ }
3275
+ ),
3276
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3277
+ "button",
3278
+ {
3279
+ type: "button",
3280
+ onClick: () => setShowConfirmPassword(!showConfirmPassword),
3281
+ className: "absolute right-3 top-1/2 -translate-y-1/2 text-[var(--color-text-tertiary)] hover:text-[var(--color-text-secondary)]",
3282
+ children: showConfirmPassword ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.EyeOff, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Eye, { className: "w-4 h-4" })
3283
+ }
3284
+ )
3285
+ ] }),
3286
+ passwordData.confirm_password && passwordData.new_password !== passwordData.confirm_password && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-1 text-xs text-red-500", children: "Les mots de passe ne correspondent pas" }),
3287
+ passwordData.confirm_password && passwordData.new_password === passwordData.confirm_password && passwordData.new_password.length >= 8 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "mt-1 text-xs text-green-600 flex items-center gap-1", children: [
3288
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Check, { className: "w-3 h-3" }),
3289
+ " Les mots de passe correspondent"
3290
+ ] })
3291
+ ] }),
3292
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-end gap-3 pt-4 border-t border-[var(--color-border)]", children: [
3293
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3294
+ "button",
3295
+ {
3296
+ onClick: () => setShowChangePasswordModal(false),
3297
+ className: "px-4 py-2 text-sm font-medium text-[var(--color-text-secondary)] bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
3298
+ children: "Annuler"
3299
+ }
3300
+ ),
3301
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3302
+ "button",
3303
+ {
3304
+ onClick: handleChangePassword,
3305
+ disabled: savingPassword || !passwordData.current_password || !passwordData.new_password || passwordData.new_password !== passwordData.confirm_password || passwordData.new_password.length < 8,
3306
+ className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[var(--color-primary)] rounded-lg hover:bg-[var(--color-primary-dark)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
3307
+ children: [
3308
+ savingPassword ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Loader2, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Shield, { className: "w-4 h-4" }),
3309
+ savingPassword ? "Modification..." : "Changer le mot de passe"
3310
+ ]
3311
+ }
3312
+ )
3313
+ ] })
3314
+ ] })
3315
+ }
3316
+ )
3317
+ ] });
3318
+ };
3319
+ var ModernDoubleSidebarLayout_default = RewiseLayout;
3320
+
2133
3321
  // src/components/ui/Toast.tsx
2134
3322
  var import_react6 = require("react");
2135
- var import_lucide_react3 = require("lucide-react");
3323
+ var import_lucide_react4 = require("lucide-react");
2136
3324
  var import_jsx_runtime10 = require("react/jsx-runtime");
2137
3325
  var ToastItem = ({ toast }) => {
2138
3326
  const { removeToast } = useToast();
@@ -2151,13 +3339,13 @@ var ToastItem = ({ toast }) => {
2151
3339
  const getIcon = () => {
2152
3340
  switch (toast.type) {
2153
3341
  case "success":
2154
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.CheckCircle, { className: "w-5 h-5 text-green-600" });
3342
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CheckCircle, { className: "w-5 h-5 text-green-600" });
2155
3343
  case "error":
2156
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.XCircle, { className: "w-5 h-5 text-red-600" });
3344
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.XCircle, { className: "w-5 h-5 text-red-600" });
2157
3345
  case "warning":
2158
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.AlertTriangle, { className: "w-5 h-5 text-yellow-600" });
3346
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.AlertTriangle, { className: "w-5 h-5 text-yellow-600" });
2159
3347
  case "info":
2160
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Info, { className: "w-5 h-5 text-blue-600" });
3348
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Info, { className: "w-5 h-5 text-blue-600" });
2161
3349
  }
2162
3350
  };
2163
3351
  const getBackgroundColor = () => {
@@ -2190,7 +3378,7 @@ var ToastItem = ({ toast }) => {
2190
3378
  {
2191
3379
  onClick: handleClose,
2192
3380
  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" })
3381
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "w-4 h-4" })
2194
3382
  }
2195
3383
  )
2196
3384
  ]
@@ -2204,7 +3392,7 @@ var ToastContainer = () => {
2204
3392
  var Toast_default = ToastContainer;
2205
3393
 
2206
3394
  // src/components/common/Pages.tsx
2207
- var import_lucide_react4 = require("lucide-react");
3395
+ var import_lucide_react5 = require("lucide-react");
2208
3396
  var import_react7 = require("react");
2209
3397
  var import_jsx_runtime11 = require("react/jsx-runtime");
2210
3398
  var Pages = ({
@@ -2224,67 +3412,411 @@ var Pages = ({
2224
3412
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: "text-2xl font-bold text-gray-900", children: title }),
2225
3413
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm text-gray-600", children: description })
2226
3414
  ] }) }),
2227
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center space-x-3", children: sideAction })
3415
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center space-x-3", children: sideAction })
3416
+ ] }),
3417
+ tabs
3418
+ ] }),
3419
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 p-6 space-y-6 min-h-[80vh]", children })
3420
+ ] }),
3421
+ sidebar && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${sidebarOpen ? "w-80" : "w-16"} bg-[var(--color-surface)] border-r border-[var(--color-border)] transition-all duration-300 flex flex-col`, children: [
3422
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "p-4 ", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between", children: [
3423
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { className: `font-semibold text-[var(--color-text-primary)] ${!sidebarOpen && "hidden"}`, children: "Classes SYSCOHADA" }),
3424
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3425
+ "button",
3426
+ {
3427
+ onClick: () => setSidebarOpen(!sidebarOpen),
3428
+ className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
3429
+ "aria-label": sidebarOpen ? "R\xE9duire" : "Ouvrir",
3430
+ 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" })
3431
+ }
3432
+ )
3433
+ ] }) }),
3434
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 overflow-y-auto py-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3435
+ "button",
3436
+ {
3437
+ onClick: () => {
3438
+ },
3439
+ className: `w-full flex items-center gap-3 px-4 py-3 transition-all relative group hover:bg-[var(--color-surface-hover)]`,
3440
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3441
+ "div",
3442
+ {
3443
+ className: `flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center transition-colors bg-[var(--color-background)]`,
3444
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-bold text-lg", children: 1 })
3445
+ }
3446
+ )
3447
+ }
3448
+ ) }),
3449
+ 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: [
3450
+ /* @__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: [
3451
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Download, { className: "w-4 h-4" }),
3452
+ "Exporter le plan"
3453
+ ] }),
3454
+ /* @__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: [
3455
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.Settings, { className: "w-4 h-4" }),
3456
+ "Configuration"
3457
+ ] })
3458
+ ] }) })
3459
+ ] })
3460
+ ] });
3461
+ };
3462
+ var Pages_default = Pages;
3463
+
3464
+ // src/components/common/FDrawer.tsx
3465
+ var import_react8 = __toESM(require("react"), 1);
3466
+ var import_react_router_dom4 = require("react-router-dom");
3467
+ var import_lucide_react6 = require("lucide-react");
3468
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3469
+ var ExcelImportModal = ({
3470
+ isOpen,
3471
+ onClose,
3472
+ importEndpoint,
3473
+ importFields,
3474
+ onSuccess
3475
+ }) => {
3476
+ const { activeBusinessEntity, token } = useSession();
3477
+ const fileInputRef = (0, import_react8.useRef)(null);
3478
+ const [file, setFile] = (0, import_react8.useState)(null);
3479
+ const [columnMapping, setColumnMapping] = (0, import_react8.useState)([]);
3480
+ const [loading, setLoading] = (0, import_react8.useState)(false);
3481
+ const [errors, setErrors] = (0, import_react8.useState)([]);
3482
+ const [importResults, setImportResults] = (0, import_react8.useState)(null);
3483
+ const [currentStep, setCurrentStep] = (0, import_react8.useState)(1);
3484
+ const allFields = [...importFields.required, ...importFields.optional];
3485
+ const handleFileChange = (event) => {
3486
+ const selectedFile = event.target.files?.[0];
3487
+ if (selectedFile) {
3488
+ if (!selectedFile.name.match(/\.(xlsx|xls)$/)) {
3489
+ setErrors(["Veuillez s\xE9lectionner un fichier Excel (.xlsx ou .xls)"]);
3490
+ return;
3491
+ }
3492
+ setFile(selectedFile);
3493
+ setErrors([]);
3494
+ setImportResults(null);
3495
+ setColumnMapping([]);
3496
+ setCurrentStep(2);
3497
+ }
3498
+ };
3499
+ const addMappingRow = () => {
3500
+ const newLetter = String.fromCharCode(65 + columnMapping.length);
3501
+ setColumnMapping([...columnMapping, { letter: newLetter, field: "" }]);
3502
+ };
3503
+ const removeMappingRow = (index) => {
3504
+ setColumnMapping(columnMapping.filter((_, i) => i !== index));
3505
+ };
3506
+ const updateMappingLetter = (index, letter) => {
3507
+ const newMapping = [...columnMapping];
3508
+ newMapping[index].letter = letter.toUpperCase();
3509
+ setColumnMapping(newMapping);
3510
+ };
3511
+ const updateMappingField = (index, field) => {
3512
+ const newMapping = [...columnMapping];
3513
+ newMapping[index].field = field;
3514
+ setColumnMapping(newMapping);
3515
+ };
3516
+ const validateMapping = () => {
3517
+ const mappedFields = columnMapping.map((m) => m.field).filter((f) => f);
3518
+ const requiredFields = importFields.required.map((f) => f.value);
3519
+ const missingRequired = requiredFields.filter((field) => !mappedFields.includes(field));
3520
+ if (missingRequired.length > 0) {
3521
+ const missingLabels = missingRequired.map(
3522
+ (field) => allFields.find((f) => f.value === field)?.label || field
3523
+ );
3524
+ setErrors([`Champs obligatoires manquants : ${missingLabels.join(", ")}`]);
3525
+ return false;
3526
+ }
3527
+ const duplicates = mappedFields.filter(
3528
+ (field, index) => mappedFields.indexOf(field) !== index && field !== ""
3529
+ );
3530
+ if (duplicates.length > 0) {
3531
+ const duplicateLabels = [...new Set(duplicates)].map(
3532
+ (field) => allFields.find((f) => f.value === field)?.label || field
3533
+ );
3534
+ setErrors([`Champs en double : ${duplicateLabels.join(", ")}`]);
3535
+ return false;
3536
+ }
3537
+ setErrors([]);
3538
+ return true;
3539
+ };
3540
+ const executeImport = async () => {
3541
+ if (!validateMapping()) return;
3542
+ if (!file) return;
3543
+ setLoading(true);
3544
+ try {
3545
+ const formData = new FormData();
3546
+ formData.append("excel_file", file);
3547
+ const mapping = {};
3548
+ columnMapping.forEach(({ letter, field }) => {
3549
+ if (field) {
3550
+ mapping[letter] = field;
3551
+ }
3552
+ });
3553
+ formData.append("column_mapping", JSON.stringify(mapping));
3554
+ const response = await fetch(`${API_URL}${importEndpoint}?business_entity_id=${activeBusinessEntity?.id}`, {
3555
+ method: "POST",
3556
+ headers: {
3557
+ "Authorization": `token ${token}`
3558
+ },
3559
+ body: formData
3560
+ });
3561
+ const result = await response.json();
3562
+ if (result.success) {
3563
+ setImportResults(result);
3564
+ setCurrentStep(3);
3565
+ } else {
3566
+ setErrors([result.message?.default || "Erreur lors de l'importation"]);
3567
+ if (result.errors) {
3568
+ const errorMessages = Object.values(result.errors).flat();
3569
+ setErrors((prev) => [...prev, ...errorMessages]);
3570
+ }
3571
+ }
3572
+ } catch (error) {
3573
+ console.error("Erreur:", error);
3574
+ setErrors(["Une erreur est survenue lors de l'importation"]);
3575
+ } finally {
3576
+ setLoading(false);
3577
+ }
3578
+ };
3579
+ const resetModal = () => {
3580
+ setFile(null);
3581
+ setColumnMapping([]);
3582
+ setErrors([]);
3583
+ setImportResults(null);
3584
+ setCurrentStep(1);
3585
+ if (fileInputRef.current) {
3586
+ fileInputRef.current.value = "";
3587
+ }
3588
+ };
3589
+ const handleClose = () => {
3590
+ resetModal();
3591
+ onClose();
3592
+ };
3593
+ const handleSuccess = () => {
3594
+ if (onSuccess) onSuccess();
3595
+ handleClose();
3596
+ };
3597
+ if (!isOpen) return null;
3598
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
3599
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 bg-black/50", onClick: handleClose }),
3600
+ /* @__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: [
3601
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between p-4 border-b border-gray-200", children: [
3602
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-3", children: [
3603
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.FileSpreadsheet, { className: "h-6 w-6 text-green-600" }),
3604
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { className: "text-lg font-semibold text-gray-800", children: "Importation Excel" }),
3605
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-sm text-gray-500", children: [
3606
+ "\xC9tape ",
3607
+ currentStep,
3608
+ "/3"
3609
+ ] })
3610
+ ] }),
3611
+ /* @__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" }) })
3612
+ ] }),
3613
+ /* @__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: [
3614
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(
3615
+ "w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors",
3616
+ currentStep >= step ? "bg-[var(--color-primary)] text-white" : "bg-gray-200 text-gray-500"
3617
+ ), children: currentStep > step ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.CheckCircle2, { className: "h-5 w-5" }) : step }),
3618
+ index < 2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn(
3619
+ "w-12 h-1 rounded",
3620
+ currentStep > step ? "bg-[var(--color-primary)]" : "bg-gray-200"
3621
+ ) })
3622
+ ] }, step)) }) }),
3623
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-6 overflow-y-auto max-h-[60vh]", children: [
3624
+ 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: [
3625
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.AlertCircle, { className: "h-5 w-5 text-red-500 mt-0.5" }),
3626
+ /* @__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)) })
3627
+ ] }) }),
3628
+ currentStep === 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center py-8", children: [
3629
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.FileSpreadsheet, { className: "h-16 w-16 text-green-500 mx-auto mb-4" }),
3630
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-medium text-gray-800 mb-2", children: "S\xE9lectionner un fichier Excel" }),
3631
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-gray-500 mb-6", children: "Formats accept\xE9s : .xlsx, .xls" }),
3632
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3633
+ "input",
3634
+ {
3635
+ ref: fileInputRef,
3636
+ type: "file",
3637
+ accept: ".xlsx,.xls",
3638
+ onChange: handleFileChange,
3639
+ 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"
3640
+ }
3641
+ ),
3642
+ file && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-4 p-3 bg-blue-50 rounded-lg text-left", children: [
3643
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-sm text-blue-800", children: [
3644
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Fichier s\xE9lectionn\xE9 :" }),
3645
+ " ",
3646
+ file.name
3647
+ ] }),
3648
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-xs text-blue-600", children: [
3649
+ "Taille : ",
3650
+ (file.size / 1024 / 1024).toFixed(2),
3651
+ " MB"
3652
+ ] })
3653
+ ] })
3654
+ ] }),
3655
+ currentStep === 2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
3656
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
3657
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-medium text-gray-800", children: "Configuration du mapping" }),
3658
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3659
+ "button",
3660
+ {
3661
+ type: "button",
3662
+ onClick: addMappingRow,
3663
+ 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)]",
3664
+ children: [
3665
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Plus, { className: "h-4 w-4" }),
3666
+ " Ajouter"
3667
+ ]
3668
+ }
3669
+ )
3670
+ ] }),
3671
+ /* @__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: [
3672
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Instructions :" }),
3673
+ " Associez chaque lettre de colonne Excel au champ correspondant. Les champs marqu\xE9s d'un (*) sont obligatoires."
3674
+ ] }) }),
3675
+ columnMapping.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center py-8", children: [
3676
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-gray-500 mb-4", children: 'Cliquez sur "Ajouter" pour commencer le mapping' }),
3677
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3678
+ "button",
3679
+ {
3680
+ type: "button",
3681
+ onClick: addMappingRow,
3682
+ 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",
3683
+ children: [
3684
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Plus, { className: "h-4 w-4" }),
3685
+ " Ajouter la premi\xE8re colonne"
3686
+ ]
3687
+ }
3688
+ )
3689
+ ] }) : /* @__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: [
3690
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "w-20", children: [
3691
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "block text-xs text-gray-500 mb-1", children: "Colonne" }),
3692
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3693
+ "input",
3694
+ {
3695
+ type: "text",
3696
+ value: mapping.letter,
3697
+ onChange: (e) => updateMappingLetter(index, e.target.value),
3698
+ className: "w-full px-3 py-2 border border-gray-300 rounded-lg text-center uppercase",
3699
+ maxLength: 2
3700
+ }
3701
+ )
3702
+ ] }),
3703
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-1", children: [
3704
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "block text-xs text-gray-500 mb-1", children: "Champ correspondant" }),
3705
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3706
+ "select",
3707
+ {
3708
+ value: mapping.field,
3709
+ onChange: (e) => updateMappingField(index, e.target.value),
3710
+ className: "w-full px-3 py-2 border border-gray-300 rounded-lg bg-white",
3711
+ children: [
3712
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "-- S\xE9lectionner un champ --" }),
3713
+ /* @__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)) }),
3714
+ /* @__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)) })
3715
+ ]
3716
+ }
3717
+ )
3718
+ ] }),
3719
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3720
+ "button",
3721
+ {
3722
+ type: "button",
3723
+ onClick: () => removeMappingRow(index),
3724
+ className: "p-2 text-red-500 hover:bg-red-50 rounded-lg mt-5",
3725
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Trash2, { className: "h-4 w-4" })
3726
+ }
3727
+ )
3728
+ ] }, index)) }),
3729
+ columnMapping.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between mt-6 pt-4 border-t border-gray-200", children: [
3730
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3731
+ "button",
3732
+ {
3733
+ type: "button",
3734
+ onClick: () => setCurrentStep(1),
3735
+ className: "px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg",
3736
+ children: "Retour"
3737
+ }
3738
+ ),
3739
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3740
+ "button",
3741
+ {
3742
+ type: "button",
3743
+ onClick: executeImport,
3744
+ disabled: loading,
3745
+ 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",
3746
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3747
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full" }),
3748
+ "Importation..."
3749
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3750
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Upload, { className: "h-4 w-4" }),
3751
+ "Lancer l'importation"
3752
+ ] })
3753
+ }
3754
+ )
3755
+ ] })
2228
3756
  ] }),
2229
- tabs
2230
- ] }),
2231
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 p-6 space-y-6 min-h-[80vh]", children })
2232
- ] }),
2233
- sidebar && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `${sidebarOpen ? "w-80" : "w-16"} bg-[var(--color-surface)] border-r border-[var(--color-border)] transition-all duration-300 flex flex-col`, children: [
2234
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "p-4 ", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-between", children: [
2235
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { className: `font-semibold text-[var(--color-text-primary)] ${!sidebarOpen && "hidden"}`, children: "Classes SYSCOHADA" }),
2236
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2237
- "button",
2238
- {
2239
- onClick: () => setSidebarOpen(!sidebarOpen),
2240
- className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2241
- "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" })
2243
- }
2244
- )
2245
- ] }) }),
2246
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 overflow-y-auto py-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2247
- "button",
2248
- {
2249
- onClick: () => {
2250
- },
2251
- className: `w-full flex items-center gap-3 px-4 py-3 transition-all relative group hover:bg-[var(--color-surface-hover)]`,
2252
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2253
- "div",
3757
+ currentStep === 3 && importResults && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center py-4", children: [
3758
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.CheckCircle2, { className: "h-16 w-16 text-green-500 mx-auto mb-4" }),
3759
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-lg font-medium text-gray-800 mb-6", children: "Importation termin\xE9e !" }),
3760
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-4 gap-4 mb-6", children: [
3761
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-blue-50 rounded-lg", children: [
3762
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-blue-600", children: importResults.results.total_rows }),
3763
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-blue-800", children: "Lignes lues" })
3764
+ ] }),
3765
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-green-50 rounded-lg", children: [
3766
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-green-600", children: importResults.results.saved_rows }),
3767
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-green-800", children: "Import\xE9es" })
3768
+ ] }),
3769
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-amber-50 rounded-lg", children: [
3770
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-amber-600", children: importResults.results.processed_rows - importResults.results.saved_rows }),
3771
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-amber-800", children: "Ignor\xE9es" })
3772
+ ] }),
3773
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 bg-red-50 rounded-lg", children: [
3774
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-2xl font-bold text-red-600", children: importResults.results.errors_count || 0 }),
3775
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-red-800", children: "Erreurs" })
3776
+ ] })
3777
+ ] }),
3778
+ 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: [
3779
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "font-medium text-amber-800 mb-2", children: "Erreurs de validation :" }),
3780
+ /* @__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: [
3781
+ "Ligne ",
3782
+ error.row,
3783
+ " : ",
3784
+ Object.entries(error.errors).map(
3785
+ ([field, messages]) => `${field}: ${messages.join(", ")}`
3786
+ ).join("; ")
3787
+ ] }, index)) }),
3788
+ importResults.data.import_summary.validation_errors.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-xs text-amber-600 mt-2", children: [
3789
+ "... et ",
3790
+ importResults.data.import_summary.validation_errors.length - 5,
3791
+ " autres erreurs"
3792
+ ] })
3793
+ ] }),
3794
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3795
+ "button",
2254
3796
  {
2255
- className: `flex-shrink-0 w-10 h-10 rounded-lg flex items-center justify-center transition-colors bg-[var(--color-background)]`,
2256
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-bold text-lg", children: 1 })
3797
+ type: "button",
3798
+ onClick: handleSuccess,
3799
+ className: "px-6 py-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)]",
3800
+ children: "Terminer"
2257
3801
  }
2258
3802
  )
2259
- }
2260
- ) }),
2261
- 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
- /* @__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" }),
2264
- "Exporter le plan"
2265
- ] }),
2266
- /* @__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" }),
2268
- "Configuration"
2269
3803
  ] })
2270
- ] }) })
3804
+ ] })
2271
3805
  ] })
2272
3806
  ] });
2273
3807
  };
2274
- var Pages_default = Pages;
2275
-
2276
- // src/components/common/FDrawer.tsx
2277
- var import_react8 = require("react");
2278
- var import_react_router_dom4 = require("react-router-dom");
2279
- var import_lucide_react5 = require("lucide-react");
2280
- var import_jsx_runtime12 = require("react/jsx-runtime");
2281
3808
  var FDrawer = ({
2282
3809
  children,
2283
3810
  apiEndpoint,
2284
3811
  columns,
2285
3812
  actions,
2286
3813
  ordering,
2287
- toggle
3814
+ toggle,
3815
+ importEndpoint,
3816
+ importFields,
3817
+ onBulkDelete,
3818
+ onDuplicate,
3819
+ title
2288
3820
  }) => {
2289
3821
  const navigate = (0, import_react_router_dom4.useNavigate)();
2290
3822
  const [searchParams] = (0, import_react_router_dom4.useSearchParams)();
@@ -2305,6 +3837,59 @@ var FDrawer = ({
2305
3837
  current_page: null
2306
3838
  });
2307
3839
  const [searchQuery, setSearchQuery] = (0, import_react8.useState)("");
3840
+ const [debouncedSearchQuery, setDebouncedSearchQuery] = (0, import_react8.useState)("");
3841
+ const searchTimeoutRef = (0, import_react8.useRef)(null);
3842
+ const [showFilterPanel, setShowFilterPanel] = (0, import_react8.useState)(false);
3843
+ const filterPanelRef = (0, import_react8.useRef)(null);
3844
+ const [showImportModal, setShowImportModal] = (0, import_react8.useState)(false);
3845
+ const [showMoreOptions, setShowMoreOptions] = (0, import_react8.useState)(false);
3846
+ const moreOptionsRef = (0, import_react8.useRef)(null);
3847
+ const [selectionMode, setSelectionMode] = (0, import_react8.useState)(false);
3848
+ const [selectedItems, setSelectedItems] = (0, import_react8.useState)([]);
3849
+ const [showColumnsPanel, setShowColumnsPanel] = (0, import_react8.useState)(false);
3850
+ const [visibleColumns, setVisibleColumns] = (0, import_react8.useState)(columns.map((c) => c.key));
3851
+ const columnsPanelRef = (0, import_react8.useRef)(null);
3852
+ const [density, setDensity] = (0, import_react8.useState)("normal");
3853
+ const [isFullscreen, setIsFullscreen] = (0, import_react8.useState)(false);
3854
+ const tableContainerRef = (0, import_react8.useRef)(null);
3855
+ (0, import_react8.useEffect)(() => {
3856
+ if (searchTimeoutRef.current) {
3857
+ clearTimeout(searchTimeoutRef.current);
3858
+ }
3859
+ searchTimeoutRef.current = setTimeout(() => {
3860
+ setDebouncedSearchQuery(searchQuery);
3861
+ }, 400);
3862
+ return () => {
3863
+ if (searchTimeoutRef.current) {
3864
+ clearTimeout(searchTimeoutRef.current);
3865
+ }
3866
+ };
3867
+ }, [searchQuery]);
3868
+ (0, import_react8.useEffect)(() => {
3869
+ setFilters((prev) => ({ ...prev, global_search: debouncedSearchQuery, page: 1 }));
3870
+ }, [debouncedSearchQuery]);
3871
+ (0, import_react8.useEffect)(() => {
3872
+ const handleClickOutside = (event) => {
3873
+ if (filterPanelRef.current && !filterPanelRef.current.contains(event.target)) {
3874
+ setShowFilterPanel(false);
3875
+ }
3876
+ if (moreOptionsRef.current && !moreOptionsRef.current.contains(event.target)) {
3877
+ setShowMoreOptions(false);
3878
+ }
3879
+ if (columnsPanelRef.current && !columnsPanelRef.current.contains(event.target)) {
3880
+ setShowColumnsPanel(false);
3881
+ }
3882
+ };
3883
+ document.addEventListener("mousedown", handleClickOutside);
3884
+ return () => document.removeEventListener("mousedown", handleClickOutside);
3885
+ }, []);
3886
+ (0, import_react8.useEffect)(() => {
3887
+ const handleFullscreenChange = () => {
3888
+ setIsFullscreen(!!document.fullscreenElement);
3889
+ };
3890
+ document.addEventListener("fullscreenchange", handleFullscreenChange);
3891
+ return () => document.removeEventListener("fullscreenchange", handleFullscreenChange);
3892
+ }, []);
2308
3893
  const makeFilters = () => columns.reduce((acc, item) => {
2309
3894
  acc[item.formule ? `${item.search_name}__icontains` : `${item.key}__icontains`] = "";
2310
3895
  return acc;
@@ -2334,7 +3919,13 @@ var FDrawer = ({
2334
3919
  }
2335
3920
  };
2336
3921
  (0, import_react8.useEffect)(() => {
2337
- const params = new URLSearchParams(filters).toString();
3922
+ const cleanFilters = {};
3923
+ Object.entries(filters).forEach(([key, value]) => {
3924
+ if (value !== "" && value !== null && value !== void 0) {
3925
+ cleanFilters[key] = String(value);
3926
+ }
3927
+ });
3928
+ const params = new URLSearchParams(cleanFilters).toString();
2338
3929
  setQueryURL(`${API_URL}${apiEndpoint}?${params}`);
2339
3930
  navigate(`${location.pathname}?${params}`);
2340
3931
  }, [filters]);
@@ -2363,116 +3954,456 @@ var FDrawer = ({
2363
3954
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2364
3955
  "input",
2365
3956
  {
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)
3957
+ type: "number",
3958
+ placeholder: "Min",
3959
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3960
+ onChange: (e) => handleChange(`${column.key}_min`, e.target.value)
3961
+ }
3962
+ ),
3963
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3964
+ "input",
3965
+ {
3966
+ type: "number",
3967
+ placeholder: "Max",
3968
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3969
+ onChange: (e) => handleChange(`${column.key}_max`, e.target.value)
3970
+ }
3971
+ )
3972
+ ] });
3973
+ case "date":
3974
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex w-full gap-1", children: [
3975
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3976
+ "input",
3977
+ {
3978
+ type: "date",
3979
+ placeholder: "Du",
3980
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3981
+ onChange: (e) => handleChange(`${column.key}_from`, e.target.value)
3982
+ }
3983
+ ),
3984
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3985
+ "input",
3986
+ {
3987
+ type: "date",
3988
+ placeholder: "Au",
3989
+ className: "border border-gray-300 rounded-lg p-3 w-1/2",
3990
+ onChange: (e) => handleChange(`${column.key}_to`, e.target.value)
3991
+ }
3992
+ )
3993
+ ] });
3994
+ default:
3995
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3996
+ "input",
3997
+ {
3998
+ id: column.key,
3999
+ type: column.type,
4000
+ className: "border border-gray-300 rounded-md p-1",
4001
+ onChange: (e) => handleChange(column.key, e.target.value)
4002
+ }
4003
+ );
4004
+ }
4005
+ };
4006
+ const renderLine = (item) => columns.map((column) => {
4007
+ let cellContent = column.formule ? column.formule(item) : item[column.key];
4008
+ if (column.type === "date" && item[column.key])
4009
+ cellContent = new Date(item[column.key]).toLocaleDateString();
4010
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: cellContent }, column.key);
4011
+ });
4012
+ const handleExport = async () => {
4013
+ try {
4014
+ const exportParams = new URLSearchParams(filters);
4015
+ exportParams.set("export", "true");
4016
+ exportParams.set("all", "true");
4017
+ const exportURL = `${API_URL}${apiEndpoint}?${exportParams.toString()}`;
4018
+ const response = await fetch(exportURL, {
4019
+ method: "GET",
4020
+ headers: {
4021
+ "Authorization": `token ${token}`
4022
+ }
4023
+ });
4024
+ if (!response.ok) throw new Error("Erreur lors de l'export");
4025
+ const blob = await response.blob();
4026
+ const url = window.URL.createObjectURL(blob);
4027
+ const a = document.createElement("a");
4028
+ a.href = url;
4029
+ a.download = `export_${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.xlsx`;
4030
+ document.body.appendChild(a);
4031
+ a.click();
4032
+ window.URL.revokeObjectURL(url);
4033
+ document.body.removeChild(a);
4034
+ } catch (error) {
4035
+ console.error("Erreur export:", error);
4036
+ }
4037
+ };
4038
+ const handlePrint = () => {
4039
+ const printContent = document.getElementById("fdrawer-table");
4040
+ if (!printContent) return;
4041
+ const printWindow = window.open("", "_blank");
4042
+ if (!printWindow) return;
4043
+ printWindow.document.write(`
4044
+ <html>
4045
+ <head>
4046
+ <title>Impression</title>
4047
+ <style>
4048
+ body { font-family: Arial, sans-serif; padding: 20px; }
4049
+ table { width: 100%; border-collapse: collapse; }
4050
+ th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
4051
+ th { background-color: #f5f5f5; font-weight: bold; }
4052
+ tr:nth-child(even) { background-color: #fafafa; }
4053
+ @media print {
4054
+ @page { margin: 1cm; }
4055
+ }
4056
+ </style>
4057
+ </head>
4058
+ <body>
4059
+ ${printContent.outerHTML}
4060
+ </body>
4061
+ </html>
4062
+ `);
4063
+ printWindow.document.close();
4064
+ printWindow.print();
4065
+ };
4066
+ const resetFilters = () => {
4067
+ const cleanFilters = {
4068
+ ...makeFilters(),
4069
+ business_entity_id: activeBusinessEntity?.id ?? null,
4070
+ order_by: order_by ?? "id",
4071
+ page: 1,
4072
+ global_search: ""
4073
+ };
4074
+ setFilters(cleanFilters);
4075
+ setSearchQuery("");
4076
+ setShowFilterPanel(false);
4077
+ };
4078
+ const getActiveFiltersCount = () => {
4079
+ let count = 0;
4080
+ Object.entries(filters).forEach(([key, value]) => {
4081
+ if (value && key !== "business_entity_id" && key !== "order_by" && key !== "page" && key !== "global_search") {
4082
+ count++;
4083
+ }
4084
+ });
4085
+ return count;
4086
+ };
4087
+ const activeFiltersCount = getActiveFiltersCount();
4088
+ const toggleSelectItem = (id) => {
4089
+ setSelectedItems(
4090
+ (prev) => prev.includes(id) ? prev.filter((i) => i !== id) : [...prev, id]
4091
+ );
4092
+ };
4093
+ const toggleSelectAll = () => {
4094
+ if (selectedItems.length === data.length) {
4095
+ setSelectedItems([]);
4096
+ } else {
4097
+ setSelectedItems(data.map((item) => item.id));
4098
+ }
4099
+ };
4100
+ const clearSelection = () => {
4101
+ setSelectedItems([]);
4102
+ setSelectionMode(false);
4103
+ };
4104
+ const handleBulkDelete = async () => {
4105
+ if (!onBulkDelete || selectedItems.length === 0) return;
4106
+ if (confirm(`Voulez-vous vraiment supprimer ${selectedItems.length} \xE9l\xE9ment(s) ?`)) {
4107
+ try {
4108
+ await onBulkDelete(selectedItems);
4109
+ clearSelection();
4110
+ getDataFilter();
4111
+ } catch (error) {
4112
+ console.error("Erreur lors de la suppression group\xE9e:", error);
4113
+ }
4114
+ }
4115
+ };
4116
+ const handleDuplicate = async (item) => {
4117
+ if (!onDuplicate) return;
4118
+ try {
4119
+ await onDuplicate(item);
4120
+ getDataFilter();
4121
+ } catch (error) {
4122
+ console.error("Erreur lors de la duplication:", error);
4123
+ }
4124
+ };
4125
+ const toggleColumnVisibility = (key) => {
4126
+ setVisibleColumns(
4127
+ (prev) => prev.includes(key) ? prev.filter((k) => k !== key) : [...prev, key]
4128
+ );
4129
+ };
4130
+ const toggleFullscreen = () => {
4131
+ if (!tableContainerRef.current) return;
4132
+ if (!document.fullscreenElement) {
4133
+ tableContainerRef.current.requestFullscreen();
4134
+ } else {
4135
+ document.exitFullscreen();
4136
+ }
4137
+ };
4138
+ const getDensityClasses = () => {
4139
+ switch (density) {
4140
+ case "compact":
4141
+ return { cell: "px-3 py-1", text: "text-xs" };
4142
+ case "comfortable":
4143
+ return { cell: "px-8 py-5", text: "text-base" };
4144
+ default:
4145
+ return { cell: "px-6 py-4", text: "text-sm" };
4146
+ }
4147
+ };
4148
+ const densityClasses = getDensityClasses();
4149
+ const visibleColumnsData = columns.filter((col) => visibleColumns.includes(col.key));
4150
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
4151
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap gap-4 mb-4", children: [
4152
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-1 min-w-64", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
4153
+ /* @__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" }),
4154
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4155
+ "input",
4156
+ {
4157
+ type: "text",
4158
+ placeholder: "Rechercher sur tous les champs...",
4159
+ className: "w-full pl-10 pr-10 py-2 border border-[#d1d7de] rounded-lg focus:ring-2 focus:ring-[#78a6d2] focus:border-transparent",
4160
+ value: searchQuery,
4161
+ onChange: (e) => setSearchQuery(e.target.value)
4162
+ }
4163
+ ),
4164
+ searchQuery && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4165
+ "button",
4166
+ {
4167
+ type: "button",
4168
+ onClick: () => setSearchQuery(""),
4169
+ className: "absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",
4170
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.X, { className: "h-4 w-4" })
4171
+ }
4172
+ )
4173
+ ] }) }),
4174
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", ref: filterPanelRef, children: [
4175
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: () => setShowFilterPanel(!showFilterPanel), type: "button", children: [
4176
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Filter, { className: "h-4 w-4 mr-2" }),
4177
+ "Filtres",
4178
+ 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 }),
4179
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ChevronDown, { className: cn("h-4 w-4 ml-1 transition-transform", showFilterPanel && "rotate-180") })
4180
+ ] }),
4181
+ 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: [
4182
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 border-b border-gray-200 flex items-center justify-between", children: [
4183
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "font-semibold text-gray-800", children: "Filtres avanc\xE9s" }),
4184
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4185
+ "button",
4186
+ {
4187
+ type: "button",
4188
+ onClick: resetFilters,
4189
+ className: "text-sm text-blue-600 hover:text-blue-800",
4190
+ children: "R\xE9initialiser"
4191
+ }
4192
+ )
4193
+ ] }),
4194
+ /* @__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: [
4195
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "block text-sm font-medium text-gray-700", children: column.label }),
4196
+ renderColumnFilter(column)
4197
+ ] }, column.key)) }),
4198
+ /* @__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)(
4199
+ "button",
4200
+ {
4201
+ type: "button",
4202
+ onClick: () => setShowFilterPanel(false),
4203
+ className: "px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg",
4204
+ children: "Fermer"
4205
+ }
4206
+ ) })
4207
+ ] })
4208
+ ] }),
4209
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: handleExport, type: "button", children: [
4210
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Download, { className: "h-4 w-4 mr-2" }),
4211
+ "Exporter"
4212
+ ] }),
4213
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: handlePrint, type: "button", children: [
4214
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Printer, { className: "h-4 w-4 mr-2" }),
4215
+ "Imprimer"
4216
+ ] }),
4217
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", ref: moreOptionsRef, children: [
4218
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Buttons_default, { onClick: () => setShowMoreOptions(!showMoreOptions), type: "button", children: [
4219
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Settings2, { className: "h-4 w-4 mr-2" }),
4220
+ "Plus",
4221
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ChevronDown, { className: cn("h-4 w-4 ml-1 transition-transform", showMoreOptions && "rotate-180") })
4222
+ ] }),
4223
+ 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: [
4224
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4225
+ "button",
4226
+ {
4227
+ type: "button",
4228
+ onClick: () => {
4229
+ getDataFilter();
4230
+ setShowMoreOptions(false);
4231
+ },
4232
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
4233
+ children: [
4234
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.RefreshCw, { className: "h-4 w-4" }),
4235
+ "Actualiser les donn\xE9es"
4236
+ ]
4237
+ }
4238
+ ),
4239
+ importEndpoint && importFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4240
+ "button",
4241
+ {
4242
+ type: "button",
4243
+ onClick: () => {
4244
+ setShowImportModal(true);
4245
+ setShowMoreOptions(false);
4246
+ },
4247
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
4248
+ children: [
4249
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Upload, { className: "h-4 w-4" }),
4250
+ "Importer depuis Excel"
4251
+ ]
4252
+ }
4253
+ ),
4254
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-2" }),
4255
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4256
+ "button",
4257
+ {
4258
+ type: "button",
4259
+ onClick: () => {
4260
+ setSelectionMode(!selectionMode);
4261
+ setShowMoreOptions(false);
4262
+ },
4263
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
4264
+ children: [
4265
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.SquareIcon, { className: "h-4 w-4" }),
4266
+ selectionMode ? "D\xE9sactiver la s\xE9lection" : "Mode s\xE9lection multiple"
4267
+ ]
4268
+ }
4269
+ ),
4270
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4271
+ "button",
4272
+ {
4273
+ type: "button",
4274
+ onClick: () => {
4275
+ setShowColumnsPanel(true);
4276
+ setShowMoreOptions(false);
4277
+ },
4278
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
4279
+ children: [
4280
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Columns3, { className: "h-4 w-4" }),
4281
+ "G\xE9rer les colonnes"
4282
+ ]
2370
4283
  }
2371
4284
  ),
2372
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2373
- "input",
4285
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-2" }),
4286
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "px-4 py-2", children: [
4287
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs font-medium text-gray-500 mb-2", children: "Densit\xE9 d'affichage" }),
4288
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex gap-1", children: ["compact", "normal", "comfortable"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4289
+ "button",
4290
+ {
4291
+ type: "button",
4292
+ onClick: () => setDensity(mode),
4293
+ className: cn(
4294
+ "flex-1 px-2 py-1 text-xs rounded transition-colors",
4295
+ density === mode ? "bg-[var(--color-primary)] text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200"
4296
+ ),
4297
+ children: mode === "compact" ? "Compact" : mode === "normal" ? "Normal" : "Large"
4298
+ },
4299
+ mode
4300
+ )) })
4301
+ ] }),
4302
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-2" }),
4303
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4304
+ "button",
2374
4305
  {
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)
4306
+ type: "button",
4307
+ onClick: () => {
4308
+ toggleFullscreen();
4309
+ setShowMoreOptions(false);
4310
+ },
4311
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-3",
4312
+ children: [
4313
+ 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" }),
4314
+ isFullscreen ? "Quitter le plein \xE9cran" : "Plein \xE9cran"
4315
+ ]
2379
4316
  }
2380
4317
  )
2381
- ] });
2382
- case "date":
2383
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex w-full gap-1", children: [
4318
+ ] })
4319
+ ] })
4320
+ ] }),
4321
+ showColumnsPanel && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
4322
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 bg-black/30", onClick: () => setShowColumnsPanel(false) }),
4323
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative bg-white rounded-xl shadow-2xl w-full max-w-md", ref: columnsPanelRef, children: [
4324
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between p-4 border-b border-gray-200", children: [
4325
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "font-semibold text-gray-800", children: "Colonnes visibles" }),
4326
+ /* @__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" }) })
4327
+ ] }),
4328
+ /* @__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
4329
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2385
4330
  "input",
2386
4331
  {
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)
4332
+ type: "checkbox",
4333
+ checked: visibleColumns.includes(column.key),
4334
+ onChange: () => toggleColumnVisibility(column.key),
4335
+ className: "w-4 h-4 text-[var(--color-primary)] rounded border-gray-300"
2391
4336
  }
2392
4337
  ),
4338
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-sm text-gray-700", children: column.label })
4339
+ ] }, column.key)) }),
4340
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-4 border-t border-gray-200 flex justify-between", children: [
2393
4341
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2394
- "input",
4342
+ "button",
2395
4343
  {
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)
4344
+ type: "button",
4345
+ onClick: () => setVisibleColumns(columns.map((c) => c.key)),
4346
+ className: "text-sm text-blue-600 hover:text-blue-800",
4347
+ children: "Tout afficher"
4348
+ }
4349
+ ),
4350
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4351
+ "button",
4352
+ {
4353
+ type: "button",
4354
+ onClick: () => setShowColumnsPanel(false),
4355
+ className: "px-4 py-2 bg-[var(--color-primary)] text-white rounded-lg text-sm",
4356
+ children: "Fermer"
2400
4357
  }
2401
4358
  )
2402
- ] });
2403
- default:
2404
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2405
- "input",
4359
+ ] })
4360
+ ] })
4361
+ ] }),
4362
+ 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: [
4363
+ /* @__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: [
4364
+ selectedItems.length,
4365
+ " \xE9l\xE9ment(s) s\xE9lectionn\xE9(s)"
4366
+ ] }) }),
4367
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
4368
+ onBulkDelete && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4369
+ "button",
2406
4370
  {
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)
4371
+ type: "button",
4372
+ onClick: handleBulkDelete,
4373
+ className: "px-3 py-1.5 bg-red-500 text-white rounded-lg text-sm flex items-center gap-2 hover:bg-red-600",
4374
+ children: [
4375
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Trash2, { className: "h-4 w-4" }),
4376
+ "Supprimer"
4377
+ ]
2411
4378
  }
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" }),
4379
+ ),
2425
4380
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2426
- "input",
4381
+ "button",
2427
4382
  {
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)
4383
+ type: "button",
4384
+ onClick: clearSelection,
4385
+ className: "px-3 py-1.5 bg-gray-200 text-gray-700 rounded-lg text-sm hover:bg-gray-300",
4386
+ children: "Annuler"
2433
4387
  }
2434
4388
  )
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
- )
4389
+ ] })
2469
4390
  ] }),
2470
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: "w-full", children: [
4391
+ 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)]" }) }),
4392
+ /* @__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
4393
  /* @__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: [
4394
+ 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)(
4395
+ "input",
4396
+ {
4397
+ type: "checkbox",
4398
+ checked: selectedItems.length === data.length && data.length > 0,
4399
+ onChange: toggleSelectAll,
4400
+ className: "w-4 h-4 text-[var(--color-primary)] rounded border-gray-300"
4401
+ }
4402
+ ) }),
4403
+ 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
4404
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex align-center items-center gap-2", children: [
2474
4405
  /* @__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) })
4406
+ 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
4407
  ] }),
2477
4408
  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
4409
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2487,7 +4418,7 @@ var FDrawer = ({
2487
4418
  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
4419
  role: "menuitem",
2489
4420
  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" }),
4421
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ArrowUpAZ, { className: "h-4 w-4" }),
2491
4422
  /* @__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
4423
  ] })
2493
4424
  }
@@ -2504,7 +4435,7 @@ var FDrawer = ({
2504
4435
  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
4436
  role: "menuitem",
2506
4437
  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" }),
4438
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ArrowDownAZ, { className: "h-4 w-4" }),
2508
4439
  /* @__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
4440
  ] })
2510
4441
  }
@@ -2515,30 +4446,86 @@ var FDrawer = ({
2515
4446
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "pb-3 px-4", children: renderColumnFilter(column) })
2516
4447
  ] })
2517
4448
  ] }, 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" })
4449
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: cn(densityClasses.cell, "text-left text-xs font-medium text-gray-500 uppercase tracking-wider") })
2519
4450
  ] }) }),
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
- }
4451
+ /* @__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)(
4452
+ "tr",
4453
+ {
4454
+ className: cn(
4455
+ "hover:bg-gray-50 cursor-pointer",
4456
+ selectionMode && selectedItems.includes(item.id) && "bg-blue-50"
2531
4457
  ),
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] })
4458
+ children: [
4459
+ 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)(
4460
+ "input",
4461
+ {
4462
+ type: "checkbox",
4463
+ checked: selectedItems.includes(item.id),
4464
+ onChange: () => toggleSelectItem(item.id),
4465
+ className: "w-4 h-4 text-[var(--color-primary)] rounded border-gray-300"
4466
+ }
4467
+ ) }),
4468
+ visibleColumnsData.map((column) => {
4469
+ let cellContent = column.formule ? column.formule(item) : item[column.key];
4470
+ if (column.type === "date" && item[column.key])
4471
+ cellContent = new Date(item[column.key]).toLocaleDateString();
4472
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: cn(densityClasses.cell, "whitespace-nowrap", densityClasses.text, "text-gray-500"), children: cellContent }, column.key);
4473
+ }),
4474
+ /* @__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: [
4475
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4476
+ "button",
4477
+ {
4478
+ type: "button",
4479
+ onClick: () => setDropdownOpen(dropdownOpen === item.id ? null : item.id),
4480
+ className: "p-1 rounded-full hover:bg-gray-100 transition-colors",
4481
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.MoreVertical, { className: "w-4 h-4 text-gray-400" })
4482
+ }
4483
+ ),
4484
+ 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: [
4485
+ actions.map(
4486
+ (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: () => {
4487
+ action.onclick && action.onclick(item);
4488
+ setDropdownOpen(null);
4489
+ }, 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)
4490
+ ),
4491
+ onDuplicate && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
4492
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-gray-100 my-1" }),
4493
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4494
+ "button",
4495
+ {
4496
+ onClick: () => {
4497
+ handleDuplicate(item);
4498
+ setDropdownOpen(null);
4499
+ },
4500
+ className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2",
4501
+ children: [
4502
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Copy, { className: "h-4 w-4" }),
4503
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "Dupliquer" })
4504
+ ]
4505
+ }
4506
+ )
4507
+ ] })
4508
+ ] })
4509
+ ] }) })
4510
+ ]
4511
+ },
4512
+ item.id
4513
+ )) })
4514
+ ] }) }),
4515
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pagination, { reponseDetail, setQueryURL, filters: [filters, setFilters] }),
4516
+ importEndpoint && importFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4517
+ ExcelImportModal,
4518
+ {
4519
+ isOpen: showImportModal,
4520
+ onClose: () => setShowImportModal(false),
4521
+ importEndpoint,
4522
+ importFields,
4523
+ onSuccess: () => {
4524
+ setShowImportModal(false);
4525
+ getDataFilter();
4526
+ }
4527
+ }
4528
+ )
2542
4529
  ] });
2543
4530
  };
2544
4531
  var Pagination = ({
@@ -2615,7 +4602,7 @@ var import_react10 = require("react");
2615
4602
 
2616
4603
  // src/components/common/SearchableSelect.tsx
2617
4604
  var import_react9 = require("react");
2618
- var import_lucide_react6 = require("lucide-react");
4605
+ var import_lucide_react7 = require("lucide-react");
2619
4606
  var import_jsx_runtime13 = require("react/jsx-runtime");
2620
4607
  var SearchableSelect = ({
2621
4608
  options,
@@ -2700,11 +4687,11 @@ var SearchableSelect = ({
2700
4687
  onClick: handleClear,
2701
4688
  className: "text-gray-400 hover:text-gray-600",
2702
4689
  type: "button",
2703
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.X, { size: 16 })
4690
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.X, { size: 16 })
2704
4691
  }
2705
4692
  ),
2706
4693
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2707
- import_lucide_react6.ChevronDown,
4694
+ import_lucide_react7.ChevronDown,
2708
4695
  {
2709
4696
  size: 16,
2710
4697
  className: `text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
@@ -2717,7 +4704,7 @@ var SearchableSelect = ({
2717
4704
  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
4705
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "p-3 border-b border-gray-200 flex", children: [
2719
4706
  /* @__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" }),
4707
+ /* @__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
4708
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2722
4709
  "input",
2723
4710
  {
@@ -2738,7 +4725,7 @@ var SearchableSelect = ({
2738
4725
  disabled,
2739
4726
  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
4727
  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" : ""}` })
4728
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.RefreshCw, { className: `w-4 h-4 ${disabled ? "animate-spin" : ""}` })
2742
4729
  }
2743
4730
  ),
2744
4731
  addElement && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -2748,7 +4735,7 @@ var SearchableSelect = ({
2748
4735
  onClick: addElement,
2749
4736
  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
4737
  title: "Rafra\xEEchir la liste",
2751
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react6.Plus, { className: "w-4 h-4" })
4738
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Plus, { className: "w-4 h-4" })
2752
4739
  }
2753
4740
  )
2754
4741
  ] }),
@@ -2776,7 +4763,7 @@ var SearchableSelect = ({
2776
4763
  };
2777
4764
 
2778
4765
  // src/components/common/ApprovalWorkflow.tsx
2779
- var import_lucide_react7 = require("lucide-react");
4766
+ var import_lucide_react8 = require("lucide-react");
2780
4767
  var import_jsx_runtime14 = require("react/jsx-runtime");
2781
4768
  var ApprovalWorkflow = ({
2782
4769
  process,
@@ -3080,7 +5067,7 @@ var ApprovalWorkflow = ({
3080
5067
  )
3081
5068
  ] }),
3082
5069
  /* @__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" }),
5070
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Users, { className: "w-8 h-8 text-[#767676] mx-auto mb-4" }),
3084
5071
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-lg font-medium text-[#191919] mb-2", children: "Aucune personne ajout\xE9e" }),
3085
5072
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[#767676] mb-4", children: 'Cliquez sur le bouton "Ajouter une personne" pour commencer' })
3086
5073
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "w-full border-collapse", children: [
@@ -3112,7 +5099,7 @@ var ApprovalWorkflow = ({
3112
5099
  ] });
3113
5100
  };
3114
5101
  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]" }) }) });
5102
+ 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
5103
  }
3117
5104
  const renderTabContent = () => {
3118
5105
  switch (activeTab) {
@@ -3139,7 +5126,7 @@ var ApprovalWorkflow = ({
3139
5126
  type: "button",
3140
5127
  classname: "flex items-center gap-2",
3141
5128
  children: [
3142
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Ban, { className: "w-4 h-4" }),
5129
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Ban, { className: "w-4 h-4" }),
3143
5130
  canceling ? "Annulation..." : "Annuler la demande"
3144
5131
  ]
3145
5132
  }
@@ -3152,7 +5139,7 @@ var ApprovalWorkflow = ({
3152
5139
  type: "button",
3153
5140
  classname: "flex items-center gap-2",
3154
5141
  children: [
3155
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.RotateCcw, { className: "w-4 h-4" }),
5142
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.RotateCcw, { className: "w-4 h-4" }),
3156
5143
  restarting ? "Red\xE9marrage..." : "Recommencer"
3157
5144
  ]
3158
5145
  }
@@ -3191,15 +5178,15 @@ var ApprovalWorkflow = ({
3191
5178
  dangerouslySetInnerHTML: { __html: caseData.html_content }
3192
5179
  }
3193
5180
  ) : /* @__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" }),
5181
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Eye, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
3195
5182
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[#767676]", children: "Aucun aper\xE7u disponible" })
3196
5183
  ] })
3197
5184
  ] }) });
3198
5185
  case "history":
3199
5186
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-6", children: [
3200
5187
  /* @__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" }),
5188
+ 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: [
5189
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.History, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
3203
5190
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[#767676]", children: "Aucun historique disponible" })
3204
5191
  ] }) : /* @__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
5192
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3 mb-2", children: [
@@ -3289,7 +5276,7 @@ var ApprovalWorkflow = ({
3289
5276
  onClick: () => setActiveTab("workflow"),
3290
5277
  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
5278
  children: [
3292
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.FileText, { className: "w-4 h-4" }),
5279
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.FileText, { className: "w-4 h-4" }),
3293
5280
  "Workflow"
3294
5281
  ]
3295
5282
  }
@@ -3300,7 +5287,7 @@ var ApprovalWorkflow = ({
3300
5287
  onClick: () => setActiveTab("preview"),
3301
5288
  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
5289
  children: [
3303
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Eye, { className: "w-4 h-4" }),
5290
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Eye, { className: "w-4 h-4" }),
3304
5291
  "Aper\xE7u"
3305
5292
  ]
3306
5293
  }
@@ -3311,7 +5298,7 @@ var ApprovalWorkflow = ({
3311
5298
  onClick: () => setActiveTab("history"),
3312
5299
  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
5300
  children: [
3314
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.History, { className: "w-4 h-4" }),
5301
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.History, { className: "w-4 h-4" }),
3315
5302
  "Historique"
3316
5303
  ]
3317
5304
  }
@@ -3336,7 +5323,7 @@ var ApprovalWorkflow = ({
3336
5323
  {
3337
5324
  className: "text-gray-500 hover:text-[#6A8A82] transition-colors",
3338
5325
  onClick: () => window.history.back(),
3339
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.X, { className: "w-5 h-5" })
5326
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.X, { className: "w-5 h-5" })
3340
5327
  }
3341
5328
  )
3342
5329
  ] }),
@@ -3391,7 +5378,7 @@ var StageRow = ({
3391
5378
  onClick: onRemove,
3392
5379
  className: "text-[#B85450] hover:text-red-700 transition-colors",
3393
5380
  title: "Supprimer",
3394
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Trash2, { className: "w-4 h-4" })
5381
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Trash2, { className: "w-4 h-4" })
3395
5382
  }
3396
5383
  ) }),
3397
5384
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "border border-gray-300 px-4 py-2 text-center", children: index + 1 }),
@@ -3513,7 +5500,7 @@ var AddStageButton = ({
3513
5500
  onClick: () => setShowModal(true),
3514
5501
  classname: "gap-2",
3515
5502
  children: [
3516
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Plus, { className: "w-4 h-4" }),
5503
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.Plus, { className: "w-4 h-4" }),
3517
5504
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Ajouter une personne" })
3518
5505
  ]
3519
5506
  }
@@ -3757,29 +5744,7 @@ var useAlert = () => {
3757
5744
  };
3758
5745
 
3759
5746
  // 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
- };
5747
+ var import_react128 = require("react");
3783
5748
 
3784
5749
  // dist/index.js
3785
5750
  var import_jsx_runtime17 = require("react/jsx-runtime");
@@ -3788,7 +5753,7 @@ var import_react_router_dom5 = require("react-router-dom");
3788
5753
  var import_jsx_runtime19 = require("react/jsx-runtime");
3789
5754
  var import_react12 = __toESM(require("react"), 1);
3790
5755
  var import_react_router_dom6 = require("react-router-dom");
3791
- var import_lucide_react8 = require("lucide-react");
5756
+ var import_lucide_react9 = require("lucide-react");
3792
5757
  var import_clsx2 = require("clsx");
3793
5758
  var import_tailwind_merge2 = require("tailwind-merge");
3794
5759
  var import_react13 = require("react");
@@ -3796,28 +5761,29 @@ var import_jsx_runtime20 = require("react/jsx-runtime");
3796
5761
  var import_react14 = require("react");
3797
5762
  var import_jsx_runtime21 = require("react/jsx-runtime");
3798
5763
  var import_react15 = require("react");
5764
+ var import_lucide_react10 = require("lucide-react");
3799
5765
  var import_jsx_runtime22 = require("react/jsx-runtime");
3800
5766
  var import_react16 = require("react");
3801
5767
  var import_jsx_runtime23 = require("react/jsx-runtime");
3802
- var import_lucide_react9 = require("lucide-react");
5768
+ var import_lucide_react11 = require("lucide-react");
3803
5769
  var import_react_router_dom7 = require("react-router-dom");
3804
5770
  var import_jsx_runtime24 = require("react/jsx-runtime");
3805
5771
  var import_jsx_runtime25 = require("react/jsx-runtime");
3806
5772
  var import_react17 = require("react");
3807
- var import_lucide_react10 = require("lucide-react");
5773
+ var import_lucide_react12 = require("lucide-react");
3808
5774
  var import_jsx_runtime26 = require("react/jsx-runtime");
3809
- var import_lucide_react11 = require("lucide-react");
5775
+ var import_lucide_react13 = require("lucide-react");
3810
5776
  var import_react18 = require("react");
3811
5777
  var import_jsx_runtime27 = require("react/jsx-runtime");
3812
- var import_react19 = require("react");
5778
+ var import_react19 = __toESM(require("react"), 1);
3813
5779
  var import_react_router_dom8 = require("react-router-dom");
3814
- var import_lucide_react12 = require("lucide-react");
5780
+ var import_lucide_react14 = require("lucide-react");
3815
5781
  var import_jsx_runtime28 = require("react/jsx-runtime");
3816
5782
  var import_react20 = require("react");
3817
5783
  var import_react21 = require("react");
3818
- var import_lucide_react13 = require("lucide-react");
5784
+ var import_lucide_react15 = require("lucide-react");
3819
5785
  var import_jsx_runtime29 = require("react/jsx-runtime");
3820
- var import_lucide_react14 = require("lucide-react");
5786
+ var import_lucide_react16 = require("lucide-react");
3821
5787
  var import_jsx_runtime30 = require("react/jsx-runtime");
3822
5788
  var import_react22 = require("react");
3823
5789
  var import_jsx_runtime31 = require("react/jsx-runtime");
@@ -3829,7 +5795,7 @@ var import_react_router_dom9 = require("react-router-dom");
3829
5795
  var import_jsx_runtime35 = require("react/jsx-runtime");
3830
5796
  var import_react24 = __toESM(require("react"), 1);
3831
5797
  var import_react_router_dom10 = require("react-router-dom");
3832
- var import_lucide_react15 = require("lucide-react");
5798
+ var import_lucide_react17 = require("lucide-react");
3833
5799
  var import_clsx3 = require("clsx");
3834
5800
  var import_tailwind_merge3 = require("tailwind-merge");
3835
5801
  var import_react25 = require("react");
@@ -3837,28 +5803,29 @@ var import_jsx_runtime36 = require("react/jsx-runtime");
3837
5803
  var import_react26 = require("react");
3838
5804
  var import_jsx_runtime37 = require("react/jsx-runtime");
3839
5805
  var import_react27 = require("react");
5806
+ var import_lucide_react18 = require("lucide-react");
3840
5807
  var import_jsx_runtime38 = require("react/jsx-runtime");
3841
5808
  var import_react28 = require("react");
3842
5809
  var import_jsx_runtime39 = require("react/jsx-runtime");
3843
- var import_lucide_react16 = require("lucide-react");
5810
+ var import_lucide_react19 = require("lucide-react");
3844
5811
  var import_react_router_dom11 = require("react-router-dom");
3845
5812
  var import_jsx_runtime40 = require("react/jsx-runtime");
3846
5813
  var import_jsx_runtime41 = require("react/jsx-runtime");
3847
5814
  var import_react29 = require("react");
3848
- var import_lucide_react17 = require("lucide-react");
5815
+ var import_lucide_react20 = require("lucide-react");
3849
5816
  var import_jsx_runtime42 = require("react/jsx-runtime");
3850
- var import_lucide_react18 = require("lucide-react");
5817
+ var import_lucide_react21 = require("lucide-react");
3851
5818
  var import_react30 = require("react");
3852
5819
  var import_jsx_runtime43 = require("react/jsx-runtime");
3853
- var import_react31 = require("react");
5820
+ var import_react31 = __toESM(require("react"), 1);
3854
5821
  var import_react_router_dom12 = require("react-router-dom");
3855
- var import_lucide_react19 = require("lucide-react");
5822
+ var import_lucide_react22 = require("lucide-react");
3856
5823
  var import_jsx_runtime44 = require("react/jsx-runtime");
3857
5824
  var import_react32 = require("react");
3858
5825
  var import_react33 = require("react");
3859
- var import_lucide_react20 = require("lucide-react");
5826
+ var import_lucide_react23 = require("lucide-react");
3860
5827
  var import_jsx_runtime45 = require("react/jsx-runtime");
3861
- var import_lucide_react21 = require("lucide-react");
5828
+ var import_lucide_react24 = require("lucide-react");
3862
5829
  var import_jsx_runtime46 = require("react/jsx-runtime");
3863
5830
  var import_react34 = require("react");
3864
5831
  var import_jsx_runtime47 = require("react/jsx-runtime");
@@ -3870,7 +5837,7 @@ var import_react_router_dom13 = require("react-router-dom");
3870
5837
  var import_jsx_runtime51 = require("react/jsx-runtime");
3871
5838
  var import_react36 = __toESM(require("react"), 1);
3872
5839
  var import_react_router_dom14 = require("react-router-dom");
3873
- var import_lucide_react22 = require("lucide-react");
5840
+ var import_lucide_react25 = require("lucide-react");
3874
5841
  var import_clsx4 = require("clsx");
3875
5842
  var import_tailwind_merge4 = require("tailwind-merge");
3876
5843
  var import_react37 = require("react");
@@ -3878,28 +5845,29 @@ var import_jsx_runtime52 = require("react/jsx-runtime");
3878
5845
  var import_react38 = require("react");
3879
5846
  var import_jsx_runtime53 = require("react/jsx-runtime");
3880
5847
  var import_react39 = require("react");
5848
+ var import_lucide_react26 = require("lucide-react");
3881
5849
  var import_jsx_runtime54 = require("react/jsx-runtime");
3882
5850
  var import_react40 = require("react");
3883
5851
  var import_jsx_runtime55 = require("react/jsx-runtime");
3884
- var import_lucide_react23 = require("lucide-react");
5852
+ var import_lucide_react27 = require("lucide-react");
3885
5853
  var import_react_router_dom15 = require("react-router-dom");
3886
5854
  var import_jsx_runtime56 = require("react/jsx-runtime");
3887
5855
  var import_jsx_runtime57 = require("react/jsx-runtime");
3888
5856
  var import_react41 = require("react");
3889
- var import_lucide_react24 = require("lucide-react");
5857
+ var import_lucide_react28 = require("lucide-react");
3890
5858
  var import_jsx_runtime58 = require("react/jsx-runtime");
3891
- var import_lucide_react25 = require("lucide-react");
5859
+ var import_lucide_react29 = require("lucide-react");
3892
5860
  var import_react42 = require("react");
3893
5861
  var import_jsx_runtime59 = require("react/jsx-runtime");
3894
- var import_react43 = require("react");
5862
+ var import_react43 = __toESM(require("react"), 1);
3895
5863
  var import_react_router_dom16 = require("react-router-dom");
3896
- var import_lucide_react26 = require("lucide-react");
5864
+ var import_lucide_react30 = require("lucide-react");
3897
5865
  var import_jsx_runtime60 = require("react/jsx-runtime");
3898
5866
  var import_react44 = require("react");
3899
5867
  var import_react45 = require("react");
3900
- var import_lucide_react27 = require("lucide-react");
5868
+ var import_lucide_react31 = require("lucide-react");
3901
5869
  var import_jsx_runtime61 = require("react/jsx-runtime");
3902
- var import_lucide_react28 = require("lucide-react");
5870
+ var import_lucide_react32 = require("lucide-react");
3903
5871
  var import_jsx_runtime62 = require("react/jsx-runtime");
3904
5872
  var import_react46 = require("react");
3905
5873
  var import_jsx_runtime63 = require("react/jsx-runtime");
@@ -3911,7 +5879,7 @@ var import_react_router_dom17 = require("react-router-dom");
3911
5879
  var import_jsx_runtime67 = require("react/jsx-runtime");
3912
5880
  var import_react48 = __toESM(require("react"), 1);
3913
5881
  var import_react_router_dom18 = require("react-router-dom");
3914
- var import_lucide_react29 = require("lucide-react");
5882
+ var import_lucide_react33 = require("lucide-react");
3915
5883
  var import_clsx5 = require("clsx");
3916
5884
  var import_tailwind_merge5 = require("tailwind-merge");
3917
5885
  var import_react49 = require("react");
@@ -3922,25 +5890,25 @@ var import_react51 = require("react");
3922
5890
  var import_jsx_runtime70 = require("react/jsx-runtime");
3923
5891
  var import_react52 = require("react");
3924
5892
  var import_jsx_runtime71 = require("react/jsx-runtime");
3925
- var import_lucide_react30 = require("lucide-react");
5893
+ var import_lucide_react34 = require("lucide-react");
3926
5894
  var import_react_router_dom19 = require("react-router-dom");
3927
5895
  var import_jsx_runtime72 = require("react/jsx-runtime");
3928
5896
  var import_jsx_runtime73 = require("react/jsx-runtime");
3929
5897
  var import_react53 = require("react");
3930
- var import_lucide_react31 = require("lucide-react");
5898
+ var import_lucide_react35 = require("lucide-react");
3931
5899
  var import_jsx_runtime74 = require("react/jsx-runtime");
3932
- var import_lucide_react32 = require("lucide-react");
5900
+ var import_lucide_react36 = require("lucide-react");
3933
5901
  var import_react54 = require("react");
3934
5902
  var import_jsx_runtime75 = require("react/jsx-runtime");
3935
5903
  var import_react55 = require("react");
3936
5904
  var import_react_router_dom20 = require("react-router-dom");
3937
- var import_lucide_react33 = require("lucide-react");
5905
+ var import_lucide_react37 = require("lucide-react");
3938
5906
  var import_jsx_runtime76 = require("react/jsx-runtime");
3939
5907
  var import_react56 = require("react");
3940
5908
  var import_react57 = require("react");
3941
- var import_lucide_react34 = require("lucide-react");
5909
+ var import_lucide_react38 = require("lucide-react");
3942
5910
  var import_jsx_runtime77 = require("react/jsx-runtime");
3943
- var import_lucide_react35 = require("lucide-react");
5911
+ var import_lucide_react39 = require("lucide-react");
3944
5912
  var import_jsx_runtime78 = require("react/jsx-runtime");
3945
5913
  var import_react58 = require("react");
3946
5914
  var import_jsx_runtime79 = require("react/jsx-runtime");
@@ -3952,7 +5920,7 @@ var import_react_router_dom21 = require("react-router-dom");
3952
5920
  var import_jsx_runtime83 = require("react/jsx-runtime");
3953
5921
  var import_react60 = __toESM(require("react"), 1);
3954
5922
  var import_react_router_dom22 = require("react-router-dom");
3955
- var import_lucide_react36 = require("lucide-react");
5923
+ var import_lucide_react40 = require("lucide-react");
3956
5924
  var import_clsx6 = require("clsx");
3957
5925
  var import_tailwind_merge6 = require("tailwind-merge");
3958
5926
  var import_react61 = require("react");
@@ -3963,25 +5931,25 @@ var import_react63 = require("react");
3963
5931
  var import_jsx_runtime86 = require("react/jsx-runtime");
3964
5932
  var import_react64 = require("react");
3965
5933
  var import_jsx_runtime87 = require("react/jsx-runtime");
3966
- var import_lucide_react37 = require("lucide-react");
5934
+ var import_lucide_react41 = require("lucide-react");
3967
5935
  var import_react_router_dom23 = require("react-router-dom");
3968
5936
  var import_jsx_runtime88 = require("react/jsx-runtime");
3969
5937
  var import_jsx_runtime89 = require("react/jsx-runtime");
3970
5938
  var import_react65 = require("react");
3971
- var import_lucide_react38 = require("lucide-react");
5939
+ var import_lucide_react42 = require("lucide-react");
3972
5940
  var import_jsx_runtime90 = require("react/jsx-runtime");
3973
- var import_lucide_react39 = require("lucide-react");
5941
+ var import_lucide_react43 = require("lucide-react");
3974
5942
  var import_react66 = require("react");
3975
5943
  var import_jsx_runtime91 = require("react/jsx-runtime");
3976
5944
  var import_react67 = require("react");
3977
5945
  var import_react_router_dom24 = require("react-router-dom");
3978
- var import_lucide_react40 = require("lucide-react");
5946
+ var import_lucide_react44 = require("lucide-react");
3979
5947
  var import_jsx_runtime92 = require("react/jsx-runtime");
3980
5948
  var import_react68 = require("react");
3981
5949
  var import_react69 = require("react");
3982
- var import_lucide_react41 = require("lucide-react");
5950
+ var import_lucide_react45 = require("lucide-react");
3983
5951
  var import_jsx_runtime93 = require("react/jsx-runtime");
3984
- var import_lucide_react42 = require("lucide-react");
5952
+ var import_lucide_react46 = require("lucide-react");
3985
5953
  var import_jsx_runtime94 = require("react/jsx-runtime");
3986
5954
  var import_react70 = require("react");
3987
5955
  var import_jsx_runtime95 = require("react/jsx-runtime");
@@ -3989,18 +5957,198 @@ var import_jsx_runtime96 = require("react/jsx-runtime");
3989
5957
  var import_react71 = require("react");
3990
5958
  var import_jsx_runtime97 = require("react/jsx-runtime");
3991
5959
  var import_jsx_runtime98 = require("react/jsx-runtime");
3992
- var import_react72 = require("react");
5960
+ var import_react_router_dom25 = require("react-router-dom");
3993
5961
  var import_jsx_runtime99 = require("react/jsx-runtime");
5962
+ var import_react72 = __toESM(require("react"), 1);
5963
+ var import_react_router_dom26 = require("react-router-dom");
5964
+ var import_lucide_react47 = require("lucide-react");
5965
+ var import_clsx7 = require("clsx");
5966
+ var import_tailwind_merge7 = require("tailwind-merge");
5967
+ var import_react73 = require("react");
3994
5968
  var import_jsx_runtime100 = require("react/jsx-runtime");
5969
+ var import_react74 = require("react");
3995
5970
  var import_jsx_runtime101 = require("react/jsx-runtime");
3996
- var import_react73 = require("react");
5971
+ var import_react75 = require("react");
3997
5972
  var import_jsx_runtime102 = require("react/jsx-runtime");
5973
+ var import_react76 = require("react");
3998
5974
  var import_jsx_runtime103 = require("react/jsx-runtime");
5975
+ var import_lucide_react48 = require("lucide-react");
5976
+ var import_react_router_dom27 = require("react-router-dom");
3999
5977
  var import_jsx_runtime104 = require("react/jsx-runtime");
4000
- var import_react74 = require("react");
4001
5978
  var import_jsx_runtime105 = require("react/jsx-runtime");
5979
+ var import_react77 = require("react");
5980
+ var import_lucide_react49 = require("lucide-react");
4002
5981
  var import_jsx_runtime106 = require("react/jsx-runtime");
5982
+ var import_lucide_react50 = require("lucide-react");
5983
+ var import_react78 = require("react");
4003
5984
  var import_jsx_runtime107 = require("react/jsx-runtime");
5985
+ var import_react79 = require("react");
5986
+ var import_react_router_dom28 = require("react-router-dom");
5987
+ var import_lucide_react51 = require("lucide-react");
5988
+ var import_jsx_runtime108 = require("react/jsx-runtime");
5989
+ var import_react80 = require("react");
5990
+ var import_react81 = require("react");
5991
+ var import_lucide_react52 = require("lucide-react");
5992
+ var import_jsx_runtime109 = require("react/jsx-runtime");
5993
+ var import_lucide_react53 = require("lucide-react");
5994
+ var import_jsx_runtime110 = require("react/jsx-runtime");
5995
+ var import_react82 = require("react");
5996
+ var import_jsx_runtime111 = require("react/jsx-runtime");
5997
+ var import_jsx_runtime112 = require("react/jsx-runtime");
5998
+ var import_react83 = require("react");
5999
+ var import_jsx_runtime113 = require("react/jsx-runtime");
6000
+ var import_jsx_runtime114 = require("react/jsx-runtime");
6001
+ var import_react_router_dom29 = require("react-router-dom");
6002
+ var import_jsx_runtime115 = require("react/jsx-runtime");
6003
+ var import_react84 = __toESM(require("react"), 1);
6004
+ var import_react_router_dom30 = require("react-router-dom");
6005
+ var import_lucide_react54 = require("lucide-react");
6006
+ var import_clsx8 = require("clsx");
6007
+ var import_tailwind_merge8 = require("tailwind-merge");
6008
+ var import_react85 = require("react");
6009
+ var import_jsx_runtime116 = require("react/jsx-runtime");
6010
+ var import_react86 = require("react");
6011
+ var import_jsx_runtime117 = require("react/jsx-runtime");
6012
+ var import_react87 = require("react");
6013
+ var import_jsx_runtime118 = require("react/jsx-runtime");
6014
+ var import_react88 = require("react");
6015
+ var import_jsx_runtime119 = require("react/jsx-runtime");
6016
+ var import_lucide_react55 = require("lucide-react");
6017
+ var import_react_router_dom31 = require("react-router-dom");
6018
+ var import_jsx_runtime120 = require("react/jsx-runtime");
6019
+ var import_jsx_runtime121 = require("react/jsx-runtime");
6020
+ var import_react89 = require("react");
6021
+ var import_lucide_react56 = require("lucide-react");
6022
+ var import_jsx_runtime122 = require("react/jsx-runtime");
6023
+ var import_lucide_react57 = require("lucide-react");
6024
+ var import_react90 = require("react");
6025
+ var import_jsx_runtime123 = require("react/jsx-runtime");
6026
+ var import_react91 = require("react");
6027
+ var import_react_router_dom32 = require("react-router-dom");
6028
+ var import_lucide_react58 = require("lucide-react");
6029
+ var import_jsx_runtime124 = require("react/jsx-runtime");
6030
+ var import_react92 = require("react");
6031
+ var import_react93 = require("react");
6032
+ var import_lucide_react59 = require("lucide-react");
6033
+ var import_jsx_runtime125 = require("react/jsx-runtime");
6034
+ var import_lucide_react60 = require("lucide-react");
6035
+ var import_jsx_runtime126 = require("react/jsx-runtime");
6036
+ var import_react94 = require("react");
6037
+ var import_jsx_runtime127 = require("react/jsx-runtime");
6038
+ var import_jsx_runtime128 = require("react/jsx-runtime");
6039
+ var import_react95 = require("react");
6040
+ var import_jsx_runtime129 = require("react/jsx-runtime");
6041
+ var import_jsx_runtime130 = require("react/jsx-runtime");
6042
+ var import_react_router_dom33 = require("react-router-dom");
6043
+ var import_jsx_runtime131 = require("react/jsx-runtime");
6044
+ var import_react96 = __toESM(require("react"), 1);
6045
+ var import_react_router_dom34 = require("react-router-dom");
6046
+ var import_lucide_react61 = require("lucide-react");
6047
+ var import_clsx9 = require("clsx");
6048
+ var import_tailwind_merge9 = require("tailwind-merge");
6049
+ var import_react97 = require("react");
6050
+ var import_jsx_runtime132 = require("react/jsx-runtime");
6051
+ var import_react98 = require("react");
6052
+ var import_jsx_runtime133 = require("react/jsx-runtime");
6053
+ var import_react99 = require("react");
6054
+ var import_jsx_runtime134 = require("react/jsx-runtime");
6055
+ var import_react100 = require("react");
6056
+ var import_jsx_runtime135 = require("react/jsx-runtime");
6057
+ var import_lucide_react62 = require("lucide-react");
6058
+ var import_react_router_dom35 = require("react-router-dom");
6059
+ var import_jsx_runtime136 = require("react/jsx-runtime");
6060
+ var import_jsx_runtime137 = require("react/jsx-runtime");
6061
+ var import_react101 = require("react");
6062
+ var import_lucide_react63 = require("lucide-react");
6063
+ var import_jsx_runtime138 = require("react/jsx-runtime");
6064
+ var import_lucide_react64 = require("lucide-react");
6065
+ var import_react102 = require("react");
6066
+ var import_jsx_runtime139 = require("react/jsx-runtime");
6067
+ var import_react103 = require("react");
6068
+ var import_react_router_dom36 = require("react-router-dom");
6069
+ var import_lucide_react65 = require("lucide-react");
6070
+ var import_jsx_runtime140 = require("react/jsx-runtime");
6071
+ var import_react104 = require("react");
6072
+ var import_react105 = require("react");
6073
+ var import_lucide_react66 = require("lucide-react");
6074
+ var import_jsx_runtime141 = require("react/jsx-runtime");
6075
+ var import_lucide_react67 = require("lucide-react");
6076
+ var import_jsx_runtime142 = require("react/jsx-runtime");
6077
+ var import_react106 = require("react");
6078
+ var import_jsx_runtime143 = require("react/jsx-runtime");
6079
+ var import_jsx_runtime144 = require("react/jsx-runtime");
6080
+ var import_react107 = require("react");
6081
+ var import_jsx_runtime145 = require("react/jsx-runtime");
6082
+ var import_jsx_runtime146 = require("react/jsx-runtime");
6083
+ var import_react_router_dom37 = require("react-router-dom");
6084
+ var import_jsx_runtime147 = require("react/jsx-runtime");
6085
+ var import_react108 = __toESM(require("react"), 1);
6086
+ var import_react_router_dom38 = require("react-router-dom");
6087
+ var import_lucide_react68 = require("lucide-react");
6088
+ var import_clsx10 = require("clsx");
6089
+ var import_tailwind_merge10 = require("tailwind-merge");
6090
+ var import_react109 = require("react");
6091
+ var import_jsx_runtime148 = require("react/jsx-runtime");
6092
+ var import_react110 = require("react");
6093
+ var import_jsx_runtime149 = require("react/jsx-runtime");
6094
+ var import_react111 = require("react");
6095
+ var import_jsx_runtime150 = require("react/jsx-runtime");
6096
+ var import_react112 = require("react");
6097
+ var import_jsx_runtime151 = require("react/jsx-runtime");
6098
+ var import_lucide_react69 = require("lucide-react");
6099
+ var import_react_router_dom39 = require("react-router-dom");
6100
+ var import_jsx_runtime152 = require("react/jsx-runtime");
6101
+ var import_jsx_runtime153 = require("react/jsx-runtime");
6102
+ var import_react113 = require("react");
6103
+ var import_lucide_react70 = require("lucide-react");
6104
+ var import_jsx_runtime154 = require("react/jsx-runtime");
6105
+ var import_lucide_react71 = require("lucide-react");
6106
+ var import_react114 = require("react");
6107
+ var import_jsx_runtime155 = require("react/jsx-runtime");
6108
+ var import_react115 = require("react");
6109
+ var import_react_router_dom40 = require("react-router-dom");
6110
+ var import_lucide_react72 = require("lucide-react");
6111
+ var import_jsx_runtime156 = require("react/jsx-runtime");
6112
+ var import_react116 = require("react");
6113
+ var import_react117 = require("react");
6114
+ var import_lucide_react73 = require("lucide-react");
6115
+ var import_jsx_runtime157 = require("react/jsx-runtime");
6116
+ var import_lucide_react74 = require("lucide-react");
6117
+ var import_jsx_runtime158 = require("react/jsx-runtime");
6118
+ var import_react118 = require("react");
6119
+ var import_jsx_runtime159 = require("react/jsx-runtime");
6120
+ var import_jsx_runtime160 = require("react/jsx-runtime");
6121
+ var import_react119 = require("react");
6122
+ var import_jsx_runtime161 = require("react/jsx-runtime");
6123
+ var import_jsx_runtime162 = require("react/jsx-runtime");
6124
+ var import_react120 = require("react");
6125
+ var import_jsx_runtime163 = require("react/jsx-runtime");
6126
+ var import_jsx_runtime164 = require("react/jsx-runtime");
6127
+ var import_jsx_runtime165 = require("react/jsx-runtime");
6128
+ var import_react121 = require("react");
6129
+ var import_jsx_runtime166 = require("react/jsx-runtime");
6130
+ var import_jsx_runtime167 = require("react/jsx-runtime");
6131
+ var import_jsx_runtime168 = require("react/jsx-runtime");
6132
+ var import_react122 = require("react");
6133
+ var import_jsx_runtime169 = require("react/jsx-runtime");
6134
+ var import_jsx_runtime170 = require("react/jsx-runtime");
6135
+ var import_jsx_runtime171 = require("react/jsx-runtime");
6136
+ var import_react123 = require("react");
6137
+ var import_jsx_runtime172 = require("react/jsx-runtime");
6138
+ var import_jsx_runtime173 = require("react/jsx-runtime");
6139
+ var import_jsx_runtime174 = require("react/jsx-runtime");
6140
+ var import_react124 = require("react");
6141
+ var import_jsx_runtime175 = require("react/jsx-runtime");
6142
+ var import_jsx_runtime176 = require("react/jsx-runtime");
6143
+ var import_jsx_runtime177 = require("react/jsx-runtime");
6144
+ var import_react125 = require("react");
6145
+ var import_jsx_runtime178 = require("react/jsx-runtime");
6146
+ var import_jsx_runtime179 = require("react/jsx-runtime");
6147
+ var import_jsx_runtime180 = require("react/jsx-runtime");
6148
+ var import_react126 = require("react");
6149
+ var import_jsx_runtime181 = require("react/jsx-runtime");
6150
+ var import_jsx_runtime182 = require("react/jsx-runtime");
6151
+ var import_jsx_runtime183 = require("react/jsx-runtime");
4004
6152
  var PrimaryButton2 = ({
4005
6153
  loading = false,
4006
6154
  children,
@@ -4018,10 +6166,10 @@ var PrimaryButton2 = ({
4018
6166
  }
4019
6167
  );
4020
6168
  var Buttons_default2 = PrimaryButton2;
4021
- var Modal2 = ({ title, description, width, open, onClose, children }) => {
6169
+ var Modal2 = ({ title, description, width = "max-w-lg", open, onClose, children }) => {
4022
6170
  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: [
6171
+ 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: [
6172
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between items-start mb-6", children: [
4025
6173
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
4026
6174
  /* @__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
6175
  description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-gray-600 mt-1", children: description })
@@ -4036,7 +6184,7 @@ var Modal2 = ({ title, description, width, open, onClose, children }) => {
4036
6184
  }
4037
6185
  )
4038
6186
  ] }),
4039
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto mb-1", children })
6187
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto", children })
4040
6188
  ] }) });
4041
6189
  };
4042
6190
  var Modals_default2 = Modal2;
@@ -4088,41 +6236,43 @@ var ADDRESS_IP2 = chooseEnv2 === "prod" ? "back.rewise.praeduim-tech.com" : "loc
4088
6236
  var ADDRESS_IP_URL2 = chooseEnv2 === "prod" ? `https://${ADDRESS_IP2}/` : `http://${ADDRESS_IP2}/`;
4089
6237
  var API_URL2 = `${ADDRESS_IP_URL2}api`;
4090
6238
  var API_BASE_URL3 = `${API_URL2}/core/auth/`;
6239
+ var VENDORS_API_URL2 = `${API_URL2}/accounting/vendors/`;
4091
6240
  var SessionContext2 = (0, import_react14.createContext)(void 0);
4092
6241
  var API_BASE_URL22 = `${API_URL2}/core/auth/`;
4093
6242
  var USERS_API_URL2 = `${API_URL2}/core/users/`;
4094
6243
  var ToastContext2 = (0, import_react15.createContext)(void 0);
4095
6244
  var APPROVAL_API_URL2 = `${API_URL2}/approvals/cases/`;
4096
6245
  var AlertContext2 = (0, import_react22.createContext)(void 0);
4097
- var VENDORS_API_URL2 = `${API_URL2}/accounting/vendors/`;
4098
6246
  var ThemeContext22 = (0, import_react25.createContext)(void 0);
4099
6247
  var chooseEnv22 = localStorage.getItem("env") ?? "prod";
4100
6248
  var ADDRESS_IP22 = chooseEnv22 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
4101
6249
  var ADDRESS_IP_URL22 = chooseEnv22 === "prod" ? `https://${ADDRESS_IP22}/` : `http://${ADDRESS_IP22}/`;
4102
6250
  var API_URL22 = `${ADDRESS_IP_URL22}api`;
4103
6251
  var API_BASE_URL32 = `${API_URL22}/core/auth/`;
6252
+ var VENDORS_API_URL22 = `${API_URL22}/accounting/vendors/`;
4104
6253
  var SessionContext22 = (0, import_react26.createContext)(void 0);
4105
6254
  var API_BASE_URL222 = `${API_URL22}/core/auth/`;
4106
6255
  var USERS_API_URL22 = `${API_URL22}/core/users/`;
4107
6256
  var ToastContext22 = (0, import_react27.createContext)(void 0);
4108
6257
  var APPROVAL_API_URL22 = `${API_URL22}/approvals/cases/`;
4109
6258
  var AlertContext22 = (0, import_react34.createContext)(void 0);
4110
- var VENDORS_API_URL22 = `${API_URL22}/accounting/vendors/`;
4111
6259
  var ThemeContext222 = (0, import_react37.createContext)(void 0);
4112
- var ADDRESS_IP222 = "localhost:8000";
4113
- var ADDRESS_IP_URL222 = `http://${ADDRESS_IP222}/`;
6260
+ var chooseEnv222 = localStorage.getItem("env") ?? "prod";
6261
+ var ADDRESS_IP222 = chooseEnv222 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
6262
+ var ADDRESS_IP_URL222 = chooseEnv222 === "prod" ? `https://${ADDRESS_IP222}/` : `http://${ADDRESS_IP222}/`;
4114
6263
  var API_URL222 = `${ADDRESS_IP_URL222}api`;
4115
6264
  var API_BASE_URL322 = `${API_URL222}/core/auth/`;
6265
+ var VENDORS_API_URL222 = `${API_URL222}/accounting/vendors/`;
4116
6266
  var SessionContext222 = (0, import_react38.createContext)(void 0);
4117
6267
  var API_BASE_URL2222 = `${API_URL222}/core/auth/`;
4118
6268
  var USERS_API_URL222 = `${API_URL222}/core/users/`;
4119
6269
  var ToastContext222 = (0, import_react39.createContext)(void 0);
4120
6270
  var APPROVAL_API_URL222 = `${API_URL222}/approvals/cases/`;
4121
6271
  var AlertContext222 = (0, import_react46.createContext)(void 0);
4122
- var VENDORS_API_URL222 = `${API_URL222}/accounting/vendors/`;
4123
6272
  var ThemeContext2222 = (0, import_react49.createContext)(void 0);
4124
- var ADDRESS_IP2222 = "localhost:8000";
4125
- var ADDRESS_IP_URL2222 = `http://${ADDRESS_IP2222}/`;
6273
+ var chooseEnv2222 = localStorage.getItem("env") ?? "prod";
6274
+ var ADDRESS_IP2222 = chooseEnv2222 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
6275
+ var ADDRESS_IP_URL2222 = chooseEnv2222 === "prod" ? `https://${ADDRESS_IP2222}/` : `http://${ADDRESS_IP2222}/`;
4126
6276
  var API_URL2222 = `${ADDRESS_IP_URL2222}api`;
4127
6277
  var API_BASE_URL3222 = `${API_URL2222}/core/auth/`;
4128
6278
  var SessionContext2222 = (0, import_react50.createContext)(void 0);
@@ -4133,8 +6283,9 @@ var APPROVAL_API_URL2222 = `${API_URL2222}/approvals/cases/`;
4133
6283
  var AlertContext2222 = (0, import_react58.createContext)(void 0);
4134
6284
  var VENDORS_API_URL2222 = `${API_URL2222}/accounting/vendors/`;
4135
6285
  var ThemeContext22222 = (0, import_react61.createContext)(void 0);
4136
- var ADDRESS_IP22222 = "localhost:8000";
4137
- var ADDRESS_IP_URL22222 = `http://${ADDRESS_IP22222}/`;
6286
+ var chooseEnv22222 = localStorage.getItem("env") ?? "prod";
6287
+ var ADDRESS_IP22222 = chooseEnv22222 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
6288
+ var ADDRESS_IP_URL22222 = chooseEnv22222 === "prod" ? `https://${ADDRESS_IP22222}/` : `http://${ADDRESS_IP22222}/`;
4138
6289
  var API_URL22222 = `${ADDRESS_IP_URL22222}api`;
4139
6290
  var API_BASE_URL32222 = `${API_URL22222}/core/auth/`;
4140
6291
  var SessionContext22222 = (0, import_react62.createContext)(void 0);
@@ -4143,26 +6294,91 @@ var USERS_API_URL22222 = `${API_URL22222}/core/users/`;
4143
6294
  var ToastContext22222 = (0, import_react63.createContext)(void 0);
4144
6295
  var APPROVAL_API_URL22222 = `${API_URL22222}/approvals/cases/`;
4145
6296
  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/`;
6297
+ var VENDORS_API_URL22222 = `${API_URL22222}/accounting/vendors/`;
6298
+ var ThemeContext222222 = (0, import_react73.createContext)(void 0);
6299
+ var chooseEnv222222 = localStorage.getItem("env") ?? "prod";
6300
+ var ADDRESS_IP222222 = chooseEnv222222 === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
6301
+ var ADDRESS_IP_URL222222 = chooseEnv222222 === "prod" ? `https://${ADDRESS_IP222222}/` : `http://${ADDRESS_IP222222}/`;
6302
+ var API_URL222222 = `${ADDRESS_IP_URL222222}api`;
6303
+ var API_BASE_URL322222 = `${API_URL222222}/core/auth/`;
6304
+ var SessionContext222222 = (0, import_react74.createContext)(void 0);
6305
+ var API_BASE_URL2222222 = `${API_URL222222}/core/auth/`;
6306
+ var USERS_API_URL222222 = `${API_URL222222}/core/users/`;
6307
+ var ToastContext222222 = (0, import_react75.createContext)(void 0);
6308
+ var APPROVAL_API_URL222222 = `${API_URL222222}/approvals/cases/`;
6309
+ var AlertContext222222 = (0, import_react82.createContext)(void 0);
6310
+ var VENDORS_API_URL222222 = `${API_URL222222}/accounting/vendors/`;
6311
+ var ThemeContext2222222 = (0, import_react85.createContext)(void 0);
6312
+ var ADDRESS_IP2222222 = "localhost:8000";
6313
+ var ADDRESS_IP_URL2222222 = `http://${ADDRESS_IP2222222}/`;
6314
+ var API_URL2222222 = `${ADDRESS_IP_URL2222222}api`;
6315
+ var API_BASE_URL3222222 = `${API_URL2222222}/core/auth/`;
6316
+ var SessionContext2222222 = (0, import_react86.createContext)(void 0);
6317
+ var API_BASE_URL22222222 = `${API_URL2222222}/core/auth/`;
6318
+ var USERS_API_URL2222222 = `${API_URL2222222}/core/users/`;
6319
+ var ToastContext2222222 = (0, import_react87.createContext)(void 0);
6320
+ var APPROVAL_API_URL2222222 = `${API_URL2222222}/approvals/cases/`;
6321
+ var AlertContext2222222 = (0, import_react94.createContext)(void 0);
6322
+ var VENDORS_API_URL2222222 = `${API_URL2222222}/accounting/vendors/`;
6323
+ var ThemeContext22222222 = (0, import_react97.createContext)(void 0);
6324
+ var ADDRESS_IP22222222 = "localhost:8000";
6325
+ var ADDRESS_IP_URL22222222 = `http://${ADDRESS_IP22222222}/`;
6326
+ var API_URL22222222 = `${ADDRESS_IP_URL22222222}api`;
6327
+ var API_BASE_URL32222222 = `${API_URL22222222}/core/auth/`;
6328
+ var SessionContext22222222 = (0, import_react98.createContext)(void 0);
6329
+ var API_BASE_URL222222222 = `${API_URL22222222}/core/auth/`;
6330
+ var USERS_API_URL22222222 = `${API_URL22222222}/core/users/`;
6331
+ var ToastContext22222222 = (0, import_react99.createContext)(void 0);
6332
+ var APPROVAL_API_URL22222222 = `${API_URL22222222}/approvals/cases/`;
6333
+ var AlertContext22222222 = (0, import_react106.createContext)(void 0);
6334
+ var VENDORS_API_URL22222222 = `${API_URL22222222}/accounting/vendors/`;
6335
+ var ThemeContext222222222 = (0, import_react109.createContext)(void 0);
6336
+ var ADDRESS_IP222222222 = "localhost:8000";
6337
+ var ADDRESS_IP_URL222222222 = `http://${ADDRESS_IP222222222}/`;
6338
+ var API_URL222222222 = `${ADDRESS_IP_URL222222222}api`;
6339
+ var API_BASE_URL322222222 = `${API_URL222222222}/core/auth/`;
6340
+ var SessionContext222222222 = (0, import_react110.createContext)(void 0);
6341
+ var API_BASE_URL2222222222 = `${API_URL222222222}/core/auth/`;
6342
+ var USERS_API_URL222222222 = `${API_URL222222222}/core/users/`;
6343
+ var ToastContext222222222 = (0, import_react111.createContext)(void 0);
6344
+ var APPROVAL_API_URL222222222 = `${API_URL222222222}/approvals/cases/`;
6345
+ var AlertContext222222222 = (0, import_react118.createContext)(void 0);
6346
+ var URI = `${API_URL22222222}/core/departments/`;
6347
+ var URI2 = `${API_URL22222222}/accounting/profit-or-cost-center/`;
6348
+ var COST_URI = `${API_URL22222222}/accounting/cost-center/`;
6349
+ var PROFIT_URI = `${API_URL22222222}/accounting/profit-center/`;
6350
+ var URI3 = `${API_URL2222222}/core/departments/`;
6351
+ var URI4 = `${API_URL2222222}/accounting/profit-or-cost-center/`;
6352
+ var COST_URI2 = `${API_URL2222222}/accounting/cost-center/`;
6353
+ var PROFIT_URI2 = `${API_URL2222222}/accounting/profit-center/`;
6354
+ var URI5 = `${API_URL222222}/core/departments/`;
6355
+ var URI6 = `${API_URL222222}/accounting/profit-or-cost-center/`;
6356
+ var COST_URI3 = `${API_URL222222}/accounting/cost-center/`;
6357
+ var PROFIT_URI3 = `${API_URL222222}/accounting/profit-center/`;
6358
+ var URI7 = `${API_URL22222}/core/departments/`;
6359
+ var URI8 = `${API_URL22222}/accounting/profit-or-cost-center/`;
6360
+ var COST_URI4 = `${API_URL22222}/accounting/cost-center/`;
6361
+ var PROFIT_URI4 = `${API_URL22222}/accounting/profit-center/`;
6362
+ var URI9 = `${API_URL2222}/core/departments/`;
6363
+ var URI10 = `${API_URL2222}/accounting/profit-or-cost-center/`;
6364
+ var COST_URI5 = `${API_URL2222}/accounting/cost-center/`;
6365
+ var PROFIT_URI5 = `${API_URL2222}/accounting/profit-center/`;
6366
+ var URI11 = `${API_URL222}/core/departments/`;
6367
+ var URI12 = `${API_URL222}/accounting/profit-or-cost-center/`;
6368
+ var COST_URI6 = `${API_URL222}/accounting/cost-center/`;
6369
+ var PROFIT_URI6 = `${API_URL222}/accounting/profit-center/`;
6370
+ var URI13 = `${API_URL22}/core/departments/`;
6371
+ var URI14 = `${API_URL22}/accounting/profit-or-cost-center/`;
6372
+ var COST_URI7 = `${API_URL22}/accounting/cost-center/`;
6373
+ var PROFIT_URI7 = `${API_URL22}/accounting/profit-center/`;
6374
+ var URI15 = `${API_URL2}/core/departments/`;
6375
+ var URI16 = `${API_URL2}/accounting/profit-or-cost-center/`;
6376
+ var COST_URI8 = `${API_URL2}/accounting/cost-center/`;
6377
+ var PROFIT_URI8 = `${API_URL2}/accounting/profit-center/`;
4162
6378
 
4163
6379
  // src/components/common/FormVendor.tsx
4164
- var import_react75 = require("react");
4165
- var import_jsx_runtime108 = require("react/jsx-runtime");
6380
+ var import_react127 = require("react");
6381
+ var import_jsx_runtime184 = require("react/jsx-runtime");
4166
6382
  var MinimalVendorForm = ({
4167
6383
  isOpen,
4168
6384
  onClose,
@@ -4171,13 +6387,13 @@ var MinimalVendorForm = ({
4171
6387
  refresh = () => {
4172
6388
  }
4173
6389
  }) => {
4174
- const [formData, setFormData] = (0, import_react75.useState)(object || {
6390
+ const [formData, setFormData] = (0, import_react127.useState)(object || {
4175
6391
  from_module: from ?? null,
4176
6392
  legal_name: "",
4177
6393
  trading_name: ""
4178
6394
  });
4179
- const [errors, setErrors] = (0, import_react75.useState)({});
4180
- const [loading, setLoading] = (0, import_react75.useState)(false);
6395
+ const [errors, setErrors] = (0, import_react127.useState)({});
6396
+ const [loading, setLoading] = (0, import_react127.useState)(false);
4181
6397
  const { token } = useSession();
4182
6398
  const { success, error: showError } = useToast();
4183
6399
  const handleInputChange = (e) => {
@@ -4236,7 +6452,7 @@ var MinimalVendorForm = ({
4236
6452
  }
4237
6453
  };
4238
6454
  if (!isOpen) return null;
4239
- return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
6455
+ return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
4240
6456
  Modals_default2,
4241
6457
  {
4242
6458
  title: "Ajouter un fournisseur",
@@ -4244,9 +6460,9 @@ var MinimalVendorForm = ({
4244
6460
  description: ``,
4245
6461
  open: isOpen,
4246
6462
  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)(
6463
+ children: /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("form", { onSubmit: handleSubmit, className: "p-", children: [
6464
+ /* @__PURE__ */ (0, import_jsx_runtime184.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6465
+ /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
4250
6466
  TextInput2,
4251
6467
  {
4252
6468
  label: "Raison sociale",
@@ -4258,7 +6474,7 @@ var MinimalVendorForm = ({
4258
6474
  onChange: handleInputChange
4259
6475
  }
4260
6476
  ),
4261
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
6477
+ /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
4262
6478
  TextInput2,
4263
6479
  {
4264
6480
  label: "Nom commercial",
@@ -4269,8 +6485,8 @@ var MinimalVendorForm = ({
4269
6485
  }
4270
6486
  )
4271
6487
  ] }) }),
4272
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex justify-between pt-6 mt-8", children: [
4273
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
6488
+ /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)("div", { className: "flex justify-between pt-6 mt-8", children: [
6489
+ /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
4274
6490
  "button",
4275
6491
  {
4276
6492
  type: "button",
@@ -4279,7 +6495,7 @@ var MinimalVendorForm = ({
4279
6495
  children: "Annuler"
4280
6496
  }
4281
6497
  ),
4282
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
6498
+ /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
4283
6499
  Buttons_default2,
4284
6500
  {
4285
6501
  type: "button",
@@ -4295,43 +6511,43 @@ var MinimalVendorForm = ({
4295
6511
  };
4296
6512
 
4297
6513
  // src/services/DepartmentServices.ts
4298
- var URI9 = `${API_URL}/core/departments/`;
6514
+ var URI17 = `${API_URL}/core/departments/`;
4299
6515
  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}/`)
6516
+ create: (data) => FetchApi.post(`${URI17}`, data),
6517
+ get: (id) => FetchApi.get(`${URI17}${id}/`),
6518
+ list: (params) => FetchApi.get(`${URI17}?${new URLSearchParams(params).toString()}`),
6519
+ update: (id, data) => FetchApi.put(`${URI17}${id}/`, data),
6520
+ delete: (id) => FetchApi.delete(`${URI17}${id}/`)
4305
6521
  };
4306
6522
 
4307
6523
  // src/services/ProfitCostsServices.ts
4308
- var URI10 = `${API_URL}/accounting/profit-or-cost-center/`;
4309
- var COST_URI5 = `${API_URL}/accounting/cost-center/`;
6524
+ var URI18 = `${API_URL}/accounting/profit-or-cost-center/`;
6525
+ var COST_URI9 = `${API_URL}/accounting/cost-center/`;
4310
6526
  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}/`)
6527
+ create: (data) => FetchApi.post(`${COST_URI9}`, data),
6528
+ get: (id) => FetchApi.get(`${COST_URI9}${id}/`),
6529
+ list: (params) => FetchApi.get(`${COST_URI9}?${new URLSearchParams(params).toString()}`),
6530
+ update: (id, data) => FetchApi.put(`${COST_URI9}${id}/`, data),
6531
+ delete: (id) => FetchApi.delete(`${COST_URI9}${id}/`)
4316
6532
  };
4317
- var PROFIT_URI5 = `${API_URL}/accounting/profit-center/`;
6533
+ var PROFIT_URI9 = `${API_URL}/accounting/profit-center/`;
4318
6534
 
4319
6535
  // src/components/common/CommonSelect.tsx
4320
- var import_jsx_runtime109 = require("react/jsx-runtime");
6536
+ var import_jsx_runtime185 = require("react/jsx-runtime");
4321
6537
  var SelectVendor = ({
4322
6538
  value,
4323
6539
  onSelect
4324
6540
  }) => {
4325
- const [showModal, setShowModal] = (0, import_react76.useState)(false);
4326
- const [selectedVendor, setSelectedVendor] = (0, import_react76.useState)(null);
6541
+ const [showModal, setShowModal] = (0, import_react128.useState)(false);
6542
+ const [selectedVendor, setSelectedVendor] = (0, import_react128.useState)(null);
4327
6543
  const { token, activeBusinessEntity } = useSession();
4328
- const [vendors, setVendors] = (0, import_react76.useState)(() => {
6544
+ const [vendors, setVendors] = (0, import_react128.useState)(() => {
4329
6545
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
4330
6546
  const cached = sessionStorage.getItem(cacheKey);
4331
6547
  return cached ? JSON.parse(cached) : [];
4332
6548
  });
4333
- const [loadingVendors, setLoadingVendors] = (0, import_react76.useState)(false);
4334
- (0, import_react76.useEffect)(() => {
6549
+ const [loadingVendors, setLoadingVendors] = (0, import_react128.useState)(false);
6550
+ (0, import_react128.useEffect)(() => {
4335
6551
  const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
4336
6552
  const cached = sessionStorage.getItem(cacheKey);
4337
6553
  if (!cached) {
@@ -4369,9 +6585,9 @@ var SelectVendor = ({
4369
6585
  sessionStorage.removeItem(cacheKey);
4370
6586
  loadVendors();
4371
6587
  };
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)(
6588
+ return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { children: [
6589
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
6590
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
4375
6591
  SearchableSelect,
4376
6592
  {
4377
6593
  value,
@@ -4387,8 +6603,8 @@ var SelectVendor = ({
4387
6603
  },
4388
6604
  "fourni" + value
4389
6605
  ),
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)(
6606
+ loadingVendors && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des fournisseurs..." }),
6607
+ showModal && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
4392
6608
  MinimalVendorForm,
4393
6609
  {
4394
6610
  object: selectedVendor,
@@ -4405,13 +6621,13 @@ var SelectUser = ({
4405
6621
  onSelect
4406
6622
  }) => {
4407
6623
  const { token, activeBusinessEntity } = useSession();
4408
- const [users, setUsers] = (0, import_react76.useState)(() => {
6624
+ const [users, setUsers] = (0, import_react128.useState)(() => {
4409
6625
  const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
4410
6626
  const cached = sessionStorage.getItem(cacheKey);
4411
6627
  return cached ? JSON.parse(cached) : [];
4412
6628
  });
4413
- const [loading, setLoading] = (0, import_react76.useState)(false);
4414
- (0, import_react76.useEffect)(() => {
6629
+ const [loading, setLoading] = (0, import_react128.useState)(false);
6630
+ (0, import_react128.useEffect)(() => {
4415
6631
  const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
4416
6632
  const cached = sessionStorage.getItem(cacheKey);
4417
6633
  if (!cached) {
@@ -4447,19 +6663,19 @@ var SelectUser = ({
4447
6663
  return users.map((user) => ({
4448
6664
  value: user.id,
4449
6665
  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: [
6666
+ content: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { className: "flex-1", children: [
6667
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { className: "font-medium text-gray-900", children: [
4452
6668
  user.first_name,
4453
6669
  " ",
4454
6670
  user.last_name
4455
6671
  ] }),
4456
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "text-sm text-gray-500", children: user.email })
6672
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "text-sm text-gray-500", children: user.email })
4457
6673
  ] }) })
4458
6674
  }));
4459
6675
  };
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)(
6676
+ return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { children: [
6677
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
6678
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
4463
6679
  SearchableSelect,
4464
6680
  {
4465
6681
  value,
@@ -4472,7 +6688,7 @@ var SelectUser = ({
4472
6688
  },
4473
6689
  "user" + value
4474
6690
  ),
4475
- loading && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
6691
+ loading && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
4476
6692
  ] });
4477
6693
  };
4478
6694
  var SelectDepartment = ({
@@ -4480,13 +6696,13 @@ var SelectDepartment = ({
4480
6696
  onSelect
4481
6697
  }) => {
4482
6698
  const { token, activeBusinessEntity } = useSession();
4483
- const [departments, setDepartments] = (0, import_react76.useState)(() => {
6699
+ const [departments, setDepartments] = (0, import_react128.useState)(() => {
4484
6700
  const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
4485
6701
  const cached = sessionStorage.getItem(cacheKey);
4486
6702
  return cached ? JSON.parse(cached) : [];
4487
6703
  });
4488
- const [loading, setLoading] = (0, import_react76.useState)(false);
4489
- (0, import_react76.useEffect)(() => {
6704
+ const [loading, setLoading] = (0, import_react128.useState)(false);
6705
+ (0, import_react128.useEffect)(() => {
4490
6706
  const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
4491
6707
  const cached = sessionStorage.getItem(cacheKey);
4492
6708
  if (!cached) {
@@ -4522,9 +6738,9 @@ var SelectDepartment = ({
4522
6738
  label: dept.name
4523
6739
  }));
4524
6740
  };
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)(
6741
+ return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { children: [
6742
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
6743
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
4528
6744
  SearchableSelect,
4529
6745
  {
4530
6746
  value,
@@ -4537,7 +6753,7 @@ var SelectDepartment = ({
4537
6753
  },
4538
6754
  "dept" + value
4539
6755
  ),
4540
- loading && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
6756
+ loading && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
4541
6757
  ] });
4542
6758
  };
4543
6759
  var SelectCostCenter = ({
@@ -4545,13 +6761,13 @@ var SelectCostCenter = ({
4545
6761
  onSelect
4546
6762
  }) => {
4547
6763
  const { token, activeBusinessEntity } = useSession();
4548
- const [costCenters, setCostCenters] = (0, import_react76.useState)(() => {
6764
+ const [costCenters, setCostCenters] = (0, import_react128.useState)(() => {
4549
6765
  const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
4550
6766
  const cached = sessionStorage.getItem(cacheKey);
4551
6767
  return cached ? JSON.parse(cached) : [];
4552
6768
  });
4553
- const [loading, setLoading] = (0, import_react76.useState)(false);
4554
- (0, import_react76.useEffect)(() => {
6769
+ const [loading, setLoading] = (0, import_react128.useState)(false);
6770
+ (0, import_react128.useEffect)(() => {
4555
6771
  const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
4556
6772
  const cached = sessionStorage.getItem(cacheKey);
4557
6773
  if (!cached) {
@@ -4585,18 +6801,18 @@ var SelectCostCenter = ({
4585
6801
  return costCenters.map((center) => ({
4586
6802
  value: center.id,
4587
6803
  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: [
6804
+ content: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { className: "flex-1", children: [
6805
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "font-medium text-gray-900", children: center.name }),
6806
+ center.code && /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { className: "text-sm text-gray-500", children: [
4591
6807
  "Code: ",
4592
6808
  center.code
4593
6809
  ] })
4594
6810
  ] }) })
4595
6811
  }));
4596
6812
  };
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)(
6813
+ return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { children: [
6814
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
6815
+ /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
4600
6816
  SearchableSelect,
4601
6817
  {
4602
6818
  value,
@@ -4609,12 +6825,12 @@ var SelectCostCenter = ({
4609
6825
  },
4610
6826
  "cost" + value
4611
6827
  ),
4612
- loading && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
6828
+ loading && /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
4613
6829
  ] });
4614
6830
  };
4615
6831
 
4616
6832
  // src/components/common/Choices.tsx
4617
- var import_jsx_runtime110 = require("react/jsx-runtime");
6833
+ var import_jsx_runtime186 = require("react/jsx-runtime");
4618
6834
  var CHOICES = {
4619
6835
  INVOICE_TYPES: [
4620
6836
  { value: "sale", label: { fr: "Vente", en: "Sale", default: "Sale" } },
@@ -4872,7 +7088,7 @@ var InvoiceTypeSelector = ({
4872
7088
  value: item.value,
4873
7089
  label: item.label[language]
4874
7090
  }));
4875
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7091
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
4876
7092
  SearchableSelect,
4877
7093
  {
4878
7094
  value,
@@ -4895,7 +7111,7 @@ var PaymentMethodSelector = ({
4895
7111
  value: item.value,
4896
7112
  label: item.label[language]
4897
7113
  }));
4898
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7114
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
4899
7115
  SearchableSelect,
4900
7116
  {
4901
7117
  value,
@@ -4918,7 +7134,7 @@ var TemplateFNESelector = ({
4918
7134
  value: item.value,
4919
7135
  label: item.label[language]
4920
7136
  }));
4921
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7137
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
4922
7138
  SearchableSelect,
4923
7139
  {
4924
7140
  value,
@@ -4941,7 +7157,7 @@ var ForeignCurrencySelector = ({
4941
7157
  value: item.value,
4942
7158
  label: item.label[language]
4943
7159
  }));
4944
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7160
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
4945
7161
  SearchableSelect,
4946
7162
  {
4947
7163
  value,
@@ -4965,7 +7181,7 @@ var TaxSelector = ({
4965
7181
  value: item.value,
4966
7182
  label: item.label[language]
4967
7183
  }));
4968
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7184
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
4969
7185
  SearchableSelect,
4970
7186
  {
4971
7187
  value,
@@ -4993,7 +7209,7 @@ var LegalFormSelector = ({
4993
7209
  value: item.value,
4994
7210
  label: item.label[language] ?? item.label.default
4995
7211
  }));
4996
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7212
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
4997
7213
  SearchableSelect,
4998
7214
  {
4999
7215
  value,
@@ -5016,7 +7232,7 @@ var CountrySelector = ({
5016
7232
  value: item.value,
5017
7233
  label: item.label[language]
5018
7234
  }));
5019
- return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
7235
+ return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
5020
7236
  SearchableSelect,
5021
7237
  {
5022
7238
  value,