ptechcore_ui 1.0.16 → 1.0.17
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 +240 -172
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +257 -175
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -670,8 +670,9 @@ var ThemeContext_default = ThemeProvider;
|
|
|
670
670
|
var import_react2 = require("react");
|
|
671
671
|
|
|
672
672
|
// src/services/api.ts
|
|
673
|
-
var
|
|
674
|
-
var
|
|
673
|
+
var chooseEnv = localStorage.getItem("env") ?? "prod";
|
|
674
|
+
var ADDRESS_IP = chooseEnv === "prod" ? "back.rewise.praeduim-tech.com" : "localhost:8000";
|
|
675
|
+
var ADDRESS_IP_URL = chooseEnv === "prod" ? `https://${ADDRESS_IP}/` : `http://${ADDRESS_IP}/`;
|
|
675
676
|
var API_URL = `${ADDRESS_IP_URL}api`;
|
|
676
677
|
var FetchApi = class {
|
|
677
678
|
static async post(url, payload, token) {
|
|
@@ -764,6 +765,8 @@ var SessionProvider = ({ children }) => {
|
|
|
764
765
|
const [loggedUser, setLoggedUser] = (0, import_react2.useState)(null);
|
|
765
766
|
const [activeBusinessEntity, setActiveBusinessEntity] = (0, import_react2.useState)(null);
|
|
766
767
|
const saved_center_id = localStorage.getItem("active_center_id") || "";
|
|
768
|
+
const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
|
|
769
|
+
const [showAuthModal, setShowAuthModal] = (0, import_react2.useState)(false);
|
|
767
770
|
(0, import_react2.useEffect)(() => {
|
|
768
771
|
const storedToken = localStorage.getItem("token");
|
|
769
772
|
if (storedToken) {
|
|
@@ -805,7 +808,9 @@ var SessionProvider = ({ children }) => {
|
|
|
805
808
|
setActiveBusinessEntity,
|
|
806
809
|
token,
|
|
807
810
|
login,
|
|
808
|
-
logout
|
|
811
|
+
logout,
|
|
812
|
+
showAuthModal,
|
|
813
|
+
setShowAuthModal
|
|
809
814
|
}, children });
|
|
810
815
|
};
|
|
811
816
|
|
|
@@ -1674,99 +1679,101 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1674
1679
|
}
|
|
1675
1680
|
)
|
|
1676
1681
|
] }),
|
|
1677
|
-
mobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
{
|
|
1702
|
-
onClick: () => setMobileMenuOpen(false),
|
|
1703
|
-
className: "text-[var(--color-sidebar-text-secondary)]",
|
|
1704
|
-
"aria-label": "Fermer le menu",
|
|
1705
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.X, { className: "w-6 h-6" })
|
|
1706
|
-
}
|
|
1707
|
-
)
|
|
1682
|
+
mobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1684
|
+
"div",
|
|
1685
|
+
{
|
|
1686
|
+
className: "fixed inset-0 bg-white z-40 lg:hidden",
|
|
1687
|
+
onClick: () => setMobileMenuOpen(false),
|
|
1688
|
+
"aria-hidden": "true"
|
|
1689
|
+
}
|
|
1690
|
+
),
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1692
|
+
"aside",
|
|
1693
|
+
{
|
|
1694
|
+
className: "fixed left-0 top-0 w-80 h-full bg-[var(--color-sidebar-bg)] z-50 lg:hidden transform transition-transform duration-300 ease-in-out shadow-2xl",
|
|
1695
|
+
onClick: (e) => e.stopPropagation(),
|
|
1696
|
+
role: "navigation",
|
|
1697
|
+
"aria-label": "Navigation mobile",
|
|
1698
|
+
children: [
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "h-16 flex items-center justify-between px-4 border-b border-[var(--color-sidebar-border)]", children: [
|
|
1700
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "text-white font-bold text-lg", children: "WiseBook" }),
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-gray-400 text-xs", children: "ERP Next-Gen" })
|
|
1705
|
+
] })
|
|
1708
1706
|
] }),
|
|
1709
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
"transition-colors",
|
|
1731
|
-
isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
1732
|
-
), children: item.icon }),
|
|
1733
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(
|
|
1734
|
-
"flex-1 text-left text-sm font-medium",
|
|
1735
|
-
isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
1736
|
-
), children: item.label }),
|
|
1737
|
-
item.badge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-[var(--color-background)] rounded-full", children: item.badge })
|
|
1738
|
-
]
|
|
1739
|
-
}
|
|
1740
|
-
),
|
|
1741
|
-
isModuleActive(item.id) && secondaryMenuItems[item.id] && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bg-[var(--color-sidebar-submenu-bg)] py-2", children: secondaryMenuItems[item.id].map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1742
|
-
"button",
|
|
1743
|
-
{
|
|
1744
|
-
onClick: () => {
|
|
1745
|
-
if (subItem.path) {
|
|
1746
|
-
navigate(subItem.path);
|
|
1747
|
-
setMobileMenuOpen(false);
|
|
1748
|
-
}
|
|
1749
|
-
},
|
|
1750
|
-
className: cn(
|
|
1751
|
-
"w-full flex items-center gap-3 pl-12 pr-4 py-2 text-sm",
|
|
1752
|
-
"hover:bg-[var(--color-sidebar-hover)]",
|
|
1753
|
-
isActive(subItem.path || "") && "bg-[var(--color-sidebar-active)] text-[var(--color-primary)]"
|
|
1754
|
-
),
|
|
1755
|
-
children: [
|
|
1756
|
-
subItem.icon,
|
|
1757
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(
|
|
1758
|
-
isActive(subItem.path || "") ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
1759
|
-
), children: subItem.label })
|
|
1760
|
-
]
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1708
|
+
"button",
|
|
1709
|
+
{
|
|
1710
|
+
onClick: () => setMobileMenuOpen(false),
|
|
1711
|
+
className: "text-[var(--color-sidebar-text-secondary)]",
|
|
1712
|
+
"aria-label": "Fermer le menu",
|
|
1713
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.X, { className: "w-6 h-6" })
|
|
1714
|
+
}
|
|
1715
|
+
)
|
|
1716
|
+
] }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("nav", { className: "py-4", role: "menubar", children: primaryMenuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1718
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1719
|
+
"button",
|
|
1720
|
+
{
|
|
1721
|
+
onClick: () => {
|
|
1722
|
+
if (item.path) {
|
|
1723
|
+
navigate(item.path);
|
|
1724
|
+
setMobileMenuOpen(false);
|
|
1725
|
+
} else {
|
|
1726
|
+
setSelectedModule(item.id);
|
|
1727
|
+
}
|
|
1761
1728
|
},
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1729
|
+
className: cn(
|
|
1730
|
+
"w-full flex items-center gap-3 px-4 py-3 transition-all duration-200",
|
|
1731
|
+
"hover:bg-[var(--color-sidebar-hover)]",
|
|
1732
|
+
isModuleActive(item.id) && "bg-[var(--color-sidebar-active)] border-l-4 border-[var(--color-primary)]"
|
|
1733
|
+
),
|
|
1734
|
+
role: "menuitem",
|
|
1735
|
+
"aria-current": isModuleActive(item.id) ? "page" : void 0,
|
|
1736
|
+
children: [
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn(
|
|
1738
|
+
"transition-colors",
|
|
1739
|
+
isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
1740
|
+
), children: item.icon }),
|
|
1741
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(
|
|
1742
|
+
"flex-1 text-left text-sm font-medium",
|
|
1743
|
+
isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
1744
|
+
), children: item.label }),
|
|
1745
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-[var(--color-background)] rounded-full", children: item.badge })
|
|
1746
|
+
]
|
|
1747
|
+
}
|
|
1748
|
+
),
|
|
1749
|
+
isModuleActive(item.id) && secondaryMenuItems[item.id] && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bg-[var(--color-sidebar-submenu-bg)] py-2", children: secondaryMenuItems[item.id].map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1750
|
+
"button",
|
|
1751
|
+
{
|
|
1752
|
+
onClick: () => {
|
|
1753
|
+
if (subItem.path) {
|
|
1754
|
+
navigate(subItem.path);
|
|
1755
|
+
setMobileMenuOpen(false);
|
|
1756
|
+
}
|
|
1757
|
+
},
|
|
1758
|
+
className: cn(
|
|
1759
|
+
"w-full flex items-center gap-3 pl-12 pr-4 py-2 text-sm",
|
|
1760
|
+
"hover:bg-[var(--color-sidebar-hover)]",
|
|
1761
|
+
isActive(subItem.path || "") && "bg-[var(--color-sidebar-active)] text-[var(--color-primary)]"
|
|
1762
|
+
),
|
|
1763
|
+
children: [
|
|
1764
|
+
subItem.icon,
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(
|
|
1766
|
+
isActive(subItem.path || "") ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
1767
|
+
), children: subItem.label })
|
|
1768
|
+
]
|
|
1769
|
+
},
|
|
1770
|
+
subItem.id
|
|
1771
|
+
)) })
|
|
1772
|
+
] }, item.id)) })
|
|
1773
|
+
]
|
|
1774
|
+
}
|
|
1775
|
+
)
|
|
1776
|
+
] }),
|
|
1770
1777
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
|
|
1771
1778
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1772
1779
|
"header",
|
|
@@ -3748,7 +3755,7 @@ var useAlert = () => {
|
|
|
3748
3755
|
};
|
|
3749
3756
|
|
|
3750
3757
|
// src/components/common/CommonSelect.tsx
|
|
3751
|
-
var
|
|
3758
|
+
var import_react50 = require("react");
|
|
3752
3759
|
|
|
3753
3760
|
// src/services/VendorServices.ts
|
|
3754
3761
|
var VENDORS_API_URL = `${API_URL}/accounting/vendors/`;
|
|
@@ -3857,6 +3864,51 @@ var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
|
3857
3864
|
var import_react35 = require("react");
|
|
3858
3865
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3859
3866
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3867
|
+
var import_react_router_dom13 = require("react-router-dom");
|
|
3868
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3869
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
3870
|
+
var import_react_router_dom14 = require("react-router-dom");
|
|
3871
|
+
var import_lucide_react22 = require("lucide-react");
|
|
3872
|
+
var import_clsx4 = require("clsx");
|
|
3873
|
+
var import_tailwind_merge4 = require("tailwind-merge");
|
|
3874
|
+
var import_react37 = require("react");
|
|
3875
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3876
|
+
var import_react38 = require("react");
|
|
3877
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3878
|
+
var import_react39 = require("react");
|
|
3879
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3880
|
+
var import_react40 = require("react");
|
|
3881
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3882
|
+
var import_lucide_react23 = require("lucide-react");
|
|
3883
|
+
var import_react_router_dom15 = require("react-router-dom");
|
|
3884
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3885
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3886
|
+
var import_react41 = require("react");
|
|
3887
|
+
var import_lucide_react24 = require("lucide-react");
|
|
3888
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3889
|
+
var import_lucide_react25 = require("lucide-react");
|
|
3890
|
+
var import_react42 = require("react");
|
|
3891
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3892
|
+
var import_react43 = require("react");
|
|
3893
|
+
var import_react_router_dom16 = require("react-router-dom");
|
|
3894
|
+
var import_lucide_react26 = require("lucide-react");
|
|
3895
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3896
|
+
var import_react44 = require("react");
|
|
3897
|
+
var import_react45 = require("react");
|
|
3898
|
+
var import_lucide_react27 = require("lucide-react");
|
|
3899
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3900
|
+
var import_lucide_react28 = require("lucide-react");
|
|
3901
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3902
|
+
var import_react46 = require("react");
|
|
3903
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3904
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3905
|
+
var import_react47 = require("react");
|
|
3906
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3907
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
3908
|
+
var import_react48 = require("react");
|
|
3909
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3910
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
3911
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
3860
3912
|
var PrimaryButton2 = ({
|
|
3861
3913
|
loading = false,
|
|
3862
3914
|
children,
|
|
@@ -3961,14 +4013,30 @@ var USERS_API_URL22 = `${API_URL22}/core/users/`;
|
|
|
3961
4013
|
var ToastContext22 = (0, import_react27.createContext)(void 0);
|
|
3962
4014
|
var APPROVAL_API_URL22 = `${API_URL22}/approvals/cases/`;
|
|
3963
4015
|
var AlertContext22 = (0, import_react34.createContext)(void 0);
|
|
3964
|
-
var
|
|
3965
|
-
var
|
|
3966
|
-
var
|
|
3967
|
-
var
|
|
4016
|
+
var VENDORS_API_URL22 = `${API_URL22}/accounting/vendors/`;
|
|
4017
|
+
var ThemeContext222 = (0, import_react37.createContext)(void 0);
|
|
4018
|
+
var ADDRESS_IP222 = "localhost:8000";
|
|
4019
|
+
var ADDRESS_IP_URL222 = `http://${ADDRESS_IP222}/`;
|
|
4020
|
+
var API_URL222 = `${ADDRESS_IP_URL222}api`;
|
|
4021
|
+
var API_BASE_URL322 = `${API_URL222}/core/auth/`;
|
|
4022
|
+
var SessionContext222 = (0, import_react38.createContext)(void 0);
|
|
4023
|
+
var API_BASE_URL2222 = `${API_URL222}/core/auth/`;
|
|
4024
|
+
var USERS_API_URL222 = `${API_URL222}/core/users/`;
|
|
4025
|
+
var ToastContext222 = (0, import_react39.createContext)(void 0);
|
|
4026
|
+
var APPROVAL_API_URL222 = `${API_URL222}/approvals/cases/`;
|
|
4027
|
+
var AlertContext222 = (0, import_react46.createContext)(void 0);
|
|
4028
|
+
var URI = `${API_URL22}/core/departments/`;
|
|
4029
|
+
var URI2 = `${API_URL22}/accounting/profit-or-cost-center/`;
|
|
4030
|
+
var COST_URI = `${API_URL22}/accounting/cost-center/`;
|
|
4031
|
+
var PROFIT_URI = `${API_URL22}/accounting/profit-center/`;
|
|
4032
|
+
var URI3 = `${API_URL2}/core/departments/`;
|
|
4033
|
+
var URI4 = `${API_URL2}/accounting/profit-or-cost-center/`;
|
|
4034
|
+
var COST_URI2 = `${API_URL2}/accounting/cost-center/`;
|
|
4035
|
+
var PROFIT_URI2 = `${API_URL2}/accounting/profit-center/`;
|
|
3968
4036
|
|
|
3969
4037
|
// src/components/common/FormVendor.tsx
|
|
3970
|
-
var
|
|
3971
|
-
var
|
|
4038
|
+
var import_react49 = require("react");
|
|
4039
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
3972
4040
|
var MinimalVendorForm = ({
|
|
3973
4041
|
isOpen,
|
|
3974
4042
|
onClose,
|
|
@@ -3977,13 +4045,13 @@ var MinimalVendorForm = ({
|
|
|
3977
4045
|
refresh = () => {
|
|
3978
4046
|
}
|
|
3979
4047
|
}) => {
|
|
3980
|
-
const [formData, setFormData] = (0,
|
|
4048
|
+
const [formData, setFormData] = (0, import_react49.useState)(object || {
|
|
3981
4049
|
from_module: from ?? null,
|
|
3982
4050
|
legal_name: "",
|
|
3983
4051
|
trading_name: ""
|
|
3984
4052
|
});
|
|
3985
|
-
const [errors, setErrors] = (0,
|
|
3986
|
-
const [loading, setLoading] = (0,
|
|
4053
|
+
const [errors, setErrors] = (0, import_react49.useState)({});
|
|
4054
|
+
const [loading, setLoading] = (0, import_react49.useState)(false);
|
|
3987
4055
|
const { token } = useSession();
|
|
3988
4056
|
const { success, error: showError } = useToast();
|
|
3989
4057
|
const handleInputChange = (e) => {
|
|
@@ -4042,7 +4110,7 @@ var MinimalVendorForm = ({
|
|
|
4042
4110
|
}
|
|
4043
4111
|
};
|
|
4044
4112
|
if (!isOpen) return null;
|
|
4045
|
-
return /* @__PURE__ */ (0,
|
|
4113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4046
4114
|
Modals_default2,
|
|
4047
4115
|
{
|
|
4048
4116
|
title: "Ajouter un fournisseur",
|
|
@@ -4050,9 +4118,9 @@ var MinimalVendorForm = ({
|
|
|
4050
4118
|
description: ``,
|
|
4051
4119
|
open: isOpen,
|
|
4052
4120
|
onClose,
|
|
4053
|
-
children: /* @__PURE__ */ (0,
|
|
4054
|
-
/* @__PURE__ */ (0,
|
|
4055
|
-
/* @__PURE__ */ (0,
|
|
4121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("form", { onSubmit: handleSubmit, className: "p-", children: [
|
|
4122
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4056
4124
|
TextInput2,
|
|
4057
4125
|
{
|
|
4058
4126
|
label: "Raison sociale",
|
|
@@ -4064,7 +4132,7 @@ var MinimalVendorForm = ({
|
|
|
4064
4132
|
onChange: handleInputChange
|
|
4065
4133
|
}
|
|
4066
4134
|
),
|
|
4067
|
-
/* @__PURE__ */ (0,
|
|
4135
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4068
4136
|
TextInput2,
|
|
4069
4137
|
{
|
|
4070
4138
|
label: "Nom commercial",
|
|
@@ -4075,8 +4143,8 @@ var MinimalVendorForm = ({
|
|
|
4075
4143
|
}
|
|
4076
4144
|
)
|
|
4077
4145
|
] }) }),
|
|
4078
|
-
/* @__PURE__ */ (0,
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4146
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex justify-between pt-6 mt-8", children: [
|
|
4147
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4080
4148
|
"button",
|
|
4081
4149
|
{
|
|
4082
4150
|
type: "button",
|
|
@@ -4085,7 +4153,7 @@ var MinimalVendorForm = ({
|
|
|
4085
4153
|
children: "Annuler"
|
|
4086
4154
|
}
|
|
4087
4155
|
),
|
|
4088
|
-
/* @__PURE__ */ (0,
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4089
4157
|
Buttons_default2,
|
|
4090
4158
|
{
|
|
4091
4159
|
type: "button",
|
|
@@ -4101,43 +4169,43 @@ var MinimalVendorForm = ({
|
|
|
4101
4169
|
};
|
|
4102
4170
|
|
|
4103
4171
|
// src/services/DepartmentServices.ts
|
|
4104
|
-
var
|
|
4172
|
+
var URI5 = `${API_URL}/core/departments/`;
|
|
4105
4173
|
var DepartmentServices = {
|
|
4106
|
-
create: (data) => FetchApi.post(`${
|
|
4107
|
-
get: (id) => FetchApi.get(`${
|
|
4108
|
-
list: (params) => FetchApi.get(`${
|
|
4109
|
-
update: (id, data) => FetchApi.put(`${
|
|
4110
|
-
delete: (id) => FetchApi.delete(`${
|
|
4174
|
+
create: (data) => FetchApi.post(`${URI5}`, data),
|
|
4175
|
+
get: (id) => FetchApi.get(`${URI5}${id}/`),
|
|
4176
|
+
list: (params) => FetchApi.get(`${URI5}?${new URLSearchParams(params).toString()}`),
|
|
4177
|
+
update: (id, data) => FetchApi.put(`${URI5}${id}/`, data),
|
|
4178
|
+
delete: (id) => FetchApi.delete(`${URI5}${id}/`)
|
|
4111
4179
|
};
|
|
4112
4180
|
|
|
4113
4181
|
// src/services/ProfitCostsServices.ts
|
|
4114
|
-
var
|
|
4115
|
-
var
|
|
4182
|
+
var URI6 = `${API_URL}/accounting/profit-or-cost-center/`;
|
|
4183
|
+
var COST_URI3 = `${API_URL}/accounting/cost-center/`;
|
|
4116
4184
|
var CostServices = {
|
|
4117
|
-
create: (data) => FetchApi.post(`${
|
|
4118
|
-
get: (id) => FetchApi.get(`${
|
|
4119
|
-
list: (params) => FetchApi.get(`${
|
|
4120
|
-
update: (id, data) => FetchApi.put(`${
|
|
4121
|
-
delete: (id) => FetchApi.delete(`${
|
|
4185
|
+
create: (data) => FetchApi.post(`${COST_URI3}`, data),
|
|
4186
|
+
get: (id) => FetchApi.get(`${COST_URI3}${id}/`),
|
|
4187
|
+
list: (params) => FetchApi.get(`${COST_URI3}?${new URLSearchParams(params).toString()}`),
|
|
4188
|
+
update: (id, data) => FetchApi.put(`${COST_URI3}${id}/`, data),
|
|
4189
|
+
delete: (id) => FetchApi.delete(`${COST_URI3}${id}/`)
|
|
4122
4190
|
};
|
|
4123
|
-
var
|
|
4191
|
+
var PROFIT_URI3 = `${API_URL}/accounting/profit-center/`;
|
|
4124
4192
|
|
|
4125
4193
|
// src/components/common/CommonSelect.tsx
|
|
4126
|
-
var
|
|
4194
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4127
4195
|
var SelectVendor = ({
|
|
4128
4196
|
value,
|
|
4129
4197
|
onSelect
|
|
4130
4198
|
}) => {
|
|
4131
|
-
const [showModal, setShowModal] = (0,
|
|
4132
|
-
const [selectedVendor, setSelectedVendor] = (0,
|
|
4199
|
+
const [showModal, setShowModal] = (0, import_react50.useState)(false);
|
|
4200
|
+
const [selectedVendor, setSelectedVendor] = (0, import_react50.useState)(null);
|
|
4133
4201
|
const { token, activeBusinessEntity } = useSession();
|
|
4134
|
-
const [vendors, setVendors] = (0,
|
|
4202
|
+
const [vendors, setVendors] = (0, import_react50.useState)(() => {
|
|
4135
4203
|
const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4136
4204
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4137
4205
|
return cached ? JSON.parse(cached) : [];
|
|
4138
4206
|
});
|
|
4139
|
-
const [loadingVendors, setLoadingVendors] = (0,
|
|
4140
|
-
(0,
|
|
4207
|
+
const [loadingVendors, setLoadingVendors] = (0, import_react50.useState)(false);
|
|
4208
|
+
(0, import_react50.useEffect)(() => {
|
|
4141
4209
|
const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4142
4210
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4143
4211
|
if (!cached) {
|
|
@@ -4175,9 +4243,9 @@ var SelectVendor = ({
|
|
|
4175
4243
|
sessionStorage.removeItem(cacheKey);
|
|
4176
4244
|
loadVendors();
|
|
4177
4245
|
};
|
|
4178
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
-
/* @__PURE__ */ (0,
|
|
4180
|
-
/* @__PURE__ */ (0,
|
|
4246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
4247
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4181
4249
|
SearchableSelect,
|
|
4182
4250
|
{
|
|
4183
4251
|
value,
|
|
@@ -4193,8 +4261,8 @@ var SelectVendor = ({
|
|
|
4193
4261
|
},
|
|
4194
4262
|
"fourni" + value
|
|
4195
4263
|
),
|
|
4196
|
-
loadingVendors && /* @__PURE__ */ (0,
|
|
4197
|
-
showModal && /* @__PURE__ */ (0,
|
|
4264
|
+
loadingVendors && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des fournisseurs..." }),
|
|
4265
|
+
showModal && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4198
4266
|
MinimalVendorForm,
|
|
4199
4267
|
{
|
|
4200
4268
|
object: selectedVendor,
|
|
@@ -4211,13 +4279,13 @@ var SelectUser = ({
|
|
|
4211
4279
|
onSelect
|
|
4212
4280
|
}) => {
|
|
4213
4281
|
const { token, activeBusinessEntity } = useSession();
|
|
4214
|
-
const [users, setUsers] = (0,
|
|
4282
|
+
const [users, setUsers] = (0, import_react50.useState)(() => {
|
|
4215
4283
|
const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4216
4284
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4217
4285
|
return cached ? JSON.parse(cached) : [];
|
|
4218
4286
|
});
|
|
4219
|
-
const [loading, setLoading] = (0,
|
|
4220
|
-
(0,
|
|
4287
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
4288
|
+
(0, import_react50.useEffect)(() => {
|
|
4221
4289
|
const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4222
4290
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4223
4291
|
if (!cached) {
|
|
@@ -4253,19 +4321,19 @@ var SelectUser = ({
|
|
|
4253
4321
|
return users.map((user) => ({
|
|
4254
4322
|
value: user.id,
|
|
4255
4323
|
label: `${user.first_name} ${user.last_name}`,
|
|
4256
|
-
content: /* @__PURE__ */ (0,
|
|
4257
|
-
/* @__PURE__ */ (0,
|
|
4324
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex-1", children: [
|
|
4325
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "font-medium text-gray-900", children: [
|
|
4258
4326
|
user.first_name,
|
|
4259
4327
|
" ",
|
|
4260
4328
|
user.last_name
|
|
4261
4329
|
] }),
|
|
4262
|
-
/* @__PURE__ */ (0,
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "text-sm text-gray-500", children: user.email })
|
|
4263
4331
|
] }) })
|
|
4264
4332
|
}));
|
|
4265
4333
|
};
|
|
4266
|
-
return /* @__PURE__ */ (0,
|
|
4267
|
-
/* @__PURE__ */ (0,
|
|
4268
|
-
/* @__PURE__ */ (0,
|
|
4334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
|
|
4336
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4269
4337
|
SearchableSelect,
|
|
4270
4338
|
{
|
|
4271
4339
|
value,
|
|
@@ -4278,7 +4346,7 @@ var SelectUser = ({
|
|
|
4278
4346
|
},
|
|
4279
4347
|
"user" + value
|
|
4280
4348
|
),
|
|
4281
|
-
loading && /* @__PURE__ */ (0,
|
|
4349
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des utilisateurs..." })
|
|
4282
4350
|
] });
|
|
4283
4351
|
};
|
|
4284
4352
|
var SelectDepartment = ({
|
|
@@ -4286,13 +4354,13 @@ var SelectDepartment = ({
|
|
|
4286
4354
|
onSelect
|
|
4287
4355
|
}) => {
|
|
4288
4356
|
const { token, activeBusinessEntity } = useSession();
|
|
4289
|
-
const [departments, setDepartments] = (0,
|
|
4357
|
+
const [departments, setDepartments] = (0, import_react50.useState)(() => {
|
|
4290
4358
|
const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4291
4359
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4292
4360
|
return cached ? JSON.parse(cached) : [];
|
|
4293
4361
|
});
|
|
4294
|
-
const [loading, setLoading] = (0,
|
|
4295
|
-
(0,
|
|
4362
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
4363
|
+
(0, import_react50.useEffect)(() => {
|
|
4296
4364
|
const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4297
4365
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4298
4366
|
if (!cached) {
|
|
@@ -4328,9 +4396,9 @@ var SelectDepartment = ({
|
|
|
4328
4396
|
label: dept.name
|
|
4329
4397
|
}));
|
|
4330
4398
|
};
|
|
4331
|
-
return /* @__PURE__ */ (0,
|
|
4332
|
-
/* @__PURE__ */ (0,
|
|
4333
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4334
4402
|
SearchableSelect,
|
|
4335
4403
|
{
|
|
4336
4404
|
value,
|
|
@@ -4343,7 +4411,7 @@ var SelectDepartment = ({
|
|
|
4343
4411
|
},
|
|
4344
4412
|
"dept" + value
|
|
4345
4413
|
),
|
|
4346
|
-
loading && /* @__PURE__ */ (0,
|
|
4414
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des d\xE9partements..." })
|
|
4347
4415
|
] });
|
|
4348
4416
|
};
|
|
4349
4417
|
var SelectCostCenter = ({
|
|
@@ -4351,13 +4419,13 @@ var SelectCostCenter = ({
|
|
|
4351
4419
|
onSelect
|
|
4352
4420
|
}) => {
|
|
4353
4421
|
const { token, activeBusinessEntity } = useSession();
|
|
4354
|
-
const [costCenters, setCostCenters] = (0,
|
|
4422
|
+
const [costCenters, setCostCenters] = (0, import_react50.useState)(() => {
|
|
4355
4423
|
const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4356
4424
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4357
4425
|
return cached ? JSON.parse(cached) : [];
|
|
4358
4426
|
});
|
|
4359
|
-
const [loading, setLoading] = (0,
|
|
4360
|
-
(0,
|
|
4427
|
+
const [loading, setLoading] = (0, import_react50.useState)(false);
|
|
4428
|
+
(0, import_react50.useEffect)(() => {
|
|
4361
4429
|
const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
|
|
4362
4430
|
const cached = sessionStorage.getItem(cacheKey);
|
|
4363
4431
|
if (!cached) {
|
|
@@ -4391,18 +4459,18 @@ var SelectCostCenter = ({
|
|
|
4391
4459
|
return costCenters.map((center) => ({
|
|
4392
4460
|
value: center.id,
|
|
4393
4461
|
label: `${center.code ? `[${center.code}] ` : ""}${center.name}`,
|
|
4394
|
-
content: /* @__PURE__ */ (0,
|
|
4395
|
-
/* @__PURE__ */ (0,
|
|
4396
|
-
center.code && /* @__PURE__ */ (0,
|
|
4462
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex-1", children: [
|
|
4463
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "font-medium text-gray-900", children: center.name }),
|
|
4464
|
+
center.code && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "text-sm text-gray-500", children: [
|
|
4397
4465
|
"Code: ",
|
|
4398
4466
|
center.code
|
|
4399
4467
|
] })
|
|
4400
4468
|
] }) })
|
|
4401
4469
|
}));
|
|
4402
4470
|
};
|
|
4403
|
-
return /* @__PURE__ */ (0,
|
|
4404
|
-
/* @__PURE__ */ (0,
|
|
4405
|
-
/* @__PURE__ */ (0,
|
|
4471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex justify-between ", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4406
4474
|
SearchableSelect,
|
|
4407
4475
|
{
|
|
4408
4476
|
value,
|
|
@@ -4415,12 +4483,12 @@ var SelectCostCenter = ({
|
|
|
4415
4483
|
},
|
|
4416
4484
|
"cost" + value
|
|
4417
4485
|
),
|
|
4418
|
-
loading && /* @__PURE__ */ (0,
|
|
4486
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "text-sm text-gray-500 mt-2", children: "Chargement des centres de co\xFBt..." })
|
|
4419
4487
|
] });
|
|
4420
4488
|
};
|
|
4421
4489
|
|
|
4422
4490
|
// src/components/common/Choices.tsx
|
|
4423
|
-
var
|
|
4491
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4424
4492
|
var CHOICES = {
|
|
4425
4493
|
INVOICE_TYPES: [
|
|
4426
4494
|
{ value: "sale", label: { fr: "Vente", en: "Sale", default: "Sale" } },
|
|
@@ -4678,7 +4746,7 @@ var InvoiceTypeSelector = ({
|
|
|
4678
4746
|
value: item.value,
|
|
4679
4747
|
label: item.label[language]
|
|
4680
4748
|
}));
|
|
4681
|
-
return /* @__PURE__ */ (0,
|
|
4749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4682
4750
|
SearchableSelect,
|
|
4683
4751
|
{
|
|
4684
4752
|
value,
|
|
@@ -4701,7 +4769,7 @@ var PaymentMethodSelector = ({
|
|
|
4701
4769
|
value: item.value,
|
|
4702
4770
|
label: item.label[language]
|
|
4703
4771
|
}));
|
|
4704
|
-
return /* @__PURE__ */ (0,
|
|
4772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4705
4773
|
SearchableSelect,
|
|
4706
4774
|
{
|
|
4707
4775
|
value,
|
|
@@ -4724,7 +4792,7 @@ var TemplateFNESelector = ({
|
|
|
4724
4792
|
value: item.value,
|
|
4725
4793
|
label: item.label[language]
|
|
4726
4794
|
}));
|
|
4727
|
-
return /* @__PURE__ */ (0,
|
|
4795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4728
4796
|
SearchableSelect,
|
|
4729
4797
|
{
|
|
4730
4798
|
value,
|
|
@@ -4747,7 +4815,7 @@ var ForeignCurrencySelector = ({
|
|
|
4747
4815
|
value: item.value,
|
|
4748
4816
|
label: item.label[language]
|
|
4749
4817
|
}));
|
|
4750
|
-
return /* @__PURE__ */ (0,
|
|
4818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4751
4819
|
SearchableSelect,
|
|
4752
4820
|
{
|
|
4753
4821
|
value,
|
|
@@ -4771,7 +4839,7 @@ var TaxSelector = ({
|
|
|
4771
4839
|
value: item.value,
|
|
4772
4840
|
label: item.label[language]
|
|
4773
4841
|
}));
|
|
4774
|
-
return /* @__PURE__ */ (0,
|
|
4842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4775
4843
|
SearchableSelect,
|
|
4776
4844
|
{
|
|
4777
4845
|
value,
|
|
@@ -4799,7 +4867,7 @@ var LegalFormSelector = ({
|
|
|
4799
4867
|
value: item.value,
|
|
4800
4868
|
label: item.label[language] ?? item.label.default
|
|
4801
4869
|
}));
|
|
4802
|
-
return /* @__PURE__ */ (0,
|
|
4870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4803
4871
|
SearchableSelect,
|
|
4804
4872
|
{
|
|
4805
4873
|
value,
|
|
@@ -4822,7 +4890,7 @@ var CountrySelector = ({
|
|
|
4822
4890
|
value: item.value,
|
|
4823
4891
|
label: item.label[language]
|
|
4824
4892
|
}));
|
|
4825
|
-
return /* @__PURE__ */ (0,
|
|
4893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4826
4894
|
SearchableSelect,
|
|
4827
4895
|
{
|
|
4828
4896
|
value,
|