ptechcore_ui 1.0.29 → 1.0.30
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 +428 -7
- package/dist/index.d.cts +164 -1
- package/dist/index.d.ts +164 -1
- package/dist/index.js +416 -7
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -828,6 +828,7 @@ var AuthServices = {
|
|
|
828
828
|
addUser: (payload) => FetchApi.post(`${API_BASE_URL}add-user/`, payload),
|
|
829
829
|
login: (payload) => FetchApi.post(`${API_BASE_URL}login/`, payload),
|
|
830
830
|
getUserInformations: (token) => FetchApi.get(`${API_BASE_URL}user-informations/`, token),
|
|
831
|
+
getUserInformationsByOldId: (id) => FetchApi.get(`${API_BASE_URL}user-informations-by-old-id/${id}/`),
|
|
831
832
|
logout: () => FetchApi.post(`${API_BASE_URL}logout/`)
|
|
832
833
|
};
|
|
833
834
|
|
|
@@ -871,13 +872,31 @@ var SessionProvider = ({ children }) => {
|
|
|
871
872
|
const [isLoading, setIsLoading] = useState2(true);
|
|
872
873
|
const [showAuthModal, setShowAuthModal] = useState2(false);
|
|
873
874
|
useEffect2(() => {
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
875
|
+
const initializeSession = async () => {
|
|
876
|
+
const params = new URLSearchParams(window.location.search);
|
|
877
|
+
const tkn = params.get("tkn");
|
|
878
|
+
if (tkn) {
|
|
879
|
+
localStorage.setItem("token", tkn);
|
|
880
|
+
setToken(tkn);
|
|
881
|
+
window.history.replaceState({}, document.title, window.location.pathname);
|
|
882
|
+
}
|
|
883
|
+
const old_rewise_user_id = params.get("rewise_user_id");
|
|
884
|
+
if (old_rewise_user_id) {
|
|
885
|
+
try {
|
|
886
|
+
const res = await AuthServices.getUserInformationsByOldId(parseInt(old_rewise_user_id));
|
|
887
|
+
const result = res;
|
|
888
|
+
if (result.success === true) {
|
|
889
|
+
setLoggedUser(result.data.user);
|
|
890
|
+
setActiveBusinessEntity(
|
|
891
|
+
result.data.user.centers_access.find((item) => parseInt(String(item.id)) === parseInt(saved_center_id)) || result.data.user.centers_access[0] || null
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
} catch (error) {
|
|
895
|
+
console.error("Failed to refresh session:", error);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
initializeSession();
|
|
881
900
|
}, []);
|
|
882
901
|
const [vendors, setVendors] = useState2(() => {
|
|
883
902
|
const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
|
|
@@ -8321,6 +8340,384 @@ var EntityFileManager = ({
|
|
|
8321
8340
|
}
|
|
8322
8341
|
) });
|
|
8323
8342
|
};
|
|
8343
|
+
|
|
8344
|
+
// src/components/common/PrintPreview.tsx
|
|
8345
|
+
import React20, { useRef as useRef6 } from "react";
|
|
8346
|
+
import { useReactToPrint } from "react-to-print";
|
|
8347
|
+
import { X as X10, Printer as Printer2, Download as Download4, ZoomIn, ZoomOut } from "lucide-react";
|
|
8348
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8349
|
+
var PrintableDocument = ({
|
|
8350
|
+
children,
|
|
8351
|
+
className = "",
|
|
8352
|
+
style = {}
|
|
8353
|
+
}) => {
|
|
8354
|
+
return /* @__PURE__ */ jsx30(
|
|
8355
|
+
"div",
|
|
8356
|
+
{
|
|
8357
|
+
className: `bg-white text-gray-900 ${className}`,
|
|
8358
|
+
style: {
|
|
8359
|
+
fontFamily: "Arial, sans-serif",
|
|
8360
|
+
fontSize: "11px",
|
|
8361
|
+
...style
|
|
8362
|
+
},
|
|
8363
|
+
children
|
|
8364
|
+
}
|
|
8365
|
+
);
|
|
8366
|
+
};
|
|
8367
|
+
var PrintPreview = ({
|
|
8368
|
+
children,
|
|
8369
|
+
isOpen,
|
|
8370
|
+
onClose,
|
|
8371
|
+
title = "Aper\xE7u avant impression",
|
|
8372
|
+
documentName = "document",
|
|
8373
|
+
pageWidth = "210mm",
|
|
8374
|
+
pageMinHeight = "297mm",
|
|
8375
|
+
orientation = "portrait",
|
|
8376
|
+
onAfterPrint,
|
|
8377
|
+
onBeforePrint
|
|
8378
|
+
}) => {
|
|
8379
|
+
const printRef = useRef6(null);
|
|
8380
|
+
const [zoom, setZoom] = React20.useState(100);
|
|
8381
|
+
const handlePrint = useReactToPrint({
|
|
8382
|
+
contentRef: printRef,
|
|
8383
|
+
documentTitle: documentName,
|
|
8384
|
+
onAfterPrint: () => {
|
|
8385
|
+
onAfterPrint?.();
|
|
8386
|
+
},
|
|
8387
|
+
onBeforePrint
|
|
8388
|
+
});
|
|
8389
|
+
const handleZoomIn = () => {
|
|
8390
|
+
setZoom((prev) => Math.min(prev + 10, 150));
|
|
8391
|
+
};
|
|
8392
|
+
const handleZoomOut = () => {
|
|
8393
|
+
setZoom((prev) => Math.max(prev - 10, 50));
|
|
8394
|
+
};
|
|
8395
|
+
if (!isOpen) return null;
|
|
8396
|
+
const pageStyles = {
|
|
8397
|
+
width: orientation === "portrait" ? pageWidth : pageMinHeight,
|
|
8398
|
+
minHeight: orientation === "portrait" ? pageMinHeight : pageWidth,
|
|
8399
|
+
transform: `scale(${zoom / 100})`,
|
|
8400
|
+
transformOrigin: "top center",
|
|
8401
|
+
transition: "transform 0.2s ease"
|
|
8402
|
+
};
|
|
8403
|
+
return /* @__PURE__ */ jsxs25("div", { className: "fixed inset-0 z-50 overflow-hidden print:hidden", children: [
|
|
8404
|
+
/* @__PURE__ */ jsx30(
|
|
8405
|
+
"div",
|
|
8406
|
+
{
|
|
8407
|
+
className: "absolute inset-0 bg-black/50 backdrop-blur-sm",
|
|
8408
|
+
onClick: onClose
|
|
8409
|
+
}
|
|
8410
|
+
),
|
|
8411
|
+
/* @__PURE__ */ jsxs25("div", { className: "relative h-full flex flex-col", children: [
|
|
8412
|
+
/* @__PURE__ */ jsxs25("div", { className: "bg-white border-b shadow-sm px-6 py-3 flex items-center justify-between z-10", children: [
|
|
8413
|
+
/* @__PURE__ */ jsx30("h3", { className: "text-lg font-semibold text-gray-900", children: title }),
|
|
8414
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-3", children: [
|
|
8415
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1 bg-gray-100 rounded-lg px-2 py-1", children: [
|
|
8416
|
+
/* @__PURE__ */ jsx30(
|
|
8417
|
+
"button",
|
|
8418
|
+
{
|
|
8419
|
+
onClick: handleZoomOut,
|
|
8420
|
+
className: "p-1 hover:bg-gray-200 rounded transition-colors",
|
|
8421
|
+
title: "Zoom arri\xE8re",
|
|
8422
|
+
children: /* @__PURE__ */ jsx30(ZoomOut, { className: "w-4 h-4 text-gray-600" })
|
|
8423
|
+
}
|
|
8424
|
+
),
|
|
8425
|
+
/* @__PURE__ */ jsxs25("span", { className: "text-sm text-gray-600 min-w-[3rem] text-center", children: [
|
|
8426
|
+
zoom,
|
|
8427
|
+
"%"
|
|
8428
|
+
] }),
|
|
8429
|
+
/* @__PURE__ */ jsx30(
|
|
8430
|
+
"button",
|
|
8431
|
+
{
|
|
8432
|
+
onClick: handleZoomIn,
|
|
8433
|
+
className: "p-1 hover:bg-gray-200 rounded transition-colors",
|
|
8434
|
+
title: "Zoom avant",
|
|
8435
|
+
children: /* @__PURE__ */ jsx30(ZoomIn, { className: "w-4 h-4 text-gray-600" })
|
|
8436
|
+
}
|
|
8437
|
+
)
|
|
8438
|
+
] }),
|
|
8439
|
+
/* @__PURE__ */ jsxs25(
|
|
8440
|
+
"button",
|
|
8441
|
+
{
|
|
8442
|
+
onClick: () => handlePrint(),
|
|
8443
|
+
className: "px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 transition-colors flex items-center gap-2",
|
|
8444
|
+
children: [
|
|
8445
|
+
/* @__PURE__ */ jsx30(Printer2, { className: "w-4 h-4" }),
|
|
8446
|
+
"Imprimer"
|
|
8447
|
+
]
|
|
8448
|
+
}
|
|
8449
|
+
),
|
|
8450
|
+
/* @__PURE__ */ jsxs25(
|
|
8451
|
+
"button",
|
|
8452
|
+
{
|
|
8453
|
+
onClick: () => handlePrint(),
|
|
8454
|
+
className: "px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-lg hover:bg-green-700 transition-colors flex items-center gap-2",
|
|
8455
|
+
children: [
|
|
8456
|
+
/* @__PURE__ */ jsx30(Download4, { className: "w-4 h-4" }),
|
|
8457
|
+
"PDF"
|
|
8458
|
+
]
|
|
8459
|
+
}
|
|
8460
|
+
),
|
|
8461
|
+
/* @__PURE__ */ jsx30(
|
|
8462
|
+
"button",
|
|
8463
|
+
{
|
|
8464
|
+
onClick: onClose,
|
|
8465
|
+
className: "p-2 hover:bg-gray-100 rounded-full transition-colors",
|
|
8466
|
+
title: "Fermer",
|
|
8467
|
+
children: /* @__PURE__ */ jsx30(X10, { className: "w-5 h-5 text-gray-500" })
|
|
8468
|
+
}
|
|
8469
|
+
)
|
|
8470
|
+
] })
|
|
8471
|
+
] }),
|
|
8472
|
+
/* @__PURE__ */ jsx30("div", { className: "flex-1 overflow-auto bg-gray-200 p-6", children: /* @__PURE__ */ jsx30("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx30(
|
|
8473
|
+
"div",
|
|
8474
|
+
{
|
|
8475
|
+
ref: printRef,
|
|
8476
|
+
className: "bg-white shadow-xl",
|
|
8477
|
+
style: pageStyles,
|
|
8478
|
+
children
|
|
8479
|
+
}
|
|
8480
|
+
) }) })
|
|
8481
|
+
] })
|
|
8482
|
+
] });
|
|
8483
|
+
};
|
|
8484
|
+
var PRINT_GREEN = "#2d7d46";
|
|
8485
|
+
var DocumentHeader = ({
|
|
8486
|
+
companyName,
|
|
8487
|
+
address,
|
|
8488
|
+
phone,
|
|
8489
|
+
email,
|
|
8490
|
+
website,
|
|
8491
|
+
documentTitle,
|
|
8492
|
+
documentNumber,
|
|
8493
|
+
date,
|
|
8494
|
+
extraInfo = []
|
|
8495
|
+
}) => {
|
|
8496
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex justify-between items-start mb-6 p-8 pb-0", children: [
|
|
8497
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex-1", children: [
|
|
8498
|
+
/* @__PURE__ */ jsxs25("div", { className: "mb-2", children: [
|
|
8499
|
+
/* @__PURE__ */ jsx30(
|
|
8500
|
+
"h1",
|
|
8501
|
+
{
|
|
8502
|
+
className: "text-xl font-bold tracking-wider text-gray-800",
|
|
8503
|
+
style: { letterSpacing: "0.15em" },
|
|
8504
|
+
children: companyName.toUpperCase()
|
|
8505
|
+
}
|
|
8506
|
+
),
|
|
8507
|
+
address && /* @__PURE__ */ jsx30("p", { className: "text-xs text-gray-600 mt-1", children: address })
|
|
8508
|
+
] }),
|
|
8509
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-xs text-gray-600 space-y-0.5 mt-3", children: [
|
|
8510
|
+
phone && /* @__PURE__ */ jsx30("p", { children: phone }),
|
|
8511
|
+
email && /* @__PURE__ */ jsx30("p", { children: email }),
|
|
8512
|
+
website && /* @__PURE__ */ jsx30("p", { children: website })
|
|
8513
|
+
] })
|
|
8514
|
+
] }),
|
|
8515
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-right", children: [
|
|
8516
|
+
/* @__PURE__ */ jsx30(
|
|
8517
|
+
"h2",
|
|
8518
|
+
{
|
|
8519
|
+
className: "text-4xl font-bold mb-4",
|
|
8520
|
+
style: { color: PRINT_GREEN },
|
|
8521
|
+
children: documentTitle
|
|
8522
|
+
}
|
|
8523
|
+
),
|
|
8524
|
+
/* @__PURE__ */ jsx30("table", { className: "ml-auto text-xs", children: /* @__PURE__ */ jsxs25("tbody", { children: [
|
|
8525
|
+
/* @__PURE__ */ jsxs25("tr", { children: [
|
|
8526
|
+
/* @__PURE__ */ jsx30("td", { className: "text-gray-600 pr-4 py-0.5", children: "Date" }),
|
|
8527
|
+
/* @__PURE__ */ jsx30("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: date })
|
|
8528
|
+
] }),
|
|
8529
|
+
/* @__PURE__ */ jsxs25("tr", { children: [
|
|
8530
|
+
/* @__PURE__ */ jsx30("td", { className: "text-gray-600 pr-4 py-0.5", children: "N\xB0" }),
|
|
8531
|
+
/* @__PURE__ */ jsx30("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: documentNumber })
|
|
8532
|
+
] }),
|
|
8533
|
+
extraInfo.map((info, index) => /* @__PURE__ */ jsxs25("tr", { children: [
|
|
8534
|
+
/* @__PURE__ */ jsx30("td", { className: "text-gray-600 pr-4 py-0.5", children: info.label }),
|
|
8535
|
+
/* @__PURE__ */ jsx30("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: info.value })
|
|
8536
|
+
] }, index))
|
|
8537
|
+
] }) })
|
|
8538
|
+
] })
|
|
8539
|
+
] });
|
|
8540
|
+
};
|
|
8541
|
+
var InfoBox = ({
|
|
8542
|
+
title,
|
|
8543
|
+
children,
|
|
8544
|
+
variant = "green"
|
|
8545
|
+
}) => {
|
|
8546
|
+
const headerBg = variant === "green" ? PRINT_GREEN : "#6b7280";
|
|
8547
|
+
return /* @__PURE__ */ jsxs25("div", { children: [
|
|
8548
|
+
/* @__PURE__ */ jsx30(
|
|
8549
|
+
"div",
|
|
8550
|
+
{
|
|
8551
|
+
className: "text-white text-xs font-semibold py-1.5 px-3 rounded-t",
|
|
8552
|
+
style: { backgroundColor: headerBg },
|
|
8553
|
+
children: title
|
|
8554
|
+
}
|
|
8555
|
+
),
|
|
8556
|
+
/* @__PURE__ */ jsx30("div", { className: "border border-gray-300 border-t-0 p-3 min-h-[80px]", children })
|
|
8557
|
+
] });
|
|
8558
|
+
};
|
|
8559
|
+
function DataTable({
|
|
8560
|
+
columns,
|
|
8561
|
+
data,
|
|
8562
|
+
minEmptyRows = 0,
|
|
8563
|
+
keyExtractor
|
|
8564
|
+
}) {
|
|
8565
|
+
const emptyRowsCount = Math.max(0, minEmptyRows - data.length);
|
|
8566
|
+
const getNestedValue = (obj, path) => {
|
|
8567
|
+
return path.split(".").reduce((acc, part) => acc && acc[part], obj);
|
|
8568
|
+
};
|
|
8569
|
+
return /* @__PURE__ */ jsxs25("table", { className: "w-full border-collapse", children: [
|
|
8570
|
+
/* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsx30("tr", { style: { backgroundColor: PRINT_GREEN }, children: columns.map((col, index) => /* @__PURE__ */ jsx30(
|
|
8571
|
+
"th",
|
|
8572
|
+
{
|
|
8573
|
+
className: "text-white text-xs font-semibold py-2 px-2 border border-gray-400",
|
|
8574
|
+
style: {
|
|
8575
|
+
width: col.width,
|
|
8576
|
+
textAlign: col.align || "left"
|
|
8577
|
+
},
|
|
8578
|
+
children: col.header
|
|
8579
|
+
},
|
|
8580
|
+
index
|
|
8581
|
+
)) }) }),
|
|
8582
|
+
/* @__PURE__ */ jsxs25("tbody", { children: [
|
|
8583
|
+
data.map((item, rowIndex) => /* @__PURE__ */ jsx30("tr", { className: "border-b border-gray-300", children: columns.map((col, colIndex) => {
|
|
8584
|
+
const value = typeof col.key === "string" ? getNestedValue(item, col.key) : item[col.key];
|
|
8585
|
+
return /* @__PURE__ */ jsx30(
|
|
8586
|
+
"td",
|
|
8587
|
+
{
|
|
8588
|
+
className: "py-2 px-2 text-xs text-gray-900 border-l border-r border-gray-300",
|
|
8589
|
+
style: { textAlign: col.align || "left" },
|
|
8590
|
+
children: col.render ? col.render(value, item, rowIndex) : value
|
|
8591
|
+
},
|
|
8592
|
+
colIndex
|
|
8593
|
+
);
|
|
8594
|
+
}) }, keyExtractor(item, rowIndex))),
|
|
8595
|
+
Array.from({ length: emptyRowsCount }).map((_, index) => /* @__PURE__ */ jsx30("tr", { className: "border-b border-gray-300", children: columns.map((_2, colIndex) => /* @__PURE__ */ jsx30(
|
|
8596
|
+
"td",
|
|
8597
|
+
{
|
|
8598
|
+
className: "py-2 px-2 border-l border-r border-gray-300",
|
|
8599
|
+
children: "\xA0"
|
|
8600
|
+
},
|
|
8601
|
+
colIndex
|
|
8602
|
+
)) }, `empty-${index}`))
|
|
8603
|
+
] })
|
|
8604
|
+
] });
|
|
8605
|
+
}
|
|
8606
|
+
var TotalsSection = ({
|
|
8607
|
+
rows,
|
|
8608
|
+
amountInWords
|
|
8609
|
+
}) => {
|
|
8610
|
+
return /* @__PURE__ */ jsxs25("div", { className: "w-64", children: [
|
|
8611
|
+
/* @__PURE__ */ jsx30("table", { className: "w-full text-xs", children: /* @__PURE__ */ jsx30("tbody", { children: rows.map((row, index) => /* @__PURE__ */ jsxs25(
|
|
8612
|
+
"tr",
|
|
8613
|
+
{
|
|
8614
|
+
className: row.isTotal ? "" : "border-b border-gray-200",
|
|
8615
|
+
children: [
|
|
8616
|
+
/* @__PURE__ */ jsx30(
|
|
8617
|
+
"td",
|
|
8618
|
+
{
|
|
8619
|
+
className: `py-1.5 px-2 ${row.isTotal ? "font-semibold text-gray-900" : "text-gray-600"}`,
|
|
8620
|
+
children: row.label
|
|
8621
|
+
}
|
|
8622
|
+
),
|
|
8623
|
+
/* @__PURE__ */ jsx30(
|
|
8624
|
+
"td",
|
|
8625
|
+
{
|
|
8626
|
+
className: `py-1.5 px-2 text-right font-medium`,
|
|
8627
|
+
style: row.isTotal ? {
|
|
8628
|
+
backgroundColor: PRINT_GREEN,
|
|
8629
|
+
color: "white",
|
|
8630
|
+
fontWeight: "bold"
|
|
8631
|
+
} : { color: row.valueColor },
|
|
8632
|
+
children: row.value
|
|
8633
|
+
}
|
|
8634
|
+
)
|
|
8635
|
+
]
|
|
8636
|
+
},
|
|
8637
|
+
index
|
|
8638
|
+
)) }) }),
|
|
8639
|
+
amountInWords && /* @__PURE__ */ jsx30("div", { className: "mt-2 text-xs text-gray-600 italic text-center px-2", children: amountInWords })
|
|
8640
|
+
] });
|
|
8641
|
+
};
|
|
8642
|
+
var SignatureSection = ({
|
|
8643
|
+
date,
|
|
8644
|
+
leftLabel = "Signature Client",
|
|
8645
|
+
rightLabel = "Cachet et signature",
|
|
8646
|
+
rightName
|
|
8647
|
+
}) => {
|
|
8648
|
+
return /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-2 gap-8 mt-12 pt-4 px-8", children: [
|
|
8649
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
8650
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs text-gray-600 mb-1", children: "Date:" }),
|
|
8651
|
+
/* @__PURE__ */ jsx30("div", { className: "border-b border-gray-400 w-32 mb-4 text-xs", children: date || "" }),
|
|
8652
|
+
/* @__PURE__ */ jsxs25("p", { className: "text-xs text-gray-600 mb-1", children: [
|
|
8653
|
+
leftLabel,
|
|
8654
|
+
":"
|
|
8655
|
+
] }),
|
|
8656
|
+
/* @__PURE__ */ jsx30("div", { className: "h-16 border-b border-gray-400 w-48" })
|
|
8657
|
+
] }),
|
|
8658
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-right", children: [
|
|
8659
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs text-gray-600 mb-2", children: rightLabel }),
|
|
8660
|
+
rightName && /* @__PURE__ */ jsx30("p", { className: "text-xs font-medium text-gray-900 mb-2", children: rightName }),
|
|
8661
|
+
/* @__PURE__ */ jsx30("div", { className: "inline-block border-2 border-dashed border-gray-300 rounded-full w-24 h-24" })
|
|
8662
|
+
] })
|
|
8663
|
+
] });
|
|
8664
|
+
};
|
|
8665
|
+
var DocumentFooter = ({ lines }) => {
|
|
8666
|
+
return /* @__PURE__ */ jsx30("div", { className: "mt-8 pt-3 border-t border-gray-300 text-center text-xs text-gray-500 px-8 pb-8", children: lines.map((line, index) => /* @__PURE__ */ jsx30("p", { children: line }, index)) });
|
|
8667
|
+
};
|
|
8668
|
+
var numberToWords = (num) => {
|
|
8669
|
+
if (num === 0) return "z\xE9ro";
|
|
8670
|
+
const units = ["", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf"];
|
|
8671
|
+
const tens = ["", "", "vingt", "trente", "quarante", "cinquante", "soixante", "soixante", "quatre-vingt", "quatre-vingt"];
|
|
8672
|
+
const convertHundreds = (n) => {
|
|
8673
|
+
if (n < 20) return units[n];
|
|
8674
|
+
if (n < 100) {
|
|
8675
|
+
const ten = Math.floor(n / 10);
|
|
8676
|
+
const unit = n % 10;
|
|
8677
|
+
if (ten === 7 || ten === 9) {
|
|
8678
|
+
return tens[ten] + "-" + units[10 + unit];
|
|
8679
|
+
}
|
|
8680
|
+
return tens[ten] + (unit ? "-" + units[unit] : ten === 8 ? "s" : "");
|
|
8681
|
+
}
|
|
8682
|
+
const hundred = Math.floor(n / 100);
|
|
8683
|
+
const rest = n % 100;
|
|
8684
|
+
return (hundred === 1 ? "cent" : units[hundred] + " cent") + (rest ? " " + convertHundreds(rest) : hundred > 1 && rest === 0 ? "s" : "");
|
|
8685
|
+
};
|
|
8686
|
+
const convertThousands = (n) => {
|
|
8687
|
+
if (n < 1e3) return convertHundreds(n);
|
|
8688
|
+
const thousands = Math.floor(n / 1e3);
|
|
8689
|
+
const rest = n % 1e3;
|
|
8690
|
+
return (thousands === 1 ? "mille" : convertHundreds(thousands) + " mille") + (rest ? " " + convertHundreds(rest) : "");
|
|
8691
|
+
};
|
|
8692
|
+
const convertMillions = (n) => {
|
|
8693
|
+
if (n < 1e6) return convertThousands(n);
|
|
8694
|
+
const millions = Math.floor(n / 1e6);
|
|
8695
|
+
const rest = n % 1e6;
|
|
8696
|
+
return convertHundreds(millions) + " million" + (millions > 1 ? "s" : "") + (rest ? " " + convertThousands(rest) : "");
|
|
8697
|
+
};
|
|
8698
|
+
return convertMillions(Math.floor(num));
|
|
8699
|
+
};
|
|
8700
|
+
var formatDateFR = (date, format = "short") => {
|
|
8701
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
8702
|
+
if (format === "short") {
|
|
8703
|
+
return d.toLocaleDateString("fr-FR", {
|
|
8704
|
+
day: "2-digit",
|
|
8705
|
+
month: "2-digit",
|
|
8706
|
+
year: "numeric"
|
|
8707
|
+
});
|
|
8708
|
+
}
|
|
8709
|
+
return d.toLocaleDateString("fr-FR", {
|
|
8710
|
+
day: "numeric",
|
|
8711
|
+
month: "long",
|
|
8712
|
+
year: "numeric"
|
|
8713
|
+
});
|
|
8714
|
+
};
|
|
8715
|
+
var formatCurrency = (amount, currency = "XOF", showDecimals = false) => {
|
|
8716
|
+
return amount.toLocaleString("fr-FR", {
|
|
8717
|
+
minimumFractionDigits: showDecimals ? 2 : 0,
|
|
8718
|
+
maximumFractionDigits: showDecimals ? 2 : 0
|
|
8719
|
+
}) + (currency ? ` ${currency}` : "");
|
|
8720
|
+
};
|
|
8324
8721
|
export {
|
|
8325
8722
|
Alert_default as Alert,
|
|
8326
8723
|
AlertProvider,
|
|
@@ -8332,7 +8729,10 @@ export {
|
|
|
8332
8729
|
AuthServices,
|
|
8333
8730
|
Choices_default as CHOICES,
|
|
8334
8731
|
CountrySelector,
|
|
8732
|
+
DataTable,
|
|
8335
8733
|
DateInput,
|
|
8734
|
+
DocumentFooter,
|
|
8735
|
+
DocumentHeader,
|
|
8336
8736
|
EntityFileManager,
|
|
8337
8737
|
FDrawer,
|
|
8338
8738
|
FetchApi,
|
|
@@ -8340,14 +8740,18 @@ export {
|
|
|
8340
8740
|
FileManager,
|
|
8341
8741
|
FileManagerProvider,
|
|
8342
8742
|
ForeignCurrencySelector,
|
|
8743
|
+
InfoBox,
|
|
8343
8744
|
InputField,
|
|
8344
8745
|
InvoiceTypeSelector,
|
|
8345
8746
|
LegalFormSelector,
|
|
8346
8747
|
Modals_default as Modal,
|
|
8347
8748
|
NumberInput,
|
|
8749
|
+
PRINT_GREEN,
|
|
8348
8750
|
Pages_default as Pages,
|
|
8349
8751
|
PaymentMethodSelector,
|
|
8350
8752
|
Buttons_default as PrimaryButton,
|
|
8753
|
+
PrintPreview,
|
|
8754
|
+
PrintableDocument,
|
|
8351
8755
|
ModernDoubleSidebarLayout_default as RewiseLayout,
|
|
8352
8756
|
SecondaryButton,
|
|
8353
8757
|
SelectCostCenter,
|
|
@@ -8357,18 +8761,23 @@ export {
|
|
|
8357
8761
|
SelectUser,
|
|
8358
8762
|
SelectVendor,
|
|
8359
8763
|
SessionProvider,
|
|
8764
|
+
SignatureSection,
|
|
8360
8765
|
TaxSelector,
|
|
8361
8766
|
TemplateFNESelector,
|
|
8362
8767
|
TextInput,
|
|
8363
8768
|
ThemeContext_default as ThemeProvider,
|
|
8364
8769
|
Toast_default as ToastContainer,
|
|
8365
8770
|
ToastProvider,
|
|
8771
|
+
TotalsSection,
|
|
8366
8772
|
UnitServices,
|
|
8367
8773
|
UserServices,
|
|
8368
8774
|
fileManagerApi,
|
|
8775
|
+
formatCurrency,
|
|
8369
8776
|
formatDate,
|
|
8777
|
+
formatDateFR,
|
|
8370
8778
|
formatFileSize,
|
|
8371
8779
|
getFileIcon,
|
|
8780
|
+
numberToWords,
|
|
8372
8781
|
useAlert,
|
|
8373
8782
|
useFileManager,
|
|
8374
8783
|
useFileManagerApi,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ptechcore_ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./dist/index.cjs",
|
|
6
|
-
"module": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"react-hook-form": "^7.48.2",
|
|
34
34
|
"react-leaflet": "^4.2.1",
|
|
35
35
|
"react-router-dom": "^6.26.0",
|
|
36
|
+
"react-to-print": "^3.2.0",
|
|
36
37
|
"tailwind-merge": "^3.3.1",
|
|
37
38
|
"tailwindcss-animate": "^1.0.7"
|
|
38
39
|
},
|