ptechcore_ui 1.0.76 → 1.0.78

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
@@ -191,9 +191,9 @@ __export(index_exports, {
191
191
  fileManagerApi: () => fileManagerApi,
192
192
  findFolderById: () => findFolderById2,
193
193
  formatCurrency: () => formatCurrency,
194
- formatDate: () => formatDate,
194
+ formatDate: () => formatDate2,
195
195
  formatDateFR: () => formatDateFR,
196
- formatDateTime: () => formatDateTime,
196
+ formatDateTime: () => formatDateTime2,
197
197
  formatFileSize: () => formatFileSize,
198
198
  getAllFolders: () => getAllFolders,
199
199
  getAllSLATemplates: () => getAllSLATemplates,
@@ -700,6 +700,25 @@ function formatCurrency(amount, currency = "XAF") {
700
700
  }
701
701
  return new Intl.NumberFormat("fr-FR").format(amount) + " " + currency;
702
702
  }
703
+ function formatDateTime(date) {
704
+ if (!date) return "Non d\xE9fini";
705
+ try {
706
+ const dateObj = typeof date === "string" ? new Date(date) : date;
707
+ if (isNaN(dateObj.getTime())) {
708
+ return "Date invalide";
709
+ }
710
+ return dateObj.toLocaleDateString("fr-FR", {
711
+ year: "numeric",
712
+ month: "long",
713
+ day: "numeric",
714
+ hour: "2-digit",
715
+ minute: "2-digit",
716
+ second: "2-digit"
717
+ });
718
+ } catch (error) {
719
+ return "Erreur de format";
720
+ }
721
+ }
703
722
 
704
723
  // src/contexts/ThemeContext.tsx
705
724
  var import_react2 = require("react");
@@ -1175,6 +1194,80 @@ var FetchApi = class {
1175
1194
  if (!res.ok) throw new Error(await res.text());
1176
1195
  return res.json();
1177
1196
  }
1197
+ static async postFile(url, payload, token) {
1198
+ const headers = {};
1199
+ const local_token = localStorage.getItem("token");
1200
+ if (local_token) {
1201
+ headers["Authorization"] = `Token ${local_token}`;
1202
+ }
1203
+ let body;
1204
+ const business_entity_id = localStorage.getItem("active_center_id");
1205
+ if (payload instanceof FormData) {
1206
+ if (business_entity_id) {
1207
+ payload.append("business_entity_id", business_entity_id);
1208
+ payload.append("business_entity", business_entity_id);
1209
+ }
1210
+ body = payload;
1211
+ } else if (payload) {
1212
+ const formData = new FormData();
1213
+ Object.entries(payload).forEach(([key, value]) => {
1214
+ if (Array.isArray(value)) {
1215
+ formData.append(key, value.join(","));
1216
+ } else if (value !== null && value !== void 0) {
1217
+ formData.append(key, value);
1218
+ }
1219
+ });
1220
+ if (business_entity_id) {
1221
+ formData.append("business_entity_id", business_entity_id);
1222
+ formData.append("business_entity", business_entity_id);
1223
+ }
1224
+ body = formData;
1225
+ }
1226
+ const res = await fetch(url, {
1227
+ method: "POST",
1228
+ headers,
1229
+ body
1230
+ });
1231
+ if (!res.ok) throw new Error(await res.text());
1232
+ return res.json();
1233
+ }
1234
+ static async putFile(url, payload, token) {
1235
+ const headers = {};
1236
+ const local_token = localStorage.getItem("token");
1237
+ if (local_token) {
1238
+ headers["Authorization"] = `Token ${local_token}`;
1239
+ }
1240
+ let body;
1241
+ const business_entity_id = localStorage.getItem("active_center_id");
1242
+ if (payload instanceof FormData) {
1243
+ if (business_entity_id) {
1244
+ payload.append("business_entity_id", business_entity_id);
1245
+ payload.append("business_entity", business_entity_id);
1246
+ }
1247
+ body = payload;
1248
+ } else if (payload) {
1249
+ const formData = new FormData();
1250
+ Object.entries(payload).forEach(([key, value]) => {
1251
+ if (Array.isArray(value)) {
1252
+ formData.append(key, value.join(","));
1253
+ } else if (value !== null && value !== void 0) {
1254
+ formData.append(key, value);
1255
+ }
1256
+ });
1257
+ if (business_entity_id) {
1258
+ formData.append("business_entity_id", business_entity_id);
1259
+ formData.append("business_entity", business_entity_id);
1260
+ }
1261
+ body = formData;
1262
+ }
1263
+ const res = await fetch(url, {
1264
+ method: "PUT",
1265
+ headers,
1266
+ body
1267
+ });
1268
+ if (!res.ok) throw new Error(await res.text());
1269
+ return res.json();
1270
+ }
1178
1271
  static async patch(url, payload, token) {
1179
1272
  const headers = {
1180
1273
  "Content-Type": "application/json"
@@ -1196,14 +1289,18 @@ var FetchApi = class {
1196
1289
  var apiClient = {
1197
1290
  get: (path) => FetchApi.get(`${API_URL}${path}`),
1198
1291
  post: (path, data) => FetchApi.post(`${API_URL}${path}`, data),
1292
+ postFile: (path, data) => FetchApi.postFile(`${API_URL}${path}`, data),
1199
1293
  put: (path, data) => FetchApi.put(`${API_URL}${path}`, data),
1294
+ putFile: (path, data) => FetchApi.putFile(`${API_URL}${path}`, data),
1200
1295
  patch: (path, data) => FetchApi.patch(`${API_URL}${path}`, data),
1201
1296
  delete: (path) => FetchApi.delete(`${API_URL}${path}`)
1202
1297
  };
1203
1298
  var coreApiClient = {
1204
1299
  get: (path) => FetchApi.get(`${API_URL}/core${path}`),
1205
1300
  post: (path, data) => FetchApi.post(`${API_URL}/core${path}`, data),
1301
+ postFile: (path, data) => FetchApi.postFile(`${API_URL}/core${path}`, data),
1206
1302
  put: (path, data) => FetchApi.put(`${API_URL}/core${path}`, data),
1303
+ putFile: (path, data) => FetchApi.putFile(`${API_URL}/core${path}`, data),
1207
1304
  patch: (path, data) => FetchApi.patch(`${API_URL}/core${path}`, data),
1208
1305
  delete: (path) => FetchApi.delete(`${API_URL}/core${path}`)
1209
1306
  };
@@ -1430,7 +1527,7 @@ var UserServices = {
1430
1527
  // Obtenir toutes les notifications de l'utilisateur
1431
1528
  getUsersNotifications: () => FetchApi.get(`${USERS_API_URL}notifications/`),
1432
1529
  // Marquer une notification comme lue
1433
- markNotificationAsRead: (notificationId) => FetchApi.post(`${USERS_API_URL}notifications/${notificationId}/mark-read/`, {}),
1530
+ markNotificationAsRead: (notificationId) => FetchApi.post(`${API_URL}/core/notifications/${notificationId}/mark-read/`, {}),
1434
1531
  // Obtenir un utilisateur par ID
1435
1532
  getUser: (id, token) => FetchApi.get(`${USERS_API_URL}${id}/`, token),
1436
1533
  // Mettre à jour un utilisateur
@@ -2984,11 +3081,11 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
2984
3081
  {
2985
3082
  className: "relative p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
2986
3083
  onClick: () => setShowNotifications(!showNotifications),
2987
- "aria-label": `Notifications ${notifications.filter((n) => !n.read).length > 0 ? `(${notifications.filter((n) => !n.read).length} non lues)` : ""}`,
3084
+ title: `Notifications ${notifications.filter((n) => !n.is_read && !["approved"].includes(n?.object_detail?.answer)).length > 0 ? `(${notifications.filter((n) => !n.is_read && !["approved"].includes(n?.object_detail?.answer)).length} non lues)` : ""}`,
2988
3085
  "aria-expanded": showNotifications,
2989
3086
  children: [
2990
3087
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Bell, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
2991
- 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" })
3088
+ notifications.filter((n) => !n.is_read && !["approved"].includes(n?.object_detail?.answer)).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" })
2992
3089
  ]
2993
3090
  }
2994
3091
  ),
@@ -3000,31 +3097,29 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
3000
3097
  "aria-label": "Centre de notifications",
3001
3098
  children: [
3002
3099
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "p-4 border-b border-[var(--color-border)]", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Notifications" }) }),
3003
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "divide-y divide-[var(--color-border)]", children: notifications.map((notif) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3004
- "div",
3005
- {
3006
- className: cn(
3007
- "p-4 hover:bg-[var(--color-surface-hover)] cursor-pointer",
3008
- !notif.read && "bg-[var(--color-primary-light)] bg-opacity-10"
3009
- ),
3010
- onClick: () => markNotificationAsRead(notif.id),
3011
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start gap-3", children: [
3012
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn(
3013
- "w-2 h-2 rounded-full mt-2",
3014
- notif.type === "error" && "bg-[var(--color-error)]",
3015
- notif.type === "warning" && "bg-[var(--color-warning)]",
3016
- notif.type === "success" && "bg-[var(--color-success)]",
3017
- notif.type === "info" && "bg-[var(--color-info)]"
3018
- ) }),
3019
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1", children: [
3020
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: notif.title }),
3021
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-secondary)] mt-1", children: notif.message }),
3022
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] mt-2" })
3023
- ] })
3024
- ] })
3025
- },
3026
- notif.id
3027
- )) })
3100
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "divide-y divide-[var(--color-border)]", children: notifications.map(
3101
+ (notif) => {
3102
+ const is_read = notif.is_read || ["approved"].includes(notif?.object_detail?.answer);
3103
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3104
+ "div",
3105
+ {
3106
+ className: cn(
3107
+ "p-4 hover:bg-[var(--color-surface-hover)] cursor-pointer"
3108
+ ),
3109
+ onClick: () => markNotificationAsRead(notif.id),
3110
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start gap-3", children: [
3111
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2", children: !is_read ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.Mail, { size: 15, className: "text-[var(--color-primary)]" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.MailOpen, { size: 15, className: "text-gray-500" }) }),
3112
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1", children: [
3113
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: `text-sm ${!is_read ? "text-black font-bold" : " font-normal text-[var(--color-text-primary)]"}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-2", children: notif.title }) }),
3114
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-secondary)] mt-1", children: notif.message }),
3115
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] mt-2", children: formatDateTime(notif?.created_at) ?? "-" })
3116
+ ] })
3117
+ ] })
3118
+ },
3119
+ notif.id
3120
+ );
3121
+ }
3122
+ ) })
3028
3123
  ]
3029
3124
  }
3030
3125
  )
@@ -7209,7 +7304,7 @@ var formatFileSize = (bytes) => {
7209
7304
  const i = Math.floor(Math.log(bytes) / Math.log(k));
7210
7305
  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${units[i]}`;
7211
7306
  };
7212
- var formatDate = (date) => {
7307
+ var formatDate2 = (date) => {
7213
7308
  if (!date) {
7214
7309
  return "-";
7215
7310
  }
@@ -7223,7 +7318,7 @@ var formatDate = (date) => {
7223
7318
  year: "numeric"
7224
7319
  });
7225
7320
  };
7226
- var formatDateTime = (date) => {
7321
+ var formatDateTime2 = (date) => {
7227
7322
  if (!date) {
7228
7323
  return "-";
7229
7324
  }
@@ -7379,7 +7474,7 @@ var FileCard = ({ item, variant = "grid" }) => {
7379
7474
  }
7380
7475
  ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "block truncate text-sm text-gray-900 dark:text-gray-100", children: item.name }) }),
7381
7476
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-20 text-right", children: !isFolder && formatFileSize(item.size) }),
7382
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-24 text-right", children: formatDate(item.updatedAt || item.createdAt) })
7477
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-24 text-right", children: formatDate2(item.updatedAt || item.createdAt) })
7383
7478
  ]
7384
7479
  }
7385
7480
  );
@@ -9694,13 +9789,12 @@ var FormVendor = ({
9694
9789
  }
9695
9790
  ),
9696
9791
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
9697
- TextInput,
9792
+ SelectLegalForm,
9698
9793
  {
9699
- label: "Forme juridique",
9700
- name: "legal_form",
9701
9794
  value: formData.legal_form || "",
9702
- placeholder: "SARL, SA, SAS, etc.",
9703
- onChange: handleInputChange
9795
+ onSelect: (option) => setFormData((prev) => ({ ...prev, legal_form: String(option.value) })),
9796
+ allowClear: true,
9797
+ onRemove: () => setFormData((prev) => ({ ...prev, legal_form: "" }))
9704
9798
  }
9705
9799
  ),
9706
9800
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
@@ -10293,13 +10387,12 @@ var FormClient = ({
10293
10387
  }
10294
10388
  ),
10295
10389
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10296
- TextInput,
10390
+ SelectLegalForm,
10297
10391
  {
10298
- label: "Forme juridique",
10299
- name: "legal_form",
10300
10392
  value: formData.legal_form || "",
10301
- placeholder: "SARL, SA, SAS, etc.",
10302
- onChange: handleInputChange
10393
+ onSelect: (option) => setFormData((prev) => ({ ...prev, legal_form: String(option.value) })),
10394
+ allowClear: true,
10395
+ onRemove: () => setFormData((prev) => ({ ...prev, legal_form: "" }))
10303
10396
  }
10304
10397
  ),
10305
10398
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
@@ -10817,6 +10910,7 @@ var ApprovalWorkflow = ({
10817
10910
  if (!token) return;
10818
10911
  try {
10819
10912
  const response = await ApprovalServices.getDetails(process, object_id, token);
10913
+ console.log("Response case details:", response.success && response.data);
10820
10914
  if (response.success && response.data) {
10821
10915
  const caseInfo = response.data;
10822
10916
  setCaseData(caseInfo);
@@ -10836,7 +10930,7 @@ var ApprovalWorkflow = ({
10836
10930
  email: v.user_detail?.email || "",
10837
10931
  role: v.user_detail?.phonenumber || "-",
10838
10932
  status: v.answer === "approved" /* APPROVED */ ? "approved" : v.answer === "refused" /* REFUSED */ ? "rejected" : "pending",
10839
- answer: v.answer === "approved" /* APPROVED */ ? 2 : v.answer === "waiting" /* WAITING */ ? 1 : v.answer === "refused" /* REFUSED */ ? -1 : 0,
10933
+ answer: v.answer === "approved" /* APPROVED */ ? 2 : v.answer === "waiting" /* WAITING */ ? 1 : v.answer === "refused" /* REFUSED */ ? -1 : v.answer === "suggest-correction" /* SUGGEST_CORRECTION */ ? -2 : 0,
10840
10934
  rank: v.rank,
10841
10935
  note: v.note
10842
10936
  })));
@@ -10851,7 +10945,7 @@ var ApprovalWorkflow = ({
10851
10945
  email: v.user_detail?.email || "",
10852
10946
  role: v.user_detail?.phonenumber || "-",
10853
10947
  status: v.answer === "approved" /* APPROVED */ ? "approved" : v.answer === "refused" /* REFUSED */ ? "rejected" : "pending",
10854
- answer: v.answer === "approved" /* APPROVED */ ? 2 : v.answer === "waiting" /* WAITING */ ? 1 : v.answer === "refused" /* REFUSED */ ? -1 : 0,
10948
+ answer: v.answer === "approved" /* APPROVED */ ? 2 : v.answer === "waiting" /* WAITING */ ? 1 : v.answer === "refused" /* REFUSED */ ? -1 : v.answer === "suggest-correction" /* SUGGEST_CORRECTION */ ? -2 : 0,
10855
10949
  rank: v.rank,
10856
10950
  note: v.note
10857
10951
  })));
@@ -10926,14 +11020,24 @@ var ApprovalWorkflow = ({
10926
11020
  }
10927
11021
  setTransmitting(true);
10928
11022
  try {
10929
- await handleSave();
10930
- if (caseData?.id) {
10931
- const response = await ApprovalServices.start(caseData.id, token);
11023
+ if (formData.status === "suggest-correction" /* SUGGEST_CORRECTION */ && caseData?.id) {
11024
+ const response = await ApprovalServices.restart(caseData.id, token);
10932
11025
  if (response.success) {
10933
- showSuccess("Demande de validation transmise avec succ\xE8s");
11026
+ showSuccess("Nouvelle version cr\xE9\xE9e et transmise avec succ\xE8s");
10934
11027
  await loadCase();
10935
11028
  } else {
10936
- showError("Erreur lors de la transmission");
11029
+ showError("Erreur lors de la re-transmission");
11030
+ }
11031
+ } else {
11032
+ await handleSave();
11033
+ if (caseData?.id) {
11034
+ const response = await ApprovalServices.start(caseData.id, token);
11035
+ if (response.success) {
11036
+ showSuccess("Demande de validation transmise avec succ\xE8s");
11037
+ await loadCase();
11038
+ } else {
11039
+ showError("Erreur lors de la transmission");
11040
+ }
10937
11041
  }
10938
11042
  }
10939
11043
  } catch (error) {
@@ -11092,64 +11196,37 @@ var ApprovalWorkflow = ({
11092
11196
  switch (activeTab) {
11093
11197
  case "workflow":
11094
11198
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "space-y-6", children: [
11199
+ formData.status === "suggest-correction" /* SUGGEST_CORRECTION */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "p-4 rounded-lg border border-[var(--color-warning)] bg-[var(--color-warning-light)] flex items-start gap-3", children: [
11200
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.Edit, { className: "w-5 h-5 flex-shrink-0 mt-0.5", style: { color: "var(--color-warning)" } }),
11201
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
11202
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm font-medium", style: { color: "var(--color-warning)" }, children: "Une modification a \xE9t\xE9 sugg\xE9r\xE9e sur cette demande" }),
11203
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs text-gray-500 mt-1", children: "Veuillez prendre en compte les commentaires et re-transmettre la demande." })
11204
+ ] })
11205
+ ] }),
11095
11206
  renderStageSection("Verification", verification, setVerification, "verification"),
11096
11207
  renderStageSection("Validation", validation, setValidation, "validation"),
11097
11208
  !readOnly && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between pt-4 border-t border-[#D9D9D9]", children: [
11209
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex gap-3" }),
11098
11210
  /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-3", children: [
11099
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11100
- SecondaryButton,
11101
- {
11102
- onClick: () => window.history.back(),
11103
- type: "button",
11104
- children: "Retour"
11105
- }
11106
- ),
11107
- caseData?.id && formData.status !== "not-send" /* NOT_SEND */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
11108
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
11109
- SecondaryButton,
11110
- {
11111
- onClick: handleCancel,
11112
- disabled: canceling,
11113
- type: "button",
11114
- classname: "flex items-center gap-2",
11115
- children: [
11116
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.Ban, { className: "w-4 h-4" }),
11117
- canceling ? "Annulation..." : "Annuler la demande"
11118
- ]
11119
- }
11120
- ),
11121
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
11122
- SecondaryButton,
11123
- {
11124
- onClick: handleRestart,
11125
- disabled: restarting,
11126
- type: "button",
11127
- classname: "flex items-center gap-2",
11128
- children: [
11129
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.RotateCcw, { className: "w-4 h-4" }),
11130
- restarting ? "Red\xE9marrage..." : "Recommencer"
11131
- ]
11132
- }
11133
- )
11134
- ] })
11135
- ] }),
11136
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-3", children: [
11137
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11211
+ (formData.status === "not-send" /* NOT_SEND */ || formData.status === "suggest-correction" /* SUGGEST_CORRECTION */) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
11138
11212
  Buttons_default,
11139
11213
  {
11140
11214
  onClick: handleSave,
11141
11215
  disabled: saving,
11142
11216
  type: "button",
11143
- children: saving ? "Enregistrement..." : "Enregistrer"
11217
+ children: [
11218
+ " ",
11219
+ saving ? "Enregistrement..." : "Enregistrer"
11220
+ ]
11144
11221
  }
11145
11222
  ),
11146
- formData.status === "not-send" /* NOT_SEND */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11223
+ (formData.status === "not-send" /* NOT_SEND */ || formData.status === "suggest-correction" /* SUGGEST_CORRECTION */) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11147
11224
  Buttons_default,
11148
11225
  {
11149
11226
  onClick: handleTransmit,
11150
11227
  disabled: transmitting || saving,
11151
11228
  type: "button",
11152
- children: transmitting ? "Transmission..." : "Transmettre"
11229
+ children: transmitting ? "Transmission..." : formData.status === "suggest-correction" /* SUGGEST_CORRECTION */ ? "Re-transmettre" : "Transmettre"
11153
11230
  }
11154
11231
  )
11155
11232
  ] })
@@ -11354,71 +11431,81 @@ var StageRow = ({
11354
11431
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex items-center justify-center w-6 h-6 bg-gray-300 rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-white text-xs", children: "\u23F1" }) });
11355
11432
  } else if (answer === -1) {
11356
11433
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex items-center justify-center w-6 h-6 bg-[var(--color-error)] rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-4 h-4 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }) }) });
11434
+ } else if (answer === -2) {
11435
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex items-center justify-center w-6 h-6 bg-[var(--color-warning)] rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.Edit, { className: "w-4 h-4 text-white" }) });
11357
11436
  }
11358
11437
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-gray-400 text-xs", children: "-" });
11359
11438
  };
11360
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("tr", { className: "hover:bg-gray-50", children: [
11361
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2 text-center", children: !readOnly && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11362
- "button",
11363
- {
11364
- type: "button",
11365
- onClick: onRemove,
11366
- className: "text-[#B85450] hover:text-[var(--color-error)] transition-colors",
11367
- title: "Supprimer",
11368
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.Trash2, { className: "w-4 h-4" })
11369
- }
11370
- ) }),
11371
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-4 py-2 text-center", children: index + 1 }),
11372
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11373
- SelectInput,
11374
- {
11375
- value: stage.space_answer,
11376
- onChange: (e) => handleSpaceAnswerChange(e),
11377
- disabled: readOnly,
11378
- options: [
11379
- { value: "internal", label: "Interne" },
11380
- { value: "external", label: "Externe" }
11381
- ]
11382
- }
11383
- ) }),
11384
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: stage.space_answer === "internal" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11385
- SearchableSelect,
11386
- {
11387
- options: userOptions,
11388
- value: stage.user,
11389
- placeholder: "S\xE9lectionner...",
11390
- searchPlaceholder: "Rechercher...",
11391
- onSelect: handleUserSelect,
11392
- disabled: readOnly || loadingUsers,
11393
- filterFunction: userFilterFunction
11394
- }
11395
- ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11396
- TextInput,
11397
- {
11398
- value: stage.name,
11399
- onChange: (e) => onUpdate({ name: e.target.value }),
11400
- disabled: readOnly
11401
- }
11402
- ) }),
11403
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11404
- TextInput,
11405
- {
11406
- type: "email",
11407
- value: stage.email,
11408
- onChange: (e) => onUpdate({ email: e.target.value }),
11409
- disabled: readOnly || stage.space_answer === "internal"
11410
- }
11411
- ) }),
11412
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11413
- "input",
11414
- {
11415
- type: "text",
11416
- value: stage.role,
11417
- disabled: true,
11418
- className: "w-full px-2 py-1 border border-gray-300 rounded text-sm bg-gray-100"
11419
- }
11420
- ) }),
11421
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-4 py-2 text-center", children: getStatusIcon(stage.answer) })
11439
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
11440
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("tr", { className: "hover:bg-gray-50", children: [
11441
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2 text-center", children: !readOnly && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11442
+ "button",
11443
+ {
11444
+ type: "button",
11445
+ onClick: onRemove,
11446
+ className: "text-[#B85450] hover:text-[var(--color-error)] transition-colors",
11447
+ title: "Supprimer",
11448
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.Trash2, { className: "w-4 h-4" })
11449
+ }
11450
+ ) }),
11451
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-4 py-2 text-center", children: index + 1 }),
11452
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11453
+ SelectInput,
11454
+ {
11455
+ value: stage.space_answer,
11456
+ onChange: (e) => handleSpaceAnswerChange(e),
11457
+ disabled: readOnly,
11458
+ options: [
11459
+ { value: "internal", label: "Interne" },
11460
+ { value: "external", label: "Externe" }
11461
+ ]
11462
+ }
11463
+ ) }),
11464
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: stage.space_answer === "internal" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11465
+ SearchableSelect,
11466
+ {
11467
+ options: userOptions,
11468
+ value: stage.user,
11469
+ placeholder: "S\xE9lectionner...",
11470
+ searchPlaceholder: "Rechercher...",
11471
+ onSelect: handleUserSelect,
11472
+ disabled: readOnly || loadingUsers,
11473
+ filterFunction: userFilterFunction
11474
+ }
11475
+ ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11476
+ TextInput,
11477
+ {
11478
+ value: stage.name,
11479
+ onChange: (e) => onUpdate({ name: e.target.value }),
11480
+ disabled: readOnly
11481
+ }
11482
+ ) }),
11483
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11484
+ TextInput,
11485
+ {
11486
+ type: "email",
11487
+ value: stage.email,
11488
+ onChange: (e) => onUpdate({ email: e.target.value }),
11489
+ disabled: readOnly || stage.space_answer === "internal"
11490
+ }
11491
+ ) }),
11492
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11493
+ "input",
11494
+ {
11495
+ type: "text",
11496
+ value: stage.role,
11497
+ disabled: true,
11498
+ className: "w-full px-2 py-1 border border-gray-300 rounded text-sm bg-gray-100"
11499
+ }
11500
+ ) }),
11501
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "border border-gray-300 px-4 py-2 text-center", children: getStatusIcon(stage.answer) })
11502
+ ] }),
11503
+ stage.note && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { colSpan: 7, className: "border border-gray-300 px-4 py-2 bg-[var(--color-warning-light)]", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("p", { className: "text-xs text-gray-600 italic flex items-center gap-1", children: [
11504
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.MessageSquare, { className: "w-3 h-3" }),
11505
+ ' Note : "',
11506
+ stage.note,
11507
+ '"'
11508
+ ] }) }) })
11422
11509
  ] });
11423
11510
  };
11424
11511
  var AddStageButton = ({
@@ -11969,7 +12056,7 @@ var getRole = (a, center_id) => {
11969
12056
  console.log(a.user_detail, center_id);
11970
12057
  return a.user_detail?.centers_access?.find((c) => c.id === center_id)?.fonction ?? "";
11971
12058
  };
11972
- var formatDate2 = (date) => date ? formatDateFR(date) : "-";
12059
+ var formatDate3 = (date) => date ? formatDateFR(date) : "-";
11973
12060
  var borderStyle = { borderColor: "var(--color-border)" };
11974
12061
  var cellClass = "border px-2 py-1";
11975
12062
  var headerStyle = { ...borderStyle, color: "var(--color-text-secondary)" };
@@ -12004,7 +12091,7 @@ var ApprovalRecap = ({ process, object_id }) => {
12004
12091
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tr", { children: [
12005
12092
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: getName(item) }),
12006
12093
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: getRole(item, activeBusinessEntity?.id ?? null) }),
12007
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: formatDate2(item.answered_at) }),
12094
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: formatDate3(item.answered_at) }),
12008
12095
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex items-center gap-1", style: { color: s.color }, children: s.icon }) }),
12009
12096
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle })
12010
12097
  ] }, i);
@@ -12025,7 +12112,7 @@ var ApprovalRecap = ({ process, object_id }) => {
12025
12112
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: "Demand\xE9 par" }),
12026
12113
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: `${requester.first_name} ${requester.last_name}`.trim() }),
12027
12114
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: requester?.centers_access?.find((c) => c.id === activeBusinessEntity?.id)?.fonction ?? "" }),
12028
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: formatDate2(caseData.created_at) }),
12115
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: formatDate3(caseData.created_at) }),
12029
12116
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex items-center gap-1", style: { color: "var(--color-primary)" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react23.CheckCircle, { className: "w-3.5 h-3.5" }) }) }),
12030
12117
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle })
12031
12118
  ] }),
@@ -12747,7 +12834,7 @@ var DetailField = ({ label, value }) => value ? /* @__PURE__ */ (0, import_jsx_r
12747
12834
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: label }),
12748
12835
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: typeof value === "string" || typeof value === "number" ? value : value })
12749
12836
  ] }) : null;
12750
- var formatDate3 = (d) => d ? new Date(d).toLocaleString("fr-FR", { day: "2-digit", month: "long", year: "numeric", hour: "2-digit", minute: "2-digit" }) : "-";
12837
+ var formatDate4 = (d) => d ? new Date(d).toLocaleString("fr-FR", { day: "2-digit", month: "long", year: "numeric", hour: "2-digit", minute: "2-digit" }) : "-";
12751
12838
  var ActivityDetailModal = ({ activity }) => {
12752
12839
  const d = activity.detail;
12753
12840
  if (!d) return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Aucun d\xE9tail disponible." });
@@ -12770,7 +12857,7 @@ var ActivityDetailModal = ({ activity }) => {
12770
12857
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Adresse de livraison", value: d.delivery_address }),
12771
12858
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Contact livraison", value: d.delivery_contact }),
12772
12859
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "T\xE9l. livraison", value: d.delivery_phone }),
12773
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Cr\xE9\xE9 le", value: formatDate3(d.created_at) }),
12860
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Cr\xE9\xE9 le", value: formatDate4(d.created_at) }),
12774
12861
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Commentaires", value: d.comments })
12775
12862
  ] }),
12776
12863
  d.items?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { children: [
@@ -12825,7 +12912,7 @@ var ActivityDetailModal = ({ activity }) => {
12825
12912
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Prix final", value: d.final_price ? `${d.final_price.toLocaleString("fr-FR")} FCFA` : void 0 }),
12826
12913
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Remise", value: d.global_discount ? `${d.global_discount}${d.global_discount_type === "percentage" ? "%" : " FCFA"}` : void 0 }),
12827
12914
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Observations", value: d.observations }),
12828
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Cr\xE9\xE9 le", value: formatDate3(d.created_at) })
12915
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Cr\xE9\xE9 le", value: formatDate4(d.created_at) })
12829
12916
  ] }),
12830
12917
  d.items?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { children: [
12831
12918
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("h4", { className: "text-sm font-semibold text-[var(--color-text-primary)] mb-2", children: [
@@ -12872,9 +12959,9 @@ var ActivityDetailModal = ({ activity }) => {
12872
12959
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-4 bg-[var(--color-surface-hover)] rounded-lg p-4", children: [
12873
12960
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Type de r\xE9ception", value: d.type_of_receipt }),
12874
12961
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Adresse de r\xE9ception", value: d.receipt_address }),
12875
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Date de r\xE9ception", value: formatDate3(d.received_at) }),
12962
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Date de r\xE9ception", value: formatDate4(d.received_at) }),
12876
12963
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Commentaires", value: d.comments }),
12877
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Cr\xE9\xE9 le", value: formatDate3(d.created_at) })
12964
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DetailField, { label: "Cr\xE9\xE9 le", value: formatDate4(d.created_at) })
12878
12965
  ] }),
12879
12966
  d.items?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { children: [
12880
12967
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("h4", { className: "text-sm font-semibold text-[var(--color-text-primary)] mb-2", children: [
@@ -18542,7 +18629,7 @@ var TaskPilot = () => {
18542
18629
  };
18543
18630
  var TaskPilot_default = TaskPilot;
18544
18631
 
18545
- // src/components/purchase-request/PurchaseRequestsPage.tsx
18632
+ // src/components/purchase-request/ProcuLink.tsx
18546
18633
  var import_react43 = require("react");
18547
18634
  var import_lucide_react35 = require("lucide-react");
18548
18635
 
@@ -19109,7 +19196,7 @@ var FormPurchaseRequest = ({
19109
19196
  const { success, error: showError } = useToast();
19110
19197
  const [showCatalogueSelector, setShowCatalogueSelector] = (0, import_react42.useState)(false);
19111
19198
  const [budgetInfo, setBudgetInfo] = (0, import_react42.useState)({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
19112
- const readonly = false;
19199
+ const readonly = object ? object.status !== "draft" : false;
19113
19200
  const fetchDepartmentBudget = async (departmentId) => {
19114
19201
  if (!departmentId) {
19115
19202
  setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
@@ -19682,7 +19769,7 @@ var FormPurchaseRequest = ({
19682
19769
  PrimaryButton,
19683
19770
  {
19684
19771
  type: "submit",
19685
- disabled: loading,
19772
+ disabled: loading || readonly,
19686
19773
  children: loading ? "chargement..." : "Enregistrer"
19687
19774
  }
19688
19775
  )
@@ -19897,7 +19984,7 @@ var PrintablePurchaseRequest = ({
19897
19984
  ] });
19898
19985
  };
19899
19986
 
19900
- // src/components/purchase-request/PurchaseRequestsPage.tsx
19987
+ // src/components/purchase-request/ProcuLink.tsx
19901
19988
  var import_jsx_runtime60 = require("react/jsx-runtime");
19902
19989
  var PurchaseRequestsPage = () => {
19903
19990
  const [refreshToggle, setRefreshToggle] = (0, import_react43.useState)(false);
@@ -19905,7 +19992,7 @@ var PurchaseRequestsPage = () => {
19905
19992
  const [showPrintPreview, setShowPrintPreview] = (0, import_react43.useState)(false);
19906
19993
  const [selectedPurchaseRequest, setSelectedPurchaseRequest] = (0, import_react43.useState)(null);
19907
19994
  const { success, error: showError, confirm: confirm2 } = useToast();
19908
- const { activeBusinessEntity } = useSession();
19995
+ const { activeBusinessEntity, loggedUser } = useSession();
19909
19996
  (0, import_react43.useEffect)(() => {
19910
19997
  }, []);
19911
19998
  const loadPurchaseRequests = async () => {
@@ -20017,7 +20104,7 @@ var PurchaseRequestsPage = () => {
20017
20104
  process: "PCR-PR",
20018
20105
  object_id: item.id,
20019
20106
  CustomBtn: (props) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Buttons_default, { className: "rounded-[6px] bg-gray-500 p-1 text-white", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react35.ClipboardCheck, {}) }),
20020
- readOnly: false
20107
+ readOnly: loggedUser?.id !== item.created_by
20021
20108
  }
20022
20109
  );
20023
20110
  }
@@ -27606,7 +27693,7 @@ var ViewContractContent = ({
27606
27693
  };
27607
27694
  }, [contract]);
27608
27695
  if (!contract) return null;
27609
- const formatDate4 = (dateString) => {
27696
+ const formatDate5 = (dateString) => {
27610
27697
  if (!dateString) return "Non d\xE9fini";
27611
27698
  return new Date(dateString).toLocaleDateString("fr-FR");
27612
27699
  };
@@ -27885,19 +27972,19 @@ var ViewContractContent = ({
27885
27972
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("dl", { className: "space-y-3", children: [
27886
27973
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
27887
27974
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "Date de cr\xE9ation" }),
27888
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate4(contract.created_at || contract.created_at) })
27975
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate5(contract.created_at || contract.created_at) })
27889
27976
  ] }),
27890
27977
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
27891
27978
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "Date de signature" }),
27892
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate4(contract.signature_date || "") })
27979
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate5(contract.signature_date || "") })
27893
27980
  ] }),
27894
27981
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
27895
27982
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "D\xE9but" }),
27896
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate4(contract.start_date) })
27983
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate5(contract.start_date) })
27897
27984
  ] }),
27898
27985
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
27899
27986
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "Fin" }),
27900
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900 font-medium", children: formatDate4(contract.end_date) })
27987
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900 font-medium", children: formatDate5(contract.end_date) })
27901
27988
  ] }),
27902
27989
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
27903
27990
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "Pr\xE9avis de r\xE9siliation" }),
@@ -28015,11 +28102,11 @@ var ViewContractContent = ({
28015
28102
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: [
28016
28103
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg", children: [
28017
28104
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-sm font-medium text-[var(--color-success)]", children: "Date de d\xE9but" }),
28018
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xl font-bold text-gray-900 mt-1", children: formatDate4(contract.start_date) })
28105
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xl font-bold text-gray-900 mt-1", children: formatDate5(contract.start_date) })
28019
28106
  ] }),
28020
28107
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg", children: [
28021
28108
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-sm font-medium text-[var(--color-error)]", children: "Date de fin" }),
28022
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xl font-bold text-gray-900 mt-1", children: formatDate4(contract.end_date) })
28109
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xl font-bold text-gray-900 mt-1", children: formatDate5(contract.end_date) })
28023
28110
  ] }),
28024
28111
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg", children: [
28025
28112
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-sm font-medium text-[var(--color-info)]", children: "Jours restants" }),
@@ -28052,7 +28139,7 @@ var ViewContractContent = ({
28052
28139
  ] }),
28053
28140
  contract.renewal_date && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
28054
28141
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "Date de renouvellement" }),
28055
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate4(contract.renewal_date) })
28142
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-sm text-gray-900", children: formatDate5(contract.renewal_date) })
28056
28143
  ] }),
28057
28144
  contract.duration && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
28058
28145
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-sm font-medium text-gray-500", children: "Dur\xE9e" }),
@@ -28193,7 +28280,7 @@ var ViewContractContent = ({
28193
28280
  milestone.percentage,
28194
28281
  "%"
28195
28282
  ] }),
28196
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("td", { className: "py-3 text-center", children: formatDate4(milestone.dueDate) }),
28283
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("td", { className: "py-3 text-center", children: formatDate5(milestone.dueDate) }),
28197
28284
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("td", { className: "py-3 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Badge2, { variant: milestone.status === "paid" ? "success" : milestone.status === "overdue" ? "error" : milestone.status === "invoiced" ? "warning" : "default", children: milestone.status === "paid" ? "Pay\xE9" : milestone.status === "overdue" ? "En retard" : milestone.status === "invoiced" ? "Factur\xE9" : "En attente" }) })
28198
28285
  ] }, milestone.id)) })
28199
28286
  ] }) })
@@ -28462,11 +28549,11 @@ var ViewContractContent = ({
28462
28549
  ] }),
28463
28550
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { children: [
28464
28551
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-gray-500", children: "Date d'\xE9mission" }),
28465
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "font-medium", children: formatDate4(guarantee.issueDate) })
28552
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "font-medium", children: formatDate5(guarantee.issueDate) })
28466
28553
  ] }),
28467
28554
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { children: [
28468
28555
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-gray-500", children: "Date d'expiration" }),
28469
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: `font-medium ${new Date(guarantee.expiryDate) < /* @__PURE__ */ new Date() ? "text-[var(--color-error)]" : ""}`, children: formatDate4(guarantee.expiryDate) })
28556
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: `font-medium ${new Date(guarantee.expiryDate) < /* @__PURE__ */ new Date() ? "text-[var(--color-error)]" : ""}`, children: formatDate5(guarantee.expiryDate) })
28470
28557
  ] })
28471
28558
  ] }),
28472
28559
  guarantee.releaseConditions && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "mt-3 p-3 bg-gray-50 rounded-lg", children: [
@@ -28506,7 +28593,7 @@ var ViewContractContent = ({
28506
28593
  ] }),
28507
28594
  insurance.validUntil && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { children: [
28508
28595
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-gray-500", children: "Valide jusqu'au" }),
28509
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: `font-medium ${new Date(insurance.validUntil) < /* @__PURE__ */ new Date() ? "text-[var(--color-error)]" : ""}`, children: formatDate4(insurance.validUntil) })
28596
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: `font-medium ${new Date(insurance.validUntil) < /* @__PURE__ */ new Date() ? "text-[var(--color-error)]" : ""}`, children: formatDate5(insurance.validUntil) })
28510
28597
  ] })
28511
28598
  ] })
28512
28599
  ] }, insurance.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "text-center py-8 text-gray-500", children: [
@@ -28577,7 +28664,7 @@ var ViewContractContent = ({
28577
28664
  ] }),
28578
28665
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "text-right", children: [
28579
28666
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Badge2, { variant: approver.status === "approved" ? "success" : approver.status === "rejected" ? "error" : "default", children: approver.status === "approved" ? "Approuv\xE9" : approver.status === "rejected" ? "Rejet\xE9" : "En attente" }),
28580
- approver.approvalDate && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xs text-gray-500 mt-1", children: formatDate4(approver.approvalDate) })
28667
+ approver.approvalDate && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-xs text-gray-500 mt-1", children: formatDate5(approver.approvalDate) })
28581
28668
  ] })
28582
28669
  ] }, index)) })
28583
28670
  ] }),
@@ -28631,11 +28718,11 @@ var ViewContractContent = ({
28631
28718
  ] }),
28632
28719
  contract.governance.steeringCommittee.lastMeetingDate && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
28633
28720
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-gray-500", children: "Derni\xE8re r\xE9union" }),
28634
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-gray-900", children: formatDate4(contract.governance.steeringCommittee.lastMeetingDate) })
28721
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-gray-900", children: formatDate5(contract.governance.steeringCommittee.lastMeetingDate) })
28635
28722
  ] }),
28636
28723
  contract.governance.steeringCommittee.nextMeetingDate && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex justify-between", children: [
28637
28724
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "text-gray-500", children: "Prochaine r\xE9union" }),
28638
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-gray-900 font-medium", children: formatDate4(contract.governance.steeringCommittee.nextMeetingDate) })
28725
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: "text-gray-900 font-medium", children: formatDate5(contract.governance.steeringCommittee.nextMeetingDate) })
28639
28726
  ] })
28640
28727
  ] })
28641
28728
  ] })
@@ -28708,7 +28795,7 @@ var ViewContractContent = ({
28708
28795
  ] }),
28709
28796
  contract.regulatoryCompliance.sanctionsScreening?.lastScreeningDate && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("p", { className: "text-sm text-gray-500", children: [
28710
28797
  "Dernier contr\xF4le: ",
28711
- formatDate4(contract.regulatoryCompliance.sanctionsScreening.lastScreeningDate)
28798
+ formatDate5(contract.regulatoryCompliance.sanctionsScreening.lastScreeningDate)
28712
28799
  ] })
28713
28800
  ] })
28714
28801
  ] })
@@ -28764,7 +28851,7 @@ var ViewContractContent = ({
28764
28851
  ] }),
28765
28852
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("p", { className: "text-xs text-[var(--color-success)] mt-1", children: [
28766
28853
  "\xC9valu\xE9 le ",
28767
- formatDate4(contract.esgCriteria.lastAssessmentDate)
28854
+ formatDate5(contract.esgCriteria.lastAssessmentDate)
28768
28855
  ] })
28769
28856
  ] }),
28770
28857
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(RewiseCard, { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex items-center space-x-3", children: [
@@ -28935,7 +29022,7 @@ var ViewContractContent = ({
28935
29022
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { children: "\u2022" }),
28936
29023
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { children: [
28937
29024
  "\xC9ch\xE9ance: ",
28938
- formatDate4(obligation.dueDate)
29025
+ formatDate5(obligation.dueDate)
28939
29026
  ] })
28940
29027
  ] }),
28941
29028
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { children: "\u2022" }),
@@ -29001,7 +29088,7 @@ var ViewContractContent = ({
29001
29088
  ] }),
29002
29089
  sla.last_evaluation && /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("span", { children: [
29003
29090
  "Derni\xE8re mesure: ",
29004
- formatDate4(sla.last_evaluation)
29091
+ formatDate5(sla.last_evaluation)
29005
29092
  ] })
29006
29093
  ] })
29007
29094
  ] }, sla.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(RewiseCard, { className: "p-8 text-center", children: [
@@ -29212,7 +29299,7 @@ var ViewContractContent = ({
29212
29299
  " MB \u2022 Version ",
29213
29300
  doc.version,
29214
29301
  " \u2022 Ajout\xE9 le ",
29215
- formatDate4(doc.uploadedAt)
29302
+ formatDate5(doc.uploadedAt)
29216
29303
  ] }),
29217
29304
  doc.description && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-sm text-gray-600 mt-1", children: doc.description })
29218
29305
  ] })
@@ -29243,7 +29330,7 @@ var ViewContractContent = ({
29243
29330
  ] }),
29244
29331
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "text-sm text-gray-600 mb-2", children: amendment.description }),
29245
29332
  /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("p", { className: "text-xs text-gray-500", children: [
29246
- formatDate4(amendment.date),
29333
+ formatDate5(amendment.date),
29247
29334
  " \u2022 Raison: ",
29248
29335
  amendment.reason
29249
29336
  ] })
@@ -29341,7 +29428,7 @@ var ViewContractContent = ({
29341
29428
  "Ce contrat expire dans ",
29342
29429
  daysUntilExpiry,
29343
29430
  " jours (",
29344
- formatDate4(contract.end_date),
29431
+ formatDate5(contract.end_date),
29345
29432
  ")"
29346
29433
  ] })
29347
29434
  ] }),
@@ -33622,7 +33709,7 @@ var SLAManagementModal = ({
33622
33709
  onShowToast("Indicateur SLA supprim\xE9", "success");
33623
33710
  }
33624
33711
  };
33625
- const formatDate4 = (dateString) => {
33712
+ const formatDate5 = (dateString) => {
33626
33713
  if (!dateString) return "N/A";
33627
33714
  return new Date(dateString).toLocaleDateString("fr-FR");
33628
33715
  };
@@ -34136,7 +34223,7 @@ var SLAManagementModal = ({
34136
34223
  ] }),
34137
34224
  /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("p", { className: "text-xs mt-1", style: { color: colors.text.tertiary }, children: [
34138
34225
  "D\xE9tect\xE9 le ",
34139
- formatDate4(incident.detected_date)
34226
+ formatDate5(incident.detected_date)
34140
34227
  ] })
34141
34228
  ] })
34142
34229
  ] }),