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.cjs
CHANGED
|
@@ -39,7 +39,10 @@ __export(index_exports, {
|
|
|
39
39
|
AuthServices: () => AuthServices,
|
|
40
40
|
CHOICES: () => Choices_default,
|
|
41
41
|
CountrySelector: () => CountrySelector,
|
|
42
|
+
DataTable: () => DataTable,
|
|
42
43
|
DateInput: () => DateInput,
|
|
44
|
+
DocumentFooter: () => DocumentFooter,
|
|
45
|
+
DocumentHeader: () => DocumentHeader,
|
|
43
46
|
EntityFileManager: () => EntityFileManager,
|
|
44
47
|
FDrawer: () => FDrawer,
|
|
45
48
|
FetchApi: () => FetchApi,
|
|
@@ -47,14 +50,18 @@ __export(index_exports, {
|
|
|
47
50
|
FileManager: () => FileManager,
|
|
48
51
|
FileManagerProvider: () => FileManagerProvider,
|
|
49
52
|
ForeignCurrencySelector: () => ForeignCurrencySelector,
|
|
53
|
+
InfoBox: () => InfoBox,
|
|
50
54
|
InputField: () => InputField,
|
|
51
55
|
InvoiceTypeSelector: () => InvoiceTypeSelector,
|
|
52
56
|
LegalFormSelector: () => LegalFormSelector,
|
|
53
57
|
Modal: () => Modals_default,
|
|
54
58
|
NumberInput: () => NumberInput,
|
|
59
|
+
PRINT_GREEN: () => PRINT_GREEN,
|
|
55
60
|
Pages: () => Pages_default,
|
|
56
61
|
PaymentMethodSelector: () => PaymentMethodSelector,
|
|
57
62
|
PrimaryButton: () => Buttons_default,
|
|
63
|
+
PrintPreview: () => PrintPreview,
|
|
64
|
+
PrintableDocument: () => PrintableDocument,
|
|
58
65
|
RewiseLayout: () => ModernDoubleSidebarLayout_default,
|
|
59
66
|
SecondaryButton: () => SecondaryButton,
|
|
60
67
|
SelectCostCenter: () => SelectCostCenter,
|
|
@@ -64,18 +71,23 @@ __export(index_exports, {
|
|
|
64
71
|
SelectUser: () => SelectUser,
|
|
65
72
|
SelectVendor: () => SelectVendor,
|
|
66
73
|
SessionProvider: () => SessionProvider,
|
|
74
|
+
SignatureSection: () => SignatureSection,
|
|
67
75
|
TaxSelector: () => TaxSelector,
|
|
68
76
|
TemplateFNESelector: () => TemplateFNESelector,
|
|
69
77
|
TextInput: () => TextInput,
|
|
70
78
|
ThemeProvider: () => ThemeContext_default,
|
|
71
79
|
ToastContainer: () => Toast_default,
|
|
72
80
|
ToastProvider: () => ToastProvider,
|
|
81
|
+
TotalsSection: () => TotalsSection,
|
|
73
82
|
UnitServices: () => UnitServices,
|
|
74
83
|
UserServices: () => UserServices,
|
|
75
84
|
fileManagerApi: () => fileManagerApi,
|
|
85
|
+
formatCurrency: () => formatCurrency,
|
|
76
86
|
formatDate: () => formatDate,
|
|
87
|
+
formatDateFR: () => formatDateFR,
|
|
77
88
|
formatFileSize: () => formatFileSize,
|
|
78
89
|
getFileIcon: () => getFileIcon,
|
|
90
|
+
numberToWords: () => numberToWords,
|
|
79
91
|
useAlert: () => useAlert,
|
|
80
92
|
useFileManager: () => useFileManager,
|
|
81
93
|
useFileManagerApi: () => useFileManagerApi,
|
|
@@ -886,6 +898,7 @@ var AuthServices = {
|
|
|
886
898
|
addUser: (payload) => FetchApi.post(`${API_BASE_URL}add-user/`, payload),
|
|
887
899
|
login: (payload) => FetchApi.post(`${API_BASE_URL}login/`, payload),
|
|
888
900
|
getUserInformations: (token) => FetchApi.get(`${API_BASE_URL}user-informations/`, token),
|
|
901
|
+
getUserInformationsByOldId: (id) => FetchApi.get(`${API_BASE_URL}user-informations-by-old-id/${id}/`),
|
|
889
902
|
logout: () => FetchApi.post(`${API_BASE_URL}logout/`)
|
|
890
903
|
};
|
|
891
904
|
|
|
@@ -929,13 +942,31 @@ var SessionProvider = ({ children }) => {
|
|
|
929
942
|
const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
|
|
930
943
|
const [showAuthModal, setShowAuthModal] = (0, import_react2.useState)(false);
|
|
931
944
|
(0, import_react2.useEffect)(() => {
|
|
932
|
-
const
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
945
|
+
const initializeSession = async () => {
|
|
946
|
+
const params = new URLSearchParams(window.location.search);
|
|
947
|
+
const tkn = params.get("tkn");
|
|
948
|
+
if (tkn) {
|
|
949
|
+
localStorage.setItem("token", tkn);
|
|
950
|
+
setToken(tkn);
|
|
951
|
+
window.history.replaceState({}, document.title, window.location.pathname);
|
|
952
|
+
}
|
|
953
|
+
const old_rewise_user_id = params.get("rewise_user_id");
|
|
954
|
+
if (old_rewise_user_id) {
|
|
955
|
+
try {
|
|
956
|
+
const res = await AuthServices.getUserInformationsByOldId(parseInt(old_rewise_user_id));
|
|
957
|
+
const result = res;
|
|
958
|
+
if (result.success === true) {
|
|
959
|
+
setLoggedUser(result.data.user);
|
|
960
|
+
setActiveBusinessEntity(
|
|
961
|
+
result.data.user.centers_access.find((item) => parseInt(String(item.id)) === parseInt(saved_center_id)) || result.data.user.centers_access[0] || null
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
} catch (error) {
|
|
965
|
+
console.error("Failed to refresh session:", error);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
initializeSession();
|
|
939
970
|
}, []);
|
|
940
971
|
const [vendors, setVendors] = (0, import_react2.useState)(() => {
|
|
941
972
|
const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
|
|
@@ -8367,6 +8398,384 @@ var EntityFileManager = ({
|
|
|
8367
8398
|
}
|
|
8368
8399
|
) });
|
|
8369
8400
|
};
|
|
8401
|
+
|
|
8402
|
+
// src/components/common/PrintPreview.tsx
|
|
8403
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
8404
|
+
var import_react_to_print = require("react-to-print");
|
|
8405
|
+
var import_lucide_react18 = require("lucide-react");
|
|
8406
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
8407
|
+
var PrintableDocument = ({
|
|
8408
|
+
children,
|
|
8409
|
+
className = "",
|
|
8410
|
+
style = {}
|
|
8411
|
+
}) => {
|
|
8412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8413
|
+
"div",
|
|
8414
|
+
{
|
|
8415
|
+
className: `bg-white text-gray-900 ${className}`,
|
|
8416
|
+
style: {
|
|
8417
|
+
fontFamily: "Arial, sans-serif",
|
|
8418
|
+
fontSize: "11px",
|
|
8419
|
+
...style
|
|
8420
|
+
},
|
|
8421
|
+
children
|
|
8422
|
+
}
|
|
8423
|
+
);
|
|
8424
|
+
};
|
|
8425
|
+
var PrintPreview = ({
|
|
8426
|
+
children,
|
|
8427
|
+
isOpen,
|
|
8428
|
+
onClose,
|
|
8429
|
+
title = "Aper\xE7u avant impression",
|
|
8430
|
+
documentName = "document",
|
|
8431
|
+
pageWidth = "210mm",
|
|
8432
|
+
pageMinHeight = "297mm",
|
|
8433
|
+
orientation = "portrait",
|
|
8434
|
+
onAfterPrint,
|
|
8435
|
+
onBeforePrint
|
|
8436
|
+
}) => {
|
|
8437
|
+
const printRef = (0, import_react23.useRef)(null);
|
|
8438
|
+
const [zoom, setZoom] = import_react23.default.useState(100);
|
|
8439
|
+
const handlePrint = (0, import_react_to_print.useReactToPrint)({
|
|
8440
|
+
contentRef: printRef,
|
|
8441
|
+
documentTitle: documentName,
|
|
8442
|
+
onAfterPrint: () => {
|
|
8443
|
+
onAfterPrint?.();
|
|
8444
|
+
},
|
|
8445
|
+
onBeforePrint
|
|
8446
|
+
});
|
|
8447
|
+
const handleZoomIn = () => {
|
|
8448
|
+
setZoom((prev) => Math.min(prev + 10, 150));
|
|
8449
|
+
};
|
|
8450
|
+
const handleZoomOut = () => {
|
|
8451
|
+
setZoom((prev) => Math.max(prev - 10, 50));
|
|
8452
|
+
};
|
|
8453
|
+
if (!isOpen) return null;
|
|
8454
|
+
const pageStyles = {
|
|
8455
|
+
width: orientation === "portrait" ? pageWidth : pageMinHeight,
|
|
8456
|
+
minHeight: orientation === "portrait" ? pageMinHeight : pageWidth,
|
|
8457
|
+
transform: `scale(${zoom / 100})`,
|
|
8458
|
+
transformOrigin: "top center",
|
|
8459
|
+
transition: "transform 0.2s ease"
|
|
8460
|
+
};
|
|
8461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "fixed inset-0 z-50 overflow-hidden print:hidden", children: [
|
|
8462
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8463
|
+
"div",
|
|
8464
|
+
{
|
|
8465
|
+
className: "absolute inset-0 bg-black/50 backdrop-blur-sm",
|
|
8466
|
+
onClick: onClose
|
|
8467
|
+
}
|
|
8468
|
+
),
|
|
8469
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative h-full flex flex-col", children: [
|
|
8470
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "bg-white border-b shadow-sm px-6 py-3 flex items-center justify-between z-10", children: [
|
|
8471
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: title }),
|
|
8472
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
8473
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-1 bg-gray-100 rounded-lg px-2 py-1", children: [
|
|
8474
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8475
|
+
"button",
|
|
8476
|
+
{
|
|
8477
|
+
onClick: handleZoomOut,
|
|
8478
|
+
className: "p-1 hover:bg-gray-200 rounded transition-colors",
|
|
8479
|
+
title: "Zoom arri\xE8re",
|
|
8480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react18.ZoomOut, { className: "w-4 h-4 text-gray-600" })
|
|
8481
|
+
}
|
|
8482
|
+
),
|
|
8483
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-sm text-gray-600 min-w-[3rem] text-center", children: [
|
|
8484
|
+
zoom,
|
|
8485
|
+
"%"
|
|
8486
|
+
] }),
|
|
8487
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8488
|
+
"button",
|
|
8489
|
+
{
|
|
8490
|
+
onClick: handleZoomIn,
|
|
8491
|
+
className: "p-1 hover:bg-gray-200 rounded transition-colors",
|
|
8492
|
+
title: "Zoom avant",
|
|
8493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react18.ZoomIn, { className: "w-4 h-4 text-gray-600" })
|
|
8494
|
+
}
|
|
8495
|
+
)
|
|
8496
|
+
] }),
|
|
8497
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
8498
|
+
"button",
|
|
8499
|
+
{
|
|
8500
|
+
onClick: () => handlePrint(),
|
|
8501
|
+
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",
|
|
8502
|
+
children: [
|
|
8503
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react18.Printer, { className: "w-4 h-4" }),
|
|
8504
|
+
"Imprimer"
|
|
8505
|
+
]
|
|
8506
|
+
}
|
|
8507
|
+
),
|
|
8508
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
8509
|
+
"button",
|
|
8510
|
+
{
|
|
8511
|
+
onClick: () => handlePrint(),
|
|
8512
|
+
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",
|
|
8513
|
+
children: [
|
|
8514
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react18.Download, { className: "w-4 h-4" }),
|
|
8515
|
+
"PDF"
|
|
8516
|
+
]
|
|
8517
|
+
}
|
|
8518
|
+
),
|
|
8519
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8520
|
+
"button",
|
|
8521
|
+
{
|
|
8522
|
+
onClick: onClose,
|
|
8523
|
+
className: "p-2 hover:bg-gray-100 rounded-full transition-colors",
|
|
8524
|
+
title: "Fermer",
|
|
8525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react18.X, { className: "w-5 h-5 text-gray-500" })
|
|
8526
|
+
}
|
|
8527
|
+
)
|
|
8528
|
+
] })
|
|
8529
|
+
] }),
|
|
8530
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1 overflow-auto bg-gray-200 p-6", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8531
|
+
"div",
|
|
8532
|
+
{
|
|
8533
|
+
ref: printRef,
|
|
8534
|
+
className: "bg-white shadow-xl",
|
|
8535
|
+
style: pageStyles,
|
|
8536
|
+
children
|
|
8537
|
+
}
|
|
8538
|
+
) }) })
|
|
8539
|
+
] })
|
|
8540
|
+
] });
|
|
8541
|
+
};
|
|
8542
|
+
var PRINT_GREEN = "#2d7d46";
|
|
8543
|
+
var DocumentHeader = ({
|
|
8544
|
+
companyName,
|
|
8545
|
+
address,
|
|
8546
|
+
phone,
|
|
8547
|
+
email,
|
|
8548
|
+
website,
|
|
8549
|
+
documentTitle,
|
|
8550
|
+
documentNumber,
|
|
8551
|
+
date,
|
|
8552
|
+
extraInfo = []
|
|
8553
|
+
}) => {
|
|
8554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between items-start mb-6 p-8 pb-0", children: [
|
|
8555
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1", children: [
|
|
8556
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mb-2", children: [
|
|
8557
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8558
|
+
"h1",
|
|
8559
|
+
{
|
|
8560
|
+
className: "text-xl font-bold tracking-wider text-gray-800",
|
|
8561
|
+
style: { letterSpacing: "0.15em" },
|
|
8562
|
+
children: companyName.toUpperCase()
|
|
8563
|
+
}
|
|
8564
|
+
),
|
|
8565
|
+
address && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xs text-gray-600 mt-1", children: address })
|
|
8566
|
+
] }),
|
|
8567
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "text-xs text-gray-600 space-y-0.5 mt-3", children: [
|
|
8568
|
+
phone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: phone }),
|
|
8569
|
+
email && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: email }),
|
|
8570
|
+
website && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { children: website })
|
|
8571
|
+
] })
|
|
8572
|
+
] }),
|
|
8573
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "text-right", children: [
|
|
8574
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8575
|
+
"h2",
|
|
8576
|
+
{
|
|
8577
|
+
className: "text-4xl font-bold mb-4",
|
|
8578
|
+
style: { color: PRINT_GREEN },
|
|
8579
|
+
children: documentTitle
|
|
8580
|
+
}
|
|
8581
|
+
),
|
|
8582
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("table", { className: "ml-auto text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("tbody", { children: [
|
|
8583
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("tr", { children: [
|
|
8584
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: "text-gray-600 pr-4 py-0.5", children: "Date" }),
|
|
8585
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: date })
|
|
8586
|
+
] }),
|
|
8587
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("tr", { children: [
|
|
8588
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: "text-gray-600 pr-4 py-0.5", children: "N\xB0" }),
|
|
8589
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: documentNumber })
|
|
8590
|
+
] }),
|
|
8591
|
+
extraInfo.map((info, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("tr", { children: [
|
|
8592
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: "text-gray-600 pr-4 py-0.5", children: info.label }),
|
|
8593
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: info.value })
|
|
8594
|
+
] }, index))
|
|
8595
|
+
] }) })
|
|
8596
|
+
] })
|
|
8597
|
+
] });
|
|
8598
|
+
};
|
|
8599
|
+
var InfoBox = ({
|
|
8600
|
+
title,
|
|
8601
|
+
children,
|
|
8602
|
+
variant = "green"
|
|
8603
|
+
}) => {
|
|
8604
|
+
const headerBg = variant === "green" ? PRINT_GREEN : "#6b7280";
|
|
8605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
8606
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8607
|
+
"div",
|
|
8608
|
+
{
|
|
8609
|
+
className: "text-white text-xs font-semibold py-1.5 px-3 rounded-t",
|
|
8610
|
+
style: { backgroundColor: headerBg },
|
|
8611
|
+
children: title
|
|
8612
|
+
}
|
|
8613
|
+
),
|
|
8614
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "border border-gray-300 border-t-0 p-3 min-h-[80px]", children })
|
|
8615
|
+
] });
|
|
8616
|
+
};
|
|
8617
|
+
function DataTable({
|
|
8618
|
+
columns,
|
|
8619
|
+
data,
|
|
8620
|
+
minEmptyRows = 0,
|
|
8621
|
+
keyExtractor
|
|
8622
|
+
}) {
|
|
8623
|
+
const emptyRowsCount = Math.max(0, minEmptyRows - data.length);
|
|
8624
|
+
const getNestedValue = (obj, path) => {
|
|
8625
|
+
return path.split(".").reduce((acc, part) => acc && acc[part], obj);
|
|
8626
|
+
};
|
|
8627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("table", { className: "w-full border-collapse", children: [
|
|
8628
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("tr", { style: { backgroundColor: PRINT_GREEN }, children: columns.map((col, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8629
|
+
"th",
|
|
8630
|
+
{
|
|
8631
|
+
className: "text-white text-xs font-semibold py-2 px-2 border border-gray-400",
|
|
8632
|
+
style: {
|
|
8633
|
+
width: col.width,
|
|
8634
|
+
textAlign: col.align || "left"
|
|
8635
|
+
},
|
|
8636
|
+
children: col.header
|
|
8637
|
+
},
|
|
8638
|
+
index
|
|
8639
|
+
)) }) }),
|
|
8640
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("tbody", { children: [
|
|
8641
|
+
data.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("tr", { className: "border-b border-gray-300", children: columns.map((col, colIndex) => {
|
|
8642
|
+
const value = typeof col.key === "string" ? getNestedValue(item, col.key) : item[col.key];
|
|
8643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8644
|
+
"td",
|
|
8645
|
+
{
|
|
8646
|
+
className: "py-2 px-2 text-xs text-gray-900 border-l border-r border-gray-300",
|
|
8647
|
+
style: { textAlign: col.align || "left" },
|
|
8648
|
+
children: col.render ? col.render(value, item, rowIndex) : value
|
|
8649
|
+
},
|
|
8650
|
+
colIndex
|
|
8651
|
+
);
|
|
8652
|
+
}) }, keyExtractor(item, rowIndex))),
|
|
8653
|
+
Array.from({ length: emptyRowsCount }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("tr", { className: "border-b border-gray-300", children: columns.map((_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8654
|
+
"td",
|
|
8655
|
+
{
|
|
8656
|
+
className: "py-2 px-2 border-l border-r border-gray-300",
|
|
8657
|
+
children: "\xA0"
|
|
8658
|
+
},
|
|
8659
|
+
colIndex
|
|
8660
|
+
)) }, `empty-${index}`))
|
|
8661
|
+
] })
|
|
8662
|
+
] });
|
|
8663
|
+
}
|
|
8664
|
+
var TotalsSection = ({
|
|
8665
|
+
rows,
|
|
8666
|
+
amountInWords
|
|
8667
|
+
}) => {
|
|
8668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "w-64", children: [
|
|
8669
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("table", { className: "w-full text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("tbody", { children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
8670
|
+
"tr",
|
|
8671
|
+
{
|
|
8672
|
+
className: row.isTotal ? "" : "border-b border-gray-200",
|
|
8673
|
+
children: [
|
|
8674
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8675
|
+
"td",
|
|
8676
|
+
{
|
|
8677
|
+
className: `py-1.5 px-2 ${row.isTotal ? "font-semibold text-gray-900" : "text-gray-600"}`,
|
|
8678
|
+
children: row.label
|
|
8679
|
+
}
|
|
8680
|
+
),
|
|
8681
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
8682
|
+
"td",
|
|
8683
|
+
{
|
|
8684
|
+
className: `py-1.5 px-2 text-right font-medium`,
|
|
8685
|
+
style: row.isTotal ? {
|
|
8686
|
+
backgroundColor: PRINT_GREEN,
|
|
8687
|
+
color: "white",
|
|
8688
|
+
fontWeight: "bold"
|
|
8689
|
+
} : { color: row.valueColor },
|
|
8690
|
+
children: row.value
|
|
8691
|
+
}
|
|
8692
|
+
)
|
|
8693
|
+
]
|
|
8694
|
+
},
|
|
8695
|
+
index
|
|
8696
|
+
)) }) }),
|
|
8697
|
+
amountInWords && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mt-2 text-xs text-gray-600 italic text-center px-2", children: amountInWords })
|
|
8698
|
+
] });
|
|
8699
|
+
};
|
|
8700
|
+
var SignatureSection = ({
|
|
8701
|
+
date,
|
|
8702
|
+
leftLabel = "Signature Client",
|
|
8703
|
+
rightLabel = "Cachet et signature",
|
|
8704
|
+
rightName
|
|
8705
|
+
}) => {
|
|
8706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-2 gap-8 mt-12 pt-4 px-8", children: [
|
|
8707
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
8708
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xs text-gray-600 mb-1", children: "Date:" }),
|
|
8709
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "border-b border-gray-400 w-32 mb-4 text-xs", children: date || "" }),
|
|
8710
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { className: "text-xs text-gray-600 mb-1", children: [
|
|
8711
|
+
leftLabel,
|
|
8712
|
+
":"
|
|
8713
|
+
] }),
|
|
8714
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-16 border-b border-gray-400 w-48" })
|
|
8715
|
+
] }),
|
|
8716
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "text-right", children: [
|
|
8717
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xs text-gray-600 mb-2", children: rightLabel }),
|
|
8718
|
+
rightName && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xs font-medium text-gray-900 mb-2", children: rightName }),
|
|
8719
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "inline-block border-2 border-dashed border-gray-300 rounded-full w-24 h-24" })
|
|
8720
|
+
] })
|
|
8721
|
+
] });
|
|
8722
|
+
};
|
|
8723
|
+
var DocumentFooter = ({ lines }) => {
|
|
8724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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__ */ (0, import_jsx_runtime30.jsx)("p", { children: line }, index)) });
|
|
8725
|
+
};
|
|
8726
|
+
var numberToWords = (num) => {
|
|
8727
|
+
if (num === 0) return "z\xE9ro";
|
|
8728
|
+
const units = ["", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf"];
|
|
8729
|
+
const tens = ["", "", "vingt", "trente", "quarante", "cinquante", "soixante", "soixante", "quatre-vingt", "quatre-vingt"];
|
|
8730
|
+
const convertHundreds = (n) => {
|
|
8731
|
+
if (n < 20) return units[n];
|
|
8732
|
+
if (n < 100) {
|
|
8733
|
+
const ten = Math.floor(n / 10);
|
|
8734
|
+
const unit = n % 10;
|
|
8735
|
+
if (ten === 7 || ten === 9) {
|
|
8736
|
+
return tens[ten] + "-" + units[10 + unit];
|
|
8737
|
+
}
|
|
8738
|
+
return tens[ten] + (unit ? "-" + units[unit] : ten === 8 ? "s" : "");
|
|
8739
|
+
}
|
|
8740
|
+
const hundred = Math.floor(n / 100);
|
|
8741
|
+
const rest = n % 100;
|
|
8742
|
+
return (hundred === 1 ? "cent" : units[hundred] + " cent") + (rest ? " " + convertHundreds(rest) : hundred > 1 && rest === 0 ? "s" : "");
|
|
8743
|
+
};
|
|
8744
|
+
const convertThousands = (n) => {
|
|
8745
|
+
if (n < 1e3) return convertHundreds(n);
|
|
8746
|
+
const thousands = Math.floor(n / 1e3);
|
|
8747
|
+
const rest = n % 1e3;
|
|
8748
|
+
return (thousands === 1 ? "mille" : convertHundreds(thousands) + " mille") + (rest ? " " + convertHundreds(rest) : "");
|
|
8749
|
+
};
|
|
8750
|
+
const convertMillions = (n) => {
|
|
8751
|
+
if (n < 1e6) return convertThousands(n);
|
|
8752
|
+
const millions = Math.floor(n / 1e6);
|
|
8753
|
+
const rest = n % 1e6;
|
|
8754
|
+
return convertHundreds(millions) + " million" + (millions > 1 ? "s" : "") + (rest ? " " + convertThousands(rest) : "");
|
|
8755
|
+
};
|
|
8756
|
+
return convertMillions(Math.floor(num));
|
|
8757
|
+
};
|
|
8758
|
+
var formatDateFR = (date, format = "short") => {
|
|
8759
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
8760
|
+
if (format === "short") {
|
|
8761
|
+
return d.toLocaleDateString("fr-FR", {
|
|
8762
|
+
day: "2-digit",
|
|
8763
|
+
month: "2-digit",
|
|
8764
|
+
year: "numeric"
|
|
8765
|
+
});
|
|
8766
|
+
}
|
|
8767
|
+
return d.toLocaleDateString("fr-FR", {
|
|
8768
|
+
day: "numeric",
|
|
8769
|
+
month: "long",
|
|
8770
|
+
year: "numeric"
|
|
8771
|
+
});
|
|
8772
|
+
};
|
|
8773
|
+
var formatCurrency = (amount, currency = "XOF", showDecimals = false) => {
|
|
8774
|
+
return amount.toLocaleString("fr-FR", {
|
|
8775
|
+
minimumFractionDigits: showDecimals ? 2 : 0,
|
|
8776
|
+
maximumFractionDigits: showDecimals ? 2 : 0
|
|
8777
|
+
}) + (currency ? ` ${currency}` : "");
|
|
8778
|
+
};
|
|
8370
8779
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8371
8780
|
0 && (module.exports = {
|
|
8372
8781
|
Alert,
|
|
@@ -8379,7 +8788,10 @@ var EntityFileManager = ({
|
|
|
8379
8788
|
AuthServices,
|
|
8380
8789
|
CHOICES,
|
|
8381
8790
|
CountrySelector,
|
|
8791
|
+
DataTable,
|
|
8382
8792
|
DateInput,
|
|
8793
|
+
DocumentFooter,
|
|
8794
|
+
DocumentHeader,
|
|
8383
8795
|
EntityFileManager,
|
|
8384
8796
|
FDrawer,
|
|
8385
8797
|
FetchApi,
|
|
@@ -8387,14 +8799,18 @@ var EntityFileManager = ({
|
|
|
8387
8799
|
FileManager,
|
|
8388
8800
|
FileManagerProvider,
|
|
8389
8801
|
ForeignCurrencySelector,
|
|
8802
|
+
InfoBox,
|
|
8390
8803
|
InputField,
|
|
8391
8804
|
InvoiceTypeSelector,
|
|
8392
8805
|
LegalFormSelector,
|
|
8393
8806
|
Modal,
|
|
8394
8807
|
NumberInput,
|
|
8808
|
+
PRINT_GREEN,
|
|
8395
8809
|
Pages,
|
|
8396
8810
|
PaymentMethodSelector,
|
|
8397
8811
|
PrimaryButton,
|
|
8812
|
+
PrintPreview,
|
|
8813
|
+
PrintableDocument,
|
|
8398
8814
|
RewiseLayout,
|
|
8399
8815
|
SecondaryButton,
|
|
8400
8816
|
SelectCostCenter,
|
|
@@ -8404,18 +8820,23 @@ var EntityFileManager = ({
|
|
|
8404
8820
|
SelectUser,
|
|
8405
8821
|
SelectVendor,
|
|
8406
8822
|
SessionProvider,
|
|
8823
|
+
SignatureSection,
|
|
8407
8824
|
TaxSelector,
|
|
8408
8825
|
TemplateFNESelector,
|
|
8409
8826
|
TextInput,
|
|
8410
8827
|
ThemeProvider,
|
|
8411
8828
|
ToastContainer,
|
|
8412
8829
|
ToastProvider,
|
|
8830
|
+
TotalsSection,
|
|
8413
8831
|
UnitServices,
|
|
8414
8832
|
UserServices,
|
|
8415
8833
|
fileManagerApi,
|
|
8834
|
+
formatCurrency,
|
|
8416
8835
|
formatDate,
|
|
8836
|
+
formatDateFR,
|
|
8417
8837
|
formatFileSize,
|
|
8418
8838
|
getFileIcon,
|
|
8839
|
+
numberToWords,
|
|
8419
8840
|
useAlert,
|
|
8420
8841
|
useFileManager,
|
|
8421
8842
|
useFileManagerApi,
|