ptechcore_ui 1.0.29 → 1.0.31
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 +476 -32
- package/dist/index.d.cts +164 -1
- package/dist/index.d.ts +164 -1
- package/dist/index.js +464 -32
- 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"}`;
|
|
@@ -5857,30 +5876,57 @@ var MinimalVendorForm = ({
|
|
|
5857
5876
|
open: isOpen,
|
|
5858
5877
|
onClose,
|
|
5859
5878
|
children: /* @__PURE__ */ jsxs14("form", { onSubmit: handleSubmit, className: "p-", children: [
|
|
5860
|
-
/* @__PURE__ */
|
|
5861
|
-
/* @__PURE__ */
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5879
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-4", children: [
|
|
5880
|
+
/* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
5881
|
+
/* @__PURE__ */ jsx17(
|
|
5882
|
+
TextInput,
|
|
5883
|
+
{
|
|
5884
|
+
label: "Raison sociale",
|
|
5885
|
+
name: "legal_name",
|
|
5886
|
+
value: formData.legal_name || "",
|
|
5887
|
+
placeholder: "Nom l\xE9gal de l'entit\xE9",
|
|
5888
|
+
required: true,
|
|
5889
|
+
error: errors.legal_name,
|
|
5890
|
+
onChange: handleInputChange
|
|
5891
|
+
}
|
|
5892
|
+
),
|
|
5893
|
+
/* @__PURE__ */ jsx17(
|
|
5894
|
+
TextInput,
|
|
5895
|
+
{
|
|
5896
|
+
label: "Nom commercial",
|
|
5897
|
+
name: "trading_name",
|
|
5898
|
+
value: formData.trading_name || "",
|
|
5899
|
+
placeholder: "Nom commercial (optionnel)",
|
|
5900
|
+
onChange: handleInputChange
|
|
5901
|
+
}
|
|
5902
|
+
)
|
|
5903
|
+
] }),
|
|
5904
|
+
/* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
5905
|
+
/* @__PURE__ */ jsx17(
|
|
5906
|
+
InputField,
|
|
5907
|
+
{
|
|
5908
|
+
label: "T\xE9l\xE9phone",
|
|
5909
|
+
name: "phone",
|
|
5910
|
+
type: "tel",
|
|
5911
|
+
value: formData.phone || "",
|
|
5912
|
+
placeholder: "+33 1 23 45 67 89",
|
|
5913
|
+
onChange: handleInputChange
|
|
5914
|
+
}
|
|
5915
|
+
),
|
|
5916
|
+
/* @__PURE__ */ jsx17(
|
|
5917
|
+
InputField,
|
|
5918
|
+
{
|
|
5919
|
+
label: "Email",
|
|
5920
|
+
name: "email",
|
|
5921
|
+
type: "email",
|
|
5922
|
+
value: formData.email || "",
|
|
5923
|
+
placeholder: "contact@entite.com",
|
|
5924
|
+
error: errors.email,
|
|
5925
|
+
onChange: handleInputChange
|
|
5926
|
+
}
|
|
5927
|
+
)
|
|
5928
|
+
] })
|
|
5929
|
+
] }),
|
|
5884
5930
|
/* @__PURE__ */ jsxs14("div", { className: "flex justify-between pt-6 mt-8", children: [
|
|
5885
5931
|
/* @__PURE__ */ jsx17(
|
|
5886
5932
|
"button",
|
|
@@ -5897,7 +5943,7 @@ var MinimalVendorForm = ({
|
|
|
5897
5943
|
type: "button",
|
|
5898
5944
|
onClick: handleSubmit,
|
|
5899
5945
|
disabled: loading,
|
|
5900
|
-
children: loading ? "chargement..." : "Enregistrer
|
|
5946
|
+
children: loading ? "chargement..." : "Enregistrer le fournisseur"
|
|
5901
5947
|
}
|
|
5902
5948
|
)
|
|
5903
5949
|
] })
|
|
@@ -8321,6 +8367,380 @@ var EntityFileManager = ({
|
|
|
8321
8367
|
}
|
|
8322
8368
|
) });
|
|
8323
8369
|
};
|
|
8370
|
+
|
|
8371
|
+
// src/components/common/PrintPreview.tsx
|
|
8372
|
+
import React20, { useRef as useRef6 } from "react";
|
|
8373
|
+
import { useReactToPrint } from "react-to-print";
|
|
8374
|
+
import { X as X10, Download as Download4, ZoomIn, ZoomOut, FileText as FileText4 } from "lucide-react";
|
|
8375
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8376
|
+
var PrintableDocument = ({
|
|
8377
|
+
children,
|
|
8378
|
+
className = "",
|
|
8379
|
+
style = {}
|
|
8380
|
+
}) => {
|
|
8381
|
+
return /* @__PURE__ */ jsx30(
|
|
8382
|
+
"div",
|
|
8383
|
+
{
|
|
8384
|
+
className: `bg-white text-gray-900 ${className}`,
|
|
8385
|
+
style: {
|
|
8386
|
+
fontFamily: "Arial, sans-serif",
|
|
8387
|
+
fontSize: "11px",
|
|
8388
|
+
...style
|
|
8389
|
+
},
|
|
8390
|
+
children
|
|
8391
|
+
}
|
|
8392
|
+
);
|
|
8393
|
+
};
|
|
8394
|
+
var PrintPreview = ({
|
|
8395
|
+
children,
|
|
8396
|
+
isOpen,
|
|
8397
|
+
onClose,
|
|
8398
|
+
title = "Aper\xE7u avant impression",
|
|
8399
|
+
documentName = "document",
|
|
8400
|
+
pageWidth = "210mm",
|
|
8401
|
+
pageMinHeight = "297mm",
|
|
8402
|
+
orientation = "portrait",
|
|
8403
|
+
onAfterPrint,
|
|
8404
|
+
onBeforePrint
|
|
8405
|
+
}) => {
|
|
8406
|
+
const printRef = useRef6(null);
|
|
8407
|
+
const [zoom, setZoom] = React20.useState(100);
|
|
8408
|
+
const handlePrint = useReactToPrint({
|
|
8409
|
+
contentRef: printRef,
|
|
8410
|
+
documentTitle: documentName,
|
|
8411
|
+
onAfterPrint: () => {
|
|
8412
|
+
onAfterPrint?.();
|
|
8413
|
+
},
|
|
8414
|
+
onBeforePrint
|
|
8415
|
+
});
|
|
8416
|
+
const handleZoomIn = () => {
|
|
8417
|
+
setZoom((prev) => Math.min(prev + 10, 150));
|
|
8418
|
+
};
|
|
8419
|
+
const handleZoomOut = () => {
|
|
8420
|
+
setZoom((prev) => Math.max(prev - 10, 50));
|
|
8421
|
+
};
|
|
8422
|
+
if (!isOpen) return null;
|
|
8423
|
+
const pageStyles = {
|
|
8424
|
+
width: orientation === "portrait" ? pageWidth : pageMinHeight,
|
|
8425
|
+
minHeight: orientation === "portrait" ? pageMinHeight : pageWidth,
|
|
8426
|
+
transform: `scale(${zoom / 100})`,
|
|
8427
|
+
transformOrigin: "top center",
|
|
8428
|
+
transition: "transform 0.2s ease"
|
|
8429
|
+
};
|
|
8430
|
+
return /* @__PURE__ */ jsxs25("div", { className: "fixed inset-0 z-50 overflow-hidden print:hidden", children: [
|
|
8431
|
+
/* @__PURE__ */ jsx30(
|
|
8432
|
+
"div",
|
|
8433
|
+
{
|
|
8434
|
+
className: "absolute inset-0 bg-black/60 backdrop-blur-sm",
|
|
8435
|
+
onClick: onClose
|
|
8436
|
+
}
|
|
8437
|
+
),
|
|
8438
|
+
/* @__PURE__ */ jsx30(
|
|
8439
|
+
"button",
|
|
8440
|
+
{
|
|
8441
|
+
onClick: onClose,
|
|
8442
|
+
className: "absolute top-4 right-4 z-20 p-2 bg-white/90 hover:bg-white rounded-full shadow-lg transition-colors",
|
|
8443
|
+
title: "Fermer",
|
|
8444
|
+
children: /* @__PURE__ */ jsx30(X10, { className: "w-5 h-5 text-gray-600" })
|
|
8445
|
+
}
|
|
8446
|
+
),
|
|
8447
|
+
/* @__PURE__ */ jsx30("div", { className: "relative h-full flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs25("div", { className: "flex items-start gap-4 max-h-full", children: [
|
|
8448
|
+
/* @__PURE__ */ jsx30("div", { className: "overflow-auto max-h-[90vh] bg-transparent", children: /* @__PURE__ */ jsx30(
|
|
8449
|
+
"div",
|
|
8450
|
+
{
|
|
8451
|
+
ref: printRef,
|
|
8452
|
+
className: "bg-white shadow-2xl",
|
|
8453
|
+
style: pageStyles,
|
|
8454
|
+
children
|
|
8455
|
+
}
|
|
8456
|
+
) }),
|
|
8457
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-2 bg-white rounded-lg shadow-lg p-2", children: [
|
|
8458
|
+
/* @__PURE__ */ jsxs25(
|
|
8459
|
+
"button",
|
|
8460
|
+
{
|
|
8461
|
+
onClick: () => handlePrint(),
|
|
8462
|
+
className: "p-3 hover:bg-gray-100 rounded-lg transition-colors flex flex-col items-center gap-1 group",
|
|
8463
|
+
title: "Imprimer / PDF",
|
|
8464
|
+
children: [
|
|
8465
|
+
/* @__PURE__ */ jsx30(FileText4, { className: "w-6 h-6 text-gray-600 group-hover:text-blue-600" }),
|
|
8466
|
+
/* @__PURE__ */ jsx30("span", { className: "text-[10px] text-gray-500 group-hover:text-blue-600", children: "PDF" })
|
|
8467
|
+
]
|
|
8468
|
+
}
|
|
8469
|
+
),
|
|
8470
|
+
/* @__PURE__ */ jsx30("div", { className: "border-t border-gray-200 my-1" }),
|
|
8471
|
+
/* @__PURE__ */ jsx30(
|
|
8472
|
+
"button",
|
|
8473
|
+
{
|
|
8474
|
+
onClick: () => handlePrint(),
|
|
8475
|
+
className: "p-3 hover:bg-gray-100 rounded-lg transition-colors flex flex-col items-center gap-1 group",
|
|
8476
|
+
title: "T\xE9l\xE9charger",
|
|
8477
|
+
children: /* @__PURE__ */ jsx30(Download4, { className: "w-6 h-6 text-gray-600 group-hover:text-blue-600" })
|
|
8478
|
+
}
|
|
8479
|
+
),
|
|
8480
|
+
/* @__PURE__ */ jsx30("div", { className: "border-t border-gray-200 my-1" }),
|
|
8481
|
+
/* @__PURE__ */ jsx30(
|
|
8482
|
+
"button",
|
|
8483
|
+
{
|
|
8484
|
+
onClick: handleZoomIn,
|
|
8485
|
+
className: "p-3 hover:bg-gray-100 rounded-lg transition-colors",
|
|
8486
|
+
title: "Zoom avant",
|
|
8487
|
+
children: /* @__PURE__ */ jsx30(ZoomIn, { className: "w-5 h-5 text-gray-600" })
|
|
8488
|
+
}
|
|
8489
|
+
),
|
|
8490
|
+
/* @__PURE__ */ jsxs25("span", { className: "text-xs text-gray-500 text-center py-1", children: [
|
|
8491
|
+
zoom,
|
|
8492
|
+
"%"
|
|
8493
|
+
] }),
|
|
8494
|
+
/* @__PURE__ */ jsx30(
|
|
8495
|
+
"button",
|
|
8496
|
+
{
|
|
8497
|
+
onClick: handleZoomOut,
|
|
8498
|
+
className: "p-3 hover:bg-gray-100 rounded-lg transition-colors",
|
|
8499
|
+
title: "Zoom arri\xE8re",
|
|
8500
|
+
children: /* @__PURE__ */ jsx30(ZoomOut, { className: "w-5 h-5 text-gray-600" })
|
|
8501
|
+
}
|
|
8502
|
+
)
|
|
8503
|
+
] })
|
|
8504
|
+
] }) })
|
|
8505
|
+
] });
|
|
8506
|
+
};
|
|
8507
|
+
var PRINT_GREEN = "#2d7d46";
|
|
8508
|
+
var DocumentHeader = ({
|
|
8509
|
+
companyName,
|
|
8510
|
+
address,
|
|
8511
|
+
phone,
|
|
8512
|
+
email,
|
|
8513
|
+
website,
|
|
8514
|
+
documentTitle,
|
|
8515
|
+
documentNumber,
|
|
8516
|
+
date,
|
|
8517
|
+
extraInfo = []
|
|
8518
|
+
}) => {
|
|
8519
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex justify-between items-start mb-6 p-8 pb-0", children: [
|
|
8520
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex-1", children: [
|
|
8521
|
+
/* @__PURE__ */ jsxs25("div", { className: "mb-2", children: [
|
|
8522
|
+
/* @__PURE__ */ jsx30(
|
|
8523
|
+
"h1",
|
|
8524
|
+
{
|
|
8525
|
+
className: "text-xl font-bold tracking-wider text-gray-800",
|
|
8526
|
+
style: { letterSpacing: "0.15em" },
|
|
8527
|
+
children: companyName.toUpperCase()
|
|
8528
|
+
}
|
|
8529
|
+
),
|
|
8530
|
+
address && /* @__PURE__ */ jsx30("p", { className: "text-xs text-gray-600 mt-1", children: address })
|
|
8531
|
+
] }),
|
|
8532
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-xs text-gray-600 space-y-0.5 mt-3", children: [
|
|
8533
|
+
phone && /* @__PURE__ */ jsx30("p", { children: phone }),
|
|
8534
|
+
email && /* @__PURE__ */ jsx30("p", { children: email }),
|
|
8535
|
+
website && /* @__PURE__ */ jsx30("p", { children: website })
|
|
8536
|
+
] })
|
|
8537
|
+
] }),
|
|
8538
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-right", children: [
|
|
8539
|
+
/* @__PURE__ */ jsx30(
|
|
8540
|
+
"h2",
|
|
8541
|
+
{
|
|
8542
|
+
className: "text-4xl font-bold mb-4",
|
|
8543
|
+
style: { color: PRINT_GREEN },
|
|
8544
|
+
children: documentTitle
|
|
8545
|
+
}
|
|
8546
|
+
),
|
|
8547
|
+
/* @__PURE__ */ jsx30("table", { className: "ml-auto text-xs", children: /* @__PURE__ */ jsxs25("tbody", { children: [
|
|
8548
|
+
/* @__PURE__ */ jsxs25("tr", { children: [
|
|
8549
|
+
/* @__PURE__ */ jsx30("td", { className: "text-gray-600 pr-4 py-0.5", children: "Date" }),
|
|
8550
|
+
/* @__PURE__ */ jsx30("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: date })
|
|
8551
|
+
] }),
|
|
8552
|
+
/* @__PURE__ */ jsxs25("tr", { children: [
|
|
8553
|
+
/* @__PURE__ */ jsx30("td", { className: "text-gray-600 pr-4 py-0.5", children: "N\xB0" }),
|
|
8554
|
+
/* @__PURE__ */ jsx30("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: documentNumber })
|
|
8555
|
+
] }),
|
|
8556
|
+
extraInfo.map((info, index) => /* @__PURE__ */ jsxs25("tr", { children: [
|
|
8557
|
+
/* @__PURE__ */ jsx30("td", { className: "text-gray-600 pr-4 py-0.5", children: info.label }),
|
|
8558
|
+
/* @__PURE__ */ jsx30("td", { className: "font-medium border-b border-gray-300 pl-2 py-0.5", children: info.value })
|
|
8559
|
+
] }, index))
|
|
8560
|
+
] }) })
|
|
8561
|
+
] })
|
|
8562
|
+
] });
|
|
8563
|
+
};
|
|
8564
|
+
var InfoBox = ({
|
|
8565
|
+
title,
|
|
8566
|
+
children,
|
|
8567
|
+
variant = "green"
|
|
8568
|
+
}) => {
|
|
8569
|
+
const headerBg = variant === "green" ? PRINT_GREEN : "#6b7280";
|
|
8570
|
+
return /* @__PURE__ */ jsxs25("div", { children: [
|
|
8571
|
+
/* @__PURE__ */ jsx30(
|
|
8572
|
+
"div",
|
|
8573
|
+
{
|
|
8574
|
+
className: "text-white text-xs font-semibold py-1.5 px-3 rounded-t",
|
|
8575
|
+
style: { backgroundColor: headerBg },
|
|
8576
|
+
children: title
|
|
8577
|
+
}
|
|
8578
|
+
),
|
|
8579
|
+
/* @__PURE__ */ jsx30("div", { className: "border border-gray-300 border-t-0 p-3 min-h-[80px]", children })
|
|
8580
|
+
] });
|
|
8581
|
+
};
|
|
8582
|
+
function DataTable({
|
|
8583
|
+
columns,
|
|
8584
|
+
data,
|
|
8585
|
+
minEmptyRows = 0,
|
|
8586
|
+
keyExtractor
|
|
8587
|
+
}) {
|
|
8588
|
+
const emptyRowsCount = Math.max(0, minEmptyRows - data.length);
|
|
8589
|
+
const getNestedValue = (obj, path) => {
|
|
8590
|
+
return path.split(".").reduce((acc, part) => acc && acc[part], obj);
|
|
8591
|
+
};
|
|
8592
|
+
return /* @__PURE__ */ jsxs25("table", { className: "w-full border-collapse", children: [
|
|
8593
|
+
/* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsx30("tr", { style: { backgroundColor: PRINT_GREEN }, children: columns.map((col, index) => /* @__PURE__ */ jsx30(
|
|
8594
|
+
"th",
|
|
8595
|
+
{
|
|
8596
|
+
className: "text-white text-xs font-semibold py-2 px-2 border border-gray-400",
|
|
8597
|
+
style: {
|
|
8598
|
+
width: col.width,
|
|
8599
|
+
textAlign: col.align || "left"
|
|
8600
|
+
},
|
|
8601
|
+
children: col.header
|
|
8602
|
+
},
|
|
8603
|
+
index
|
|
8604
|
+
)) }) }),
|
|
8605
|
+
/* @__PURE__ */ jsxs25("tbody", { children: [
|
|
8606
|
+
data.map((item, rowIndex) => /* @__PURE__ */ jsx30("tr", { className: "border-b border-gray-300", children: columns.map((col, colIndex) => {
|
|
8607
|
+
const value = typeof col.key === "string" ? getNestedValue(item, col.key) : item[col.key];
|
|
8608
|
+
return /* @__PURE__ */ jsx30(
|
|
8609
|
+
"td",
|
|
8610
|
+
{
|
|
8611
|
+
className: "py-2 px-2 text-xs text-gray-900 border-l border-r border-gray-300",
|
|
8612
|
+
style: { textAlign: col.align || "left" },
|
|
8613
|
+
children: col.render ? col.render(value, item, rowIndex) : value
|
|
8614
|
+
},
|
|
8615
|
+
colIndex
|
|
8616
|
+
);
|
|
8617
|
+
}) }, keyExtractor(item, rowIndex))),
|
|
8618
|
+
Array.from({ length: emptyRowsCount }).map((_, index) => /* @__PURE__ */ jsx30("tr", { className: "border-b border-gray-300", children: columns.map((_2, colIndex) => /* @__PURE__ */ jsx30(
|
|
8619
|
+
"td",
|
|
8620
|
+
{
|
|
8621
|
+
className: "py-2 px-2 border-l border-r border-gray-300",
|
|
8622
|
+
children: "\xA0"
|
|
8623
|
+
},
|
|
8624
|
+
colIndex
|
|
8625
|
+
)) }, `empty-${index}`))
|
|
8626
|
+
] })
|
|
8627
|
+
] });
|
|
8628
|
+
}
|
|
8629
|
+
var TotalsSection = ({
|
|
8630
|
+
rows,
|
|
8631
|
+
amountInWords
|
|
8632
|
+
}) => {
|
|
8633
|
+
return /* @__PURE__ */ jsxs25("div", { className: "w-64", children: [
|
|
8634
|
+
/* @__PURE__ */ jsx30("table", { className: "w-full text-xs", children: /* @__PURE__ */ jsx30("tbody", { children: rows.map((row, index) => /* @__PURE__ */ jsxs25(
|
|
8635
|
+
"tr",
|
|
8636
|
+
{
|
|
8637
|
+
className: row.isTotal ? "" : "border-b border-gray-200",
|
|
8638
|
+
children: [
|
|
8639
|
+
/* @__PURE__ */ jsx30(
|
|
8640
|
+
"td",
|
|
8641
|
+
{
|
|
8642
|
+
className: `py-1.5 px-2 ${row.isTotal ? "font-semibold text-gray-900" : "text-gray-600"}`,
|
|
8643
|
+
children: row.label
|
|
8644
|
+
}
|
|
8645
|
+
),
|
|
8646
|
+
/* @__PURE__ */ jsx30(
|
|
8647
|
+
"td",
|
|
8648
|
+
{
|
|
8649
|
+
className: `py-1.5 px-2 text-right font-medium`,
|
|
8650
|
+
style: row.isTotal ? {
|
|
8651
|
+
backgroundColor: PRINT_GREEN,
|
|
8652
|
+
color: "white",
|
|
8653
|
+
fontWeight: "bold"
|
|
8654
|
+
} : { color: row.valueColor },
|
|
8655
|
+
children: row.value
|
|
8656
|
+
}
|
|
8657
|
+
)
|
|
8658
|
+
]
|
|
8659
|
+
},
|
|
8660
|
+
index
|
|
8661
|
+
)) }) }),
|
|
8662
|
+
amountInWords && /* @__PURE__ */ jsx30("div", { className: "mt-2 text-xs text-gray-600 italic text-center px-2", children: amountInWords })
|
|
8663
|
+
] });
|
|
8664
|
+
};
|
|
8665
|
+
var SignatureSection = ({
|
|
8666
|
+
date,
|
|
8667
|
+
leftLabel = "Signature Client",
|
|
8668
|
+
rightLabel = "Cachet et signature",
|
|
8669
|
+
rightName
|
|
8670
|
+
}) => {
|
|
8671
|
+
return /* @__PURE__ */ jsxs25("div", { className: "grid grid-cols-2 gap-8 mt-12 pt-4 px-8", children: [
|
|
8672
|
+
/* @__PURE__ */ jsxs25("div", { children: [
|
|
8673
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs text-gray-600 mb-1", children: "Date:" }),
|
|
8674
|
+
/* @__PURE__ */ jsx30("div", { className: "border-b border-gray-400 w-32 mb-4 text-xs", children: date || "" }),
|
|
8675
|
+
/* @__PURE__ */ jsxs25("p", { className: "text-xs text-gray-600 mb-1", children: [
|
|
8676
|
+
leftLabel,
|
|
8677
|
+
":"
|
|
8678
|
+
] }),
|
|
8679
|
+
/* @__PURE__ */ jsx30("div", { className: "h-16 border-b border-gray-400 w-48" })
|
|
8680
|
+
] }),
|
|
8681
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-right", children: [
|
|
8682
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs text-gray-600 mb-2", children: rightLabel }),
|
|
8683
|
+
rightName && /* @__PURE__ */ jsx30("p", { className: "text-xs font-medium text-gray-900 mb-2", children: rightName }),
|
|
8684
|
+
/* @__PURE__ */ jsx30("div", { className: "inline-block border-2 border-dashed border-gray-300 rounded-full w-24 h-24" })
|
|
8685
|
+
] })
|
|
8686
|
+
] });
|
|
8687
|
+
};
|
|
8688
|
+
var DocumentFooter = ({ lines }) => {
|
|
8689
|
+
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)) });
|
|
8690
|
+
};
|
|
8691
|
+
var numberToWords = (num) => {
|
|
8692
|
+
if (num === 0) return "z\xE9ro";
|
|
8693
|
+
const units = ["", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf"];
|
|
8694
|
+
const tens = ["", "", "vingt", "trente", "quarante", "cinquante", "soixante", "soixante", "quatre-vingt", "quatre-vingt"];
|
|
8695
|
+
const convertHundreds = (n) => {
|
|
8696
|
+
if (n < 20) return units[n];
|
|
8697
|
+
if (n < 100) {
|
|
8698
|
+
const ten = Math.floor(n / 10);
|
|
8699
|
+
const unit = n % 10;
|
|
8700
|
+
if (ten === 7 || ten === 9) {
|
|
8701
|
+
return tens[ten] + "-" + units[10 + unit];
|
|
8702
|
+
}
|
|
8703
|
+
return tens[ten] + (unit ? "-" + units[unit] : ten === 8 ? "s" : "");
|
|
8704
|
+
}
|
|
8705
|
+
const hundred = Math.floor(n / 100);
|
|
8706
|
+
const rest = n % 100;
|
|
8707
|
+
return (hundred === 1 ? "cent" : units[hundred] + " cent") + (rest ? " " + convertHundreds(rest) : hundred > 1 && rest === 0 ? "s" : "");
|
|
8708
|
+
};
|
|
8709
|
+
const convertThousands = (n) => {
|
|
8710
|
+
if (n < 1e3) return convertHundreds(n);
|
|
8711
|
+
const thousands = Math.floor(n / 1e3);
|
|
8712
|
+
const rest = n % 1e3;
|
|
8713
|
+
return (thousands === 1 ? "mille" : convertHundreds(thousands) + " mille") + (rest ? " " + convertHundreds(rest) : "");
|
|
8714
|
+
};
|
|
8715
|
+
const convertMillions = (n) => {
|
|
8716
|
+
if (n < 1e6) return convertThousands(n);
|
|
8717
|
+
const millions = Math.floor(n / 1e6);
|
|
8718
|
+
const rest = n % 1e6;
|
|
8719
|
+
return convertHundreds(millions) + " million" + (millions > 1 ? "s" : "") + (rest ? " " + convertThousands(rest) : "");
|
|
8720
|
+
};
|
|
8721
|
+
return convertMillions(Math.floor(num));
|
|
8722
|
+
};
|
|
8723
|
+
var formatDateFR = (date, format = "short") => {
|
|
8724
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
8725
|
+
if (format === "short") {
|
|
8726
|
+
return d.toLocaleDateString("fr-FR", {
|
|
8727
|
+
day: "2-digit",
|
|
8728
|
+
month: "2-digit",
|
|
8729
|
+
year: "numeric"
|
|
8730
|
+
});
|
|
8731
|
+
}
|
|
8732
|
+
return d.toLocaleDateString("fr-FR", {
|
|
8733
|
+
day: "numeric",
|
|
8734
|
+
month: "long",
|
|
8735
|
+
year: "numeric"
|
|
8736
|
+
});
|
|
8737
|
+
};
|
|
8738
|
+
var formatCurrency = (amount, currency = "XOF", showDecimals = false) => {
|
|
8739
|
+
return amount.toLocaleString("fr-FR", {
|
|
8740
|
+
minimumFractionDigits: showDecimals ? 2 : 0,
|
|
8741
|
+
maximumFractionDigits: showDecimals ? 2 : 0
|
|
8742
|
+
}) + (currency ? ` ${currency}` : "");
|
|
8743
|
+
};
|
|
8324
8744
|
export {
|
|
8325
8745
|
Alert_default as Alert,
|
|
8326
8746
|
AlertProvider,
|
|
@@ -8332,7 +8752,10 @@ export {
|
|
|
8332
8752
|
AuthServices,
|
|
8333
8753
|
Choices_default as CHOICES,
|
|
8334
8754
|
CountrySelector,
|
|
8755
|
+
DataTable,
|
|
8335
8756
|
DateInput,
|
|
8757
|
+
DocumentFooter,
|
|
8758
|
+
DocumentHeader,
|
|
8336
8759
|
EntityFileManager,
|
|
8337
8760
|
FDrawer,
|
|
8338
8761
|
FetchApi,
|
|
@@ -8340,14 +8763,18 @@ export {
|
|
|
8340
8763
|
FileManager,
|
|
8341
8764
|
FileManagerProvider,
|
|
8342
8765
|
ForeignCurrencySelector,
|
|
8766
|
+
InfoBox,
|
|
8343
8767
|
InputField,
|
|
8344
8768
|
InvoiceTypeSelector,
|
|
8345
8769
|
LegalFormSelector,
|
|
8346
8770
|
Modals_default as Modal,
|
|
8347
8771
|
NumberInput,
|
|
8772
|
+
PRINT_GREEN,
|
|
8348
8773
|
Pages_default as Pages,
|
|
8349
8774
|
PaymentMethodSelector,
|
|
8350
8775
|
Buttons_default as PrimaryButton,
|
|
8776
|
+
PrintPreview,
|
|
8777
|
+
PrintableDocument,
|
|
8351
8778
|
ModernDoubleSidebarLayout_default as RewiseLayout,
|
|
8352
8779
|
SecondaryButton,
|
|
8353
8780
|
SelectCostCenter,
|
|
@@ -8357,18 +8784,23 @@ export {
|
|
|
8357
8784
|
SelectUser,
|
|
8358
8785
|
SelectVendor,
|
|
8359
8786
|
SessionProvider,
|
|
8787
|
+
SignatureSection,
|
|
8360
8788
|
TaxSelector,
|
|
8361
8789
|
TemplateFNESelector,
|
|
8362
8790
|
TextInput,
|
|
8363
8791
|
ThemeContext_default as ThemeProvider,
|
|
8364
8792
|
Toast_default as ToastContainer,
|
|
8365
8793
|
ToastProvider,
|
|
8794
|
+
TotalsSection,
|
|
8366
8795
|
UnitServices,
|
|
8367
8796
|
UserServices,
|
|
8368
8797
|
fileManagerApi,
|
|
8798
|
+
formatCurrency,
|
|
8369
8799
|
formatDate,
|
|
8800
|
+
formatDateFR,
|
|
8370
8801
|
formatFileSize,
|
|
8371
8802
|
getFileIcon,
|
|
8803
|
+
numberToWords,
|
|
8372
8804
|
useAlert,
|
|
8373
8805
|
useFileManager,
|
|
8374
8806
|
useFileManagerApi,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ptechcore_ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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
|
},
|