ptechcore_ui 1.0.6 → 1.0.9
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 +693 -330
- package/dist/index.d.cts +67 -12
- package/dist/index.d.ts +67 -12
- package/dist/index.js +645 -282
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
DateInput: () => DateInput,
|
|
33
|
+
FDrawer: () => FDrawer,
|
|
33
34
|
FileInput: () => FileInput,
|
|
34
35
|
InputField: () => InputField,
|
|
35
36
|
Modal: () => Modals_default,
|
|
@@ -264,7 +265,7 @@ var FileInput = ({
|
|
|
264
265
|
};
|
|
265
266
|
|
|
266
267
|
// src/components/layout/ModernDoubleSidebarLayout.tsx
|
|
267
|
-
var
|
|
268
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
268
269
|
var import_react_router_dom2 = require("react-router-dom");
|
|
269
270
|
var import_lucide_react = require("lucide-react");
|
|
270
271
|
|
|
@@ -643,21 +644,194 @@ var ThemeProvider = ({ children }) => {
|
|
|
643
644
|
};
|
|
644
645
|
var ThemeContext_default = ThemeProvider;
|
|
645
646
|
|
|
646
|
-
// src/
|
|
647
|
+
// src/contexts/SessionContext.tsx
|
|
648
|
+
var import_react2 = require("react");
|
|
649
|
+
|
|
650
|
+
// src/services/api.ts
|
|
651
|
+
var ADDRESS_IP = "localhost:8000";
|
|
652
|
+
var ADDRESS_IP_URL = `http://${ADDRESS_IP}/`;
|
|
653
|
+
var API_URL = `${ADDRESS_IP_URL}api`;
|
|
654
|
+
var FetchApi = class {
|
|
655
|
+
static async post(url, payload, token) {
|
|
656
|
+
const headers = {
|
|
657
|
+
"Content-Type": "application/json"
|
|
658
|
+
};
|
|
659
|
+
if (token) {
|
|
660
|
+
headers["Authorization"] = `Token ${token}`;
|
|
661
|
+
}
|
|
662
|
+
const res = await fetch(url, {
|
|
663
|
+
method: "POST",
|
|
664
|
+
headers,
|
|
665
|
+
body: payload ? JSON.stringify(payload) : void 0
|
|
666
|
+
});
|
|
667
|
+
if (!res.ok) throw new Error(await res.text());
|
|
668
|
+
return res.json();
|
|
669
|
+
}
|
|
670
|
+
static async get(url, token) {
|
|
671
|
+
const headers = {};
|
|
672
|
+
if (token) {
|
|
673
|
+
headers["Authorization"] = `Token ${token}`;
|
|
674
|
+
}
|
|
675
|
+
const res = await fetch(url, {
|
|
676
|
+
method: "GET",
|
|
677
|
+
headers
|
|
678
|
+
});
|
|
679
|
+
if (!res.ok) throw new Error(await res.text());
|
|
680
|
+
return res.json();
|
|
681
|
+
}
|
|
682
|
+
static async put(url, payload, token) {
|
|
683
|
+
const headers = {
|
|
684
|
+
"Content-Type": "application/json"
|
|
685
|
+
};
|
|
686
|
+
if (token) {
|
|
687
|
+
headers["Authorization"] = `Token ${token}`;
|
|
688
|
+
}
|
|
689
|
+
const res = await fetch(url, {
|
|
690
|
+
method: "PUT",
|
|
691
|
+
headers,
|
|
692
|
+
body: payload ? JSON.stringify(payload) : void 0
|
|
693
|
+
});
|
|
694
|
+
if (!res.ok) throw new Error(await res.text());
|
|
695
|
+
return res.json();
|
|
696
|
+
}
|
|
697
|
+
static async delete(url, token) {
|
|
698
|
+
const headers = {};
|
|
699
|
+
if (token) {
|
|
700
|
+
headers["Authorization"] = `Token ${token}`;
|
|
701
|
+
}
|
|
702
|
+
const res = await fetch(url, {
|
|
703
|
+
method: "DELETE",
|
|
704
|
+
headers
|
|
705
|
+
});
|
|
706
|
+
if (!res.ok) throw new Error(await res.text());
|
|
707
|
+
return res.json();
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// src/services/AuthServices.ts
|
|
712
|
+
var API_BASE_URL = `${API_URL}/core/auth/`;
|
|
713
|
+
var FetchApi2 = class {
|
|
714
|
+
static async post(url, payload, token) {
|
|
715
|
+
const headers = {
|
|
716
|
+
"Content-Type": "application/json"
|
|
717
|
+
};
|
|
718
|
+
if (token) {
|
|
719
|
+
headers["Authorization"] = `Token ${token}`;
|
|
720
|
+
}
|
|
721
|
+
const res = await fetch(url, {
|
|
722
|
+
method: "POST",
|
|
723
|
+
headers,
|
|
724
|
+
body: payload ? JSON.stringify(payload) : void 0
|
|
725
|
+
});
|
|
726
|
+
if (!res.ok) throw new Error(await res.text());
|
|
727
|
+
return res.json();
|
|
728
|
+
}
|
|
729
|
+
static async get(url, token) {
|
|
730
|
+
const headers = {};
|
|
731
|
+
if (token) {
|
|
732
|
+
headers["Authorization"] = `Token ${token}`;
|
|
733
|
+
}
|
|
734
|
+
const res = await fetch(url, {
|
|
735
|
+
method: "GET",
|
|
736
|
+
headers
|
|
737
|
+
});
|
|
738
|
+
if (!res.ok) throw new Error(await res.text());
|
|
739
|
+
return res.json();
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var AuthServices = {
|
|
743
|
+
sendOtp: (payload) => FetchApi2.post(`${API_BASE_URL}send-otp/`, payload),
|
|
744
|
+
verifyOtp: (payload) => FetchApi2.post(`${API_BASE_URL}verify-otp/`, payload),
|
|
745
|
+
completeRegistration: (payload) => FetchApi2.post(`${API_BASE_URL}complete-registration/`, payload),
|
|
746
|
+
getInvitations: (token) => FetchApi2.get(`${API_BASE_URL}invitations/?token=${token}`),
|
|
747
|
+
respondInvitationEmail: (payload) => FetchApi2.post(`${API_BASE_URL}respond-invitation-email/`, payload),
|
|
748
|
+
change_password: (payload) => FetchApi2.post(`${API_BASE_URL}change-password/`, payload),
|
|
749
|
+
addUser: (payload) => FetchApi2.post(`${API_BASE_URL}add-user/`, payload),
|
|
750
|
+
login: (payload) => FetchApi2.post(`${API_BASE_URL}login/`, payload),
|
|
751
|
+
getUserInformations: (token) => FetchApi2.get(`${API_BASE_URL}user-informations/`, token),
|
|
752
|
+
logout: () => FetchApi2.post(`${API_BASE_URL}logout/`)
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
// src/contexts/SessionContext.tsx
|
|
647
756
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
757
|
+
var SessionContext = (0, import_react2.createContext)(void 0);
|
|
758
|
+
var useSession = () => {
|
|
759
|
+
const context = (0, import_react2.useContext)(SessionContext);
|
|
760
|
+
if (!context) {
|
|
761
|
+
throw new Error("useSession must be used within a SessionProvider");
|
|
762
|
+
}
|
|
763
|
+
return context;
|
|
764
|
+
};
|
|
765
|
+
var SessionProvider = ({ children }) => {
|
|
766
|
+
const [token, setToken] = (0, import_react2.useState)(localStorage.getItem("token"));
|
|
767
|
+
const [loggedUser, setLoggedUser] = (0, import_react2.useState)(null);
|
|
768
|
+
const [activeBusinessEntity, setActiveBusinessEntity] = (0, import_react2.useState)(null);
|
|
769
|
+
const saved_center_id = localStorage.getItem("active_center_id") || "";
|
|
770
|
+
(0, import_react2.useEffect)(() => {
|
|
771
|
+
const storedToken = localStorage.getItem("token");
|
|
772
|
+
if (storedToken) {
|
|
773
|
+
setToken(storedToken);
|
|
774
|
+
}
|
|
775
|
+
}, []);
|
|
776
|
+
const login = (newToken) => {
|
|
777
|
+
localStorage.setItem("token", newToken);
|
|
778
|
+
setToken(newToken);
|
|
779
|
+
};
|
|
780
|
+
const logout = () => {
|
|
781
|
+
localStorage.removeItem("token");
|
|
782
|
+
setToken(null);
|
|
783
|
+
};
|
|
784
|
+
(0, import_react2.useEffect)(() => {
|
|
785
|
+
if (token) {
|
|
786
|
+
AuthServices.getUserInformations(token).then((res) => {
|
|
787
|
+
const result = res;
|
|
788
|
+
if (result.success === true) {
|
|
789
|
+
setLoggedUser(result.data.user);
|
|
790
|
+
setActiveBusinessEntity(result.data.user.centers_access.find((item) => parseInt(item.id) === parseInt(saved_center_id)) || result.data.user.centers_access[0] || null);
|
|
791
|
+
} else {
|
|
792
|
+
setLoggedUser(null);
|
|
793
|
+
}
|
|
794
|
+
}).catch(() => setLoggedUser(null));
|
|
795
|
+
} else {
|
|
796
|
+
setLoggedUser(null);
|
|
797
|
+
}
|
|
798
|
+
}, [token]);
|
|
799
|
+
(0, import_react2.useEffect)(() => {
|
|
800
|
+
if (activeBusinessEntity) {
|
|
801
|
+
localStorage.setItem("active_center_id", activeBusinessEntity.id.toString());
|
|
802
|
+
}
|
|
803
|
+
}, [activeBusinessEntity]);
|
|
804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SessionContext.Provider, { value: {
|
|
805
|
+
isAuthenticated: !!token,
|
|
806
|
+
loggedUser,
|
|
807
|
+
activeBusinessEntity,
|
|
808
|
+
setActiveBusinessEntity,
|
|
809
|
+
token,
|
|
810
|
+
login,
|
|
811
|
+
logout
|
|
812
|
+
}, children });
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
// src/components/layout/ModernDoubleSidebarLayout.tsx
|
|
816
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
648
817
|
var RewiseLayout = ({ children, module_name = "Rewise", module_description = "Description du module", primaryMenuItems, secondaryMenuItems }) => {
|
|
649
818
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
650
819
|
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
651
820
|
const { theme, themeType, setTheme } = useTheme();
|
|
652
|
-
const
|
|
653
|
-
const [
|
|
654
|
-
const [
|
|
655
|
-
const [
|
|
656
|
-
const [
|
|
657
|
-
const [
|
|
658
|
-
const [
|
|
659
|
-
const [
|
|
660
|
-
const [
|
|
821
|
+
const { loggedUser, activeBusinessEntity, setActiveBusinessEntity } = useSession();
|
|
822
|
+
const [primaryCollapsed, setPrimaryCollapsed] = (0, import_react3.useState)(false);
|
|
823
|
+
const [secondaryCollapsed, setSecondaryCollapsed] = (0, import_react3.useState)(false);
|
|
824
|
+
const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react3.useState)(false);
|
|
825
|
+
const [selectedModule, setSelectedModule] = (0, import_react3.useState)("dashboard");
|
|
826
|
+
const [searchQuery, setSearchQuery] = (0, import_react3.useState)("");
|
|
827
|
+
const [showNotifications, setShowNotifications] = (0, import_react3.useState)(false);
|
|
828
|
+
const [showUserMenu, setShowUserMenu] = (0, import_react3.useState)(false);
|
|
829
|
+
const [showThemeMenu, setShowThemeMenu] = (0, import_react3.useState)(false);
|
|
830
|
+
const [showCenterMenu, setShowCenterMenu] = (0, import_react3.useState)(false);
|
|
831
|
+
const [selectedCenterId, setSelectedCenterId] = (0, import_react3.useState)(
|
|
832
|
+
loggedUser?.centers_access?.[0]?.id || null
|
|
833
|
+
);
|
|
834
|
+
const [notifications, setNotifications] = (0, import_react3.useState)([
|
|
661
835
|
{
|
|
662
836
|
id: "1",
|
|
663
837
|
title: "Nouvelle facture",
|
|
@@ -675,7 +849,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
675
849
|
read: false
|
|
676
850
|
}
|
|
677
851
|
]);
|
|
678
|
-
(0,
|
|
852
|
+
(0, import_react3.useEffect)(() => {
|
|
679
853
|
const handleKeyDown = (e) => {
|
|
680
854
|
if (e.altKey && e.key === "m") {
|
|
681
855
|
e.preventDefault();
|
|
@@ -695,7 +869,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
695
869
|
document.addEventListener("keydown", handleKeyDown);
|
|
696
870
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
697
871
|
}, []);
|
|
698
|
-
(0,
|
|
872
|
+
(0, import_react3.useEffect)(() => {
|
|
699
873
|
const path = location.pathname;
|
|
700
874
|
const moduleMatch = path.match(/^\/([^/]+)/);
|
|
701
875
|
if (moduleMatch) {
|
|
@@ -730,8 +904,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
730
904
|
(prev) => prev.map((n) => n.id === id ? { ...n, read: true } : n)
|
|
731
905
|
);
|
|
732
906
|
};
|
|
733
|
-
return /* @__PURE__ */ (0,
|
|
734
|
-
/* @__PURE__ */ (0,
|
|
907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex h-screen bg-[var(--color-background)] overflow-hidden", children: [
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
735
909
|
"a",
|
|
736
910
|
{
|
|
737
911
|
href: "#main-content",
|
|
@@ -739,7 +913,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
739
913
|
children: "Aller au contenu principal"
|
|
740
914
|
}
|
|
741
915
|
),
|
|
742
|
-
/* @__PURE__ */ (0,
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
743
917
|
"aside",
|
|
744
918
|
{
|
|
745
919
|
className: cn(
|
|
@@ -749,38 +923,38 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
749
923
|
role: "navigation",
|
|
750
924
|
"aria-label": "Navigation principale",
|
|
751
925
|
children: [
|
|
752
|
-
/* @__PURE__ */ (0,
|
|
753
|
-
/* @__PURE__ */ (0,
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "h-16 flex items-center justify-between px-4 border-b border-[var(--color-sidebar-border)]", children: [
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn(
|
|
754
928
|
"flex items-center gap-3",
|
|
755
929
|
primaryCollapsed && "justify-center"
|
|
756
930
|
), children: [
|
|
757
|
-
/* @__PURE__ */ (0,
|
|
758
|
-
!primaryCollapsed && /* @__PURE__ */ (0,
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
|
|
932
|
+
!primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { className: "text-[var(--color-sidebar-text)] font-bold text-lg", children: module_name }),
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-[var(--color-sidebar-text-secondary)] text-xs", children: module_description })
|
|
761
935
|
] })
|
|
762
936
|
] }),
|
|
763
|
-
/* @__PURE__ */ (0,
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
764
938
|
"button",
|
|
765
939
|
{
|
|
766
940
|
onClick: () => setPrimaryCollapsed(!primaryCollapsed),
|
|
767
941
|
className: "text-[var(--color-sidebar-text-secondary)] hover:text-[var(--color-sidebar-text)] transition-colors",
|
|
768
942
|
"aria-label": primaryCollapsed ? "D\xE9velopper le menu" : "R\xE9duire le menu",
|
|
769
943
|
"aria-expanded": !primaryCollapsed,
|
|
770
|
-
children: /* @__PURE__ */ (0,
|
|
944
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronLeft, { className: cn(
|
|
771
945
|
"w-5 h-5 transition-transform",
|
|
772
946
|
primaryCollapsed && "rotate-180"
|
|
773
947
|
) })
|
|
774
948
|
}
|
|
775
949
|
)
|
|
776
950
|
] }),
|
|
777
|
-
/* @__PURE__ */ (0,
|
|
951
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
778
952
|
"nav",
|
|
779
953
|
{
|
|
780
954
|
className: "flex-1 py-4 overflow-y-auto",
|
|
781
955
|
role: "menubar",
|
|
782
956
|
"aria-label": "Modules principaux",
|
|
783
|
-
children: primaryMenuItems.map((item) => /* @__PURE__ */ (0,
|
|
957
|
+
children: primaryMenuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
784
958
|
"button",
|
|
785
959
|
{
|
|
786
960
|
onClick: () => {
|
|
@@ -800,48 +974,48 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
800
974
|
"aria-label": item.ariaLabel || item.label,
|
|
801
975
|
"aria-current": isModuleActive(item.id) ? "page" : void 0,
|
|
802
976
|
children: [
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(
|
|
804
978
|
"transition-colors",
|
|
805
979
|
isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)] group-hover:text-[var(--color-sidebar-text)]"
|
|
806
980
|
), children: item.icon }),
|
|
807
|
-
!primaryCollapsed && /* @__PURE__ */ (0,
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
981
|
+
!primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn(
|
|
809
983
|
"flex-1 text-left text-sm font-medium transition-colors",
|
|
810
984
|
isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)] group-hover:text-[var(--color-sidebar-text)]"
|
|
811
985
|
), children: item.label }),
|
|
812
|
-
item.badge && /* @__PURE__ */ (0,
|
|
986
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-[var(--color-background)] rounded-full", children: item.badge })
|
|
813
987
|
] }),
|
|
814
|
-
primaryCollapsed && /* @__PURE__ */ (0,
|
|
988
|
+
primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute left-full ml-2 px-2 py-1 bg-[var(--color-sidebar-active)] text-[var(--color-sidebar-text)] text-xs rounded opacity-0 group-hover:opacity-100 pointer-events-none whitespace-nowrap z-50", children: item.label })
|
|
815
989
|
]
|
|
816
990
|
},
|
|
817
991
|
item.id
|
|
818
992
|
))
|
|
819
993
|
}
|
|
820
994
|
),
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "p-4 border-t border-[var(--color-sidebar-border)]", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn(
|
|
822
996
|
"flex items-center gap-3",
|
|
823
997
|
primaryCollapsed && "justify-center"
|
|
824
998
|
), children: [
|
|
825
|
-
/* @__PURE__ */ (0,
|
|
826
|
-
!primaryCollapsed && /* @__PURE__ */ (0,
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
828
|
-
/* @__PURE__ */ (0,
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.User, { className: "w-5 h-5 text-[var(--color-background)]" }) }),
|
|
1000
|
+
!primaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1", children: [
|
|
1001
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm font-medium text-[var(--color-sidebar-text)]", children: loggedUser?.first_name && loggedUser?.last_name ? `${loggedUser.first_name} ${loggedUser.last_name}` : loggedUser?.username || "Utilisateur" }),
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-sidebar-text-secondary)]", children: loggedUser?.email || "email@example.com" })
|
|
829
1003
|
] })
|
|
830
1004
|
] }) })
|
|
831
1005
|
]
|
|
832
1006
|
}
|
|
833
1007
|
),
|
|
834
|
-
secondaryMenuItems[selectedModule] && /* @__PURE__ */ (0,
|
|
835
|
-
secondaryCollapsed && /* @__PURE__ */ (0,
|
|
1008
|
+
secondaryMenuItems[selectedModule] && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1009
|
+
secondaryCollapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
836
1010
|
"button",
|
|
837
1011
|
{
|
|
838
1012
|
onClick: () => setSecondaryCollapsed(false),
|
|
839
1013
|
className: "hidden lg:flex items-center justify-center w-12 h-full bg-[var(--color-background)] border-r border-[var(--color-border)] hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
840
1014
|
"aria-label": "Ouvrir le sous-menu",
|
|
841
|
-
children: /* @__PURE__ */ (0,
|
|
1015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronRight, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
|
|
842
1016
|
}
|
|
843
1017
|
),
|
|
844
|
-
/* @__PURE__ */ (0,
|
|
1018
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
845
1019
|
"aside",
|
|
846
1020
|
{
|
|
847
1021
|
className: cn(
|
|
@@ -851,28 +1025,28 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
851
1025
|
role: "navigation",
|
|
852
1026
|
"aria-label": "Navigation secondaire",
|
|
853
1027
|
children: [
|
|
854
|
-
/* @__PURE__ */ (0,
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
856
|
-
/* @__PURE__ */ (0,
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "h-16 flex items-center justify-between px-4 border-b border-[var(--color-border)]", children: [
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "text-sm font-semibold text-[var(--color-text-secondary)] uppercase tracking-wider whitespace-nowrap", children: primaryMenuItems.find((item) => item.id === selectedModule)?.label }),
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
857
1031
|
"button",
|
|
858
1032
|
{
|
|
859
1033
|
onClick: () => setSecondaryCollapsed(!secondaryCollapsed),
|
|
860
1034
|
className: "text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)] flex-shrink-0",
|
|
861
1035
|
"aria-label": secondaryCollapsed ? "D\xE9velopper le sous-menu" : "R\xE9duire le sous-menu",
|
|
862
|
-
children: /* @__PURE__ */ (0,
|
|
1036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronLeft, { className: cn(
|
|
863
1037
|
"w-4 h-4 transition-transform",
|
|
864
1038
|
secondaryCollapsed && "rotate-180"
|
|
865
1039
|
) })
|
|
866
1040
|
}
|
|
867
1041
|
)
|
|
868
1042
|
] }),
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
870
1044
|
"nav",
|
|
871
1045
|
{
|
|
872
1046
|
className: "flex-1 py-4 overflow-y-auto",
|
|
873
1047
|
role: "menu",
|
|
874
1048
|
"aria-label": "Sous-navigation",
|
|
875
|
-
children: secondaryMenuItems[selectedModule]?.map((item) => /* @__PURE__ */ (0,
|
|
1049
|
+
children: secondaryMenuItems[selectedModule]?.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
876
1050
|
"button",
|
|
877
1051
|
{
|
|
878
1052
|
onClick: () => item.path && navigate(item.path),
|
|
@@ -884,15 +1058,15 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
884
1058
|
role: "menuitem",
|
|
885
1059
|
"aria-current": isActive(item.path || "") ? "page" : void 0,
|
|
886
1060
|
children: [
|
|
887
|
-
item.icon && /* @__PURE__ */ (0,
|
|
1061
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(
|
|
888
1062
|
"transition-colors",
|
|
889
1063
|
isActive(item.path || "") ? "text-[var(--color-primary)]" : "text-[var(--color-text-tertiary)]"
|
|
890
1064
|
), children: item.icon }),
|
|
891
|
-
/* @__PURE__ */ (0,
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn(
|
|
892
1066
|
"flex-1 text-left text-sm",
|
|
893
1067
|
isActive(item.path || "") ? "text-[var(--color-primary)] font-medium" : "text-[var(--color-text-secondary)]"
|
|
894
1068
|
), children: item.label }),
|
|
895
|
-
item.badge && /* @__PURE__ */ (0,
|
|
1069
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-white rounded-full", children: item.badge })
|
|
896
1070
|
]
|
|
897
1071
|
},
|
|
898
1072
|
item.id
|
|
@@ -903,13 +1077,13 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
903
1077
|
}
|
|
904
1078
|
)
|
|
905
1079
|
] }),
|
|
906
|
-
mobileMenuOpen && /* @__PURE__ */ (0,
|
|
1080
|
+
mobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
907
1081
|
"div",
|
|
908
1082
|
{
|
|
909
1083
|
className: "fixed inset-0 bg-black bg-opacity-50 z-50 lg:hidden",
|
|
910
1084
|
onClick: () => setMobileMenuOpen(false),
|
|
911
1085
|
"aria-hidden": "true",
|
|
912
|
-
children: /* @__PURE__ */ (0,
|
|
1086
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
913
1087
|
"aside",
|
|
914
1088
|
{
|
|
915
1089
|
className: "w-80 h-full bg-[var(--color-sidebar-bg)]",
|
|
@@ -917,26 +1091,26 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
917
1091
|
role: "navigation",
|
|
918
1092
|
"aria-label": "Navigation mobile",
|
|
919
1093
|
children: [
|
|
920
|
-
/* @__PURE__ */ (0,
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
924
|
-
/* @__PURE__ */ (0,
|
|
925
|
-
/* @__PURE__ */ (0,
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "h-16 flex items-center justify-between px-4 border-b border-[var(--color-sidebar-border)]", children: [
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1096
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-10 h-10 bg-[var(--color-primary)] rounded-lg flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[var(--color-background)] font-bold text-xl", children: "W" }) }),
|
|
1097
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { className: "text-white font-bold text-lg", children: "WiseBook" }),
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-gray-400 text-xs", children: "ERP Next-Gen" })
|
|
926
1100
|
] })
|
|
927
1101
|
] }),
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
929
1103
|
"button",
|
|
930
1104
|
{
|
|
931
1105
|
onClick: () => setMobileMenuOpen(false),
|
|
932
1106
|
className: "text-[var(--color-sidebar-text-secondary)]",
|
|
933
1107
|
"aria-label": "Fermer le menu",
|
|
934
|
-
children: /* @__PURE__ */ (0,
|
|
1108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.X, { className: "w-6 h-6" })
|
|
935
1109
|
}
|
|
936
1110
|
)
|
|
937
1111
|
] }),
|
|
938
|
-
/* @__PURE__ */ (0,
|
|
939
|
-
/* @__PURE__ */ (0,
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { className: "py-4", role: "menubar", children: primaryMenuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
940
1114
|
"button",
|
|
941
1115
|
{
|
|
942
1116
|
onClick: () => {
|
|
@@ -955,19 +1129,19 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
955
1129
|
role: "menuitem",
|
|
956
1130
|
"aria-current": isModuleActive(item.id) ? "page" : void 0,
|
|
957
1131
|
children: [
|
|
958
|
-
/* @__PURE__ */ (0,
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(
|
|
959
1133
|
"transition-colors",
|
|
960
1134
|
isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
961
1135
|
), children: item.icon }),
|
|
962
|
-
/* @__PURE__ */ (0,
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn(
|
|
963
1137
|
"flex-1 text-left text-sm font-medium",
|
|
964
1138
|
isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
965
1139
|
), children: item.label }),
|
|
966
|
-
item.badge && /* @__PURE__ */ (0,
|
|
1140
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "px-2 py-0.5 text-xs bg-[var(--color-primary)] text-[var(--color-background)] rounded-full", children: item.badge })
|
|
967
1141
|
]
|
|
968
1142
|
}
|
|
969
1143
|
),
|
|
970
|
-
isModuleActive(item.id) && secondaryMenuItems[item.id] && /* @__PURE__ */ (0,
|
|
1144
|
+
isModuleActive(item.id) && secondaryMenuItems[item.id] && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "bg-[var(--color-sidebar-submenu-bg)] py-2", children: secondaryMenuItems[item.id].map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
971
1145
|
"button",
|
|
972
1146
|
{
|
|
973
1147
|
onClick: () => {
|
|
@@ -983,7 +1157,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
983
1157
|
),
|
|
984
1158
|
children: [
|
|
985
1159
|
subItem.icon,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn(
|
|
987
1161
|
isActive(subItem.path || "") ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)]"
|
|
988
1162
|
), children: subItem.label })
|
|
989
1163
|
]
|
|
@@ -996,31 +1170,31 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
996
1170
|
)
|
|
997
1171
|
}
|
|
998
1172
|
),
|
|
999
|
-
/* @__PURE__ */ (0,
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
|
|
1174
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1001
1175
|
"header",
|
|
1002
1176
|
{
|
|
1003
1177
|
className: "h-14 bg-[var(--color-background)] border-b border-[var(--color-border)] flex items-center justify-between px-3 lg:px-4",
|
|
1004
1178
|
role: "banner",
|
|
1005
1179
|
children: [
|
|
1006
|
-
/* @__PURE__ */ (0,
|
|
1007
|
-
/* @__PURE__ */ (0,
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-4 flex-1", children: [
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1008
1182
|
"button",
|
|
1009
1183
|
{
|
|
1010
1184
|
onClick: () => setMobileMenuOpen(true),
|
|
1011
1185
|
className: "lg:hidden text-[var(--color-text-primary)]",
|
|
1012
1186
|
"aria-label": "Ouvrir le menu mobile",
|
|
1013
|
-
children: /* @__PURE__ */ (0,
|
|
1187
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Menu, { className: "w-6 h-6" })
|
|
1014
1188
|
}
|
|
1015
1189
|
),
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1190
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1017
1191
|
"nav",
|
|
1018
1192
|
{
|
|
1019
1193
|
className: "hidden sm:flex items-center gap-2 text-sm",
|
|
1020
1194
|
"aria-label": "Fil d'Ariane",
|
|
1021
|
-
children: getBreadcrumbs().map((crumb, index) => /* @__PURE__ */ (0,
|
|
1022
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
1023
|
-
/* @__PURE__ */ (0,
|
|
1195
|
+
children: getBreadcrumbs().map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react3.default.Fragment, { children: [
|
|
1196
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }),
|
|
1197
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1024
1198
|
"button",
|
|
1025
1199
|
{
|
|
1026
1200
|
onClick: () => navigate(crumb.path),
|
|
@@ -1034,9 +1208,9 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1034
1208
|
] }, crumb.path))
|
|
1035
1209
|
}
|
|
1036
1210
|
),
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative max-w-md flex-1 hidden lg:block", children: [
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-[var(--color-text-tertiary)] w-5 h-5" }),
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1040
1214
|
"input",
|
|
1041
1215
|
{
|
|
1042
1216
|
id: "global-search",
|
|
@@ -1050,9 +1224,69 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1050
1224
|
)
|
|
1051
1225
|
] })
|
|
1052
1226
|
] }),
|
|
1053
|
-
/* @__PURE__ */ (0,
|
|
1054
|
-
/* @__PURE__ */ (0,
|
|
1055
|
-
/* @__PURE__ */ (0,
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1228
|
+
loggedUser?.centers_access && loggedUser.centers_access.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1230
|
+
"button",
|
|
1231
|
+
{
|
|
1232
|
+
onClick: () => setShowCenterMenu(!showCenterMenu),
|
|
1233
|
+
className: "flex items-center gap-2 px-3 py-1.5 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)] hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
1234
|
+
title: "S\xE9lectionner un centre",
|
|
1235
|
+
"aria-label": "S\xE9lecteur de centre",
|
|
1236
|
+
"aria-expanded": showCenterMenu,
|
|
1237
|
+
children: [
|
|
1238
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Building2, { className: "w-4 h-4 text-[var(--color-primary)]" }),
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)] hidden sm:block", children: loggedUser.centers_access.find((c) => c.id === activeBusinessEntity?.id)?.legal_name || "S\xE9lectionner" }),
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronRight, { className: cn(
|
|
1241
|
+
"w-4 h-4 text-[var(--color-text-tertiary)] transition-transform",
|
|
1242
|
+
showCenterMenu && "rotate-90"
|
|
1243
|
+
) })
|
|
1244
|
+
]
|
|
1245
|
+
}
|
|
1246
|
+
),
|
|
1247
|
+
showCenterMenu && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1248
|
+
"div",
|
|
1249
|
+
{
|
|
1250
|
+
className: "absolute right-0 mt-2 w-64 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-80 overflow-y-auto",
|
|
1251
|
+
role: "menu",
|
|
1252
|
+
"aria-label": "S\xE9lection du centre",
|
|
1253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "p-2", children: [
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "px-3 py-2 text-xs font-semibold text-[var(--color-text-tertiary)] uppercase", children: "Centres disponibles" }),
|
|
1255
|
+
loggedUser.centers_access.map((center) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1256
|
+
"button",
|
|
1257
|
+
{
|
|
1258
|
+
onClick: () => {
|
|
1259
|
+
setActiveBusinessEntity(center);
|
|
1260
|
+
setSelectedCenterId(center.id);
|
|
1261
|
+
setShowCenterMenu(false);
|
|
1262
|
+
},
|
|
1263
|
+
className: cn(
|
|
1264
|
+
"w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
1265
|
+
selectedCenterId === center.id && "bg-[var(--color-primary-light)] border-l-2 border-[var(--color-primary)]"
|
|
1266
|
+
),
|
|
1267
|
+
role: "menuitem",
|
|
1268
|
+
children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Building2, { className: cn(
|
|
1270
|
+
"w-5 h-5",
|
|
1271
|
+
selectedCenterId === center.id ? "text-[var(--color-primary)]" : "text-[var(--color-text-tertiary)]"
|
|
1272
|
+
) }),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-left flex-1", children: [
|
|
1274
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: cn(
|
|
1275
|
+
"text-sm font-medium",
|
|
1276
|
+
selectedCenterId === center.id ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"
|
|
1277
|
+
), children: center.legal_name }),
|
|
1278
|
+
center.trading_name && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: center.trading_name })
|
|
1279
|
+
] })
|
|
1280
|
+
]
|
|
1281
|
+
},
|
|
1282
|
+
center.id
|
|
1283
|
+
))
|
|
1284
|
+
] })
|
|
1285
|
+
}
|
|
1286
|
+
)
|
|
1287
|
+
] }),
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1056
1290
|
"button",
|
|
1057
1291
|
{
|
|
1058
1292
|
onClick: () => setShowThemeMenu(!showThemeMenu),
|
|
@@ -1060,18 +1294,18 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1060
1294
|
title: "Changer le th\xE8me",
|
|
1061
1295
|
"aria-label": "S\xE9lecteur de th\xE8me",
|
|
1062
1296
|
"aria-expanded": showThemeMenu,
|
|
1063
|
-
children: /* @__PURE__ */ (0,
|
|
1297
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Palette, { className: "w-5 h-5 text-[var(--color-text-secondary)]" })
|
|
1064
1298
|
}
|
|
1065
1299
|
),
|
|
1066
|
-
showThemeMenu && /* @__PURE__ */ (0,
|
|
1300
|
+
showThemeMenu && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1067
1301
|
"div",
|
|
1068
1302
|
{
|
|
1069
1303
|
className: "absolute right-0 mt-2 w-64 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50",
|
|
1070
1304
|
role: "menu",
|
|
1071
1305
|
"aria-label": "S\xE9lection du th\xE8me",
|
|
1072
|
-
children: /* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1074
|
-
/* @__PURE__ */ (0,
|
|
1306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "p-2", children: [
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "px-3 py-2 text-xs font-semibold text-[var(--color-text-tertiary)] uppercase", children: "Th\xE8mes disponibles" }),
|
|
1308
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1075
1309
|
"button",
|
|
1076
1310
|
{
|
|
1077
1311
|
onClick: () => handleThemeChange("elegant"),
|
|
@@ -1081,15 +1315,15 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1081
1315
|
),
|
|
1082
1316
|
role: "menuitem",
|
|
1083
1317
|
children: [
|
|
1084
|
-
/* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-10 h-10 rounded-lg bg-gradient-to-br from-[var(--color-primary)] to-[var(--color-accent)]" }),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-left", children: [
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm font-medium", children: "\xC9l\xE9gance Sobre" }),
|
|
1321
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Finance traditionnelle" })
|
|
1088
1322
|
] })
|
|
1089
1323
|
]
|
|
1090
1324
|
}
|
|
1091
1325
|
),
|
|
1092
|
-
/* @__PURE__ */ (0,
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1093
1327
|
"button",
|
|
1094
1328
|
{
|
|
1095
1329
|
onClick: () => handleThemeChange("fintech"),
|
|
@@ -1099,15 +1333,15 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1099
1333
|
),
|
|
1100
1334
|
role: "menuitem",
|
|
1101
1335
|
children: [
|
|
1102
|
-
/* @__PURE__ */ (0,
|
|
1103
|
-
/* @__PURE__ */ (0,
|
|
1104
|
-
/* @__PURE__ */ (0,
|
|
1105
|
-
/* @__PURE__ */ (0,
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-10 h-10 rounded-lg bg-gradient-to-br from-[var(--color-success)] to-[var(--color-text-primary)]" }),
|
|
1337
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-left", children: [
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm font-medium", children: "Modern Fintech" }),
|
|
1339
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Tableau de bord moderne" })
|
|
1106
1340
|
] })
|
|
1107
1341
|
]
|
|
1108
1342
|
}
|
|
1109
1343
|
),
|
|
1110
|
-
/* @__PURE__ */ (0,
|
|
1344
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1111
1345
|
"button",
|
|
1112
1346
|
{
|
|
1113
1347
|
onClick: () => handleThemeChange("minimalist"),
|
|
@@ -1117,10 +1351,10 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1117
1351
|
),
|
|
1118
1352
|
role: "menuitem",
|
|
1119
1353
|
children: [
|
|
1120
|
-
/* @__PURE__ */ (0,
|
|
1121
|
-
/* @__PURE__ */ (0,
|
|
1122
|
-
/* @__PURE__ */ (0,
|
|
1123
|
-
/* @__PURE__ */ (0,
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-10 h-10 rounded-lg bg-gradient-to-br from-[var(--color-text-secondary)] to-[var(--color-accent)]" }),
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-left", children: [
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm font-medium", children: "Minimaliste Premium" }),
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "\xC9l\xE9gance minimaliste" })
|
|
1124
1358
|
] })
|
|
1125
1359
|
]
|
|
1126
1360
|
}
|
|
@@ -1129,12 +1363,12 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1129
1363
|
}
|
|
1130
1364
|
)
|
|
1131
1365
|
] }),
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1133
|
-
/* @__PURE__ */ (0,
|
|
1134
|
-
/* @__PURE__ */ (0,
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center px-3 py-1.5 bg-[var(--color-surface)] rounded-lg border border-[var(--color-border)]", children: [
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.DollarSign, { className: "w-4 h-4 text-[var(--color-primary)] mr-2" }),
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: "FCFA" })
|
|
1135
1369
|
] }),
|
|
1136
|
-
/* @__PURE__ */ (0,
|
|
1137
|
-
/* @__PURE__ */ (0,
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1138
1372
|
"button",
|
|
1139
1373
|
{
|
|
1140
1374
|
className: "relative p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
|
|
@@ -1142,20 +1376,20 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1142
1376
|
"aria-label": `Notifications ${notifications.filter((n) => !n.read).length > 0 ? `(${notifications.filter((n) => !n.read).length} non lues)` : ""}`,
|
|
1143
1377
|
"aria-expanded": showNotifications,
|
|
1144
1378
|
children: [
|
|
1145
|
-
/* @__PURE__ */ (0,
|
|
1146
|
-
notifications.filter((n) => !n.read).length > 0 && /* @__PURE__ */ (0,
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Bell, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
|
|
1380
|
+
notifications.filter((n) => !n.read).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute top-1 right-1 w-2 h-2 bg-[var(--color-error)] rounded-full" })
|
|
1147
1381
|
]
|
|
1148
1382
|
}
|
|
1149
1383
|
),
|
|
1150
|
-
showNotifications && /* @__PURE__ */ (0,
|
|
1384
|
+
showNotifications && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1151
1385
|
"div",
|
|
1152
1386
|
{
|
|
1153
1387
|
className: "absolute right-0 mt-2 w-80 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-96 overflow-y-auto",
|
|
1154
1388
|
role: "region",
|
|
1155
1389
|
"aria-label": "Centre de notifications",
|
|
1156
1390
|
children: [
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "p-4 border-b border-[var(--color-border)]", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Notifications" }) }),
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "divide-y divide-[var(--color-border)]", children: notifications.map((notif) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1159
1393
|
"div",
|
|
1160
1394
|
{
|
|
1161
1395
|
className: cn(
|
|
@@ -1163,18 +1397,18 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1163
1397
|
!notif.read && "bg-[var(--color-primary-light)] bg-opacity-10"
|
|
1164
1398
|
),
|
|
1165
1399
|
onClick: () => markNotificationAsRead(notif.id),
|
|
1166
|
-
children: /* @__PURE__ */ (0,
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(
|
|
1168
1402
|
"w-2 h-2 rounded-full mt-2",
|
|
1169
1403
|
notif.type === "error" && "bg-[var(--color-error)]",
|
|
1170
1404
|
notif.type === "warning" && "bg-[var(--color-warning)]",
|
|
1171
1405
|
notif.type === "success" && "bg-[var(--color-success)]",
|
|
1172
1406
|
notif.type === "info" && "bg-[var(--color-info)]"
|
|
1173
1407
|
) }),
|
|
1174
|
-
/* @__PURE__ */ (0,
|
|
1175
|
-
/* @__PURE__ */ (0,
|
|
1176
|
-
/* @__PURE__ */ (0,
|
|
1177
|
-
/* @__PURE__ */ (0,
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1", children: [
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: notif.title }),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-text-secondary)] mt-1", children: notif.message }),
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-[var(--color-text-tertiary)] mt-2", children: notif.timestamp.toLocaleTimeString() })
|
|
1178
1412
|
] })
|
|
1179
1413
|
] })
|
|
1180
1414
|
},
|
|
@@ -1184,36 +1418,36 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1184
1418
|
}
|
|
1185
1419
|
)
|
|
1186
1420
|
] }),
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1189
1423
|
"button",
|
|
1190
1424
|
{
|
|
1191
1425
|
onClick: () => setShowUserMenu(!showUserMenu),
|
|
1192
1426
|
className: "flex items-center gap-2 p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
|
|
1193
1427
|
"aria-label": "Menu utilisateur",
|
|
1194
1428
|
"aria-expanded": showUserMenu,
|
|
1195
|
-
children: /* @__PURE__ */ (0,
|
|
1429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-8 h-8 bg-[var(--color-primary)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.User, { className: "w-4 h-4 text-[var(--color-background)]" }) })
|
|
1196
1430
|
}
|
|
1197
1431
|
),
|
|
1198
|
-
showUserMenu && /* @__PURE__ */ (0,
|
|
1432
|
+
showUserMenu && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1199
1433
|
"div",
|
|
1200
1434
|
{
|
|
1201
1435
|
className: "absolute right-0 mt-2 w-56 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50",
|
|
1202
1436
|
role: "menu",
|
|
1203
1437
|
"aria-label": "Menu utilisateur",
|
|
1204
|
-
children: /* @__PURE__ */ (0,
|
|
1205
|
-
/* @__PURE__ */ (0,
|
|
1438
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "p-2", children: [
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1206
1440
|
"button",
|
|
1207
1441
|
{
|
|
1208
1442
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
1209
1443
|
role: "menuitem",
|
|
1210
1444
|
children: [
|
|
1211
|
-
/* @__PURE__ */ (0,
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.User, { className: "w-4 h-4" }),
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm", children: "Mon profil" })
|
|
1213
1447
|
]
|
|
1214
1448
|
}
|
|
1215
1449
|
),
|
|
1216
|
-
/* @__PURE__ */ (0,
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1217
1451
|
"button",
|
|
1218
1452
|
{
|
|
1219
1453
|
onClick: () => {
|
|
@@ -1223,31 +1457,31 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1223
1457
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
1224
1458
|
role: "menuitem",
|
|
1225
1459
|
children: [
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1227
|
-
/* @__PURE__ */ (0,
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.Settings, { className: "w-4 h-4" }),
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm", children: "Param\xE8tres" })
|
|
1228
1462
|
]
|
|
1229
1463
|
}
|
|
1230
1464
|
),
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1232
1466
|
"button",
|
|
1233
1467
|
{
|
|
1234
1468
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
|
|
1235
1469
|
role: "menuitem",
|
|
1236
1470
|
children: [
|
|
1237
|
-
/* @__PURE__ */ (0,
|
|
1238
|
-
/* @__PURE__ */ (0,
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.HelpCircle, { className: "w-4 h-4" }),
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm", children: "Aide" })
|
|
1239
1473
|
]
|
|
1240
1474
|
}
|
|
1241
1475
|
),
|
|
1242
|
-
/* @__PURE__ */ (0,
|
|
1243
|
-
/* @__PURE__ */ (0,
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("hr", { className: "my-2 border-[var(--color-border)]" }),
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1244
1478
|
"button",
|
|
1245
1479
|
{
|
|
1246
1480
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] text-[var(--color-error)] transition-colors",
|
|
1247
1481
|
role: "menuitem",
|
|
1248
1482
|
children: [
|
|
1249
|
-
/* @__PURE__ */ (0,
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.LogOut, { className: "w-4 h-4" }),
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm", children: "D\xE9connexion" })
|
|
1251
1485
|
]
|
|
1252
1486
|
}
|
|
1253
1487
|
)
|
|
@@ -1259,13 +1493,13 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1259
1493
|
]
|
|
1260
1494
|
}
|
|
1261
1495
|
),
|
|
1262
|
-
/* @__PURE__ */ (0,
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1263
1497
|
"main",
|
|
1264
1498
|
{
|
|
1265
1499
|
id: "main-content",
|
|
1266
1500
|
className: "flex-1 overflow-y-auto bg-[var(--color-background)]",
|
|
1267
1501
|
role: "main",
|
|
1268
|
-
children: /* @__PURE__ */ (0,
|
|
1502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "p-3 lg:p-4", children })
|
|
1269
1503
|
}
|
|
1270
1504
|
)
|
|
1271
1505
|
] })
|
|
@@ -1274,25 +1508,25 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
|
|
|
1274
1508
|
var ModernDoubleSidebarLayout_default = RewiseLayout;
|
|
1275
1509
|
|
|
1276
1510
|
// src/components/ui/Toast.tsx
|
|
1277
|
-
var
|
|
1511
|
+
var import_react5 = require("react");
|
|
1278
1512
|
|
|
1279
1513
|
// src/contexts/ToastContext.tsx
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
1282
|
-
var ToastContext = (0,
|
|
1514
|
+
var import_react4 = require("react");
|
|
1515
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1516
|
+
var ToastContext = (0, import_react4.createContext)(void 0);
|
|
1283
1517
|
var useToast = () => {
|
|
1284
|
-
const context = (0,
|
|
1518
|
+
const context = (0, import_react4.useContext)(ToastContext);
|
|
1285
1519
|
if (!context) {
|
|
1286
1520
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1287
1521
|
}
|
|
1288
1522
|
return context;
|
|
1289
1523
|
};
|
|
1290
1524
|
var ToastProvider = ({ children }) => {
|
|
1291
|
-
const [toasts, setToasts] = (0,
|
|
1525
|
+
const [toasts, setToasts] = (0, import_react4.useState)([]);
|
|
1292
1526
|
const generateId = () => {
|
|
1293
1527
|
return Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
1294
1528
|
};
|
|
1295
|
-
const addToast = (0,
|
|
1529
|
+
const addToast = (0, import_react4.useCallback)((toast) => {
|
|
1296
1530
|
const id = generateId();
|
|
1297
1531
|
const newToast = {
|
|
1298
1532
|
id,
|
|
@@ -1306,19 +1540,19 @@ var ToastProvider = ({ children }) => {
|
|
|
1306
1540
|
}, newToast.duration);
|
|
1307
1541
|
}
|
|
1308
1542
|
}, []);
|
|
1309
|
-
const removeToast = (0,
|
|
1543
|
+
const removeToast = (0, import_react4.useCallback)((id) => {
|
|
1310
1544
|
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
1311
1545
|
}, []);
|
|
1312
|
-
const success = (0,
|
|
1546
|
+
const success = (0, import_react4.useCallback)((message, duration) => {
|
|
1313
1547
|
addToast({ message, type: "success", duration });
|
|
1314
1548
|
}, [addToast]);
|
|
1315
|
-
const error = (0,
|
|
1549
|
+
const error = (0, import_react4.useCallback)((message, duration) => {
|
|
1316
1550
|
addToast({ message, type: "error", duration });
|
|
1317
1551
|
}, [addToast]);
|
|
1318
|
-
const warning = (0,
|
|
1552
|
+
const warning = (0, import_react4.useCallback)((message, duration) => {
|
|
1319
1553
|
addToast({ message, type: "warning", duration });
|
|
1320
1554
|
}, [addToast]);
|
|
1321
|
-
const info = (0,
|
|
1555
|
+
const info = (0, import_react4.useCallback)((message, duration) => {
|
|
1322
1556
|
addToast({ message, type: "info", duration });
|
|
1323
1557
|
}, [addToast]);
|
|
1324
1558
|
const value = {
|
|
@@ -1330,17 +1564,17 @@ var ToastProvider = ({ children }) => {
|
|
|
1330
1564
|
warning,
|
|
1331
1565
|
info
|
|
1332
1566
|
};
|
|
1333
|
-
return /* @__PURE__ */ (0,
|
|
1567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToastContext.Provider, { value, children });
|
|
1334
1568
|
};
|
|
1335
1569
|
|
|
1336
1570
|
// src/components/ui/Toast.tsx
|
|
1337
1571
|
var import_lucide_react2 = require("lucide-react");
|
|
1338
|
-
var
|
|
1572
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1339
1573
|
var ToastItem = ({ toast }) => {
|
|
1340
1574
|
const { removeToast } = useToast();
|
|
1341
|
-
const [isVisible, setIsVisible] = (0,
|
|
1342
|
-
const [isLeaving, setIsLeaving] = (0,
|
|
1343
|
-
(0,
|
|
1575
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(false);
|
|
1576
|
+
const [isLeaving, setIsLeaving] = (0, import_react5.useState)(false);
|
|
1577
|
+
(0, import_react5.useEffect)(() => {
|
|
1344
1578
|
const timer = setTimeout(() => setIsVisible(true), 10);
|
|
1345
1579
|
return () => clearTimeout(timer);
|
|
1346
1580
|
}, []);
|
|
@@ -1353,13 +1587,13 @@ var ToastItem = ({ toast }) => {
|
|
|
1353
1587
|
const getIcon = () => {
|
|
1354
1588
|
switch (toast.type) {
|
|
1355
1589
|
case "success":
|
|
1356
|
-
return /* @__PURE__ */ (0,
|
|
1590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.CheckCircle, { className: "w-5 h-5 text-green-600" });
|
|
1357
1591
|
case "error":
|
|
1358
|
-
return /* @__PURE__ */ (0,
|
|
1592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.XCircle, { className: "w-5 h-5 text-red-600" });
|
|
1359
1593
|
case "warning":
|
|
1360
|
-
return /* @__PURE__ */ (0,
|
|
1594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.AlertTriangle, { className: "w-5 h-5 text-yellow-600" });
|
|
1361
1595
|
case "info":
|
|
1362
|
-
return /* @__PURE__ */ (0,
|
|
1596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Info, { className: "w-5 h-5 text-blue-600" });
|
|
1363
1597
|
}
|
|
1364
1598
|
};
|
|
1365
1599
|
const getBackgroundColor = () => {
|
|
@@ -1374,7 +1608,7 @@ var ToastItem = ({ toast }) => {
|
|
|
1374
1608
|
return "bg-blue-50 border-blue-200";
|
|
1375
1609
|
}
|
|
1376
1610
|
};
|
|
1377
|
-
return /* @__PURE__ */ (0,
|
|
1611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1378
1612
|
"div",
|
|
1379
1613
|
{
|
|
1380
1614
|
className: `
|
|
@@ -1385,14 +1619,14 @@ var ToastItem = ({ toast }) => {
|
|
|
1385
1619
|
flex items-start space-x-3
|
|
1386
1620
|
`,
|
|
1387
1621
|
children: [
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1389
|
-
/* @__PURE__ */ (0,
|
|
1390
|
-
/* @__PURE__ */ (0,
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex-shrink-0", children: getIcon() }),
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm text-gray-900 font-medium", children: toast.message }) }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1391
1625
|
"button",
|
|
1392
1626
|
{
|
|
1393
1627
|
onClick: handleClose,
|
|
1394
1628
|
className: "flex-shrink-0 ml-4 text-gray-400 hover:text-gray-600 transition-colors",
|
|
1395
|
-
children: /* @__PURE__ */ (0,
|
|
1629
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { className: "w-4 h-4" })
|
|
1396
1630
|
}
|
|
1397
1631
|
)
|
|
1398
1632
|
]
|
|
@@ -1401,165 +1635,10 @@ var ToastItem = ({ toast }) => {
|
|
|
1401
1635
|
};
|
|
1402
1636
|
var ToastContainer = () => {
|
|
1403
1637
|
const { toasts } = useToast();
|
|
1404
|
-
return /* @__PURE__ */ (0,
|
|
1638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "fixed top-4 right-4 z-50 space-y-3", children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ToastItem, { toast }, toast.id)) });
|
|
1405
1639
|
};
|
|
1406
1640
|
var Toast_default = ToastContainer;
|
|
1407
1641
|
|
|
1408
|
-
// src/contexts/SessionContext.tsx
|
|
1409
|
-
var import_react5 = require("react");
|
|
1410
|
-
|
|
1411
|
-
// src/services/api.ts
|
|
1412
|
-
var ADDRESS_IP = "localhost:8000";
|
|
1413
|
-
var ADDRESS_IP_URL = `http://${ADDRESS_IP}/`;
|
|
1414
|
-
var API_URL = `${ADDRESS_IP_URL}api`;
|
|
1415
|
-
var FetchApi = class {
|
|
1416
|
-
static async post(url, payload, token) {
|
|
1417
|
-
const headers = {
|
|
1418
|
-
"Content-Type": "application/json"
|
|
1419
|
-
};
|
|
1420
|
-
if (token) {
|
|
1421
|
-
headers["Authorization"] = `Token ${token}`;
|
|
1422
|
-
}
|
|
1423
|
-
const res = await fetch(url, {
|
|
1424
|
-
method: "POST",
|
|
1425
|
-
headers,
|
|
1426
|
-
body: payload ? JSON.stringify(payload) : void 0
|
|
1427
|
-
});
|
|
1428
|
-
if (!res.ok) throw new Error(await res.text());
|
|
1429
|
-
return res.json();
|
|
1430
|
-
}
|
|
1431
|
-
static async get(url, token) {
|
|
1432
|
-
const headers = {};
|
|
1433
|
-
if (token) {
|
|
1434
|
-
headers["Authorization"] = `Token ${token}`;
|
|
1435
|
-
}
|
|
1436
|
-
const res = await fetch(url, {
|
|
1437
|
-
method: "GET",
|
|
1438
|
-
headers
|
|
1439
|
-
});
|
|
1440
|
-
if (!res.ok) throw new Error(await res.text());
|
|
1441
|
-
return res.json();
|
|
1442
|
-
}
|
|
1443
|
-
static async put(url, payload, token) {
|
|
1444
|
-
const headers = {
|
|
1445
|
-
"Content-Type": "application/json"
|
|
1446
|
-
};
|
|
1447
|
-
if (token) {
|
|
1448
|
-
headers["Authorization"] = `Token ${token}`;
|
|
1449
|
-
}
|
|
1450
|
-
const res = await fetch(url, {
|
|
1451
|
-
method: "PUT",
|
|
1452
|
-
headers,
|
|
1453
|
-
body: payload ? JSON.stringify(payload) : void 0
|
|
1454
|
-
});
|
|
1455
|
-
if (!res.ok) throw new Error(await res.text());
|
|
1456
|
-
return res.json();
|
|
1457
|
-
}
|
|
1458
|
-
static async delete(url, token) {
|
|
1459
|
-
const headers = {};
|
|
1460
|
-
if (token) {
|
|
1461
|
-
headers["Authorization"] = `Token ${token}`;
|
|
1462
|
-
}
|
|
1463
|
-
const res = await fetch(url, {
|
|
1464
|
-
method: "DELETE",
|
|
1465
|
-
headers
|
|
1466
|
-
});
|
|
1467
|
-
if (!res.ok) throw new Error(await res.text());
|
|
1468
|
-
return res.json();
|
|
1469
|
-
}
|
|
1470
|
-
};
|
|
1471
|
-
|
|
1472
|
-
// src/services/AuthServices.ts
|
|
1473
|
-
var API_BASE_URL = `${API_URL}/core/auth/`;
|
|
1474
|
-
var FetchApi2 = class {
|
|
1475
|
-
static async post(url, payload, token) {
|
|
1476
|
-
const headers = {
|
|
1477
|
-
"Content-Type": "application/json"
|
|
1478
|
-
};
|
|
1479
|
-
if (token) {
|
|
1480
|
-
headers["Authorization"] = `Token ${token}`;
|
|
1481
|
-
}
|
|
1482
|
-
const res = await fetch(url, {
|
|
1483
|
-
method: "POST",
|
|
1484
|
-
headers,
|
|
1485
|
-
body: payload ? JSON.stringify(payload) : void 0
|
|
1486
|
-
});
|
|
1487
|
-
if (!res.ok) throw new Error(await res.text());
|
|
1488
|
-
return res.json();
|
|
1489
|
-
}
|
|
1490
|
-
static async get(url, token) {
|
|
1491
|
-
const headers = {};
|
|
1492
|
-
if (token) {
|
|
1493
|
-
headers["Authorization"] = `Token ${token}`;
|
|
1494
|
-
}
|
|
1495
|
-
const res = await fetch(url, {
|
|
1496
|
-
method: "GET",
|
|
1497
|
-
headers
|
|
1498
|
-
});
|
|
1499
|
-
if (!res.ok) throw new Error(await res.text());
|
|
1500
|
-
return res.json();
|
|
1501
|
-
}
|
|
1502
|
-
};
|
|
1503
|
-
var AuthServices = {
|
|
1504
|
-
sendOtp: (payload) => FetchApi2.post(`${API_BASE_URL}send-otp/`, payload),
|
|
1505
|
-
verifyOtp: (payload) => FetchApi2.post(`${API_BASE_URL}verify-otp/`, payload),
|
|
1506
|
-
completeRegistration: (payload) => FetchApi2.post(`${API_BASE_URL}complete-registration/`, payload),
|
|
1507
|
-
addUser: (payload) => FetchApi2.post(`${API_BASE_URL}add-user/`, payload),
|
|
1508
|
-
login: (payload) => FetchApi2.post(`${API_BASE_URL}login/`, payload),
|
|
1509
|
-
getUserInformations: (token) => FetchApi2.get(`${API_BASE_URL}user-informations/`, token),
|
|
1510
|
-
logout: () => FetchApi2.post(`${API_BASE_URL}logout/`)
|
|
1511
|
-
};
|
|
1512
|
-
|
|
1513
|
-
// src/contexts/SessionContext.tsx
|
|
1514
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1515
|
-
var SessionContext = (0, import_react5.createContext)(void 0);
|
|
1516
|
-
var useSession = () => {
|
|
1517
|
-
const context = (0, import_react5.useContext)(SessionContext);
|
|
1518
|
-
if (!context) {
|
|
1519
|
-
throw new Error("useSession must be used within a SessionProvider");
|
|
1520
|
-
}
|
|
1521
|
-
return context;
|
|
1522
|
-
};
|
|
1523
|
-
var SessionProvider = ({ children }) => {
|
|
1524
|
-
const [token, setToken] = (0, import_react5.useState)(localStorage.getItem("token"));
|
|
1525
|
-
const [loggedUser, setLoggedUser] = (0, import_react5.useState)(null);
|
|
1526
|
-
(0, import_react5.useEffect)(() => {
|
|
1527
|
-
const storedToken = localStorage.getItem("token");
|
|
1528
|
-
if (storedToken) {
|
|
1529
|
-
setToken(storedToken);
|
|
1530
|
-
}
|
|
1531
|
-
}, []);
|
|
1532
|
-
const login = (newToken) => {
|
|
1533
|
-
localStorage.setItem("token", newToken);
|
|
1534
|
-
setToken(newToken);
|
|
1535
|
-
};
|
|
1536
|
-
const logout = () => {
|
|
1537
|
-
localStorage.removeItem("token");
|
|
1538
|
-
setToken(null);
|
|
1539
|
-
};
|
|
1540
|
-
(0, import_react5.useEffect)(() => {
|
|
1541
|
-
if (token) {
|
|
1542
|
-
AuthServices.getUserInformations(token).then((res) => {
|
|
1543
|
-
const result = res;
|
|
1544
|
-
if (result.success === true) {
|
|
1545
|
-
setLoggedUser(result.data.user);
|
|
1546
|
-
} else {
|
|
1547
|
-
setLoggedUser(null);
|
|
1548
|
-
}
|
|
1549
|
-
}).catch(() => setLoggedUser(null));
|
|
1550
|
-
} else {
|
|
1551
|
-
setLoggedUser(null);
|
|
1552
|
-
}
|
|
1553
|
-
}, [token]);
|
|
1554
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SessionContext.Provider, { value: {
|
|
1555
|
-
isAuthenticated: !!token,
|
|
1556
|
-
loggedUser,
|
|
1557
|
-
token,
|
|
1558
|
-
login,
|
|
1559
|
-
logout
|
|
1560
|
-
}, children });
|
|
1561
|
-
};
|
|
1562
|
-
|
|
1563
1642
|
// src/components/common/Pages.tsx
|
|
1564
1643
|
var import_lucide_react3 = require("lucide-react");
|
|
1565
1644
|
var import_react6 = require("react");
|
|
@@ -1569,11 +1648,11 @@ var Pages = ({
|
|
|
1569
1648
|
description = "",
|
|
1570
1649
|
sideAction,
|
|
1571
1650
|
sidebar,
|
|
1572
|
-
tabs =
|
|
1651
|
+
tabs = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}),
|
|
1573
1652
|
children
|
|
1574
1653
|
}) => {
|
|
1575
1654
|
const [sidebarOpen, setSidebarOpen] = (0, import_react6.useState)(false);
|
|
1576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full bg-gray-
|
|
1655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full bg-gray-100", children: [
|
|
1577
1656
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 flex flex-col", children: [
|
|
1578
1657
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-white border-b border-gray-200 p-6", children: [
|
|
1579
1658
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
@@ -1583,16 +1662,9 @@ var Pages = ({
|
|
|
1583
1662
|
] }) }),
|
|
1584
1663
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center space-x-3", children: sideAction })
|
|
1585
1664
|
] }),
|
|
1586
|
-
tabs
|
|
1587
|
-
"button",
|
|
1588
|
-
{
|
|
1589
|
-
className: `px-4 py-2 text-sm rounded-lg transition-all whitespace-nowrap ${tab.id === "manual" ? "bg-[#6A8A82] text-white shadow-md" : "text-gray-600 hover:bg-gray-100"}`,
|
|
1590
|
-
children: tab.label
|
|
1591
|
-
},
|
|
1592
|
-
tab.id
|
|
1593
|
-
)) })
|
|
1665
|
+
tabs
|
|
1594
1666
|
] }),
|
|
1595
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-1 p-6 space-y-6", children })
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-1 p-6 space-y-6 min-h-[80vh]", children })
|
|
1596
1668
|
] }),
|
|
1597
1669
|
sidebar && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${sidebarOpen ? "w-80" : "w-16"} bg-[var(--color-surface)] border-r border-[var(--color-border)] transition-all duration-300 flex flex-col`, children: [
|
|
1598
1670
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "p-4 ", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
@@ -1642,7 +1714,7 @@ var API_BASE_URL2 = `${API_URL}/core/auth/`;
|
|
|
1642
1714
|
var USERS_API_URL = `${API_URL}/core/users/`;
|
|
1643
1715
|
var UserServices = {
|
|
1644
1716
|
// Créer un nouvel utilisateur
|
|
1645
|
-
addUser: (data, token) => FetchApi.post(`${
|
|
1717
|
+
addUser: (data, token) => FetchApi.post(`${API_BASE_URL2}add-user/`, data, token),
|
|
1646
1718
|
// Obtenir tous les utilisateurs
|
|
1647
1719
|
getUsers: (token) => FetchApi.get(`${USERS_API_URL}`, token),
|
|
1648
1720
|
// Obtenir un utilisateur par ID
|
|
@@ -1653,12 +1725,303 @@ var UserServices = {
|
|
|
1653
1725
|
deleteUser: (id, token) => FetchApi.delete(`${USERS_API_URL}${id}/`, token),
|
|
1654
1726
|
// Obtenir les utilisateurs d'une entité
|
|
1655
1727
|
getEntityUsers: (entityId, token) => FetchApi.get(`${API_URL}/core/entities/${entityId}/users/`, token),
|
|
1728
|
+
// Obtenir les utilisateurs d'une entité
|
|
1729
|
+
getuserEntitiesAccess: (id, token) => FetchApi.get(`${API_URL}/core/entities/`, token),
|
|
1730
|
+
// !!! ce n'est pas la bonne url
|
|
1656
1731
|
// Ajouter un utilisateur à une entité
|
|
1657
1732
|
addUserToEntity: (entityId, userId, token) => FetchApi.post(`${API_URL}/core/entities/${entityId}/users/`, { user_id: userId }, token)
|
|
1658
1733
|
};
|
|
1734
|
+
|
|
1735
|
+
// src/components/common/FDrawer.tsx
|
|
1736
|
+
var import_react7 = require("react");
|
|
1737
|
+
var import_react_router_dom3 = require("react-router-dom");
|
|
1738
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1739
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1740
|
+
var FDrawer = ({
|
|
1741
|
+
children,
|
|
1742
|
+
apiEndpoint,
|
|
1743
|
+
columns,
|
|
1744
|
+
actions,
|
|
1745
|
+
ordering,
|
|
1746
|
+
toggle
|
|
1747
|
+
}) => {
|
|
1748
|
+
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
1749
|
+
const [searchParams] = (0, import_react_router_dom3.useSearchParams)();
|
|
1750
|
+
const location = (0, import_react_router_dom3.useLocation)();
|
|
1751
|
+
const allParams = Object.fromEntries([...searchParams]);
|
|
1752
|
+
const { activeBusinessEntity, token } = useSession();
|
|
1753
|
+
const [data, setData] = (0, import_react7.useState)([]);
|
|
1754
|
+
const [order_by, setOrderBy] = (0, import_react7.useState)(ordering || "-id");
|
|
1755
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
1756
|
+
const [showOrdering, setShowOrdering] = (0, import_react7.useState)(null);
|
|
1757
|
+
const [showFilters, setShowFilters] = (0, import_react7.useState)(null);
|
|
1758
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react7.useState)(null);
|
|
1759
|
+
const [queryURL, setQueryURL] = (0, import_react7.useState)("");
|
|
1760
|
+
const [reponseDetail, setReponseDetail] = (0, import_react7.useState)({
|
|
1761
|
+
total_pages: null,
|
|
1762
|
+
previous: null,
|
|
1763
|
+
next: null,
|
|
1764
|
+
current_page: null
|
|
1765
|
+
});
|
|
1766
|
+
const makeFilters = () => columns.reduce((acc, item) => {
|
|
1767
|
+
acc[item.formule ? `${item.search_name}__icontains` : `${item.key}__icontains`] = "";
|
|
1768
|
+
return acc;
|
|
1769
|
+
}, {});
|
|
1770
|
+
const preFilters = columns.length > 0 ? makeFilters() : [];
|
|
1771
|
+
const [filters, setFilters] = (0, import_react7.useState)(
|
|
1772
|
+
() => Object.keys(allParams).length > 0 ? allParams : { ...preFilters, business_entity_id: activeBusinessEntity?.id ?? null, order_by: order_by ?? "id", page: 1 }
|
|
1773
|
+
);
|
|
1774
|
+
const getDataFilter = async () => {
|
|
1775
|
+
setLoading(true);
|
|
1776
|
+
try {
|
|
1777
|
+
const response = await fetch(queryURL, {
|
|
1778
|
+
method: "GET",
|
|
1779
|
+
headers: {
|
|
1780
|
+
"Content-Type": "application/json",
|
|
1781
|
+
"Authorization": `token ${token}`
|
|
1782
|
+
}
|
|
1783
|
+
});
|
|
1784
|
+
if (!response.ok) throw new Error(`HTTP ERROR! STATUS: ${response.status}`);
|
|
1785
|
+
const data2 = await response.json();
|
|
1786
|
+
setReponseDetail(data2.paginate);
|
|
1787
|
+
setData(data2.data);
|
|
1788
|
+
} catch (error) {
|
|
1789
|
+
console.error("ERROR FETCHING DATA", error);
|
|
1790
|
+
} finally {
|
|
1791
|
+
setLoading(false);
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
(0, import_react7.useEffect)(() => {
|
|
1795
|
+
const params = new URLSearchParams(filters).toString();
|
|
1796
|
+
setQueryURL(`${API_URL}${apiEndpoint}?${params}&business_entity_id=${activeBusinessEntity?.id ?? ""}`);
|
|
1797
|
+
navigate(`${location.pathname}?${params}`);
|
|
1798
|
+
}, [filters]);
|
|
1799
|
+
(0, import_react7.useEffect)(() => {
|
|
1800
|
+
getDataFilter();
|
|
1801
|
+
}, [activeBusinessEntity, queryURL, toggle]);
|
|
1802
|
+
const renderColumnFilter = (column) => {
|
|
1803
|
+
if (!column.filterable) return null;
|
|
1804
|
+
const handleChange = (key, value) => setFilters({ ...filters, [key]: value, page: 1 });
|
|
1805
|
+
switch (column.type) {
|
|
1806
|
+
case "text":
|
|
1807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1808
|
+
"input",
|
|
1809
|
+
{
|
|
1810
|
+
id: column.key,
|
|
1811
|
+
type: "text",
|
|
1812
|
+
value: filters[`${column.key}__icontains`] || "",
|
|
1813
|
+
placeholder: "Rechercher...",
|
|
1814
|
+
className: "border border-gray-300 rounded-lg p-3 w-full",
|
|
1815
|
+
onChange: (e) => handleChange(`${column.key}__icontains`, e.target.value)
|
|
1816
|
+
}
|
|
1817
|
+
);
|
|
1818
|
+
case "number":
|
|
1819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full gap-1", children: [
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1821
|
+
"input",
|
|
1822
|
+
{
|
|
1823
|
+
type: "number",
|
|
1824
|
+
placeholder: "Min",
|
|
1825
|
+
className: "border border-gray-300 rounded-lg p-3 w-1/2",
|
|
1826
|
+
onChange: (e) => handleChange(`${column.key}_min`, e.target.value)
|
|
1827
|
+
}
|
|
1828
|
+
),
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1830
|
+
"input",
|
|
1831
|
+
{
|
|
1832
|
+
type: "number",
|
|
1833
|
+
placeholder: "Max",
|
|
1834
|
+
className: "border border-gray-300 rounded-lg p-3 w-1/2",
|
|
1835
|
+
onChange: (e) => handleChange(`${column.key}_max`, e.target.value)
|
|
1836
|
+
}
|
|
1837
|
+
)
|
|
1838
|
+
] });
|
|
1839
|
+
case "date":
|
|
1840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full gap-1", children: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1842
|
+
"input",
|
|
1843
|
+
{
|
|
1844
|
+
type: "date",
|
|
1845
|
+
placeholder: "Du",
|
|
1846
|
+
className: "border border-gray-300 rounded-lg p-3 w-1/2",
|
|
1847
|
+
onChange: (e) => handleChange(`${column.key}_from`, e.target.value)
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1851
|
+
"input",
|
|
1852
|
+
{
|
|
1853
|
+
type: "date",
|
|
1854
|
+
placeholder: "Au",
|
|
1855
|
+
className: "border border-gray-300 rounded-lg p-3 w-1/2",
|
|
1856
|
+
onChange: (e) => handleChange(`${column.key}_to`, e.target.value)
|
|
1857
|
+
}
|
|
1858
|
+
)
|
|
1859
|
+
] });
|
|
1860
|
+
default:
|
|
1861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1862
|
+
"input",
|
|
1863
|
+
{
|
|
1864
|
+
id: column.key,
|
|
1865
|
+
type: column.type,
|
|
1866
|
+
className: "border border-gray-300 rounded-md p-1",
|
|
1867
|
+
onChange: (e) => handleChange(column.key, e.target.value)
|
|
1868
|
+
}
|
|
1869
|
+
);
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
const renderLine = (item) => columns.map((column) => {
|
|
1873
|
+
let cellContent = column.formule ? column.formule(item) : item[column.key];
|
|
1874
|
+
if (column.type === "date" && item[column.key])
|
|
1875
|
+
cellContent = new Date(item[column.key]).toLocaleDateString();
|
|
1876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-sm text-gray-500", children: cellContent }, column.key);
|
|
1877
|
+
});
|
|
1878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("table", { className: "w-full", children: [
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { className: "bg-gray-50", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { children: [
|
|
1881
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("th", { className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider relative", scope: "col", children: [
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex align-center items-center gap-2", children: [
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { onClick: () => setShowFilters(showFilters === column.key ? "" : column.key), children: column.label }),
|
|
1884
|
+
column.sortable && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowDownUp, { className: "h-4 w-4 cursor-pointer", onClick: () => setShowOrdering(showOrdering === column.key ? "" : column.key) })
|
|
1885
|
+
] }),
|
|
1886
|
+
showOrdering === column.key && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute left-6 mt-2 bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-80 overflow-y-auto", role: "menu", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "p-2", children: [
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1888
|
+
"button",
|
|
1889
|
+
{
|
|
1890
|
+
type: "button",
|
|
1891
|
+
onClick: () => {
|
|
1892
|
+
setOrderBy(column.key);
|
|
1893
|
+
setFilters({ ...filters, order_by: column.key });
|
|
1894
|
+
setShowOrdering(null);
|
|
1895
|
+
},
|
|
1896
|
+
className: cn("w-full flex items-center gap-3 px-3 py-1 border-b rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors", order_by === column.key && "bg-[var(--color-primary-light)]"),
|
|
1897
|
+
role: "menuitem",
|
|
1898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-left flex-1 flex items-center gap-2", children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowUpAZ, { className: "h-4 w-4" }),
|
|
1900
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: cn("text-sm font-medium", order_by === column.key ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"), children: "Croissant" })
|
|
1901
|
+
] })
|
|
1902
|
+
}
|
|
1903
|
+
),
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1905
|
+
"button",
|
|
1906
|
+
{
|
|
1907
|
+
type: "button",
|
|
1908
|
+
onClick: () => {
|
|
1909
|
+
setOrderBy(`-${column.key}`);
|
|
1910
|
+
setFilters({ ...filters, order_by: `-${column.key}` });
|
|
1911
|
+
setShowOrdering(null);
|
|
1912
|
+
},
|
|
1913
|
+
className: cn("w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors", order_by === `-${column.key}` && "bg-[var(--color-primary-light)]"),
|
|
1914
|
+
role: "menuitem",
|
|
1915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "text-left flex-1 flex items-center gap-2", children: [
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.ArrowDownAZ, { className: "h-4 w-4" }),
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: cn("text-sm font-medium", order_by === `-${column.key}` ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"), children: "D\xE9croissant" })
|
|
1918
|
+
] })
|
|
1919
|
+
}
|
|
1920
|
+
)
|
|
1921
|
+
] }) }),
|
|
1922
|
+
showFilters === column.key && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "absolute left-6 mt-2 w-[500px] bg-[var(--color-background)] rounded-lg shadow-xl border border-[var(--color-border)] z-50 max-h-80 overflow-y-auto", role: "menu", children: [
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "py-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Filtrer" }) }),
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "pb-3 px-4", children: renderColumnFilter(column) })
|
|
1925
|
+
] })
|
|
1926
|
+
] }, column.key)),
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("th", { className: "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider" })
|
|
1928
|
+
] }) }),
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tbody", { className: "bg-white divide-y divide-gray-200", children: data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { className: "hover:bg-gray-50 cursor-pointer", children: [
|
|
1930
|
+
renderLine(item),
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "px-6 py-4 whitespace-nowrap text-right text-sm font-medium", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative", children: [
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1933
|
+
"button",
|
|
1934
|
+
{
|
|
1935
|
+
type: "button",
|
|
1936
|
+
onClick: () => setDropdownOpen(dropdownOpen === item.id ? null : item.id),
|
|
1937
|
+
className: "p-1 rounded-full hover:bg-gray-100 transition-colors",
|
|
1938
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.MoreVertical, { className: "w-4 h-4 text-gray-400" })
|
|
1939
|
+
}
|
|
1940
|
+
),
|
|
1941
|
+
dropdownOpen === item.id && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "fixed right-3 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 py-2 z-10", children: actions.map(
|
|
1942
|
+
(action, index) => action.navigate ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { to: action.navigate, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { onClick: () => {
|
|
1943
|
+
action.onclick(item);
|
|
1944
|
+
setDropdownOpen(null);
|
|
1945
|
+
}, className: "w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center space-x-2", children: action.label }, index)
|
|
1946
|
+
) })
|
|
1947
|
+
] }) })
|
|
1948
|
+
] }, item.id)) })
|
|
1949
|
+
] }),
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Pagination, { reponseDetail, setQueryURL, filters: [filters, setFilters] })
|
|
1951
|
+
] });
|
|
1952
|
+
};
|
|
1953
|
+
var Pagination = ({
|
|
1954
|
+
reponseDetail,
|
|
1955
|
+
filters
|
|
1956
|
+
}) => {
|
|
1957
|
+
const [filtersValue, setFilters] = filters;
|
|
1958
|
+
const { current_page, total_pages, previous, next, results, count } = reponseDetail;
|
|
1959
|
+
const range = 1;
|
|
1960
|
+
const pageItems = [];
|
|
1961
|
+
const generatePages = () => {
|
|
1962
|
+
if (total_pages <= 5) {
|
|
1963
|
+
for (let i = 1; i <= total_pages; i++)
|
|
1964
|
+
pageItems.push(
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: `page-item ${current_page === i ? "active" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { className: "page-link px-3 py-1 border border-[#E8E8E8] rounded text-sm", to: "#", onClick: () => setFilters({ ...filtersValue, page: i }), children: i }) }, i)
|
|
1966
|
+
);
|
|
1967
|
+
} else {
|
|
1968
|
+
let start = Math.max(1, current_page - range);
|
|
1969
|
+
let end = Math.min(total_pages, current_page + range);
|
|
1970
|
+
if (start > 1) {
|
|
1971
|
+
pageItems.push(
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: `page-item ${current_page === 1 ? "active" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { className: "page-link px-3 py-1 border border-[#E8E8E8] rounded text-sm", to: "#", onClick: () => setFilters({ ...filtersValue, page: 1 }), children: "1" }) }, 1)
|
|
1973
|
+
);
|
|
1974
|
+
if (start > 2)
|
|
1975
|
+
pageItems.push(/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "page-item disabled", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "page-link px-3 py-1 text-sm", children: "..." }) }, "ellipsis-start"));
|
|
1976
|
+
}
|
|
1977
|
+
for (let i = start; i <= end; i++)
|
|
1978
|
+
pageItems.push(
|
|
1979
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: `page-item ${current_page === i ? "active" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { className: "page-link px-3 py-1 border border-[#E8E8E8] rounded text-sm", to: "#", onClick: () => setFilters({ ...filtersValue, page: i }), children: i }) }, i)
|
|
1980
|
+
);
|
|
1981
|
+
if (end < total_pages) {
|
|
1982
|
+
if (end < total_pages - 1)
|
|
1983
|
+
pageItems.push(/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "page-item disabled", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "page-link px-3 py-1 text-sm", children: "..." }) }, "ellipsis-end"));
|
|
1984
|
+
pageItems.push(
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: `page-item ${current_page === total_pages ? "active" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { className: "page-link px-3 py-1 border border-[#E8E8E8] rounded text-sm", to: "#", onClick: () => setFilters({ ...filtersValue, page: total_pages }), children: total_pages }) }, total_pages)
|
|
1986
|
+
);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
generatePages();
|
|
1991
|
+
const handleChangePage = (direction) => {
|
|
1992
|
+
let newPage = current_page + (direction === "next" ? 1 : -1);
|
|
1993
|
+
if (newPage >= 1 && newPage <= total_pages)
|
|
1994
|
+
setFilters({ ...filtersValue, page: newPage });
|
|
1995
|
+
};
|
|
1996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "p-4 border-t border-[#E8E8E8] flex items-center justify-between", children: [
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-sm text-[#666666]", children: [
|
|
1998
|
+
"Affichage de 1 \xE0 ",
|
|
1999
|
+
results?.length ?? 0,
|
|
2000
|
+
" sur ",
|
|
2001
|
+
count ?? 0,
|
|
2002
|
+
" entr\xE9es"
|
|
2003
|
+
] }),
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("nav", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { className: "flex items-center space-x-2 pagination", children: [
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: `page-item ${previous === null ? "disabled" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { className: "page-link px-3 py-1 border border-[#E8E8E8] rounded text-sm disabled:opacity-50", to: "#", onClick: () => handleChangePage("previous"), tabIndex: -1, "aria-disabled": previous === null, children: "Pr\xE9c\xE9dent" }) }),
|
|
2006
|
+
pageItems,
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: `page-item ${next === null ? "disabled" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom3.Link, { className: "page-link px-3 py-1 border border-[#E8E8E8] rounded text-sm disabled:opacity-50", to: "#", onClick: () => handleChangePage("next"), "aria-disabled": next === null, children: "Suivant" }) }),
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "page-item", style: { border: "0.02rem solid #f2f2f2" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2009
|
+
"select",
|
|
2010
|
+
{
|
|
2011
|
+
id: "page-select",
|
|
2012
|
+
value: current_page,
|
|
2013
|
+
onChange: (e) => setFilters({ ...filtersValue, page: Number(e.target.value) }),
|
|
2014
|
+
style: { height: "27px", color: "#72939D", border: "0.05rem solid #f2f2f2", background: "#ffffff" },
|
|
2015
|
+
children: Array.from({ length: total_pages }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: index + 1, children: index + 1 }, index + 1))
|
|
2016
|
+
}
|
|
2017
|
+
) })
|
|
2018
|
+
] }) })
|
|
2019
|
+
] });
|
|
2020
|
+
};
|
|
1659
2021
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1660
2022
|
0 && (module.exports = {
|
|
1661
2023
|
DateInput,
|
|
2024
|
+
FDrawer,
|
|
1662
2025
|
FileInput,
|
|
1663
2026
|
InputField,
|
|
1664
2027
|
Modal,
|