ptechcore_ui 1.0.68 → 1.0.69
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 +20 -377
- package/dist/index.js +738 -1092
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -259,8 +259,8 @@ var FileInput = ({
|
|
|
259
259
|
};
|
|
260
260
|
|
|
261
261
|
// src/components/layout/ModernDoubleSidebarLayout.tsx
|
|
262
|
-
import
|
|
263
|
-
import { Link as Link2, useLocation
|
|
262
|
+
import React4, { useState as useState5, useEffect as useEffect4 } from "react";
|
|
263
|
+
import { Link as Link2, useLocation, useNavigate as useNavigate2 } from "react-router-dom";
|
|
264
264
|
import {
|
|
265
265
|
Settings,
|
|
266
266
|
ChevronLeft,
|
|
@@ -751,7 +751,7 @@ var ThemeProvider = ({ children }) => {
|
|
|
751
751
|
var ThemeContext_default = ThemeProvider;
|
|
752
752
|
|
|
753
753
|
// src/contexts/SessionContext.tsx
|
|
754
|
-
import { createContext as
|
|
754
|
+
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect2, useState as useState2 } from "react";
|
|
755
755
|
|
|
756
756
|
// src/services/api.ts
|
|
757
757
|
var chooseEnv = localStorage.getItem("env") ?? "prod";
|
|
@@ -939,359 +939,26 @@ var VendorServices = {
|
|
|
939
939
|
delete: (id) => FetchApi.delete(`${VENDORS_API_URL}${id}/`)
|
|
940
940
|
};
|
|
941
941
|
|
|
942
|
-
// node_modules/react-router/dist/index.js
|
|
943
|
-
import * as React2 from "react";
|
|
944
|
-
|
|
945
|
-
// node_modules/@remix-run/router/dist/router.js
|
|
946
|
-
function _extends() {
|
|
947
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
948
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
949
|
-
var source = arguments[i];
|
|
950
|
-
for (var key in source) {
|
|
951
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
952
|
-
target[key] = source[key];
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
return target;
|
|
957
|
-
};
|
|
958
|
-
return _extends.apply(this, arguments);
|
|
959
|
-
}
|
|
960
|
-
var Action;
|
|
961
|
-
(function(Action2) {
|
|
962
|
-
Action2["Pop"] = "POP";
|
|
963
|
-
Action2["Push"] = "PUSH";
|
|
964
|
-
Action2["Replace"] = "REPLACE";
|
|
965
|
-
})(Action || (Action = {}));
|
|
966
|
-
function invariant(value, message) {
|
|
967
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
968
|
-
throw new Error(message);
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
function warning(cond, message) {
|
|
972
|
-
if (!cond) {
|
|
973
|
-
if (typeof console !== "undefined") console.warn(message);
|
|
974
|
-
try {
|
|
975
|
-
throw new Error(message);
|
|
976
|
-
} catch (e) {
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
function parsePath(path) {
|
|
981
|
-
let parsedPath = {};
|
|
982
|
-
if (path) {
|
|
983
|
-
let hashIndex = path.indexOf("#");
|
|
984
|
-
if (hashIndex >= 0) {
|
|
985
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
986
|
-
path = path.substr(0, hashIndex);
|
|
987
|
-
}
|
|
988
|
-
let searchIndex = path.indexOf("?");
|
|
989
|
-
if (searchIndex >= 0) {
|
|
990
|
-
parsedPath.search = path.substr(searchIndex);
|
|
991
|
-
path = path.substr(0, searchIndex);
|
|
992
|
-
}
|
|
993
|
-
if (path) {
|
|
994
|
-
parsedPath.pathname = path;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
return parsedPath;
|
|
998
|
-
}
|
|
999
|
-
var ResultType;
|
|
1000
|
-
(function(ResultType2) {
|
|
1001
|
-
ResultType2["data"] = "data";
|
|
1002
|
-
ResultType2["deferred"] = "deferred";
|
|
1003
|
-
ResultType2["redirect"] = "redirect";
|
|
1004
|
-
ResultType2["error"] = "error";
|
|
1005
|
-
})(ResultType || (ResultType = {}));
|
|
1006
|
-
function resolvePath(to, fromPathname) {
|
|
1007
|
-
if (fromPathname === void 0) {
|
|
1008
|
-
fromPathname = "/";
|
|
1009
|
-
}
|
|
1010
|
-
let {
|
|
1011
|
-
pathname: toPathname,
|
|
1012
|
-
search = "",
|
|
1013
|
-
hash = ""
|
|
1014
|
-
} = typeof to === "string" ? parsePath(to) : to;
|
|
1015
|
-
let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
|
|
1016
|
-
return {
|
|
1017
|
-
pathname,
|
|
1018
|
-
search: normalizeSearch(search),
|
|
1019
|
-
hash: normalizeHash(hash)
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
function resolvePathname(relativePath, fromPathname) {
|
|
1023
|
-
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
1024
|
-
let relativeSegments = relativePath.split("/");
|
|
1025
|
-
relativeSegments.forEach((segment) => {
|
|
1026
|
-
if (segment === "..") {
|
|
1027
|
-
if (segments.length > 1) segments.pop();
|
|
1028
|
-
} else if (segment !== ".") {
|
|
1029
|
-
segments.push(segment);
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
return segments.length > 1 ? segments.join("/") : "/";
|
|
1033
|
-
}
|
|
1034
|
-
function getInvalidPathError(char, field, dest, path) {
|
|
1035
|
-
return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
|
|
1036
|
-
}
|
|
1037
|
-
function getPathContributingMatches(matches) {
|
|
1038
|
-
return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
|
|
1039
|
-
}
|
|
1040
|
-
function getResolveToMatches(matches, v7_relativeSplatPath) {
|
|
1041
|
-
let pathMatches = getPathContributingMatches(matches);
|
|
1042
|
-
if (v7_relativeSplatPath) {
|
|
1043
|
-
return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
|
|
1044
|
-
}
|
|
1045
|
-
return pathMatches.map((match) => match.pathnameBase);
|
|
1046
|
-
}
|
|
1047
|
-
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
|
|
1048
|
-
if (isPathRelative === void 0) {
|
|
1049
|
-
isPathRelative = false;
|
|
1050
|
-
}
|
|
1051
|
-
let to;
|
|
1052
|
-
if (typeof toArg === "string") {
|
|
1053
|
-
to = parsePath(toArg);
|
|
1054
|
-
} else {
|
|
1055
|
-
to = _extends({}, toArg);
|
|
1056
|
-
invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
|
|
1057
|
-
invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
|
|
1058
|
-
invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
|
|
1059
|
-
}
|
|
1060
|
-
let isEmptyPath = toArg === "" || to.pathname === "";
|
|
1061
|
-
let toPathname = isEmptyPath ? "/" : to.pathname;
|
|
1062
|
-
let from;
|
|
1063
|
-
if (toPathname == null) {
|
|
1064
|
-
from = locationPathname;
|
|
1065
|
-
} else {
|
|
1066
|
-
let routePathnameIndex = routePathnames.length - 1;
|
|
1067
|
-
if (!isPathRelative && toPathname.startsWith("..")) {
|
|
1068
|
-
let toSegments = toPathname.split("/");
|
|
1069
|
-
while (toSegments[0] === "..") {
|
|
1070
|
-
toSegments.shift();
|
|
1071
|
-
routePathnameIndex -= 1;
|
|
1072
|
-
}
|
|
1073
|
-
to.pathname = toSegments.join("/");
|
|
1074
|
-
}
|
|
1075
|
-
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
1076
|
-
}
|
|
1077
|
-
let path = resolvePath(to, from);
|
|
1078
|
-
let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
|
|
1079
|
-
let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
1080
|
-
if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
|
|
1081
|
-
path.pathname += "/";
|
|
1082
|
-
}
|
|
1083
|
-
return path;
|
|
1084
|
-
}
|
|
1085
|
-
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
1086
|
-
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
1087
|
-
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
1088
|
-
var validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
1089
|
-
var validMutationMethods = new Set(validMutationMethodsArr);
|
|
1090
|
-
var validRequestMethodsArr = ["get", ...validMutationMethodsArr];
|
|
1091
|
-
var validRequestMethods = new Set(validRequestMethodsArr);
|
|
1092
|
-
var UNSAFE_DEFERRED_SYMBOL = Symbol("deferred");
|
|
1093
|
-
|
|
1094
|
-
// node_modules/react-router/dist/index.js
|
|
1095
|
-
function _extends2() {
|
|
1096
|
-
_extends2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
1097
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1098
|
-
var source = arguments[i];
|
|
1099
|
-
for (var key in source) {
|
|
1100
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1101
|
-
target[key] = source[key];
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
return target;
|
|
1106
|
-
};
|
|
1107
|
-
return _extends2.apply(this, arguments);
|
|
1108
|
-
}
|
|
1109
|
-
var DataRouterContext = /* @__PURE__ */ React2.createContext(null);
|
|
1110
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1111
|
-
DataRouterContext.displayName = "DataRouter";
|
|
1112
|
-
}
|
|
1113
|
-
var DataRouterStateContext = /* @__PURE__ */ React2.createContext(null);
|
|
1114
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1115
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
1116
|
-
}
|
|
1117
|
-
var AwaitContext = /* @__PURE__ */ React2.createContext(null);
|
|
1118
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1119
|
-
AwaitContext.displayName = "Await";
|
|
1120
|
-
}
|
|
1121
|
-
var NavigationContext = /* @__PURE__ */ React2.createContext(null);
|
|
1122
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1123
|
-
NavigationContext.displayName = "Navigation";
|
|
1124
|
-
}
|
|
1125
|
-
var LocationContext = /* @__PURE__ */ React2.createContext(null);
|
|
1126
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1127
|
-
LocationContext.displayName = "Location";
|
|
1128
|
-
}
|
|
1129
|
-
var RouteContext = /* @__PURE__ */ React2.createContext({
|
|
1130
|
-
outlet: null,
|
|
1131
|
-
matches: [],
|
|
1132
|
-
isDataRoute: false
|
|
1133
|
-
});
|
|
1134
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1135
|
-
RouteContext.displayName = "Route";
|
|
1136
|
-
}
|
|
1137
|
-
var RouteErrorContext = /* @__PURE__ */ React2.createContext(null);
|
|
1138
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1139
|
-
RouteErrorContext.displayName = "RouteError";
|
|
1140
|
-
}
|
|
1141
|
-
function useInRouterContext() {
|
|
1142
|
-
return React2.useContext(LocationContext) != null;
|
|
1143
|
-
}
|
|
1144
|
-
function useLocation() {
|
|
1145
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
|
|
1146
|
-
false,
|
|
1147
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1148
|
-
// router loaded. We can help them understand how to avoid that.
|
|
1149
|
-
"useLocation() may be used only in the context of a <Router> component."
|
|
1150
|
-
) : invariant(false) : void 0;
|
|
1151
|
-
return React2.useContext(LocationContext).location;
|
|
1152
|
-
}
|
|
1153
|
-
var navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
1154
|
-
function useIsomorphicLayoutEffect(cb) {
|
|
1155
|
-
let isStatic = React2.useContext(NavigationContext).static;
|
|
1156
|
-
if (!isStatic) {
|
|
1157
|
-
React2.useLayoutEffect(cb);
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
function useNavigate() {
|
|
1161
|
-
let {
|
|
1162
|
-
isDataRoute
|
|
1163
|
-
} = React2.useContext(RouteContext);
|
|
1164
|
-
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
1165
|
-
}
|
|
1166
|
-
function useNavigateUnstable() {
|
|
1167
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
|
|
1168
|
-
false,
|
|
1169
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1170
|
-
// router loaded. We can help them understand how to avoid that.
|
|
1171
|
-
"useNavigate() may be used only in the context of a <Router> component."
|
|
1172
|
-
) : invariant(false) : void 0;
|
|
1173
|
-
let dataRouterContext = React2.useContext(DataRouterContext);
|
|
1174
|
-
let {
|
|
1175
|
-
basename,
|
|
1176
|
-
future,
|
|
1177
|
-
navigator: navigator2
|
|
1178
|
-
} = React2.useContext(NavigationContext);
|
|
1179
|
-
let {
|
|
1180
|
-
matches
|
|
1181
|
-
} = React2.useContext(RouteContext);
|
|
1182
|
-
let {
|
|
1183
|
-
pathname: locationPathname
|
|
1184
|
-
} = useLocation();
|
|
1185
|
-
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
|
|
1186
|
-
let activeRef = React2.useRef(false);
|
|
1187
|
-
useIsomorphicLayoutEffect(() => {
|
|
1188
|
-
activeRef.current = true;
|
|
1189
|
-
});
|
|
1190
|
-
let navigate = React2.useCallback(function(to, options) {
|
|
1191
|
-
if (options === void 0) {
|
|
1192
|
-
options = {};
|
|
1193
|
-
}
|
|
1194
|
-
process.env.NODE_ENV !== "production" ? warning(activeRef.current, navigateEffectWarning) : void 0;
|
|
1195
|
-
if (!activeRef.current) return;
|
|
1196
|
-
if (typeof to === "number") {
|
|
1197
|
-
navigator2.go(to);
|
|
1198
|
-
return;
|
|
1199
|
-
}
|
|
1200
|
-
let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
|
1201
|
-
if (dataRouterContext == null && basename !== "/") {
|
|
1202
|
-
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
1203
|
-
}
|
|
1204
|
-
(!!options.replace ? navigator2.replace : navigator2.push)(path, options.state, options);
|
|
1205
|
-
}, [basename, navigator2, routePathnamesJson, locationPathname, dataRouterContext]);
|
|
1206
|
-
return navigate;
|
|
1207
|
-
}
|
|
1208
|
-
var DataRouterHook = /* @__PURE__ */ (function(DataRouterHook2) {
|
|
1209
|
-
DataRouterHook2["UseBlocker"] = "useBlocker";
|
|
1210
|
-
DataRouterHook2["UseRevalidator"] = "useRevalidator";
|
|
1211
|
-
DataRouterHook2["UseNavigateStable"] = "useNavigate";
|
|
1212
|
-
return DataRouterHook2;
|
|
1213
|
-
})(DataRouterHook || {});
|
|
1214
|
-
var DataRouterStateHook = /* @__PURE__ */ (function(DataRouterStateHook2) {
|
|
1215
|
-
DataRouterStateHook2["UseBlocker"] = "useBlocker";
|
|
1216
|
-
DataRouterStateHook2["UseLoaderData"] = "useLoaderData";
|
|
1217
|
-
DataRouterStateHook2["UseActionData"] = "useActionData";
|
|
1218
|
-
DataRouterStateHook2["UseRouteError"] = "useRouteError";
|
|
1219
|
-
DataRouterStateHook2["UseNavigation"] = "useNavigation";
|
|
1220
|
-
DataRouterStateHook2["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
1221
|
-
DataRouterStateHook2["UseMatches"] = "useMatches";
|
|
1222
|
-
DataRouterStateHook2["UseRevalidator"] = "useRevalidator";
|
|
1223
|
-
DataRouterStateHook2["UseNavigateStable"] = "useNavigate";
|
|
1224
|
-
DataRouterStateHook2["UseRouteId"] = "useRouteId";
|
|
1225
|
-
return DataRouterStateHook2;
|
|
1226
|
-
})(DataRouterStateHook || {});
|
|
1227
|
-
function getDataRouterConsoleError(hookName) {
|
|
1228
|
-
return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
|
|
1229
|
-
}
|
|
1230
|
-
function useDataRouterContext(hookName) {
|
|
1231
|
-
let ctx = React2.useContext(DataRouterContext);
|
|
1232
|
-
!ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
1233
|
-
return ctx;
|
|
1234
|
-
}
|
|
1235
|
-
function useRouteContext(hookName) {
|
|
1236
|
-
let route = React2.useContext(RouteContext);
|
|
1237
|
-
!route ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
1238
|
-
return route;
|
|
1239
|
-
}
|
|
1240
|
-
function useCurrentRouteId(hookName) {
|
|
1241
|
-
let route = useRouteContext(hookName);
|
|
1242
|
-
let thisRoute = route.matches[route.matches.length - 1];
|
|
1243
|
-
!thisRoute.route.id ? process.env.NODE_ENV !== "production" ? invariant(false, hookName + ' can only be used on routes that contain a unique "id"') : invariant(false) : void 0;
|
|
1244
|
-
return thisRoute.route.id;
|
|
1245
|
-
}
|
|
1246
|
-
function useNavigateStable() {
|
|
1247
|
-
let {
|
|
1248
|
-
router
|
|
1249
|
-
} = useDataRouterContext(DataRouterHook.UseNavigateStable);
|
|
1250
|
-
let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
|
|
1251
|
-
let activeRef = React2.useRef(false);
|
|
1252
|
-
useIsomorphicLayoutEffect(() => {
|
|
1253
|
-
activeRef.current = true;
|
|
1254
|
-
});
|
|
1255
|
-
let navigate = React2.useCallback(function(to, options) {
|
|
1256
|
-
if (options === void 0) {
|
|
1257
|
-
options = {};
|
|
1258
|
-
}
|
|
1259
|
-
process.env.NODE_ENV !== "production" ? warning(activeRef.current, navigateEffectWarning) : void 0;
|
|
1260
|
-
if (!activeRef.current) return;
|
|
1261
|
-
if (typeof to === "number") {
|
|
1262
|
-
router.navigate(to);
|
|
1263
|
-
} else {
|
|
1264
|
-
router.navigate(to, _extends2({
|
|
1265
|
-
fromRouteId: id
|
|
1266
|
-
}, options));
|
|
1267
|
-
}
|
|
1268
|
-
}, [router, id]);
|
|
1269
|
-
return navigate;
|
|
1270
|
-
}
|
|
1271
|
-
var START_TRANSITION = "startTransition";
|
|
1272
|
-
var startTransitionImpl = React2[START_TRANSITION];
|
|
1273
|
-
var neverSettledPromise = new Promise(() => {
|
|
1274
|
-
});
|
|
1275
|
-
|
|
1276
942
|
// src/contexts/SessionContext.tsx
|
|
943
|
+
import { useNavigate } from "react-router";
|
|
1277
944
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1278
|
-
var SessionContext =
|
|
945
|
+
var SessionContext = createContext2(void 0);
|
|
1279
946
|
var useSession = () => {
|
|
1280
|
-
const context =
|
|
947
|
+
const context = useContext2(SessionContext);
|
|
1281
948
|
if (!context) {
|
|
1282
949
|
throw new Error("useSession must be used within a SessionProvider");
|
|
1283
950
|
}
|
|
1284
951
|
return context;
|
|
1285
952
|
};
|
|
1286
953
|
var SessionProvider = ({ children }) => {
|
|
1287
|
-
const [token, setToken] =
|
|
1288
|
-
const [loggedUser, setLoggedUser] =
|
|
1289
|
-
const [activeBusinessEntity, setActiveBusinessEntity] =
|
|
954
|
+
const [token, setToken] = useState2(localStorage.getItem("token"));
|
|
955
|
+
const [loggedUser, setLoggedUser] = useState2(null);
|
|
956
|
+
const [activeBusinessEntity, setActiveBusinessEntity] = useState2(null);
|
|
1290
957
|
const saved_center_id = localStorage.getItem("active_center_id") || "";
|
|
1291
|
-
const [isLoading, setIsLoading] =
|
|
1292
|
-
const [showAuthModal, setShowAuthModal] =
|
|
958
|
+
const [isLoading, setIsLoading] = useState2(true);
|
|
959
|
+
const [showAuthModal, setShowAuthModal] = useState2(false);
|
|
1293
960
|
const navigate = useNavigate();
|
|
1294
|
-
|
|
961
|
+
useEffect2(() => {
|
|
1295
962
|
const initializeSession = async () => {
|
|
1296
963
|
const params = new URLSearchParams(window.location.search);
|
|
1297
964
|
const tkn = params.get("tkn");
|
|
@@ -1323,12 +990,12 @@ var SessionProvider = ({ children }) => {
|
|
|
1323
990
|
};
|
|
1324
991
|
initializeSession();
|
|
1325
992
|
}, []);
|
|
1326
|
-
const [vendors, setVendors] =
|
|
993
|
+
const [vendors, setVendors] = useState2(() => {
|
|
1327
994
|
const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
|
|
1328
995
|
const cached = sessionStorage.getItem(cacheKey);
|
|
1329
996
|
return cached ? JSON.parse(cached) : [];
|
|
1330
997
|
});
|
|
1331
|
-
const [loadingVendors, setLoadingVendors] =
|
|
998
|
+
const [loadingVendors, setLoadingVendors] = useState2(false);
|
|
1332
999
|
const loadVendors = async () => {
|
|
1333
1000
|
if (!token) {
|
|
1334
1001
|
console.error("Vous devez etre connect\xE9 pour voir les organisations");
|
|
@@ -1346,7 +1013,7 @@ var SessionProvider = ({ children }) => {
|
|
|
1346
1013
|
setLoadingVendors(false);
|
|
1347
1014
|
}
|
|
1348
1015
|
};
|
|
1349
|
-
|
|
1016
|
+
useEffect2(() => {
|
|
1350
1017
|
const cacheKey = `vendors_cache_${activeBusinessEntity?.id || "default"}`;
|
|
1351
1018
|
const cached = sessionStorage.getItem(cacheKey);
|
|
1352
1019
|
if (!cached) {
|
|
@@ -1355,7 +1022,7 @@ var SessionProvider = ({ children }) => {
|
|
|
1355
1022
|
setVendors(JSON.parse(cached));
|
|
1356
1023
|
}
|
|
1357
1024
|
}, [activeBusinessEntity?.id]);
|
|
1358
|
-
|
|
1025
|
+
useEffect2(() => {
|
|
1359
1026
|
const storedToken = localStorage.getItem("token");
|
|
1360
1027
|
if (storedToken) {
|
|
1361
1028
|
setToken(storedToken);
|
|
@@ -1391,7 +1058,7 @@ var SessionProvider = ({ children }) => {
|
|
|
1391
1058
|
console.error("Failed to refresh session:", error);
|
|
1392
1059
|
}
|
|
1393
1060
|
};
|
|
1394
|
-
|
|
1061
|
+
useEffect2(() => {
|
|
1395
1062
|
if (token) {
|
|
1396
1063
|
AuthServices.getUserInformations(token).then((res) => {
|
|
1397
1064
|
const result = res;
|
|
@@ -1408,7 +1075,7 @@ var SessionProvider = ({ children }) => {
|
|
|
1408
1075
|
setLoggedUser(null);
|
|
1409
1076
|
}
|
|
1410
1077
|
}, [token]);
|
|
1411
|
-
|
|
1078
|
+
useEffect2(() => {
|
|
1412
1079
|
if (activeBusinessEntity) {
|
|
1413
1080
|
localStorage.setItem("active_center_id", activeBusinessEntity.id.toString());
|
|
1414
1081
|
}
|
|
@@ -1475,20 +1142,20 @@ var UserServices = {
|
|
|
1475
1142
|
};
|
|
1476
1143
|
|
|
1477
1144
|
// src/contexts/ToastContext.tsx
|
|
1478
|
-
import { createContext as
|
|
1145
|
+
import { createContext as createContext3, useContext as useContext3, useState as useState3, useCallback } from "react";
|
|
1479
1146
|
import { AlertTriangle, HelpCircle, AlertCircle, X } from "lucide-react";
|
|
1480
1147
|
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1481
|
-
var ToastContext =
|
|
1148
|
+
var ToastContext = createContext3(void 0);
|
|
1482
1149
|
var useToast = () => {
|
|
1483
|
-
const context =
|
|
1150
|
+
const context = useContext3(ToastContext);
|
|
1484
1151
|
if (!context) {
|
|
1485
1152
|
throw new Error("useToast must be used within a ToastProvider");
|
|
1486
1153
|
}
|
|
1487
1154
|
return context;
|
|
1488
1155
|
};
|
|
1489
1156
|
var ToastProvider = ({ children }) => {
|
|
1490
|
-
const [toasts, setToasts] =
|
|
1491
|
-
const [confirmState, setConfirmState] =
|
|
1157
|
+
const [toasts, setToasts] = useState3([]);
|
|
1158
|
+
const [confirmState, setConfirmState] = useState3({
|
|
1492
1159
|
isOpen: false,
|
|
1493
1160
|
options: null,
|
|
1494
1161
|
resolve: null
|
|
@@ -1496,7 +1163,7 @@ var ToastProvider = ({ children }) => {
|
|
|
1496
1163
|
const generateId2 = () => {
|
|
1497
1164
|
return Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
1498
1165
|
};
|
|
1499
|
-
const addToast =
|
|
1166
|
+
const addToast = useCallback((toast) => {
|
|
1500
1167
|
const id = generateId2();
|
|
1501
1168
|
const defaultDuration = toast.type === "error" ? 7e3 : 3e3;
|
|
1502
1169
|
const duration = toast.duration ?? defaultDuration;
|
|
@@ -1512,22 +1179,22 @@ var ToastProvider = ({ children }) => {
|
|
|
1512
1179
|
}, duration);
|
|
1513
1180
|
}
|
|
1514
1181
|
}, []);
|
|
1515
|
-
const removeToast =
|
|
1182
|
+
const removeToast = useCallback((id) => {
|
|
1516
1183
|
setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
1517
1184
|
}, []);
|
|
1518
|
-
const success =
|
|
1185
|
+
const success = useCallback((message, duration) => {
|
|
1519
1186
|
addToast({ message, type: "success", duration });
|
|
1520
1187
|
}, [addToast]);
|
|
1521
|
-
const error =
|
|
1188
|
+
const error = useCallback((message, duration) => {
|
|
1522
1189
|
addToast({ message, type: "error", duration });
|
|
1523
1190
|
}, [addToast]);
|
|
1524
|
-
const
|
|
1191
|
+
const warning = useCallback((message, duration) => {
|
|
1525
1192
|
addToast({ message, type: "warning", duration });
|
|
1526
1193
|
}, [addToast]);
|
|
1527
|
-
const info =
|
|
1194
|
+
const info = useCallback((message, duration) => {
|
|
1528
1195
|
addToast({ message, type: "info", duration });
|
|
1529
1196
|
}, [addToast]);
|
|
1530
|
-
const confirm2 =
|
|
1197
|
+
const confirm2 = useCallback((options) => {
|
|
1531
1198
|
return new Promise((resolve) => {
|
|
1532
1199
|
const normalizedOptions = typeof options === "string" ? { message: options } : options;
|
|
1533
1200
|
setConfirmState({
|
|
@@ -1537,7 +1204,7 @@ var ToastProvider = ({ children }) => {
|
|
|
1537
1204
|
});
|
|
1538
1205
|
});
|
|
1539
1206
|
}, []);
|
|
1540
|
-
const handleConfirm =
|
|
1207
|
+
const handleConfirm = useCallback((result) => {
|
|
1541
1208
|
if (confirmState.resolve) {
|
|
1542
1209
|
confirmState.resolve(result);
|
|
1543
1210
|
}
|
|
@@ -1553,7 +1220,7 @@ var ToastProvider = ({ children }) => {
|
|
|
1553
1220
|
removeToast,
|
|
1554
1221
|
success,
|
|
1555
1222
|
error,
|
|
1556
|
-
warning
|
|
1223
|
+
warning,
|
|
1557
1224
|
info,
|
|
1558
1225
|
confirm: confirm2
|
|
1559
1226
|
};
|
|
@@ -1629,7 +1296,7 @@ var ToastProvider = ({ children }) => {
|
|
|
1629
1296
|
};
|
|
1630
1297
|
|
|
1631
1298
|
// src/pages/ApprovalPreviewAnswer.tsx
|
|
1632
|
-
import { useState as
|
|
1299
|
+
import { useState as useState4, useEffect as useEffect3 } from "react";
|
|
1633
1300
|
|
|
1634
1301
|
// src/components/common/Cards.tsx
|
|
1635
1302
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -1657,12 +1324,12 @@ var ApprovalServices = {
|
|
|
1657
1324
|
/**
|
|
1658
1325
|
* Obtenir les détails d'un cas d'approbation par process et object_id
|
|
1659
1326
|
*/
|
|
1660
|
-
getDetails: (
|
|
1327
|
+
getDetails: (process, object_id, token) => FetchApi.get(`${APPROVAL_API_URL}details/?process=${process}&object_id=${object_id}`, token),
|
|
1661
1328
|
getAnswerDetails: (link_token) => FetchApi.get(`${APPROVAL_API_URL}answers/?link_token=${link_token}`),
|
|
1662
1329
|
/**
|
|
1663
1330
|
* Obtenir l'historique des versions d'un cas d'approbation
|
|
1664
1331
|
*/
|
|
1665
|
-
getHistory: (
|
|
1332
|
+
getHistory: (process, object_id, token) => FetchApi.get(`${APPROVAL_API_URL}history/?process=${process}&object_id=${object_id}`, token),
|
|
1666
1333
|
/**
|
|
1667
1334
|
* Mettre à jour un cas d'approbation
|
|
1668
1335
|
*/
|
|
@@ -1698,11 +1365,11 @@ var ApprovalServices = {
|
|
|
1698
1365
|
};
|
|
1699
1366
|
|
|
1700
1367
|
// src/pages/ApprovalPreviewAnswer.tsx
|
|
1701
|
-
import { Fragment
|
|
1368
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1702
1369
|
var ApprovalAnswerModal = ({ answer_id, link_token, object_detail }) => {
|
|
1703
|
-
const [answerId, setAnswerId] =
|
|
1704
|
-
const [caseData, setCaseData] =
|
|
1705
|
-
const [loading, setLoading] =
|
|
1370
|
+
const [answerId, setAnswerId] = useState4(answer_id);
|
|
1371
|
+
const [caseData, setCaseData] = useState4(object_detail);
|
|
1372
|
+
const [loading, setLoading] = useState4(false);
|
|
1706
1373
|
const { error: showError, success: showSuccess } = useToast();
|
|
1707
1374
|
const loadData = async () => {
|
|
1708
1375
|
if (!link_token) {
|
|
@@ -1740,11 +1407,11 @@ var ApprovalAnswerModal = ({ answer_id, link_token, object_detail }) => {
|
|
|
1740
1407
|
var ApprovalAnswerPage = () => {
|
|
1741
1408
|
const [searchParams] = useSearchParams();
|
|
1742
1409
|
const { link_token } = useParams();
|
|
1743
|
-
const [answerId, setAnswerId] =
|
|
1410
|
+
const [answerId, setAnswerId] = useState4(null);
|
|
1744
1411
|
const { error: showError, success: showSuccess } = useToast();
|
|
1745
|
-
const [loading, setLoading] =
|
|
1746
|
-
const [caseData, setCaseData] =
|
|
1747
|
-
|
|
1412
|
+
const [loading, setLoading] = useState4(true);
|
|
1413
|
+
const [caseData, setCaseData] = useState4(null);
|
|
1414
|
+
useEffect3(() => {
|
|
1748
1415
|
loadData();
|
|
1749
1416
|
}, [link_token]);
|
|
1750
1417
|
const loadData = async () => {
|
|
@@ -1789,10 +1456,10 @@ var ApprovalAnswerPage = () => {
|
|
|
1789
1456
|
};
|
|
1790
1457
|
var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
|
|
1791
1458
|
const { error: showError, success: showSuccess } = useToast();
|
|
1792
|
-
const [submitting, setSubmitting] =
|
|
1793
|
-
const [showNoteModal, setShowNoteModal] =
|
|
1794
|
-
const [currentAction, setCurrentAction] =
|
|
1795
|
-
const [note, setNote] =
|
|
1459
|
+
const [submitting, setSubmitting] = useState4(false);
|
|
1460
|
+
const [showNoteModal, setShowNoteModal] = useState4(false);
|
|
1461
|
+
const [currentAction, setCurrentAction] = useState4(null);
|
|
1462
|
+
const [note, setNote] = useState4("");
|
|
1796
1463
|
const openNoteModal = (action) => {
|
|
1797
1464
|
setCurrentAction(action);
|
|
1798
1465
|
setNote("");
|
|
@@ -1913,7 +1580,7 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
|
|
|
1913
1580
|
] }) }),
|
|
1914
1581
|
/* @__PURE__ */ jsx8("span", { className: `text-xs font-medium ${statusDisplay.textColor}`, children: statusDisplay.label })
|
|
1915
1582
|
] }),
|
|
1916
|
-
approval.answered_at && /* @__PURE__ */ jsx8(
|
|
1583
|
+
approval.answered_at && /* @__PURE__ */ jsx8(Fragment, { children: /* @__PURE__ */ jsxs5("p", { className: "text-xs text-gray-500", children: [
|
|
1917
1584
|
"R\xE9pondu le ",
|
|
1918
1585
|
new Date(approval.answered_at).toLocaleDateString("fr-FR", {
|
|
1919
1586
|
day: "2-digit",
|
|
@@ -2109,10 +1776,10 @@ var ApprovalPreviewAnswer = ({ loadCase, answerId, caseData }) => {
|
|
|
2109
1776
|
onClick: executeAction,
|
|
2110
1777
|
disabled: submitting || currentAction === "suggest" && !note.trim(),
|
|
2111
1778
|
className: "flex items-center gap-2",
|
|
2112
|
-
children: submitting ? /* @__PURE__ */ jsxs5(
|
|
1779
|
+
children: submitting ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
2113
1780
|
/* @__PURE__ */ jsx8(Loader, { className: "w-4 h-4 animate-spin" }),
|
|
2114
1781
|
"Traitement..."
|
|
2115
|
-
] }) : /* @__PURE__ */ jsxs5(
|
|
1782
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
2116
1783
|
currentAction === "approve" && /* @__PURE__ */ jsx8(Check, { className: "w-4 h-4" }),
|
|
2117
1784
|
currentAction === "reject" && /* @__PURE__ */ jsx8(XCircle, { className: "w-4 h-4" }),
|
|
2118
1785
|
currentAction === "suggest" && /* @__PURE__ */ jsx8(Edit, { className: "w-4 h-4" }),
|
|
@@ -2150,7 +1817,7 @@ var usePermissions = () => {
|
|
|
2150
1817
|
};
|
|
2151
1818
|
|
|
2152
1819
|
// src/components/layout/ModernDoubleSidebarLayout.tsx
|
|
2153
|
-
import { Fragment as
|
|
1820
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2154
1821
|
var MODULE_URLS = {
|
|
2155
1822
|
production: {
|
|
2156
1823
|
wiseConnect: "https://rewise.praedium-tech.com/admin/crm/trade-strategy/lead-insight/",
|
|
@@ -2212,7 +1879,7 @@ var MODULE_CODE_MAP = {
|
|
|
2212
1879
|
"HR": "WiseHR"
|
|
2213
1880
|
};
|
|
2214
1881
|
var RewiseLayout = ({ children, module_name = "Rewise", module_description = "", primaryMenuItems, secondaryMenuItems }) => {
|
|
2215
|
-
const location =
|
|
1882
|
+
const location = useLocation();
|
|
2216
1883
|
const navigate = useNavigate2();
|
|
2217
1884
|
const { theme, themeType, setTheme } = useTheme();
|
|
2218
1885
|
const { loggedUser, token, activeBusinessEntity, setActiveBusinessEntity } = useSession();
|
|
@@ -2234,21 +1901,21 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2234
1901
|
if (!moduleCode) return true;
|
|
2235
1902
|
return organizationModuleCodes.includes(moduleCode);
|
|
2236
1903
|
};
|
|
2237
|
-
const [primaryCollapsed, setPrimaryCollapsed] =
|
|
2238
|
-
const [secondaryCollapsed, setSecondaryCollapsed] =
|
|
2239
|
-
const [mobileMenuOpen, setMobileMenuOpen] =
|
|
2240
|
-
const [selectedModule, setSelectedModule] =
|
|
2241
|
-
const [searchQuery, setSearchQuery] =
|
|
2242
|
-
const [showNotifications, setShowNotifications] =
|
|
2243
|
-
const [showUserMenu, setShowUserMenu] =
|
|
2244
|
-
const [showThemeMenu, setShowThemeMenu] =
|
|
2245
|
-
const [showCenterMenu, setShowCenterMenu] =
|
|
2246
|
-
const [showModulesMenu, setShowModulesMenu] =
|
|
2247
|
-
const [showProfileModal, setShowProfileModal] =
|
|
2248
|
-
const [showEditProfileModal, setShowEditProfileModal] =
|
|
2249
|
-
const [showChangePasswordModal, setShowChangePasswordModal] =
|
|
2250
|
-
const [currentSlide, setCurrentSlide] =
|
|
2251
|
-
const [editProfileData, setEditProfileData] =
|
|
1904
|
+
const [primaryCollapsed, setPrimaryCollapsed] = useState5(false);
|
|
1905
|
+
const [secondaryCollapsed, setSecondaryCollapsed] = useState5(false);
|
|
1906
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState5(false);
|
|
1907
|
+
const [selectedModule, setSelectedModule] = useState5("dashboard");
|
|
1908
|
+
const [searchQuery, setSearchQuery] = useState5("");
|
|
1909
|
+
const [showNotifications, setShowNotifications] = useState5(false);
|
|
1910
|
+
const [showUserMenu, setShowUserMenu] = useState5(false);
|
|
1911
|
+
const [showThemeMenu, setShowThemeMenu] = useState5(false);
|
|
1912
|
+
const [showCenterMenu, setShowCenterMenu] = useState5(false);
|
|
1913
|
+
const [showModulesMenu, setShowModulesMenu] = useState5(false);
|
|
1914
|
+
const [showProfileModal, setShowProfileModal] = useState5(false);
|
|
1915
|
+
const [showEditProfileModal, setShowEditProfileModal] = useState5(false);
|
|
1916
|
+
const [showChangePasswordModal, setShowChangePasswordModal] = useState5(false);
|
|
1917
|
+
const [currentSlide, setCurrentSlide] = useState5(0);
|
|
1918
|
+
const [editProfileData, setEditProfileData] = useState5({
|
|
2252
1919
|
first_name: "",
|
|
2253
1920
|
last_name: "",
|
|
2254
1921
|
email: "",
|
|
@@ -2256,18 +1923,18 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2256
1923
|
job_title: "",
|
|
2257
1924
|
department: ""
|
|
2258
1925
|
});
|
|
2259
|
-
const [savingProfile, setSavingProfile] =
|
|
2260
|
-
const [uploadingPhoto, setUploadingPhoto] =
|
|
2261
|
-
const [passwordData, setPasswordData] =
|
|
1926
|
+
const [savingProfile, setSavingProfile] = useState5(false);
|
|
1927
|
+
const [uploadingPhoto, setUploadingPhoto] = useState5(false);
|
|
1928
|
+
const [passwordData, setPasswordData] = useState5({
|
|
2262
1929
|
current_password: "",
|
|
2263
1930
|
new_password: "",
|
|
2264
1931
|
confirm_password: ""
|
|
2265
1932
|
});
|
|
2266
|
-
const [savingPassword, setSavingPassword] =
|
|
2267
|
-
const [showCurrentPassword, setShowCurrentPassword] =
|
|
2268
|
-
const [showNewPassword, setShowNewPassword] =
|
|
2269
|
-
const [showConfirmPassword, setShowConfirmPassword] =
|
|
2270
|
-
const fileInputRef =
|
|
1933
|
+
const [savingPassword, setSavingPassword] = useState5(false);
|
|
1934
|
+
const [showCurrentPassword, setShowCurrentPassword] = useState5(false);
|
|
1935
|
+
const [showNewPassword, setShowNewPassword] = useState5(false);
|
|
1936
|
+
const [showConfirmPassword, setShowConfirmPassword] = useState5(false);
|
|
1937
|
+
const fileInputRef = React4.useRef(null);
|
|
2271
1938
|
const slides = [
|
|
2272
1939
|
{
|
|
2273
1940
|
title: "Rappel \u2013 Gestion des jours de cong\xE9",
|
|
@@ -2291,16 +1958,16 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2291
1958
|
const goToSlide = (index) => {
|
|
2292
1959
|
setCurrentSlide(index);
|
|
2293
1960
|
};
|
|
2294
|
-
const [showApprovalModal, setShowApprovalModal] =
|
|
2295
|
-
const [approvalAnswerDetail, setApprovalAnswerDetail] =
|
|
2296
|
-
const [caseData, setCaseData] =
|
|
2297
|
-
const [selectedCenterId, setSelectedCenterId] =
|
|
1961
|
+
const [showApprovalModal, setShowApprovalModal] = useState5(false);
|
|
1962
|
+
const [approvalAnswerDetail, setApprovalAnswerDetail] = useState5(null);
|
|
1963
|
+
const [caseData, setCaseData] = useState5(null);
|
|
1964
|
+
const [selectedCenterId, setSelectedCenterId] = useState5(
|
|
2298
1965
|
loggedUser?.centers_access?.[0]?.id || null
|
|
2299
1966
|
);
|
|
2300
1967
|
const { success, error: showError } = useToast();
|
|
2301
|
-
const [notifications, setNotifications] =
|
|
2302
|
-
const [loading, setLoading] =
|
|
2303
|
-
|
|
1968
|
+
const [notifications, setNotifications] = useState5([]);
|
|
1969
|
+
const [loading, setLoading] = useState5(false);
|
|
1970
|
+
useEffect4(() => {
|
|
2304
1971
|
const handleKeyDown = (e) => {
|
|
2305
1972
|
if (e.altKey && e.key === "m") {
|
|
2306
1973
|
e.preventDefault();
|
|
@@ -2321,7 +1988,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2321
1988
|
document.addEventListener("keydown", handleKeyDown);
|
|
2322
1989
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2323
1990
|
}, []);
|
|
2324
|
-
|
|
1991
|
+
useEffect4(() => {
|
|
2325
1992
|
const loadOrganizations = async () => {
|
|
2326
1993
|
try {
|
|
2327
1994
|
setLoading(true);
|
|
@@ -2339,7 +2006,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2339
2006
|
loadOrganizations();
|
|
2340
2007
|
}
|
|
2341
2008
|
}, [loggedUser]);
|
|
2342
|
-
|
|
2009
|
+
useEffect4(() => {
|
|
2343
2010
|
const path = location.pathname;
|
|
2344
2011
|
const moduleMatch = path.match(/^\/([^/]+)/);
|
|
2345
2012
|
if (moduleMatch) {
|
|
@@ -2591,7 +2258,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2591
2258
|
"transition-colors",
|
|
2592
2259
|
isModuleActive(item.id) ? "text-[var(--color-primary)]" : "text-[var(--color-sidebar-text-secondary)] group-hover:text-[var(--color-sidebar-text)]"
|
|
2593
2260
|
), children: item.icon }),
|
|
2594
|
-
!primaryCollapsed && /* @__PURE__ */ jsxs6(
|
|
2261
|
+
!primaryCollapsed && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2595
2262
|
/* @__PURE__ */ jsx9("span", { className: cn(
|
|
2596
2263
|
"flex-1 text-left text-sm font-medium transition-colors",
|
|
2597
2264
|
isModuleActive(item.id) ? "text-[var(--color-sidebar-text)]" : "text-[var(--color-sidebar-text-secondary)] group-hover:text-[var(--color-sidebar-text)]"
|
|
@@ -2618,7 +2285,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2618
2285
|
]
|
|
2619
2286
|
}
|
|
2620
2287
|
),
|
|
2621
|
-
secondaryMenuItems[selectedModule] && /* @__PURE__ */ jsxs6(
|
|
2288
|
+
secondaryMenuItems[selectedModule] && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2622
2289
|
secondaryCollapsed && /* @__PURE__ */ jsx9(
|
|
2623
2290
|
"button",
|
|
2624
2291
|
{
|
|
@@ -2690,7 +2357,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2690
2357
|
}
|
|
2691
2358
|
)
|
|
2692
2359
|
] }),
|
|
2693
|
-
mobileMenuOpen && /* @__PURE__ */ jsxs6(
|
|
2360
|
+
mobileMenuOpen && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2694
2361
|
/* @__PURE__ */ jsx9(
|
|
2695
2362
|
"div",
|
|
2696
2363
|
{
|
|
@@ -2807,7 +2474,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
2807
2474
|
{
|
|
2808
2475
|
className: "hidden sm:flex items-center gap-2 text-sm",
|
|
2809
2476
|
"aria-label": "Fil d'Ariane",
|
|
2810
|
-
children: getBreadcrumbs().map((crumb, index) => /* @__PURE__ */ jsxs6(
|
|
2477
|
+
children: getBreadcrumbs().map((crumb, index) => /* @__PURE__ */ jsxs6(React4.Fragment, { children: [
|
|
2811
2478
|
index > 0 && /* @__PURE__ */ jsx9(ChevronRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }),
|
|
2812
2479
|
/* @__PURE__ */ jsx9(
|
|
2813
2480
|
"button",
|
|
@@ -3770,14 +3437,14 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "",
|
|
|
3770
3437
|
var ModernDoubleSidebarLayout_default = RewiseLayout;
|
|
3771
3438
|
|
|
3772
3439
|
// src/components/ui/Toast.tsx
|
|
3773
|
-
import { useEffect as
|
|
3440
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
3774
3441
|
import { CheckCircle as CheckCircle2, XCircle as XCircle2, AlertTriangle as AlertTriangle2, Info as Info2, X as X4 } from "lucide-react";
|
|
3775
3442
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3776
3443
|
var ToastItem = ({ toast }) => {
|
|
3777
3444
|
const { removeToast } = useToast();
|
|
3778
|
-
const [isVisible, setIsVisible] =
|
|
3779
|
-
const [isLeaving, setIsLeaving] =
|
|
3780
|
-
|
|
3445
|
+
const [isVisible, setIsVisible] = useState6(false);
|
|
3446
|
+
const [isLeaving, setIsLeaving] = useState6(false);
|
|
3447
|
+
useEffect5(() => {
|
|
3781
3448
|
const timer = setTimeout(() => setIsVisible(true), 10);
|
|
3782
3449
|
return () => clearTimeout(timer);
|
|
3783
3450
|
}, []);
|
|
@@ -3844,17 +3511,17 @@ var Toast_default = ToastContainer;
|
|
|
3844
3511
|
|
|
3845
3512
|
// src/components/common/Pages.tsx
|
|
3846
3513
|
import { ChevronLeft as ChevronLeft2, Download, Menu as Menu2, Settings as Settings2 } from "lucide-react";
|
|
3847
|
-
import { useState as
|
|
3848
|
-
import { Fragment as
|
|
3514
|
+
import { useState as useState7 } from "react";
|
|
3515
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3849
3516
|
var Pages = ({
|
|
3850
3517
|
title = "",
|
|
3851
3518
|
description = "",
|
|
3852
3519
|
sideAction,
|
|
3853
3520
|
sidebar,
|
|
3854
|
-
tabs = /* @__PURE__ */ jsx11(
|
|
3521
|
+
tabs = /* @__PURE__ */ jsx11(Fragment3, {}),
|
|
3855
3522
|
children
|
|
3856
3523
|
}) => {
|
|
3857
|
-
const [sidebarOpen, setSidebarOpen] =
|
|
3524
|
+
const [sidebarOpen, setSidebarOpen] = useState7(false);
|
|
3858
3525
|
return /* @__PURE__ */ jsxs8("div", { className: "flex h-full bg-gray-100", children: [
|
|
3859
3526
|
/* @__PURE__ */ jsxs8("div", { className: "flex-1 flex flex-col", children: [
|
|
3860
3527
|
/* @__PURE__ */ jsxs8("div", { className: "bg-white border-b border-gray-200 p-6", children: [
|
|
@@ -4041,10 +3708,10 @@ var Badge = ({
|
|
|
4041
3708
|
};
|
|
4042
3709
|
|
|
4043
3710
|
// src/components/common/FDrawer.tsx
|
|
4044
|
-
import
|
|
4045
|
-
import { useLocation as
|
|
3711
|
+
import React7, { useEffect as useEffect6, useState as useState8, useRef } from "react";
|
|
3712
|
+
import { useLocation as useLocation2, useNavigate as useNavigate3, useSearchParams as useSearchParams2, Link as Link3 } from "react-router-dom";
|
|
4046
3713
|
import { ArrowDownAZ, ArrowDownUp, ArrowUpAZ, AlertCircle as AlertCircle3, CheckCircle2 as CheckCircle22, ChevronDown, Columns3, Copy, Download as Download2, FileSpreadsheet, Filter, LayoutGrid as LayoutGrid2, LayoutList, Maximize2, Minimize2, MoreVertical, Plus, Printer, RefreshCw, Settings2 as Settings22, Trash2 as Trash22, Upload, X as X5, Search as Search2, SquareIcon } from "lucide-react";
|
|
4047
|
-
import { Fragment as
|
|
3714
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4048
3715
|
var ExcelImportModal = ({
|
|
4049
3716
|
isOpen,
|
|
4050
3717
|
onClose,
|
|
@@ -4053,13 +3720,13 @@ var ExcelImportModal = ({
|
|
|
4053
3720
|
onSuccess
|
|
4054
3721
|
}) => {
|
|
4055
3722
|
const { activeBusinessEntity, token } = useSession();
|
|
4056
|
-
const fileInputRef =
|
|
4057
|
-
const [file, setFile] =
|
|
4058
|
-
const [columnMapping, setColumnMapping] =
|
|
4059
|
-
const [loading, setLoading] =
|
|
4060
|
-
const [errors, setErrors] =
|
|
4061
|
-
const [importResults, setImportResults] =
|
|
4062
|
-
const [currentStep, setCurrentStep] =
|
|
3723
|
+
const fileInputRef = useRef(null);
|
|
3724
|
+
const [file, setFile] = useState8(null);
|
|
3725
|
+
const [columnMapping, setColumnMapping] = useState8([]);
|
|
3726
|
+
const [loading, setLoading] = useState8(false);
|
|
3727
|
+
const [errors, setErrors] = useState8([]);
|
|
3728
|
+
const [importResults, setImportResults] = useState8(null);
|
|
3729
|
+
const [currentStep, setCurrentStep] = useState8(1);
|
|
4063
3730
|
const allFields = [...importFields.required, ...importFields.optional];
|
|
4064
3731
|
const handleFileChange = (event) => {
|
|
4065
3732
|
const selectedFile = event.target.files?.[0];
|
|
@@ -4189,7 +3856,7 @@ var ExcelImportModal = ({
|
|
|
4189
3856
|
] }),
|
|
4190
3857
|
/* @__PURE__ */ jsx14("button", { type: "button", onClick: handleClose, className: "p-1 hover:bg-gray-100 rounded-lg", children: /* @__PURE__ */ jsx14(X5, { className: "h-5 w-5 text-gray-500" }) })
|
|
4191
3858
|
] }),
|
|
4192
|
-
/* @__PURE__ */ jsx14("div", { className: "flex justify-center py-4 border-b border-gray-100", children: /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2", children: [1, 2, 3].map((step, index) => /* @__PURE__ */ jsxs10(
|
|
3859
|
+
/* @__PURE__ */ jsx14("div", { className: "flex justify-center py-4 border-b border-gray-100", children: /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2", children: [1, 2, 3].map((step, index) => /* @__PURE__ */ jsxs10(React7.Fragment, { children: [
|
|
4193
3860
|
/* @__PURE__ */ jsx14("div", { className: cn(
|
|
4194
3861
|
"w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors",
|
|
4195
3862
|
currentStep >= step ? "bg-[var(--color-primary)] text-white" : "bg-gray-200 text-gray-500"
|
|
@@ -4321,10 +3988,10 @@ var ExcelImportModal = ({
|
|
|
4321
3988
|
onClick: executeImport,
|
|
4322
3989
|
disabled: loading,
|
|
4323
3990
|
variant: "full",
|
|
4324
|
-
children: loading ? /* @__PURE__ */ jsxs10(
|
|
3991
|
+
children: loading ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
4325
3992
|
/* @__PURE__ */ jsx14("div", { className: "animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full" }),
|
|
4326
3993
|
"Importation..."
|
|
4327
|
-
] }) : /* @__PURE__ */ jsxs10(
|
|
3994
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
4328
3995
|
/* @__PURE__ */ jsx14(Upload, { className: "h-4 w-4" }),
|
|
4329
3996
|
"Lancer l'importation"
|
|
4330
3997
|
] })
|
|
@@ -4401,41 +4068,41 @@ var FDrawer = ({
|
|
|
4401
4068
|
}) => {
|
|
4402
4069
|
const navigate = useNavigate3();
|
|
4403
4070
|
const [searchParams] = useSearchParams2();
|
|
4404
|
-
const location =
|
|
4071
|
+
const location = useLocation2();
|
|
4405
4072
|
const allParams = Object.fromEntries([...searchParams]);
|
|
4406
4073
|
const { activeBusinessEntity, token } = useSession();
|
|
4407
4074
|
const { hasPermission } = usePermissions();
|
|
4408
|
-
const [data, setData] =
|
|
4409
|
-
const [order_by, setOrderBy] =
|
|
4410
|
-
const [loading, setLoading] =
|
|
4411
|
-
const [showOrdering, setShowOrdering] =
|
|
4412
|
-
const [showFilters, setShowFilters] =
|
|
4413
|
-
const [dropdownOpen, setDropdownOpen] =
|
|
4414
|
-
const [queryURL, setQueryURL] =
|
|
4415
|
-
const [reponseDetail, setReponseDetail] =
|
|
4075
|
+
const [data, setData] = useState8([]);
|
|
4076
|
+
const [order_by, setOrderBy] = useState8(ordering || "-id");
|
|
4077
|
+
const [loading, setLoading] = useState8(false);
|
|
4078
|
+
const [showOrdering, setShowOrdering] = useState8(null);
|
|
4079
|
+
const [showFilters, setShowFilters] = useState8(null);
|
|
4080
|
+
const [dropdownOpen, setDropdownOpen] = useState8(null);
|
|
4081
|
+
const [queryURL, setQueryURL] = useState8("");
|
|
4082
|
+
const [reponseDetail, setReponseDetail] = useState8({
|
|
4416
4083
|
total_pages: null,
|
|
4417
4084
|
previous: null,
|
|
4418
4085
|
next: null,
|
|
4419
4086
|
current_page: null
|
|
4420
4087
|
});
|
|
4421
|
-
const [searchQuery, setSearchQuery] =
|
|
4422
|
-
const [debouncedSearchQuery, setDebouncedSearchQuery] =
|
|
4423
|
-
const searchTimeoutRef =
|
|
4424
|
-
const [showFilterPanel, setShowFilterPanel] =
|
|
4425
|
-
const filterPanelRef =
|
|
4426
|
-
const [showImportModal, setShowImportModal] =
|
|
4427
|
-
const [showMoreOptions, setShowMoreOptions] =
|
|
4428
|
-
const moreOptionsRef =
|
|
4429
|
-
const [selectionMode, setSelectionMode] =
|
|
4430
|
-
const [selectedItems, setSelectedItems] =
|
|
4431
|
-
const [showColumnsPanel, setShowColumnsPanel] =
|
|
4432
|
-
const [visibleColumns, setVisibleColumns] =
|
|
4433
|
-
const columnsPanelRef =
|
|
4434
|
-
const [density, setDensity] =
|
|
4435
|
-
const [isFullscreen, setIsFullscreen] =
|
|
4436
|
-
const tableContainerRef =
|
|
4437
|
-
const [viewMode, setViewMode] =
|
|
4438
|
-
|
|
4088
|
+
const [searchQuery, setSearchQuery] = useState8("");
|
|
4089
|
+
const [debouncedSearchQuery, setDebouncedSearchQuery] = useState8("");
|
|
4090
|
+
const searchTimeoutRef = useRef(null);
|
|
4091
|
+
const [showFilterPanel, setShowFilterPanel] = useState8(false);
|
|
4092
|
+
const filterPanelRef = useRef(null);
|
|
4093
|
+
const [showImportModal, setShowImportModal] = useState8(false);
|
|
4094
|
+
const [showMoreOptions, setShowMoreOptions] = useState8(false);
|
|
4095
|
+
const moreOptionsRef = useRef(null);
|
|
4096
|
+
const [selectionMode, setSelectionMode] = useState8(false);
|
|
4097
|
+
const [selectedItems, setSelectedItems] = useState8([]);
|
|
4098
|
+
const [showColumnsPanel, setShowColumnsPanel] = useState8(false);
|
|
4099
|
+
const [visibleColumns, setVisibleColumns] = useState8(columns.map((c) => c.key));
|
|
4100
|
+
const columnsPanelRef = useRef(null);
|
|
4101
|
+
const [density, setDensity] = useState8("compact");
|
|
4102
|
+
const [isFullscreen, setIsFullscreen] = useState8(false);
|
|
4103
|
+
const tableContainerRef = useRef(null);
|
|
4104
|
+
const [viewMode, setViewMode] = useState8(defaultView);
|
|
4105
|
+
useEffect6(() => {
|
|
4439
4106
|
if (searchTimeoutRef.current) {
|
|
4440
4107
|
clearTimeout(searchTimeoutRef.current);
|
|
4441
4108
|
}
|
|
@@ -4448,15 +4115,15 @@ var FDrawer = ({
|
|
|
4448
4115
|
}
|
|
4449
4116
|
};
|
|
4450
4117
|
}, [searchQuery]);
|
|
4451
|
-
|
|
4118
|
+
useEffect6(() => {
|
|
4452
4119
|
setFilters((prev) => ({ ...prev, global_search: debouncedSearchQuery, page: 1 }));
|
|
4453
4120
|
}, [debouncedSearchQuery]);
|
|
4454
|
-
|
|
4121
|
+
useEffect6(() => {
|
|
4455
4122
|
if (activeBusinessEntity?.id) {
|
|
4456
4123
|
setFilters((prev) => ({ ...prev, business_entity_id: activeBusinessEntity.id }));
|
|
4457
4124
|
}
|
|
4458
4125
|
}, [activeBusinessEntity?.id]);
|
|
4459
|
-
|
|
4126
|
+
useEffect6(() => {
|
|
4460
4127
|
const handleClickOutside = (event) => {
|
|
4461
4128
|
if (filterPanelRef.current && !filterPanelRef.current.contains(event.target)) {
|
|
4462
4129
|
setShowFilterPanel(false);
|
|
@@ -4471,7 +4138,7 @@ var FDrawer = ({
|
|
|
4471
4138
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4472
4139
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
4473
4140
|
}, []);
|
|
4474
|
-
|
|
4141
|
+
useEffect6(() => {
|
|
4475
4142
|
const handleFullscreenChange = () => {
|
|
4476
4143
|
setIsFullscreen(!!document.fullscreenElement);
|
|
4477
4144
|
};
|
|
@@ -4483,7 +4150,7 @@ var FDrawer = ({
|
|
|
4483
4150
|
return acc;
|
|
4484
4151
|
}, {});
|
|
4485
4152
|
const preFilters = columns.length > 0 ? makeFilters() : [];
|
|
4486
|
-
const [filters, setFilters] =
|
|
4153
|
+
const [filters, setFilters] = useState8(
|
|
4487
4154
|
() => Object.keys(allParams).length > 0 ? allParams : { ...preFilters, business_entity_id: activeBusinessEntity?.id ?? null, order_by: order_by ?? "id", page: 1 }
|
|
4488
4155
|
);
|
|
4489
4156
|
const getDataFilter = async () => {
|
|
@@ -4506,7 +4173,7 @@ var FDrawer = ({
|
|
|
4506
4173
|
setLoading(false);
|
|
4507
4174
|
}
|
|
4508
4175
|
};
|
|
4509
|
-
|
|
4176
|
+
useEffect6(() => {
|
|
4510
4177
|
const cleanFilters = {};
|
|
4511
4178
|
Object.entries(filters).forEach(([key, value]) => {
|
|
4512
4179
|
if (value !== "" && value !== null && value !== void 0) {
|
|
@@ -4517,7 +4184,7 @@ var FDrawer = ({
|
|
|
4517
4184
|
setQueryURL(`${API_URL}${apiEndpoint}?${params}`);
|
|
4518
4185
|
navigate(`${location.pathname}?${params}`);
|
|
4519
4186
|
}, [filters]);
|
|
4520
|
-
|
|
4187
|
+
useEffect6(() => {
|
|
4521
4188
|
if (!activeBusinessEntity) return;
|
|
4522
4189
|
getDataFilter();
|
|
4523
4190
|
}, [activeBusinessEntity, queryURL, toggle]);
|
|
@@ -4730,7 +4397,7 @@ var FDrawer = ({
|
|
|
4730
4397
|
};
|
|
4731
4398
|
const densityClasses = getDensityClasses();
|
|
4732
4399
|
const visibleColumnsData = columns.filter((col) => visibleColumns.includes(col.key));
|
|
4733
|
-
return /* @__PURE__ */ jsxs10(
|
|
4400
|
+
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
4734
4401
|
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap gap-4 mb-4", children: [
|
|
4735
4402
|
/* @__PURE__ */ jsx14("div", { className: "flex-1 min-w-64", children: /* @__PURE__ */ jsxs10("div", { className: "relative", children: [
|
|
4736
4403
|
/* @__PURE__ */ jsx14(Search2, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" }),
|
|
@@ -5138,7 +4805,7 @@ var FDrawer = ({
|
|
|
5138
4805
|
setDropdownOpen(null);
|
|
5139
4806
|
}, 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)
|
|
5140
4807
|
),
|
|
5141
|
-
onDuplicate && /* @__PURE__ */ jsxs10(
|
|
4808
|
+
onDuplicate && /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
5142
4809
|
/* @__PURE__ */ jsx14("div", { className: "border-t border-gray-100 my-1" }),
|
|
5143
4810
|
/* @__PURE__ */ jsxs10(
|
|
5144
4811
|
"button",
|
|
@@ -5249,16 +4916,16 @@ var Pagination = ({
|
|
|
5249
4916
|
};
|
|
5250
4917
|
|
|
5251
4918
|
// src/components/common/FormVendor.tsx
|
|
5252
|
-
import { useState as
|
|
4919
|
+
import { useState as useState19 } from "react";
|
|
5253
4920
|
|
|
5254
4921
|
// src/components/common/CommonSelect.tsx
|
|
5255
|
-
import { useEffect as
|
|
4922
|
+
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
5256
4923
|
|
|
5257
4924
|
// src/components/common/SearchableSelect.tsx
|
|
5258
|
-
import { useState as
|
|
4925
|
+
import { useState as useState9, useRef as useRef2, useEffect as useEffect7 } from "react";
|
|
5259
4926
|
import { createPortal as createPortal2 } from "react-dom";
|
|
5260
4927
|
import { Search as Search3, ChevronDown as ChevronDown2, X as X6, RefreshCw as RefreshCw2, Plus as Plus2 } from "lucide-react";
|
|
5261
|
-
import { Fragment as
|
|
4928
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5262
4929
|
var SearchableSelect = ({
|
|
5263
4930
|
options,
|
|
5264
4931
|
value,
|
|
@@ -5272,12 +4939,12 @@ var SearchableSelect = ({
|
|
|
5272
4939
|
addElement,
|
|
5273
4940
|
refresh
|
|
5274
4941
|
}) => {
|
|
5275
|
-
const [isOpen, setIsOpen] =
|
|
5276
|
-
const [searchTerm, setSearchTerm] =
|
|
5277
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
5278
|
-
const dropdownRef =
|
|
5279
|
-
const dropdownMenuRef =
|
|
5280
|
-
const inputRef =
|
|
4942
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
4943
|
+
const [searchTerm, setSearchTerm] = useState9("");
|
|
4944
|
+
const [dropdownPosition, setDropdownPosition] = useState9({ top: 0, left: 0, width: 0 });
|
|
4945
|
+
const dropdownRef = useRef2(null);
|
|
4946
|
+
const dropdownMenuRef = useRef2(null);
|
|
4947
|
+
const inputRef = useRef2(null);
|
|
5281
4948
|
const selectedOption = options.find((option) => option.value === value);
|
|
5282
4949
|
const defaultFilter = (option, searchTerm2) => {
|
|
5283
4950
|
return option.label.toLowerCase().includes(searchTerm2.toLowerCase());
|
|
@@ -5285,7 +4952,7 @@ var SearchableSelect = ({
|
|
|
5285
4952
|
const filteredOptions = options.filter(
|
|
5286
4953
|
(option) => filterFunction ? filterFunction(option, searchTerm) : defaultFilter(option, searchTerm)
|
|
5287
4954
|
);
|
|
5288
|
-
|
|
4955
|
+
useEffect7(() => {
|
|
5289
4956
|
if (isOpen && dropdownRef.current) {
|
|
5290
4957
|
const rect = dropdownRef.current.getBoundingClientRect();
|
|
5291
4958
|
setDropdownPosition({
|
|
@@ -5295,7 +4962,7 @@ var SearchableSelect = ({
|
|
|
5295
4962
|
});
|
|
5296
4963
|
}
|
|
5297
4964
|
}, [isOpen]);
|
|
5298
|
-
|
|
4965
|
+
useEffect7(() => {
|
|
5299
4966
|
const handleClickOutside = (event) => {
|
|
5300
4967
|
const target = event.target;
|
|
5301
4968
|
const isOutsideTrigger = dropdownRef.current && !dropdownRef.current.contains(target);
|
|
@@ -5339,7 +5006,7 @@ var SearchableSelect = ({
|
|
|
5339
5006
|
${isOpen ? "ring-2 ring-[#6B7C92] border-transparent" : ""}
|
|
5340
5007
|
`,
|
|
5341
5008
|
children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
5342
|
-
/* @__PURE__ */ jsx15("div", { className: "flex items-center space-x-2 flex-1 min-w-0", children: selectedOption ? /* @__PURE__ */ jsxs11(
|
|
5009
|
+
/* @__PURE__ */ jsx15("div", { className: "flex items-center space-x-2 flex-1 min-w-0", children: selectedOption ? /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
5343
5010
|
selectedOption.image && /* @__PURE__ */ jsx15(
|
|
5344
5011
|
"img",
|
|
5345
5012
|
{
|
|
@@ -5516,7 +5183,7 @@ var SelectVendor = ({
|
|
|
5516
5183
|
onRemove,
|
|
5517
5184
|
label = "Ajouter un fournisseur"
|
|
5518
5185
|
}) => {
|
|
5519
|
-
const [showModal, setShowModal] =
|
|
5186
|
+
const [showModal, setShowModal] = useState10(false);
|
|
5520
5187
|
const { vendors, loadingVendors, loadVendors } = useSession();
|
|
5521
5188
|
const getVendorOptions = () => {
|
|
5522
5189
|
return vendors.filter((vendor) => vendor.id !== void 0).map((vendor) => ({
|
|
@@ -5569,13 +5236,13 @@ var SelectUser = ({
|
|
|
5569
5236
|
label = "S\xE9lectionner un utilisateur"
|
|
5570
5237
|
}) => {
|
|
5571
5238
|
const { token, activeBusinessEntity } = useSession();
|
|
5572
|
-
const [users, setUsers] =
|
|
5239
|
+
const [users, setUsers] = useState10(() => {
|
|
5573
5240
|
const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5574
5241
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5575
5242
|
return cached ? JSON.parse(cached) : [];
|
|
5576
5243
|
});
|
|
5577
|
-
const [loading, setLoading] =
|
|
5578
|
-
|
|
5244
|
+
const [loading, setLoading] = useState10(false);
|
|
5245
|
+
useEffect8(() => {
|
|
5579
5246
|
const cacheKey = `users_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5580
5247
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5581
5248
|
if (!cached) {
|
|
@@ -5649,13 +5316,13 @@ var SelectDepartment = ({
|
|
|
5649
5316
|
label = "S\xE9lectionner un d\xE9partement"
|
|
5650
5317
|
}) => {
|
|
5651
5318
|
const { token, activeBusinessEntity } = useSession();
|
|
5652
|
-
const [departments, setDepartments] =
|
|
5319
|
+
const [departments, setDepartments] = useState10(() => {
|
|
5653
5320
|
const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5654
5321
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5655
5322
|
return cached ? JSON.parse(cached) : [];
|
|
5656
5323
|
});
|
|
5657
|
-
const [loading, setLoading] =
|
|
5658
|
-
|
|
5324
|
+
const [loading, setLoading] = useState10(false);
|
|
5325
|
+
useEffect8(() => {
|
|
5659
5326
|
const cacheKey = `departments_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5660
5327
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5661
5328
|
if (!cached) {
|
|
@@ -5719,13 +5386,13 @@ var SelectCostCenter = ({
|
|
|
5719
5386
|
label = "S\xE9lectionner un centre de co\xFBt"
|
|
5720
5387
|
}) => {
|
|
5721
5388
|
const { token, activeBusinessEntity } = useSession();
|
|
5722
|
-
const [costCenters, setCostCenters] =
|
|
5389
|
+
const [costCenters, setCostCenters] = useState10(() => {
|
|
5723
5390
|
const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5724
5391
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5725
5392
|
return cached ? JSON.parse(cached) : [];
|
|
5726
5393
|
});
|
|
5727
|
-
const [loading, setLoading] =
|
|
5728
|
-
|
|
5394
|
+
const [loading, setLoading] = useState10(false);
|
|
5395
|
+
useEffect8(() => {
|
|
5729
5396
|
const cacheKey = `cost_centers_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5730
5397
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5731
5398
|
if (!cached) {
|
|
@@ -5796,13 +5463,13 @@ var SelectUnit = ({
|
|
|
5796
5463
|
label = "S\xE9lectionner une cellule"
|
|
5797
5464
|
}) => {
|
|
5798
5465
|
const { token, activeBusinessEntity } = useSession();
|
|
5799
|
-
const [units, setUnits] =
|
|
5466
|
+
const [units, setUnits] = useState10(() => {
|
|
5800
5467
|
const cacheKey = `units_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5801
5468
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5802
5469
|
return cached ? JSON.parse(cached) : [];
|
|
5803
5470
|
});
|
|
5804
|
-
const [loading, setLoading] =
|
|
5805
|
-
|
|
5471
|
+
const [loading, setLoading] = useState10(false);
|
|
5472
|
+
useEffect8(() => {
|
|
5806
5473
|
const cacheKey = `units_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5807
5474
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5808
5475
|
if (!cached) {
|
|
@@ -5896,23 +5563,23 @@ var SelectAccount = ({
|
|
|
5896
5563
|
onRemove
|
|
5897
5564
|
}) => {
|
|
5898
5565
|
const { token, activeBusinessEntity } = useSession();
|
|
5899
|
-
const [accounts, setAccounts] =
|
|
5566
|
+
const [accounts, setAccounts] = useState10(() => {
|
|
5900
5567
|
const cacheKey = `accounts_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5901
5568
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5902
5569
|
return cached ? JSON.parse(cached) : [];
|
|
5903
5570
|
});
|
|
5904
|
-
const [loading, setLoading] =
|
|
5905
|
-
const [showModal, setShowModal] =
|
|
5906
|
-
const [formLoading, setFormLoading] =
|
|
5907
|
-
const [formData, setFormData] =
|
|
5571
|
+
const [loading, setLoading] = useState10(false);
|
|
5572
|
+
const [showModal, setShowModal] = useState10(false);
|
|
5573
|
+
const [formLoading, setFormLoading] = useState10(false);
|
|
5574
|
+
const [formData, setFormData] = useState10({
|
|
5908
5575
|
account_number: filterClass || "",
|
|
5909
5576
|
name: "",
|
|
5910
5577
|
balance: "Dr",
|
|
5911
5578
|
account_type: "E",
|
|
5912
5579
|
is_active: true
|
|
5913
5580
|
});
|
|
5914
|
-
const [formErrors, setFormErrors] =
|
|
5915
|
-
|
|
5581
|
+
const [formErrors, setFormErrors] = useState10({});
|
|
5582
|
+
useEffect8(() => {
|
|
5916
5583
|
const cacheKey = `accounts_cache_${activeBusinessEntity?.id || "default"}`;
|
|
5917
5584
|
const cached = sessionStorage.getItem(cacheKey);
|
|
5918
5585
|
if (!cached) {
|
|
@@ -6429,13 +6096,13 @@ var SelectClient = ({
|
|
|
6429
6096
|
label = "S\xE9lectionner un client"
|
|
6430
6097
|
}) => {
|
|
6431
6098
|
const { token, activeBusinessEntity } = useSession();
|
|
6432
|
-
const [clients, setClients] =
|
|
6099
|
+
const [clients, setClients] = useState10(() => {
|
|
6433
6100
|
const cacheKey = `clients_cache_${activeBusinessEntity?.id || "default"}`;
|
|
6434
6101
|
const cached = sessionStorage.getItem(cacheKey);
|
|
6435
6102
|
return cached ? JSON.parse(cached) : [];
|
|
6436
6103
|
});
|
|
6437
|
-
const [loading, setLoading] =
|
|
6438
|
-
|
|
6104
|
+
const [loading, setLoading] = useState10(false);
|
|
6105
|
+
useEffect8(() => {
|
|
6439
6106
|
const cacheKey = `clients_cache_${activeBusinessEntity?.id || "default"}`;
|
|
6440
6107
|
const cached = sessionStorage.getItem(cacheKey);
|
|
6441
6108
|
if (!cached) {
|
|
@@ -6497,11 +6164,11 @@ var SelectClient = ({
|
|
|
6497
6164
|
};
|
|
6498
6165
|
|
|
6499
6166
|
// src/components/common/FileManager/FileManager.tsx
|
|
6500
|
-
import { useState as
|
|
6167
|
+
import { useState as useState15 } from "react";
|
|
6501
6168
|
import { Menu as Menu3, X as X8 } from "lucide-react";
|
|
6502
6169
|
|
|
6503
6170
|
// src/components/common/FileManager/FileManagerContext.tsx
|
|
6504
|
-
import { createContext as
|
|
6171
|
+
import { createContext as createContext4, useContext as useContext4, useState as useState11, useCallback as useCallback2, useMemo } from "react";
|
|
6505
6172
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
6506
6173
|
var defaultTexts = {
|
|
6507
6174
|
createFolder: "Cr\xE9er un dossier",
|
|
@@ -6519,7 +6186,7 @@ var defaultTexts = {
|
|
|
6519
6186
|
confirm: "Confirmer",
|
|
6520
6187
|
refresh: "Actualiser"
|
|
6521
6188
|
};
|
|
6522
|
-
var FileManagerContext =
|
|
6189
|
+
var FileManagerContext = createContext4(null);
|
|
6523
6190
|
function findFolderById(items, id) {
|
|
6524
6191
|
for (const item of items) {
|
|
6525
6192
|
if (item.id === id) {
|
|
@@ -6533,7 +6200,7 @@ function findFolderById(items, id) {
|
|
|
6533
6200
|
return null;
|
|
6534
6201
|
}
|
|
6535
6202
|
var useFileManager = () => {
|
|
6536
|
-
const context =
|
|
6203
|
+
const context = useContext4(FileManagerContext);
|
|
6537
6204
|
if (!context) {
|
|
6538
6205
|
throw new Error("useFileManager must be used within a FileManagerProvider");
|
|
6539
6206
|
}
|
|
@@ -6561,7 +6228,7 @@ var FileManagerProvider = ({
|
|
|
6561
6228
|
onSelect,
|
|
6562
6229
|
onRefresh
|
|
6563
6230
|
}) => {
|
|
6564
|
-
const rootFolder =
|
|
6231
|
+
const rootFolder = useMemo(
|
|
6565
6232
|
() => ({
|
|
6566
6233
|
id: rootFolderId || "__root__",
|
|
6567
6234
|
name: rootName,
|
|
@@ -6571,24 +6238,24 @@ var FileManagerProvider = ({
|
|
|
6571
6238
|
}),
|
|
6572
6239
|
[data, rootName, rootFolderId]
|
|
6573
6240
|
);
|
|
6574
|
-
const [currentFolderId, setCurrentFolderId] =
|
|
6575
|
-
const [pathHistoryIds, setPathHistoryIds] =
|
|
6576
|
-
const [selectedItems, setSelectedItems] =
|
|
6577
|
-
const [viewMode, setViewMode] =
|
|
6578
|
-
const [renamingItem, setRenamingItem] =
|
|
6579
|
-
const [contextMenu, setContextMenu] =
|
|
6241
|
+
const [currentFolderId, setCurrentFolderId] = useState11(rootFolder.id);
|
|
6242
|
+
const [pathHistoryIds, setPathHistoryIds] = useState11([rootFolder.id]);
|
|
6243
|
+
const [selectedItems, setSelectedItems] = useState11([]);
|
|
6244
|
+
const [viewMode, setViewMode] = useState11(initialViewMode);
|
|
6245
|
+
const [renamingItem, setRenamingItem] = useState11(null);
|
|
6246
|
+
const [contextMenu, setContextMenu] = useState11({
|
|
6580
6247
|
visible: false,
|
|
6581
6248
|
position: { x: 0, y: 0 },
|
|
6582
6249
|
item: null
|
|
6583
6250
|
});
|
|
6584
|
-
const currentFolder =
|
|
6251
|
+
const currentFolder = useMemo(() => {
|
|
6585
6252
|
if (currentFolderId === rootFolder.id) {
|
|
6586
6253
|
return rootFolder;
|
|
6587
6254
|
}
|
|
6588
6255
|
const found = findFolderById(data, currentFolderId);
|
|
6589
6256
|
return found || rootFolder;
|
|
6590
6257
|
}, [currentFolderId, data, rootFolder]);
|
|
6591
|
-
const pathHistory =
|
|
6258
|
+
const pathHistory = useMemo(() => {
|
|
6592
6259
|
return pathHistoryIds.map((id) => {
|
|
6593
6260
|
if (id === rootFolder.id) {
|
|
6594
6261
|
return rootFolder;
|
|
@@ -6596,11 +6263,11 @@ var FileManagerProvider = ({
|
|
|
6596
6263
|
return findFolderById(data, id) || rootFolder;
|
|
6597
6264
|
});
|
|
6598
6265
|
}, [pathHistoryIds, data, rootFolder]);
|
|
6599
|
-
const texts =
|
|
6600
|
-
const currentFolderContents =
|
|
6266
|
+
const texts = useMemo(() => ({ ...defaultTexts, ...customTexts }), [customTexts]);
|
|
6267
|
+
const currentFolderContents = useMemo(() => {
|
|
6601
6268
|
return currentFolder?.children || [];
|
|
6602
6269
|
}, [currentFolder]);
|
|
6603
|
-
const navigateToFolder =
|
|
6270
|
+
const navigateToFolder = useCallback2(
|
|
6604
6271
|
(folder) => {
|
|
6605
6272
|
if (!folder) {
|
|
6606
6273
|
setCurrentFolderId(rootFolder.id);
|
|
@@ -6614,7 +6281,7 @@ var FileManagerProvider = ({
|
|
|
6614
6281
|
},
|
|
6615
6282
|
[rootFolder.id]
|
|
6616
6283
|
);
|
|
6617
|
-
const navigateBack =
|
|
6284
|
+
const navigateBack = useCallback2(() => {
|
|
6618
6285
|
if (pathHistoryIds.length > 1) {
|
|
6619
6286
|
const newHistoryIds = [...pathHistoryIds];
|
|
6620
6287
|
newHistoryIds.pop();
|
|
@@ -6624,7 +6291,7 @@ var FileManagerProvider = ({
|
|
|
6624
6291
|
setSelectedItems([]);
|
|
6625
6292
|
}
|
|
6626
6293
|
}, [pathHistoryIds]);
|
|
6627
|
-
const navigateToPath =
|
|
6294
|
+
const navigateToPath = useCallback2(
|
|
6628
6295
|
(index) => {
|
|
6629
6296
|
if (index < pathHistoryIds.length - 1) {
|
|
6630
6297
|
const newHistoryIds = pathHistoryIds.slice(0, index + 1);
|
|
@@ -6635,7 +6302,7 @@ var FileManagerProvider = ({
|
|
|
6635
6302
|
},
|
|
6636
6303
|
[pathHistoryIds]
|
|
6637
6304
|
);
|
|
6638
|
-
const selectItem =
|
|
6305
|
+
const selectItem = useCallback2(
|
|
6639
6306
|
(item, multiSelect = false) => {
|
|
6640
6307
|
setSelectedItems((prev) => {
|
|
6641
6308
|
if (multiSelect && allowMultiSelect) {
|
|
@@ -6654,31 +6321,31 @@ var FileManagerProvider = ({
|
|
|
6654
6321
|
},
|
|
6655
6322
|
[allowMultiSelect, onSelect, selectedItems]
|
|
6656
6323
|
);
|
|
6657
|
-
const deselectAll =
|
|
6324
|
+
const deselectAll = useCallback2(() => {
|
|
6658
6325
|
setSelectedItems([]);
|
|
6659
6326
|
if (onSelect) {
|
|
6660
6327
|
onSelect([]);
|
|
6661
6328
|
}
|
|
6662
6329
|
}, [onSelect]);
|
|
6663
|
-
const showContextMenu =
|
|
6330
|
+
const showContextMenu = useCallback2((item, position) => {
|
|
6664
6331
|
setContextMenu({
|
|
6665
6332
|
visible: true,
|
|
6666
6333
|
position,
|
|
6667
6334
|
item
|
|
6668
6335
|
});
|
|
6669
6336
|
}, []);
|
|
6670
|
-
const hideContextMenu =
|
|
6337
|
+
const hideContextMenu = useCallback2(() => {
|
|
6671
6338
|
setContextMenu((prev) => ({ ...prev, visible: false }));
|
|
6672
6339
|
}, []);
|
|
6673
|
-
const startRenaming =
|
|
6340
|
+
const startRenaming = useCallback2((item) => {
|
|
6674
6341
|
setRenamingItem(item);
|
|
6675
6342
|
hideContextMenu();
|
|
6676
6343
|
}, [hideContextMenu]);
|
|
6677
|
-
const stopRenaming =
|
|
6344
|
+
const stopRenaming = useCallback2(() => {
|
|
6678
6345
|
setRenamingItem(null);
|
|
6679
6346
|
}, []);
|
|
6680
6347
|
const actualRootFolderId = rootFolderId || "__root__";
|
|
6681
|
-
const contextValue =
|
|
6348
|
+
const contextValue = useMemo(
|
|
6682
6349
|
() => ({
|
|
6683
6350
|
data,
|
|
6684
6351
|
currentFolder,
|
|
@@ -6753,12 +6420,12 @@ var FileManagerProvider = ({
|
|
|
6753
6420
|
};
|
|
6754
6421
|
|
|
6755
6422
|
// src/components/common/FileManager/components/FolderTree.tsx
|
|
6756
|
-
import { useState as
|
|
6423
|
+
import { useState as useState12 } from "react";
|
|
6757
6424
|
import { ChevronRight as ChevronRight2, ChevronDown as ChevronDown3, Folder, FolderOpen } from "lucide-react";
|
|
6758
6425
|
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6759
6426
|
var FolderTreeItem = ({ item, level }) => {
|
|
6760
6427
|
const { currentFolder, navigateToFolder, pathHistory } = useFileManager();
|
|
6761
|
-
const [isExpanded, setIsExpanded] =
|
|
6428
|
+
const [isExpanded, setIsExpanded] = useState12(
|
|
6762
6429
|
pathHistory.some((f) => f.id === item.id) || level === 0
|
|
6763
6430
|
);
|
|
6764
6431
|
const isSelected = currentFolder?.id === item.id;
|
|
@@ -6846,7 +6513,7 @@ var FolderTree = () => {
|
|
|
6846
6513
|
import { FolderPlus } from "lucide-react";
|
|
6847
6514
|
|
|
6848
6515
|
// src/components/common/FileManager/components/FileCard.tsx
|
|
6849
|
-
import { useState as
|
|
6516
|
+
import { useState as useState13, useRef as useRef3, useEffect as useEffect9 } from "react";
|
|
6850
6517
|
|
|
6851
6518
|
// src/components/common/FileManager/utils.ts
|
|
6852
6519
|
import {
|
|
@@ -7086,20 +6753,20 @@ var FileCard = ({ item, variant = "grid" }) => {
|
|
|
7086
6753
|
onDownload,
|
|
7087
6754
|
allowRename
|
|
7088
6755
|
} = useFileManager();
|
|
7089
|
-
const [renameValue, setRenameValue] =
|
|
7090
|
-
const inputRef =
|
|
6756
|
+
const [renameValue, setRenameValue] = useState13(item.name);
|
|
6757
|
+
const inputRef = useRef3(null);
|
|
7091
6758
|
const isSelected = selectedItems.some((i) => i.id === item.id);
|
|
7092
6759
|
const isRenaming = renamingItem?.id === item.id;
|
|
7093
6760
|
const isFolder = item.type === "folder";
|
|
7094
6761
|
const Icon = getFileIcon(item.mimeType, isFolder);
|
|
7095
6762
|
const iconColor = getFileIconColor(item.mimeType, isFolder);
|
|
7096
|
-
|
|
6763
|
+
useEffect9(() => {
|
|
7097
6764
|
if (isRenaming && inputRef.current) {
|
|
7098
6765
|
inputRef.current.focus();
|
|
7099
6766
|
inputRef.current.select();
|
|
7100
6767
|
}
|
|
7101
6768
|
}, [isRenaming]);
|
|
7102
|
-
|
|
6769
|
+
useEffect9(() => {
|
|
7103
6770
|
setRenameValue(item.name);
|
|
7104
6771
|
}, [item.name]);
|
|
7105
6772
|
const handleClick = (e) => {
|
|
@@ -7296,7 +6963,7 @@ var FileList = () => {
|
|
|
7296
6963
|
};
|
|
7297
6964
|
|
|
7298
6965
|
// src/components/common/FileManager/components/Breadcrumb.tsx
|
|
7299
|
-
import
|
|
6966
|
+
import React12 from "react";
|
|
7300
6967
|
import { ChevronRight as ChevronRight3, ChevronLeft as ChevronLeft3 } from "lucide-react";
|
|
7301
6968
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7302
6969
|
var Breadcrumb = () => {
|
|
@@ -7316,7 +6983,7 @@ var Breadcrumb = () => {
|
|
|
7316
6983
|
children: /* @__PURE__ */ jsx22(ChevronLeft3, { className: "w-4 h-4" })
|
|
7317
6984
|
}
|
|
7318
6985
|
),
|
|
7319
|
-
/* @__PURE__ */ jsx22("div", { className: "flex items-center gap-1 overflow-x-auto scrollbar-thin", children: pathHistory.map((folder, index) => /* @__PURE__ */ jsxs17(
|
|
6986
|
+
/* @__PURE__ */ jsx22("div", { className: "flex items-center gap-1 overflow-x-auto scrollbar-thin", children: pathHistory.map((folder, index) => /* @__PURE__ */ jsxs17(React12.Fragment, { children: [
|
|
7320
6987
|
index > 0 && /* @__PURE__ */ jsx22(ChevronRight3, { className: "w-4 h-4 text-gray-400 dark:text-gray-600 flex-shrink-0" }),
|
|
7321
6988
|
/* @__PURE__ */ jsx22(
|
|
7322
6989
|
"button",
|
|
@@ -7335,19 +7002,19 @@ var Breadcrumb = () => {
|
|
|
7335
7002
|
};
|
|
7336
7003
|
|
|
7337
7004
|
// src/components/common/FileManager/components/Toolbar.tsx
|
|
7338
|
-
import
|
|
7005
|
+
import React13, { useRef as useRef4, useState as useState14 } from "react";
|
|
7339
7006
|
import { createPortal as createPortal3 } from "react-dom";
|
|
7340
7007
|
import { FolderPlus as FolderPlus3, Upload as Upload2, Grid, List, X as X7, RefreshCw as RefreshCw3 } from "lucide-react";
|
|
7341
|
-
import { Fragment as
|
|
7008
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7342
7009
|
var CreateFolderModal = ({
|
|
7343
7010
|
isOpen,
|
|
7344
7011
|
onClose,
|
|
7345
7012
|
onSubmit,
|
|
7346
7013
|
texts
|
|
7347
7014
|
}) => {
|
|
7348
|
-
const [folderName, setFolderName] =
|
|
7349
|
-
const inputRef =
|
|
7350
|
-
|
|
7015
|
+
const [folderName, setFolderName] = useState14("");
|
|
7016
|
+
const inputRef = useRef4(null);
|
|
7017
|
+
React13.useEffect(() => {
|
|
7351
7018
|
if (isOpen && inputRef.current) {
|
|
7352
7019
|
inputRef.current.focus();
|
|
7353
7020
|
}
|
|
@@ -7449,9 +7116,9 @@ var Toolbar = () => {
|
|
|
7449
7116
|
allowUpload,
|
|
7450
7117
|
texts
|
|
7451
7118
|
} = useFileManager();
|
|
7452
|
-
const [showCreateModal, setShowCreateModal] =
|
|
7453
|
-
const [isRefreshing, setIsRefreshing] =
|
|
7454
|
-
const fileInputRef =
|
|
7119
|
+
const [showCreateModal, setShowCreateModal] = useState14(false);
|
|
7120
|
+
const [isRefreshing, setIsRefreshing] = useState14(false);
|
|
7121
|
+
const fileInputRef = useRef4(null);
|
|
7455
7122
|
const handleRefresh = async () => {
|
|
7456
7123
|
if (onRefresh && !isRefreshing) {
|
|
7457
7124
|
setIsRefreshing(true);
|
|
@@ -7489,7 +7156,7 @@ var Toolbar = () => {
|
|
|
7489
7156
|
fileInputRef.current.value = "";
|
|
7490
7157
|
}
|
|
7491
7158
|
};
|
|
7492
|
-
return /* @__PURE__ */ jsxs18(
|
|
7159
|
+
return /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
7493
7160
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between gap-4 flex-wrap", children: [
|
|
7494
7161
|
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
7495
7162
|
allowCreateFolder && /* @__PURE__ */ jsxs18(
|
|
@@ -7509,7 +7176,7 @@ var Toolbar = () => {
|
|
|
7509
7176
|
]
|
|
7510
7177
|
}
|
|
7511
7178
|
),
|
|
7512
|
-
allowUpload && /* @__PURE__ */ jsxs18(
|
|
7179
|
+
allowUpload && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
7513
7180
|
/* @__PURE__ */ jsxs18(
|
|
7514
7181
|
PrimaryButton,
|
|
7515
7182
|
{
|
|
@@ -7619,9 +7286,9 @@ var Toolbar = () => {
|
|
|
7619
7286
|
};
|
|
7620
7287
|
|
|
7621
7288
|
// src/components/common/FileManager/components/ContextMenu.tsx
|
|
7622
|
-
import { useEffect as
|
|
7289
|
+
import { useEffect as useEffect10, useRef as useRef5 } from "react";
|
|
7623
7290
|
import { FolderOpen as FolderOpen3, Edit3 as Edit32, Download as Download3, Trash2 as Trash23 } from "lucide-react";
|
|
7624
|
-
import { Fragment as
|
|
7291
|
+
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7625
7292
|
var ContextMenu = () => {
|
|
7626
7293
|
const {
|
|
7627
7294
|
contextMenu,
|
|
@@ -7636,8 +7303,8 @@ var ContextMenu = () => {
|
|
|
7636
7303
|
allowDownload,
|
|
7637
7304
|
texts
|
|
7638
7305
|
} = useFileManager();
|
|
7639
|
-
const menuRef =
|
|
7640
|
-
|
|
7306
|
+
const menuRef = useRef5(null);
|
|
7307
|
+
useEffect10(() => {
|
|
7641
7308
|
const handleClickOutside = (e) => {
|
|
7642
7309
|
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
7643
7310
|
hideContextMenu();
|
|
@@ -7759,7 +7426,7 @@ var ContextMenu = () => {
|
|
|
7759
7426
|
]
|
|
7760
7427
|
}
|
|
7761
7428
|
),
|
|
7762
|
-
allowDelete && /* @__PURE__ */ jsxs19(
|
|
7429
|
+
allowDelete && /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
7763
7430
|
/* @__PURE__ */ jsx24("div", { className: "border-t border-gray-200 dark:border-gray-700 my-1" }),
|
|
7764
7431
|
/* @__PURE__ */ jsxs19(
|
|
7765
7432
|
"button",
|
|
@@ -7786,7 +7453,7 @@ var ContextMenu = () => {
|
|
|
7786
7453
|
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7787
7454
|
var FileManagerContent = ({ className }) => {
|
|
7788
7455
|
const { viewMode, hideContextMenu } = useFileManager();
|
|
7789
|
-
const [sidebarOpen, setSidebarOpen] =
|
|
7456
|
+
const [sidebarOpen, setSidebarOpen] = useState15(false);
|
|
7790
7457
|
const handleMainClick = () => {
|
|
7791
7458
|
hideContextMenu();
|
|
7792
7459
|
};
|
|
@@ -7850,11 +7517,11 @@ var FileManager = (props) => {
|
|
|
7850
7517
|
};
|
|
7851
7518
|
|
|
7852
7519
|
// src/components/common/FileManager/components/EntityFileManager.tsx
|
|
7853
|
-
import
|
|
7520
|
+
import React16 from "react";
|
|
7854
7521
|
import { Loader2 as Loader22, FolderX, AlertCircle as AlertCircle4, RefreshCw as RefreshCw4 } from "lucide-react";
|
|
7855
7522
|
|
|
7856
7523
|
// src/components/common/FileManager/hooks/useFileManagerApi.ts
|
|
7857
|
-
import { useState as
|
|
7524
|
+
import { useState as useState16, useEffect as useEffect11, useCallback as useCallback3 } from "react";
|
|
7858
7525
|
|
|
7859
7526
|
// src/components/common/FileManager/services/fileManagerApi.ts
|
|
7860
7527
|
var API_BASE = `${API_URL}/files-manager`;
|
|
@@ -8128,12 +7795,12 @@ function extractRootChildren(entityFolder) {
|
|
|
8128
7795
|
return entityFolder.children || [];
|
|
8129
7796
|
}
|
|
8130
7797
|
function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
8131
|
-
const [data, setData] =
|
|
8132
|
-
const [loading, setLoading] =
|
|
8133
|
-
const [refreshing, setRefreshing] =
|
|
8134
|
-
const [error, setError] =
|
|
8135
|
-
const [rootFolderCode, setRootFolderCode] =
|
|
8136
|
-
const loadEntityFolders =
|
|
7798
|
+
const [data, setData] = useState16([]);
|
|
7799
|
+
const [loading, setLoading] = useState16(true);
|
|
7800
|
+
const [refreshing, setRefreshing] = useState16(false);
|
|
7801
|
+
const [error, setError] = useState16(null);
|
|
7802
|
+
const [rootFolderCode, setRootFolderCode] = useState16(null);
|
|
7803
|
+
const loadEntityFolders = useCallback3(async (isRefresh = false) => {
|
|
8137
7804
|
if (!isRefresh) {
|
|
8138
7805
|
setLoading(true);
|
|
8139
7806
|
} else {
|
|
@@ -8171,13 +7838,13 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
|
8171
7838
|
setRefreshing(false);
|
|
8172
7839
|
}
|
|
8173
7840
|
}, [entityType, entityId]);
|
|
8174
|
-
const refresh =
|
|
7841
|
+
const refresh = useCallback3(async () => {
|
|
8175
7842
|
await loadEntityFolders(true);
|
|
8176
7843
|
}, [loadEntityFolders]);
|
|
8177
|
-
|
|
7844
|
+
useEffect11(() => {
|
|
8178
7845
|
loadEntityFolders();
|
|
8179
7846
|
}, [loadEntityFolders]);
|
|
8180
|
-
const handleCreateFolder =
|
|
7847
|
+
const handleCreateFolder = useCallback3(
|
|
8181
7848
|
async (name, parentId) => {
|
|
8182
7849
|
try {
|
|
8183
7850
|
const created = await fileManagerApi.createFolder(
|
|
@@ -8195,7 +7862,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
|
8195
7862
|
},
|
|
8196
7863
|
[businessEntityId, refresh]
|
|
8197
7864
|
);
|
|
8198
|
-
const handleUploadFiles =
|
|
7865
|
+
const handleUploadFiles = useCallback3(
|
|
8199
7866
|
async (files, parentId) => {
|
|
8200
7867
|
try {
|
|
8201
7868
|
const uploaded = await fileManagerApi.uploadFiles(files, parentId);
|
|
@@ -8209,7 +7876,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
|
8209
7876
|
},
|
|
8210
7877
|
[refresh]
|
|
8211
7878
|
);
|
|
8212
|
-
const handleRename =
|
|
7879
|
+
const handleRename = useCallback3(
|
|
8213
7880
|
async (item, newName) => {
|
|
8214
7881
|
try {
|
|
8215
7882
|
if (item.type === "folder") {
|
|
@@ -8226,7 +7893,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
|
8226
7893
|
},
|
|
8227
7894
|
[refresh]
|
|
8228
7895
|
);
|
|
8229
|
-
const handleDelete =
|
|
7896
|
+
const handleDelete = useCallback3(
|
|
8230
7897
|
async (item) => {
|
|
8231
7898
|
try {
|
|
8232
7899
|
if (item.metadata?.isSystemFolder) {
|
|
@@ -8246,7 +7913,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
|
8246
7913
|
},
|
|
8247
7914
|
[refresh]
|
|
8248
7915
|
);
|
|
8249
|
-
const handleDownload =
|
|
7916
|
+
const handleDownload = useCallback3((item) => {
|
|
8250
7917
|
if (item.type === "file") {
|
|
8251
7918
|
const url = item.url || fileManagerApi.getDownloadUrl(item.id);
|
|
8252
7919
|
window.open(url, "_blank");
|
|
@@ -8347,7 +8014,7 @@ var EntityFileManager = ({
|
|
|
8347
8014
|
entityId,
|
|
8348
8015
|
businessEntityId
|
|
8349
8016
|
);
|
|
8350
|
-
|
|
8017
|
+
React16.useEffect(() => {
|
|
8351
8018
|
if (error && onError) {
|
|
8352
8019
|
onError(error);
|
|
8353
8020
|
}
|
|
@@ -8394,10 +8061,10 @@ var EntityFileManager = ({
|
|
|
8394
8061
|
};
|
|
8395
8062
|
|
|
8396
8063
|
// src/components/common/FileManager/components/RootFileManager.tsx
|
|
8397
|
-
import
|
|
8064
|
+
import React17 from "react";
|
|
8398
8065
|
|
|
8399
8066
|
// src/components/common/FileManager/hooks/useRootFileManagerApi.ts
|
|
8400
|
-
import { useState as
|
|
8067
|
+
import { useState as useState17, useEffect as useEffect12, useCallback as useCallback4 } from "react";
|
|
8401
8068
|
function transformFile2(backendFile, parentPath, parentId) {
|
|
8402
8069
|
return {
|
|
8403
8070
|
id: backendFile.code,
|
|
@@ -8442,13 +8109,13 @@ function transformFolder2(backendFolder, parentPath = "", parentId = null) {
|
|
|
8442
8109
|
};
|
|
8443
8110
|
}
|
|
8444
8111
|
function useRootFileManagerApi(businessEntityId) {
|
|
8445
|
-
const [data, setData] =
|
|
8446
|
-
const [loading, setLoading] =
|
|
8447
|
-
const [refreshing, setRefreshing] =
|
|
8448
|
-
const [error, setError] =
|
|
8449
|
-
const [rootFolderCode, setRootFolderCode] =
|
|
8450
|
-
const [rootName, setRootName] =
|
|
8451
|
-
const loadRootFolders =
|
|
8112
|
+
const [data, setData] = useState17([]);
|
|
8113
|
+
const [loading, setLoading] = useState17(true);
|
|
8114
|
+
const [refreshing, setRefreshing] = useState17(false);
|
|
8115
|
+
const [error, setError] = useState17(null);
|
|
8116
|
+
const [rootFolderCode, setRootFolderCode] = useState17(null);
|
|
8117
|
+
const [rootName, setRootName] = useState17("Documents");
|
|
8118
|
+
const loadRootFolders = useCallback4(async (isRefresh = false) => {
|
|
8452
8119
|
if (!isRefresh) {
|
|
8453
8120
|
setLoading(true);
|
|
8454
8121
|
} else {
|
|
@@ -8477,13 +8144,13 @@ function useRootFileManagerApi(businessEntityId) {
|
|
|
8477
8144
|
setRefreshing(false);
|
|
8478
8145
|
}
|
|
8479
8146
|
}, [businessEntityId]);
|
|
8480
|
-
const refresh =
|
|
8147
|
+
const refresh = useCallback4(async () => {
|
|
8481
8148
|
await loadRootFolders(true);
|
|
8482
8149
|
}, [loadRootFolders]);
|
|
8483
|
-
|
|
8150
|
+
useEffect12(() => {
|
|
8484
8151
|
loadRootFolders();
|
|
8485
8152
|
}, [loadRootFolders]);
|
|
8486
|
-
const handleCreateFolder =
|
|
8153
|
+
const handleCreateFolder = useCallback4(
|
|
8487
8154
|
async (name, parentId) => {
|
|
8488
8155
|
try {
|
|
8489
8156
|
const created = await fileManagerApi.createFolder(name, parentId, businessEntityId);
|
|
@@ -8497,7 +8164,7 @@ function useRootFileManagerApi(businessEntityId) {
|
|
|
8497
8164
|
},
|
|
8498
8165
|
[businessEntityId, refresh]
|
|
8499
8166
|
);
|
|
8500
|
-
const handleUploadFiles =
|
|
8167
|
+
const handleUploadFiles = useCallback4(
|
|
8501
8168
|
async (files, parentId) => {
|
|
8502
8169
|
try {
|
|
8503
8170
|
const uploaded = await fileManagerApi.uploadFiles(files, parentId);
|
|
@@ -8511,7 +8178,7 @@ function useRootFileManagerApi(businessEntityId) {
|
|
|
8511
8178
|
},
|
|
8512
8179
|
[refresh]
|
|
8513
8180
|
);
|
|
8514
|
-
const handleRename =
|
|
8181
|
+
const handleRename = useCallback4(
|
|
8515
8182
|
async (item, newName) => {
|
|
8516
8183
|
try {
|
|
8517
8184
|
if (item.type === "folder") {
|
|
@@ -8528,7 +8195,7 @@ function useRootFileManagerApi(businessEntityId) {
|
|
|
8528
8195
|
},
|
|
8529
8196
|
[refresh]
|
|
8530
8197
|
);
|
|
8531
|
-
const handleDelete =
|
|
8198
|
+
const handleDelete = useCallback4(
|
|
8532
8199
|
async (item) => {
|
|
8533
8200
|
try {
|
|
8534
8201
|
if (item.metadata?.isSystemFolder) {
|
|
@@ -8548,7 +8215,7 @@ function useRootFileManagerApi(businessEntityId) {
|
|
|
8548
8215
|
},
|
|
8549
8216
|
[refresh]
|
|
8550
8217
|
);
|
|
8551
|
-
const handleDownload =
|
|
8218
|
+
const handleDownload = useCallback4((item) => {
|
|
8552
8219
|
if (item.type === "file") {
|
|
8553
8220
|
const url = item.url || fileManagerApi.getDownloadUrl(item.id);
|
|
8554
8221
|
window.open(url, "_blank");
|
|
@@ -8596,7 +8263,7 @@ var RootFileManager = ({
|
|
|
8596
8263
|
refresh,
|
|
8597
8264
|
handlers
|
|
8598
8265
|
} = useRootFileManagerApi(businessEntityId);
|
|
8599
|
-
|
|
8266
|
+
React17.useEffect(() => {
|
|
8600
8267
|
if (error && onError) {
|
|
8601
8268
|
onError(error);
|
|
8602
8269
|
}
|
|
@@ -8690,7 +8357,7 @@ var RootFileManager = ({
|
|
|
8690
8357
|
};
|
|
8691
8358
|
|
|
8692
8359
|
// src/components/common/FileManager/components/AttachmentUploader.tsx
|
|
8693
|
-
import { useState as
|
|
8360
|
+
import { useState as useState18, useRef as useRef6, useEffect as useEffect13, useCallback as useCallback5 } from "react";
|
|
8694
8361
|
import { createPortal as createPortal4 } from "react-dom";
|
|
8695
8362
|
import {
|
|
8696
8363
|
Upload as Upload3,
|
|
@@ -8715,7 +8382,7 @@ import {
|
|
|
8715
8382
|
Presentation as Presentation2,
|
|
8716
8383
|
FolderPlus as FolderPlus4
|
|
8717
8384
|
} from "lucide-react";
|
|
8718
|
-
import { Fragment as
|
|
8385
|
+
import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8719
8386
|
function formatFileSize2(bytes) {
|
|
8720
8387
|
if (bytes === 0) return "0 B";
|
|
8721
8388
|
const k = 1024;
|
|
@@ -8789,7 +8456,7 @@ var FolderTreeItem2 = ({
|
|
|
8789
8456
|
selectedCode,
|
|
8790
8457
|
onSelect
|
|
8791
8458
|
}) => {
|
|
8792
|
-
const [isExpanded, setIsExpanded] =
|
|
8459
|
+
const [isExpanded, setIsExpanded] = useState18(level < 2);
|
|
8793
8460
|
const hasChildren = folder.children && folder.children.length > 0;
|
|
8794
8461
|
const isSelected = selectedCode === folder.code;
|
|
8795
8462
|
return /* @__PURE__ */ jsxs23("div", { children: [
|
|
@@ -8840,9 +8507,9 @@ var CreateFolderInPickerModal = ({
|
|
|
8840
8507
|
onSubmit,
|
|
8841
8508
|
parentFolderName
|
|
8842
8509
|
}) => {
|
|
8843
|
-
const [folderName, setFolderName] =
|
|
8844
|
-
const inputRef =
|
|
8845
|
-
|
|
8510
|
+
const [folderName, setFolderName] = useState18("");
|
|
8511
|
+
const inputRef = useRef6(null);
|
|
8512
|
+
useEffect13(() => {
|
|
8846
8513
|
if (isOpen && inputRef.current) {
|
|
8847
8514
|
inputRef.current.focus();
|
|
8848
8515
|
}
|
|
@@ -8937,13 +8604,13 @@ var FolderPickerModal = ({
|
|
|
8937
8604
|
startingFolderCode,
|
|
8938
8605
|
allowCreateFolder = true
|
|
8939
8606
|
}) => {
|
|
8940
|
-
const [loading, setLoading] =
|
|
8941
|
-
const [error, setError] =
|
|
8942
|
-
const [displayFolder, setDisplayFolder] =
|
|
8943
|
-
const [selectedFolder, setSelectedFolder] =
|
|
8944
|
-
const [showCreateFolderModal, setShowCreateFolderModal] =
|
|
8945
|
-
const [creatingFolder, setCreatingFolder] =
|
|
8946
|
-
|
|
8607
|
+
const [loading, setLoading] = useState18(true);
|
|
8608
|
+
const [error, setError] = useState18(null);
|
|
8609
|
+
const [displayFolder, setDisplayFolder] = useState18(null);
|
|
8610
|
+
const [selectedFolder, setSelectedFolder] = useState18(null);
|
|
8611
|
+
const [showCreateFolderModal, setShowCreateFolderModal] = useState18(false);
|
|
8612
|
+
const [creatingFolder, setCreatingFolder] = useState18(false);
|
|
8613
|
+
useEffect13(() => {
|
|
8947
8614
|
if (isOpen && businessEntityId) {
|
|
8948
8615
|
loadFolderTree();
|
|
8949
8616
|
}
|
|
@@ -9117,15 +8784,15 @@ var AttachmentUploader = ({
|
|
|
9117
8784
|
onError,
|
|
9118
8785
|
className
|
|
9119
8786
|
}) => {
|
|
9120
|
-
const [files, setFiles] =
|
|
9121
|
-
const [loading, setLoading] =
|
|
9122
|
-
const [uploading, setUploading] =
|
|
9123
|
-
const [error, setError] =
|
|
9124
|
-
const [deleteConfirm, setDeleteConfirm] =
|
|
9125
|
-
const [showFolderPicker, setShowFolderPicker] =
|
|
9126
|
-
const [pendingFiles, setPendingFiles] =
|
|
9127
|
-
const fileInputRef =
|
|
9128
|
-
const loadFiles =
|
|
8787
|
+
const [files, setFiles] = useState18([]);
|
|
8788
|
+
const [loading, setLoading] = useState18(true);
|
|
8789
|
+
const [uploading, setUploading] = useState18(false);
|
|
8790
|
+
const [error, setError] = useState18(null);
|
|
8791
|
+
const [deleteConfirm, setDeleteConfirm] = useState18(null);
|
|
8792
|
+
const [showFolderPicker, setShowFolderPicker] = useState18(false);
|
|
8793
|
+
const [pendingFiles, setPendingFiles] = useState18([]);
|
|
8794
|
+
const fileInputRef = useRef6(null);
|
|
8795
|
+
const loadFiles = useCallback5(async () => {
|
|
9129
8796
|
try {
|
|
9130
8797
|
setLoading(true);
|
|
9131
8798
|
setError(null);
|
|
@@ -9139,7 +8806,7 @@ var AttachmentUploader = ({
|
|
|
9139
8806
|
setLoading(false);
|
|
9140
8807
|
}
|
|
9141
8808
|
}, [model, objectId, linkType, onError]);
|
|
9142
|
-
|
|
8809
|
+
useEffect13(() => {
|
|
9143
8810
|
if (objectId) {
|
|
9144
8811
|
loadFiles();
|
|
9145
8812
|
}
|
|
@@ -9255,7 +8922,7 @@ var AttachmentUploader = ({
|
|
|
9255
8922
|
")"
|
|
9256
8923
|
] })
|
|
9257
8924
|
] }),
|
|
9258
|
-
allowUpload && /* @__PURE__ */ jsxs23(
|
|
8925
|
+
allowUpload && /* @__PURE__ */ jsxs23(Fragment8, { children: [
|
|
9259
8926
|
/* @__PURE__ */ jsxs23(
|
|
9260
8927
|
PrimaryButton,
|
|
9261
8928
|
{
|
|
@@ -9369,7 +9036,7 @@ var FormVendor = ({
|
|
|
9369
9036
|
refresh = () => {
|
|
9370
9037
|
}
|
|
9371
9038
|
}) => {
|
|
9372
|
-
const [formData, setFormData] =
|
|
9039
|
+
const [formData, setFormData] = useState19(object || {
|
|
9373
9040
|
from_module: from ?? null,
|
|
9374
9041
|
legal_name: "",
|
|
9375
9042
|
trading_name: "",
|
|
@@ -9406,9 +9073,9 @@ var FormVendor = ({
|
|
|
9406
9073
|
rib: "",
|
|
9407
9074
|
vendor_number: ""
|
|
9408
9075
|
});
|
|
9409
|
-
const [errors, setErrors] =
|
|
9410
|
-
const [activeTab, setActiveTab] =
|
|
9411
|
-
const [loading, setLoading] =
|
|
9076
|
+
const [errors, setErrors] = useState19({});
|
|
9077
|
+
const [activeTab, setActiveTab] = useState19("general");
|
|
9078
|
+
const [loading, setLoading] = useState19(false);
|
|
9412
9079
|
const { token, activeBusinessEntity } = useSession();
|
|
9413
9080
|
const { success, error: showError } = useToast();
|
|
9414
9081
|
const handleInputChange = (e) => {
|
|
@@ -9936,7 +9603,7 @@ var FormVendor = ({
|
|
|
9936
9603
|
var MinimalVendorForm = FormVendor;
|
|
9937
9604
|
|
|
9938
9605
|
// src/components/common/FormClient.tsx
|
|
9939
|
-
import { useState as
|
|
9606
|
+
import { useState as useState20 } from "react";
|
|
9940
9607
|
|
|
9941
9608
|
// src/models/Client.ts
|
|
9942
9609
|
var TEMPLATE_FNE_CHOICES = [
|
|
@@ -9967,7 +9634,7 @@ var FormClient = ({
|
|
|
9967
9634
|
object,
|
|
9968
9635
|
refresh
|
|
9969
9636
|
}) => {
|
|
9970
|
-
const [formData, setFormData] =
|
|
9637
|
+
const [formData, setFormData] = useState20(object || {
|
|
9971
9638
|
from_module: "crm",
|
|
9972
9639
|
legal_name: "",
|
|
9973
9640
|
trading_name: "",
|
|
@@ -10005,9 +9672,9 @@ var FormClient = ({
|
|
|
10005
9672
|
business_provider: "",
|
|
10006
9673
|
target_clients: ""
|
|
10007
9674
|
});
|
|
10008
|
-
const [errors, setErrors] =
|
|
10009
|
-
const [activeTab, setActiveTab] =
|
|
10010
|
-
const [loading, setLoading] =
|
|
9675
|
+
const [errors, setErrors] = useState20({});
|
|
9676
|
+
const [activeTab, setActiveTab] = useState20("general");
|
|
9677
|
+
const [loading, setLoading] = useState20(false);
|
|
10011
9678
|
const { activeBusinessEntity, token } = useSession();
|
|
10012
9679
|
const { success, error: showError } = useToast();
|
|
10013
9680
|
const handleInputChange = (e) => {
|
|
@@ -10574,11 +10241,11 @@ var FormClient = ({
|
|
|
10574
10241
|
};
|
|
10575
10242
|
|
|
10576
10243
|
// src/components/common/ApprovalWorkflow.tsx
|
|
10577
|
-
import { useState as
|
|
10244
|
+
import { useState as useState21, useEffect as useEffect14 } from "react";
|
|
10578
10245
|
import { X as X10, Plus as Plus3, Trash2 as Trash25, Users, Loader as Loader3, RotateCcw, Ban, Eye as Eye4, FileText as FileText6, History } from "lucide-react";
|
|
10579
|
-
import { Fragment as
|
|
10246
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
10580
10247
|
var ApprovalWorkflow = ({
|
|
10581
|
-
process
|
|
10248
|
+
process,
|
|
10582
10249
|
object_id,
|
|
10583
10250
|
title = "Validation t\xE2che",
|
|
10584
10251
|
readOnly = false,
|
|
@@ -10586,29 +10253,29 @@ var ApprovalWorkflow = ({
|
|
|
10586
10253
|
}) => {
|
|
10587
10254
|
const { token, loggedUser } = useSession();
|
|
10588
10255
|
const { error: showError, success: showSuccess } = useToast();
|
|
10589
|
-
const [activeTab, setActiveTab] =
|
|
10590
|
-
const [loading, setLoading] =
|
|
10591
|
-
const [caseData, setCaseData] =
|
|
10592
|
-
const [history, setHistory] =
|
|
10593
|
-
const [loadingHistory, setLoadingHistory] =
|
|
10594
|
-
const [formData, setFormData] =
|
|
10256
|
+
const [activeTab, setActiveTab] = useState21("workflow");
|
|
10257
|
+
const [loading, setLoading] = useState21(CustomBtn ? false : true);
|
|
10258
|
+
const [caseData, setCaseData] = useState21(null);
|
|
10259
|
+
const [history, setHistory] = useState21([]);
|
|
10260
|
+
const [loadingHistory, setLoadingHistory] = useState21(false);
|
|
10261
|
+
const [formData, setFormData] = useState21({
|
|
10595
10262
|
title,
|
|
10596
10263
|
file: null,
|
|
10597
10264
|
description: "",
|
|
10598
10265
|
status: "not-send" /* NOT_SEND */
|
|
10599
10266
|
});
|
|
10600
|
-
const [users, setUsers] =
|
|
10601
|
-
const [loadingUsers, setLoadingUsers] =
|
|
10602
|
-
const [saving, setSaving] =
|
|
10603
|
-
const [transmitting, setTransmitting] =
|
|
10604
|
-
const [canceling, setCanceling] =
|
|
10605
|
-
const [restarting, setRestarting] =
|
|
10606
|
-
const [verification, setVerification] =
|
|
10607
|
-
const [validation, setValidation] =
|
|
10608
|
-
const [isOpen, setIsOpen] =
|
|
10267
|
+
const [users, setUsers] = useState21([]);
|
|
10268
|
+
const [loadingUsers, setLoadingUsers] = useState21(false);
|
|
10269
|
+
const [saving, setSaving] = useState21(false);
|
|
10270
|
+
const [transmitting, setTransmitting] = useState21(false);
|
|
10271
|
+
const [canceling, setCanceling] = useState21(false);
|
|
10272
|
+
const [restarting, setRestarting] = useState21(false);
|
|
10273
|
+
const [verification, setVerification] = useState21([]);
|
|
10274
|
+
const [validation, setValidation] = useState21([]);
|
|
10275
|
+
const [isOpen, setIsOpen] = useState21(false);
|
|
10609
10276
|
const open_modal = () => setIsOpen(true);
|
|
10610
10277
|
const close_modal = () => setIsOpen(false);
|
|
10611
|
-
|
|
10278
|
+
useEffect14(() => {
|
|
10612
10279
|
if (CustomBtn) {
|
|
10613
10280
|
if (isOpen) {
|
|
10614
10281
|
loadData();
|
|
@@ -10616,7 +10283,7 @@ var ApprovalWorkflow = ({
|
|
|
10616
10283
|
} else {
|
|
10617
10284
|
loadData();
|
|
10618
10285
|
}
|
|
10619
|
-
}, [
|
|
10286
|
+
}, [process, object_id, isOpen]);
|
|
10620
10287
|
const loadData = async () => {
|
|
10621
10288
|
if (!token) {
|
|
10622
10289
|
showError("Vous devez \xEAtre connect\xE9");
|
|
@@ -10647,7 +10314,7 @@ var ApprovalWorkflow = ({
|
|
|
10647
10314
|
const loadCase = async () => {
|
|
10648
10315
|
if (!token) return;
|
|
10649
10316
|
try {
|
|
10650
|
-
const response = await ApprovalServices.getDetails(
|
|
10317
|
+
const response = await ApprovalServices.getDetails(process, object_id, token);
|
|
10651
10318
|
if (response.success && response.data) {
|
|
10652
10319
|
const caseInfo = response.data;
|
|
10653
10320
|
setCaseData(caseInfo);
|
|
@@ -10707,7 +10374,7 @@ var ApprovalWorkflow = ({
|
|
|
10707
10374
|
try {
|
|
10708
10375
|
const payload = {
|
|
10709
10376
|
title: formData.title,
|
|
10710
|
-
process
|
|
10377
|
+
process,
|
|
10711
10378
|
object_id,
|
|
10712
10379
|
requested_by: loggedUser.id,
|
|
10713
10380
|
description: formData.description,
|
|
@@ -10814,7 +10481,7 @@ var ApprovalWorkflow = ({
|
|
|
10814
10481
|
if (!token) return;
|
|
10815
10482
|
setLoadingHistory(true);
|
|
10816
10483
|
try {
|
|
10817
|
-
const response = await ApprovalServices.getHistory(
|
|
10484
|
+
const response = await ApprovalServices.getHistory(process, object_id, token);
|
|
10818
10485
|
if (response.success && response.data) {
|
|
10819
10486
|
setHistory(response.data);
|
|
10820
10487
|
}
|
|
@@ -10825,7 +10492,7 @@ var ApprovalWorkflow = ({
|
|
|
10825
10492
|
setLoadingHistory(false);
|
|
10826
10493
|
}
|
|
10827
10494
|
};
|
|
10828
|
-
|
|
10495
|
+
useEffect14(() => {
|
|
10829
10496
|
if (activeTab === "history" && history.length === 0) {
|
|
10830
10497
|
loadHistory();
|
|
10831
10498
|
}
|
|
@@ -10935,7 +10602,7 @@ var ApprovalWorkflow = ({
|
|
|
10935
10602
|
children: "Retour"
|
|
10936
10603
|
}
|
|
10937
10604
|
),
|
|
10938
|
-
caseData?.id && formData.status !== "not-send" /* NOT_SEND */ && /* @__PURE__ */ jsxs26(
|
|
10605
|
+
caseData?.id && formData.status !== "not-send" /* NOT_SEND */ && /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
10939
10606
|
/* @__PURE__ */ jsxs26(
|
|
10940
10607
|
SecondaryButton,
|
|
10941
10608
|
{
|
|
@@ -11025,7 +10692,7 @@ var ApprovalWorkflow = ({
|
|
|
11025
10692
|
] }),
|
|
11026
10693
|
/* @__PURE__ */ jsx31("span", { children: "\u2022" }),
|
|
11027
10694
|
/* @__PURE__ */ jsx31("span", { children: new Date(item.created_at || "").toLocaleDateString("fr-FR") }),
|
|
11028
|
-
item.closed_at && /* @__PURE__ */ jsxs26(
|
|
10695
|
+
item.closed_at && /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
11029
10696
|
/* @__PURE__ */ jsx31("span", { children: "\u2022" }),
|
|
11030
10697
|
/* @__PURE__ */ jsxs26("span", { children: [
|
|
11031
10698
|
"Cl\xF4tur\xE9 le: ",
|
|
@@ -11126,12 +10793,12 @@ var ApprovalWorkflow = ({
|
|
|
11126
10793
|
] });
|
|
11127
10794
|
};
|
|
11128
10795
|
if (CustomBtn) {
|
|
11129
|
-
return /* @__PURE__ */ jsxs26(
|
|
10796
|
+
return /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
11130
10797
|
/* @__PURE__ */ jsx31(CustomBtn, { onClick: open_modal }),
|
|
11131
10798
|
/* @__PURE__ */ jsx31(Modals_default, { open: isOpen, onClose: close_modal, title, width: "w-[60%]", children: formulaire() })
|
|
11132
10799
|
] });
|
|
11133
10800
|
}
|
|
11134
|
-
return /* @__PURE__ */ jsx31(
|
|
10801
|
+
return /* @__PURE__ */ jsx31(Fragment9, { children: /* @__PURE__ */ jsx31(
|
|
11135
10802
|
RewiseBasicCard,
|
|
11136
10803
|
{
|
|
11137
10804
|
title: /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between w-full", children: [
|
|
@@ -11259,8 +10926,8 @@ var AddStageButton = ({
|
|
|
11259
10926
|
loadingUsers,
|
|
11260
10927
|
onAdd
|
|
11261
10928
|
}) => {
|
|
11262
|
-
const [showModal, setShowModal] =
|
|
11263
|
-
const [newStage, setNewStage] =
|
|
10929
|
+
const [showModal, setShowModal] = useState21(false);
|
|
10930
|
+
const [newStage, setNewStage] = useState21({
|
|
11264
10931
|
space_answer: "internal",
|
|
11265
10932
|
name: "",
|
|
11266
10933
|
email: "",
|
|
@@ -11306,7 +10973,7 @@ var AddStageButton = ({
|
|
|
11306
10973
|
role: user.phonenumber || "-"
|
|
11307
10974
|
});
|
|
11308
10975
|
};
|
|
11309
|
-
return /* @__PURE__ */ jsxs26(
|
|
10976
|
+
return /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
11310
10977
|
/* @__PURE__ */ jsxs26(
|
|
11311
10978
|
Buttons_default,
|
|
11312
10979
|
{
|
|
@@ -11412,7 +11079,7 @@ var AddStageButton = ({
|
|
|
11412
11079
|
var ApprovalWorkflow_default = ApprovalWorkflow;
|
|
11413
11080
|
|
|
11414
11081
|
// src/contexts/AlertContext.tsx
|
|
11415
|
-
import { createContext as
|
|
11082
|
+
import { createContext as createContext5, useContext as useContext5, useState as useState22, useCallback as useCallback6 } from "react";
|
|
11416
11083
|
|
|
11417
11084
|
// src/components/common/Alert.tsx
|
|
11418
11085
|
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -11484,14 +11151,14 @@ var Alert_default = Alert;
|
|
|
11484
11151
|
|
|
11485
11152
|
// src/contexts/AlertContext.tsx
|
|
11486
11153
|
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
11487
|
-
var AlertContext =
|
|
11154
|
+
var AlertContext = createContext5(void 0);
|
|
11488
11155
|
var AlertProvider = ({ children }) => {
|
|
11489
|
-
const [alertState, setAlertState] =
|
|
11156
|
+
const [alertState, setAlertState] = useState22({
|
|
11490
11157
|
open: false,
|
|
11491
11158
|
title: "",
|
|
11492
11159
|
variant: "warning"
|
|
11493
11160
|
});
|
|
11494
|
-
const showConfirmation =
|
|
11161
|
+
const showConfirmation = useCallback6((options) => {
|
|
11495
11162
|
return new Promise((resolve) => {
|
|
11496
11163
|
setAlertState({
|
|
11497
11164
|
...options,
|
|
@@ -11500,7 +11167,7 @@ var AlertProvider = ({ children }) => {
|
|
|
11500
11167
|
});
|
|
11501
11168
|
});
|
|
11502
11169
|
}, []);
|
|
11503
|
-
const showAlert =
|
|
11170
|
+
const showAlert = useCallback6(
|
|
11504
11171
|
(title, confirmText = "Oui", cancelText = "Annuler", description, variant = "warning") => {
|
|
11505
11172
|
return showConfirmation({
|
|
11506
11173
|
title,
|
|
@@ -11512,13 +11179,13 @@ var AlertProvider = ({ children }) => {
|
|
|
11512
11179
|
},
|
|
11513
11180
|
[showConfirmation]
|
|
11514
11181
|
);
|
|
11515
|
-
const handleConfirm =
|
|
11182
|
+
const handleConfirm = useCallback6(() => {
|
|
11516
11183
|
if (alertState.resolve) {
|
|
11517
11184
|
alertState.resolve(true);
|
|
11518
11185
|
}
|
|
11519
11186
|
setAlertState((prev) => ({ ...prev, open: false }));
|
|
11520
11187
|
}, [alertState.resolve]);
|
|
11521
|
-
const handleCancel =
|
|
11188
|
+
const handleCancel = useCallback6(() => {
|
|
11522
11189
|
if (alertState.resolve) {
|
|
11523
11190
|
alertState.resolve(false);
|
|
11524
11191
|
}
|
|
@@ -11543,7 +11210,7 @@ var AlertProvider = ({ children }) => {
|
|
|
11543
11210
|
] });
|
|
11544
11211
|
};
|
|
11545
11212
|
var useAlert = () => {
|
|
11546
|
-
const context =
|
|
11213
|
+
const context = useContext5(AlertContext);
|
|
11547
11214
|
if (!context) {
|
|
11548
11215
|
throw new Error("useAlert must be used within an AlertProvider");
|
|
11549
11216
|
}
|
|
@@ -11968,7 +11635,7 @@ var CountrySelector = ({
|
|
|
11968
11635
|
};
|
|
11969
11636
|
|
|
11970
11637
|
// src/components/common/PrintPreview.tsx
|
|
11971
|
-
import
|
|
11638
|
+
import React23, { useRef as useRef7 } from "react";
|
|
11972
11639
|
import { useReactToPrint } from "react-to-print";
|
|
11973
11640
|
import { X as X11, Download as Download5, ZoomIn, ZoomOut, FileText as FileText7 } from "lucide-react";
|
|
11974
11641
|
import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
@@ -12002,8 +11669,8 @@ var PrintPreview = ({
|
|
|
12002
11669
|
onAfterPrint,
|
|
12003
11670
|
onBeforePrint
|
|
12004
11671
|
}) => {
|
|
12005
|
-
const printRef =
|
|
12006
|
-
const [zoom, setZoom] =
|
|
11672
|
+
const printRef = useRef7(null);
|
|
11673
|
+
const [zoom, setZoom] = React23.useState(100);
|
|
12007
11674
|
const handlePrint = useReactToPrint({
|
|
12008
11675
|
contentRef: printRef,
|
|
12009
11676
|
documentTitle: documentName,
|
|
@@ -12453,7 +12120,7 @@ var WorkspaceServices = {
|
|
|
12453
12120
|
};
|
|
12454
12121
|
|
|
12455
12122
|
// src/pages/workspaces/WorkSpace.tsx
|
|
12456
|
-
import { useState as
|
|
12123
|
+
import { useState as useState27, useEffect as useEffect19, useMemo as useMemo2 } from "react";
|
|
12457
12124
|
import {
|
|
12458
12125
|
ShoppingCart as ShoppingCart2,
|
|
12459
12126
|
Calculator as Calculator2,
|
|
@@ -12465,7 +12132,7 @@ import {
|
|
|
12465
12132
|
} from "lucide-react";
|
|
12466
12133
|
|
|
12467
12134
|
// src/pages/workspaces/PurchaseWorkspace.tsx
|
|
12468
|
-
import { useState as
|
|
12135
|
+
import { useState as useState23, useEffect as useEffect15 } from "react";
|
|
12469
12136
|
import {
|
|
12470
12137
|
FileText as FileText8,
|
|
12471
12138
|
ShoppingCart,
|
|
@@ -12513,12 +12180,12 @@ var formatRelativeTime = (timestamp) => {
|
|
|
12513
12180
|
return date.toLocaleDateString("fr-FR");
|
|
12514
12181
|
};
|
|
12515
12182
|
var PurchaseWorkspace = () => {
|
|
12516
|
-
const [stats, setStats] =
|
|
12517
|
-
const [recentActivities, setRecentActivities] =
|
|
12518
|
-
const [pendingTasks, setPendingTasks] =
|
|
12519
|
-
const [loading, setLoading] =
|
|
12520
|
-
const [error, setError] =
|
|
12521
|
-
|
|
12183
|
+
const [stats, setStats] = useState23(null);
|
|
12184
|
+
const [recentActivities, setRecentActivities] = useState23([]);
|
|
12185
|
+
const [pendingTasks, setPendingTasks] = useState23([]);
|
|
12186
|
+
const [loading, setLoading] = useState23(true);
|
|
12187
|
+
const [error, setError] = useState23(null);
|
|
12188
|
+
useEffect15(() => {
|
|
12522
12189
|
loadWorkspaceData();
|
|
12523
12190
|
}, []);
|
|
12524
12191
|
const loadWorkspaceData = async () => {
|
|
@@ -12856,7 +12523,7 @@ var PurchaseWorkspace = () => {
|
|
|
12856
12523
|
var PurchaseWorkspace_default = PurchaseWorkspace;
|
|
12857
12524
|
|
|
12858
12525
|
// src/pages/workspaces/AccountingWorkspace.tsx
|
|
12859
|
-
import { useState as
|
|
12526
|
+
import { useState as useState24, useEffect as useEffect16 } from "react";
|
|
12860
12527
|
import {
|
|
12861
12528
|
TrendingUp,
|
|
12862
12529
|
TrendingDown,
|
|
@@ -12886,10 +12553,10 @@ var formatCurrencyShort2 = (amount) => {
|
|
|
12886
12553
|
return formatCurrency3(amount);
|
|
12887
12554
|
};
|
|
12888
12555
|
var AccountingWorkspace = () => {
|
|
12889
|
-
const [stats, setStats] =
|
|
12890
|
-
const [loading, setLoading] =
|
|
12891
|
-
const [error, setError] =
|
|
12892
|
-
|
|
12556
|
+
const [stats, setStats] = useState24(null);
|
|
12557
|
+
const [loading, setLoading] = useState24(true);
|
|
12558
|
+
const [error, setError] = useState24(null);
|
|
12559
|
+
useEffect16(() => {
|
|
12893
12560
|
loadWorkspaceData();
|
|
12894
12561
|
}, []);
|
|
12895
12562
|
const loadWorkspaceData = async () => {
|
|
@@ -13127,7 +12794,7 @@ var AccountingWorkspace = () => {
|
|
|
13127
12794
|
var AccountingWorkspace_default = AccountingWorkspace;
|
|
13128
12795
|
|
|
13129
12796
|
// src/pages/workspaces/CrmWorkspace.tsx
|
|
13130
|
-
import { useState as
|
|
12797
|
+
import { useState as useState25, useEffect as useEffect17 } from "react";
|
|
13131
12798
|
import {
|
|
13132
12799
|
Users as Users3,
|
|
13133
12800
|
UserPlus,
|
|
@@ -13152,11 +12819,11 @@ var formatCurrencyShort3 = (amount) => {
|
|
|
13152
12819
|
return `${amount.toLocaleString("fr-FR")} FCFA`;
|
|
13153
12820
|
};
|
|
13154
12821
|
var CrmWorkspace = () => {
|
|
13155
|
-
const [stats, setStats] =
|
|
13156
|
-
const [recentContacts, setRecentContacts] =
|
|
13157
|
-
const [loading, setLoading] =
|
|
13158
|
-
const [error, setError] =
|
|
13159
|
-
|
|
12822
|
+
const [stats, setStats] = useState25(null);
|
|
12823
|
+
const [recentContacts, setRecentContacts] = useState25([]);
|
|
12824
|
+
const [loading, setLoading] = useState25(true);
|
|
12825
|
+
const [error, setError] = useState25(null);
|
|
12826
|
+
useEffect17(() => {
|
|
13160
12827
|
loadWorkspaceData();
|
|
13161
12828
|
}, []);
|
|
13162
12829
|
const loadWorkspaceData = async () => {
|
|
@@ -13422,7 +13089,7 @@ var CrmWorkspace = () => {
|
|
|
13422
13089
|
var CrmWorkspace_default = CrmWorkspace;
|
|
13423
13090
|
|
|
13424
13091
|
// src/pages/workspaces/FacilityWorkspace.tsx
|
|
13425
|
-
import
|
|
13092
|
+
import React28, { useState as useState26 } from "react";
|
|
13426
13093
|
import { useQuery } from "@tanstack/react-query";
|
|
13427
13094
|
|
|
13428
13095
|
// src/pages/workspaces/charts.tsx
|
|
@@ -13787,7 +13454,7 @@ function Alerts({ alerts, onDismiss, onAction }) {
|
|
|
13787
13454
|
}
|
|
13788
13455
|
|
|
13789
13456
|
// src/pages/layout/PremiumPageLayout.tsx
|
|
13790
|
-
import
|
|
13457
|
+
import React27 from "react";
|
|
13791
13458
|
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
13792
13459
|
function PremiumButton({
|
|
13793
13460
|
children,
|
|
@@ -13907,7 +13574,7 @@ function PremiumPageLayout({
|
|
|
13907
13574
|
actions,
|
|
13908
13575
|
headerActions
|
|
13909
13576
|
}) {
|
|
13910
|
-
const [showActionsMenu, setShowActionsMenu] =
|
|
13577
|
+
const [showActionsMenu, setShowActionsMenu] = React27.useState(false);
|
|
13911
13578
|
return /* @__PURE__ */ jsxs37(
|
|
13912
13579
|
"div",
|
|
13913
13580
|
{
|
|
@@ -13972,14 +13639,14 @@ function PremiumPageLayout({
|
|
|
13972
13639
|
// src/pages/workspaces/FacilityWorkspace.tsx
|
|
13973
13640
|
import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
13974
13641
|
var FacilityWorkspace = () => {
|
|
13975
|
-
const [activeTab, setActiveTab] =
|
|
13976
|
-
const [showExportModal, setShowExportModal] =
|
|
13977
|
-
const [showConfigModal, setShowConfigModal] =
|
|
13978
|
-
const [showQuickActionModal, setShowQuickActionModal] =
|
|
13979
|
-
const [showMaintenanceModal, setShowMaintenanceModal] =
|
|
13980
|
-
const [showReportsModal, setShowReportsModal] =
|
|
13981
|
-
const [showFloatingMenu, setShowFloatingMenu] =
|
|
13982
|
-
const [dismissedAlerts, setDismissedAlerts] =
|
|
13642
|
+
const [activeTab, setActiveTab] = useState26("overview");
|
|
13643
|
+
const [showExportModal, setShowExportModal] = useState26(false);
|
|
13644
|
+
const [showConfigModal, setShowConfigModal] = useState26(false);
|
|
13645
|
+
const [showQuickActionModal, setShowQuickActionModal] = useState26(false);
|
|
13646
|
+
const [showMaintenanceModal, setShowMaintenanceModal] = useState26(false);
|
|
13647
|
+
const [showReportsModal, setShowReportsModal] = useState26(false);
|
|
13648
|
+
const [showFloatingMenu, setShowFloatingMenu] = useState26(false);
|
|
13649
|
+
const [dismissedAlerts, setDismissedAlerts] = useState26([]);
|
|
13983
13650
|
const { data: apiData, isLoading } = useQuery({
|
|
13984
13651
|
queryKey: ["dashboard-stats"],
|
|
13985
13652
|
queryFn: async () => {
|
|
@@ -14054,7 +13721,7 @@ var FacilityWorkspace = () => {
|
|
|
14054
13721
|
const workOrderData = apiData?.workOrderData || [];
|
|
14055
13722
|
const equipmentStatusData = apiData?.equipmentStatusData || [];
|
|
14056
13723
|
const expenseData = apiData?.expenseData || [];
|
|
14057
|
-
const activities =
|
|
13724
|
+
const activities = React28.useMemo(() => {
|
|
14058
13725
|
const combinedActivities = [];
|
|
14059
13726
|
if (recentTickets && Array.isArray(recentTickets)) {
|
|
14060
13727
|
recentTickets.forEach((ticket) => {
|
|
@@ -14093,7 +13760,7 @@ var FacilityWorkspace = () => {
|
|
|
14093
13760
|
combinedActivities.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
|
|
14094
13761
|
return combinedActivities.slice(0, 5);
|
|
14095
13762
|
}, [recentTickets, recentWorkOrders]);
|
|
14096
|
-
const alerts =
|
|
13763
|
+
const alerts = React28.useMemo(() => {
|
|
14097
13764
|
const generatedAlerts = [];
|
|
14098
13765
|
if (stats.workOrders.overdue > 0) {
|
|
14099
13766
|
generatedAlerts.push({
|
|
@@ -15015,7 +14682,7 @@ Budget utilis\xE9: ${stats?.expenses.budgetUtilization}%`;
|
|
|
15015
14682
|
var FacilityWorkspace_default = FacilityWorkspace;
|
|
15016
14683
|
|
|
15017
14684
|
// src/pages/workspaces/WorkSpace.tsx
|
|
15018
|
-
import { Fragment as
|
|
14685
|
+
import { Fragment as Fragment10, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
15019
14686
|
var MODULES_CONFIG = [
|
|
15020
14687
|
{
|
|
15021
14688
|
id: "core",
|
|
@@ -15064,11 +14731,11 @@ var MODULES_CONFIG = [
|
|
|
15064
14731
|
}
|
|
15065
14732
|
];
|
|
15066
14733
|
var WorkSpace = ({ module }) => {
|
|
15067
|
-
const [activeModule, setActiveModule] =
|
|
15068
|
-
const [availableModules, setAvailableModules] =
|
|
15069
|
-
const [loading, setLoading] =
|
|
15070
|
-
const [showModuleSelector, setShowModuleSelector] =
|
|
15071
|
-
|
|
14734
|
+
const [activeModule, setActiveModule] = useState27(module || null);
|
|
14735
|
+
const [availableModules, setAvailableModules] = useState27([]);
|
|
14736
|
+
const [loading, setLoading] = useState27(true);
|
|
14737
|
+
const [showModuleSelector, setShowModuleSelector] = useState27(false);
|
|
14738
|
+
useEffect19(() => {
|
|
15072
14739
|
loadAvailableModules();
|
|
15073
14740
|
}, []);
|
|
15074
14741
|
const loadAvailableModules = async () => {
|
|
@@ -15088,10 +14755,10 @@ var WorkSpace = ({ module }) => {
|
|
|
15088
14755
|
setLoading(false);
|
|
15089
14756
|
}
|
|
15090
14757
|
};
|
|
15091
|
-
const filteredModules =
|
|
14758
|
+
const filteredModules = useMemo2(() => {
|
|
15092
14759
|
return MODULES_CONFIG.filter((m) => availableModules.includes(m.id));
|
|
15093
14760
|
}, [availableModules]);
|
|
15094
|
-
const currentModule =
|
|
14761
|
+
const currentModule = useMemo2(() => {
|
|
15095
14762
|
return MODULES_CONFIG.find((m) => m.id === activeModule);
|
|
15096
14763
|
}, [activeModule]);
|
|
15097
14764
|
const ActiveWorkspaceComponent = currentModule?.component;
|
|
@@ -15130,7 +14797,7 @@ var WorkSpace = ({ module }) => {
|
|
|
15130
14797
|
]
|
|
15131
14798
|
}
|
|
15132
14799
|
),
|
|
15133
|
-
showModuleSelector && filteredModules.length > 1 && /* @__PURE__ */ jsxs39(
|
|
14800
|
+
showModuleSelector && filteredModules.length > 1 && /* @__PURE__ */ jsxs39(Fragment10, { children: [
|
|
15134
14801
|
/* @__PURE__ */ jsx45(
|
|
15135
14802
|
"div",
|
|
15136
14803
|
{
|
|
@@ -15439,7 +15106,7 @@ var BudgetPage = () => {
|
|
|
15439
15106
|
var BudgetPage_default = BudgetPage;
|
|
15440
15107
|
|
|
15441
15108
|
// src/pages/workspaces/ChatEquipePage.tsx
|
|
15442
|
-
import { useState as
|
|
15109
|
+
import { useState as useState28, useRef as useRef8, useEffect as useEffect20, useCallback as useCallback7 } from "react";
|
|
15443
15110
|
|
|
15444
15111
|
// src/pages/common/modern-form-components.tsx
|
|
15445
15112
|
import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
@@ -15573,25 +15240,25 @@ var ModernButton = ({ children, onClick, type = "button", variant = "primary", s
|
|
|
15573
15240
|
};
|
|
15574
15241
|
|
|
15575
15242
|
// src/pages/workspaces/ChatEquipePage.tsx
|
|
15576
|
-
import { Fragment as
|
|
15243
|
+
import { Fragment as Fragment11, jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
15577
15244
|
function TeamChat() {
|
|
15578
|
-
const [activeChannel, setActiveChannel] =
|
|
15579
|
-
const [newMessage, setNewMessage] =
|
|
15580
|
-
const [isTyping] =
|
|
15581
|
-
const [showCreateChannel, setShowCreateChannel] =
|
|
15582
|
-
const [newChannelName, setNewChannelName] =
|
|
15583
|
-
const [newChannelDescription, setNewChannelDescription] =
|
|
15584
|
-
const [newChannelType, setNewChannelType] =
|
|
15585
|
-
const [selectedUserIds, setSelectedUserIds] =
|
|
15586
|
-
const [platformUsers, setPlatformUsers] =
|
|
15587
|
-
const [channels, setChannels] =
|
|
15588
|
-
const [channelsLoading, setChannelsLoading] =
|
|
15589
|
-
const [messages, setMessages] =
|
|
15590
|
-
const [messagesLoading, setMessagesLoading] =
|
|
15591
|
-
const [sendingMessage, setSendingMessage] =
|
|
15592
|
-
const [creatingChannel, setCreatingChannel] =
|
|
15593
|
-
const messagesEndRef =
|
|
15594
|
-
const fetchUsers =
|
|
15245
|
+
const [activeChannel, setActiveChannel] = useState28("");
|
|
15246
|
+
const [newMessage, setNewMessage] = useState28("");
|
|
15247
|
+
const [isTyping] = useState28([]);
|
|
15248
|
+
const [showCreateChannel, setShowCreateChannel] = useState28(false);
|
|
15249
|
+
const [newChannelName, setNewChannelName] = useState28("");
|
|
15250
|
+
const [newChannelDescription, setNewChannelDescription] = useState28("");
|
|
15251
|
+
const [newChannelType, setNewChannelType] = useState28("general");
|
|
15252
|
+
const [selectedUserIds, setSelectedUserIds] = useState28([]);
|
|
15253
|
+
const [platformUsers, setPlatformUsers] = useState28([]);
|
|
15254
|
+
const [channels, setChannels] = useState28([]);
|
|
15255
|
+
const [channelsLoading, setChannelsLoading] = useState28(true);
|
|
15256
|
+
const [messages, setMessages] = useState28([]);
|
|
15257
|
+
const [messagesLoading, setMessagesLoading] = useState28(false);
|
|
15258
|
+
const [sendingMessage, setSendingMessage] = useState28(false);
|
|
15259
|
+
const [creatingChannel, setCreatingChannel] = useState28(false);
|
|
15260
|
+
const messagesEndRef = useRef8(null);
|
|
15261
|
+
const fetchUsers = useCallback7(async () => {
|
|
15595
15262
|
try {
|
|
15596
15263
|
const response = await coreApiClient.get("/users/");
|
|
15597
15264
|
console.log("\u{1F465} Users response:", response);
|
|
@@ -15601,12 +15268,12 @@ function TeamChat() {
|
|
|
15601
15268
|
console.error("\u274C Error fetching users:", error);
|
|
15602
15269
|
}
|
|
15603
15270
|
}, []);
|
|
15604
|
-
|
|
15271
|
+
useEffect20(() => {
|
|
15605
15272
|
if (showCreateChannel) {
|
|
15606
15273
|
fetchUsers();
|
|
15607
15274
|
}
|
|
15608
15275
|
}, [showCreateChannel, fetchUsers]);
|
|
15609
|
-
const fetchChannels =
|
|
15276
|
+
const fetchChannels = useCallback7(async () => {
|
|
15610
15277
|
try {
|
|
15611
15278
|
const response = await apiClient.get("/facility/chat-channels/my_channels/");
|
|
15612
15279
|
console.log("\u{1F4E2} Channels response:", response);
|
|
@@ -15630,18 +15297,18 @@ function TeamChat() {
|
|
|
15630
15297
|
setChannelsLoading(false);
|
|
15631
15298
|
}
|
|
15632
15299
|
}, []);
|
|
15633
|
-
|
|
15300
|
+
useEffect20(() => {
|
|
15634
15301
|
fetchChannels();
|
|
15635
15302
|
const interval = setInterval(fetchChannels, 3e4);
|
|
15636
15303
|
return () => clearInterval(interval);
|
|
15637
15304
|
}, [fetchChannels]);
|
|
15638
|
-
|
|
15305
|
+
useEffect20(() => {
|
|
15639
15306
|
if (channels.length > 0 && !activeChannel) {
|
|
15640
15307
|
console.log("\u2705 S\xE9lection automatique du canal:", channels[0].id);
|
|
15641
15308
|
setActiveChannel(channels[0].id);
|
|
15642
15309
|
}
|
|
15643
15310
|
}, [channels, activeChannel]);
|
|
15644
|
-
const fetchMessages =
|
|
15311
|
+
const fetchMessages = useCallback7(async () => {
|
|
15645
15312
|
if (!activeChannel) return;
|
|
15646
15313
|
try {
|
|
15647
15314
|
setMessagesLoading(true);
|
|
@@ -15672,7 +15339,7 @@ function TeamChat() {
|
|
|
15672
15339
|
setMessagesLoading(false);
|
|
15673
15340
|
}
|
|
15674
15341
|
}, [activeChannel]);
|
|
15675
|
-
|
|
15342
|
+
useEffect20(() => {
|
|
15676
15343
|
if (activeChannel) {
|
|
15677
15344
|
fetchMessages();
|
|
15678
15345
|
const interval = setInterval(fetchMessages, 1e4);
|
|
@@ -15734,7 +15401,7 @@ function TeamChat() {
|
|
|
15734
15401
|
(prev) => prev.includes(userId) ? prev.filter((id) => id !== userId) : [...prev, userId]
|
|
15735
15402
|
);
|
|
15736
15403
|
};
|
|
15737
|
-
|
|
15404
|
+
useEffect20(() => {
|
|
15738
15405
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
15739
15406
|
}, [messages]);
|
|
15740
15407
|
const handleSendMessage = () => {
|
|
@@ -15881,7 +15548,7 @@ function TeamChat() {
|
|
|
15881
15548
|
message.content
|
|
15882
15549
|
] }),
|
|
15883
15550
|
/* @__PURE__ */ jsx50("div", { className: "text-[11px] mt-1", style: { color: "#999" }, children: formatTimestamp(message.created_at) })
|
|
15884
|
-
] }) : /* @__PURE__ */ jsxs44(
|
|
15551
|
+
] }) : /* @__PURE__ */ jsxs44(Fragment11, { children: [
|
|
15885
15552
|
showAvatar && /* @__PURE__ */ jsxs44("div", { className: "flex items-center space-x-2 mb-1", style: { fontFamily: "'Sometype Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace" }, children: [
|
|
15886
15553
|
/* @__PURE__ */ jsx50("span", { className: "text-[13px] font-medium", style: { color: "#191919" }, children: getAuthorName(message.author) }),
|
|
15887
15554
|
/* @__PURE__ */ jsx50("span", { className: "text-[11px]", style: { color: "#999" }, children: formatTimestamp(message.created_at) }),
|
|
@@ -16118,7 +15785,7 @@ function TeamChat() {
|
|
|
16118
15785
|
var ChatEquipePage_default = TeamChat;
|
|
16119
15786
|
|
|
16120
15787
|
// src/pages/workspaces/ActifsPage.tsx
|
|
16121
|
-
import { useState as
|
|
15788
|
+
import { useState as useState29, useMemo as useMemo3, useEffect as useEffect21 } from "react";
|
|
16122
15789
|
|
|
16123
15790
|
// src/services/EquipmentServices.ts
|
|
16124
15791
|
var EquipmentService = class {
|
|
@@ -16236,14 +15903,14 @@ var mapEquipmentToAsset = (equipment) => {
|
|
|
16236
15903
|
};
|
|
16237
15904
|
};
|
|
16238
15905
|
function AssetsDashboard() {
|
|
16239
|
-
const [selectedLocation, setSelectedLocation] =
|
|
16240
|
-
const [selectedStatus, setSelectedStatus] =
|
|
16241
|
-
const [selectedCriticality, setSelectedCriticality] =
|
|
16242
|
-
const [viewMode, setViewMode] =
|
|
16243
|
-
const [equipmentData, setEquipmentData] =
|
|
16244
|
-
const [isLoading, setIsLoading] =
|
|
16245
|
-
const [isError, setIsError] =
|
|
16246
|
-
|
|
15906
|
+
const [selectedLocation, setSelectedLocation] = useState29("");
|
|
15907
|
+
const [selectedStatus, setSelectedStatus] = useState29("");
|
|
15908
|
+
const [selectedCriticality, setSelectedCriticality] = useState29("");
|
|
15909
|
+
const [viewMode, setViewMode] = useState29("overview");
|
|
15910
|
+
const [equipmentData, setEquipmentData] = useState29(null);
|
|
15911
|
+
const [isLoading, setIsLoading] = useState29(true);
|
|
15912
|
+
const [isError, setIsError] = useState29(false);
|
|
15913
|
+
useEffect21(() => {
|
|
16247
15914
|
const fetchEquipment = async () => {
|
|
16248
15915
|
try {
|
|
16249
15916
|
setIsLoading(true);
|
|
@@ -16266,7 +15933,7 @@ function AssetsDashboard() {
|
|
|
16266
15933
|
const interval = setInterval(fetchEquipment, 5 * 60 * 1e3);
|
|
16267
15934
|
return () => clearInterval(interval);
|
|
16268
15935
|
}, []);
|
|
16269
|
-
const assets =
|
|
15936
|
+
const assets = useMemo3(() => {
|
|
16270
15937
|
if (!equipmentData?.results) return [];
|
|
16271
15938
|
try {
|
|
16272
15939
|
return equipmentData.results.map(mapEquipmentToAsset);
|
|
@@ -16275,7 +15942,7 @@ function AssetsDashboard() {
|
|
|
16275
15942
|
return [];
|
|
16276
15943
|
}
|
|
16277
15944
|
}, [equipmentData]);
|
|
16278
|
-
const filteredAssets =
|
|
15945
|
+
const filteredAssets = useMemo3(() => {
|
|
16279
15946
|
return assets.filter((asset) => {
|
|
16280
15947
|
const matchesLocation = selectedLocation === "" || asset.location.includes(selectedLocation);
|
|
16281
15948
|
const matchesStatus = selectedStatus === "" || asset.status === selectedStatus;
|
|
@@ -16741,7 +16408,7 @@ function AssetsDashboard() {
|
|
|
16741
16408
|
var ActifsPage_default = AssetsDashboard;
|
|
16742
16409
|
|
|
16743
16410
|
// src/pages/workspaces/PlanningPage.tsx
|
|
16744
|
-
import { useState as
|
|
16411
|
+
import { useState as useState30, useEffect as useEffect22, useMemo as useMemo4, useCallback as useCallback8 } from "react";
|
|
16745
16412
|
|
|
16746
16413
|
// src/services/WorkOrdersServices.ts
|
|
16747
16414
|
var WorkOrdersService = class {
|
|
@@ -16832,15 +16499,15 @@ var mapUserToTeamMember = (user) => {
|
|
|
16832
16499
|
};
|
|
16833
16500
|
};
|
|
16834
16501
|
function TeamCalendar() {
|
|
16835
|
-
const [currentDate, setCurrentDate] =
|
|
16836
|
-
const [viewMode, setViewMode] =
|
|
16837
|
-
const [selectedEvent, setSelectedEvent] =
|
|
16838
|
-
const [showCreateModal, setShowCreateModal] =
|
|
16839
|
-
const [showEventDetails, setShowEventDetails] =
|
|
16840
|
-
const [filterType, setFilterType] =
|
|
16841
|
-
const [filterAssignee, setFilterAssignee] =
|
|
16842
|
-
const [hasToken, setHasToken] =
|
|
16843
|
-
const [newEvent, setNewEvent] =
|
|
16502
|
+
const [currentDate, setCurrentDate] = useState30(/* @__PURE__ */ new Date());
|
|
16503
|
+
const [viewMode, setViewMode] = useState30("month");
|
|
16504
|
+
const [selectedEvent, setSelectedEvent] = useState30(null);
|
|
16505
|
+
const [showCreateModal, setShowCreateModal] = useState30(false);
|
|
16506
|
+
const [showEventDetails, setShowEventDetails] = useState30(false);
|
|
16507
|
+
const [filterType, setFilterType] = useState30("");
|
|
16508
|
+
const [filterAssignee, setFilterAssignee] = useState30("");
|
|
16509
|
+
const [hasToken, setHasToken] = useState30(false);
|
|
16510
|
+
const [newEvent, setNewEvent] = useState30({
|
|
16844
16511
|
title: "",
|
|
16845
16512
|
description: "",
|
|
16846
16513
|
type: "maintenance",
|
|
@@ -16852,14 +16519,14 @@ function TeamCalendar() {
|
|
|
16852
16519
|
assignees: [],
|
|
16853
16520
|
equipmentId: ""
|
|
16854
16521
|
});
|
|
16855
|
-
const [workOrdersData, setWorkOrdersData] =
|
|
16856
|
-
const [workOrdersLoading, setWorkOrdersLoading] =
|
|
16857
|
-
const [teamMembersData, setTeamMembersData] =
|
|
16858
|
-
|
|
16522
|
+
const [workOrdersData, setWorkOrdersData] = useState30(null);
|
|
16523
|
+
const [workOrdersLoading, setWorkOrdersLoading] = useState30(true);
|
|
16524
|
+
const [teamMembersData, setTeamMembersData] = useState30([]);
|
|
16525
|
+
useEffect22(() => {
|
|
16859
16526
|
const token = localStorage.getItem("token");
|
|
16860
16527
|
setHasToken(!!token);
|
|
16861
16528
|
}, []);
|
|
16862
|
-
const fetchWorkOrders =
|
|
16529
|
+
const fetchWorkOrders = useCallback8(async () => {
|
|
16863
16530
|
if (!hasToken) return;
|
|
16864
16531
|
try {
|
|
16865
16532
|
setWorkOrdersLoading(true);
|
|
@@ -16877,7 +16544,7 @@ function TeamCalendar() {
|
|
|
16877
16544
|
setWorkOrdersLoading(false);
|
|
16878
16545
|
}
|
|
16879
16546
|
}, [hasToken]);
|
|
16880
|
-
const fetchTeamMembers =
|
|
16547
|
+
const fetchTeamMembers = useCallback8(async () => {
|
|
16881
16548
|
if (!hasToken) return;
|
|
16882
16549
|
try {
|
|
16883
16550
|
const businessEntityId = localStorage.getItem("selectedBusinessEntity") || "1";
|
|
@@ -16896,7 +16563,7 @@ function TeamCalendar() {
|
|
|
16896
16563
|
setTeamMembersData([]);
|
|
16897
16564
|
}
|
|
16898
16565
|
}, [hasToken]);
|
|
16899
|
-
|
|
16566
|
+
useEffect22(() => {
|
|
16900
16567
|
if (hasToken) {
|
|
16901
16568
|
fetchWorkOrders();
|
|
16902
16569
|
fetchTeamMembers();
|
|
@@ -16904,7 +16571,7 @@ function TeamCalendar() {
|
|
|
16904
16571
|
return () => clearInterval(interval);
|
|
16905
16572
|
}
|
|
16906
16573
|
}, [hasToken, fetchWorkOrders, fetchTeamMembers]);
|
|
16907
|
-
const events =
|
|
16574
|
+
const events = useMemo4(() => {
|
|
16908
16575
|
if (!workOrdersData?.results) return [];
|
|
16909
16576
|
try {
|
|
16910
16577
|
return workOrdersData.results.map(mapWorkOrderToCalendarEvent);
|
|
@@ -16913,7 +16580,7 @@ function TeamCalendar() {
|
|
|
16913
16580
|
return [];
|
|
16914
16581
|
}
|
|
16915
16582
|
}, [workOrdersData]);
|
|
16916
|
-
const teamMembers =
|
|
16583
|
+
const teamMembers = useMemo4(() => {
|
|
16917
16584
|
if (!teamMembersData || teamMembersData.length === 0) return [];
|
|
16918
16585
|
try {
|
|
16919
16586
|
return teamMembersData.map(mapUserToTeamMember);
|
|
@@ -16922,7 +16589,7 @@ function TeamCalendar() {
|
|
|
16922
16589
|
return [];
|
|
16923
16590
|
}
|
|
16924
16591
|
}, [teamMembersData]);
|
|
16925
|
-
const currentMonthEvents =
|
|
16592
|
+
const currentMonthEvents = useMemo4(() => {
|
|
16926
16593
|
return events.filter((event) => {
|
|
16927
16594
|
const eventMonth = event.startDate.getMonth();
|
|
16928
16595
|
const eventYear = event.startDate.getFullYear();
|
|
@@ -17607,7 +17274,7 @@ function TeamCalendar() {
|
|
|
17607
17274
|
var PlanningPage_default = TeamCalendar;
|
|
17608
17275
|
|
|
17609
17276
|
// src/pages/workspaces/TaskPilot.tsx
|
|
17610
|
-
import { useState as
|
|
17277
|
+
import { useState as useState32, useEffect as useEffect24, useCallback as useCallback9 } from "react";
|
|
17611
17278
|
import {
|
|
17612
17279
|
Plus as Plus6,
|
|
17613
17280
|
MoreVertical as MoreVertical2,
|
|
@@ -17648,13 +17315,13 @@ var TaskServices = {
|
|
|
17648
17315
|
};
|
|
17649
17316
|
|
|
17650
17317
|
// src/pages/workspaces/FormTask.tsx
|
|
17651
|
-
import { useState as
|
|
17318
|
+
import { useState as useState31, useEffect as useEffect23 } from "react";
|
|
17652
17319
|
import { Loader2 as Loader25 } from "lucide-react";
|
|
17653
17320
|
import { jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
17654
17321
|
var FormTask = ({ open, onClose, task, defaultStatus = "new", onSuccess }) => {
|
|
17655
17322
|
const { addToast } = useToast();
|
|
17656
|
-
const [loading, setLoading] =
|
|
17657
|
-
const [formData, setFormData] =
|
|
17323
|
+
const [loading, setLoading] = useState31(false);
|
|
17324
|
+
const [formData, setFormData] = useState31({
|
|
17658
17325
|
title: "",
|
|
17659
17326
|
description: "",
|
|
17660
17327
|
status: defaultStatus,
|
|
@@ -17662,7 +17329,7 @@ var FormTask = ({ open, onClose, task, defaultStatus = "new", onSuccess }) => {
|
|
|
17662
17329
|
start_date: "",
|
|
17663
17330
|
end_date: ""
|
|
17664
17331
|
});
|
|
17665
|
-
|
|
17332
|
+
useEffect23(() => {
|
|
17666
17333
|
if (task) {
|
|
17667
17334
|
setFormData({
|
|
17668
17335
|
title: task.title || "",
|
|
@@ -17843,7 +17510,7 @@ var PriorityBadge = ({ priority }) => {
|
|
|
17843
17510
|
return /* @__PURE__ */ jsx54("span", { className: `px-2 py-0.5 text-xs font-medium rounded ${option.color}`, children: option.label });
|
|
17844
17511
|
};
|
|
17845
17512
|
var TaskCard = ({ task, isDragging, onDragStart, onDragEnd, onEdit, onDelete }) => {
|
|
17846
|
-
const [showMenu, setShowMenu] =
|
|
17513
|
+
const [showMenu, setShowMenu] = useState32(false);
|
|
17847
17514
|
return /* @__PURE__ */ jsxs48(
|
|
17848
17515
|
"div",
|
|
17849
17516
|
{
|
|
@@ -17971,15 +17638,15 @@ var KanbanColumn = ({ column, tasks, onAddTask, draggedTask, onDragStart, onDrag
|
|
|
17971
17638
|
};
|
|
17972
17639
|
var TaskPilot = () => {
|
|
17973
17640
|
const { success: showSuccess, error: showError, warning: showWarning, info: showInfo, confirm: confirm2 } = useToast();
|
|
17974
|
-
const [tasks, setTasks] =
|
|
17975
|
-
const [loading, setLoading] =
|
|
17976
|
-
const [searchQuery, setSearchQuery] =
|
|
17977
|
-
const [draggedTask, setDraggedTask] =
|
|
17978
|
-
const [dropTargetColumn, setDropTargetColumn] =
|
|
17979
|
-
const [isFormOpen, setIsFormOpen] =
|
|
17980
|
-
const [editingTask, setEditingTask] =
|
|
17981
|
-
const [defaultStatus, setDefaultStatus] =
|
|
17982
|
-
const loadTasks =
|
|
17641
|
+
const [tasks, setTasks] = useState32([]);
|
|
17642
|
+
const [loading, setLoading] = useState32(true);
|
|
17643
|
+
const [searchQuery, setSearchQuery] = useState32("");
|
|
17644
|
+
const [draggedTask, setDraggedTask] = useState32(null);
|
|
17645
|
+
const [dropTargetColumn, setDropTargetColumn] = useState32(null);
|
|
17646
|
+
const [isFormOpen, setIsFormOpen] = useState32(false);
|
|
17647
|
+
const [editingTask, setEditingTask] = useState32(null);
|
|
17648
|
+
const [defaultStatus, setDefaultStatus] = useState32("new");
|
|
17649
|
+
const loadTasks = useCallback9(async () => {
|
|
17983
17650
|
try {
|
|
17984
17651
|
setLoading(true);
|
|
17985
17652
|
const response = await TaskServices.list();
|
|
@@ -17998,7 +17665,7 @@ var TaskPilot = () => {
|
|
|
17998
17665
|
setLoading(false);
|
|
17999
17666
|
}
|
|
18000
17667
|
}, [showError]);
|
|
18001
|
-
|
|
17668
|
+
useEffect24(() => {
|
|
18002
17669
|
loadTasks();
|
|
18003
17670
|
}, [loadTasks]);
|
|
18004
17671
|
const getTasksByStatus = (status) => {
|
|
@@ -18149,11 +17816,11 @@ var TaskPilot = () => {
|
|
|
18149
17816
|
var TaskPilot_default = TaskPilot;
|
|
18150
17817
|
|
|
18151
17818
|
// src/components/purchase-request/PurchaseRequestsPage.tsx
|
|
18152
|
-
import { useEffect as
|
|
17819
|
+
import { useEffect as useEffect27, useState as useState35 } from "react";
|
|
18153
17820
|
import { ClipboardCheck, Plus as Plus9 } from "lucide-react";
|
|
18154
17821
|
|
|
18155
17822
|
// src/components/purchase-request/FormPurchaseRequest.tsx
|
|
18156
|
-
import { useState as
|
|
17823
|
+
import { useState as useState34, useEffect as useEffect26 } from "react";
|
|
18157
17824
|
import {
|
|
18158
17825
|
Building2 as Building26,
|
|
18159
17826
|
Trash2 as Trash27,
|
|
@@ -18192,7 +17859,7 @@ var UNITS = [
|
|
|
18192
17859
|
];
|
|
18193
17860
|
|
|
18194
17861
|
// src/components/purchase-request/components/CatalogueProductSelector.tsx
|
|
18195
|
-
import { useState as
|
|
17862
|
+
import { useState as useState33, useMemo as useMemo5, useEffect as useEffect25, useCallback as useCallback10 } from "react";
|
|
18196
17863
|
import {
|
|
18197
17864
|
Search as Search5,
|
|
18198
17865
|
Package as Package2,
|
|
@@ -18367,16 +18034,16 @@ var CatalogueProductSelector = ({
|
|
|
18367
18034
|
selectedSupplierId,
|
|
18368
18035
|
onShowToast
|
|
18369
18036
|
}) => {
|
|
18370
|
-
const [searchTerm, setSearchTerm] =
|
|
18371
|
-
const [filterCategory, setFilterCategory] =
|
|
18372
|
-
const [filterType, setFilterType] =
|
|
18373
|
-
const [onlyHomologated, setOnlyHomologated] =
|
|
18374
|
-
const [selectedProducts, setSelectedProducts] =
|
|
18375
|
-
const [products, setProducts] =
|
|
18376
|
-
const [loading, setLoading] =
|
|
18377
|
-
const [loadingProductId, setLoadingProductId] =
|
|
18037
|
+
const [searchTerm, setSearchTerm] = useState33("");
|
|
18038
|
+
const [filterCategory, setFilterCategory] = useState33("all");
|
|
18039
|
+
const [filterType, setFilterType] = useState33("all");
|
|
18040
|
+
const [onlyHomologated, setOnlyHomologated] = useState33(true);
|
|
18041
|
+
const [selectedProducts, setSelectedProducts] = useState33(/* @__PURE__ */ new Map());
|
|
18042
|
+
const [products, setProducts] = useState33([]);
|
|
18043
|
+
const [loading, setLoading] = useState33(false);
|
|
18044
|
+
const [loadingProductId, setLoadingProductId] = useState33(null);
|
|
18378
18045
|
const { activeBusinessEntity } = useSession();
|
|
18379
|
-
const fetchProducts =
|
|
18046
|
+
const fetchProducts = useCallback10(async () => {
|
|
18380
18047
|
setLoading(true);
|
|
18381
18048
|
try {
|
|
18382
18049
|
const params = { status: "active", business_entity_id: activeBusinessEntity?.id };
|
|
@@ -18393,12 +18060,12 @@ var CatalogueProductSelector = ({
|
|
|
18393
18060
|
setLoading(false);
|
|
18394
18061
|
}
|
|
18395
18062
|
}, [searchTerm, filterCategory, filterType, selectedSupplierId]);
|
|
18396
|
-
|
|
18063
|
+
useEffect25(() => {
|
|
18397
18064
|
if (!isOpen) return;
|
|
18398
18065
|
const timer = setTimeout(fetchProducts, 300);
|
|
18399
18066
|
return () => clearTimeout(timer);
|
|
18400
18067
|
}, [fetchProducts, isOpen]);
|
|
18401
|
-
|
|
18068
|
+
useEffect25(() => {
|
|
18402
18069
|
if (!isOpen) {
|
|
18403
18070
|
setSelectedProducts(/* @__PURE__ */ new Map());
|
|
18404
18071
|
setSearchTerm("");
|
|
@@ -18406,7 +18073,7 @@ var CatalogueProductSelector = ({
|
|
|
18406
18073
|
setFilterType("all");
|
|
18407
18074
|
}
|
|
18408
18075
|
}, [isOpen]);
|
|
18409
|
-
const filteredProducts =
|
|
18076
|
+
const filteredProducts = useMemo5(() => {
|
|
18410
18077
|
return products.filter((product) => {
|
|
18411
18078
|
const hasHomologated = !onlyHomologated || (product.homologated_suppliers_count || 0) > 0;
|
|
18412
18079
|
return hasHomologated;
|
|
@@ -18694,7 +18361,7 @@ var FormPurchaseRequest = ({
|
|
|
18694
18361
|
refresh = () => {
|
|
18695
18362
|
}
|
|
18696
18363
|
}) => {
|
|
18697
|
-
const [formData, setFormData] =
|
|
18364
|
+
const [formData, setFormData] = useState34(object || {
|
|
18698
18365
|
request_number: "",
|
|
18699
18366
|
title: "",
|
|
18700
18367
|
description: "",
|
|
@@ -18727,13 +18394,13 @@ var FormPurchaseRequest = ({
|
|
|
18727
18394
|
{ description: "", specifications: "", quantity: 1, unit: "", unit_price: 0, total_price: 0, comments: "" }
|
|
18728
18395
|
]
|
|
18729
18396
|
});
|
|
18730
|
-
const [errors, setErrors] =
|
|
18731
|
-
const [activeTab, setActiveTab] =
|
|
18732
|
-
const [loading, setLoading] =
|
|
18397
|
+
const [errors, setErrors] = useState34({});
|
|
18398
|
+
const [activeTab, setActiveTab] = useState34("general");
|
|
18399
|
+
const [loading, setLoading] = useState34(false);
|
|
18733
18400
|
const { loggedUser, token, vendors } = useSession();
|
|
18734
18401
|
const { success, error: showError } = useToast();
|
|
18735
|
-
const [showCatalogueSelector, setShowCatalogueSelector] =
|
|
18736
|
-
const [budgetInfo, setBudgetInfo] =
|
|
18402
|
+
const [showCatalogueSelector, setShowCatalogueSelector] = useState34(false);
|
|
18403
|
+
const [budgetInfo, setBudgetInfo] = useState34({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
|
|
18737
18404
|
const readonly = false;
|
|
18738
18405
|
const fetchDepartmentBudget = async (departmentId) => {
|
|
18739
18406
|
if (!departmentId) {
|
|
@@ -18768,12 +18435,12 @@ var FormPurchaseRequest = ({
|
|
|
18768
18435
|
setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
|
|
18769
18436
|
}
|
|
18770
18437
|
};
|
|
18771
|
-
|
|
18438
|
+
useEffect26(() => {
|
|
18772
18439
|
if (formData.department) {
|
|
18773
18440
|
fetchDepartmentBudget(formData.department);
|
|
18774
18441
|
}
|
|
18775
18442
|
}, [formData.department]);
|
|
18776
|
-
|
|
18443
|
+
useEffect26(() => {
|
|
18777
18444
|
const total = formData.items?.reduce((sum, item) => sum + (Number(item?.total_price) || 0), 0) || 0;
|
|
18778
18445
|
setFormData((prev) => ({ ...prev, estimated_amount: total }));
|
|
18779
18446
|
}, [formData.items]);
|
|
@@ -19335,15 +19002,15 @@ var FormPurchaseRequest = ({
|
|
|
19335
19002
|
// src/components/purchase-request/PurchaseRequestsPage.tsx
|
|
19336
19003
|
import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
19337
19004
|
var PurchaseRequestsPage = () => {
|
|
19338
|
-
const [purchaseRequests, setPurchaseRequests] =
|
|
19339
|
-
const [loading, setLoading] =
|
|
19340
|
-
const [refreshToggle, setRefreshToggle] =
|
|
19341
|
-
const [showModal, setShowModal] =
|
|
19342
|
-
const [showModalRFQ, setShowModalRFQ] =
|
|
19343
|
-
const [showModalSourcing, setShowModalSourcing] =
|
|
19344
|
-
const [selectedPurchaseRequest, setSelectedPurchaseRequest] =
|
|
19005
|
+
const [purchaseRequests, setPurchaseRequests] = useState35([]);
|
|
19006
|
+
const [loading, setLoading] = useState35(true);
|
|
19007
|
+
const [refreshToggle, setRefreshToggle] = useState35(false);
|
|
19008
|
+
const [showModal, setShowModal] = useState35(false);
|
|
19009
|
+
const [showModalRFQ, setShowModalRFQ] = useState35(false);
|
|
19010
|
+
const [showModalSourcing, setShowModalSourcing] = useState35(false);
|
|
19011
|
+
const [selectedPurchaseRequest, setSelectedPurchaseRequest] = useState35(null);
|
|
19345
19012
|
const { token } = useSession();
|
|
19346
|
-
|
|
19013
|
+
useEffect27(() => {
|
|
19347
19014
|
}, []);
|
|
19348
19015
|
const loadPurchaseRequests = async () => {
|
|
19349
19016
|
setRefreshToggle((prev) => !prev);
|
|
@@ -19352,7 +19019,7 @@ var PurchaseRequestsPage = () => {
|
|
|
19352
19019
|
{ id: "purchase_requests", label: "Demande d'achat", icon: ClipboardCheck },
|
|
19353
19020
|
{ id: "my_gr_se", label: "My GR-SE", icon: ClipboardCheck }
|
|
19354
19021
|
];
|
|
19355
|
-
const [activeTab, setActiveTab] =
|
|
19022
|
+
const [activeTab, setActiveTab] = useState35("purchase_requests");
|
|
19356
19023
|
return /* @__PURE__ */ jsxs51(
|
|
19357
19024
|
Pages_default,
|
|
19358
19025
|
{
|
|
@@ -19530,9 +19197,13 @@ var PurchaseRequestsPage = () => {
|
|
|
19530
19197
|
|
|
19531
19198
|
// src/App.tsx
|
|
19532
19199
|
import { Routes, Route, BrowserRouter } from "react-router-dom";
|
|
19200
|
+
import {
|
|
19201
|
+
QueryClient,
|
|
19202
|
+
QueryClientProvider
|
|
19203
|
+
} from "@tanstack/react-query";
|
|
19533
19204
|
|
|
19534
19205
|
// src/pages/Home.tsx
|
|
19535
|
-
import { useState as
|
|
19206
|
+
import { useState as useState36 } from "react";
|
|
19536
19207
|
import { useNavigate as useNavigate4 } from "react-router-dom";
|
|
19537
19208
|
import {
|
|
19538
19209
|
Zap as Zap2,
|
|
@@ -19563,19 +19234,19 @@ import {
|
|
|
19563
19234
|
import { jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
19564
19235
|
|
|
19565
19236
|
// src/pages/auth/Login.tsx
|
|
19566
|
-
import { useState as
|
|
19237
|
+
import { useState as useState37 } from "react";
|
|
19567
19238
|
import { Eye as Eye5, EyeOff as EyeOff3 } from "lucide-react";
|
|
19568
19239
|
import { useNavigate as useNavigate5 } from "react-router-dom";
|
|
19569
19240
|
import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
19570
19241
|
|
|
19571
19242
|
// src/pages/auth/Register.tsx
|
|
19572
|
-
import { useState as
|
|
19243
|
+
import { useState as useState38 } from "react";
|
|
19573
19244
|
import { Eye as Eye6, EyeOff as EyeOff4 } from "lucide-react";
|
|
19574
19245
|
import { useNavigate as useNavigate6 } from "react-router-dom";
|
|
19575
19246
|
import { jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
19576
19247
|
|
|
19577
19248
|
// src/pages/Dashboard.tsx
|
|
19578
|
-
import { useEffect as
|
|
19249
|
+
import { useEffect as useEffect28 } from "react";
|
|
19579
19250
|
import { useNavigate as useNavigate7 } from "react-router-dom";
|
|
19580
19251
|
import {
|
|
19581
19252
|
FileText as FileText13,
|
|
@@ -19598,17 +19269,17 @@ import { BarChart3 as BarChart33, TrendingUp as TrendingUp7, Users as Users9, Cl
|
|
|
19598
19269
|
import { jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
19599
19270
|
|
|
19600
19271
|
// src/pages/Team.tsx
|
|
19601
|
-
import { useState as
|
|
19272
|
+
import { useState as useState39 } from "react";
|
|
19602
19273
|
import { Plus as Plus10, Search as Search6, Filter as Filter3, MoreVertical as MoreVertical3, Mail as Mail4, Phone as Phone4, MapPin as MapPin5 } from "lucide-react";
|
|
19603
19274
|
import { jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
19604
19275
|
|
|
19605
19276
|
// src/pages/Profile.tsx
|
|
19606
|
-
import { useState as
|
|
19277
|
+
import { useState as useState40, useEffect as useEffect29 } from "react";
|
|
19607
19278
|
import { Camera as Camera2, Mail as Mail5, Phone as Phone5, Calendar as Calendar6, Edit3 as Edit34, Save as Save2, X as X13, User as UserIcon2 } from "lucide-react";
|
|
19608
19279
|
import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
19609
19280
|
|
|
19610
19281
|
// src/pages/Settings.tsx
|
|
19611
|
-
import { useState as
|
|
19282
|
+
import { useState as useState41 } from "react";
|
|
19612
19283
|
import {
|
|
19613
19284
|
Bell as Bell2,
|
|
19614
19285
|
Shield as Shield2,
|
|
@@ -19625,7 +19296,7 @@ import {
|
|
|
19625
19296
|
import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
19626
19297
|
|
|
19627
19298
|
// src/pages/CreateOrganization.tsx
|
|
19628
|
-
import { useEffect as
|
|
19299
|
+
import { useEffect as useEffect30, useState as useState42 } from "react";
|
|
19629
19300
|
import { useNavigate as useNavigate8, useParams as useParams2 } from "react-router-dom";
|
|
19630
19301
|
import { ArrowLeft, Loader2 as Loader28 } from "lucide-react";
|
|
19631
19302
|
|
|
@@ -19637,7 +19308,7 @@ var ENTITIES_API_URL = `${API_URL}/core/entities/`;
|
|
|
19637
19308
|
import { jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
19638
19309
|
|
|
19639
19310
|
// src/pages/organizations/ListOrganizations.tsx
|
|
19640
|
-
import { useState as
|
|
19311
|
+
import { useState as useState43, useEffect as useEffect31 } from "react";
|
|
19641
19312
|
import { useNavigate as useNavigate9 } from "react-router-dom";
|
|
19642
19313
|
import {
|
|
19643
19314
|
Building2 as Building27,
|
|
@@ -19655,7 +19326,7 @@ import {
|
|
|
19655
19326
|
import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
19656
19327
|
|
|
19657
19328
|
// src/pages/organizations/DetailOrganizations.tsx
|
|
19658
|
-
import { useState as
|
|
19329
|
+
import { useState as useState45, useEffect as useEffect33 } from "react";
|
|
19659
19330
|
import { useParams as useParams3, useNavigate as useNavigate11 } from "react-router-dom";
|
|
19660
19331
|
import {
|
|
19661
19332
|
ArrowLeft as ArrowLeft2,
|
|
@@ -19674,41 +19345,41 @@ import {
|
|
|
19674
19345
|
} from "lucide-react";
|
|
19675
19346
|
|
|
19676
19347
|
// src/pages/pricings/ListPricing.tsx
|
|
19677
|
-
import { useState as
|
|
19348
|
+
import { useState as useState44 } from "react";
|
|
19678
19349
|
import { useNavigate as useNavigate10 } from "react-router-dom";
|
|
19679
19350
|
import {
|
|
19680
19351
|
Check as Check5,
|
|
19681
19352
|
X as X14
|
|
19682
19353
|
} from "lucide-react";
|
|
19683
|
-
import { Fragment as
|
|
19354
|
+
import { Fragment as Fragment12, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
19684
19355
|
|
|
19685
19356
|
// src/services/PlanSubscriptionServices.tsx
|
|
19686
19357
|
var MODULES_API_URL = `${API_URL}/core/modules/`;
|
|
19687
19358
|
var PLANS_API_URL = `${API_URL}/core/plans/`;
|
|
19688
19359
|
|
|
19689
19360
|
// src/pages/organizations/DetailOrganizations.tsx
|
|
19690
|
-
import { Fragment as
|
|
19361
|
+
import { Fragment as Fragment13, jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
19691
19362
|
|
|
19692
19363
|
// src/pages/organizations/DetailEntity.tsx
|
|
19693
|
-
import { useState as
|
|
19364
|
+
import { useState as useState47, useEffect as useEffect35 } from "react";
|
|
19694
19365
|
import { useNavigate as useNavigate12, useParams as useParams4 } from "react-router-dom";
|
|
19695
19366
|
import { Building2 as Building210, CreditCard as CreditCard6, FileText as FileText15, MapPin as MapPin9, User as UserIcon4, File as File3 } from "lucide-react";
|
|
19696
19367
|
|
|
19697
19368
|
// src/forms/UserForm.tsx
|
|
19698
|
-
import { useState as
|
|
19369
|
+
import { useState as useState46, useEffect as useEffect34 } from "react";
|
|
19699
19370
|
|
|
19700
19371
|
// src/services/AuthorizationService.ts
|
|
19701
19372
|
var API_BASE_URL3 = `${API_URL}/core/permissions`;
|
|
19702
19373
|
|
|
19703
19374
|
// src/forms/UserForm.tsx
|
|
19704
19375
|
import { Building2 as Building29, User as UserIcon3, X as X16 } from "lucide-react";
|
|
19705
|
-
import { Fragment as
|
|
19376
|
+
import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
19706
19377
|
|
|
19707
19378
|
// src/pages/organizations/DetailEntity.tsx
|
|
19708
19379
|
import { jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
19709
19380
|
|
|
19710
19381
|
// src/pages/pricings/CartPlan.tsx
|
|
19711
|
-
import { useState as
|
|
19382
|
+
import { useState as useState48, useEffect as useEffect36 } from "react";
|
|
19712
19383
|
import { useNavigate as useNavigate13, useSearchParams as useSearchParams3 } from "react-router-dom";
|
|
19713
19384
|
import {
|
|
19714
19385
|
Check as Check6,
|
|
@@ -19721,7 +19392,7 @@ import {
|
|
|
19721
19392
|
Zap as Zap3,
|
|
19722
19393
|
Trash2 as Trash211
|
|
19723
19394
|
} from "lucide-react";
|
|
19724
|
-
import { Fragment as
|
|
19395
|
+
import { Fragment as Fragment15, jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
19725
19396
|
|
|
19726
19397
|
// src/App.tsx
|
|
19727
19398
|
import {
|
|
@@ -19745,32 +19416,32 @@ import {
|
|
|
19745
19416
|
} from "lucide-react";
|
|
19746
19417
|
|
|
19747
19418
|
// src/pages/auth/ForgotPassword.tsx
|
|
19748
|
-
import { useState as
|
|
19419
|
+
import { useState as useState49 } from "react";
|
|
19749
19420
|
import { useNavigate as useNavigate14 } from "react-router-dom";
|
|
19750
19421
|
import { Mail as Mail7, CheckCircle as CheckCircle6 } from "lucide-react";
|
|
19751
19422
|
import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
19752
19423
|
|
|
19753
19424
|
// src/pages/auth/ResetPassword.tsx
|
|
19754
|
-
import { useState as
|
|
19425
|
+
import { useState as useState50 } from "react";
|
|
19755
19426
|
import { useNavigate as useNavigate15, useParams as useParams5 } from "react-router-dom";
|
|
19756
19427
|
import { Lock as Lock4, CheckCircle as CheckCircle7 } from "lucide-react";
|
|
19757
19428
|
import { jsx as jsx74, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
19758
19429
|
|
|
19759
19430
|
// src/pages/auth/RespondInvitationEmail.tsx
|
|
19760
|
-
import { useState as
|
|
19431
|
+
import { useState as useState51, useEffect as useEffect37 } from "react";
|
|
19761
19432
|
import { useNavigate as useNavigate16, useSearchParams as useSearchParams4 } from "react-router-dom";
|
|
19762
19433
|
import { Building2 as Building212, User as UserIcon5, Mail as Mail8, CheckCircle as CheckCircle8, XCircle as XCircle3 } from "lucide-react";
|
|
19763
19434
|
import { jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
19764
19435
|
|
|
19765
19436
|
// src/pages/parameters/ProfitCostCenterPage.tsx
|
|
19766
|
-
import { useState as
|
|
19437
|
+
import { useState as useState52, useEffect as useEffect38 } from "react";
|
|
19767
19438
|
import { useNavigate as useNavigate17 } from "react-router-dom";
|
|
19768
19439
|
import {
|
|
19769
19440
|
Plus as Plus14,
|
|
19770
19441
|
Edit as Edit5,
|
|
19771
19442
|
Trash2 as Trash212
|
|
19772
19443
|
} from "lucide-react";
|
|
19773
|
-
import { Fragment as
|
|
19444
|
+
import { Fragment as Fragment16, jsx as jsx76, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
19774
19445
|
|
|
19775
19446
|
// src/pages/parameters/ParametersPage.tsx
|
|
19776
19447
|
import { useNavigate as useNavigate18 } from "react-router-dom";
|
|
@@ -19792,7 +19463,7 @@ import {
|
|
|
19792
19463
|
import { jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
19793
19464
|
|
|
19794
19465
|
// src/pages/users/UsersPage.tsx
|
|
19795
|
-
import { useState as
|
|
19466
|
+
import { useState as useState53, useEffect as useEffect39 } from "react";
|
|
19796
19467
|
import {
|
|
19797
19468
|
Users as Users12,
|
|
19798
19469
|
UserPlus as UserPlus3,
|
|
@@ -19812,15 +19483,15 @@ import {
|
|
|
19812
19483
|
Edit as Edit6,
|
|
19813
19484
|
Loader2 as Loader210
|
|
19814
19485
|
} from "lucide-react";
|
|
19815
|
-
import { Fragment as
|
|
19486
|
+
import { Fragment as Fragment17, jsx as jsx78, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
19816
19487
|
|
|
19817
19488
|
// src/pages/onboarding/OnboardingWizard.tsx
|
|
19818
|
-
import { useState as
|
|
19489
|
+
import { useState as useState57, useEffect as useEffect41 } from "react";
|
|
19819
19490
|
import { useNavigate as useNavigate19 } from "react-router-dom";
|
|
19820
19491
|
import { X as X18 } from "lucide-react";
|
|
19821
19492
|
|
|
19822
19493
|
// src/pages/onboarding/components/StepIndicator.tsx
|
|
19823
|
-
import
|
|
19494
|
+
import React47 from "react";
|
|
19824
19495
|
import { Check as Check7 } from "lucide-react";
|
|
19825
19496
|
import { jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
19826
19497
|
|
|
@@ -19829,17 +19500,17 @@ import { Building2 as Building215, Users as Users13, FileCheck as FileCheck2, Ar
|
|
|
19829
19500
|
import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
19830
19501
|
|
|
19831
19502
|
// src/pages/onboarding/steps/OrganizationStep.tsx
|
|
19832
|
-
import { useState as
|
|
19503
|
+
import { useState as useState54 } from "react";
|
|
19833
19504
|
import { Building2 as Building216, ArrowLeft as ArrowLeft4, ArrowRight as ArrowRight8, Loader2 as Loader211 } from "lucide-react";
|
|
19834
19505
|
import { jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
19835
19506
|
|
|
19836
19507
|
// src/pages/onboarding/steps/EntityStep.tsx
|
|
19837
|
-
import { useState as
|
|
19508
|
+
import { useState as useState55 } from "react";
|
|
19838
19509
|
import { Store, ArrowLeft as ArrowLeft5, ArrowRight as ArrowRight9, Loader2 as Loader212, MapPin as MapPin11 } from "lucide-react";
|
|
19839
|
-
import { Fragment as
|
|
19510
|
+
import { Fragment as Fragment18, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
19840
19511
|
|
|
19841
19512
|
// src/pages/onboarding/steps/ConfirmationStep.tsx
|
|
19842
|
-
import { useEffect as
|
|
19513
|
+
import { useEffect as useEffect40, useState as useState56 } from "react";
|
|
19843
19514
|
import { CheckCircle as CheckCircle10, Building2 as Building217, Store as Store2, ArrowRight as ArrowRight10, Sparkles as Sparkles3 } from "lucide-react";
|
|
19844
19515
|
import { jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
19845
19516
|
|
|
@@ -19847,7 +19518,7 @@ import { jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
|
19847
19518
|
import { jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
19848
19519
|
|
|
19849
19520
|
// src/pages/parameters/CrmParametersPage.tsx
|
|
19850
|
-
import { useState as
|
|
19521
|
+
import { useState as useState58, useEffect as useEffect42 } from "react";
|
|
19851
19522
|
import {
|
|
19852
19523
|
Plus as Plus16,
|
|
19853
19524
|
Edit as Edit7,
|
|
@@ -19861,14 +19532,14 @@ var OTHER_COST_URI = `${API_URL}/crm/other-costs/`;
|
|
|
19861
19532
|
var LEAD_NEED_URI = `${API_URL}/crm/lead-needs/`;
|
|
19862
19533
|
|
|
19863
19534
|
// src/pages/parameters/CrmParametersPage.tsx
|
|
19864
|
-
import { Fragment as
|
|
19535
|
+
import { Fragment as Fragment19, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
19865
19536
|
|
|
19866
19537
|
// src/pages/parameters/email-template-editor/EmailTemplateEditorPage.tsx
|
|
19867
|
-
import { useState as
|
|
19538
|
+
import { useState as useState64 } from "react";
|
|
19868
19539
|
import { useNavigate as useNavigate20 } from "react-router-dom";
|
|
19869
19540
|
|
|
19870
19541
|
// src/components/email-builder/EmailTemplateEditor.tsx
|
|
19871
|
-
import { useEffect as
|
|
19542
|
+
import { useEffect as useEffect45, useState as useState63 } from "react";
|
|
19872
19543
|
import { Eye as Eye11, Code as Code2, Pencil, Save as Save5, X as X19, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen } from "lucide-react";
|
|
19873
19544
|
|
|
19874
19545
|
// src/components/email-builder/editor/EditorContext.ts
|
|
@@ -20224,10 +19895,10 @@ function EditorBlockWrapper({ id, children }) {
|
|
|
20224
19895
|
}
|
|
20225
19896
|
|
|
20226
19897
|
// src/components/email-builder/blocks/EditorChildrenIds.tsx
|
|
20227
|
-
import
|
|
19898
|
+
import React54 from "react";
|
|
20228
19899
|
|
|
20229
19900
|
// src/components/email-builder/blocks/AddBlockMenu.tsx
|
|
20230
|
-
import { useState as
|
|
19901
|
+
import { useState as useState59, useRef as useRef9, useEffect as useEffect43 } from "react";
|
|
20231
19902
|
import {
|
|
20232
19903
|
Type,
|
|
20233
19904
|
AlignLeft,
|
|
@@ -20275,9 +19946,9 @@ function ColumnAddBlockMenu({ containerId, columnIndex, index }) {
|
|
|
20275
19946
|
);
|
|
20276
19947
|
}
|
|
20277
19948
|
function BlockMenuBase({ onAdd }) {
|
|
20278
|
-
const [open, setOpen] =
|
|
20279
|
-
const ref =
|
|
20280
|
-
|
|
19949
|
+
const [open, setOpen] = useState59(false);
|
|
19950
|
+
const ref = useRef9(null);
|
|
19951
|
+
useEffect43(() => {
|
|
20281
19952
|
if (!open) return;
|
|
20282
19953
|
const handler = (e) => {
|
|
20283
19954
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
@@ -20383,7 +20054,7 @@ import { jsx as jsx89, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
|
20383
20054
|
function EditorChildrenIds({ childrenIds, parentId }) {
|
|
20384
20055
|
return /* @__PURE__ */ jsxs83("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
20385
20056
|
/* @__PURE__ */ jsx89(AddBlockMenu, { parentId, index: 0 }),
|
|
20386
|
-
childrenIds.map((childId, idx) => /* @__PURE__ */ jsxs83(
|
|
20057
|
+
childrenIds.map((childId, idx) => /* @__PURE__ */ jsxs83(React54.Fragment, { children: [
|
|
20387
20058
|
/* @__PURE__ */ jsx89(EditorBlock, { id: childId }),
|
|
20388
20059
|
/* @__PURE__ */ jsx89(AddBlockMenu, { parentId, index: idx + 1 })
|
|
20389
20060
|
] }, childId))
|
|
@@ -20462,7 +20133,7 @@ function ContainerEditor({ id }) {
|
|
|
20462
20133
|
}
|
|
20463
20134
|
|
|
20464
20135
|
// src/components/email-builder/blocks/ColumnsContainerEditor.tsx
|
|
20465
|
-
import
|
|
20136
|
+
import React55, { useCallback as useCallback11, useRef as useRef10 } from "react";
|
|
20466
20137
|
import { jsx as jsx92, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
20467
20138
|
function ColumnsContainerEditor({ id }) {
|
|
20468
20139
|
const block = useEditorStore((s) => s.document[id]);
|
|
@@ -20475,8 +20146,8 @@ function ColumnsContainerEditor({ id }) {
|
|
|
20475
20146
|
const columns = props.columns ?? [{ childrenIds: [] }, { childrenIds: [] }, { childrenIds: [] }];
|
|
20476
20147
|
const gap = props.columnsGap ?? 16;
|
|
20477
20148
|
const columnWidths = props.columnWidths ?? Array(columnsCount).fill(Math.round(100 / columnsCount));
|
|
20478
|
-
const containerRef =
|
|
20479
|
-
const handleResize =
|
|
20149
|
+
const containerRef = useRef10(null);
|
|
20150
|
+
const handleResize = useCallback11((handleIndex, deltaPercent) => {
|
|
20480
20151
|
const newWidths = [...columnWidths];
|
|
20481
20152
|
const left = newWidths[handleIndex];
|
|
20482
20153
|
const right = newWidths[handleIndex + 1];
|
|
@@ -20509,7 +20180,7 @@ function ColumnsContainerEditor({ id }) {
|
|
|
20509
20180
|
gap,
|
|
20510
20181
|
position: "relative"
|
|
20511
20182
|
},
|
|
20512
|
-
children: columns.slice(0, columnsCount).map((col, idx) => /* @__PURE__ */ jsxs85(
|
|
20183
|
+
children: columns.slice(0, columnsCount).map((col, idx) => /* @__PURE__ */ jsxs85(React55.Fragment, { children: [
|
|
20513
20184
|
/* @__PURE__ */ jsx92(ColumnEditor, { containerId: id, columnIndex: idx, childrenIds: col.childrenIds ?? [] }),
|
|
20514
20185
|
idx < columnsCount - 1 && /* @__PURE__ */ jsx92(
|
|
20515
20186
|
ResizeHandle,
|
|
@@ -20535,9 +20206,9 @@ function ResizeHandle({
|
|
|
20535
20206
|
handleIndex,
|
|
20536
20207
|
onResize
|
|
20537
20208
|
}) {
|
|
20538
|
-
const dragging =
|
|
20539
|
-
const startX =
|
|
20540
|
-
const handleMouseDown =
|
|
20209
|
+
const dragging = useRef10(false);
|
|
20210
|
+
const startX = useRef10(0);
|
|
20211
|
+
const handleMouseDown = useCallback11((e) => {
|
|
20541
20212
|
e.preventDefault();
|
|
20542
20213
|
e.stopPropagation();
|
|
20543
20214
|
dragging.current = true;
|
|
@@ -20627,7 +20298,7 @@ function ColumnEditor({ containerId, columnIndex, childrenIds }) {
|
|
|
20627
20298
|
},
|
|
20628
20299
|
children: /* @__PURE__ */ jsxs85("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
20629
20300
|
/* @__PURE__ */ jsx92(ColumnAddBlockMenu, { containerId, columnIndex, index: 0 }),
|
|
20630
|
-
childrenIds.map((childId, idx) => /* @__PURE__ */ jsxs85(
|
|
20301
|
+
childrenIds.map((childId, idx) => /* @__PURE__ */ jsxs85(React55.Fragment, { children: [
|
|
20631
20302
|
/* @__PURE__ */ jsx92(EditorBlock, { id: childId }),
|
|
20632
20303
|
/* @__PURE__ */ jsx92(ColumnAddBlockMenu, { containerId, columnIndex, index: idx + 1 })
|
|
20633
20304
|
] }, childId)),
|
|
@@ -20845,13 +20516,13 @@ function paddingToStyle(padding) {
|
|
|
20845
20516
|
import { Settings as Settings5, Paintbrush } from "lucide-react";
|
|
20846
20517
|
|
|
20847
20518
|
// src/components/email-builder/sidebar/inputs/ColorInput.tsx
|
|
20848
|
-
import { useState as
|
|
20519
|
+
import { useState as useState60, useRef as useRef11, useEffect as useEffect44 } from "react";
|
|
20849
20520
|
import { HexColorPicker } from "react-colorful";
|
|
20850
20521
|
import { jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
20851
20522
|
function ColorInput({ label, value, onChange, nullable = true }) {
|
|
20852
|
-
const [open, setOpen] =
|
|
20853
|
-
const ref =
|
|
20854
|
-
|
|
20523
|
+
const [open, setOpen] = useState60(false);
|
|
20524
|
+
const ref = useRef11(null);
|
|
20525
|
+
useEffect44(() => {
|
|
20855
20526
|
if (!open) return;
|
|
20856
20527
|
const handler = (e) => {
|
|
20857
20528
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
@@ -21836,7 +21507,7 @@ function InspectorSidebar() {
|
|
|
21836
21507
|
}
|
|
21837
21508
|
|
|
21838
21509
|
// src/components/email-builder/variables/VariablePanel.tsx
|
|
21839
|
-
import { useState as
|
|
21510
|
+
import { useState as useState61 } from "react";
|
|
21840
21511
|
import { ChevronDown as ChevronDown8, ChevronRight as ChevronRight5, Variable } from "lucide-react";
|
|
21841
21512
|
|
|
21842
21513
|
// src/components/email-builder/variables/useVariableInsertion.ts
|
|
@@ -21885,7 +21556,7 @@ function useVariableInsertion() {
|
|
|
21885
21556
|
// src/components/email-builder/variables/VariablePanel.tsx
|
|
21886
21557
|
import { jsx as jsx115, jsxs as jsxs107 } from "react/jsx-runtime";
|
|
21887
21558
|
function VariablePanel({ categories: categories2 }) {
|
|
21888
|
-
const [expandedCategories, setExpandedCategories] =
|
|
21559
|
+
const [expandedCategories, setExpandedCategories] = useState61(new Set(categories2.map((c) => c.name)));
|
|
21889
21560
|
const { insertVariable } = useVariableInsertion();
|
|
21890
21561
|
const selectedBlockId = useEditorStore((s) => s.selectedBlockId);
|
|
21891
21562
|
const toggleCategory = (name) => {
|
|
@@ -21979,10 +21650,10 @@ function VariablePanel({ categories: categories2 }) {
|
|
|
21979
21650
|
}
|
|
21980
21651
|
|
|
21981
21652
|
// src/components/email-builder/TemplatePreview.tsx
|
|
21982
|
-
import { useMemo as
|
|
21653
|
+
import { useMemo as useMemo7 } from "react";
|
|
21983
21654
|
|
|
21984
21655
|
// src/components/email-builder/HtmlExportPanel.tsx
|
|
21985
|
-
import { useMemo as
|
|
21656
|
+
import { useMemo as useMemo6, useState as useState62 } from "react";
|
|
21986
21657
|
import { Copy as Copy3, Check as Check8 } from "lucide-react";
|
|
21987
21658
|
import { renderToStaticMarkup } from "@usewaypoint/email-builder";
|
|
21988
21659
|
import { jsx as jsx116, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
@@ -22038,8 +21709,8 @@ function exportToHtml(document2) {
|
|
|
22038
21709
|
}
|
|
22039
21710
|
function HtmlExportPanel() {
|
|
22040
21711
|
const editorDocument = useEditorStore((s) => s.document);
|
|
22041
|
-
const [copied, setCopied] =
|
|
22042
|
-
const html =
|
|
21712
|
+
const [copied, setCopied] = useState62(false);
|
|
21713
|
+
const html = useMemo6(() => {
|
|
22043
21714
|
try {
|
|
22044
21715
|
return exportToHtml(editorDocument);
|
|
22045
21716
|
} catch (err) {
|
|
@@ -22108,7 +21779,7 @@ import { jsx as jsx117 } from "react/jsx-runtime";
|
|
|
22108
21779
|
function TemplatePreview({ document: externalDoc }) {
|
|
22109
21780
|
const storeDoc = useEditorStore((s) => s.document);
|
|
22110
21781
|
const document2 = externalDoc ?? storeDoc;
|
|
22111
|
-
const html =
|
|
21782
|
+
const html = useMemo7(() => {
|
|
22112
21783
|
try {
|
|
22113
21784
|
return exportToHtml(document2);
|
|
22114
21785
|
} catch (err) {
|
|
@@ -22178,10 +21849,10 @@ function EmailTemplateEditor({
|
|
|
22178
21849
|
const selectedMainTab = useEditorStore((s) => s.selectedMainTab);
|
|
22179
21850
|
const setMainTab = useEditorStore((s) => s.setMainTab);
|
|
22180
21851
|
const selectBlock = useEditorStore((s) => s.selectBlock);
|
|
22181
|
-
const [showVariables, setShowVariables] =
|
|
22182
|
-
const [showInspector, setShowInspector] =
|
|
21852
|
+
const [showVariables, setShowVariables] = useState63(true);
|
|
21853
|
+
const [showInspector, setShowInspector] = useState63(true);
|
|
22183
21854
|
const categories2 = variables ?? DEFAULT_VARIABLE_CATEGORIES;
|
|
22184
|
-
|
|
21855
|
+
useEffect45(() => {
|
|
22185
21856
|
if (initialDocument) {
|
|
22186
21857
|
setDocument(initialDocument);
|
|
22187
21858
|
}
|
|
@@ -22337,7 +22008,7 @@ var toolbarBtnStyle = {
|
|
|
22337
22008
|
import { jsx as jsx119 } from "react/jsx-runtime";
|
|
22338
22009
|
|
|
22339
22010
|
// src/pages/organizations/EntitiesPage.tsx
|
|
22340
|
-
import { useState as
|
|
22011
|
+
import { useState as useState65 } from "react";
|
|
22341
22012
|
import {
|
|
22342
22013
|
Building2 as Building218,
|
|
22343
22014
|
Plus as Plus19,
|
|
@@ -22349,7 +22020,7 @@ import {
|
|
|
22349
22020
|
import { jsx as jsx120, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
22350
22021
|
|
|
22351
22022
|
// src/pages/workspaces/FixItNow.tsx
|
|
22352
|
-
import { useState as
|
|
22023
|
+
import { useState as useState68, useMemo as useMemo8, useEffect as useEffect49 } from "react";
|
|
22353
22024
|
|
|
22354
22025
|
// src/services/MaintenanceServices.ts
|
|
22355
22026
|
var UsersService = class {
|
|
@@ -22488,7 +22159,7 @@ var purchaseRequestService = new PurchaseRequestServiceExtended();
|
|
|
22488
22159
|
var maintenanceTicketsService = new MaintenanceTicketsService();
|
|
22489
22160
|
|
|
22490
22161
|
// src/hooks/usePaginatedData.ts
|
|
22491
|
-
import { useState as
|
|
22162
|
+
import { useState as useState66, useCallback as useCallback12, useEffect as useEffect47 } from "react";
|
|
22492
22163
|
function usePaginatedData({
|
|
22493
22164
|
endpoint,
|
|
22494
22165
|
initialItemsPerPage = 10,
|
|
@@ -22496,14 +22167,14 @@ function usePaginatedData({
|
|
|
22496
22167
|
queryKey,
|
|
22497
22168
|
enabled = true
|
|
22498
22169
|
}) {
|
|
22499
|
-
const [currentPage, setCurrentPage] =
|
|
22500
|
-
const [itemsPerPage, setItemsPerPage] =
|
|
22501
|
-
const [searchTerm, setSearchTerm] =
|
|
22502
|
-
const [filters, setFilters] =
|
|
22503
|
-
const [data, setData] =
|
|
22504
|
-
const [isLoading, setIsLoading] =
|
|
22505
|
-
const [error, setError] =
|
|
22506
|
-
const buildQueryParams =
|
|
22170
|
+
const [currentPage, setCurrentPage] = useState66(initialPage);
|
|
22171
|
+
const [itemsPerPage, setItemsPerPage] = useState66(initialItemsPerPage);
|
|
22172
|
+
const [searchTerm, setSearchTerm] = useState66("");
|
|
22173
|
+
const [filters, setFilters] = useState66({});
|
|
22174
|
+
const [data, setData] = useState66(null);
|
|
22175
|
+
const [isLoading, setIsLoading] = useState66(false);
|
|
22176
|
+
const [error, setError] = useState66(null);
|
|
22177
|
+
const buildQueryParams = useCallback12(() => {
|
|
22507
22178
|
const params = new URLSearchParams();
|
|
22508
22179
|
params.append("page", currentPage.toString());
|
|
22509
22180
|
params.append("page_size", itemsPerPage.toString());
|
|
@@ -22517,10 +22188,10 @@ function usePaginatedData({
|
|
|
22517
22188
|
});
|
|
22518
22189
|
return params.toString();
|
|
22519
22190
|
}, [currentPage, itemsPerPage, searchTerm, filters]);
|
|
22520
|
-
|
|
22191
|
+
useEffect47(() => {
|
|
22521
22192
|
setCurrentPage(1);
|
|
22522
22193
|
}, [searchTerm, filters, itemsPerPage]);
|
|
22523
|
-
const fetchData =
|
|
22194
|
+
const fetchData = useCallback12(async () => {
|
|
22524
22195
|
if (!enabled) return;
|
|
22525
22196
|
try {
|
|
22526
22197
|
setIsLoading(true);
|
|
@@ -22536,19 +22207,19 @@ function usePaginatedData({
|
|
|
22536
22207
|
setIsLoading(false);
|
|
22537
22208
|
}
|
|
22538
22209
|
}, [endpoint, buildQueryParams, enabled]);
|
|
22539
|
-
|
|
22210
|
+
useEffect47(() => {
|
|
22540
22211
|
fetchData();
|
|
22541
22212
|
}, [fetchData]);
|
|
22542
|
-
const refetch =
|
|
22213
|
+
const refetch = useCallback12(() => {
|
|
22543
22214
|
fetchData();
|
|
22544
22215
|
}, [fetchData]);
|
|
22545
|
-
const updateFilter =
|
|
22216
|
+
const updateFilter = useCallback12((key, value) => {
|
|
22546
22217
|
setFilters((prev) => ({
|
|
22547
22218
|
...prev,
|
|
22548
22219
|
[key]: value
|
|
22549
22220
|
}));
|
|
22550
22221
|
}, []);
|
|
22551
|
-
const clearFilters =
|
|
22222
|
+
const clearFilters = useCallback12(() => {
|
|
22552
22223
|
setFilters({});
|
|
22553
22224
|
setSearchTerm("");
|
|
22554
22225
|
}, []);
|
|
@@ -22581,7 +22252,7 @@ function usePaginatedData({
|
|
|
22581
22252
|
}
|
|
22582
22253
|
|
|
22583
22254
|
// src/components/common/PremiumComponents.tsx
|
|
22584
|
-
import { useState as
|
|
22255
|
+
import { useState as useState67, useEffect as useEffect48, useRef as useRef12 } from "react";
|
|
22585
22256
|
import { jsx as jsx121, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
22586
22257
|
var PremiumPageLayout2 = ({
|
|
22587
22258
|
title,
|
|
@@ -22743,9 +22414,9 @@ var SearchBar = ({
|
|
|
22743
22414
|
debounceMs = 300,
|
|
22744
22415
|
className = ""
|
|
22745
22416
|
}) => {
|
|
22746
|
-
const [localValue, setLocalValue] =
|
|
22747
|
-
const timeoutRef =
|
|
22748
|
-
|
|
22417
|
+
const [localValue, setLocalValue] = useState67(value);
|
|
22418
|
+
const timeoutRef = useRef12();
|
|
22419
|
+
useEffect48(() => {
|
|
22749
22420
|
setLocalValue(value);
|
|
22750
22421
|
}, [value]);
|
|
22751
22422
|
const handleChange = (e) => {
|
|
@@ -22938,9 +22609,9 @@ var ComprehensiveActionsDropdown = ({
|
|
|
22938
22609
|
additionalActions = [],
|
|
22939
22610
|
className = ""
|
|
22940
22611
|
}) => {
|
|
22941
|
-
const [isOpen, setIsOpen] =
|
|
22942
|
-
const dropdownRef =
|
|
22943
|
-
|
|
22612
|
+
const [isOpen, setIsOpen] = useState67(false);
|
|
22613
|
+
const dropdownRef = useRef12(null);
|
|
22614
|
+
useEffect48(() => {
|
|
22944
22615
|
const handleClickOutside = (event) => {
|
|
22945
22616
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
22946
22617
|
setIsOpen(false);
|
|
@@ -22993,7 +22664,7 @@ var MaintenanceTicketForm = ({
|
|
|
22993
22664
|
ticket,
|
|
22994
22665
|
onSave
|
|
22995
22666
|
}) => {
|
|
22996
|
-
const [formData, setFormData] =
|
|
22667
|
+
const [formData, setFormData] = useState67({
|
|
22997
22668
|
title: "",
|
|
22998
22669
|
description: "",
|
|
22999
22670
|
type: "corrective",
|
|
@@ -23001,7 +22672,7 @@ var MaintenanceTicketForm = ({
|
|
|
23001
22672
|
equipment_id: "",
|
|
23002
22673
|
notes: ""
|
|
23003
22674
|
});
|
|
23004
|
-
|
|
22675
|
+
useEffect48(() => {
|
|
23005
22676
|
if (ticket) {
|
|
23006
22677
|
setFormData({
|
|
23007
22678
|
title: ticket.title || "",
|
|
@@ -23220,7 +22891,7 @@ var MaintenanceTicketPrint = ({
|
|
|
23220
22891
|
};
|
|
23221
22892
|
|
|
23222
22893
|
// src/pages/workspaces/FixItNow.tsx
|
|
23223
|
-
import { Fragment as
|
|
22894
|
+
import { Fragment as Fragment20, jsx as jsx122, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
23224
22895
|
var API_FACILITY_URL = `${API_URL}/facility`;
|
|
23225
22896
|
var getTypeStatus = (type) => {
|
|
23226
22897
|
switch (type) {
|
|
@@ -23267,20 +22938,20 @@ var getPriorityStatus = (priority) => {
|
|
|
23267
22938
|
}
|
|
23268
22939
|
};
|
|
23269
22940
|
function FixitNow() {
|
|
23270
|
-
const [activeTab, setActiveTab] =
|
|
23271
|
-
const [viewMode, setViewMode] =
|
|
23272
|
-
const [selectedTicket, setSelectedTicket] =
|
|
23273
|
-
const [showCreateTicketForm, setShowCreateTicketForm] =
|
|
23274
|
-
const [showWorkOrderModal, setShowWorkOrderModal] =
|
|
23275
|
-
const [selectedTicketForWO, setSelectedTicketForWO] =
|
|
23276
|
-
const [showEditModal, setShowEditModal] =
|
|
23277
|
-
const [printTicket, setPrintTicket] =
|
|
23278
|
-
const [ticketToEdit, setTicketToEdit] =
|
|
23279
|
-
const [showAnalyticsModal, setShowAnalyticsModal] =
|
|
23280
|
-
const [showExportModal, setShowExportModal] =
|
|
23281
|
-
const [showPlanningModal, setShowPlanningModal] =
|
|
23282
|
-
const [detailsModalTab, setDetailsModalTab] =
|
|
23283
|
-
const [diagnosticForm, setDiagnosticForm] =
|
|
22941
|
+
const [activeTab, setActiveTab] = useState68("tickets");
|
|
22942
|
+
const [viewMode, setViewMode] = useState68("carte");
|
|
22943
|
+
const [selectedTicket, setSelectedTicket] = useState68(null);
|
|
22944
|
+
const [showCreateTicketForm, setShowCreateTicketForm] = useState68(false);
|
|
22945
|
+
const [showWorkOrderModal, setShowWorkOrderModal] = useState68(false);
|
|
22946
|
+
const [selectedTicketForWO, setSelectedTicketForWO] = useState68(null);
|
|
22947
|
+
const [showEditModal, setShowEditModal] = useState68(false);
|
|
22948
|
+
const [printTicket, setPrintTicket] = useState68(null);
|
|
22949
|
+
const [ticketToEdit, setTicketToEdit] = useState68(null);
|
|
22950
|
+
const [showAnalyticsModal, setShowAnalyticsModal] = useState68(false);
|
|
22951
|
+
const [showExportModal, setShowExportModal] = useState68(false);
|
|
22952
|
+
const [showPlanningModal, setShowPlanningModal] = useState68(false);
|
|
22953
|
+
const [detailsModalTab, setDetailsModalTab] = useState68("details");
|
|
22954
|
+
const [diagnosticForm, setDiagnosticForm] = useState68({
|
|
23284
22955
|
symptoms_observed: "",
|
|
23285
22956
|
failure_description: "",
|
|
23286
22957
|
measurements: {},
|
|
@@ -23295,22 +22966,22 @@ function FixitNow() {
|
|
|
23295
22966
|
notes: "",
|
|
23296
22967
|
recommendations: ""
|
|
23297
22968
|
});
|
|
23298
|
-
const [users, setUsers] =
|
|
23299
|
-
const [technicians, setTechnicians] =
|
|
23300
|
-
const [ticketsWithDiagnostics, setTicketsWithDiagnostics] =
|
|
23301
|
-
const [existingDiagnostic, setExistingDiagnostic] =
|
|
23302
|
-
const [workOrderForm, setWorkOrderForm] =
|
|
22969
|
+
const [users, setUsers] = useState68([]);
|
|
22970
|
+
const [technicians, setTechnicians] = useState68([]);
|
|
22971
|
+
const [ticketsWithDiagnostics, setTicketsWithDiagnostics] = useState68(/* @__PURE__ */ new Set());
|
|
22972
|
+
const [existingDiagnostic, setExistingDiagnostic] = useState68(null);
|
|
22973
|
+
const [workOrderForm, setWorkOrderForm] = useState68({
|
|
23303
22974
|
title: "",
|
|
23304
22975
|
scheduled_start: "",
|
|
23305
22976
|
scheduled_end: "",
|
|
23306
22977
|
estimated_hours: 1,
|
|
23307
22978
|
notes: ""
|
|
23308
22979
|
});
|
|
23309
|
-
const [workOrders, setWorkOrders] =
|
|
23310
|
-
const [isLoadingWorkOrders, setIsLoadingWorkOrders] =
|
|
23311
|
-
const [hasProcurementModule, setHasProcurementModule] =
|
|
23312
|
-
const [purchaseRequestFile, setPurchaseRequestFile] =
|
|
23313
|
-
|
|
22980
|
+
const [workOrders, setWorkOrders] = useState68([]);
|
|
22981
|
+
const [isLoadingWorkOrders, setIsLoadingWorkOrders] = useState68(false);
|
|
22982
|
+
const [hasProcurementModule, setHasProcurementModule] = useState68(null);
|
|
22983
|
+
const [purchaseRequestFile, setPurchaseRequestFile] = useState68(null);
|
|
22984
|
+
useEffect49(() => {
|
|
23314
22985
|
const fetchUsers = async () => {
|
|
23315
22986
|
try {
|
|
23316
22987
|
const response = await usersService.getCoreUsers({ is_active: true, page_size: 100 });
|
|
@@ -23326,7 +22997,7 @@ function FixitNow() {
|
|
|
23326
22997
|
};
|
|
23327
22998
|
fetchUsers();
|
|
23328
22999
|
}, []);
|
|
23329
|
-
|
|
23000
|
+
useEffect49(() => {
|
|
23330
23001
|
const checkProcurementModule = async () => {
|
|
23331
23002
|
try {
|
|
23332
23003
|
const hasModule = await usersService.hasModule("procurement");
|
|
@@ -23401,12 +23072,12 @@ function FixitNow() {
|
|
|
23401
23072
|
console.error("\u274C Erreur lors du chargement des diagnostics:", error);
|
|
23402
23073
|
}
|
|
23403
23074
|
};
|
|
23404
|
-
|
|
23075
|
+
useEffect49(() => {
|
|
23405
23076
|
if (tickets.length > 0) {
|
|
23406
23077
|
loadDiagnostics();
|
|
23407
23078
|
}
|
|
23408
23079
|
}, [tickets]);
|
|
23409
|
-
|
|
23080
|
+
useEffect49(() => {
|
|
23410
23081
|
console.log("\u{1F504} [DEBUG] useEffect d\xE9clench\xE9 - selectedTicket:", selectedTicket?.id, "detailsModalTab:", detailsModalTab);
|
|
23411
23082
|
const loadExistingDiagnostic = async () => {
|
|
23412
23083
|
if (selectedTicket && detailsModalTab === "diagnostic") {
|
|
@@ -23533,12 +23204,12 @@ function FixitNow() {
|
|
|
23533
23204
|
setIsLoadingWorkOrders(false);
|
|
23534
23205
|
}
|
|
23535
23206
|
};
|
|
23536
|
-
|
|
23207
|
+
useEffect49(() => {
|
|
23537
23208
|
loadUsers().catch((err) => {
|
|
23538
23209
|
console.error("\u{1F465} \u274C Error in useEffect calling loadUsers:", err);
|
|
23539
23210
|
});
|
|
23540
23211
|
}, []);
|
|
23541
|
-
|
|
23212
|
+
useEffect49(() => {
|
|
23542
23213
|
if (activeTab === "workorders") {
|
|
23543
23214
|
loadWorkOrders();
|
|
23544
23215
|
}
|
|
@@ -23554,7 +23225,7 @@ function FixitNow() {
|
|
|
23554
23225
|
};
|
|
23555
23226
|
const filteredTickets = tickets;
|
|
23556
23227
|
const displayTickets = tickets;
|
|
23557
|
-
const stats =
|
|
23228
|
+
const stats = useMemo8(() => {
|
|
23558
23229
|
return {
|
|
23559
23230
|
totalTickets: pagination.count,
|
|
23560
23231
|
openTickets: tickets.filter((t) => t.status === "open").length,
|
|
@@ -23839,7 +23510,7 @@ ${purchaseError?.message || "Erreur inconnue"}`);
|
|
|
23839
23510
|
}
|
|
23840
23511
|
)
|
|
23841
23512
|
] }) }),
|
|
23842
|
-
!ticketsError && viewMode === "carte" && /* @__PURE__ */ jsxs112(
|
|
23513
|
+
!ticketsError && viewMode === "carte" && /* @__PURE__ */ jsxs112(Fragment20, { children: [
|
|
23843
23514
|
/* @__PURE__ */ jsx122(PremiumCard2, { title: `\u{1F3AF} Tickets de Maintenance (${pagination.count})`, style: { backgroundColor: "#F0F3F2", borderColor: "rgba(106,138,130,0.2)" }, children: /* @__PURE__ */ jsx122("div", { className: "space-y-3", style: { fontFamily: "'Sometype Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace" }, children: isLoadingTickets ? /* @__PURE__ */ jsx122("div", { className: "text-center py-6", style: { fontFamily: "'Sometype Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace" }, children: /* @__PURE__ */ jsx122("div", { className: "text-[14px] font-semibold text-[#6A8A82]", style: { fontFamily: "'Sometype Mono', monospace" }, children: "\u{1F504} Chargement..." }) }) : displayTickets.length === 0 ? /* @__PURE__ */ jsxs112("div", { className: "text-center py-8", style: { fontFamily: "'Sometype Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace" }, children: [
|
|
23844
23515
|
/* @__PURE__ */ jsx122("div", { className: "text-5xl mb-3", children: "\u{1F4CB}" }),
|
|
23845
23516
|
/* @__PURE__ */ jsx122("div", { className: "text-[14px] font-semibold mb-2", style: { color: "#191919" }, children: "Aucun ticket trouv\xE9" }),
|
|
@@ -23975,7 +23646,7 @@ ${purchaseError?.message || "Erreur inconnue"}`);
|
|
|
23975
23646
|
}
|
|
23976
23647
|
) })
|
|
23977
23648
|
] }),
|
|
23978
|
-
!ticketsError && viewMode === "liste" && /* @__PURE__ */ jsxs112(
|
|
23649
|
+
!ticketsError && viewMode === "liste" && /* @__PURE__ */ jsxs112(Fragment20, { children: [
|
|
23979
23650
|
/* @__PURE__ */ jsx122(
|
|
23980
23651
|
PremiumCard2,
|
|
23981
23652
|
{
|
|
@@ -24120,7 +23791,7 @@ ${purchaseError?.message || "Erreur inconnue"}`);
|
|
|
24120
23791
|
}
|
|
24121
23792
|
) })
|
|
24122
23793
|
] }),
|
|
24123
|
-
!ticketsError && viewMode === "kanban" && /* @__PURE__ */ jsxs112(
|
|
23794
|
+
!ticketsError && viewMode === "kanban" && /* @__PURE__ */ jsxs112(Fragment20, { children: [
|
|
24124
23795
|
/* @__PURE__ */ jsx122(PremiumCard2, { title: `\u{1F504} Vue Kanban (${pagination.count})`, style: { backgroundColor: "#F0F3F2", borderColor: "rgba(106,138,130,0.2)" }, children: /* @__PURE__ */ jsx122("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-3", style: { fontFamily: "'Sometype Mono', monospace" }, children: [
|
|
24125
23796
|
{ status: "open", label: "Ouverts", color: "#B87333", icon: "\u{1F513}" },
|
|
24126
23797
|
{ status: "assigned", label: "Assign\xE9s", color: "#6A8A82", icon: "\u{1F464}" },
|
|
@@ -24936,7 +24607,7 @@ ${purchaseError?.message || "Erreur inconnue"}`);
|
|
|
24936
24607
|
" ",
|
|
24937
24608
|
existingDiagnostic.external_da_reference
|
|
24938
24609
|
] }) })
|
|
24939
|
-
] }) : /* @__PURE__ */ jsxs112(
|
|
24610
|
+
] }) : /* @__PURE__ */ jsxs112(Fragment20, { children: [
|
|
24940
24611
|
/* @__PURE__ */ jsx122("div", { className: "bg-amber-50 border border-amber-200 rounded-lg p-4", children: /* @__PURE__ */ jsxs112("div", { className: "flex items-start", children: [
|
|
24941
24612
|
/* @__PURE__ */ jsx122("svg", { className: "w-5 h-5 text-amber-600 mt-0.5 mr-3 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx122("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
24942
24613
|
/* @__PURE__ */ jsxs112("div", { children: [
|
|
@@ -25349,7 +25020,8 @@ var WorkSpaceRoutes = ({ module_name = "Rewise", module_id = "core", module_desc
|
|
|
25349
25020
|
{ id: "car", label: "CAR", path: "budget/car", icon: /* @__PURE__ */ jsx123(Eye12, { className: "w-4 h-4" }) }
|
|
25350
25021
|
]
|
|
25351
25022
|
};
|
|
25352
|
-
|
|
25023
|
+
const queryClient = new QueryClient();
|
|
25024
|
+
return /* @__PURE__ */ jsx123(ModernDoubleSidebarLayout_default, { module_name, module_description, primaryMenuItems, secondaryMenuItems, children: /* @__PURE__ */ jsx123(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxs113(Routes, { children: [
|
|
25353
25025
|
/* @__PURE__ */ jsx123(Route, { path: "", element: /* @__PURE__ */ jsx123(WorkSpace_default, { module: module_id }) }),
|
|
25354
25026
|
/* @__PURE__ */ jsx123(Route, { path: "task-pilot", element: /* @__PURE__ */ jsx123(TaskPilot_default, {}) }),
|
|
25355
25027
|
/* @__PURE__ */ jsx123(Route, { path: "proculink", element: /* @__PURE__ */ jsx123(PurchaseRequestsPage, {}) }),
|
|
@@ -25360,11 +25032,11 @@ var WorkSpaceRoutes = ({ module_name = "Rewise", module_id = "core", module_desc
|
|
|
25360
25032
|
/* @__PURE__ */ jsx123(Route, { path: "actifs", element: /* @__PURE__ */ jsx123(ActifsPage_default, {}) }),
|
|
25361
25033
|
/* @__PURE__ */ jsx123(Route, { path: "planning", element: /* @__PURE__ */ jsx123(PlanningPage_default, {}) }),
|
|
25362
25034
|
/* @__PURE__ */ jsx123(Route, { path: "fix-it-now", element: /* @__PURE__ */ jsx123(FixitNow, {}) })
|
|
25363
|
-
] }) });
|
|
25035
|
+
] }) }) });
|
|
25364
25036
|
};
|
|
25365
25037
|
|
|
25366
25038
|
// src/components/contracts/ContractsPage.tsx
|
|
25367
|
-
import
|
|
25039
|
+
import React69, { useState as useState76, useEffect as useEffect54, useMemo as useMemo11 } from "react";
|
|
25368
25040
|
import {
|
|
25369
25041
|
FileSignature,
|
|
25370
25042
|
Plus as Plus22,
|
|
@@ -25398,7 +25070,7 @@ import {
|
|
|
25398
25070
|
} from "lucide-react";
|
|
25399
25071
|
|
|
25400
25072
|
// src/components/contracts/components/SLAIndicatorForm.tsx
|
|
25401
|
-
import { useState as
|
|
25073
|
+
import { useState as useState69, useEffect as useEffect50 } from "react";
|
|
25402
25074
|
|
|
25403
25075
|
// src/components/contracts/types.ts
|
|
25404
25076
|
var FM_SERVICE_LABELS = {
|
|
@@ -26189,7 +25861,7 @@ var SLAIndicatorForm = ({
|
|
|
26189
25861
|
}) => {
|
|
26190
25862
|
const { theme } = useTheme();
|
|
26191
25863
|
const colors = theme.colors;
|
|
26192
|
-
const [formData, setFormData] =
|
|
25864
|
+
const [formData, setFormData] = useState69(() => {
|
|
26193
25865
|
if (indicator) {
|
|
26194
25866
|
return {
|
|
26195
25867
|
name: indicator.name || "",
|
|
@@ -26210,10 +25882,10 @@ var SLAIndicatorForm = ({
|
|
|
26210
25882
|
}
|
|
26211
25883
|
return initialFormData;
|
|
26212
25884
|
});
|
|
26213
|
-
const [errors, setErrors] =
|
|
26214
|
-
const [showPenalties, setShowPenalties] =
|
|
26215
|
-
const [showBonus, setShowBonus] =
|
|
26216
|
-
|
|
25885
|
+
const [errors, setErrors] = useState69({});
|
|
25886
|
+
const [showPenalties, setShowPenalties] = useState69(!!indicator?.penalty_type);
|
|
25887
|
+
const [showBonus, setShowBonus] = useState69(!!indicator?.bonus_type);
|
|
25888
|
+
useEffect50(() => {
|
|
26217
25889
|
if (indicator) {
|
|
26218
25890
|
setFormData({
|
|
26219
25891
|
name: indicator.name || "",
|
|
@@ -26585,10 +26257,10 @@ var SLAIndicatorForm = ({
|
|
|
26585
26257
|
};
|
|
26586
26258
|
|
|
26587
26259
|
// src/components/contracts/ContractModal.tsx
|
|
26588
|
-
import { useState as
|
|
26260
|
+
import { useState as useState72, useEffect as useEffect53 } from "react";
|
|
26589
26261
|
|
|
26590
26262
|
// src/components/contracts/ViewContractContent.tsx
|
|
26591
|
-
import { useState as
|
|
26263
|
+
import { useState as useState70, useMemo as useMemo9, useEffect as useEffect51 } from "react";
|
|
26592
26264
|
import {
|
|
26593
26265
|
FileText as FileText19,
|
|
26594
26266
|
Building2 as Building220,
|
|
@@ -26713,7 +26385,7 @@ var SLAEvaluationSessionServices = {
|
|
|
26713
26385
|
};
|
|
26714
26386
|
|
|
26715
26387
|
// src/components/contracts/ViewContractContent.tsx
|
|
26716
|
-
import { Fragment as
|
|
26388
|
+
import { Fragment as Fragment21, jsx as jsx125, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
26717
26389
|
var Button = ({ children, onClick, variant = "default", size = "md", className = "", disabled = false }) => {
|
|
26718
26390
|
const baseStyles = "inline-flex items-center justify-center font-medium rounded-lg transition-colors disabled:opacity-50";
|
|
26719
26391
|
const variantStyles2 = {
|
|
@@ -26845,12 +26517,12 @@ var ViewContractContent = ({
|
|
|
26845
26517
|
onOpenSLA,
|
|
26846
26518
|
onOpenEvaluation
|
|
26847
26519
|
}) => {
|
|
26848
|
-
const [activeTab, setActiveTab] =
|
|
26849
|
-
const [evaluationSessions, setEvaluationSessions] =
|
|
26850
|
-
const [sessionsLoading, setSessionsLoading] =
|
|
26851
|
-
const [expandedSession, setExpandedSession] =
|
|
26852
|
-
const [selectedSession, setSelectedSession] =
|
|
26853
|
-
|
|
26520
|
+
const [activeTab, setActiveTab] = useState70("general");
|
|
26521
|
+
const [evaluationSessions, setEvaluationSessions] = useState70([]);
|
|
26522
|
+
const [sessionsLoading, setSessionsLoading] = useState70(false);
|
|
26523
|
+
const [expandedSession, setExpandedSession] = useState70(null);
|
|
26524
|
+
const [selectedSession, setSelectedSession] = useState70(null);
|
|
26525
|
+
useEffect51(() => {
|
|
26854
26526
|
const loadEvaluationSessions = async () => {
|
|
26855
26527
|
if (!contract?.id || activeTab !== "evaluations") return;
|
|
26856
26528
|
setSessionsLoading(true);
|
|
@@ -26867,7 +26539,7 @@ var ViewContractContent = ({
|
|
|
26867
26539
|
};
|
|
26868
26540
|
loadEvaluationSessions();
|
|
26869
26541
|
}, [contract?.id, activeTab]);
|
|
26870
|
-
const contractProgress =
|
|
26542
|
+
const contractProgress = useMemo9(() => {
|
|
26871
26543
|
if (!contract) return 0;
|
|
26872
26544
|
const start = new Date(contract.start_date).getTime();
|
|
26873
26545
|
const end = new Date(contract.end_date).getTime();
|
|
@@ -26875,7 +26547,7 @@ var ViewContractContent = ({
|
|
|
26875
26547
|
const progress = Math.max(0, Math.min(100, (now - start) / (end - start) * 100));
|
|
26876
26548
|
return Math.round(progress);
|
|
26877
26549
|
}, [contract]);
|
|
26878
|
-
const financialMetrics =
|
|
26550
|
+
const financialMetrics = useMemo9(() => {
|
|
26879
26551
|
if (!contract) return { totalValue: 0, currency: "EUR", totalPaid: 0, percentPaid: 0, remaining: 0 };
|
|
26880
26552
|
const totalValue = contract.financialTerms?.totalValue || contract.amount || 0;
|
|
26881
26553
|
const currency = contract.financialTerms?.currency || contract.currency || "EUR";
|
|
@@ -27527,7 +27199,7 @@ var ViewContractContent = ({
|
|
|
27527
27199
|
] })
|
|
27528
27200
|
] })
|
|
27529
27201
|
] });
|
|
27530
|
-
const renderPriceScheduleTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.priceSchedule && contract.priceSchedule.length > 0 ? /* @__PURE__ */ jsxs115(
|
|
27202
|
+
const renderPriceScheduleTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.priceSchedule && contract.priceSchedule.length > 0 ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
27531
27203
|
/* @__PURE__ */ jsxs115("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4", children: [
|
|
27532
27204
|
/* @__PURE__ */ jsxs115(RewiseCard, { className: "p-4 bg-gradient-to-br from-blue-50 to-blue-100", children: [
|
|
27533
27205
|
/* @__PURE__ */ jsx125("p", { className: "text-sm text-blue-600 font-medium", children: "Nombre d'articles" }),
|
|
@@ -27640,7 +27312,7 @@ var ViewContractContent = ({
|
|
|
27640
27312
|
/* @__PURE__ */ jsx125("h3", { className: "text-lg font-medium text-gray-900 mb-2", children: "Aucun bordereau des prix" }),
|
|
27641
27313
|
/* @__PURE__ */ jsx125("p", { className: "text-gray-500 max-w-md mx-auto", children: "Ce contrat n'a pas de bordereau des prix d\xE9fini. Le bordereau des prix est g\xE9n\xE9ralement utilis\xE9 pour les contrats-cadre afin de lister les prix unitaires n\xE9goci\xE9s." })
|
|
27642
27314
|
] }) });
|
|
27643
|
-
const renderLogisticsTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.incoterm ? /* @__PURE__ */ jsxs115(
|
|
27315
|
+
const renderLogisticsTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.incoterm ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
27644
27316
|
/* @__PURE__ */ jsxs115(RewiseCard, { className: "p-6", children: [
|
|
27645
27317
|
/* @__PURE__ */ jsxs115("h3", { className: "text-lg font-semibold text-gray-900 mb-4 flex items-center", children: [
|
|
27646
27318
|
/* @__PURE__ */ jsx125(Globe3, { className: "w-5 h-5 mr-2" }),
|
|
@@ -27663,12 +27335,12 @@ var ViewContractContent = ({
|
|
|
27663
27335
|
/* @__PURE__ */ jsxs115("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
27664
27336
|
/* @__PURE__ */ jsxs115("div", { className: "bg-orange-50 rounded-lg p-3", children: [
|
|
27665
27337
|
/* @__PURE__ */ jsx125("p", { className: "text-xs text-orange-600 font-medium mb-1", children: "Vendeur" }),
|
|
27666
|
-
/* @__PURE__ */ jsx125("ul", { className: "text-sm text-orange-900 space-y-1", children: ["EXW"].includes(contract.incoterm) ? /* @__PURE__ */ jsx125("li", { children: "\u2022 Mise \xE0 disposition \xE0 l'usine" }) : ["DDP", "DAP", "DPU"].includes(contract.incoterm) ? /* @__PURE__ */ jsxs115(
|
|
27338
|
+
/* @__PURE__ */ jsx125("ul", { className: "text-sm text-orange-900 space-y-1", children: ["EXW"].includes(contract.incoterm) ? /* @__PURE__ */ jsx125("li", { children: "\u2022 Mise \xE0 disposition \xE0 l'usine" }) : ["DDP", "DAP", "DPU"].includes(contract.incoterm) ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
27667
27339
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Transport principal" }),
|
|
27668
27340
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Assurance transport" }),
|
|
27669
27341
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Formalit\xE9s douani\xE8res" }),
|
|
27670
27342
|
contract.incoterm === "DDP" && /* @__PURE__ */ jsx125("li", { children: "\u2022 Droits et taxes" })
|
|
27671
|
-
] }) : /* @__PURE__ */ jsxs115(
|
|
27343
|
+
] }) : /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
27672
27344
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Emballage et marquage" }),
|
|
27673
27345
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Formalit\xE9s export" }),
|
|
27674
27346
|
["CIF", "CIP"].includes(contract.incoterm) && /* @__PURE__ */ jsx125("li", { children: "\u2022 Assurance transport" })
|
|
@@ -27676,12 +27348,12 @@ var ViewContractContent = ({
|
|
|
27676
27348
|
] }),
|
|
27677
27349
|
/* @__PURE__ */ jsxs115("div", { className: "bg-blue-50 rounded-lg p-3", children: [
|
|
27678
27350
|
/* @__PURE__ */ jsx125("p", { className: "text-xs text-blue-600 font-medium mb-1", children: "Acheteur" }),
|
|
27679
|
-
/* @__PURE__ */ jsx125("ul", { className: "text-sm text-blue-900 space-y-1", children: ["EXW"].includes(contract.incoterm) ? /* @__PURE__ */ jsxs115(
|
|
27351
|
+
/* @__PURE__ */ jsx125("ul", { className: "text-sm text-blue-900 space-y-1", children: ["EXW"].includes(contract.incoterm) ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
27680
27352
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Transport complet" }),
|
|
27681
27353
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Assurance" }),
|
|
27682
27354
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Formalit\xE9s douani\xE8res" }),
|
|
27683
27355
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Droits et taxes" })
|
|
27684
|
-
] }) : ["DDP"].includes(contract.incoterm) ? /* @__PURE__ */ jsx125("li", { children: "\u2022 D\xE9chargement (selon accord)" }) : /* @__PURE__ */ jsxs115(
|
|
27356
|
+
] }) : ["DDP"].includes(contract.incoterm) ? /* @__PURE__ */ jsx125("li", { children: "\u2022 D\xE9chargement (selon accord)" }) : /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
27685
27357
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Formalit\xE9s import" }),
|
|
27686
27358
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Transport final" }),
|
|
27687
27359
|
/* @__PURE__ */ jsx125("li", { children: "\u2022 Droits et taxes import" })
|
|
@@ -28045,7 +27717,7 @@ var ViewContractContent = ({
|
|
|
28045
27717
|
] }, risk.id)) })
|
|
28046
27718
|
] })
|
|
28047
27719
|
] });
|
|
28048
|
-
const renderESGTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.esgCriteria ? /* @__PURE__ */ jsxs115(
|
|
27720
|
+
const renderESGTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.esgCriteria ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
28049
27721
|
/* @__PURE__ */ jsxs115("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4", children: [
|
|
28050
27722
|
/* @__PURE__ */ jsxs115(RewiseCard, { className: "p-4 bg-gradient-to-br from-green-50 to-green-100", children: [
|
|
28051
27723
|
/* @__PURE__ */ jsx125("p", { className: "text-sm text-green-600 font-medium", children: "Score ESG global" }),
|
|
@@ -28183,7 +27855,7 @@ var ViewContractContent = ({
|
|
|
28183
27855
|
/* @__PURE__ */ jsx125("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: "Crit\xE8res ESG non d\xE9finis" }),
|
|
28184
27856
|
/* @__PURE__ */ jsx125("p", { className: "text-gray-500", children: "Les crit\xE8res environnementaux, sociaux et de gouvernance n'ont pas \xE9t\xE9 \xE9valu\xE9s pour ce contrat." })
|
|
28185
27857
|
] }) });
|
|
28186
|
-
const renderObligationsTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.obligations && contract.obligations.length > 0 ? /* @__PURE__ */ jsxs115(
|
|
27858
|
+
const renderObligationsTab = () => /* @__PURE__ */ jsx125("div", { className: "space-y-6", children: contract.obligations && contract.obligations.length > 0 ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
28187
27859
|
/* @__PURE__ */ jsxs115("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4", children: [
|
|
28188
27860
|
/* @__PURE__ */ jsxs115(RewiseCard, { className: "p-4", children: [
|
|
28189
27861
|
/* @__PURE__ */ jsx125("p", { className: "text-sm text-gray-500", children: "Total obligations" }),
|
|
@@ -28222,7 +27894,7 @@ var ViewContractContent = ({
|
|
|
28222
27894
|
"Fr\xE9quence: ",
|
|
28223
27895
|
obligation.frequency === "one_time" ? "Unique" : obligation.frequency === "daily" ? "Quotidien" : obligation.frequency === "weekly" ? "Hebdomadaire" : obligation.frequency === "monthly" ? "Mensuel" : obligation.frequency === "quarterly" ? "Trimestriel" : obligation.frequency === "annually" ? "Annuel" : "Sur demande"
|
|
28224
27896
|
] }),
|
|
28225
|
-
obligation.dueDate && /* @__PURE__ */ jsxs115(
|
|
27897
|
+
obligation.dueDate && /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
28226
27898
|
/* @__PURE__ */ jsx125("span", { children: "\u2022" }),
|
|
28227
27899
|
/* @__PURE__ */ jsxs115("span", { children: [
|
|
28228
27900
|
"\xC9ch\xE9ance: ",
|
|
@@ -28487,7 +28159,7 @@ var ViewContractContent = ({
|
|
|
28487
28159
|
] })
|
|
28488
28160
|
] });
|
|
28489
28161
|
const renderDocumentsTab = () => /* @__PURE__ */ jsxs115("div", { className: "space-y-4", children: [
|
|
28490
|
-
contract.documents && contract.documents.length > 0 ? /* @__PURE__ */ jsxs115(
|
|
28162
|
+
contract.documents && contract.documents.length > 0 ? /* @__PURE__ */ jsxs115(Fragment21, { children: [
|
|
28491
28163
|
/* @__PURE__ */ jsx125("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs115("h3", { className: "text-lg font-semibold text-gray-900", children: [
|
|
28492
28164
|
"Documents contractuels (",
|
|
28493
28165
|
contract.documents.length,
|
|
@@ -28701,7 +28373,7 @@ var ViewContractContent = ({
|
|
|
28701
28373
|
};
|
|
28702
28374
|
|
|
28703
28375
|
// src/components/contracts/ContractForm.tsx
|
|
28704
|
-
import { useState as
|
|
28376
|
+
import { useState as useState71, useEffect as useEffect52 } from "react";
|
|
28705
28377
|
import {
|
|
28706
28378
|
Building2 as Building221,
|
|
28707
28379
|
User as User4,
|
|
@@ -28730,7 +28402,7 @@ import {
|
|
|
28730
28402
|
Truck as Truck3,
|
|
28731
28403
|
ClipboardCheck as ClipboardCheck3
|
|
28732
28404
|
} from "lucide-react";
|
|
28733
|
-
import { Fragment as
|
|
28405
|
+
import { Fragment as Fragment22, jsx as jsx126, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
28734
28406
|
var initialFormData2 = {
|
|
28735
28407
|
number: "",
|
|
28736
28408
|
title: "",
|
|
@@ -28777,7 +28449,7 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
28777
28449
|
const { activeBusinessEntity } = useSession();
|
|
28778
28450
|
const { theme } = useTheme();
|
|
28779
28451
|
const colors = theme.colors;
|
|
28780
|
-
const [formData, setFormData] =
|
|
28452
|
+
const [formData, setFormData] = useState71(() => {
|
|
28781
28453
|
if (contract) {
|
|
28782
28454
|
return {
|
|
28783
28455
|
...contract
|
|
@@ -28785,7 +28457,7 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
28785
28457
|
}
|
|
28786
28458
|
return initialFormData2;
|
|
28787
28459
|
});
|
|
28788
|
-
|
|
28460
|
+
useEffect52(() => {
|
|
28789
28461
|
if (contract) {
|
|
28790
28462
|
setFormData({ ...contract });
|
|
28791
28463
|
} else {
|
|
@@ -28794,20 +28466,20 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
28794
28466
|
}, [contract]);
|
|
28795
28467
|
console.log("formData", formData);
|
|
28796
28468
|
console.log("contract prop", contract);
|
|
28797
|
-
const [activeTab, setActiveTab] =
|
|
28798
|
-
const [errors, setErrors] =
|
|
28799
|
-
const [isSubmitting, setIsSubmitting] =
|
|
28800
|
-
const [editingPriceItem, setEditingPriceItem] =
|
|
28801
|
-
const [showSLAForm, setShowSLAForm] =
|
|
28802
|
-
const [editingSLAId, setEditingSLAId] =
|
|
28803
|
-
const [selectedFMService, setSelectedFMService] =
|
|
28804
|
-
const [fmSites, setFmSites] =
|
|
28805
|
-
const [showSiteForm, setShowSiteForm] =
|
|
28806
|
-
const [editingSite, setEditingSite] =
|
|
28807
|
-
const [showPriceForm, setShowPriceForm] =
|
|
28808
|
-
const [showPriceScheduleForm, setShowPriceScheduleForm] =
|
|
28809
|
-
const [editingPriceScheduleId, setEditingPriceScheduleId] =
|
|
28810
|
-
const [priceScheduleFormData, setPriceScheduleFormData] =
|
|
28469
|
+
const [activeTab, setActiveTab] = useState71("general");
|
|
28470
|
+
const [errors, setErrors] = useState71({});
|
|
28471
|
+
const [isSubmitting, setIsSubmitting] = useState71(false);
|
|
28472
|
+
const [editingPriceItem, setEditingPriceItem] = useState71(null);
|
|
28473
|
+
const [showSLAForm, setShowSLAForm] = useState71(false);
|
|
28474
|
+
const [editingSLAId, setEditingSLAId] = useState71(null);
|
|
28475
|
+
const [selectedFMService, setSelectedFMService] = useState71("");
|
|
28476
|
+
const [fmSites, setFmSites] = useState71([]);
|
|
28477
|
+
const [showSiteForm, setShowSiteForm] = useState71(false);
|
|
28478
|
+
const [editingSite, setEditingSite] = useState71(null);
|
|
28479
|
+
const [showPriceForm, setShowPriceForm] = useState71(false);
|
|
28480
|
+
const [showPriceScheduleForm, setShowPriceScheduleForm] = useState71(false);
|
|
28481
|
+
const [editingPriceScheduleId, setEditingPriceScheduleId] = useState71(null);
|
|
28482
|
+
const [priceScheduleFormData, setPriceScheduleFormData] = useState71({
|
|
28811
28483
|
reference: "",
|
|
28812
28484
|
designation: "",
|
|
28813
28485
|
unit: "unite",
|
|
@@ -28818,10 +28490,10 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
28818
28490
|
is_active: true,
|
|
28819
28491
|
price_valid_from: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
|
|
28820
28492
|
});
|
|
28821
|
-
const [fmServices, setFmServices] =
|
|
28822
|
-
const [showFMServiceForm, setShowFMServiceForm] =
|
|
28823
|
-
const [editingFMServiceIndex, setEditingFMServiceIndex] =
|
|
28824
|
-
const [fmServiceFormData, setFmServiceFormData] =
|
|
28493
|
+
const [fmServices, setFmServices] = useState71([]);
|
|
28494
|
+
const [showFMServiceForm, setShowFMServiceForm] = useState71(false);
|
|
28495
|
+
const [editingFMServiceIndex, setEditingFMServiceIndex] = useState71(null);
|
|
28496
|
+
const [fmServiceFormData, setFmServiceFormData] = useState71({
|
|
28825
28497
|
service_type: "cleaning",
|
|
28826
28498
|
description: "",
|
|
28827
28499
|
frequency: "daily",
|
|
@@ -28962,7 +28634,7 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
28962
28634
|
setIsSubmitting(false);
|
|
28963
28635
|
}
|
|
28964
28636
|
};
|
|
28965
|
-
const [editingSLAIndicator, setEditingSLAIndicator] =
|
|
28637
|
+
const [editingSLAIndicator, setEditingSLAIndicator] = useState71(null);
|
|
28966
28638
|
const handleSaveSLA = (data) => {
|
|
28967
28639
|
const currentSLAs = formData.sla_indicators || [];
|
|
28968
28640
|
if (editingSLAId !== null) {
|
|
@@ -29337,13 +29009,13 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
29337
29009
|
/* @__PURE__ */ jsx126("h5", { className: "text-xs font-semibold mb-2", style: { color: colors.success }, children: "Vendeur (Fournisseur)" }),
|
|
29338
29010
|
/* @__PURE__ */ jsxs116("ul", { className: "text-xs space-y-1", style: { color: colors.text.secondary }, children: [
|
|
29339
29011
|
formData.incoterm === "EXW" && /* @__PURE__ */ jsx126("li", { children: "\u2022 Mise \xE0 disposition des marchandises" }),
|
|
29340
|
-
formData.incoterm === "DDP" && /* @__PURE__ */ jsxs116(
|
|
29012
|
+
formData.incoterm === "DDP" && /* @__PURE__ */ jsxs116(Fragment22, { children: [
|
|
29341
29013
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Transport principal" }),
|
|
29342
29014
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Assurance transport" }),
|
|
29343
29015
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 D\xE9douanement export/import" }),
|
|
29344
29016
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Livraison au lieu convenu" })
|
|
29345
29017
|
] }),
|
|
29346
|
-
["FOB", "CFR", "CIF"].includes(formData.incoterm || "") && /* @__PURE__ */ jsxs116(
|
|
29018
|
+
["FOB", "CFR", "CIF"].includes(formData.incoterm || "") && /* @__PURE__ */ jsxs116(Fragment22, { children: [
|
|
29347
29019
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Chargement sur navire" }),
|
|
29348
29020
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 D\xE9douanement export" })
|
|
29349
29021
|
] })
|
|
@@ -29352,7 +29024,7 @@ var ContractForm = ({ contract, onSubmit, onCancel, onShowToast, isEdit = false
|
|
|
29352
29024
|
/* @__PURE__ */ jsxs116("div", { children: [
|
|
29353
29025
|
/* @__PURE__ */ jsx126("h5", { className: "text-xs font-semibold mb-2", style: { color: colors.info }, children: "Acheteur" }),
|
|
29354
29026
|
/* @__PURE__ */ jsxs116("ul", { className: "text-xs space-y-1", style: { color: colors.text.secondary }, children: [
|
|
29355
|
-
formData.incoterm === "EXW" && /* @__PURE__ */ jsxs116(
|
|
29027
|
+
formData.incoterm === "EXW" && /* @__PURE__ */ jsxs116(Fragment22, { children: [
|
|
29356
29028
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Chargement" }),
|
|
29357
29029
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Transport principal" }),
|
|
29358
29030
|
/* @__PURE__ */ jsx126("li", { children: "\u2022 Assurance" }),
|
|
@@ -30763,14 +30435,14 @@ var ContractModal = ({
|
|
|
30763
30435
|
onShowToast
|
|
30764
30436
|
}) => {
|
|
30765
30437
|
const { activeBusinessEntity } = useSession();
|
|
30766
|
-
const [mode, setMode] =
|
|
30767
|
-
const [contractData, setContractData] =
|
|
30768
|
-
const [cameFromView, setCameFromView] =
|
|
30769
|
-
|
|
30438
|
+
const [mode, setMode] = useState72(initialMode);
|
|
30439
|
+
const [contractData, setContractData] = useState72(contract);
|
|
30440
|
+
const [cameFromView, setCameFromView] = useState72(false);
|
|
30441
|
+
useEffect53(() => {
|
|
30770
30442
|
setMode(initialMode);
|
|
30771
30443
|
setCameFromView(false);
|
|
30772
30444
|
}, [initialMode, isOpen]);
|
|
30773
|
-
|
|
30445
|
+
useEffect53(() => {
|
|
30774
30446
|
setContractData(contract);
|
|
30775
30447
|
}, [contract]);
|
|
30776
30448
|
const handleSwitchToEdit = () => {
|
|
@@ -30876,7 +30548,7 @@ var ContractModal = ({
|
|
|
30876
30548
|
};
|
|
30877
30549
|
|
|
30878
30550
|
// src/components/contracts/components/ContractReportsModal.tsx
|
|
30879
|
-
import { useState as
|
|
30551
|
+
import { useState as useState73 } from "react";
|
|
30880
30552
|
import {
|
|
30881
30553
|
Download as Download8,
|
|
30882
30554
|
FileText as FileText21,
|
|
@@ -30912,7 +30584,7 @@ var ContractReportsModal = ({
|
|
|
30912
30584
|
contracts,
|
|
30913
30585
|
onShowToast
|
|
30914
30586
|
}) => {
|
|
30915
|
-
const [activeTab, setActiveTab] =
|
|
30587
|
+
const [activeTab, setActiveTab] = useState73("overview");
|
|
30916
30588
|
const getTotalContracts = () => contracts.length;
|
|
30917
30589
|
const getActiveContracts = () => contracts.filter((c) => c.status === "actif" || c.status === "active").length;
|
|
30918
30590
|
const getExpiredContracts = () => contracts.filter((c) => c.status === "expire" || c.status === "expired").length;
|
|
@@ -31305,7 +30977,7 @@ var ContractReportsModal = ({
|
|
|
31305
30977
|
};
|
|
31306
30978
|
|
|
31307
30979
|
// src/components/contracts/components/AlertsManagementModal.tsx
|
|
31308
|
-
import { useState as
|
|
30980
|
+
import { useState as useState74 } from "react";
|
|
31309
30981
|
import {
|
|
31310
30982
|
X as X22,
|
|
31311
30983
|
Plus as Plus21,
|
|
@@ -31361,12 +31033,12 @@ var AlertsManagementModal = ({
|
|
|
31361
31033
|
contracts,
|
|
31362
31034
|
onShowToast
|
|
31363
31035
|
}) => {
|
|
31364
|
-
const [activeTab, setActiveTab] =
|
|
31365
|
-
const [selectedPriority, setSelectedPriority] =
|
|
31366
|
-
const [selectedType, setSelectedType] =
|
|
31367
|
-
const [searchTerm, setSearchTerm] =
|
|
31368
|
-
const [, setShowAddRule] =
|
|
31369
|
-
const [alertRules, setAlertRules] =
|
|
31036
|
+
const [activeTab, setActiveTab] = useState74("alerts");
|
|
31037
|
+
const [selectedPriority, setSelectedPriority] = useState74("");
|
|
31038
|
+
const [selectedType, setSelectedType] = useState74("");
|
|
31039
|
+
const [searchTerm, setSearchTerm] = useState74("");
|
|
31040
|
+
const [, setShowAddRule] = useState74(false);
|
|
31041
|
+
const [alertRules, setAlertRules] = useState74([
|
|
31370
31042
|
{
|
|
31371
31043
|
id: "1",
|
|
31372
31044
|
name: "Expiration de contrat - 30 jours",
|
|
@@ -31781,7 +31453,7 @@ var AlertsManagementModal = ({
|
|
|
31781
31453
|
};
|
|
31782
31454
|
|
|
31783
31455
|
// src/components/contracts/components/BulkSLAEvaluationModal.tsx
|
|
31784
|
-
import
|
|
31456
|
+
import React68, { useState as useState75, useMemo as useMemo10 } from "react";
|
|
31785
31457
|
import {
|
|
31786
31458
|
Calendar as Calendar13,
|
|
31787
31459
|
Save as Save7,
|
|
@@ -31792,7 +31464,7 @@ import {
|
|
|
31792
31464
|
Target as Target5,
|
|
31793
31465
|
TrendingUp as TrendingUp11
|
|
31794
31466
|
} from "lucide-react";
|
|
31795
|
-
import { Fragment as
|
|
31467
|
+
import { Fragment as Fragment23, jsx as jsx130, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
31796
31468
|
var CATEGORY_CONFIG = {
|
|
31797
31469
|
delivery: { icon: TrendingUp11, label: "Livraison" },
|
|
31798
31470
|
quality: { icon: CheckCircle23, label: "Qualit\xE9" },
|
|
@@ -31812,16 +31484,16 @@ var BulkSLAEvaluationModal = ({
|
|
|
31812
31484
|
}) => {
|
|
31813
31485
|
const { theme } = useTheme();
|
|
31814
31486
|
const colors = theme.colors;
|
|
31815
|
-
const [sessionDate, setSessionDate] =
|
|
31816
|
-
const [sessionTitle, setSessionTitle] =
|
|
31817
|
-
const [sessionComments, setSessionComments] =
|
|
31818
|
-
const [loading, setLoading] =
|
|
31819
|
-
const [evaluations, setEvaluations] =
|
|
31820
|
-
const activeIndicators =
|
|
31487
|
+
const [sessionDate, setSessionDate] = useState75((/* @__PURE__ */ new Date()).toISOString().split("T")[0]);
|
|
31488
|
+
const [sessionTitle, setSessionTitle] = useState75("");
|
|
31489
|
+
const [sessionComments, setSessionComments] = useState75("");
|
|
31490
|
+
const [loading, setLoading] = useState75(false);
|
|
31491
|
+
const [evaluations, setEvaluations] = useState75([]);
|
|
31492
|
+
const activeIndicators = useMemo10(() => {
|
|
31821
31493
|
const indicators = contract?.sla_indicators || [];
|
|
31822
31494
|
return indicators.filter((sla) => sla.is_active);
|
|
31823
31495
|
}, [contract?.sla_indicators]);
|
|
31824
|
-
|
|
31496
|
+
React68.useEffect(() => {
|
|
31825
31497
|
if (activeIndicators.length > 0 && evaluations.length === 0) {
|
|
31826
31498
|
const initialEvaluations = activeIndicators.map((sla) => ({
|
|
31827
31499
|
sla_indicator: sla.id,
|
|
@@ -31853,20 +31525,20 @@ var BulkSLAEvaluationModal = ({
|
|
|
31853
31525
|
return updated;
|
|
31854
31526
|
});
|
|
31855
31527
|
};
|
|
31856
|
-
const stats =
|
|
31528
|
+
const stats = useMemo10(() => {
|
|
31857
31529
|
let achieved = 0;
|
|
31858
|
-
let
|
|
31530
|
+
let warning = 0;
|
|
31859
31531
|
let failed = 0;
|
|
31860
31532
|
let total = 0;
|
|
31861
31533
|
evaluations.forEach((e) => {
|
|
31862
31534
|
if (e.value !== "" && e.status) {
|
|
31863
31535
|
total++;
|
|
31864
31536
|
if (e.status === "achieved") achieved++;
|
|
31865
|
-
else if (e.status === "warning")
|
|
31537
|
+
else if (e.status === "warning") warning++;
|
|
31866
31538
|
else failed++;
|
|
31867
31539
|
}
|
|
31868
31540
|
});
|
|
31869
|
-
return { achieved, warning
|
|
31541
|
+
return { achieved, warning, failed, total, evaluated: total };
|
|
31870
31542
|
}, [evaluations]);
|
|
31871
31543
|
const handleSubmit = async () => {
|
|
31872
31544
|
const validEvaluations = evaluations.filter((e) => e.value !== "" && !isNaN(parseFloat(e.value)));
|
|
@@ -31902,7 +31574,7 @@ var BulkSLAEvaluationModal = ({
|
|
|
31902
31574
|
setLoading(false);
|
|
31903
31575
|
}
|
|
31904
31576
|
};
|
|
31905
|
-
const groupedIndicators =
|
|
31577
|
+
const groupedIndicators = useMemo10(() => {
|
|
31906
31578
|
const groups = {};
|
|
31907
31579
|
activeIndicators.forEach((indicator, idx) => {
|
|
31908
31580
|
const category = indicator.category || "custom";
|
|
@@ -32041,7 +31713,7 @@ var BulkSLAEvaluationModal = ({
|
|
|
32041
31713
|
" ",
|
|
32042
31714
|
indicator.measurement_unit
|
|
32043
31715
|
] }),
|
|
32044
|
-
indicator.current_value !== null && /* @__PURE__ */ jsxs119(
|
|
31716
|
+
indicator.current_value !== null && /* @__PURE__ */ jsxs119(Fragment23, { children: [
|
|
32045
31717
|
/* @__PURE__ */ jsx130("span", { children: "|" }),
|
|
32046
31718
|
/* @__PURE__ */ jsxs119("span", { children: [
|
|
32047
31719
|
"Actuel: ",
|
|
@@ -32145,14 +31817,14 @@ var ContractsPage = () => {
|
|
|
32145
31817
|
const { activeBusinessEntity } = useSession();
|
|
32146
31818
|
const { theme } = useTheme();
|
|
32147
31819
|
const colors = theme.colors;
|
|
32148
|
-
const [currentView, setCurrentView] =
|
|
32149
|
-
const [showModal, setShowModal] =
|
|
32150
|
-
const [contracts, setContracts] =
|
|
32151
|
-
const [modalContent, setModalContent] =
|
|
32152
|
-
const [selectedContract, setSelectedContract] =
|
|
32153
|
-
const [loading, setLoading] =
|
|
32154
|
-
const [refreshList, setRefreshList] =
|
|
32155
|
-
const [refreshSLAList, setRefreshSLAList] =
|
|
31820
|
+
const [currentView, setCurrentView] = useState76("dashboard");
|
|
31821
|
+
const [showModal, setShowModal] = useState76(false);
|
|
31822
|
+
const [contracts, setContracts] = useState76([]);
|
|
31823
|
+
const [modalContent, setModalContent] = useState76(null);
|
|
31824
|
+
const [selectedContract, setSelectedContract] = useState76(null);
|
|
31825
|
+
const [loading, setLoading] = useState76(false);
|
|
31826
|
+
const [refreshList, setRefreshList] = useState76(false);
|
|
31827
|
+
const [refreshSLAList, setRefreshSLAList] = useState76(false);
|
|
32156
31828
|
const contractColumns = [
|
|
32157
31829
|
{ key: "number", label: "N\xB0 Contrat", type: "text", filterable: true, sortable: true, search_name: "number" },
|
|
32158
31830
|
{
|
|
@@ -32313,7 +31985,7 @@ var ContractsPage = () => {
|
|
|
32313
31985
|
setModalContent(null);
|
|
32314
31986
|
setSelectedContract(null);
|
|
32315
31987
|
};
|
|
32316
|
-
|
|
31988
|
+
useEffect54(() => {
|
|
32317
31989
|
const loadContracts = async () => {
|
|
32318
31990
|
if (!activeBusinessEntity?.id) return;
|
|
32319
31991
|
try {
|
|
@@ -32571,27 +32243,27 @@ var SLAManagementModal = ({
|
|
|
32571
32243
|
}) => {
|
|
32572
32244
|
const { theme } = useTheme();
|
|
32573
32245
|
const colors = theme.colors;
|
|
32574
|
-
const [activeTab, setActiveTab] =
|
|
32575
|
-
const [selectedIndicator, setSelectedIndicator] =
|
|
32576
|
-
const [showAddIndicator, setShowAddIndicator] =
|
|
32577
|
-
const [showAddMeasurement, setShowAddMeasurement] =
|
|
32578
|
-
const [editingIndicator, setEditingIndicator] =
|
|
32579
|
-
const [showBulkMeasurement, setShowBulkMeasurement] =
|
|
32580
|
-
const [evaluationSessions, setEvaluationSessions] =
|
|
32581
|
-
const [sessionsLoading, setSessionsLoading] =
|
|
32582
|
-
const [expandedSession, setExpandedSession] =
|
|
32583
|
-
const [selectedSession, setSelectedSession] =
|
|
32584
|
-
const [notes, setNotes] =
|
|
32585
|
-
const [notesLoading, setNotesLoading] =
|
|
32586
|
-
const [newNote, setNewNote] =
|
|
32587
|
-
const [newNoteType, setNewNoteType] =
|
|
32588
|
-
const [newNoteImportant, setNewNoteImportant] =
|
|
32589
|
-
const [noteFilter, setNoteFilter] =
|
|
32590
|
-
const [incidentFilter, setIncidentFilter] =
|
|
32591
|
-
const slaStats =
|
|
32246
|
+
const [activeTab, setActiveTab] = useState76("overview");
|
|
32247
|
+
const [selectedIndicator, setSelectedIndicator] = useState76(null);
|
|
32248
|
+
const [showAddIndicator, setShowAddIndicator] = useState76(false);
|
|
32249
|
+
const [showAddMeasurement, setShowAddMeasurement] = useState76(false);
|
|
32250
|
+
const [editingIndicator, setEditingIndicator] = useState76(null);
|
|
32251
|
+
const [showBulkMeasurement, setShowBulkMeasurement] = useState76(false);
|
|
32252
|
+
const [evaluationSessions, setEvaluationSessions] = useState76([]);
|
|
32253
|
+
const [sessionsLoading, setSessionsLoading] = useState76(false);
|
|
32254
|
+
const [expandedSession, setExpandedSession] = useState76(null);
|
|
32255
|
+
const [selectedSession, setSelectedSession] = useState76(null);
|
|
32256
|
+
const [notes, setNotes] = useState76([]);
|
|
32257
|
+
const [notesLoading, setNotesLoading] = useState76(false);
|
|
32258
|
+
const [newNote, setNewNote] = useState76("");
|
|
32259
|
+
const [newNoteType, setNewNoteType] = useState76("comment");
|
|
32260
|
+
const [newNoteImportant, setNewNoteImportant] = useState76(false);
|
|
32261
|
+
const [noteFilter, setNoteFilter] = useState76("all");
|
|
32262
|
+
const [incidentFilter, setIncidentFilter] = useState76("all");
|
|
32263
|
+
const slaStats = useMemo11(() => {
|
|
32592
32264
|
const indicators = contract.sla_indicators || [];
|
|
32593
32265
|
const achieved = indicators.filter((i) => i.status === "achieved").length;
|
|
32594
|
-
const
|
|
32266
|
+
const warning = indicators.filter((i) => i.status === "warning").length;
|
|
32595
32267
|
const failed = indicators.filter((i) => i.status === "failed").length;
|
|
32596
32268
|
const total = indicators.length;
|
|
32597
32269
|
const overallPerformance = total > 0 ? Math.round(indicators.reduce((sum, i) => {
|
|
@@ -32611,7 +32283,7 @@ var SLAManagementModal = ({
|
|
|
32611
32283
|
return {
|
|
32612
32284
|
total,
|
|
32613
32285
|
achieved,
|
|
32614
|
-
warning
|
|
32286
|
+
warning,
|
|
32615
32287
|
failed,
|
|
32616
32288
|
overallPerformance,
|
|
32617
32289
|
totalPenalties,
|
|
@@ -32636,7 +32308,7 @@ var SLAManagementModal = ({
|
|
|
32636
32308
|
setSessionsLoading(false);
|
|
32637
32309
|
}
|
|
32638
32310
|
};
|
|
32639
|
-
|
|
32311
|
+
useEffect54(() => {
|
|
32640
32312
|
if (isOpen && contract?.id && activeTab === "evaluations") {
|
|
32641
32313
|
loadEvaluationSessions();
|
|
32642
32314
|
}
|
|
@@ -32656,7 +32328,7 @@ var SLAManagementModal = ({
|
|
|
32656
32328
|
setNotesLoading(false);
|
|
32657
32329
|
}
|
|
32658
32330
|
};
|
|
32659
|
-
|
|
32331
|
+
useEffect54(() => {
|
|
32660
32332
|
if (isOpen && contract?.id && activeTab === "notes") {
|
|
32661
32333
|
loadContractNotes();
|
|
32662
32334
|
}
|
|
@@ -33889,9 +33561,9 @@ var AddSLAEvaluationModal = ({
|
|
|
33889
33561
|
}) => {
|
|
33890
33562
|
const { theme } = useTheme();
|
|
33891
33563
|
const colors = theme.colors;
|
|
33892
|
-
const [value, setValue] =
|
|
33893
|
-
const [date, setDate] =
|
|
33894
|
-
const [comments, setComments] =
|
|
33564
|
+
const [value, setValue] = React69.useState("");
|
|
33565
|
+
const [date, setDate] = React69.useState((/* @__PURE__ */ new Date()).toISOString().split("T")[0]);
|
|
33566
|
+
const [comments, setComments] = React69.useState("");
|
|
33895
33567
|
const handleSubmit = (e) => {
|
|
33896
33568
|
e.preventDefault();
|
|
33897
33569
|
if (!value) {
|
|
@@ -33978,7 +33650,7 @@ var AddSLAEvaluationModal = ({
|
|
|
33978
33650
|
};
|
|
33979
33651
|
|
|
33980
33652
|
// src/components/contracts/components/SLAEvaluationForm.tsx
|
|
33981
|
-
import { useState as
|
|
33653
|
+
import { useState as useState77 } from "react";
|
|
33982
33654
|
import { jsx as jsx132, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
33983
33655
|
var SLAEvaluationForm = ({
|
|
33984
33656
|
indicator,
|
|
@@ -33989,15 +33661,15 @@ var SLAEvaluationForm = ({
|
|
|
33989
33661
|
}) => {
|
|
33990
33662
|
const { theme } = useTheme();
|
|
33991
33663
|
const colors = theme.colors;
|
|
33992
|
-
const [formData, setFormData] =
|
|
33664
|
+
const [formData, setFormData] = useState77({
|
|
33993
33665
|
sla_indicator: indicator?.id,
|
|
33994
33666
|
evaluation_date: evaluation?.evaluation_date || (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
33995
33667
|
value: evaluation?.value || 0,
|
|
33996
33668
|
comments: evaluation?.comments || "",
|
|
33997
33669
|
automatic_evaluation: evaluation?.automatic_evaluation || false
|
|
33998
33670
|
});
|
|
33999
|
-
const [errors, setErrors] =
|
|
34000
|
-
const [evaluatedByName, setEvaluatedByName] =
|
|
33671
|
+
const [errors, setErrors] = useState77({});
|
|
33672
|
+
const [evaluatedByName, setEvaluatedByName] = useState77(evaluation?.evaluated_by_name || "");
|
|
34001
33673
|
const calculateStatus = (value) => {
|
|
34002
33674
|
if (value >= indicator?.target_value) return "achieved";
|
|
34003
33675
|
if (value >= indicator?.minimum_acceptable) return "warning";
|
|
@@ -34511,29 +34183,3 @@ export {
|
|
|
34511
34183
|
useTheme,
|
|
34512
34184
|
useToast
|
|
34513
34185
|
};
|
|
34514
|
-
/*! Bundled license information:
|
|
34515
|
-
|
|
34516
|
-
@remix-run/router/dist/router.js:
|
|
34517
|
-
(**
|
|
34518
|
-
* @remix-run/router v1.23.0
|
|
34519
|
-
*
|
|
34520
|
-
* Copyright (c) Remix Software Inc.
|
|
34521
|
-
*
|
|
34522
|
-
* This source code is licensed under the MIT license found in the
|
|
34523
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
34524
|
-
*
|
|
34525
|
-
* @license MIT
|
|
34526
|
-
*)
|
|
34527
|
-
|
|
34528
|
-
react-router/dist/index.js:
|
|
34529
|
-
(**
|
|
34530
|
-
* React Router v6.30.1
|
|
34531
|
-
*
|
|
34532
|
-
* Copyright (c) Remix Software Inc.
|
|
34533
|
-
*
|
|
34534
|
-
* This source code is licensed under the MIT license found in the
|
|
34535
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
34536
|
-
*
|
|
34537
|
-
* @license MIT
|
|
34538
|
-
*)
|
|
34539
|
-
*/
|