ptechcore_ui 1.0.78 → 1.0.79

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
@@ -1209,19 +1209,27 @@ var FetchApi = class {
1209
1209
  }
1210
1210
  body = payload;
1211
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);
1212
+ const hasFile = Object.values(payload).some((v) => v instanceof File || v instanceof Blob);
1213
+ if (hasFile) {
1214
+ const formData = new FormData();
1215
+ Object.entries(payload).forEach(([key, value]) => {
1216
+ if (value instanceof File || value instanceof Blob) {
1217
+ formData.append(key, value);
1218
+ } else if (Array.isArray(value)) {
1219
+ formData.append(key, JSON.stringify(value));
1220
+ } else if (value !== null && value !== void 0) {
1221
+ formData.append(key, String(value));
1222
+ }
1223
+ });
1224
+ if (business_entity_id) {
1225
+ formData.append("business_entity_id", business_entity_id);
1226
+ formData.append("business_entity", business_entity_id);
1218
1227
  }
1219
- });
1220
- if (business_entity_id) {
1221
- formData.append("business_entity_id", business_entity_id);
1222
- formData.append("business_entity", business_entity_id);
1228
+ body = formData;
1229
+ } else {
1230
+ headers["Content-Type"] = "application/json";
1231
+ body = JSON.stringify({ ...payload, business_entity_id, business_entity: business_entity_id });
1223
1232
  }
1224
- body = formData;
1225
1233
  }
1226
1234
  const res = await fetch(url, {
1227
1235
  method: "POST",
@@ -1246,19 +1254,27 @@ var FetchApi = class {
1246
1254
  }
1247
1255
  body = payload;
1248
1256
  } 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);
1257
+ const hasFile = Object.values(payload).some((v) => v instanceof File || v instanceof Blob);
1258
+ if (hasFile) {
1259
+ const formData = new FormData();
1260
+ Object.entries(payload).forEach(([key, value]) => {
1261
+ if (value instanceof File || value instanceof Blob) {
1262
+ formData.append(key, value);
1263
+ } else if (Array.isArray(value)) {
1264
+ formData.append(key, JSON.stringify(value));
1265
+ } else if (value !== null && value !== void 0) {
1266
+ formData.append(key, String(value));
1267
+ }
1268
+ });
1269
+ if (business_entity_id) {
1270
+ formData.append("business_entity_id", business_entity_id);
1271
+ formData.append("business_entity", business_entity_id);
1255
1272
  }
1256
- });
1257
- if (business_entity_id) {
1258
- formData.append("business_entity_id", business_entity_id);
1259
- formData.append("business_entity", business_entity_id);
1273
+ body = formData;
1274
+ } else {
1275
+ headers["Content-Type"] = "application/json";
1276
+ body = JSON.stringify({ ...payload, business_entity_id, business_entity: business_entity_id });
1260
1277
  }
1261
- body = formData;
1262
1278
  }
1263
1279
  const res = await fetch(url, {
1264
1280
  method: "PUT",
package/dist/index.js CHANGED
@@ -1017,19 +1017,27 @@ var FetchApi = class {
1017
1017
  }
1018
1018
  body = payload;
1019
1019
  } else if (payload) {
1020
- const formData = new FormData();
1021
- Object.entries(payload).forEach(([key, value]) => {
1022
- if (Array.isArray(value)) {
1023
- formData.append(key, value.join(","));
1024
- } else if (value !== null && value !== void 0) {
1025
- formData.append(key, value);
1020
+ const hasFile = Object.values(payload).some((v) => v instanceof File || v instanceof Blob);
1021
+ if (hasFile) {
1022
+ const formData = new FormData();
1023
+ Object.entries(payload).forEach(([key, value]) => {
1024
+ if (value instanceof File || value instanceof Blob) {
1025
+ formData.append(key, value);
1026
+ } else if (Array.isArray(value)) {
1027
+ formData.append(key, JSON.stringify(value));
1028
+ } else if (value !== null && value !== void 0) {
1029
+ formData.append(key, String(value));
1030
+ }
1031
+ });
1032
+ if (business_entity_id) {
1033
+ formData.append("business_entity_id", business_entity_id);
1034
+ formData.append("business_entity", business_entity_id);
1026
1035
  }
1027
- });
1028
- if (business_entity_id) {
1029
- formData.append("business_entity_id", business_entity_id);
1030
- formData.append("business_entity", business_entity_id);
1036
+ body = formData;
1037
+ } else {
1038
+ headers["Content-Type"] = "application/json";
1039
+ body = JSON.stringify({ ...payload, business_entity_id, business_entity: business_entity_id });
1031
1040
  }
1032
- body = formData;
1033
1041
  }
1034
1042
  const res = await fetch(url, {
1035
1043
  method: "POST",
@@ -1054,19 +1062,27 @@ var FetchApi = class {
1054
1062
  }
1055
1063
  body = payload;
1056
1064
  } else if (payload) {
1057
- const formData = new FormData();
1058
- Object.entries(payload).forEach(([key, value]) => {
1059
- if (Array.isArray(value)) {
1060
- formData.append(key, value.join(","));
1061
- } else if (value !== null && value !== void 0) {
1062
- formData.append(key, value);
1065
+ const hasFile = Object.values(payload).some((v) => v instanceof File || v instanceof Blob);
1066
+ if (hasFile) {
1067
+ const formData = new FormData();
1068
+ Object.entries(payload).forEach(([key, value]) => {
1069
+ if (value instanceof File || value instanceof Blob) {
1070
+ formData.append(key, value);
1071
+ } else if (Array.isArray(value)) {
1072
+ formData.append(key, JSON.stringify(value));
1073
+ } else if (value !== null && value !== void 0) {
1074
+ formData.append(key, String(value));
1075
+ }
1076
+ });
1077
+ if (business_entity_id) {
1078
+ formData.append("business_entity_id", business_entity_id);
1079
+ formData.append("business_entity", business_entity_id);
1063
1080
  }
1064
- });
1065
- if (business_entity_id) {
1066
- formData.append("business_entity_id", business_entity_id);
1067
- formData.append("business_entity", business_entity_id);
1081
+ body = formData;
1082
+ } else {
1083
+ headers["Content-Type"] = "application/json";
1084
+ body = JSON.stringify({ ...payload, business_entity_id, business_entity: business_entity_id });
1068
1085
  }
1069
- body = formData;
1070
1086
  }
1071
1087
  const res = await fetch(url, {
1072
1088
  method: "PUT",
@@ -6972,7 +6988,7 @@ import { useState as useState14, useRef as useRef4, useEffect as useEffect10 } f
6972
6988
  import {
6973
6989
  Folder as Folder2,
6974
6990
  FolderOpen as FolderOpen2,
6975
- File,
6991
+ File as File2,
6976
6992
  FileText as FileText2,
6977
6993
  FileImage,
6978
6994
  FileSpreadsheet as FileSpreadsheet2,
@@ -6988,7 +7004,7 @@ var getFileIcon = (mimeType, isFolder, isOpen) => {
6988
7004
  return isOpen ? FolderOpen2 : Folder2;
6989
7005
  }
6990
7006
  if (!mimeType) {
6991
- return File;
7007
+ return File2;
6992
7008
  }
6993
7009
  const type = mimeType.toLowerCase();
6994
7010
  if (type.startsWith("image/")) {
@@ -7021,7 +7037,7 @@ var getFileIcon = (mimeType, isFolder, isOpen) => {
7021
7037
  if (type.startsWith("text/")) {
7022
7038
  return FileText2;
7023
7039
  }
7024
- return File;
7040
+ return File2;
7025
7041
  };
7026
7042
  var getFileIconColor = (mimeType, isFolder) => {
7027
7043
  if (isFolder) {
@@ -9478,7 +9494,7 @@ import {
9478
9494
  MapPin,
9479
9495
  FileText as FileText4,
9480
9496
  CreditCard,
9481
- File as File2
9497
+ File as File3
9482
9498
  } from "lucide-react";
9483
9499
  import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
9484
9500
  var FormVendor = ({
@@ -9588,7 +9604,7 @@ var FormVendor = ({
9588
9604
  { id: "representative", label: "Repr\xE9sentant", icon: FileText4 },
9589
9605
  { id: "accounting", label: "Comptabilit\xE9", icon: FileText4 },
9590
9606
  { id: "banking", label: "Bancaire", icon: CreditCard },
9591
- { id: "attachment", label: "Fichiers", icon: File2 }
9607
+ { id: "attachment", label: "Fichiers", icon: File3 }
9592
9608
  ];
9593
9609
  const renderTabContent = () => {
9594
9610
  switch (activeTab) {
@@ -9973,7 +9989,7 @@ var FormVendor = ({
9973
9989
  case "attachment":
9974
9990
  if (!object?.id) {
9975
9991
  return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col items-center justify-center py-12 text-gray-500", children: [
9976
- /* @__PURE__ */ jsx30(File2, { className: "w-12 h-12 mb-4 text-gray-400" }),
9992
+ /* @__PURE__ */ jsx30(File3, { className: "w-12 h-12 mb-4 text-gray-400" }),
9977
9993
  /* @__PURE__ */ jsx30("p", { className: "text-lg font-medium", children: "Fichiers non disponibles" }),
9978
9994
  /* @__PURE__ */ jsx30("p", { className: "text-sm mt-2", children: "Enregistrez d'abord le fournisseur pour pouvoir ajouter des fichiers." })
9979
9995
  ] });
@@ -20346,7 +20362,7 @@ import { Fragment as Fragment14, jsx as jsx72, jsxs as jsxs65 } from "react/jsx-
20346
20362
  // src/pages/organizations/DetailEntity.tsx
20347
20363
  import { useState as useState49, useEffect as useEffect37 } from "react";
20348
20364
  import { useNavigate as useNavigate12, useParams as useParams4 } from "react-router-dom";
20349
- import { Building2 as Building210, CreditCard as CreditCard6, FileText as FileText15, MapPin as MapPin9, User as UserIcon4, File as File3 } from "lucide-react";
20365
+ import { Building2 as Building210, CreditCard as CreditCard6, FileText as FileText15, MapPin as MapPin9, User as UserIcon4, File as File4 } from "lucide-react";
20350
20366
 
20351
20367
  // src/forms/UserForm.tsx
20352
20368
  import { useState as useState48, useEffect as useEffect36 } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptechcore_ui",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",