@dexteel/mesf-core 7.8.0 → 7.9.0
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/controls/section-selector/SectionMultiSelect.d.ts +11 -0
- package/dist/controls/section-selector/SectionSelector.d.ts +11 -0
- package/dist/controls/section-selector/hooks/index.d.ts +2 -0
- package/dist/controls/section-selector/hooks/useSections.d.ts +7 -0
- package/dist/controls/section-selector/hooks/useTopSections.d.ts +6 -0
- package/dist/controls/section-selector/index.d.ts +5 -0
- package/dist/controls/section-selector/models/Section.d.ts +22 -0
- package/dist/controls/section-selector/repositories/SectionRepository.d.ts +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +2884 -288
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/section-logbook/entry/LogbookPage.d.ts +3 -0
- package/dist/pages/section-logbook/entry/components/Logbook.d.ts +2 -0
- package/dist/pages/section-logbook/entry/components/attachments/AttachmentModal.d.ts +12 -0
- package/dist/pages/section-logbook/entry/components/attachments/AttachmentPlugin.d.ts +15 -0
- package/dist/pages/section-logbook/entry/components/attachments/DeleteAttachmentConfirmationDialog.d.ts +9 -0
- package/dist/pages/section-logbook/entry/components/dialog/DeleteEntryDialog.d.ts +9 -0
- package/dist/pages/section-logbook/entry/components/entry-viewer/ContentInput.d.ts +16 -0
- package/dist/pages/section-logbook/entry/components/entry-viewer/EntryViewer.d.ts +17 -0
- package/dist/pages/section-logbook/entry/components/filters/filters.d.ts +10 -0
- package/dist/pages/section-logbook/entry/hooks/useEntries.d.ts +8 -0
- package/dist/pages/section-logbook/entry/hooks/useEntrySubmission.d.ts +34 -0
- package/dist/pages/section-logbook/entry/hooks/useLogbookEntryOptionsFunctions.d.ts +12 -0
- package/dist/pages/section-logbook/entry/hooks/useTableData.d.ts +10 -0
- package/dist/pages/section-logbook/entry/index.d.ts +2 -0
- package/dist/pages/section-logbook/entry/models/Entry.d.ts +22 -0
- package/dist/pages/section-logbook/entry/models/EntryAttachment.d.ts +20 -0
- package/dist/pages/section-logbook/entry/repository/LogbookRepository.d.ts +34 -0
- package/dist/pages/section-logbook/index.d.ts +22 -0
- package/dist/pages/section-logbook/report/LogbookPage.d.ts +3 -0
- package/dist/pages/section-logbook/report/components/Logbook.d.ts +2 -0
- package/dist/pages/section-logbook/report/components/entry-viewer/EntryViewer.d.ts +13 -0
- package/dist/pages/section-logbook/report/components/filters/filters.d.ts +14 -0
- package/dist/pages/section-logbook/report/hooks/useEntriesReport.d.ts +10 -0
- package/dist/pages/section-logbook/report/hooks/useTableData.d.ts +8 -0
- package/dist/pages/section-logbook/report/index.d.ts +2 -0
- package/dist/pages/section-logbook/report/repository/LogbookRepository.d.ts +8 -0
- package/dist/pages/section-logbook/shared/LogbookSectionPage.d.ts +2 -0
- package/dist/pages/section-logbook/shared/components/LogbookSection.d.ts +2 -0
- package/dist/pages/section-logbook/shared/components/entry-viewer/SectionEntryViewer.d.ts +14 -0
- package/dist/pages/section-logbook/shared/components/entry-viewer/index.d.ts +1 -0
- package/dist/pages/section-logbook/shared/components/filters/SectionFilters.d.ts +15 -0
- package/dist/pages/section-logbook/shared/components/filters/index.d.ts +1 -0
- package/dist/pages/section-logbook/shared/hooks/index.d.ts +2 -0
- package/dist/pages/section-logbook/shared/hooks/useSectionEntries.d.ts +7 -0
- package/dist/pages/section-logbook/shared/hooks/useTableData.d.ts +11 -0
- package/dist/pages/section-logbook/shared/index.d.ts +6 -0
- package/dist/pages/section-logbook/shared/models/SectionEntry.d.ts +16 -0
- package/dist/pages/section-logbook/shared/repository/SectionRepository.d.ts +25 -0
- package/dist/pages/section-logbook/useGridDefinitions.d.ts +9 -0
- package/dist/reducers/LogbookSettingsReducer.d.ts +11 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -34,9 +34,9 @@ import { DataGrid, GridOverlay } from '@mui/x-data-grid';
|
|
|
34
34
|
import PropTypes from 'prop-types';
|
|
35
35
|
import GetAppIcon from '@mui/icons-material/GetApp';
|
|
36
36
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
37
|
-
import moment$
|
|
37
|
+
import moment$g from 'moment-timezone';
|
|
38
38
|
import { useParams, useNavigate, useSearchParams, Link, Navigate, Routes, Route, useLocation, BrowserRouter } from 'react-router-dom';
|
|
39
|
-
import moment$
|
|
39
|
+
import moment$f from 'moment';
|
|
40
40
|
import SkipNextIcon from '@mui/icons-material/SkipNext';
|
|
41
41
|
import PersonOutlineIcon from '@mui/icons-material/PersonOutline';
|
|
42
42
|
import LockIcon from '@mui/icons-material/Lock';
|
|
@@ -903,7 +903,7 @@ var MESApiService = /** @class */ (function () {
|
|
|
903
903
|
data.dataBaseName = database;
|
|
904
904
|
data.parameters = formattedParameters;
|
|
905
905
|
Date.prototype.toJSON = function () {
|
|
906
|
-
return moment$
|
|
906
|
+
return moment$f(this).format("YYYY-MM-DDTHH:mm:ss");
|
|
907
907
|
}; // eslint-disable-line
|
|
908
908
|
isError = { ok: true };
|
|
909
909
|
return [2 /*return*/, fetch(this.config.API_PROCEDURE_URL + "/Execute", {
|
|
@@ -962,7 +962,7 @@ var MESApiService = /** @class */ (function () {
|
|
|
962
962
|
data.method = procedure;
|
|
963
963
|
data.parameters = formattedParameters;
|
|
964
964
|
Date.prototype.toJSON = function () {
|
|
965
|
-
return moment$
|
|
965
|
+
return moment$f(this).format("YYYY-MM-DDTHH:mm:ss");
|
|
966
966
|
}; // eslint-disable-line
|
|
967
967
|
curatedMethod = procedure.replace(/[\[\]]/g, "");
|
|
968
968
|
_a.label = 1;
|
|
@@ -1017,7 +1017,7 @@ var MESApiService = /** @class */ (function () {
|
|
|
1017
1017
|
data.dataBaseName = database;
|
|
1018
1018
|
data.parameters = formattedParameters;
|
|
1019
1019
|
Date.prototype.toJSON = function () {
|
|
1020
|
-
return moment$
|
|
1020
|
+
return moment$f(this).format("YYYY-MM-DDTHH:mm:ss");
|
|
1021
1021
|
}; // eslint-disable-line
|
|
1022
1022
|
isError = { ok: true };
|
|
1023
1023
|
return [2 /*return*/, fetch(this.config.API_PROCEDURE_URL + "/ExecuteJSON", {
|
|
@@ -1074,7 +1074,7 @@ var MESApiService = /** @class */ (function () {
|
|
|
1074
1074
|
formattedParameters.push(formattedParameter);
|
|
1075
1075
|
});
|
|
1076
1076
|
Date.prototype.toJSON = function () {
|
|
1077
|
-
return moment$
|
|
1077
|
+
return moment$f(this).format("YYYY-MM-DDTHH:mm:ss");
|
|
1078
1078
|
}; // eslint-disable-line
|
|
1079
1079
|
isError = { ok: true };
|
|
1080
1080
|
files.forEach(function (element) {
|
|
@@ -1141,7 +1141,7 @@ var MESApiService = /** @class */ (function () {
|
|
|
1141
1141
|
data.parameters = formattedParameters;
|
|
1142
1142
|
data.fileName = fileName || "Default.xlsx";
|
|
1143
1143
|
Date.prototype.toJSON = function () {
|
|
1144
|
-
return moment$
|
|
1144
|
+
return moment$f(this).format("YYYY-MM-DDTHH:mm:ss");
|
|
1145
1145
|
}; // eslint-disable-line
|
|
1146
1146
|
isError = { ok: true };
|
|
1147
1147
|
return [2 /*return*/, fetch(this.config.API_PROCEDURE_URL + "/Export", {
|
|
@@ -1219,7 +1219,7 @@ var MESApiService = /** @class */ (function () {
|
|
|
1219
1219
|
data.parameters = formattedParameters;
|
|
1220
1220
|
data.fileName = fileName || "Default.xlsx";
|
|
1221
1221
|
Date.prototype.toJSON = function () {
|
|
1222
|
-
return moment$
|
|
1222
|
+
return moment$f(this).format("YYYY-MM-DDTHH:mm:ss");
|
|
1223
1223
|
}; // eslint-disable-line
|
|
1224
1224
|
isError = { ok: true };
|
|
1225
1225
|
return [2 /*return*/, fetch(this.config.API_PROCEDURE_URL + "/ExportExcel", {
|
|
@@ -1771,7 +1771,7 @@ var TimeService = /** @class */ (function () {
|
|
|
1771
1771
|
else {
|
|
1772
1772
|
this.timeZone = timeZone;
|
|
1773
1773
|
}
|
|
1774
|
-
moment$
|
|
1774
|
+
moment$g.tz.setDefault(this.timeZone);
|
|
1775
1775
|
};
|
|
1776
1776
|
TimeService.prototype.toUTC = function (datetime, format$1) {
|
|
1777
1777
|
try {
|
|
@@ -1810,7 +1810,7 @@ var TimeService = /** @class */ (function () {
|
|
|
1810
1810
|
};
|
|
1811
1811
|
return TimeService;
|
|
1812
1812
|
}());
|
|
1813
|
-
var getMomentTz = function () { return moment$
|
|
1813
|
+
var getMomentTz = function () { return moment$g; };
|
|
1814
1814
|
var dxtServerTimeZone = function () {
|
|
1815
1815
|
return TimeService.getInstance().getServerTimeZone;
|
|
1816
1816
|
};
|
|
@@ -4322,7 +4322,7 @@ var useProfilesOptionsFunctions = function (_a) {
|
|
|
4322
4322
|
};
|
|
4323
4323
|
};
|
|
4324
4324
|
|
|
4325
|
-
var useTableData$
|
|
4325
|
+
var useTableData$7 = function (_a) {
|
|
4326
4326
|
var setProfileId = _a.setProfileId, setModalProceduresProfile = _a.setModalProceduresProfile, setModalDeleteProfile = _a.setModalDeleteProfile, showContextMenu = _a.showContextMenu;
|
|
4327
4327
|
var columnDefs = [
|
|
4328
4328
|
{
|
|
@@ -4441,7 +4441,7 @@ var TableProfiles = function () {
|
|
|
4441
4441
|
setModalProceduresProfile: setModalProceduresProfile,
|
|
4442
4442
|
}).getMenuOptions;
|
|
4443
4443
|
var _h = useContextMenuMESF(), showContextMenu = _h.showContextMenu, registerConfig = _h.registerConfig;
|
|
4444
|
-
var columnDefs = useTableData$
|
|
4444
|
+
var columnDefs = useTableData$7({
|
|
4445
4445
|
setModalDeleteProfile: setModalDeleteProfile,
|
|
4446
4446
|
setModalProceduresProfile: setModalProceduresProfile,
|
|
4447
4447
|
setProfileId: setProfile,
|
|
@@ -4578,36 +4578,36 @@ var CreateUser = function (_a) {
|
|
|
4578
4578
|
setOpen(false);
|
|
4579
4579
|
};
|
|
4580
4580
|
var UserName = watch("UserName");
|
|
4581
|
-
var profilesIds = watch("ProfilesId");
|
|
4582
|
-
var setProfiles = useMutation({
|
|
4583
|
-
mutationFn: setProfilesToUser,
|
|
4584
|
-
onError: function (error) {
|
|
4585
|
-
setError(error.message);
|
|
4586
|
-
},
|
|
4587
|
-
});
|
|
4588
4581
|
var createUser = useMutation({
|
|
4589
|
-
mutationFn:
|
|
4590
|
-
|
|
4582
|
+
mutationFn: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4583
|
+
var userId, passwordResult;
|
|
4591
4584
|
return __generator(this, function (_a) {
|
|
4592
4585
|
switch (_a.label) {
|
|
4593
|
-
case 0:
|
|
4594
|
-
_a.trys.push([0, 2, , 3]);
|
|
4595
|
-
return [4 /*yield*/, setProfiles.mutateAsync({
|
|
4596
|
-
UserId: userCreatedId,
|
|
4597
|
-
profileIds: profilesIds,
|
|
4598
|
-
})];
|
|
4586
|
+
case 0: return [4 /*yield*/, upsertUser(data)];
|
|
4599
4587
|
case 1:
|
|
4600
|
-
_a.sent();
|
|
4601
|
-
|
|
4602
|
-
onHide(true);
|
|
4603
|
-
return [3 /*break*/, 3];
|
|
4588
|
+
userId = _a.sent();
|
|
4589
|
+
return [4 /*yield*/, setPassword(userId, data.UserName)];
|
|
4604
4590
|
case 2:
|
|
4591
|
+
passwordResult = _a.sent();
|
|
4592
|
+
if (!passwordResult.ok) {
|
|
4593
|
+
throw new Error(passwordResult.message || "Error setting password");
|
|
4594
|
+
}
|
|
4595
|
+
if (!(data.ProfilesId && Array.isArray(data.ProfilesId))) return [3 /*break*/, 4];
|
|
4596
|
+
return [4 /*yield*/, setProfilesToUser({
|
|
4597
|
+
UserId: userId,
|
|
4598
|
+
profileIds: data.ProfilesId,
|
|
4599
|
+
})];
|
|
4600
|
+
case 3:
|
|
4605
4601
|
_a.sent();
|
|
4606
|
-
|
|
4607
|
-
case
|
|
4602
|
+
_a.label = 4;
|
|
4603
|
+
case 4: return [2 /*return*/, userId];
|
|
4608
4604
|
}
|
|
4609
4605
|
});
|
|
4610
4606
|
}); },
|
|
4607
|
+
onSuccess: function () {
|
|
4608
|
+
setOpen(true);
|
|
4609
|
+
onHide(true);
|
|
4610
|
+
},
|
|
4611
4611
|
onError: function (error) {
|
|
4612
4612
|
setError(error.message);
|
|
4613
4613
|
},
|
|
@@ -5072,39 +5072,39 @@ var EditUser = function (_a) {
|
|
|
5072
5072
|
}
|
|
5073
5073
|
setOpen(false);
|
|
5074
5074
|
};
|
|
5075
|
-
var setProfiles = useMutation({
|
|
5076
|
-
mutationFn: setProfilesToUser,
|
|
5077
|
-
onError: function (error) {
|
|
5078
|
-
setError(error.message);
|
|
5079
|
-
},
|
|
5080
|
-
});
|
|
5081
5075
|
var editUser = useMutation({
|
|
5082
|
-
mutationFn:
|
|
5083
|
-
|
|
5084
|
-
var currentLoggedUserId;
|
|
5076
|
+
mutationFn: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5077
|
+
var userUpdatedId, validProfileIds;
|
|
5085
5078
|
return __generator(this, function (_a) {
|
|
5086
5079
|
switch (_a.label) {
|
|
5087
|
-
case 0:
|
|
5088
|
-
|
|
5089
|
-
|
|
5080
|
+
case 0: return [4 /*yield*/, upsertUser(data)];
|
|
5081
|
+
case 1:
|
|
5082
|
+
userUpdatedId = _a.sent();
|
|
5083
|
+
validProfileIds = Array.isArray(profilesIds)
|
|
5084
|
+
? profilesIds.filter(function (id) { return !isNaN(id) && id > 0; })
|
|
5085
|
+
: [];
|
|
5086
|
+
// Step 3: Set the profiles for the user
|
|
5087
|
+
return [4 /*yield*/, setProfilesToUser({
|
|
5090
5088
|
UserId: userUpdatedId,
|
|
5091
|
-
profileIds:
|
|
5089
|
+
profileIds: validProfileIds,
|
|
5092
5090
|
})];
|
|
5093
|
-
case 1:
|
|
5094
|
-
_a.sent();
|
|
5095
|
-
currentLoggedUserId = getUserId();
|
|
5096
|
-
if (currentLoggedUserId === userUpdatedId) {
|
|
5097
|
-
// Update context - the area-selector effect will update the name
|
|
5098
|
-
setDefaultAreaId(defaultAssetId);
|
|
5099
|
-
}
|
|
5100
|
-
onHide(true);
|
|
5101
|
-
setOpen(true);
|
|
5102
|
-
return [3 /*break*/, 3];
|
|
5103
5091
|
case 2:
|
|
5092
|
+
// Step 3: Set the profiles for the user
|
|
5104
5093
|
_a.sent();
|
|
5105
|
-
return [
|
|
5106
|
-
|
|
5094
|
+
return [2 /*return*/, userUpdatedId];
|
|
5095
|
+
}
|
|
5096
|
+
});
|
|
5097
|
+
}); },
|
|
5098
|
+
onSuccess: function (userUpdatedId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5099
|
+
var currentLoggedUserId;
|
|
5100
|
+
return __generator(this, function (_a) {
|
|
5101
|
+
currentLoggedUserId = getUserId();
|
|
5102
|
+
if (currentLoggedUserId === userUpdatedId && defaultAssetId) {
|
|
5103
|
+
setDefaultAreaId(defaultAssetId);
|
|
5107
5104
|
}
|
|
5105
|
+
onHide(true);
|
|
5106
|
+
setOpen(true);
|
|
5107
|
+
return [2 /*return*/];
|
|
5108
5108
|
});
|
|
5109
5109
|
}); },
|
|
5110
5110
|
onError: function (error) {
|
|
@@ -5133,7 +5133,13 @@ var EditUser = function (_a) {
|
|
|
5133
5133
|
if (isSuccess) {
|
|
5134
5134
|
var userSelected = rows ? rows[0] : null;
|
|
5135
5135
|
if (userSelected) {
|
|
5136
|
-
var
|
|
5136
|
+
var profilesIdsString = ((_a = userSelected.ProfilesId) === null || _a === void 0 ? void 0 : _a.toString()) || "";
|
|
5137
|
+
var profilesIds_1 = profilesIdsString
|
|
5138
|
+
.split(",")
|
|
5139
|
+
.map(function (pId) { return pId.trim(); })
|
|
5140
|
+
.filter(function (pId) { return pId !== ""; })
|
|
5141
|
+
.map(function (pId) { return parseInt(pId); })
|
|
5142
|
+
.filter(function (pId) { return !isNaN(pId); });
|
|
5137
5143
|
setValue("UserId", userSelected.UserId);
|
|
5138
5144
|
setValue("UserName", userSelected.UserName);
|
|
5139
5145
|
setValue("FirstName", userSelected.FirstName);
|
|
@@ -5142,7 +5148,7 @@ var EditUser = function (_a) {
|
|
|
5142
5148
|
setValue("IsActive", userSelected.IsActive);
|
|
5143
5149
|
setValue("LastLogin", userSelected.LastLogin);
|
|
5144
5150
|
setValue("DefaultAssetId", userSelected.DefaultAssetId);
|
|
5145
|
-
setValue("ProfilesId", profilesIds_1
|
|
5151
|
+
setValue("ProfilesId", profilesIds_1);
|
|
5146
5152
|
}
|
|
5147
5153
|
}
|
|
5148
5154
|
}
|
|
@@ -5266,7 +5272,7 @@ var buttonsCellRenderer = function (params) {
|
|
|
5266
5272
|
React__default.createElement(FormatListBulletedSharpIcon, { style: { height: "auto" }, color: "action" })))));
|
|
5267
5273
|
};
|
|
5268
5274
|
|
|
5269
|
-
var useTableData$
|
|
5275
|
+
var useTableData$6 = function (_a) {
|
|
5270
5276
|
var setUserId = _a.setUserId, setOpenModalEditDataUser = _a.setOpenModalEditDataUser, setOpenModalDeleteUser = _a.setOpenModalDeleteUser, setOpenModalChangePasswordd = _a.setOpenModalChangePasswordd, showContextMenu = _a.showContextMenu;
|
|
5271
5277
|
var columnDefs = [
|
|
5272
5278
|
{
|
|
@@ -5436,7 +5442,7 @@ var TableUsers = function () {
|
|
|
5436
5442
|
setShowChangePasswordModal: setOpenModalChangePasswordd,
|
|
5437
5443
|
}).getMenuOptions;
|
|
5438
5444
|
var _k = useContextMenuMESF(), showContextMenu = _k.showContextMenu, registerConfig = _k.registerConfig;
|
|
5439
|
-
var columnDefs = useTableData$
|
|
5445
|
+
var columnDefs = useTableData$6({
|
|
5440
5446
|
setUserId: setUserId,
|
|
5441
5447
|
setOpenModalEditDataUser: setOpenModalEditDataUser,
|
|
5442
5448
|
setOpenModalDeleteUser: setOpenModalDeleteUser,
|
|
@@ -6217,11 +6223,11 @@ var useShiftNavigatorManager = function () {
|
|
|
6217
6223
|
case 1:
|
|
6218
6224
|
resp = _a.sent();
|
|
6219
6225
|
if (resp.ok) {
|
|
6220
|
-
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$
|
|
6226
|
+
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$f
|
|
6221
6227
|
.utc(resp.data.CurrentProductionDate)
|
|
6222
|
-
.toDate(), CurrentStart: moment$
|
|
6228
|
+
.toDate(), CurrentStart: moment$f.utc(resp.data.CurrentStart).toDate(), CurrentEnd: moment$f.utc(resp.data.CurrentEnd).toDate(), PreviousProductionDate: moment$f
|
|
6223
6229
|
.utc(resp.data.PreviousProductionDate)
|
|
6224
|
-
.toDate(), PreviousStart: moment$
|
|
6230
|
+
.toDate(), PreviousStart: moment$f.utc(resp.data.PreviousStart).toDate(), PreviousEnd: moment$f.utc(resp.data.PreviousEnd).toDate(), LastProductionDate: moment$f.utc(resp.data.LastProductionDate).toDate(), LastStart: moment$f.utc(resp.data.LastStart).toDate(), LastEnd: moment$f.utc(resp.data.LastEnd).toDate() });
|
|
6225
6231
|
setShiftInfo(shift);
|
|
6226
6232
|
return [2 /*return*/, shift];
|
|
6227
6233
|
}
|
|
@@ -6246,11 +6252,11 @@ var useShiftNavigatorManager = function () {
|
|
|
6246
6252
|
case 2:
|
|
6247
6253
|
resp = _a.sent();
|
|
6248
6254
|
if (resp.ok) {
|
|
6249
|
-
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$
|
|
6255
|
+
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$f
|
|
6250
6256
|
.utc(resp.data.CurrentProductionDate)
|
|
6251
|
-
.toDate(), CurrentStart: moment$
|
|
6257
|
+
.toDate(), CurrentStart: moment$f.utc(resp.data.CurrentStart).toDate(), CurrentEnd: moment$f.utc(resp.data.CurrentEnd).toDate(), PreviousProductionDate: moment$f
|
|
6252
6258
|
.utc(resp.data.PreviousProductionDate)
|
|
6253
|
-
.toDate(), PreviousStart: moment$
|
|
6259
|
+
.toDate(), PreviousStart: moment$f.utc(resp.data.PreviousStart).toDate(), PreviousEnd: moment$f.utc(resp.data.PreviousEnd).toDate(), LastProductionDate: moment$f.utc(resp.data.LastProductionDate).toDate(), LastStart: moment$f.utc(resp.data.LastStart).toDate(), LastEnd: moment$f.utc(resp.data.LastEnd).toDate() });
|
|
6254
6260
|
setShiftInfo(shift);
|
|
6255
6261
|
return [2 /*return*/, shift];
|
|
6256
6262
|
}
|
|
@@ -6276,11 +6282,11 @@ var useShiftNavigatorManager = function () {
|
|
|
6276
6282
|
case 1:
|
|
6277
6283
|
resp = _a.sent();
|
|
6278
6284
|
if (resp.ok) {
|
|
6279
|
-
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$
|
|
6285
|
+
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$f
|
|
6280
6286
|
.utc(resp.data.CurrentProductionDate)
|
|
6281
|
-
.toDate(), CurrentStart: moment$
|
|
6287
|
+
.toDate(), CurrentStart: moment$f.utc(resp.data.CurrentStart).toDate(), CurrentEnd: moment$f.utc(resp.data.CurrentEnd).toDate(), PreviousProductionDate: moment$f
|
|
6282
6288
|
.utc(resp.data.PreviousProductionDate)
|
|
6283
|
-
.toDate(), PreviousStart: moment$
|
|
6289
|
+
.toDate(), PreviousStart: moment$f.utc(resp.data.PreviousStart).toDate(), PreviousEnd: moment$f.utc(resp.data.PreviousEnd).toDate(), LastProductionDate: moment$f.utc(resp.data.LastProductionDate).toDate(), LastStart: moment$f.utc(resp.data.LastStart).toDate(), LastEnd: moment$f.utc(resp.data.LastEnd).toDate() });
|
|
6284
6290
|
setShiftInfo(shift);
|
|
6285
6291
|
return [2 /*return*/, shift];
|
|
6286
6292
|
}
|
|
@@ -6378,13 +6384,13 @@ var ShiftDayNavigatorControl = function (_a) {
|
|
|
6378
6384
|
case 2:
|
|
6379
6385
|
resp = _a.sent();
|
|
6380
6386
|
if (resp.ok) {
|
|
6381
|
-
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$
|
|
6387
|
+
shift = __assign(__assign({}, resp.data), { CurrentProductionDate: moment$g
|
|
6382
6388
|
.utc(resp.data.CurrentProductionDate)
|
|
6383
|
-
.toDate(), CurrentStart: moment$
|
|
6389
|
+
.toDate(), CurrentStart: moment$g.utc(resp.data.CurrentStart).toDate(), CurrentEnd: moment$g.utc(resp.data.CurrentEnd).toDate(), PreviousProductionDate: moment$g
|
|
6384
6390
|
.utc(resp.data.PreviousProductionDate)
|
|
6385
|
-
.toDate(), PreviousStart: moment$
|
|
6391
|
+
.toDate(), PreviousStart: moment$g.utc(resp.data.PreviousStart).toDate(), PreviousEnd: moment$g.utc(resp.data.PreviousEnd).toDate(), LastProductionDate: moment$g
|
|
6386
6392
|
.utc(resp.data.LastProductionDate)
|
|
6387
|
-
.toDate(), LastStart: moment$
|
|
6393
|
+
.toDate(), LastStart: moment$g.utc(resp.data.LastStart).toDate(), LastEnd: moment$g.utc(resp.data.LastEnd).toDate() });
|
|
6388
6394
|
setShiftInfoCopy(shift);
|
|
6389
6395
|
}
|
|
6390
6396
|
return [3 /*break*/, 4];
|
|
@@ -6428,7 +6434,7 @@ var ShiftDayNavigatorControl = function (_a) {
|
|
|
6428
6434
|
}, size: "small" },
|
|
6429
6435
|
React__default.createElement(ArrowBackRounded, null)))),
|
|
6430
6436
|
React__default.createElement(Grid2, { size: "auto" },
|
|
6431
|
-
React__default.createElement(DatePicker, { label: "Current Date", timezone: "UTC", format: "MM/DD/YYYY", maxDate: moment$
|
|
6437
|
+
React__default.createElement(DatePicker, { label: "Current Date", timezone: "UTC", format: "MM/DD/YYYY", maxDate: moment$g(), closeOnSelect: true, formatDensity: "dense", value: moment$g(shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentProductionDate), onChange: function (date) {
|
|
6432
6438
|
if (date) {
|
|
6433
6439
|
getShiftDataFromAPI(date.toDate(), 0).then(function () { });
|
|
6434
6440
|
}
|
|
@@ -6510,8 +6516,8 @@ var getShiftsRangeByParameters = function (period_1) {
|
|
|
6510
6516
|
if (resp.ok) {
|
|
6511
6517
|
data = resp.data;
|
|
6512
6518
|
data.tables[0].rows.map(function (shift) {
|
|
6513
|
-
shift.Start = moment$
|
|
6514
|
-
shift.End = moment$
|
|
6519
|
+
shift.Start = moment$g.utc(shift["Start"]).toDate();
|
|
6520
|
+
shift.End = moment$g.utc(shift["End"]).toDate();
|
|
6515
6521
|
});
|
|
6516
6522
|
return [2 /*return*/, {
|
|
6517
6523
|
ok: true,
|
|
@@ -6561,13 +6567,13 @@ var ShiftPeriodNavigatorControl = function (_a) {
|
|
|
6561
6567
|
case 1:
|
|
6562
6568
|
_a.trys.push([1, 6, , 7]);
|
|
6563
6569
|
if (!(direction === "prev" && (startShift === null || startShift === void 0 ? void 0 : startShift.Start))) return [3 /*break*/, 3];
|
|
6564
|
-
return [4 /*yield*/, searchShiftsRangeByParameters(period, moment$
|
|
6570
|
+
return [4 /*yield*/, searchShiftsRangeByParameters(period, moment$g(startShift.Start).toDate(), null, false, "prev")];
|
|
6565
6571
|
case 2:
|
|
6566
6572
|
_a.sent();
|
|
6567
6573
|
return [3 /*break*/, 5];
|
|
6568
6574
|
case 3:
|
|
6569
6575
|
if (!(direction === "next" && (endShift === null || endShift === void 0 ? void 0 : endShift.End))) return [3 /*break*/, 5];
|
|
6570
|
-
return [4 /*yield*/, searchShiftsRangeByParameters(period, null, moment$
|
|
6576
|
+
return [4 /*yield*/, searchShiftsRangeByParameters(period, null, moment$g(endShift.End).toDate(), false, "next")];
|
|
6571
6577
|
case 4:
|
|
6572
6578
|
_a.sent();
|
|
6573
6579
|
_a.label = 5;
|
|
@@ -6723,8 +6729,8 @@ var ShiftPeriodNavigatorControl = function (_a) {
|
|
|
6723
6729
|
newPeriod = event.target.value;
|
|
6724
6730
|
setPeriod(newPeriod);
|
|
6725
6731
|
if (!(newPeriod === "Custom")) return [3 /*break*/, 2];
|
|
6726
|
-
today = moment$
|
|
6727
|
-
yesterday = moment$
|
|
6732
|
+
today = moment$g();
|
|
6733
|
+
yesterday = moment$g().subtract(1, "day");
|
|
6728
6734
|
setCustomStartDate(yesterday);
|
|
6729
6735
|
setCustomEndDate(today);
|
|
6730
6736
|
return [4 /*yield*/, searchShiftsRangeByParameters("Custom", yesterday.toDate(), today.toDate(), false)];
|
|
@@ -6734,7 +6740,7 @@ var ShiftPeriodNavigatorControl = function (_a) {
|
|
|
6734
6740
|
case 2:
|
|
6735
6741
|
setCustomStartDate(null);
|
|
6736
6742
|
setCustomEndDate(null);
|
|
6737
|
-
return [4 /*yield*/, searchShiftsRangeByParameters(newPeriod, null, (endShift === null || endShift === void 0 ? void 0 : endShift.Start) ? moment$
|
|
6743
|
+
return [4 /*yield*/, searchShiftsRangeByParameters(newPeriod, null, (endShift === null || endShift === void 0 ? void 0 : endShift.Start) ? moment$g(endShift.Start).toDate() : null, false)];
|
|
6738
6744
|
case 3:
|
|
6739
6745
|
_a.sent();
|
|
6740
6746
|
_a.label = 4;
|
|
@@ -6798,10 +6804,10 @@ var ShiftPeriodNavigatorControl = function (_a) {
|
|
|
6798
6804
|
},
|
|
6799
6805
|
} },
|
|
6800
6806
|
React__default.createElement(DatePicker$1, { label: "Start", format: dateFormat, value: isCustomMode
|
|
6801
|
-
? customStartDate || moment$
|
|
6802
|
-
: moment$
|
|
6803
|
-
return handleDateChange(value ? moment$
|
|
6804
|
-
}, disabled: loadingShiftPeriodList, maxDate: isCustomMode ? moment$
|
|
6807
|
+
? customStartDate || moment$g().subtract(1, "day")
|
|
6808
|
+
: moment$g((startShift === null || startShift === void 0 ? void 0 : startShift.Start) || moment$g().subtract(1, "day")), onChange: function (value) {
|
|
6809
|
+
return handleDateChange(value ? moment$g(value) : null, "start");
|
|
6810
|
+
}, disabled: loadingShiftPeriodList, maxDate: isCustomMode ? moment$g() : undefined, enableAccessibleFieldDOMStructure: false, slots: {
|
|
6805
6811
|
textField: function (props) { return (React__default.createElement(TextField, __assign({}, props, { size: "small", variant: "outlined", fullWidth: true, style: { width: "100%" }, InputProps: __assign(__assign({}, props.InputProps), { style: { paddingTop: "2px" } }) }))); },
|
|
6806
6812
|
openPickerIcon: function () { return (React__default.createElement("div", { style: {
|
|
6807
6813
|
display: "flex",
|
|
@@ -6843,10 +6849,10 @@ var ShiftPeriodNavigatorControl = function (_a) {
|
|
|
6843
6849
|
},
|
|
6844
6850
|
} },
|
|
6845
6851
|
React__default.createElement(DatePicker$1, { label: "End", format: dateFormat, value: isCustomMode
|
|
6846
|
-
? customEndDate || moment$
|
|
6847
|
-
: moment$
|
|
6848
|
-
return handleDateChange(value ? moment$
|
|
6849
|
-
}, disabled: loadingShiftPeriodList, minDate: isCustomMode && customStartDate ? customStartDate : undefined, maxDate: isCustomMode ? moment$
|
|
6852
|
+
? customEndDate || moment$g()
|
|
6853
|
+
: moment$g((endShift === null || endShift === void 0 ? void 0 : endShift.End) || (endShift === null || endShift === void 0 ? void 0 : endShift.Start) || moment$g()), onChange: function (value) {
|
|
6854
|
+
return handleDateChange(value ? moment$g(value) : null, "end");
|
|
6855
|
+
}, disabled: loadingShiftPeriodList, minDate: isCustomMode && customStartDate ? customStartDate : undefined, maxDate: isCustomMode ? moment$g() : undefined, enableAccessibleFieldDOMStructure: false, slots: {
|
|
6850
6856
|
textField: function (props) { return (React__default.createElement(TextField, __assign({}, props, { size: "small", variant: "outlined", fullWidth: true, style: { width: "100%" }, InputProps: __assign(__assign({}, props.InputProps), { style: { paddingTop: "2px" } }) }))); },
|
|
6851
6857
|
openPickerIcon: function () { return (React__default.createElement("div", { style: {
|
|
6852
6858
|
display: "flex",
|
|
@@ -7526,15 +7532,15 @@ var getJobs = function () { return __awaiter(void 0, void 0, void 0, function ()
|
|
|
7526
7532
|
if (resp.ok) {
|
|
7527
7533
|
rows = get(resp, "data.tables[0].rows", []);
|
|
7528
7534
|
rows = rows.map(function (job) { return (__assign(__assign({}, job), { LastStarted: job.LastStarted
|
|
7529
|
-
? moment$
|
|
7535
|
+
? moment$f.utc(job["LastStarted"]).toDate()
|
|
7530
7536
|
: null, LastContact: job.LastContact
|
|
7531
|
-
? moment$
|
|
7537
|
+
? moment$f.utc(job["LastContact"]).toDate()
|
|
7532
7538
|
: null, LastCounter: job.LastCounter
|
|
7533
|
-
? moment$
|
|
7534
|
-
: null, StartTime: job.StartTime ? moment$
|
|
7535
|
-
? moment$
|
|
7539
|
+
? moment$f.utc(job["LastCounter"]).toDate()
|
|
7540
|
+
: null, StartTime: job.StartTime ? moment$f.utc(job["StartTime"]).toDate() : null, NextExecutionTime: job.NextExecutionTime
|
|
7541
|
+
? moment$f.utc(job["NextExecutionTime"]).toDate()
|
|
7536
7542
|
: null, LastExecutionTime: job.LastExecutionTime
|
|
7537
|
-
? moment$
|
|
7543
|
+
? moment$f.utc(job["LastExecutionTime"]).toDate()
|
|
7538
7544
|
: null })); });
|
|
7539
7545
|
return [2 /*return*/, rows];
|
|
7540
7546
|
}
|
|
@@ -7794,7 +7800,7 @@ var JobDetails = function (_a) {
|
|
|
7794
7800
|
React__default.createElement(Controller, { name: "StartTime", control: control, render: function (_a) {
|
|
7795
7801
|
var field = _a.field, error = _a.fieldState.error;
|
|
7796
7802
|
return (React__default.createElement(React__default.Fragment, null,
|
|
7797
|
-
React__default.createElement(DateTimePicker, { label: "Start Time", value: field.value ? moment$
|
|
7803
|
+
React__default.createElement(DateTimePicker, { label: "Start Time", value: field.value ? moment$g(field.value) : null, onChange: field.onChange, format: "MM/DD/YYYY HH:mm:ss", views: ["year", "month", "day", "hours", "minutes"], ampm: false, timezone: TimeService.getInstance().getServerTimeZone(), slotProps: {
|
|
7798
7804
|
textField: {
|
|
7799
7805
|
size: "small",
|
|
7800
7806
|
margin: "none",
|
|
@@ -7812,7 +7818,7 @@ var JobDetails = function (_a) {
|
|
|
7812
7818
|
React__default.createElement(Grid2, { size: { xs: 12, md: 6 } },
|
|
7813
7819
|
React__default.createElement(Controller, { name: "LastExecutionTime", control: control, render: function (_a) {
|
|
7814
7820
|
var field = _a.field;
|
|
7815
|
-
return (React__default.createElement(DateTimePicker, { label: "Last Execution Time", value: field.value ? moment$
|
|
7821
|
+
return (React__default.createElement(DateTimePicker, { label: "Last Execution Time", value: field.value ? moment$g(field.value) : null, format: "MM/DD/YYYY HH:mm:ss", views: ["year", "month", "day", "hours", "minutes"], ampm: false, timezone: TimeService.getInstance().getServerTimeZone(), disabled: true, slotProps: {
|
|
7816
7822
|
textField: {
|
|
7817
7823
|
size: "small",
|
|
7818
7824
|
margin: "none",
|
|
@@ -7823,7 +7829,7 @@ var JobDetails = function (_a) {
|
|
|
7823
7829
|
React__default.createElement(Grid2, { size: { xs: 12, md: 6 } },
|
|
7824
7830
|
React__default.createElement(Controller, { name: "NextExecutionTime", control: control, render: function (_a) {
|
|
7825
7831
|
var field = _a.field;
|
|
7826
|
-
return (React__default.createElement(DateTimePicker, { label: "Next Execution Time", value: field.value ? moment$
|
|
7832
|
+
return (React__default.createElement(DateTimePicker, { label: "Next Execution Time", value: field.value ? moment$g(field.value) : null, format: "MM/DD/YYYY HH:mm:ss", views: ["year", "month", "day", "hours", "minutes"], ampm: false, timezone: TimeService.getInstance().getServerTimeZone(), disabled: true, slotProps: {
|
|
7827
7833
|
textField: {
|
|
7828
7834
|
size: "small",
|
|
7829
7835
|
margin: "none",
|
|
@@ -7947,7 +7953,7 @@ var useJobsTableData = function (_a) {
|
|
|
7947
7953
|
headerName: "Next Execution",
|
|
7948
7954
|
valueFormatter: function (_a) {
|
|
7949
7955
|
var value = _a.value;
|
|
7950
|
-
return value === null ? "" : moment$
|
|
7956
|
+
return value === null ? "" : moment$f(value).format("DD/MM/YY HH:mm");
|
|
7951
7957
|
},
|
|
7952
7958
|
flex: 2,
|
|
7953
7959
|
},
|
|
@@ -8275,7 +8281,7 @@ var CodeFilter = function (_a) {
|
|
|
8275
8281
|
var DateFilter = function (_a) {
|
|
8276
8282
|
var date = _a.date, setDate = _a.setDate, _b = _a.label, label = _b === void 0 ? "Date" : _b, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
8277
8283
|
return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterMoment },
|
|
8278
|
-
React__default.createElement(DatePicker$1, { format: "MM/DD/YYYY", minDate: minDate ? moment$
|
|
8284
|
+
React__default.createElement(DatePicker$1, { format: "MM/DD/YYYY", minDate: minDate ? moment$f(minDate) : undefined, maxDate: maxDate ? moment$f(maxDate) : undefined, sx: {
|
|
8279
8285
|
minWidth: "100%",
|
|
8280
8286
|
borderTopLeftRadius: 3,
|
|
8281
8287
|
borderTopRightRadius: 3,
|
|
@@ -8285,7 +8291,7 @@ var DateFilter = function (_a) {
|
|
|
8285
8291
|
size: "small",
|
|
8286
8292
|
fullWidth: true,
|
|
8287
8293
|
},
|
|
8288
|
-
}, label: label, value: date ? moment$
|
|
8294
|
+
}, label: label, value: date ? moment$f(date) : null, onChange: function (newDate) { return setDate(newDate ? newDate.toDate() : null); } })));
|
|
8289
8295
|
};
|
|
8290
8296
|
|
|
8291
8297
|
var SearchFilter = function (_a) {
|
|
@@ -8397,7 +8403,7 @@ var getLogs = function (_a) { return __awaiter(void 0, [_a], void 0, function (_
|
|
|
8397
8403
|
resp = _c.sent();
|
|
8398
8404
|
if (resp.ok) {
|
|
8399
8405
|
rows = get(resp, "data.tables[0].rows", []);
|
|
8400
|
-
rows = rows.map(function (log) { return (__assign(__assign({}, log), { Timestamp: log.Timestamp ? moment$
|
|
8406
|
+
rows = rows.map(function (log) { return (__assign(__assign({}, log), { Timestamp: log.Timestamp ? moment$f.utc(log["Timestamp"]).toDate() : null })); });
|
|
8401
8407
|
return [2 /*return*/, rows];
|
|
8402
8408
|
}
|
|
8403
8409
|
else {
|
|
@@ -8526,8 +8532,8 @@ var getLogTypeByCodeId = function (logTypeCodeId) {
|
|
|
8526
8532
|
return get(LOG_TYPE_CODES, "".concat(logTypeCodeId, ".description"), " -");
|
|
8527
8533
|
};
|
|
8528
8534
|
var TableLogs = function () {
|
|
8529
|
-
var _a = useState(moment$
|
|
8530
|
-
var _b = useState(moment$
|
|
8535
|
+
var _a = useState(moment$f().add(-5, "days").hour(0).minute(0).second(0).toDate()), startDate = _a[0], setStartDate = _a[1];
|
|
8536
|
+
var _b = useState(moment$f().hour(23).minute(59).second(59).toDate()), endDate = _b[0], setEndDate = _b[1];
|
|
8531
8537
|
var _c = useState("UTC"), timezone = _c[0], setTimezone = _c[1];
|
|
8532
8538
|
var _d = useState(""), search = _d[0], setSearch = _d[1];
|
|
8533
8539
|
var _e = useState(["I", "W", "E"]), logTypeCode = _e[0], setLogTypeCode = _e[1];
|
|
@@ -8550,7 +8556,7 @@ var TableLogs = function () {
|
|
|
8550
8556
|
return ({
|
|
8551
8557
|
id: LogId,
|
|
8552
8558
|
Timestamp: timezone === "UTC"
|
|
8553
|
-
? moment$
|
|
8559
|
+
? moment$f(Timestamp).utc().format("YYYY-MM-DD HH:mm:ss z")
|
|
8554
8560
|
: dxtToLocalServerTime(Timestamp, "yyyy-MM-dd HH:mm:ss z"),
|
|
8555
8561
|
Source: Source,
|
|
8556
8562
|
Message: isNil(Message) ? "" : Message.replaceAll("Added", " Added"),
|
|
@@ -8576,8 +8582,8 @@ var TableLogs = function () {
|
|
|
8576
8582
|
var _m = useContextMenuMESF(), showContextMenu = _m.showContextMenu, registerConfig = _m.registerConfig;
|
|
8577
8583
|
var handleResetButtonClick = function () {
|
|
8578
8584
|
resetFilter();
|
|
8579
|
-
setStartDate(moment$
|
|
8580
|
-
setEndDate(moment$
|
|
8585
|
+
setStartDate(moment$f().add(-5, "days").hour(0).minute(0).second(0).toDate());
|
|
8586
|
+
setEndDate(moment$f().hour(23).minute(59).second(59).toDate());
|
|
8581
8587
|
setSearch("");
|
|
8582
8588
|
gridAPI === null || gridAPI === void 0 ? void 0 : gridAPI.setGridOption("quickFilterText", "");
|
|
8583
8589
|
setLogTypeCode(["I", "W", "E"]);
|
|
@@ -8586,8 +8592,8 @@ var TableLogs = function () {
|
|
|
8586
8592
|
};
|
|
8587
8593
|
// Btn reset data
|
|
8588
8594
|
var resetFilter = function () {
|
|
8589
|
-
setStartDate(moment$
|
|
8590
|
-
setEndDate(moment$
|
|
8595
|
+
setStartDate(moment$f().add(-5, "days").hour(0).minute(0).second(0).toDate());
|
|
8596
|
+
setEndDate(moment$f().hour(23).minute(59).second(59).toDate());
|
|
8591
8597
|
setSearch("");
|
|
8592
8598
|
gridAPI === null || gridAPI === void 0 ? void 0 : gridAPI.setGridOption("quickFilterText", "");
|
|
8593
8599
|
setLogTypeCode(["I", "W", "E"]);
|
|
@@ -8672,7 +8678,7 @@ var TableLogs = function () {
|
|
|
8672
8678
|
setEndDate(null);
|
|
8673
8679
|
}
|
|
8674
8680
|
else {
|
|
8675
|
-
setEndDate(moment$
|
|
8681
|
+
setEndDate(moment$f().hour(23).minute(59).second(59).toDate());
|
|
8676
8682
|
}
|
|
8677
8683
|
setAutoRefresh(checked);
|
|
8678
8684
|
} })),
|
|
@@ -8868,14 +8874,14 @@ var CreateShift = function (_a) {
|
|
|
8868
8874
|
minWidth: "100%",
|
|
8869
8875
|
borderTopLeftRadius: 3,
|
|
8870
8876
|
borderTopRightRadius: 3,
|
|
8871
|
-
}, label: "Start", value: value ? moment$
|
|
8877
|
+
}, label: "Start", value: value ? moment$f(value) : value, onChange: function (evt) { return onChange(evt === null || evt === void 0 ? void 0 : evt.toDate()); }, slotProps: {
|
|
8872
8878
|
textField: {
|
|
8873
8879
|
fullWidth: true,
|
|
8874
8880
|
variant: "standard",
|
|
8875
8881
|
},
|
|
8876
8882
|
} })),
|
|
8877
8883
|
React.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
8878
|
-
React.createElement(DatePicker$1, { label: "Time", value: value ? moment$
|
|
8884
|
+
React.createElement(DatePicker$1, { label: "Time", value: value ? moment$f(value) : value, onChange: function (evt) { return onChange(evt === null || evt === void 0 ? void 0 : evt.toDate()); }, slotProps: {
|
|
8879
8885
|
textField: {
|
|
8880
8886
|
fullWidth: true,
|
|
8881
8887
|
variant: "standard",
|
|
@@ -9098,7 +9104,7 @@ var DeleteShift = function (_a) {
|
|
|
9098
9104
|
minWidth: "100%",
|
|
9099
9105
|
borderTopLeftRadius: 3,
|
|
9100
9106
|
borderTopRightRadius: 3,
|
|
9101
|
-
}, label: "Start", value: value ? moment$
|
|
9107
|
+
}, label: "Start", value: value ? moment$f(value) : value, onChange: function (evt) { return onChange(evt === null || evt === void 0 ? void 0 : evt.toDate()); }, slotProps: {
|
|
9102
9108
|
textField: {
|
|
9103
9109
|
fullWidth: true,
|
|
9104
9110
|
variant: "standard",
|
|
@@ -9106,7 +9112,7 @@ var DeleteShift = function (_a) {
|
|
|
9106
9112
|
},
|
|
9107
9113
|
} })),
|
|
9108
9114
|
React.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
9109
|
-
React.createElement(DatePicker$1, { label: "Time", value: value ? moment$
|
|
9115
|
+
React.createElement(DatePicker$1, { label: "Time", value: value ? moment$f(value) : value, onChange: function (evt) { return onChange(evt === null || evt === void 0 ? void 0 : evt.toDate()); }, slotProps: {
|
|
9110
9116
|
textField: {
|
|
9111
9117
|
fullWidth: true,
|
|
9112
9118
|
variant: "standard",
|
|
@@ -9267,14 +9273,14 @@ var EditShift = function (_a) {
|
|
|
9267
9273
|
minWidth: "100%",
|
|
9268
9274
|
borderTopLeftRadius: 3,
|
|
9269
9275
|
borderTopRightRadius: 3,
|
|
9270
|
-
}, label: "Start", value: value ? moment$
|
|
9276
|
+
}, label: "Start", value: value ? moment$f(value) : value, onChange: function (evt) { return onChange(evt === null || evt === void 0 ? void 0 : evt.toDate()); }, slotProps: {
|
|
9271
9277
|
textField: {
|
|
9272
9278
|
fullWidth: true,
|
|
9273
9279
|
variant: "standard",
|
|
9274
9280
|
},
|
|
9275
9281
|
} })),
|
|
9276
9282
|
React.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
9277
|
-
React.createElement(DatePicker$1, { label: "Time", value: value ? moment$
|
|
9283
|
+
React.createElement(DatePicker$1, { label: "Time", value: value ? moment$f(value) : value, onChange: function (evt) { return onChange(evt === null || evt === void 0 ? void 0 : evt.toDate()); }, slotProps: {
|
|
9278
9284
|
textField: {
|
|
9279
9285
|
fullWidth: true,
|
|
9280
9286
|
variant: "standard",
|
|
@@ -9466,7 +9472,7 @@ var useShiftsOptionsFunctions = function (_a) {
|
|
|
9466
9472
|
};
|
|
9467
9473
|
};
|
|
9468
9474
|
|
|
9469
|
-
var useTableData$
|
|
9475
|
+
var useTableData$5 = function (_a) {
|
|
9470
9476
|
var setShiftSelected = _a.setShiftSelected, setOpenModalEditShift = _a.setOpenModalEditShift, setOpenModalDeleteShift = _a.setOpenModalDeleteShift, showContextMenu = _a.showContextMenu;
|
|
9471
9477
|
var columnDefs = [
|
|
9472
9478
|
{
|
|
@@ -9474,7 +9480,7 @@ var useTableData$3 = function (_a) {
|
|
|
9474
9480
|
headerName: "Pattern Start",
|
|
9475
9481
|
valueFormatter: function (_a) {
|
|
9476
9482
|
var value = _a.value;
|
|
9477
|
-
return "".concat(moment$
|
|
9483
|
+
return "".concat(moment$f(value).format("L"), ", ").concat(moment$f(value).format("LTS"));
|
|
9478
9484
|
},
|
|
9479
9485
|
minWidth: 180,
|
|
9480
9486
|
flex: 4,
|
|
@@ -9615,7 +9621,7 @@ var TableShiftsCrews = function () {
|
|
|
9615
9621
|
setShowEditModal: setOpenModalEditShift,
|
|
9616
9622
|
}).getMenuOptions;
|
|
9617
9623
|
var _g = useContextMenuMESF(), showContextMenu = _g.showContextMenu, registerConfig = _g.registerConfig;
|
|
9618
|
-
var columnDefs = useTableData$
|
|
9624
|
+
var columnDefs = useTableData$5({
|
|
9619
9625
|
setShiftSelected: setShiftSelected,
|
|
9620
9626
|
setOpenModalEditShift: setOpenModalEditShift,
|
|
9621
9627
|
setOpenModalDeleteShift: setOpenModalDeleteShift,
|
|
@@ -9831,6 +9837,16 @@ var LogbookSettingsInitialState = {
|
|
|
9831
9837
|
showShiftCrew: false,
|
|
9832
9838
|
exportToExcel: false,
|
|
9833
9839
|
},
|
|
9840
|
+
section: {
|
|
9841
|
+
schema: undefined,
|
|
9842
|
+
withAssetFilter: undefined,
|
|
9843
|
+
filterAssets: undefined,
|
|
9844
|
+
canEditAsset: false,
|
|
9845
|
+
allowAttachments: false,
|
|
9846
|
+
showShiftCrew: false,
|
|
9847
|
+
exportToExcel: false,
|
|
9848
|
+
topSectionsCount: 5,
|
|
9849
|
+
},
|
|
9834
9850
|
};
|
|
9835
9851
|
|
|
9836
9852
|
var LogbookSettingsContext = createContext(LogbookSettingsInitialState);
|
|
@@ -9841,6 +9857,7 @@ var LogbookSettingsProvider = function (_a) {
|
|
|
9841
9857
|
var settings = useMemo(function () { return ({
|
|
9842
9858
|
entry: __assign(__assign({}, LogbookSettingsInitialState.entry), (logbookSettings.entry || {})),
|
|
9843
9859
|
report: __assign(__assign({}, LogbookSettingsInitialState.report), (logbookSettings.report || {})),
|
|
9860
|
+
section: __assign(__assign({}, LogbookSettingsInitialState.section), (logbookSettings.section || {})),
|
|
9844
9861
|
}); }, [logbookSettings]);
|
|
9845
9862
|
return (React__default.createElement(LogbookSettingsContext.Provider, { value: settings }, children));
|
|
9846
9863
|
};
|
|
@@ -9898,7 +9915,7 @@ var useSettingsOptionsFunctions = function (_a) {
|
|
|
9898
9915
|
};
|
|
9899
9916
|
};
|
|
9900
9917
|
|
|
9901
|
-
var useTableData$
|
|
9918
|
+
var useTableData$4 = function (_a) {
|
|
9902
9919
|
var setOpenModalEditSetting = _a.setOpenModalEditSetting, setOpenModalDeleteSetting = _a.setOpenModalDeleteSetting, showContextMenu = _a.showContextMenu, setSettingSelected = _a.setSettingSelected;
|
|
9903
9920
|
var columnDefs = [
|
|
9904
9921
|
{
|
|
@@ -10321,7 +10338,7 @@ var TableSettings = function () {
|
|
|
10321
10338
|
setShowCreateModal: setOpenModalNew,
|
|
10322
10339
|
setShowEditModal: setOpenModalEditSetting,
|
|
10323
10340
|
}).getMenuOptions;
|
|
10324
|
-
var _k = useTableData$
|
|
10341
|
+
var _k = useTableData$4({
|
|
10325
10342
|
setOpenModalEditSetting: setOpenModalEditSetting,
|
|
10326
10343
|
setOpenModalDeleteSetting: setOpenModalDeleteSetting,
|
|
10327
10344
|
showContextMenu: showContextMenu,
|
|
@@ -11013,7 +11030,7 @@ var renderInput = function (param, onChange, disabled) {
|
|
|
11013
11030
|
}, disabled: disabled, fullWidth: true, size: "small", inputProps: { step: "any" } }));
|
|
11014
11031
|
}
|
|
11015
11032
|
if (["datetime", "datetime2", "date", "smalldatetime"].includes(type)) {
|
|
11016
|
-
return (React__default.createElement(DateTimePicker$1, { label: param.parameterName, value: param.value ? moment$
|
|
11033
|
+
return (React__default.createElement(DateTimePicker$1, { label: param.parameterName, value: param.value ? moment$f(param.value) : null, onChange: function (newValue) { return onChange((newValue === null || newValue === void 0 ? void 0 : newValue.toDate()) || null); }, disabled: disabled, slotProps: {
|
|
11017
11034
|
textField: {
|
|
11018
11035
|
fullWidth: true,
|
|
11019
11036
|
size: "small",
|
|
@@ -12118,21 +12135,21 @@ var dateNavigator = function (startDate, endDate, scope, operator, current) {
|
|
|
12118
12135
|
}
|
|
12119
12136
|
else {
|
|
12120
12137
|
var _a = scope.split(" "), quantity = _a[0], duration = _a[1];
|
|
12121
|
-
newStartDate = moment$
|
|
12138
|
+
newStartDate = moment$f(newEndDate)
|
|
12122
12139
|
.subtract(quantity, duration[0])
|
|
12123
12140
|
.toDate();
|
|
12124
12141
|
}
|
|
12125
12142
|
}
|
|
12126
12143
|
else {
|
|
12127
12144
|
if (scope === "custom") {
|
|
12128
|
-
var durationInMs = moment$
|
|
12129
|
-
newStartDate = moment$
|
|
12145
|
+
var durationInMs = moment$f(endDate).diff(moment$f(startDate));
|
|
12146
|
+
newStartDate = moment$f(startDate)[operator](durationInMs).toDate();
|
|
12130
12147
|
}
|
|
12131
12148
|
else {
|
|
12132
12149
|
var _b = scope.split(" "), quantity = _b[0], duration = _b[1];
|
|
12133
|
-
newStartDate = moment$
|
|
12150
|
+
newStartDate = moment$f(startDate)[operator](quantity, duration[0])
|
|
12134
12151
|
.toDate();
|
|
12135
|
-
newEndDate = moment$
|
|
12152
|
+
newEndDate = moment$f(endDate)[operator](quantity, duration[0])
|
|
12136
12153
|
.toDate();
|
|
12137
12154
|
}
|
|
12138
12155
|
}
|
|
@@ -12575,11 +12592,11 @@ var HeaderSectionV2 = React__default.memo(function (_a) {
|
|
|
12575
12592
|
};
|
|
12576
12593
|
var handlePartialDateNavigator = function (operator) {
|
|
12577
12594
|
// Calculate 20% of the current period
|
|
12578
|
-
var durationInMs = moment$
|
|
12595
|
+
var durationInMs = moment$f(timeScopeEnd).diff(moment$f(timeScopeStart));
|
|
12579
12596
|
var partialDuration = Math.round(durationInMs * 0.2);
|
|
12580
|
-
var newStartDate = moment$
|
|
12597
|
+
var newStartDate = moment$f(timeScopeStart)[operator](partialDuration, "milliseconds")
|
|
12581
12598
|
.toDate();
|
|
12582
|
-
var newEndDate = moment$
|
|
12599
|
+
var newEndDate = moment$f(timeScopeEnd)[operator](partialDuration, "milliseconds")
|
|
12583
12600
|
.toDate();
|
|
12584
12601
|
setTotalScope({
|
|
12585
12602
|
start: newStartDate,
|
|
@@ -12589,7 +12606,7 @@ var HeaderSectionV2 = React__default.memo(function (_a) {
|
|
|
12589
12606
|
};
|
|
12590
12607
|
var handleDateChange = function (newValue, key) {
|
|
12591
12608
|
var _a, _b;
|
|
12592
|
-
var newDate = moment$
|
|
12609
|
+
var newDate = moment$f(newValue).toDate();
|
|
12593
12610
|
// If scope is "custom", just update the changed date
|
|
12594
12611
|
if (scope === "custom") {
|
|
12595
12612
|
setTotalScope((_a = {}, _a[key] = newDate, _a));
|
|
@@ -12705,7 +12722,7 @@ var HeaderSectionV2 = React__default.memo(function (_a) {
|
|
|
12705
12722
|
React__default.createElement(FastRewind, { fontSize: "medium", sx: { color: "black" } })))),
|
|
12706
12723
|
React__default.createElement(Grid2, { size: { md: 3.5 } },
|
|
12707
12724
|
React__default.createElement(LocalizationProvider$1, { dateAdapter: AdapterMoment },
|
|
12708
|
-
React__default.createElement(DateTimePicker, { label: "Start", format: "MM/DD/YYYY HH:mm:ss", value: moment$
|
|
12725
|
+
React__default.createElement(DateTimePicker, { label: "Start", format: "MM/DD/YYYY HH:mm:ss", value: moment$f(timeScopeStart), onChange: function (newValue) {
|
|
12709
12726
|
if (newValue) {
|
|
12710
12727
|
handleDateChange(newValue.toDate(), "start");
|
|
12711
12728
|
}
|
|
@@ -12730,7 +12747,7 @@ var HeaderSectionV2 = React__default.memo(function (_a) {
|
|
|
12730
12747
|
React__default.createElement(MenuItem, { value: "custom" }, "Custom")))),
|
|
12731
12748
|
React__default.createElement(Grid2, { size: { md: 3.5 } },
|
|
12732
12749
|
React__default.createElement(LocalizationProvider$1, { dateAdapter: AdapterMoment },
|
|
12733
|
-
React__default.createElement(DateTimePicker, { label: "End", format: "MM/DD/YYYY HH:mm:ss", value: autoRefresh ? null : moment$
|
|
12750
|
+
React__default.createElement(DateTimePicker, { label: "End", format: "MM/DD/YYYY HH:mm:ss", value: autoRefresh ? null : moment$f(timeScopeEnd), onChange: function (newValue) {
|
|
12734
12751
|
if (newValue) {
|
|
12735
12752
|
handleDateChange(newValue.toDate(), "end");
|
|
12736
12753
|
}
|
|
@@ -16636,7 +16653,7 @@ const FORMATS = {
|
|
|
16636
16653
|
year: 'YYYY'
|
|
16637
16654
|
};
|
|
16638
16655
|
|
|
16639
|
-
_adapters._date.override(typeof moment$
|
|
16656
|
+
_adapters._date.override(typeof moment$f === 'function' ? {
|
|
16640
16657
|
_id: 'moment', // DEBUG ONLY
|
|
16641
16658
|
|
|
16642
16659
|
formats: function() {
|
|
@@ -16645,27 +16662,27 @@ _adapters._date.override(typeof moment$8 === 'function' ? {
|
|
|
16645
16662
|
|
|
16646
16663
|
parse: function(value, format) {
|
|
16647
16664
|
if (typeof value === 'string' && typeof format === 'string') {
|
|
16648
|
-
value = moment$
|
|
16649
|
-
} else if (!(value instanceof moment$
|
|
16650
|
-
value = moment$
|
|
16665
|
+
value = moment$f(value, format);
|
|
16666
|
+
} else if (!(value instanceof moment$f)) {
|
|
16667
|
+
value = moment$f(value);
|
|
16651
16668
|
}
|
|
16652
16669
|
return value.isValid() ? value.valueOf() : null;
|
|
16653
16670
|
},
|
|
16654
16671
|
|
|
16655
16672
|
format: function(time, format) {
|
|
16656
|
-
return moment$
|
|
16673
|
+
return moment$f(time).format(format);
|
|
16657
16674
|
},
|
|
16658
16675
|
|
|
16659
16676
|
add: function(time, amount, unit) {
|
|
16660
|
-
return moment$
|
|
16677
|
+
return moment$f(time).add(amount, unit).valueOf();
|
|
16661
16678
|
},
|
|
16662
16679
|
|
|
16663
16680
|
diff: function(max, min, unit) {
|
|
16664
|
-
return moment$
|
|
16681
|
+
return moment$f(max).diff(moment$f(min), unit);
|
|
16665
16682
|
},
|
|
16666
16683
|
|
|
16667
16684
|
startOf: function(time, unit, weekday) {
|
|
16668
|
-
time = moment$
|
|
16685
|
+
time = moment$f(time);
|
|
16669
16686
|
if (unit === 'isoWeek') {
|
|
16670
16687
|
weekday = Math.trunc(Math.min(Math.max(0, weekday), 6));
|
|
16671
16688
|
return time.isoWeekday(weekday).startOf('day').valueOf();
|
|
@@ -16674,7 +16691,7 @@ _adapters._date.override(typeof moment$8 === 'function' ? {
|
|
|
16674
16691
|
},
|
|
16675
16692
|
|
|
16676
16693
|
endOf: function(time, unit) {
|
|
16677
|
-
return moment$
|
|
16694
|
+
return moment$f(time).endOf(unit).valueOf();
|
|
16678
16695
|
}
|
|
16679
16696
|
} : {});
|
|
16680
16697
|
|
|
@@ -16729,7 +16746,7 @@ var ColorPicker = function (_a) {
|
|
|
16729
16746
|
};
|
|
16730
16747
|
|
|
16731
16748
|
var TrendingsInitialState = {
|
|
16732
|
-
timeScopeStart: moment$
|
|
16749
|
+
timeScopeStart: moment$f(new Date()).subtract(1, "days").toDate(),
|
|
16733
16750
|
timeScopeEnd: new Date(),
|
|
16734
16751
|
scope: "1 day",
|
|
16735
16752
|
graphPan: false,
|
|
@@ -16769,32 +16786,32 @@ var TrendingsReducer = createSlice({
|
|
|
16769
16786
|
if (payload.scope !== "custom") {
|
|
16770
16787
|
switch (payload.scope) {
|
|
16771
16788
|
case "10 min":
|
|
16772
|
-
state.timeScopeStart = moment$
|
|
16789
|
+
state.timeScopeStart = moment$f(state.timeScopeEnd)
|
|
16773
16790
|
.subtract(10, "minutes")
|
|
16774
16791
|
.toDate();
|
|
16775
16792
|
break;
|
|
16776
16793
|
case "1 hour":
|
|
16777
|
-
state.timeScopeStart = moment$
|
|
16794
|
+
state.timeScopeStart = moment$f(state.timeScopeEnd)
|
|
16778
16795
|
.subtract(1, "hours")
|
|
16779
16796
|
.toDate();
|
|
16780
16797
|
break;
|
|
16781
16798
|
case "4 hours":
|
|
16782
|
-
state.timeScopeStart = moment$
|
|
16799
|
+
state.timeScopeStart = moment$f(state.timeScopeEnd)
|
|
16783
16800
|
.subtract(4, "hours")
|
|
16784
16801
|
.toDate();
|
|
16785
16802
|
break;
|
|
16786
16803
|
case "12 hours":
|
|
16787
|
-
state.timeScopeStart = moment$
|
|
16804
|
+
state.timeScopeStart = moment$f(state.timeScopeEnd)
|
|
16788
16805
|
.subtract(12, "hours")
|
|
16789
16806
|
.toDate();
|
|
16790
16807
|
break;
|
|
16791
16808
|
case "1 day":
|
|
16792
|
-
state.timeScopeStart = moment$
|
|
16809
|
+
state.timeScopeStart = moment$f(state.timeScopeEnd)
|
|
16793
16810
|
.subtract(1, "days")
|
|
16794
16811
|
.toDate();
|
|
16795
16812
|
break;
|
|
16796
16813
|
case "10 days":
|
|
16797
|
-
state.timeScopeStart = moment$
|
|
16814
|
+
state.timeScopeStart = moment$f(state.timeScopeEnd)
|
|
16798
16815
|
.subtract(10, "days")
|
|
16799
16816
|
.toDate();
|
|
16800
16817
|
break;
|
|
@@ -16825,32 +16842,32 @@ var TrendingsReducer = createSlice({
|
|
|
16825
16842
|
if (state.scope !== "custom") {
|
|
16826
16843
|
switch (state.scope) {
|
|
16827
16844
|
case "10 min":
|
|
16828
|
-
state.timeScopeEnd = moment$
|
|
16845
|
+
state.timeScopeEnd = moment$f(payload.start)
|
|
16829
16846
|
.add(10, "minutes")
|
|
16830
16847
|
.toDate();
|
|
16831
16848
|
break;
|
|
16832
16849
|
case "1 hour":
|
|
16833
|
-
state.timeScopeEnd = moment$
|
|
16850
|
+
state.timeScopeEnd = moment$f(payload.start)
|
|
16834
16851
|
.add(1, "hours")
|
|
16835
16852
|
.toDate();
|
|
16836
16853
|
break;
|
|
16837
16854
|
case "4 hours":
|
|
16838
|
-
state.timeScopeEnd = moment$
|
|
16855
|
+
state.timeScopeEnd = moment$f(payload.start)
|
|
16839
16856
|
.add(4, "hours")
|
|
16840
16857
|
.toDate();
|
|
16841
16858
|
break;
|
|
16842
16859
|
case "12 hours":
|
|
16843
|
-
state.timeScopeEnd = moment$
|
|
16860
|
+
state.timeScopeEnd = moment$f(payload.start)
|
|
16844
16861
|
.add(12, "hours")
|
|
16845
16862
|
.toDate();
|
|
16846
16863
|
break;
|
|
16847
16864
|
case "1 day":
|
|
16848
|
-
state.timeScopeEnd = moment$
|
|
16865
|
+
state.timeScopeEnd = moment$f(payload.start)
|
|
16849
16866
|
.add(1, "days")
|
|
16850
16867
|
.toDate();
|
|
16851
16868
|
break;
|
|
16852
16869
|
case "10 days":
|
|
16853
|
-
state.timeScopeEnd = moment$
|
|
16870
|
+
state.timeScopeEnd = moment$f(payload.start)
|
|
16854
16871
|
.add(10, "days")
|
|
16855
16872
|
.toDate();
|
|
16856
16873
|
break;
|
|
@@ -16863,32 +16880,32 @@ var TrendingsReducer = createSlice({
|
|
|
16863
16880
|
if (state.scope !== "custom") {
|
|
16864
16881
|
switch (state.scope) {
|
|
16865
16882
|
case "10 min":
|
|
16866
|
-
state.timeScopeStart = moment$
|
|
16883
|
+
state.timeScopeStart = moment$f(payload.end)
|
|
16867
16884
|
.subtract(10, "minutes")
|
|
16868
16885
|
.toDate();
|
|
16869
16886
|
break;
|
|
16870
16887
|
case "1 hour":
|
|
16871
|
-
state.timeScopeStart = moment$
|
|
16888
|
+
state.timeScopeStart = moment$f(payload.end)
|
|
16872
16889
|
.subtract(1, "hours")
|
|
16873
16890
|
.toDate();
|
|
16874
16891
|
break;
|
|
16875
16892
|
case "4 hours":
|
|
16876
|
-
state.timeScopeStart = moment$
|
|
16893
|
+
state.timeScopeStart = moment$f(payload.end)
|
|
16877
16894
|
.subtract(4, "hours")
|
|
16878
16895
|
.toDate();
|
|
16879
16896
|
break;
|
|
16880
16897
|
case "12 hours":
|
|
16881
|
-
state.timeScopeStart = moment$
|
|
16898
|
+
state.timeScopeStart = moment$f(payload.end)
|
|
16882
16899
|
.subtract(12, "hours")
|
|
16883
16900
|
.toDate();
|
|
16884
16901
|
break;
|
|
16885
16902
|
case "1 day":
|
|
16886
|
-
state.timeScopeStart = moment$
|
|
16903
|
+
state.timeScopeStart = moment$f(payload.end)
|
|
16887
16904
|
.subtract(1, "days")
|
|
16888
16905
|
.toDate();
|
|
16889
16906
|
break;
|
|
16890
16907
|
case "10 days":
|
|
16891
|
-
state.timeScopeStart = moment$
|
|
16908
|
+
state.timeScopeStart = moment$f(payload.end)
|
|
16892
16909
|
.subtract(10, "days")
|
|
16893
16910
|
.toDate();
|
|
16894
16911
|
break;
|
|
@@ -18622,7 +18639,7 @@ var Header = React__default.memo(function (_a) {
|
|
|
18622
18639
|
var handleDateChange = function (newValue, key) {
|
|
18623
18640
|
var _a;
|
|
18624
18641
|
//@ts-ignore
|
|
18625
|
-
actions.setTotalScope((_a = {}, _a[key] = moment$
|
|
18642
|
+
actions.setTotalScope((_a = {}, _a[key] = moment$f(newValue).toDate(), _a));
|
|
18626
18643
|
};
|
|
18627
18644
|
var handleChangeScope = function (value) {
|
|
18628
18645
|
actions.setTotalScope({
|
|
@@ -18661,7 +18678,7 @@ var Header = React__default.memo(function (_a) {
|
|
|
18661
18678
|
} },
|
|
18662
18679
|
React__default.createElement(ChevronLeft, { fontSize: "medium" }))),
|
|
18663
18680
|
React__default.createElement(Grid2, { size: { md: 4 } },
|
|
18664
|
-
React__default.createElement(DateTimePicker, { label: "Start", format: "MM/DD/YYYY HH:mm:ss", value: moment$
|
|
18681
|
+
React__default.createElement(DateTimePicker, { label: "Start", format: "MM/DD/YYYY HH:mm:ss", value: moment$f(state.timeScopeStart), onChange: function (newValue) {
|
|
18665
18682
|
if (newValue) {
|
|
18666
18683
|
handleDateChange(newValue.toDate(), "start");
|
|
18667
18684
|
}
|
|
@@ -18685,7 +18702,7 @@ var Header = React__default.memo(function (_a) {
|
|
|
18685
18702
|
React__default.createElement(MenuItem, { value: "10 days" }, "10 days"),
|
|
18686
18703
|
React__default.createElement(MenuItem, { value: "custom" }, "Custom")))),
|
|
18687
18704
|
React__default.createElement(Grid2, { size: { md: 4 } },
|
|
18688
|
-
React__default.createElement(DateTimePicker, { label: "End", format: "MM/DD/YYYY HH:mm:ss", value: autoRefresh ? null : moment$
|
|
18705
|
+
React__default.createElement(DateTimePicker, { label: "End", format: "MM/DD/YYYY HH:mm:ss", value: autoRefresh ? null : moment$f(state.timeScopeEnd), onChange: function (newValue) {
|
|
18689
18706
|
if (newValue) {
|
|
18690
18707
|
handleDateChange(newValue.toDate(), "end");
|
|
18691
18708
|
}
|
|
@@ -19370,7 +19387,7 @@ var ProvidersLoader = function (_a) {
|
|
|
19370
19387
|
};
|
|
19371
19388
|
|
|
19372
19389
|
var timezone = TimeService.getInstance().getServerTimeZone();
|
|
19373
|
-
moment$
|
|
19390
|
+
moment$g.tz.setDefault(timezone);
|
|
19374
19391
|
var base = document.getElementsByTagName("base")[0].getAttribute("href") || "/";
|
|
19375
19392
|
var queryClient = new QueryClient({
|
|
19376
19393
|
defaultOptions: {
|
|
@@ -19390,7 +19407,7 @@ function MESFMain(_a) {
|
|
|
19390
19407
|
React__default.createElement(HelmetDexteelProvider, { navbarTitle: navbarTitle },
|
|
19391
19408
|
React__default.createElement(QueryClientProvider, { client: queryClient },
|
|
19392
19409
|
React__default.createElement(AuthProvider, { authConfig: authentication },
|
|
19393
|
-
React__default.createElement(LocalizationProvider, { dateAdapter: AdapterMoment, dateLibInstance: moment$
|
|
19410
|
+
React__default.createElement(LocalizationProvider, { dateAdapter: AdapterMoment, dateLibInstance: moment$g },
|
|
19394
19411
|
React__default.createElement(UserProvider, null,
|
|
19395
19412
|
React__default.createElement(UTLSettingsProvider, null,
|
|
19396
19413
|
React__default.createElement(ProvidersLoader, null,
|
|
@@ -19418,7 +19435,7 @@ var CustomStatusPanel = function (_a) {
|
|
|
19418
19435
|
React__default.createElement(PlaylistAddIcon, { style: { width: 30, height: 30 } })));
|
|
19419
19436
|
};
|
|
19420
19437
|
|
|
19421
|
-
var useGridDefinitions = function (_a) {
|
|
19438
|
+
var useGridDefinitions$1 = function (_a) {
|
|
19422
19439
|
_a.OnEdit; _a.OnSend;
|
|
19423
19440
|
var defaultColDef = {
|
|
19424
19441
|
flex: 1,
|
|
@@ -19442,8 +19459,8 @@ var useGridDefinitions = function (_a) {
|
|
|
19442
19459
|
};
|
|
19443
19460
|
};
|
|
19444
19461
|
|
|
19445
|
-
var moment$
|
|
19446
|
-
var getEntries = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
19462
|
+
var moment$e = getMomentTz();
|
|
19463
|
+
var getEntries$1 = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
19447
19464
|
var apiService, parameters, resp, rows;
|
|
19448
19465
|
var shiftId = _b.shiftId, assetId = _b.assetId, signal = _b.signal;
|
|
19449
19466
|
return __generator(this, function (_c) {
|
|
@@ -19462,9 +19479,9 @@ var getEntries = function (_a) { return __awaiter(void 0, [_a], void 0, function
|
|
|
19462
19479
|
if (resp.ok) {
|
|
19463
19480
|
rows = get(resp, "data.tables[0].rows", []);
|
|
19464
19481
|
rows = rows.map(function (entry) { return (__assign(__assign({}, entry), { CreateTimestamp: entry.CreateTimestamp
|
|
19465
|
-
? moment$
|
|
19482
|
+
? moment$e.utc(entry["CreateTimestamp"]).toDate()
|
|
19466
19483
|
: null, UpdateTimestamp: entry.UpdateTimestamp
|
|
19467
|
-
? moment$
|
|
19484
|
+
? moment$e.utc(entry["UpdateTimestamp"]).toDate()
|
|
19468
19485
|
: null })); });
|
|
19469
19486
|
return [2 /*return*/, rows];
|
|
19470
19487
|
}
|
|
@@ -19474,7 +19491,7 @@ var getEntries = function (_a) { return __awaiter(void 0, [_a], void 0, function
|
|
|
19474
19491
|
}
|
|
19475
19492
|
});
|
|
19476
19493
|
}); };
|
|
19477
|
-
var upsertEntry = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
19494
|
+
var upsertEntry$1 = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
19478
19495
|
var apiService, parameters, resp;
|
|
19479
19496
|
var assetId = _b.assetId, entryId = _b.entryId, shiftId = _b.shiftId, title = _b.title, content = _b.content, createTimestamp = _b.createTimestamp, author = _b.author;
|
|
19480
19497
|
return __generator(this, function (_c) {
|
|
@@ -19511,7 +19528,7 @@ var upsertEntry = function (_a) { return __awaiter(void 0, [_a], void 0, functio
|
|
|
19511
19528
|
}
|
|
19512
19529
|
});
|
|
19513
19530
|
}); };
|
|
19514
|
-
var deleteEntry = function (EntryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19531
|
+
var deleteEntry$1 = function (EntryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19515
19532
|
var apiService, attachmentsToDelete, error_1, parameters, resp;
|
|
19516
19533
|
return __generator(this, function (_a) {
|
|
19517
19534
|
switch (_a.label) {
|
|
@@ -19522,7 +19539,7 @@ var deleteEntry = function (EntryId) { return __awaiter(void 0, void 0, void 0,
|
|
|
19522
19539
|
case 1:
|
|
19523
19540
|
_a.trys.push([1, 4, , 5]);
|
|
19524
19541
|
if (!EntryId) return [3 /*break*/, 3];
|
|
19525
|
-
return [4 /*yield*/, getEntryAttachments(EntryId)];
|
|
19542
|
+
return [4 /*yield*/, getEntryAttachments$1(EntryId)];
|
|
19526
19543
|
case 2:
|
|
19527
19544
|
attachmentsToDelete = _a.sent();
|
|
19528
19545
|
_a.label = 3;
|
|
@@ -19542,13 +19559,13 @@ var deleteEntry = function (EntryId) { return __awaiter(void 0, void 0, void 0,
|
|
|
19542
19559
|
}
|
|
19543
19560
|
// Delete associated files in background (don't block the UI)
|
|
19544
19561
|
if (attachmentsToDelete.length > 0) {
|
|
19545
|
-
deleteAttachedFilesInBackground(attachmentsToDelete);
|
|
19562
|
+
deleteAttachedFilesInBackground$1(attachmentsToDelete);
|
|
19546
19563
|
}
|
|
19547
19564
|
return [2 /*return*/];
|
|
19548
19565
|
}
|
|
19549
19566
|
});
|
|
19550
19567
|
}); };
|
|
19551
|
-
var deleteAttachedFilesInBackground = function (attachments) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19568
|
+
var deleteAttachedFilesInBackground$1 = function (attachments) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19552
19569
|
return __generator(this, function (_a) {
|
|
19553
19570
|
// Delete files in background without blocking the UI
|
|
19554
19571
|
Promise.all(attachments.map(function (attachment) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -19557,7 +19574,7 @@ var deleteAttachedFilesInBackground = function (attachments) { return __awaiter(
|
|
|
19557
19574
|
switch (_a.label) {
|
|
19558
19575
|
case 0:
|
|
19559
19576
|
_a.trys.push([0, 2, , 3]);
|
|
19560
|
-
return [4 /*yield*/, deleteUploadFile(attachment.UploadFileId)];
|
|
19577
|
+
return [4 /*yield*/, deleteUploadFile$1(attachment.UploadFileId)];
|
|
19561
19578
|
case 1:
|
|
19562
19579
|
_a.sent();
|
|
19563
19580
|
return [3 /*break*/, 3];
|
|
@@ -19575,7 +19592,7 @@ var deleteAttachedFilesInBackground = function (attachments) { return __awaiter(
|
|
|
19575
19592
|
return [2 /*return*/];
|
|
19576
19593
|
});
|
|
19577
19594
|
}); };
|
|
19578
|
-
var deleteUploadFile = function (uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19595
|
+
var deleteUploadFile$1 = function (uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19579
19596
|
var apiService, parameters, resp;
|
|
19580
19597
|
return __generator(this, function (_a) {
|
|
19581
19598
|
switch (_a.label) {
|
|
@@ -19595,7 +19612,7 @@ var deleteUploadFile = function (uploadFileId) { return __awaiter(void 0, void 0
|
|
|
19595
19612
|
});
|
|
19596
19613
|
}); };
|
|
19597
19614
|
// Attachment management functions
|
|
19598
|
-
var getEntryAttachments = function (entryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19615
|
+
var getEntryAttachments$1 = function (entryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19599
19616
|
var apiService, parameters, resp, rows;
|
|
19600
19617
|
return __generator(this, function (_a) {
|
|
19601
19618
|
switch (_a.label) {
|
|
@@ -19608,7 +19625,7 @@ var getEntryAttachments = function (entryId) { return __awaiter(void 0, void 0,
|
|
|
19608
19625
|
if (resp.ok) {
|
|
19609
19626
|
rows = get(resp, "data.tables[0].rows", []);
|
|
19610
19627
|
rows = rows.map(function (attachment) { return (__assign(__assign({}, attachment), { CreationTime: attachment.CreationTime
|
|
19611
|
-
? moment$
|
|
19628
|
+
? moment$e.utc(attachment.CreationTime).toDate()
|
|
19612
19629
|
: new Date() })); });
|
|
19613
19630
|
return [2 /*return*/, rows];
|
|
19614
19631
|
}
|
|
@@ -19618,7 +19635,7 @@ var getEntryAttachments = function (entryId) { return __awaiter(void 0, void 0,
|
|
|
19618
19635
|
}
|
|
19619
19636
|
});
|
|
19620
19637
|
}); };
|
|
19621
|
-
var upsertEntryAttachment = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
19638
|
+
var upsertEntryAttachment$1 = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
19622
19639
|
var apiService, parameters, resp, attachment;
|
|
19623
19640
|
var entryId = _b.entryId, uploadFileId = _b.uploadFileId, attachmentName = _b.attachmentName, attachmentURL = _b.attachmentURL;
|
|
19624
19641
|
return __generator(this, function (_c) {
|
|
@@ -19638,7 +19655,7 @@ var upsertEntryAttachment = function (_a) { return __awaiter(void 0, [_a], void
|
|
|
19638
19655
|
attachment = get(resp, "data.tables[0].rows[0]", null);
|
|
19639
19656
|
if (attachment) {
|
|
19640
19657
|
return [2 /*return*/, __assign(__assign({}, attachment), { CreationTime: attachment.CreationTime
|
|
19641
|
-
? moment$
|
|
19658
|
+
? moment$e.utc(attachment.CreationTime).toDate()
|
|
19642
19659
|
: new Date() })];
|
|
19643
19660
|
}
|
|
19644
19661
|
return [2 /*return*/, null];
|
|
@@ -19649,7 +19666,7 @@ var upsertEntryAttachment = function (_a) { return __awaiter(void 0, [_a], void
|
|
|
19649
19666
|
}
|
|
19650
19667
|
});
|
|
19651
19668
|
}); };
|
|
19652
|
-
var deleteEntryAttachment = function (entryAttachmentId, uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19669
|
+
var deleteEntryAttachment$1 = function (entryAttachmentId, uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19653
19670
|
var apiService, parameters, resp;
|
|
19654
19671
|
return __generator(this, function (_a) {
|
|
19655
19672
|
switch (_a.label) {
|
|
@@ -19666,19 +19683,19 @@ var deleteEntryAttachment = function (entryAttachmentId, uploadFileId) { return
|
|
|
19666
19683
|
}
|
|
19667
19684
|
// Delete the associated file in background if UploadFileId was provided
|
|
19668
19685
|
if (uploadFileId) {
|
|
19669
|
-
deleteUploadFileInBackground(uploadFileId);
|
|
19686
|
+
deleteUploadFileInBackground$1(uploadFileId);
|
|
19670
19687
|
}
|
|
19671
19688
|
return [2 /*return*/];
|
|
19672
19689
|
}
|
|
19673
19690
|
});
|
|
19674
19691
|
}); };
|
|
19675
|
-
var deleteUploadFileInBackground = function (uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19692
|
+
var deleteUploadFileInBackground$1 = function (uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19676
19693
|
var error_3;
|
|
19677
19694
|
return __generator(this, function (_a) {
|
|
19678
19695
|
switch (_a.label) {
|
|
19679
19696
|
case 0:
|
|
19680
19697
|
_a.trys.push([0, 2, , 3]);
|
|
19681
|
-
return [4 /*yield*/, deleteUploadFile(uploadFileId)];
|
|
19698
|
+
return [4 /*yield*/, deleteUploadFile$1(uploadFileId)];
|
|
19682
19699
|
case 1:
|
|
19683
19700
|
_a.sent();
|
|
19684
19701
|
return [3 /*break*/, 3];
|
|
@@ -19692,19 +19709,19 @@ var deleteUploadFileInBackground = function (uploadFileId) { return __awaiter(vo
|
|
|
19692
19709
|
});
|
|
19693
19710
|
}); };
|
|
19694
19711
|
|
|
19695
|
-
var useEntries = function (_a) {
|
|
19712
|
+
var useEntries$1 = function (_a) {
|
|
19696
19713
|
var shiftId = _a.shiftId, assetId = _a.assetId;
|
|
19697
19714
|
return useQuery({
|
|
19698
19715
|
queryKey: ["entries", shiftId, assetId],
|
|
19699
19716
|
queryFn: function (_a) {
|
|
19700
19717
|
var signal = _a.signal;
|
|
19701
|
-
return getEntries({ shiftId: shiftId, assetId: assetId, signal: signal });
|
|
19718
|
+
return getEntries$1({ shiftId: shiftId, assetId: assetId, signal: signal });
|
|
19702
19719
|
},
|
|
19703
19720
|
});
|
|
19704
19721
|
};
|
|
19705
|
-
var routeLogbookEntry = "/logbook/entry";
|
|
19722
|
+
var routeLogbookEntry$1 = "/logbook/entry";
|
|
19706
19723
|
|
|
19707
|
-
var useLogbookEntryOptionsFunctions = function (_a) {
|
|
19724
|
+
var useLogbookEntryOptionsFunctions$1 = function (_a) {
|
|
19708
19725
|
var setSelectedRowData = _a.setSelectedRowData, setShow = _a.setShow, setShowRemoveDialog = _a.setShowRemoveDialog, handleNewEntry = _a.handleNewEntry;
|
|
19709
19726
|
var getMenuOptions = function (data) {
|
|
19710
19727
|
var options = [];
|
|
@@ -19750,7 +19767,7 @@ var useLogbookEntryOptionsFunctions = function (_a) {
|
|
|
19750
19767
|
};
|
|
19751
19768
|
};
|
|
19752
19769
|
|
|
19753
|
-
var useTableData$
|
|
19770
|
+
var useTableData$3 = function (_a) {
|
|
19754
19771
|
var showContextMenu = _a.showContextMenu, allowAttachments = _a.allowAttachments, withAssetFilter = _a.withAssetFilter, showShiftCrew = _a.showShiftCrew;
|
|
19755
19772
|
var columnDefs = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
19756
19773
|
{
|
|
@@ -19866,7 +19883,7 @@ var useTableData$1 = function (_a) {
|
|
|
19866
19883
|
return { columnDefs: columnDefs };
|
|
19867
19884
|
};
|
|
19868
19885
|
|
|
19869
|
-
var ENTRY_INITIAL_VALUES = {
|
|
19886
|
+
var ENTRY_INITIAL_VALUES$1 = {
|
|
19870
19887
|
EntryId: 0,
|
|
19871
19888
|
ShiftId: 0,
|
|
19872
19889
|
AssetId: null,
|
|
@@ -19882,7 +19899,7 @@ var ENTRY_INITIAL_VALUES = {
|
|
|
19882
19899
|
AttachmentCount: 0,
|
|
19883
19900
|
};
|
|
19884
19901
|
|
|
19885
|
-
var RemoveEntryDialog = function (_a) {
|
|
19902
|
+
var RemoveEntryDialog$1 = function (_a) {
|
|
19886
19903
|
var entry = _a.entry, show = _a.show, onHide = _a.onHide;
|
|
19887
19904
|
var navigate = useNavigate();
|
|
19888
19905
|
var _b = useState(false), isSubmitLoading = _b[0], setIsSubmitLoading = _b[1];
|
|
@@ -19893,14 +19910,14 @@ var RemoveEntryDialog = function (_a) {
|
|
|
19893
19910
|
onHide(false);
|
|
19894
19911
|
};
|
|
19895
19912
|
var queryClient = useQueryClient();
|
|
19896
|
-
var removeEntry = useMutation(deleteEntry, {
|
|
19913
|
+
var removeEntry = useMutation(deleteEntry$1, {
|
|
19897
19914
|
onSuccess: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19898
19915
|
return __generator(this, function (_a) {
|
|
19899
19916
|
switch (_a.label) {
|
|
19900
19917
|
case 0: return [4 /*yield*/, queryClient.invalidateQueries({ queryKey: ["entries"] })];
|
|
19901
19918
|
case 1:
|
|
19902
19919
|
_a.sent();
|
|
19903
|
-
navigate("".concat(routeLogbookEntry), { replace: true });
|
|
19920
|
+
navigate("".concat(routeLogbookEntry$1), { replace: true });
|
|
19904
19921
|
setSuccessMessage("The entry was deleted succesfully");
|
|
19905
19922
|
onHide(true);
|
|
19906
19923
|
return [2 /*return*/];
|
|
@@ -19983,7 +20000,7 @@ var AssetsFilter = function (_a) {
|
|
|
19983
20000
|
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
19984
20001
|
};
|
|
19985
20002
|
|
|
19986
|
-
var moment$
|
|
20003
|
+
var moment$d = getMomentTz();
|
|
19987
20004
|
var getShifts = function (shiftId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
19988
20005
|
var apiService, parameters, resp, rows;
|
|
19989
20006
|
return __generator(this, function (_a) {
|
|
@@ -20002,26 +20019,26 @@ var getShifts = function (shiftId) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
20002
20019
|
if (resp.ok) {
|
|
20003
20020
|
rows = get(resp, "data.tables[0].rows", []);
|
|
20004
20021
|
rows = rows.map(function (row) {
|
|
20005
|
-
(row.CurrentProductionDate = moment$
|
|
20022
|
+
(row.CurrentProductionDate = moment$d
|
|
20006
20023
|
.utc(row["CurrentProductionDate"])
|
|
20007
20024
|
.toDate()),
|
|
20008
|
-
(row.CurrentStart = moment$
|
|
20009
|
-
(row.CurrentEnd = moment$
|
|
20010
|
-
(row.PreviousProductionDate = moment$
|
|
20025
|
+
(row.CurrentStart = moment$d.utc(row["CurrentStart"]).toDate()),
|
|
20026
|
+
(row.CurrentEnd = moment$d.utc(row["CurrentEnd"]).toDate()),
|
|
20027
|
+
(row.PreviousProductionDate = moment$d
|
|
20011
20028
|
.utc(row["PreviousProductionDate"])
|
|
20012
20029
|
.toDate()),
|
|
20013
|
-
(row.PreviousStart = moment$
|
|
20014
|
-
(row.PreviousEnd = moment$
|
|
20015
|
-
(row.NextProductionDate = moment$
|
|
20030
|
+
(row.PreviousStart = moment$d.utc(row["PreviousStart"]).toDate()),
|
|
20031
|
+
(row.PreviousEnd = moment$d.utc(row["PreviousEnd"]).toDate()),
|
|
20032
|
+
(row.NextProductionDate = moment$d
|
|
20016
20033
|
.utc(row["NextProductionDate"])
|
|
20017
20034
|
.toDate()),
|
|
20018
|
-
(row.NextStart = moment$
|
|
20019
|
-
(row.NextEnd = moment$
|
|
20020
|
-
(row.LastProductionDate = moment$
|
|
20035
|
+
(row.NextStart = moment$d.utc(row["NextStart"]).toDate()),
|
|
20036
|
+
(row.NextEnd = moment$d.utc(row["NextEnd"]).toDate()),
|
|
20037
|
+
(row.LastProductionDate = moment$d
|
|
20021
20038
|
.utc(row["LastProductionDate"])
|
|
20022
20039
|
.toDate()),
|
|
20023
|
-
(row.LastStart = moment$
|
|
20024
|
-
(row.LastEnd = moment$
|
|
20040
|
+
(row.LastStart = moment$d.utc(row["LastStart"]).toDate()),
|
|
20041
|
+
(row.LastEnd = moment$d.utc(row["LastEnd"]).toDate());
|
|
20025
20042
|
return row;
|
|
20026
20043
|
});
|
|
20027
20044
|
return [2 /*return*/, rows];
|
|
@@ -20050,7 +20067,7 @@ var getShiftsAroundCurrent = function (_a) { return __awaiter(void 0, [_a], void
|
|
|
20050
20067
|
resp = _c.sent();
|
|
20051
20068
|
if (resp.ok) {
|
|
20052
20069
|
rows = get(resp, "data.tables[0].rows", []);
|
|
20053
|
-
rows = rows.map(function (row) { return (__assign(__assign({}, row), { Start: moment$
|
|
20070
|
+
rows = rows.map(function (row) { return (__assign(__assign({}, row), { Start: moment$d.utc(row.Start).toDate(), End: moment$d.utc(row.End).toDate() })); });
|
|
20054
20071
|
return [2 /*return*/, rows];
|
|
20055
20072
|
}
|
|
20056
20073
|
else {
|
|
@@ -20060,7 +20077,7 @@ var getShiftsAroundCurrent = function (_a) { return __awaiter(void 0, [_a], void
|
|
|
20060
20077
|
});
|
|
20061
20078
|
}); };
|
|
20062
20079
|
|
|
20063
|
-
var moment$
|
|
20080
|
+
var moment$c = getMomentTz();
|
|
20064
20081
|
var useShiftsAroundCurrent = function (_a) {
|
|
20065
20082
|
var currentShiftId = _a.currentShiftId, shiftsRange = _a.shiftsRange;
|
|
20066
20083
|
return useQuery({
|
|
@@ -20088,7 +20105,7 @@ var ShiftAutocomplete = function (_a) {
|
|
|
20088
20105
|
React__default.createElement(Grid2, { container: true },
|
|
20089
20106
|
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
20090
20107
|
React__default.createElement(Autocomplete, { loading: isLoading, options: rows || [], getOptionLabel: function (option) {
|
|
20091
|
-
return "".concat(moment$
|
|
20108
|
+
return "".concat(moment$c
|
|
20092
20109
|
.utc(option.ProductionDate)
|
|
20093
20110
|
.format("MM/DD/YYYY"), " - ").concat(option.Shift, " - ").concat(option.Crew);
|
|
20094
20111
|
}, value: selectedShift, onChange: function (event, newValue) {
|
|
@@ -20125,12 +20142,12 @@ var ShiftSelector = function (_a) {
|
|
|
20125
20142
|
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); }, title: "Error loading shifts" })));
|
|
20126
20143
|
};
|
|
20127
20144
|
|
|
20128
|
-
var useEntrySubmission = function (_a) {
|
|
20145
|
+
var useEntrySubmission$1 = function (_a) {
|
|
20129
20146
|
var _b = _a === void 0 ? {} : _a, onSuccess = _b.onSuccess, onError = _b.onError, _c = _b.isNewEntry, isNewEntry = _c === void 0 ? false : _c, _d = _b.onHide, onHide = _d === void 0 ? function () { } : _d;
|
|
20130
20147
|
var _e = useState(false), isSubmitLoading = _e[0], setIsSubmitLoading = _e[1];
|
|
20131
20148
|
var _f = useState(false), showConfirmationDialog = _f[0], setShowConfirmationDialog = _f[1];
|
|
20132
20149
|
var _g = useState(null), pendingSubmitData = _g[0], setPendingSubmitData = _g[1];
|
|
20133
|
-
var submit = useMutation(upsertEntry, {
|
|
20150
|
+
var submit = useMutation(upsertEntry$1, {
|
|
20134
20151
|
onSuccess: function (entry) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20135
20152
|
return __generator(this, function (_a) {
|
|
20136
20153
|
if (entry && entry.EntryId) {
|
|
@@ -20207,7 +20224,7 @@ var useEntrySubmission = function (_a) {
|
|
|
20207
20224
|
};
|
|
20208
20225
|
};
|
|
20209
20226
|
|
|
20210
|
-
var DeleteAttachmentConfirmationDialog = function (_a) {
|
|
20227
|
+
var DeleteAttachmentConfirmationDialog$1 = function (_a) {
|
|
20211
20228
|
var open = _a.open, attachmentName = _a.attachmentName, onClose = _a.onClose, _b = _a.isDeleting, isDeleting = _b === void 0 ? false : _b;
|
|
20212
20229
|
var _c = useState(false), isClosing = _c[0], setIsClosing = _c[1];
|
|
20213
20230
|
var handleCancel = function () {
|
|
@@ -20233,7 +20250,7 @@ var DeleteAttachmentConfirmationDialog = function (_a) {
|
|
|
20233
20250
|
React__default.createElement(Button, { onClick: handleConfirm, color: "secondary", variant: "contained", disabled: isClosing, startIcon: isDeleting && React__default.createElement(CircularProgress, { size: "1rem" }) }, "Delete"))));
|
|
20234
20251
|
};
|
|
20235
20252
|
|
|
20236
|
-
var AttachmentModal = function (_a) {
|
|
20253
|
+
var AttachmentModal$1 = function (_a) {
|
|
20237
20254
|
var open = _a.open, onClose = _a.onClose, entryId = _a.entryId, isEditing = _a.isEditing, entryData = _a.entryData, onEntrySubmitted = _a.onEntrySubmitted;
|
|
20238
20255
|
var queryClient = useQueryClient();
|
|
20239
20256
|
var api = new MESApiService();
|
|
@@ -20245,7 +20262,7 @@ var AttachmentModal = function (_a) {
|
|
|
20245
20262
|
var _g = useState(null), attachmentToDelete = _g[0], setAttachmentToDelete = _g[1];
|
|
20246
20263
|
var pendingFilesRef = useRef([]);
|
|
20247
20264
|
// Entry submission hook for background saves
|
|
20248
|
-
var _h = useEntrySubmission({
|
|
20265
|
+
var _h = useEntrySubmission$1({
|
|
20249
20266
|
onSuccess: function (entry) {
|
|
20250
20267
|
setIsSubmittingEntry(false);
|
|
20251
20268
|
if (entry === null || entry === void 0 ? void 0 : entry.EntryId) {
|
|
@@ -20274,11 +20291,11 @@ var AttachmentModal = function (_a) {
|
|
|
20274
20291
|
// Query for fetching attachments
|
|
20275
20292
|
var _j = useQuery({
|
|
20276
20293
|
queryKey: ["entryAttachments", currentEntryId],
|
|
20277
|
-
queryFn: function () { return getEntryAttachments(currentEntryId); },
|
|
20294
|
+
queryFn: function () { return getEntryAttachments$1(currentEntryId); },
|
|
20278
20295
|
enabled: !!currentEntryId && currentEntryId > 0,
|
|
20279
20296
|
}), _k = _j.data, attachments = _k === void 0 ? [] : _k, isLoading = _j.isLoading, fetchError = _j.error;
|
|
20280
20297
|
// Mutations
|
|
20281
|
-
var uploadMutation = useMutation(upsertEntryAttachment, {
|
|
20298
|
+
var uploadMutation = useMutation(upsertEntryAttachment$1, {
|
|
20282
20299
|
onSuccess: function () {
|
|
20283
20300
|
queryClient.invalidateQueries(["entryAttachments", currentEntryId]);
|
|
20284
20301
|
queryClient.invalidateQueries(["entries"]);
|
|
@@ -20290,7 +20307,7 @@ var AttachmentModal = function (_a) {
|
|
|
20290
20307
|
});
|
|
20291
20308
|
var deleteMutation = useMutation(function (_a) {
|
|
20292
20309
|
var entryAttachmentId = _a.entryAttachmentId, uploadFileId = _a.uploadFileId;
|
|
20293
|
-
return deleteEntryAttachment(entryAttachmentId, uploadFileId);
|
|
20310
|
+
return deleteEntryAttachment$1(entryAttachmentId, uploadFileId);
|
|
20294
20311
|
}, {
|
|
20295
20312
|
onSuccess: function () {
|
|
20296
20313
|
queryClient.invalidateQueries(["entryAttachments", currentEntryId]);
|
|
@@ -20562,11 +20579,11 @@ var AttachmentModal = function (_a) {
|
|
|
20562
20579
|
" file(s)...")))),
|
|
20563
20580
|
React__default.createElement(DialogActions$1, null,
|
|
20564
20581
|
React__default.createElement(Button, { onClick: onClose, color: "primary" }, "Close"))),
|
|
20565
|
-
React__default.createElement(DeleteAttachmentConfirmationDialog, { open: showDeleteConfirmation, attachmentName: (attachmentToDelete === null || attachmentToDelete === void 0 ? void 0 : attachmentToDelete.name) || "", onClose: handleDeleteConfirmation, isDeleting: deleteMutation.isLoading }),
|
|
20582
|
+
React__default.createElement(DeleteAttachmentConfirmationDialog$1, { open: showDeleteConfirmation, attachmentName: (attachmentToDelete === null || attachmentToDelete === void 0 ? void 0 : attachmentToDelete.name) || "", onClose: handleDeleteConfirmation, isDeleting: deleteMutation.isLoading }),
|
|
20566
20583
|
React__default.createElement(ErrorModal, { error: error || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.message), onHide: function () { return setError(null); } })));
|
|
20567
20584
|
};
|
|
20568
20585
|
|
|
20569
|
-
var AttachmentPlugin = /** @class */ (function (_super) {
|
|
20586
|
+
var AttachmentPlugin$1 = /** @class */ (function (_super) {
|
|
20570
20587
|
__extends(AttachmentPlugin, _super);
|
|
20571
20588
|
function AttachmentPlugin() {
|
|
20572
20589
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
@@ -20613,7 +20630,7 @@ var AttachmentPlugin = /** @class */ (function (_super) {
|
|
|
20613
20630
|
return AttachmentPlugin;
|
|
20614
20631
|
}(PluginComponent));
|
|
20615
20632
|
|
|
20616
|
-
var ContentInput = function (_a) {
|
|
20633
|
+
var ContentInput$1 = function (_a) {
|
|
20617
20634
|
var value = _a.value, onChange = _a.onChange, isEditing = _a.isEditing, UpdateTimestamp = _a.UpdateTimestamp, UpdatedBy = _a.UpdatedBy, isNewEntry = _a.isNewEntry, entryId = _a.entryId, entryData = _a.entryData, onEntrySubmitted = _a.onEntrySubmitted, _b = _a.allowAttachments, allowAttachments = _b === void 0 ? false : _b;
|
|
20618
20635
|
var mdParser = new MarkdownIt();
|
|
20619
20636
|
var api = new MESApiService();
|
|
@@ -20627,7 +20644,7 @@ var ContentInput = function (_a) {
|
|
|
20627
20644
|
// Query for fetching attachment count
|
|
20628
20645
|
var _f = useQuery({
|
|
20629
20646
|
queryKey: ["entryAttachments", effectiveEntryId],
|
|
20630
|
-
queryFn: function () { return getEntryAttachments(effectiveEntryId); },
|
|
20647
|
+
queryFn: function () { return getEntryAttachments$1(effectiveEntryId); },
|
|
20631
20648
|
enabled: !!effectiveEntryId && effectiveEntryId > 0,
|
|
20632
20649
|
retry: 1,
|
|
20633
20650
|
onError: function (err) {
|
|
@@ -20667,7 +20684,7 @@ var ContentInput = function (_a) {
|
|
|
20667
20684
|
}, [isEditing, attachmentCount]);
|
|
20668
20685
|
// Register the attachment plugin
|
|
20669
20686
|
useEffect(function () {
|
|
20670
|
-
MdEditor.use(AttachmentPlugin, {
|
|
20687
|
+
MdEditor.use(AttachmentPlugin$1, {
|
|
20671
20688
|
attachmentCount: attachmentCount,
|
|
20672
20689
|
onAttachmentClick: function () {
|
|
20673
20690
|
if (entryData.title && entryData.author) {
|
|
@@ -20785,12 +20802,12 @@ var ContentInput = function (_a) {
|
|
|
20785
20802
|
fontSize: "0.7rem",
|
|
20786
20803
|
},
|
|
20787
20804
|
} })))),
|
|
20788
|
-
React__default.createElement(AttachmentModal, { open: attachmentModalOpen, onClose: function () { return setAttachmentModalOpen(false); }, entryId: effectiveEntryId, isEditing: isEditing, entryData: entryData, onEntrySubmitted: onEntrySubmitted }),
|
|
20805
|
+
React__default.createElement(AttachmentModal$1, { open: attachmentModalOpen, onClose: function () { return setAttachmentModalOpen(false); }, entryId: effectiveEntryId, isEditing: isEditing, entryData: entryData, onEntrySubmitted: onEntrySubmitted }),
|
|
20789
20806
|
React__default.createElement(ErrorModal, { error: error || (attachmentError === null || attachmentError === void 0 ? void 0 : attachmentError.message), onHide: function () { return setError(""); } })));
|
|
20790
20807
|
};
|
|
20791
20808
|
|
|
20792
|
-
var moment$
|
|
20793
|
-
var EntryViewer$
|
|
20809
|
+
var moment$b = getMomentTz();
|
|
20810
|
+
var EntryViewer$3 = function (_a) {
|
|
20794
20811
|
var entry = _a.entry, show = _a.show, onChangeShow = _a.onChangeShow, onHide = _a.onHide, preselectedAssetId = _a.preselectedAssetId, withAssetFilter = _a.withAssetFilter, canEditAsset = _a.canEditAsset, canEditShift = _a.canEditShift, filterAssets = _a.filterAssets, allowAttachments = _a.allowAttachments, shiftsRange = _a.shiftsRange;
|
|
20795
20812
|
var settings = useUTLSettingsContext().state.settings;
|
|
20796
20813
|
var defaultAssetId = Number(get(settings, "DefaultAssetId", 15));
|
|
@@ -20829,7 +20846,7 @@ var EntryViewer$1 = function (_a) {
|
|
|
20829
20846
|
}, 1000); // 1000ms delay to ensure all processing is complete
|
|
20830
20847
|
};
|
|
20831
20848
|
// Use the shared entry submission hook
|
|
20832
|
-
var _g = useEntrySubmission({
|
|
20849
|
+
var _g = useEntrySubmission$1({
|
|
20833
20850
|
onSuccess: function (entry) {
|
|
20834
20851
|
setNotificationMessage(entryId === "new"
|
|
20835
20852
|
? "Entry created successfully"
|
|
@@ -20881,8 +20898,8 @@ var EntryViewer$1 = function (_a) {
|
|
|
20881
20898
|
useEffect(function () {
|
|
20882
20899
|
var _a, _b, _c;
|
|
20883
20900
|
if (shiftInfo || !isNewEntry) {
|
|
20884
|
-
var newEntry = __assign(__assign({}, ENTRY_INITIAL_VALUES), { ShiftId: shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId, Shift: (_a = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShift) !== null && _a !== void 0 ? _a : "", Crew: (_b = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentCrew) !== null && _b !== void 0 ? _b : "", CreateTimestamp: new Date(), AssetId: (_c = preselectedAssetId !== null && preselectedAssetId !== void 0 ? preselectedAssetId : defaultAssetId) !== null && _c !== void 0 ? _c : null });
|
|
20885
|
-
reset((isNewEntry ? newEntry : entry) || ENTRY_INITIAL_VALUES);
|
|
20901
|
+
var newEntry = __assign(__assign({}, ENTRY_INITIAL_VALUES$1), { ShiftId: shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId, Shift: (_a = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShift) !== null && _a !== void 0 ? _a : "", Crew: (_b = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentCrew) !== null && _b !== void 0 ? _b : "", CreateTimestamp: new Date(), AssetId: (_c = preselectedAssetId !== null && preselectedAssetId !== void 0 ? preselectedAssetId : defaultAssetId) !== null && _c !== void 0 ? _c : null });
|
|
20902
|
+
reset((isNewEntry ? newEntry : entry) || ENTRY_INITIAL_VALUES$1);
|
|
20886
20903
|
}
|
|
20887
20904
|
}, [entry, shiftInfo, entryId, reset, defaultAssetId]);
|
|
20888
20905
|
useEffect(function () {
|
|
@@ -20914,7 +20931,7 @@ var EntryViewer$1 = function (_a) {
|
|
|
20914
20931
|
React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
20915
20932
|
React__default.createElement(Controller, { name: "CreateTimestamp", control: control, render: function (_a) {
|
|
20916
20933
|
var value = _a.field.value;
|
|
20917
|
-
return (React__default.createElement(DateTimePicker, { label: "Creation Time", timezone: TimeService.getInstance().getServerTimeZone(), format: "MM/DD/YYYY HH:mm", value: value ? moment$
|
|
20934
|
+
return (React__default.createElement(DateTimePicker, { label: "Creation Time", timezone: TimeService.getInstance().getServerTimeZone(), format: "MM/DD/YYYY HH:mm", value: value ? moment$b(value) : null, disabled: true, slotProps: {
|
|
20918
20935
|
textField: {
|
|
20919
20936
|
variant: "outlined",
|
|
20920
20937
|
size: "small",
|
|
@@ -20975,7 +20992,7 @@ var EntryViewer$1 = function (_a) {
|
|
|
20975
20992
|
React__default.createElement(Grid2, { size: { md: 12 }, height: "100%", flexGrow: 1, overflow: "auto" },
|
|
20976
20993
|
React__default.createElement(Controller, { name: "Content", control: control, render: function (_a) {
|
|
20977
20994
|
var _b = _a.field, value = _b.value, onChange = _b.onChange;
|
|
20978
|
-
return (React__default.createElement(ContentInput, { UpdatedBy: updatedBy, UpdateTimestamp: updateTimestamp, onChange: function (val) { return onChange(val); }, value: value, isEditing: show === "edit", isNewEntry: isNewEntry, entryId: entryIdValue, entryData: {
|
|
20995
|
+
return (React__default.createElement(ContentInput$1, { UpdatedBy: updatedBy, UpdateTimestamp: updateTimestamp, onChange: function (val) { return onChange(val); }, value: value, isEditing: show === "edit", isNewEntry: isNewEntry, entryId: entryIdValue, entryData: {
|
|
20979
20996
|
assetId: assetId,
|
|
20980
20997
|
entryId: entryIdValue,
|
|
20981
20998
|
shiftId: shiftId,
|
|
@@ -20997,11 +21014,11 @@ var EntryViewer$1 = function (_a) {
|
|
|
20997
21014
|
React__default.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
20998
21015
|
React__default.createElement(Button, { fullWidth: true, startIcon: isSubmitLoading && React__default.createElement(CircularProgress, { size: "1rem" }), disabled: isSubmitLoading || !isFormDirty, variant: "contained", color: "primary", type: "submit" }, isNewEntry ? "Create" : "Save"))))))) : null,
|
|
20999
21016
|
React__default.createElement(NotificationSnackBar, { message: notificationMessage, onHide: function () { return setNotificationMessage(""); } }),
|
|
21000
|
-
React__default.createElement(ConfirmationDialogRaw, { open: showConfirmationDialog, onClose: handleConfirmationClose, title: "Shift Submission Confirmation", message: "You are about to ".concat(isNewEntry ? "create" : "save", " an entry for ").concat(moment$
|
|
21017
|
+
React__default.createElement(ConfirmationDialogRaw, { open: showConfirmationDialog, onClose: handleConfirmationClose, title: "Shift Submission Confirmation", message: "You are about to ".concat(isNewEntry ? "create" : "save", " an entry for ").concat(moment$b(shiftTimestamp).format("MM/DD/YYYY"), " ").concat(shift, " - ").concat(crew, ". Are you sure you want to proceed?"), suffixTitle: "Logbook Entry" }),
|
|
21001
21018
|
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
21002
21019
|
};
|
|
21003
21020
|
|
|
21004
|
-
var Filters$
|
|
21021
|
+
var Filters$3 = function (_a) {
|
|
21005
21022
|
var withAssetFilter = _a.withAssetFilter, filterAssets = _a.filterAssets, assetId = _a.assetId, _b = _a.setAssetId, setAssetId = _b === void 0 ? function () { } : _b, quickFilter = _a.quickFilter, onQuickFilterChange = _a.onQuickFilterChange;
|
|
21006
21023
|
useMesfRealtime({
|
|
21007
21024
|
onReceiveMessage: function (author, message) {
|
|
@@ -21029,8 +21046,8 @@ var Filters$1 = function (_a) {
|
|
|
21029
21046
|
} }))));
|
|
21030
21047
|
};
|
|
21031
21048
|
|
|
21032
|
-
var moment$
|
|
21033
|
-
var Logbook$
|
|
21049
|
+
var moment$a = getMomentTz();
|
|
21050
|
+
var Logbook$3 = function () {
|
|
21034
21051
|
var entry = useLogbookSettings().entry;
|
|
21035
21052
|
var defaultAreaId = useUserContext().state.defaultAreaId;
|
|
21036
21053
|
var withAssetFilter = entry.withAssetFilter;
|
|
@@ -21059,17 +21076,17 @@ var Logbook$1 = function () {
|
|
|
21059
21076
|
var _f = useState(null), selectedRowData = _f[0], setSelectedRowData = _f[1];
|
|
21060
21077
|
var _g = useState(false), showRemoveDialog = _g[0], setShowRemoveDialog = _g[1];
|
|
21061
21078
|
var _h = useContextMenuMESF(), registerConfig = _h.registerConfig, showContextMenu = _h.showContextMenu;
|
|
21062
|
-
var _j = useEntries({
|
|
21079
|
+
var _j = useEntries$1({
|
|
21063
21080
|
shiftId: shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId,
|
|
21064
21081
|
assetId: withAssetFilter ? assetId : undefined,
|
|
21065
21082
|
}), rows = _j.data, isLoading = _j.isLoading, e = _j.error, isError = _j.isError, refetch = _j.refetch;
|
|
21066
|
-
var columnDefs = useTableData$
|
|
21083
|
+
var columnDefs = useTableData$3({
|
|
21067
21084
|
showContextMenu: showContextMenu,
|
|
21068
21085
|
allowAttachments: allowAttachments,
|
|
21069
21086
|
withAssetFilter: withAssetFilter,
|
|
21070
21087
|
showShiftCrew: showShiftCrew,
|
|
21071
21088
|
}).columnDefs;
|
|
21072
|
-
var defaultColDef = useGridDefinitions({}).defaultColDef;
|
|
21089
|
+
var defaultColDef = useGridDefinitions$1({}).defaultColDef;
|
|
21073
21090
|
var onQuickFilterChange = function (text) {
|
|
21074
21091
|
var _a;
|
|
21075
21092
|
setQuickFilter(text);
|
|
@@ -21078,8 +21095,8 @@ var Logbook$1 = function () {
|
|
|
21078
21095
|
var handleNewEntry = function () {
|
|
21079
21096
|
var _a;
|
|
21080
21097
|
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.deselectAll();
|
|
21081
|
-
setSelectedRowData(__assign({}, ENTRY_INITIAL_VALUES));
|
|
21082
|
-
navigate("".concat(routeLogbookEntry, "/").concat(shiftIdRef.current, "?action=new"), {
|
|
21098
|
+
setSelectedRowData(__assign({}, ENTRY_INITIAL_VALUES$1));
|
|
21099
|
+
navigate("".concat(routeLogbookEntry$1, "/").concat(shiftIdRef.current, "?action=new"), {
|
|
21083
21100
|
replace: true,
|
|
21084
21101
|
});
|
|
21085
21102
|
setShow("edit");
|
|
@@ -21088,7 +21105,7 @@ var Logbook$1 = function () {
|
|
|
21088
21105
|
var _a;
|
|
21089
21106
|
var currentShiftId = shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId);
|
|
21090
21107
|
setSelectedRowData(event === null || event === void 0 ? void 0 : event.data);
|
|
21091
|
-
navigate("".concat(routeLogbookEntry, "/").concat(currentShiftId, "?entryId=").concat((_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.EntryId, "&action=view"));
|
|
21108
|
+
navigate("".concat(routeLogbookEntry$1, "/").concat(currentShiftId, "?entryId=").concat((_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.EntryId, "&action=view"));
|
|
21092
21109
|
setShow("view");
|
|
21093
21110
|
};
|
|
21094
21111
|
var onCellKeyDown = useCallback(function (event) {
|
|
@@ -21106,7 +21123,7 @@ var Logbook$1 = function () {
|
|
|
21106
21123
|
nextNode.setSelected(true);
|
|
21107
21124
|
api.ensureIndexVisible(nextRowIndex);
|
|
21108
21125
|
setSelectedRowData(nextNode.data);
|
|
21109
|
-
navigate("".concat(routeLogbookEntry, "/").concat(currentShiftId, "/?entryId=").concat(nextNode.data.EntryId, "&action=view"));
|
|
21126
|
+
navigate("".concat(routeLogbookEntry$1, "/").concat(currentShiftId, "/?entryId=").concat(nextNode.data.EntryId, "&action=view"));
|
|
21110
21127
|
}
|
|
21111
21128
|
}
|
|
21112
21129
|
}, [setSelectedRowData, shiftId, shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId]);
|
|
@@ -21120,7 +21137,7 @@ var Logbook$1 = function () {
|
|
|
21120
21137
|
}
|
|
21121
21138
|
return [];
|
|
21122
21139
|
}, [rows]);
|
|
21123
|
-
var getMenuOptions = useLogbookEntryOptionsFunctions({
|
|
21140
|
+
var getMenuOptions = useLogbookEntryOptionsFunctions$1({
|
|
21124
21141
|
setSelectedRowData: setSelectedRowData,
|
|
21125
21142
|
setShow: setShow,
|
|
21126
21143
|
setShowRemoveDialog: setShowRemoveDialog,
|
|
@@ -21143,7 +21160,7 @@ var Logbook$1 = function () {
|
|
|
21143
21160
|
],
|
|
21144
21161
|
processCellCallback: function (params) {
|
|
21145
21162
|
if (params.column.colId === "CreateTimestamp") {
|
|
21146
|
-
return moment$
|
|
21163
|
+
return moment$a(params.value).format("MM/DD/yy - HH:mm");
|
|
21147
21164
|
}
|
|
21148
21165
|
return params.value;
|
|
21149
21166
|
},
|
|
@@ -21212,10 +21229,10 @@ var Logbook$1 = function () {
|
|
|
21212
21229
|
if (entryId &&
|
|
21213
21230
|
(shiftIdRef.current == null ||
|
|
21214
21231
|
shiftIdRef.current === (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId))) {
|
|
21215
|
-
navigate("".concat(routeLogbookEntry, "/").concat(shiftInfo.CurrentShiftId, "?entryId=").concat(entryId, "&action=").concat(action));
|
|
21232
|
+
navigate("".concat(routeLogbookEntry$1, "/").concat(shiftInfo.CurrentShiftId, "?entryId=").concat(entryId, "&action=").concat(action));
|
|
21216
21233
|
}
|
|
21217
21234
|
else {
|
|
21218
|
-
navigate("".concat(routeLogbookEntry, "/").concat(shiftInfo.CurrentShiftId));
|
|
21235
|
+
navigate("".concat(routeLogbookEntry$1, "/").concat(shiftInfo.CurrentShiftId));
|
|
21219
21236
|
}
|
|
21220
21237
|
shiftIdRef.current = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId;
|
|
21221
21238
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21270,7 +21287,7 @@ var Logbook$1 = function () {
|
|
|
21270
21287
|
} }, "LOGBOOK")),
|
|
21271
21288
|
React__default.createElement(Grid2, { container: true, size: { xs: 12, md: 5 }, spacing: 1 },
|
|
21272
21289
|
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
21273
|
-
React__default.createElement(Filters$
|
|
21290
|
+
React__default.createElement(Filters$3, { withAssetFilter: withAssetFilter, filterAssets: filterAssets, quickFilter: quickFilter, onQuickFilterChange: onQuickFilterChange, assetId: assetId, setAssetId: setAssetId })),
|
|
21274
21291
|
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
21275
21292
|
React__default.createElement(Paper, { elevation: 1, style: {
|
|
21276
21293
|
height: "62vh",
|
|
@@ -21303,7 +21320,7 @@ var Logbook$1 = function () {
|
|
|
21303
21320
|
},
|
|
21304
21321
|
} })))),
|
|
21305
21322
|
React__default.createElement(Grid2, { size: { xs: 12, md: 7 } },
|
|
21306
|
-
React__default.createElement(EntryViewer$
|
|
21323
|
+
React__default.createElement(EntryViewer$3, { entry: selectedRowData, show: show, onChangeShow: function () {
|
|
21307
21324
|
var newShow = show === "view" ? "edit" : "view";
|
|
21308
21325
|
setShow(newShow);
|
|
21309
21326
|
if (entryId && entryId !== "new") {
|
|
@@ -21370,13 +21387,13 @@ var Logbook$1 = function () {
|
|
|
21370
21387
|
setShow("");
|
|
21371
21388
|
setSelectedRowData(null);
|
|
21372
21389
|
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.deselectAll();
|
|
21373
|
-
navigate("".concat(routeLogbookEntry, "/").concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId)));
|
|
21390
|
+
navigate("".concat(routeLogbookEntry$1, "/").concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId)));
|
|
21374
21391
|
_b.label = 3;
|
|
21375
21392
|
case 3: return [2 /*return*/];
|
|
21376
21393
|
}
|
|
21377
21394
|
});
|
|
21378
21395
|
}); } }))),
|
|
21379
|
-
React__default.createElement(RemoveEntryDialog, { entry: selectedRowData, show: showRemoveDialog, onHide: function (shouldUpdate) {
|
|
21396
|
+
React__default.createElement(RemoveEntryDialog$1, { entry: selectedRowData, show: showRemoveDialog, onHide: function (shouldUpdate) {
|
|
21380
21397
|
if (shouldUpdate) {
|
|
21381
21398
|
refetch();
|
|
21382
21399
|
}
|
|
@@ -21387,19 +21404,19 @@ var Logbook$1 = function () {
|
|
|
21387
21404
|
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
21388
21405
|
};
|
|
21389
21406
|
|
|
21390
|
-
var LogbookPage$
|
|
21407
|
+
var LogbookPage$3 = function () {
|
|
21391
21408
|
return (React__default.createElement(React__default.Fragment, null,
|
|
21392
21409
|
React__default.createElement(HelmetDexteel, { title: "Logbook Entry" }),
|
|
21393
21410
|
React__default.createElement(Grid2, { container: true, style: { padding: "1.5rem" } },
|
|
21394
|
-
React__default.createElement(Logbook$
|
|
21411
|
+
React__default.createElement(Logbook$3, null))));
|
|
21395
21412
|
};
|
|
21396
21413
|
|
|
21397
|
-
var MESFLogbookEntry = function () {
|
|
21398
|
-
return React__default.createElement(LogbookPage$
|
|
21414
|
+
var MESFLogbookEntry$1 = function () {
|
|
21415
|
+
return React__default.createElement(LogbookPage$3, null);
|
|
21399
21416
|
};
|
|
21400
21417
|
|
|
21401
|
-
var moment$
|
|
21402
|
-
var getEntriesReport = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
21418
|
+
var moment$9 = getMomentTz();
|
|
21419
|
+
var getEntriesReport$1 = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
21403
21420
|
var apiService, parameters, resp, rows;
|
|
21404
21421
|
var startShiftId = _b.startShiftId, endShiftId = _b.endShiftId, assetId = _b.assetId;
|
|
21405
21422
|
return __generator(this, function (_c) {
|
|
@@ -21419,9 +21436,9 @@ var getEntriesReport = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
21419
21436
|
if (resp.ok) {
|
|
21420
21437
|
rows = get(resp, "data.tables[0].rows", []);
|
|
21421
21438
|
rows = rows.map(function (entry) { return (__assign(__assign({}, entry), { CreateTimestamp: entry.CreateTimestamp
|
|
21422
|
-
? moment$
|
|
21439
|
+
? moment$9.utc(entry["CreateTimestamp"]).toDate()
|
|
21423
21440
|
: null, UpdateTimestamp: entry.UpdateTimestamp
|
|
21424
|
-
? moment$
|
|
21441
|
+
? moment$9.utc(entry["UpdateTimestamp"]).toDate()
|
|
21425
21442
|
: null })); });
|
|
21426
21443
|
return [2 /*return*/, rows];
|
|
21427
21444
|
}
|
|
@@ -21432,16 +21449,16 @@ var getEntriesReport = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
21432
21449
|
});
|
|
21433
21450
|
}); };
|
|
21434
21451
|
|
|
21435
|
-
var useEntriesReport = function (_a) {
|
|
21452
|
+
var useEntriesReport$1 = function (_a) {
|
|
21436
21453
|
var startShiftId = _a.startShiftId, endShiftId = _a.endShiftId, assetId = _a.assetId;
|
|
21437
21454
|
return useQuery({
|
|
21438
21455
|
queryKey: ["entriesReport", startShiftId, endShiftId, assetId],
|
|
21439
|
-
queryFn: function () { return getEntriesReport({ startShiftId: startShiftId, endShiftId: endShiftId, assetId: assetId }); },
|
|
21456
|
+
queryFn: function () { return getEntriesReport$1({ startShiftId: startShiftId, endShiftId: endShiftId, assetId: assetId }); },
|
|
21440
21457
|
});
|
|
21441
21458
|
};
|
|
21442
21459
|
var routeLogbookReport = "/logbook/report";
|
|
21443
21460
|
|
|
21444
|
-
var useTableData = function (_a) {
|
|
21461
|
+
var useTableData$2 = function (_a) {
|
|
21445
21462
|
var showAttachments = _a.showAttachments, showAsset = _a.showAsset, showShiftCrew = _a.showShiftCrew;
|
|
21446
21463
|
var columnDefs = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
21447
21464
|
{
|
|
@@ -21534,8 +21551,8 @@ var useTableData = function (_a) {
|
|
|
21534
21551
|
return { columnDefs: columnDefs };
|
|
21535
21552
|
};
|
|
21536
21553
|
|
|
21537
|
-
var moment$
|
|
21538
|
-
var EntryViewer = function (_a) {
|
|
21554
|
+
var moment$8 = getMomentTz();
|
|
21555
|
+
var EntryViewer$2 = function (_a) {
|
|
21539
21556
|
var entry = _a.entry, show = _a.show, onHide = _a.onHide, filterAssets = _a.filterAssets, showAsset = _a.showAsset, _b = _a.showAttachments, showAttachments = _b === void 0 ? false : _b;
|
|
21540
21557
|
var _c = useState(""), error = _c[0], setError = _c[1];
|
|
21541
21558
|
var _d = useForm(), control = _d.control, setValue = _d.setValue, reset = _d.reset, watch = _d.watch; _d.getValues;
|
|
@@ -21549,7 +21566,7 @@ var EntryViewer = function (_a) {
|
|
|
21549
21566
|
var assetId = watch("AssetId");
|
|
21550
21567
|
var createTimestamp = watch("CreateTimestamp");
|
|
21551
21568
|
useEffect(function () {
|
|
21552
|
-
reset(entry || ENTRY_INITIAL_VALUES);
|
|
21569
|
+
reset(entry || ENTRY_INITIAL_VALUES$1);
|
|
21553
21570
|
}, [entry, show]);
|
|
21554
21571
|
return (React__default.createElement(React__default.Fragment, null,
|
|
21555
21572
|
(entry === null || entry === void 0 ? void 0 : entry.EntryId) && (React__default.createElement(HelmetDexteel, { title: "'".concat(entry === null || entry === void 0 ? void 0 : entry.Title, "' by ").concat(entry.Author, " - Logbook Report") })),
|
|
@@ -21569,7 +21586,7 @@ var EntryViewer = function (_a) {
|
|
|
21569
21586
|
React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
21570
21587
|
React__default.createElement(Controller, { name: "CreateTimestamp", control: control, render: function (_a) {
|
|
21571
21588
|
var value = _a.field.value;
|
|
21572
|
-
return (React__default.createElement(DateTimePicker, { label: "Creation Time", timezone: TimeService.getInstance().getServerTimeZone(), format: "MM/DD/YYYY HH:mm", value: value ? moment$
|
|
21589
|
+
return (React__default.createElement(DateTimePicker, { label: "Creation Time", timezone: TimeService.getInstance().getServerTimeZone(), format: "MM/DD/YYYY HH:mm", value: value ? moment$8(value) : null, disabled: true, slotProps: {
|
|
21573
21590
|
textField: {
|
|
21574
21591
|
variant: "outlined",
|
|
21575
21592
|
size: "small",
|
|
@@ -21600,7 +21617,7 @@ var EntryViewer = function (_a) {
|
|
|
21600
21617
|
React__default.createElement(Grid2, { size: { md: 12 }, height: "100%", flexGrow: 1, overflow: "auto" },
|
|
21601
21618
|
React__default.createElement(Controller, { name: "Content", control: control, render: function (_a) {
|
|
21602
21619
|
var _b = _a.field; _b.value; _b.onChange;
|
|
21603
|
-
return (React__default.createElement(ContentInput, { UpdatedBy: updatedBy, UpdateTimestamp: updateTimestamp, onChange: function (val) { return setValue("Content", val); }, value: content, isEditing: false, isNewEntry: false, entryId: entryId, entryData: {
|
|
21620
|
+
return (React__default.createElement(ContentInput$1, { UpdatedBy: updatedBy, UpdateTimestamp: updateTimestamp, onChange: function (val) { return setValue("Content", val); }, value: content, isEditing: false, isNewEntry: false, entryId: entryId, entryData: {
|
|
21604
21621
|
assetId: assetId,
|
|
21605
21622
|
entryId: entryId,
|
|
21606
21623
|
shiftId: shiftId,
|
|
@@ -21617,7 +21634,7 @@ var EntryViewer = function (_a) {
|
|
|
21617
21634
|
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
21618
21635
|
};
|
|
21619
21636
|
|
|
21620
|
-
var customPeriodOptions = [
|
|
21637
|
+
var customPeriodOptions$1 = [
|
|
21621
21638
|
{ value: "Day", label: "Day" },
|
|
21622
21639
|
{ value: "4Days", label: "4 Days" },
|
|
21623
21640
|
{ value: "Week", label: "Week" },
|
|
@@ -21644,7 +21661,7 @@ var buildTreeAssets = function (nodes) {
|
|
|
21644
21661
|
});
|
|
21645
21662
|
return root;
|
|
21646
21663
|
};
|
|
21647
|
-
var Filters = function (_a) {
|
|
21664
|
+
var Filters$2 = function (_a) {
|
|
21648
21665
|
var withAssetFilter = _a.withAssetFilter, filterAssets = _a.filterAssets, quickFilter = _a.quickFilter, onQuickFilterChange = _a.onQuickFilterChange, assetId = _a.assetId, setAssetId = _a.setAssetId, shiftPeriod = _a.shiftPeriod, onChangeShiftPeriod = _a.onChangeShiftPeriod, actualPeriod = _a.actualPeriod;
|
|
21649
21666
|
var handleShiftPeriodChange = function (value, period) {
|
|
21650
21667
|
onChangeShiftPeriod(value, period);
|
|
@@ -21670,7 +21687,7 @@ var Filters = function (_a) {
|
|
|
21670
21687
|
return (React__default.createElement(Paper, { elevation: 1, style: { padding: 8 } },
|
|
21671
21688
|
React__default.createElement(Grid2, { container: true, spacing: 1 },
|
|
21672
21689
|
React__default.createElement(Grid2, { size: { xs: 12 }, alignItems: "center", justifyContent: "center" },
|
|
21673
|
-
React__default.createElement(ShiftPeriodNavigatorControl, { onChange: handleShiftPeriodChange, value: shiftPeriod, actualPeriod: actualPeriod, showShiftAndCrews: false, dateFormat: "MM/DD/YYYY", periodOptions: customPeriodOptions })),
|
|
21690
|
+
React__default.createElement(ShiftPeriodNavigatorControl, { onChange: handleShiftPeriodChange, value: shiftPeriod, actualPeriod: actualPeriod, showShiftAndCrews: false, dateFormat: "MM/DD/YYYY", periodOptions: customPeriodOptions$1 })),
|
|
21674
21691
|
React__default.createElement(Grid2, { size: { xs: 12, md: withAssetFilter ? 6 : 12 } },
|
|
21675
21692
|
React__default.createElement(TextField, { fullWidth: true, label: "Search", variant: "outlined", size: "small", margin: "dense", value: quickFilter, onChange: function (event) {
|
|
21676
21693
|
onQuickFilterChange(event === null || event === void 0 ? void 0 : event.target.value);
|
|
@@ -21694,8 +21711,8 @@ var Filters = function (_a) {
|
|
|
21694
21711
|
}, filterAreaAssets: filterAssets === "area", isFilter: true }))))));
|
|
21695
21712
|
};
|
|
21696
21713
|
|
|
21697
|
-
var moment = getMomentTz();
|
|
21698
|
-
var Logbook = function () {
|
|
21714
|
+
var moment$7 = getMomentTz();
|
|
21715
|
+
var Logbook$2 = function () {
|
|
21699
21716
|
var report = useLogbookSettings().report;
|
|
21700
21717
|
var defaultAreaId = useUserContext().state.defaultAreaId;
|
|
21701
21718
|
var withAssetFilter = report.withAssetFilter;
|
|
@@ -21750,17 +21767,17 @@ var Logbook = function () {
|
|
|
21750
21767
|
}
|
|
21751
21768
|
setSearchParams(newParams);
|
|
21752
21769
|
};
|
|
21753
|
-
var _h = useEntriesReport({
|
|
21770
|
+
var _h = useEntriesReport$1({
|
|
21754
21771
|
startShiftId: shiftPeriod.StartShiftId,
|
|
21755
21772
|
endShiftId: shiftPeriod.EndShiftId,
|
|
21756
21773
|
assetId: assetId,
|
|
21757
21774
|
}), rows = _h.data, isLoading = _h.isLoading, e = _h.error, isError = _h.isError, refetch = _h.refetch;
|
|
21758
|
-
var columnDefs = useTableData({
|
|
21775
|
+
var columnDefs = useTableData$2({
|
|
21759
21776
|
showAttachments: showAttachments,
|
|
21760
21777
|
showAsset: showAsset,
|
|
21761
21778
|
showShiftCrew: showShiftCrew,
|
|
21762
21779
|
}).columnDefs;
|
|
21763
|
-
var defaultColDef = useGridDefinitions({}).defaultColDef;
|
|
21780
|
+
var defaultColDef = useGridDefinitions$1({}).defaultColDef;
|
|
21764
21781
|
var onQuickFilterChange = function (text) {
|
|
21765
21782
|
var _a;
|
|
21766
21783
|
setQuickFilter(text);
|
|
@@ -21808,7 +21825,7 @@ var Logbook = function () {
|
|
|
21808
21825
|
],
|
|
21809
21826
|
processCellCallback: function (params) {
|
|
21810
21827
|
if (params.column.colId === "CreateTimestamp") {
|
|
21811
|
-
return moment(params.value).format("MM/DD/yy - HH:mm");
|
|
21828
|
+
return moment$7(params.value).format("MM/DD/yy - HH:mm");
|
|
21812
21829
|
}
|
|
21813
21830
|
return params.value;
|
|
21814
21831
|
},
|
|
@@ -21892,7 +21909,7 @@ var Logbook = function () {
|
|
|
21892
21909
|
} }, "LOGBOOK REPORT")),
|
|
21893
21910
|
React__default.createElement(Grid2, { container: true, size: { xs: 12, md: 5 }, spacing: 1 },
|
|
21894
21911
|
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
21895
|
-
React__default.createElement(Filters, { withAssetFilter: withAssetFilter, filterAssets: filterAssets, quickFilter: quickFilter, onQuickFilterChange: onQuickFilterChange, assetId: assetId, setAssetId: function (value) { return setAssetId(value); }, shiftPeriod: shiftPeriod, onChangeShiftPeriod: function (value, period) {
|
|
21912
|
+
React__default.createElement(Filters$2, { withAssetFilter: withAssetFilter, filterAssets: filterAssets, quickFilter: quickFilter, onQuickFilterChange: onQuickFilterChange, assetId: assetId, setAssetId: function (value) { return setAssetId(value); }, shiftPeriod: shiftPeriod, onChangeShiftPeriod: function (value, period) {
|
|
21896
21913
|
setShiftPeriod(value);
|
|
21897
21914
|
updateUrl({
|
|
21898
21915
|
startShiftId: value.StartShiftId,
|
|
@@ -21930,7 +21947,7 @@ var Logbook = function () {
|
|
|
21930
21947
|
},
|
|
21931
21948
|
} })))),
|
|
21932
21949
|
React__default.createElement(Grid2, { size: { xs: 12, md: 7 } },
|
|
21933
|
-
React__default.createElement(EntryViewer, { entry: selectedRowData, show: show, onChangeShow: function () { return setShow(show === "view" ? "edit" : "view"); }, onHide: function () {
|
|
21950
|
+
React__default.createElement(EntryViewer$2, { entry: selectedRowData, show: show, onChangeShow: function () { return setShow(show === "view" ? "edit" : "view"); }, onHide: function () {
|
|
21934
21951
|
var _a;
|
|
21935
21952
|
setShow("");
|
|
21936
21953
|
setSelectedRowData(null);
|
|
@@ -21940,29 +21957,29 @@ var Logbook = function () {
|
|
|
21940
21957
|
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
21941
21958
|
};
|
|
21942
21959
|
|
|
21943
|
-
var LogbookPage = function () {
|
|
21960
|
+
var LogbookPage$2 = function () {
|
|
21944
21961
|
return (React__default.createElement(React__default.Fragment, null,
|
|
21945
21962
|
React__default.createElement(HelmetDexteel, { title: "Logbook Report" }),
|
|
21946
21963
|
React__default.createElement(Grid2, { container: true, style: { padding: "1.5rem" } },
|
|
21947
|
-
React__default.createElement(Logbook, null))));
|
|
21964
|
+
React__default.createElement(Logbook$2, null))));
|
|
21948
21965
|
};
|
|
21949
21966
|
|
|
21950
|
-
var MESFLogbookReport = function () {
|
|
21951
|
-
return React__default.createElement(LogbookPage, null);
|
|
21967
|
+
var MESFLogbookReport$1 = function () {
|
|
21968
|
+
return React__default.createElement(LogbookPage$2, null);
|
|
21952
21969
|
};
|
|
21953
21970
|
|
|
21954
21971
|
var logbookRoutesMESF = [
|
|
21955
21972
|
{
|
|
21956
21973
|
path: "/logbook/entry",
|
|
21957
|
-
element: React__default.createElement(MESFLogbookEntry),
|
|
21974
|
+
element: React__default.createElement(MESFLogbookEntry$1),
|
|
21958
21975
|
},
|
|
21959
21976
|
{
|
|
21960
21977
|
path: "/logbook/entry/:shiftId",
|
|
21961
|
-
element: React__default.createElement(MESFLogbookEntry),
|
|
21978
|
+
element: React__default.createElement(MESFLogbookEntry$1),
|
|
21962
21979
|
},
|
|
21963
21980
|
{
|
|
21964
21981
|
path: "/logbook/report",
|
|
21965
|
-
element: React__default.createElement(MESFLogbookReport),
|
|
21982
|
+
element: React__default.createElement(MESFLogbookReport$1),
|
|
21966
21983
|
},
|
|
21967
21984
|
];
|
|
21968
21985
|
var logbookNavbar = [
|
|
@@ -21982,6 +21999,2585 @@ var logbookNavbar = [
|
|
|
21982
21999
|
},
|
|
21983
22000
|
];
|
|
21984
22001
|
|
|
22002
|
+
var useGridDefinitions = function (_a) {
|
|
22003
|
+
_a.OnEdit; _a.OnSend;
|
|
22004
|
+
var defaultColDef = {
|
|
22005
|
+
flex: 1,
|
|
22006
|
+
filter: false,
|
|
22007
|
+
floatingFilter: false,
|
|
22008
|
+
sortable: false,
|
|
22009
|
+
editable: false,
|
|
22010
|
+
resizable: false,
|
|
22011
|
+
wrapText: false,
|
|
22012
|
+
autoHeight: false,
|
|
22013
|
+
wrapHeaderText: true,
|
|
22014
|
+
suppressHeaderMenuButton: true,
|
|
22015
|
+
cellStyle: {
|
|
22016
|
+
display: "flex",
|
|
22017
|
+
alignItems: "center",
|
|
22018
|
+
justifyContent: "center",
|
|
22019
|
+
},
|
|
22020
|
+
};
|
|
22021
|
+
return {
|
|
22022
|
+
defaultColDef: defaultColDef,
|
|
22023
|
+
};
|
|
22024
|
+
};
|
|
22025
|
+
|
|
22026
|
+
var moment$6 = getMomentTz();
|
|
22027
|
+
var getEntries = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
22028
|
+
var apiService, parameters, resp, rows;
|
|
22029
|
+
var shiftId = _b.shiftId, sectionIds = _b.sectionIds, signal = _b.signal;
|
|
22030
|
+
return __generator(this, function (_c) {
|
|
22031
|
+
switch (_c.label) {
|
|
22032
|
+
case 0:
|
|
22033
|
+
apiService = new MESApiService();
|
|
22034
|
+
parameters = [
|
|
22035
|
+
{ name: "ShiftId", value: shiftId },
|
|
22036
|
+
];
|
|
22037
|
+
// Pass comma-separated sectionIds for multi-select filter
|
|
22038
|
+
if (sectionIds && sectionIds.length > 0) {
|
|
22039
|
+
parameters.push({ name: "SectionIds", value: sectionIds.join(",") });
|
|
22040
|
+
}
|
|
22041
|
+
return [4 /*yield*/, apiService.callV2("[SWV].[GetSectionLogbookEntries]", parameters, signal)];
|
|
22042
|
+
case 1:
|
|
22043
|
+
resp = _c.sent();
|
|
22044
|
+
if (resp.ok) {
|
|
22045
|
+
rows = get(resp, "data.tables[0].rows", []);
|
|
22046
|
+
rows = rows.map(function (entry) { return (__assign(__assign({}, entry), { CreateTimestamp: entry.CreateTimestamp
|
|
22047
|
+
? moment$6.utc(entry["CreateTimestamp"]).toDate()
|
|
22048
|
+
: null, UpdateTimestamp: entry.UpdateTimestamp
|
|
22049
|
+
? moment$6.utc(entry["UpdateTimestamp"]).toDate()
|
|
22050
|
+
: null })); });
|
|
22051
|
+
return [2 /*return*/, rows];
|
|
22052
|
+
}
|
|
22053
|
+
else {
|
|
22054
|
+
throw new Error(resp.message || "Error fetching entries");
|
|
22055
|
+
}
|
|
22056
|
+
}
|
|
22057
|
+
});
|
|
22058
|
+
}); };
|
|
22059
|
+
var upsertEntry = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
22060
|
+
var apiService, parameters, resp;
|
|
22061
|
+
var assetId = _b.assetId, entryId = _b.entryId, shiftId = _b.shiftId, title = _b.title, content = _b.content, createTimestamp = _b.createTimestamp, author = _b.author;
|
|
22062
|
+
return __generator(this, function (_c) {
|
|
22063
|
+
switch (_c.label) {
|
|
22064
|
+
case 0:
|
|
22065
|
+
apiService = new MESApiService();
|
|
22066
|
+
parameters = [
|
|
22067
|
+
{ name: "EntryId", value: entryId },
|
|
22068
|
+
{ name: "ShiftId", value: shiftId },
|
|
22069
|
+
{ name: "Title", value: title },
|
|
22070
|
+
{ name: "Content", value: content },
|
|
22071
|
+
{
|
|
22072
|
+
name: "CreateTimestamp",
|
|
22073
|
+
value: createTimestamp.toISOString(),
|
|
22074
|
+
},
|
|
22075
|
+
{
|
|
22076
|
+
name: "UpdateTimestamp",
|
|
22077
|
+
value: new Date().toISOString(),
|
|
22078
|
+
},
|
|
22079
|
+
{ name: "Author", value: author },
|
|
22080
|
+
];
|
|
22081
|
+
if (assetId || assetId === 0) {
|
|
22082
|
+
parameters.push({ name: "AssetId", value: assetId });
|
|
22083
|
+
}
|
|
22084
|
+
return [4 /*yield*/, apiService.callV2("[LB].[UpsertEntry]", parameters)];
|
|
22085
|
+
case 1:
|
|
22086
|
+
resp = _c.sent();
|
|
22087
|
+
if (resp.ok) {
|
|
22088
|
+
return [2 /*return*/, get(resp, "data.tables[0].rows[0]", null)];
|
|
22089
|
+
}
|
|
22090
|
+
{
|
|
22091
|
+
throw new Error(resp.message || "Error upserting entry");
|
|
22092
|
+
}
|
|
22093
|
+
}
|
|
22094
|
+
});
|
|
22095
|
+
}); };
|
|
22096
|
+
var deleteEntry = function (EntryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22097
|
+
var apiService, attachmentsToDelete, error_1, parameters, resp;
|
|
22098
|
+
return __generator(this, function (_a) {
|
|
22099
|
+
switch (_a.label) {
|
|
22100
|
+
case 0:
|
|
22101
|
+
apiService = new MESApiService();
|
|
22102
|
+
attachmentsToDelete = [];
|
|
22103
|
+
_a.label = 1;
|
|
22104
|
+
case 1:
|
|
22105
|
+
_a.trys.push([1, 4, , 5]);
|
|
22106
|
+
if (!EntryId) return [3 /*break*/, 3];
|
|
22107
|
+
return [4 /*yield*/, getEntryAttachments(EntryId)];
|
|
22108
|
+
case 2:
|
|
22109
|
+
attachmentsToDelete = _a.sent();
|
|
22110
|
+
_a.label = 3;
|
|
22111
|
+
case 3: return [3 /*break*/, 5];
|
|
22112
|
+
case 4:
|
|
22113
|
+
error_1 = _a.sent();
|
|
22114
|
+
// If we can't get attachments, log but continue with entry deletion
|
|
22115
|
+
console.warn("Failed to get attachments for entry deletion:", error_1);
|
|
22116
|
+
return [3 /*break*/, 5];
|
|
22117
|
+
case 5:
|
|
22118
|
+
parameters = [{ name: "EntryId", value: EntryId }];
|
|
22119
|
+
return [4 /*yield*/, apiService.callV2("[LB].[DeleteEntry]", parameters)];
|
|
22120
|
+
case 6:
|
|
22121
|
+
resp = _a.sent();
|
|
22122
|
+
if (!resp.ok) {
|
|
22123
|
+
throw new Error(resp.message || "Error deleting entry");
|
|
22124
|
+
}
|
|
22125
|
+
// Delete associated files in background (don't block the UI)
|
|
22126
|
+
if (attachmentsToDelete.length > 0) {
|
|
22127
|
+
deleteAttachedFilesInBackground(attachmentsToDelete);
|
|
22128
|
+
}
|
|
22129
|
+
return [2 /*return*/];
|
|
22130
|
+
}
|
|
22131
|
+
});
|
|
22132
|
+
}); };
|
|
22133
|
+
var deleteAttachedFilesInBackground = function (attachments) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22134
|
+
return __generator(this, function (_a) {
|
|
22135
|
+
// Delete files in background without blocking the UI
|
|
22136
|
+
Promise.all(attachments.map(function (attachment) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22137
|
+
var error_2;
|
|
22138
|
+
return __generator(this, function (_a) {
|
|
22139
|
+
switch (_a.label) {
|
|
22140
|
+
case 0:
|
|
22141
|
+
_a.trys.push([0, 2, , 3]);
|
|
22142
|
+
return [4 /*yield*/, deleteUploadFile(attachment.UploadFileId)];
|
|
22143
|
+
case 1:
|
|
22144
|
+
_a.sent();
|
|
22145
|
+
return [3 /*break*/, 3];
|
|
22146
|
+
case 2:
|
|
22147
|
+
error_2 = _a.sent();
|
|
22148
|
+
// Log errors but don't fail the entire operation
|
|
22149
|
+
console.error("Failed to delete file ".concat(attachment.UploadFileId, ":"), error_2);
|
|
22150
|
+
return [3 /*break*/, 3];
|
|
22151
|
+
case 3: return [2 /*return*/];
|
|
22152
|
+
}
|
|
22153
|
+
});
|
|
22154
|
+
}); })).catch(function (error) {
|
|
22155
|
+
console.error("Background file deletion failed:", error);
|
|
22156
|
+
});
|
|
22157
|
+
return [2 /*return*/];
|
|
22158
|
+
});
|
|
22159
|
+
}); };
|
|
22160
|
+
var deleteUploadFile = function (uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22161
|
+
var apiService, parameters, resp;
|
|
22162
|
+
return __generator(this, function (_a) {
|
|
22163
|
+
switch (_a.label) {
|
|
22164
|
+
case 0:
|
|
22165
|
+
apiService = new MESApiService();
|
|
22166
|
+
parameters = [
|
|
22167
|
+
{ name: "UploadFileId", value: uploadFileId },
|
|
22168
|
+
];
|
|
22169
|
+
return [4 /*yield*/, apiService.callV2("[SYSTEM].[DeleteUploadFile]", parameters)];
|
|
22170
|
+
case 1:
|
|
22171
|
+
resp = _a.sent();
|
|
22172
|
+
if (!resp.ok) {
|
|
22173
|
+
throw new Error(resp.message || "Error deleting upload file");
|
|
22174
|
+
}
|
|
22175
|
+
return [2 /*return*/];
|
|
22176
|
+
}
|
|
22177
|
+
});
|
|
22178
|
+
}); };
|
|
22179
|
+
// Attachment management functions
|
|
22180
|
+
var getEntryAttachments = function (entryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22181
|
+
var apiService, parameters, resp, rows;
|
|
22182
|
+
return __generator(this, function (_a) {
|
|
22183
|
+
switch (_a.label) {
|
|
22184
|
+
case 0:
|
|
22185
|
+
apiService = new MESApiService();
|
|
22186
|
+
parameters = [{ name: "EntryId", value: entryId }];
|
|
22187
|
+
return [4 /*yield*/, apiService.callV2("[LB].[GetEntryAttachments]", parameters)];
|
|
22188
|
+
case 1:
|
|
22189
|
+
resp = _a.sent();
|
|
22190
|
+
if (resp.ok) {
|
|
22191
|
+
rows = get(resp, "data.tables[0].rows", []);
|
|
22192
|
+
rows = rows.map(function (attachment) { return (__assign(__assign({}, attachment), { CreationTime: attachment.CreationTime
|
|
22193
|
+
? moment$6.utc(attachment.CreationTime).toDate()
|
|
22194
|
+
: new Date() })); });
|
|
22195
|
+
return [2 /*return*/, rows];
|
|
22196
|
+
}
|
|
22197
|
+
else {
|
|
22198
|
+
throw new Error(resp.message || "Error fetching entry attachments");
|
|
22199
|
+
}
|
|
22200
|
+
}
|
|
22201
|
+
});
|
|
22202
|
+
}); };
|
|
22203
|
+
var upsertEntryAttachment = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
22204
|
+
var apiService, parameters, resp, attachment;
|
|
22205
|
+
var entryId = _b.entryId, uploadFileId = _b.uploadFileId, attachmentName = _b.attachmentName, attachmentURL = _b.attachmentURL;
|
|
22206
|
+
return __generator(this, function (_c) {
|
|
22207
|
+
switch (_c.label) {
|
|
22208
|
+
case 0:
|
|
22209
|
+
apiService = new MESApiService();
|
|
22210
|
+
parameters = [
|
|
22211
|
+
{ name: "EntryId", value: entryId },
|
|
22212
|
+
{ name: "UploadFileId", value: uploadFileId },
|
|
22213
|
+
{ name: "AttachmentName", value: attachmentName },
|
|
22214
|
+
{ name: "AttachmentURL", value: attachmentURL },
|
|
22215
|
+
];
|
|
22216
|
+
return [4 /*yield*/, apiService.callV2("[LB].[UpsertEntryAttachment]", parameters)];
|
|
22217
|
+
case 1:
|
|
22218
|
+
resp = _c.sent();
|
|
22219
|
+
if (resp.ok) {
|
|
22220
|
+
attachment = get(resp, "data.tables[0].rows[0]", null);
|
|
22221
|
+
if (attachment) {
|
|
22222
|
+
return [2 /*return*/, __assign(__assign({}, attachment), { CreationTime: attachment.CreationTime
|
|
22223
|
+
? moment$6.utc(attachment.CreationTime).toDate()
|
|
22224
|
+
: new Date() })];
|
|
22225
|
+
}
|
|
22226
|
+
return [2 /*return*/, null];
|
|
22227
|
+
}
|
|
22228
|
+
else {
|
|
22229
|
+
throw new Error(resp.message || "Error creating entry attachment");
|
|
22230
|
+
}
|
|
22231
|
+
}
|
|
22232
|
+
});
|
|
22233
|
+
}); };
|
|
22234
|
+
var deleteEntryAttachment = function (entryAttachmentId, uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22235
|
+
var apiService, parameters, resp;
|
|
22236
|
+
return __generator(this, function (_a) {
|
|
22237
|
+
switch (_a.label) {
|
|
22238
|
+
case 0:
|
|
22239
|
+
apiService = new MESApiService();
|
|
22240
|
+
parameters = [
|
|
22241
|
+
{ name: "EntryAttachmentId", value: entryAttachmentId },
|
|
22242
|
+
];
|
|
22243
|
+
return [4 /*yield*/, apiService.callV2("[LB].[DeleteEntryAttachment]", parameters)];
|
|
22244
|
+
case 1:
|
|
22245
|
+
resp = _a.sent();
|
|
22246
|
+
if (!resp.ok) {
|
|
22247
|
+
throw new Error(resp.message || "Error deleting entry attachment");
|
|
22248
|
+
}
|
|
22249
|
+
// Delete the associated file in background if UploadFileId was provided
|
|
22250
|
+
if (uploadFileId) {
|
|
22251
|
+
deleteUploadFileInBackground(uploadFileId);
|
|
22252
|
+
}
|
|
22253
|
+
return [2 /*return*/];
|
|
22254
|
+
}
|
|
22255
|
+
});
|
|
22256
|
+
}); };
|
|
22257
|
+
var deleteUploadFileInBackground = function (uploadFileId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22258
|
+
var error_3;
|
|
22259
|
+
return __generator(this, function (_a) {
|
|
22260
|
+
switch (_a.label) {
|
|
22261
|
+
case 0:
|
|
22262
|
+
_a.trys.push([0, 2, , 3]);
|
|
22263
|
+
return [4 /*yield*/, deleteUploadFile(uploadFileId)];
|
|
22264
|
+
case 1:
|
|
22265
|
+
_a.sent();
|
|
22266
|
+
return [3 /*break*/, 3];
|
|
22267
|
+
case 2:
|
|
22268
|
+
error_3 = _a.sent();
|
|
22269
|
+
// Log errors but don't fail the operation
|
|
22270
|
+
console.error("Failed to delete file ".concat(uploadFileId, ":"), error_3);
|
|
22271
|
+
return [3 /*break*/, 3];
|
|
22272
|
+
case 3: return [2 /*return*/];
|
|
22273
|
+
}
|
|
22274
|
+
});
|
|
22275
|
+
}); };
|
|
22276
|
+
|
|
22277
|
+
var useEntries = function (_a) {
|
|
22278
|
+
var shiftId = _a.shiftId, sectionIds = _a.sectionIds;
|
|
22279
|
+
return useQuery({
|
|
22280
|
+
queryKey: ["entries", shiftId, sectionIds],
|
|
22281
|
+
queryFn: function (_a) {
|
|
22282
|
+
var signal = _a.signal;
|
|
22283
|
+
return getEntries({ shiftId: shiftId, sectionIds: sectionIds, signal: signal });
|
|
22284
|
+
},
|
|
22285
|
+
});
|
|
22286
|
+
};
|
|
22287
|
+
var routeLogbookEntry = "/logbook/entry";
|
|
22288
|
+
|
|
22289
|
+
var useLogbookEntryOptionsFunctions = function (_a) {
|
|
22290
|
+
var setSelectedRowData = _a.setSelectedRowData, setShow = _a.setShow, setShowRemoveDialog = _a.setShowRemoveDialog, handleNewEntry = _a.handleNewEntry;
|
|
22291
|
+
var getMenuOptions = function (data) {
|
|
22292
|
+
var options = [];
|
|
22293
|
+
options = options.concat([
|
|
22294
|
+
{
|
|
22295
|
+
name: "New Entry",
|
|
22296
|
+
key: "new_logbook_entry",
|
|
22297
|
+
onClick: function () { return handleNewEntry(); },
|
|
22298
|
+
icon: React__default.createElement(PlaylistAddIcon, null),
|
|
22299
|
+
},
|
|
22300
|
+
]);
|
|
22301
|
+
if (data) {
|
|
22302
|
+
options = options.concat([
|
|
22303
|
+
{
|
|
22304
|
+
name: "Edit Entry",
|
|
22305
|
+
key: "edit_logbook_entry",
|
|
22306
|
+
onClick: function () {
|
|
22307
|
+
setSelectedRowData(data);
|
|
22308
|
+
setShow("edit");
|
|
22309
|
+
},
|
|
22310
|
+
icon: React__default.createElement(EditIcon, null),
|
|
22311
|
+
},
|
|
22312
|
+
{
|
|
22313
|
+
name: "Delete Entry",
|
|
22314
|
+
key: "delete_logbook_entry",
|
|
22315
|
+
onClick: function () {
|
|
22316
|
+
setShowRemoveDialog(true);
|
|
22317
|
+
},
|
|
22318
|
+
icon: React__default.createElement(DeleteIcon, null),
|
|
22319
|
+
},
|
|
22320
|
+
]);
|
|
22321
|
+
}
|
|
22322
|
+
return options;
|
|
22323
|
+
};
|
|
22324
|
+
return {
|
|
22325
|
+
getMenuOptions: getMenuOptions,
|
|
22326
|
+
};
|
|
22327
|
+
};
|
|
22328
|
+
|
|
22329
|
+
var useTableData$1 = function (_a) {
|
|
22330
|
+
var showContextMenu = _a.showContextMenu, allowAttachments = _a.allowAttachments, showShiftCrew = _a.showShiftCrew;
|
|
22331
|
+
var columnDefs = __spreadArray(__spreadArray(__spreadArray([
|
|
22332
|
+
{
|
|
22333
|
+
field: "CreateTimestamp",
|
|
22334
|
+
headerName: "Created",
|
|
22335
|
+
flex: 2,
|
|
22336
|
+
valueGetter: function (params) {
|
|
22337
|
+
return dxtToLocalServerTime(params.data.CreateTimestamp, "MM/dd/yy HH:mm");
|
|
22338
|
+
},
|
|
22339
|
+
},
|
|
22340
|
+
{
|
|
22341
|
+
field: "AssetName",
|
|
22342
|
+
headerName: "Asset",
|
|
22343
|
+
sortable: true,
|
|
22344
|
+
flex: 2,
|
|
22345
|
+
minWidth: 70,
|
|
22346
|
+
},
|
|
22347
|
+
{
|
|
22348
|
+
field: "Title",
|
|
22349
|
+
headerName: "Title",
|
|
22350
|
+
flex: 4,
|
|
22351
|
+
},
|
|
22352
|
+
{
|
|
22353
|
+
field: "SectionName",
|
|
22354
|
+
headerName: "Section",
|
|
22355
|
+
flex: 2,
|
|
22356
|
+
},
|
|
22357
|
+
{
|
|
22358
|
+
field: "Author",
|
|
22359
|
+
headerName: "Created By",
|
|
22360
|
+
flex: 2,
|
|
22361
|
+
}
|
|
22362
|
+
], (showShiftCrew
|
|
22363
|
+
? [
|
|
22364
|
+
{
|
|
22365
|
+
field: "Shift",
|
|
22366
|
+
headerName: "Shift",
|
|
22367
|
+
sortable: false,
|
|
22368
|
+
flex: 1,
|
|
22369
|
+
minWidth: 60,
|
|
22370
|
+
maxWidth: 60,
|
|
22371
|
+
},
|
|
22372
|
+
{
|
|
22373
|
+
field: "Crew",
|
|
22374
|
+
headerName: "Crew",
|
|
22375
|
+
sortable: false,
|
|
22376
|
+
flex: 1,
|
|
22377
|
+
minWidth: 60,
|
|
22378
|
+
maxWidth: 60,
|
|
22379
|
+
},
|
|
22380
|
+
]
|
|
22381
|
+
: []), true), (allowAttachments
|
|
22382
|
+
? [
|
|
22383
|
+
{
|
|
22384
|
+
field: "AttachmentCount",
|
|
22385
|
+
headerName: "",
|
|
22386
|
+
flex: 1,
|
|
22387
|
+
headerComponent: function () { return (React__default.createElement("div", { style: {
|
|
22388
|
+
display: "flex",
|
|
22389
|
+
alignItems: "center",
|
|
22390
|
+
justifyContent: "center",
|
|
22391
|
+
height: "100%",
|
|
22392
|
+
width: "100%",
|
|
22393
|
+
textAlign: "center",
|
|
22394
|
+
} },
|
|
22395
|
+
React__default.createElement(AttachFile, { style: { fontSize: 18, color: "#666" } }))); },
|
|
22396
|
+
cellRenderer: function (params) {
|
|
22397
|
+
var count = params.data.AttachmentCount || 0;
|
|
22398
|
+
if (count === 0) {
|
|
22399
|
+
return null;
|
|
22400
|
+
}
|
|
22401
|
+
return (React__default.createElement("div", { style: {
|
|
22402
|
+
display: "flex",
|
|
22403
|
+
alignItems: "center",
|
|
22404
|
+
height: "100%",
|
|
22405
|
+
justifyContent: "center",
|
|
22406
|
+
} },
|
|
22407
|
+
React__default.createElement(Chip, { icon: React__default.createElement(AttachFile, { style: { fontSize: 16 } }), label: count, size: "small", variant: "outlined", color: "primary" })));
|
|
22408
|
+
},
|
|
22409
|
+
},
|
|
22410
|
+
]
|
|
22411
|
+
: []), true), [
|
|
22412
|
+
{
|
|
22413
|
+
field: "Content",
|
|
22414
|
+
headerName: "Content",
|
|
22415
|
+
hide: true,
|
|
22416
|
+
},
|
|
22417
|
+
{
|
|
22418
|
+
headerName: "",
|
|
22419
|
+
flex: 1,
|
|
22420
|
+
wrapText: false,
|
|
22421
|
+
autoHeight: false,
|
|
22422
|
+
cellRenderer: function (params) {
|
|
22423
|
+
return (React__default.createElement(Grid2, { container: true, style: {
|
|
22424
|
+
height: "100%",
|
|
22425
|
+
display: "flex",
|
|
22426
|
+
justifyContent: "center",
|
|
22427
|
+
alignItems: "center",
|
|
22428
|
+
} },
|
|
22429
|
+
React__default.createElement(Grid2, { size: { md: 12, xs: 12 }, style: {
|
|
22430
|
+
display: "flex",
|
|
22431
|
+
justifyContent: "center",
|
|
22432
|
+
alignItems: "center",
|
|
22433
|
+
} },
|
|
22434
|
+
React__default.createElement(Button, { fullWidth: true, onClick: function (e) {
|
|
22435
|
+
return showContextMenu(e, params.data, "logbookEntryContext");
|
|
22436
|
+
}, size: "small" },
|
|
22437
|
+
React__default.createElement(FormatListBulletedSharpIcon, { style: { height: "auto" }, color: "action" })))));
|
|
22438
|
+
},
|
|
22439
|
+
},
|
|
22440
|
+
], false);
|
|
22441
|
+
return { columnDefs: columnDefs };
|
|
22442
|
+
};
|
|
22443
|
+
|
|
22444
|
+
var ENTRY_INITIAL_VALUES = {
|
|
22445
|
+
EntryId: 0,
|
|
22446
|
+
ShiftId: 0,
|
|
22447
|
+
AssetId: null,
|
|
22448
|
+
Title: "",
|
|
22449
|
+
Content: "",
|
|
22450
|
+
CreateTimestamp: new Date(),
|
|
22451
|
+
UpdateTimestamp: new Date(),
|
|
22452
|
+
LogEntryTypeCode: "S", // Default 'S'
|
|
22453
|
+
Shift: null,
|
|
22454
|
+
Crew: null,
|
|
22455
|
+
Author: null,
|
|
22456
|
+
UpdatedBy: null,
|
|
22457
|
+
AttachmentCount: 0,
|
|
22458
|
+
// Section defaults
|
|
22459
|
+
SectionId: null,
|
|
22460
|
+
SectionName: undefined,
|
|
22461
|
+
SectionFamilyName: undefined,
|
|
22462
|
+
WeighUp: undefined,
|
|
22463
|
+
BreakIn: undefined,
|
|
22464
|
+
SectionNotes: undefined,
|
|
22465
|
+
};
|
|
22466
|
+
|
|
22467
|
+
var RemoveEntryDialog = function (_a) {
|
|
22468
|
+
var entry = _a.entry, show = _a.show, onHide = _a.onHide;
|
|
22469
|
+
var navigate = useNavigate();
|
|
22470
|
+
var _b = useState(false), isSubmitLoading = _b[0], setIsSubmitLoading = _b[1];
|
|
22471
|
+
var _c = useState(""); _c[0]; var setSuccessMessage = _c[1];
|
|
22472
|
+
var _d = useState(""), error = _d[0], setError = _d[1];
|
|
22473
|
+
var handleCancel = function () {
|
|
22474
|
+
setIsSubmitLoading(false);
|
|
22475
|
+
onHide(false);
|
|
22476
|
+
};
|
|
22477
|
+
var queryClient = useQueryClient();
|
|
22478
|
+
var removeEntry = useMutation(deleteEntry, {
|
|
22479
|
+
onSuccess: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
22480
|
+
return __generator(this, function (_a) {
|
|
22481
|
+
switch (_a.label) {
|
|
22482
|
+
case 0: return [4 /*yield*/, queryClient.invalidateQueries({ queryKey: ["entries"] })];
|
|
22483
|
+
case 1:
|
|
22484
|
+
_a.sent();
|
|
22485
|
+
navigate("".concat(routeLogbookEntry), { replace: true });
|
|
22486
|
+
setSuccessMessage("The entry was deleted succesfully");
|
|
22487
|
+
onHide(true);
|
|
22488
|
+
return [2 /*return*/];
|
|
22489
|
+
}
|
|
22490
|
+
});
|
|
22491
|
+
}); },
|
|
22492
|
+
onError: function (error) {
|
|
22493
|
+
setError(error.message);
|
|
22494
|
+
},
|
|
22495
|
+
onSettled: function () { return setIsSubmitLoading(false); },
|
|
22496
|
+
});
|
|
22497
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
22498
|
+
React__default.createElement(Dialog$1, { fullWidth: true, maxWidth: "md", open: show, onClose: function () { return handleCancel(); }, disableEnforceFocus: true, sx: {
|
|
22499
|
+
"& .input-group-text": {
|
|
22500
|
+
display: "none",
|
|
22501
|
+
},
|
|
22502
|
+
"& .MuiDialogContent-dividers": {
|
|
22503
|
+
padding: 0,
|
|
22504
|
+
},
|
|
22505
|
+
} },
|
|
22506
|
+
React__default.createElement(DialogTitle$1, { id: "responsive-dialog-title", style: { paddingBottom: 0 } }, "WARNING"),
|
|
22507
|
+
React__default.createElement(DialogContent$1, null,
|
|
22508
|
+
React__default.createElement(DialogContentText, { style: { padding: 0, margin: 0 } },
|
|
22509
|
+
"Be careful, you are about to delete: ",
|
|
22510
|
+
React__default.createElement("b", null, entry === null || entry === void 0 ? void 0 : entry.Title),
|
|
22511
|
+
". Once deleted you will not be able to recover this Entry. Are you sure you want to delete it?")),
|
|
22512
|
+
React__default.createElement(DialogActions$1, { style: { padding: "0 24px 16px" } },
|
|
22513
|
+
React__default.createElement(Button, { onClick: function () { return onHide(false); }, autoFocus: true, color: "inherit" }, "CANCEL"),
|
|
22514
|
+
React__default.createElement(Button, { autoFocus: true, color: "secondary", startIcon: isSubmitLoading && React__default.createElement(CircularProgress, { size: "1rem" }), onClick: function () { var _a; return removeEntry.mutate((_a = entry === null || entry === void 0 ? void 0 : entry.EntryId) !== null && _a !== void 0 ? _a : 0); } }, "Delete"))),
|
|
22515
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
22516
|
+
};
|
|
22517
|
+
|
|
22518
|
+
var moment$5 = getMomentTz();
|
|
22519
|
+
var getSections = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
22520
|
+
var apiService, parameters, resp;
|
|
22521
|
+
var schema = _b.schema, sectionFamilyId = _b.sectionFamilyId, searchText = _b.searchText, signal = _b.signal;
|
|
22522
|
+
return __generator(this, function (_c) {
|
|
22523
|
+
switch (_c.label) {
|
|
22524
|
+
case 0:
|
|
22525
|
+
apiService = new MESApiService();
|
|
22526
|
+
parameters = [];
|
|
22527
|
+
if (sectionFamilyId) {
|
|
22528
|
+
parameters.push({ name: "SectionFamilyId", value: sectionFamilyId });
|
|
22529
|
+
}
|
|
22530
|
+
if (searchText) {
|
|
22531
|
+
parameters.push({ name: "SearchText", value: searchText });
|
|
22532
|
+
}
|
|
22533
|
+
return [4 /*yield*/, apiService.callV2("[".concat(schema, "].[GetSections]"), parameters, signal)];
|
|
22534
|
+
case 1:
|
|
22535
|
+
resp = _c.sent();
|
|
22536
|
+
if (resp.ok) {
|
|
22537
|
+
return [2 /*return*/, get(resp, "data.tables[0].rows", [])];
|
|
22538
|
+
}
|
|
22539
|
+
else {
|
|
22540
|
+
throw new Error(resp.message || "Error fetching sections");
|
|
22541
|
+
}
|
|
22542
|
+
}
|
|
22543
|
+
});
|
|
22544
|
+
}); };
|
|
22545
|
+
var getTopUsedSections = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
22546
|
+
var apiService, parameters, resp, rows;
|
|
22547
|
+
var schema = _b.schema, _c = _b.top, top = _c === void 0 ? 5 : _c, signal = _b.signal;
|
|
22548
|
+
return __generator(this, function (_d) {
|
|
22549
|
+
switch (_d.label) {
|
|
22550
|
+
case 0:
|
|
22551
|
+
apiService = new MESApiService();
|
|
22552
|
+
parameters = [{ name: "Top", value: top }];
|
|
22553
|
+
return [4 /*yield*/, apiService.callV2("[".concat(schema, "].[GetTopUsedSections]"), parameters, signal)];
|
|
22554
|
+
case 1:
|
|
22555
|
+
resp = _d.sent();
|
|
22556
|
+
if (resp.ok) {
|
|
22557
|
+
rows = get(resp, "data.tables[0].rows", []);
|
|
22558
|
+
rows = rows.map(function (section) { return (__assign(__assign({}, section), { LastUsedTimestamp: section.LastUsedTimestamp
|
|
22559
|
+
? moment$5.utc(section.LastUsedTimestamp).toDate()
|
|
22560
|
+
: null })); });
|
|
22561
|
+
return [2 /*return*/, rows];
|
|
22562
|
+
}
|
|
22563
|
+
else {
|
|
22564
|
+
throw new Error(resp.message || "Error fetching top used sections");
|
|
22565
|
+
}
|
|
22566
|
+
}
|
|
22567
|
+
});
|
|
22568
|
+
}); };
|
|
22569
|
+
|
|
22570
|
+
var useSections = function (_a) {
|
|
22571
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.searchText, searchText = _c === void 0 ? null : _c, _d = _b.enabled, enabled = _d === void 0 ? true : _d;
|
|
22572
|
+
var section = useLogbookSettings().section;
|
|
22573
|
+
var schema = section === null || section === void 0 ? void 0 : section.schema;
|
|
22574
|
+
return useQuery({
|
|
22575
|
+
queryKey: ["sections", schema, searchText],
|
|
22576
|
+
queryFn: function (_a) {
|
|
22577
|
+
var signal = _a.signal;
|
|
22578
|
+
return getSections({ schema: schema, searchText: searchText, signal: signal });
|
|
22579
|
+
},
|
|
22580
|
+
enabled: enabled,
|
|
22581
|
+
});
|
|
22582
|
+
};
|
|
22583
|
+
|
|
22584
|
+
var useTopSections = function (_a) {
|
|
22585
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.top, top = _c === void 0 ? 5 : _c;
|
|
22586
|
+
var section = useLogbookSettings().section;
|
|
22587
|
+
var schema = section === null || section === void 0 ? void 0 : section.schema;
|
|
22588
|
+
return useQuery({
|
|
22589
|
+
queryKey: ["topSections", schema, top],
|
|
22590
|
+
queryFn: function (_a) {
|
|
22591
|
+
var signal = _a.signal;
|
|
22592
|
+
return getTopUsedSections({ schema: schema, top: top, signal: signal });
|
|
22593
|
+
},
|
|
22594
|
+
});
|
|
22595
|
+
};
|
|
22596
|
+
|
|
22597
|
+
var SectionSelector = function (_a) {
|
|
22598
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.topSectionsCount, topSectionsCount = _b === void 0 ? 5 : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.label, label = _d === void 0 ? "Section" : _d;
|
|
22599
|
+
var _e = useState(false), open = _e[0], setOpen = _e[1];
|
|
22600
|
+
var _f = useState(""), inputValue = _f[0], setInputValue = _f[1];
|
|
22601
|
+
var _g = useTopSections({
|
|
22602
|
+
top: topSectionsCount,
|
|
22603
|
+
}), _h = _g.data, topSections = _h === void 0 ? [] : _h, loadingTop = _g.isLoading;
|
|
22604
|
+
var _j = useSections({
|
|
22605
|
+
searchText: inputValue || null,
|
|
22606
|
+
enabled: open,
|
|
22607
|
+
}), _k = _j.data, options = _k === void 0 ? [] : _k, loading = _j.isFetching;
|
|
22608
|
+
var handleChipClick = function (section) {
|
|
22609
|
+
if ((value === null || value === void 0 ? void 0 : value.SectionId) === section.SectionId) {
|
|
22610
|
+
onChange(null);
|
|
22611
|
+
}
|
|
22612
|
+
else {
|
|
22613
|
+
onChange(section);
|
|
22614
|
+
}
|
|
22615
|
+
};
|
|
22616
|
+
return (React__default.createElement(Box, { sx: {
|
|
22617
|
+
display: "flex",
|
|
22618
|
+
flexDirection: "row",
|
|
22619
|
+
alignItems: "center",
|
|
22620
|
+
gap: 1,
|
|
22621
|
+
flexWrap: "wrap",
|
|
22622
|
+
} },
|
|
22623
|
+
React__default.createElement(Autocomplete$1, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, value: value, onChange: function (_, newValue) { return onChange(newValue); }, inputValue: inputValue, onInputChange: function (_, newInputValue) { return setInputValue(newInputValue); }, options: options, loading: loading, disabled: disabled, getOptionLabel: function (option) { return option.SectionName; }, isOptionEqualToValue: function (option, value) {
|
|
22624
|
+
return option.SectionId === value.SectionId;
|
|
22625
|
+
}, sx: { minWidth: 120, maxWidth: 150 }, renderOption: function (props, option) { return (React__default.createElement(Box, __assign({ component: "li" }, props, { key: option.SectionId, sx: { display: "flex", justifyContent: "space-between" } }),
|
|
22626
|
+
React__default.createElement(Typography$1, { fontWeight: 500 }, option.SectionName))); }, renderInput: function (params) { return (React__default.createElement(TextField, __assign({}, params, { label: label, placeholder: "####", size: "small", slotProps: {
|
|
22627
|
+
input: __assign(__assign({}, params.InputProps), { endAdornment: (React__default.createElement(React__default.Fragment, null,
|
|
22628
|
+
loading ? (React__default.createElement(CircularProgress, { color: "inherit", size: 16 })) : null,
|
|
22629
|
+
params.InputProps.endAdornment)) }),
|
|
22630
|
+
} }))); } }),
|
|
22631
|
+
loadingTop ? (React__default.createElement(CircularProgress, { size: 14 })) : topSections.length > 0 ? (React__default.createElement(Box, { sx: {
|
|
22632
|
+
display: "flex",
|
|
22633
|
+
flexWrap: "wrap",
|
|
22634
|
+
gap: 0.5,
|
|
22635
|
+
alignItems: "center",
|
|
22636
|
+
} },
|
|
22637
|
+
React__default.createElement(Typography$1, { variant: "caption", color: "text.secondary", sx: { mr: 0.5 } }, "Top:"),
|
|
22638
|
+
topSections.map(function (section) { return (React__default.createElement(Chip, { key: section.SectionId, label: section.SectionName, size: "small", variant: (value === null || value === void 0 ? void 0 : value.SectionId) === section.SectionId ? "filled" : "outlined", color: (value === null || value === void 0 ? void 0 : value.SectionId) === section.SectionId ? "primary" : "default", onClick: function () { return handleChipClick(section); }, disabled: disabled, sx: {
|
|
22639
|
+
cursor: "pointer",
|
|
22640
|
+
height: 22,
|
|
22641
|
+
"& .MuiChip-label": { px: 1, fontSize: "0.75rem" },
|
|
22642
|
+
} })); }))) : null));
|
|
22643
|
+
};
|
|
22644
|
+
|
|
22645
|
+
var SectionMultiSelect = function (_a) {
|
|
22646
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.topSectionsCount, topSectionsCount = _b === void 0 ? 5 : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.label, label = _d === void 0 ? "Sections" : _d;
|
|
22647
|
+
var _e = useState(false), open = _e[0], setOpen = _e[1];
|
|
22648
|
+
var _f = useState(""), inputValue = _f[0], setInputValue = _f[1];
|
|
22649
|
+
var _g = useTopSections({
|
|
22650
|
+
top: topSectionsCount,
|
|
22651
|
+
}), _h = _g.data, topSections = _h === void 0 ? [] : _h, loadingTop = _g.isLoading;
|
|
22652
|
+
var _j = useSections({
|
|
22653
|
+
searchText: inputValue || null,
|
|
22654
|
+
enabled: open,
|
|
22655
|
+
}), _k = _j.data, options = _k === void 0 ? [] : _k, loading = _j.isFetching;
|
|
22656
|
+
var handleChipClick = function (section) {
|
|
22657
|
+
var isSelected = value.some(function (s) { return s.SectionId === section.SectionId; });
|
|
22658
|
+
if (isSelected) {
|
|
22659
|
+
onChange(value.filter(function (s) { return s.SectionId !== section.SectionId; }));
|
|
22660
|
+
}
|
|
22661
|
+
else {
|
|
22662
|
+
onChange(__spreadArray(__spreadArray([], value, true), [section], false));
|
|
22663
|
+
}
|
|
22664
|
+
};
|
|
22665
|
+
return (React__default.createElement(Box, { sx: {
|
|
22666
|
+
display: "flex",
|
|
22667
|
+
flexDirection: "row",
|
|
22668
|
+
alignItems: "center",
|
|
22669
|
+
gap: 1,
|
|
22670
|
+
flexWrap: "wrap",
|
|
22671
|
+
} },
|
|
22672
|
+
React__default.createElement(Autocomplete$1, { multiple: true, open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, value: value, onChange: function (_, newValue) { return onChange(newValue); }, inputValue: inputValue, onInputChange: function (_, newInputValue) { return setInputValue(newInputValue); }, options: options, loading: loading, disabled: disabled, getOptionLabel: function (option) { return option.SectionName; }, isOptionEqualToValue: function (option, val) {
|
|
22673
|
+
return option.SectionId === val.SectionId;
|
|
22674
|
+
}, limitTags: 2, size: "small", sx: { minWidth: 200, flex: 1 }, renderOption: function (props, option) { return (React__default.createElement(Box, __assign({ component: "li" }, props, { key: option.SectionId, sx: { display: "flex", justifyContent: "space-between" } }),
|
|
22675
|
+
React__default.createElement(Typography$1, { fontWeight: 500 }, option.SectionName))); }, renderInput: function (params) { return (React__default.createElement(TextField, __assign({}, params, { label: label, placeholder: value.length === 0 ? "All sections" : "", size: "small", slotProps: {
|
|
22676
|
+
input: __assign(__assign({}, params.InputProps), { endAdornment: (React__default.createElement(React__default.Fragment, null,
|
|
22677
|
+
loading ? (React__default.createElement(CircularProgress, { color: "inherit", size: 16 })) : null,
|
|
22678
|
+
params.InputProps.endAdornment)) }),
|
|
22679
|
+
} }))); } }),
|
|
22680
|
+
loadingTop ? (React__default.createElement(CircularProgress, { size: 14 })) : topSections.length > 0 ? (React__default.createElement(Box, { sx: {
|
|
22681
|
+
display: "flex",
|
|
22682
|
+
flexWrap: "wrap",
|
|
22683
|
+
gap: 0.5,
|
|
22684
|
+
alignItems: "center",
|
|
22685
|
+
} },
|
|
22686
|
+
React__default.createElement(Typography$1, { variant: "caption", color: "text.secondary", sx: { mr: 0.5 } }, "Top:"),
|
|
22687
|
+
topSections.map(function (section) {
|
|
22688
|
+
var isSelected = value.some(function (s) { return s.SectionId === section.SectionId; });
|
|
22689
|
+
return (React__default.createElement(Chip, { key: section.SectionId, label: section.SectionName, size: "small", variant: isSelected ? "filled" : "outlined", color: isSelected ? "primary" : "default", onClick: function () { return handleChipClick(section); }, disabled: disabled, sx: {
|
|
22690
|
+
cursor: "pointer",
|
|
22691
|
+
height: 22,
|
|
22692
|
+
"& .MuiChip-label": { px: 1, fontSize: "0.75rem" },
|
|
22693
|
+
} }));
|
|
22694
|
+
}))) : null));
|
|
22695
|
+
};
|
|
22696
|
+
|
|
22697
|
+
var upsertSectionEntry = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
22698
|
+
var apiService, parameters, resp;
|
|
22699
|
+
var entryId = _b.entryId, sectionId = _b.sectionId, weighUp = _b.weighUp, breakIn = _b.breakIn, notes = _b.notes;
|
|
22700
|
+
return __generator(this, function (_c) {
|
|
22701
|
+
switch (_c.label) {
|
|
22702
|
+
case 0:
|
|
22703
|
+
apiService = new MESApiService();
|
|
22704
|
+
parameters = [
|
|
22705
|
+
{ name: "EntryId", value: entryId },
|
|
22706
|
+
{ name: "SectionId", value: sectionId },
|
|
22707
|
+
];
|
|
22708
|
+
if (weighUp !== undefined) {
|
|
22709
|
+
parameters.push({ name: "WeighUp", value: weighUp });
|
|
22710
|
+
}
|
|
22711
|
+
if (breakIn !== undefined) {
|
|
22712
|
+
parameters.push({ name: "BreakIn", value: breakIn });
|
|
22713
|
+
}
|
|
22714
|
+
if (notes !== undefined) {
|
|
22715
|
+
parameters.push({ name: "Notes", value: notes });
|
|
22716
|
+
}
|
|
22717
|
+
return [4 /*yield*/, apiService.callV2("[SWV].[UpsertLogSectionEntry]", parameters)];
|
|
22718
|
+
case 1:
|
|
22719
|
+
resp = _c.sent();
|
|
22720
|
+
if (resp.ok) {
|
|
22721
|
+
return [2 /*return*/, get(resp, "data.tables[0].rows[0]", null)];
|
|
22722
|
+
}
|
|
22723
|
+
else {
|
|
22724
|
+
throw new Error(resp.message || "Error upserting section entry");
|
|
22725
|
+
}
|
|
22726
|
+
}
|
|
22727
|
+
});
|
|
22728
|
+
}); };
|
|
22729
|
+
|
|
22730
|
+
var useEntrySubmission = function (_a) {
|
|
22731
|
+
var _b = _a === void 0 ? {} : _a, onSuccess = _b.onSuccess, onError = _b.onError, _c = _b.isNewEntry, isNewEntry = _c === void 0 ? false : _c, _d = _b.onHide, onHide = _d === void 0 ? function () { } : _d;
|
|
22732
|
+
var _e = useState(false), isSubmitLoading = _e[0], setIsSubmitLoading = _e[1];
|
|
22733
|
+
var _f = useState(false), showConfirmationDialog = _f[0], setShowConfirmationDialog = _f[1];
|
|
22734
|
+
var _g = useState(null), pendingSubmitData = _g[0], setPendingSubmitData = _g[1];
|
|
22735
|
+
var submit = useMutation(upsertEntry, {
|
|
22736
|
+
onSuccess: function (entry) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22737
|
+
return __generator(this, function (_a) {
|
|
22738
|
+
if (entry && entry.EntryId) {
|
|
22739
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(entry);
|
|
22740
|
+
}
|
|
22741
|
+
else {
|
|
22742
|
+
console.error("No EntryId received from API response", entry);
|
|
22743
|
+
onError === null || onError === void 0 ? void 0 : onError(new Error("Failed to get entry ID from server response"));
|
|
22744
|
+
}
|
|
22745
|
+
return [2 /*return*/];
|
|
22746
|
+
});
|
|
22747
|
+
}); },
|
|
22748
|
+
onError: function (error) {
|
|
22749
|
+
onError === null || onError === void 0 ? void 0 : onError(error);
|
|
22750
|
+
},
|
|
22751
|
+
onSettled: function () { return setIsSubmitLoading(false); },
|
|
22752
|
+
});
|
|
22753
|
+
var submitEntry = function (formData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22754
|
+
var submissionData;
|
|
22755
|
+
var _a;
|
|
22756
|
+
return __generator(this, function (_b) {
|
|
22757
|
+
switch (_b.label) {
|
|
22758
|
+
case 0:
|
|
22759
|
+
setIsSubmitLoading(true);
|
|
22760
|
+
submissionData = __assign({}, formData);
|
|
22761
|
+
if (isNewEntry && !submissionData.createTimestamp) {
|
|
22762
|
+
submissionData.createTimestamp = new Date();
|
|
22763
|
+
}
|
|
22764
|
+
if (!(!submissionData.shiftId || submissionData.isForOtherShift)) return [3 /*break*/, 1];
|
|
22765
|
+
setPendingSubmitData(submissionData);
|
|
22766
|
+
setShowConfirmationDialog(true);
|
|
22767
|
+
setIsSubmitLoading(false);
|
|
22768
|
+
return [3 /*break*/, 3];
|
|
22769
|
+
case 1: return [4 /*yield*/, submit.mutate({
|
|
22770
|
+
assetId: submissionData.assetId,
|
|
22771
|
+
shiftId: submissionData.shiftId,
|
|
22772
|
+
entryId: submissionData.entryId,
|
|
22773
|
+
title: submissionData.title,
|
|
22774
|
+
content: submissionData.content,
|
|
22775
|
+
author: (_a = submissionData.author) !== null && _a !== void 0 ? _a : "",
|
|
22776
|
+
createTimestamp: submissionData.createTimestamp,
|
|
22777
|
+
})];
|
|
22778
|
+
case 2:
|
|
22779
|
+
_b.sent();
|
|
22780
|
+
_b.label = 3;
|
|
22781
|
+
case 3: return [2 /*return*/];
|
|
22782
|
+
}
|
|
22783
|
+
});
|
|
22784
|
+
}); };
|
|
22785
|
+
var handleConfirmationClose = function (value) {
|
|
22786
|
+
var _a;
|
|
22787
|
+
setShowConfirmationDialog(false);
|
|
22788
|
+
if (value === "OK" && pendingSubmitData) {
|
|
22789
|
+
onHide();
|
|
22790
|
+
submit.mutate({
|
|
22791
|
+
assetId: pendingSubmitData.assetId,
|
|
22792
|
+
shiftId: pendingSubmitData.shiftId,
|
|
22793
|
+
entryId: pendingSubmitData.entryId,
|
|
22794
|
+
title: pendingSubmitData.title,
|
|
22795
|
+
content: pendingSubmitData.content,
|
|
22796
|
+
author: (_a = pendingSubmitData.author) !== null && _a !== void 0 ? _a : "",
|
|
22797
|
+
createTimestamp: pendingSubmitData.createTimestamp,
|
|
22798
|
+
});
|
|
22799
|
+
}
|
|
22800
|
+
setPendingSubmitData(null);
|
|
22801
|
+
};
|
|
22802
|
+
return {
|
|
22803
|
+
submitEntry: submitEntry,
|
|
22804
|
+
isSubmitLoading: isSubmitLoading,
|
|
22805
|
+
showConfirmationDialog: showConfirmationDialog,
|
|
22806
|
+
pendingSubmitData: pendingSubmitData,
|
|
22807
|
+
handleConfirmationClose: handleConfirmationClose,
|
|
22808
|
+
mutation: submit,
|
|
22809
|
+
};
|
|
22810
|
+
};
|
|
22811
|
+
|
|
22812
|
+
var DeleteAttachmentConfirmationDialog = function (_a) {
|
|
22813
|
+
var open = _a.open, attachmentName = _a.attachmentName, onClose = _a.onClose, _b = _a.isDeleting, isDeleting = _b === void 0 ? false : _b;
|
|
22814
|
+
var _c = useState(false), isClosing = _c[0], setIsClosing = _c[1];
|
|
22815
|
+
var handleCancel = function () {
|
|
22816
|
+
if (isClosing)
|
|
22817
|
+
return;
|
|
22818
|
+
onClose(false);
|
|
22819
|
+
};
|
|
22820
|
+
var handleConfirm = function () {
|
|
22821
|
+
if (isClosing)
|
|
22822
|
+
return;
|
|
22823
|
+
setIsClosing(true);
|
|
22824
|
+
onClose(true);
|
|
22825
|
+
};
|
|
22826
|
+
return (React__default.createElement(Dialog$1, { open: open, onClose: handleCancel, "aria-labelledby": "delete-attachment-dialog-title", "aria-describedby": "delete-attachment-dialog-description" },
|
|
22827
|
+
React__default.createElement(DialogTitle$1, { id: "delete-attachment-dialog-title" }, "Delete Attachment"),
|
|
22828
|
+
React__default.createElement(DialogContent$1, null,
|
|
22829
|
+
React__default.createElement(DialogContentText, { id: "delete-attachment-dialog-description" },
|
|
22830
|
+
"Are you sure you want to delete ",
|
|
22831
|
+
React__default.createElement("b", null, attachmentName),
|
|
22832
|
+
"? This action cannot be undone.")),
|
|
22833
|
+
React__default.createElement(DialogActions$1, null,
|
|
22834
|
+
React__default.createElement(Button, { onClick: handleCancel, color: "inherit", disabled: isClosing }, "Cancel"),
|
|
22835
|
+
React__default.createElement(Button, { onClick: handleConfirm, color: "secondary", variant: "contained", disabled: isClosing, startIcon: isDeleting && React__default.createElement(CircularProgress, { size: "1rem" }) }, "Delete"))));
|
|
22836
|
+
};
|
|
22837
|
+
|
|
22838
|
+
var AttachmentModal = function (_a) {
|
|
22839
|
+
var open = _a.open, onClose = _a.onClose, entryId = _a.entryId, isEditing = _a.isEditing, entryData = _a.entryData, onEntrySubmitted = _a.onEntrySubmitted;
|
|
22840
|
+
var queryClient = useQueryClient();
|
|
22841
|
+
var api = new MESApiService();
|
|
22842
|
+
var _b = useState(null), error = _b[0], setError = _b[1];
|
|
22843
|
+
var _c = useState([]), uploadingFiles = _c[0], setUploadingFiles = _c[1];
|
|
22844
|
+
var _d = useState(entryId), currentEntryId = _d[0], setCurrentEntryId = _d[1];
|
|
22845
|
+
var _e = useState(false), isSubmittingEntry = _e[0], setIsSubmittingEntry = _e[1];
|
|
22846
|
+
var _f = useState(false), showDeleteConfirmation = _f[0], setShowDeleteConfirmation = _f[1];
|
|
22847
|
+
var _g = useState(null), attachmentToDelete = _g[0], setAttachmentToDelete = _g[1];
|
|
22848
|
+
var pendingFilesRef = useRef([]);
|
|
22849
|
+
// Entry submission hook for background saves
|
|
22850
|
+
var _h = useEntrySubmission({
|
|
22851
|
+
onSuccess: function (entry) {
|
|
22852
|
+
setIsSubmittingEntry(false);
|
|
22853
|
+
if (entry === null || entry === void 0 ? void 0 : entry.EntryId) {
|
|
22854
|
+
setCurrentEntryId(entry.EntryId);
|
|
22855
|
+
onEntrySubmitted === null || onEntrySubmitted === void 0 ? void 0 : onEntrySubmitted(entry.EntryId, entry);
|
|
22856
|
+
// If there are pending files, upload them now with the new entry ID
|
|
22857
|
+
if (pendingFilesRef.current.length > 0) {
|
|
22858
|
+
var filesToUpload = __spreadArray([], pendingFilesRef.current, true);
|
|
22859
|
+
pendingFilesRef.current = [];
|
|
22860
|
+
// Call upload directly with the new entry ID instead of relying on state
|
|
22861
|
+
uploadFilesWithEntryId(filesToUpload, entry.EntryId);
|
|
22862
|
+
}
|
|
22863
|
+
}
|
|
22864
|
+
},
|
|
22865
|
+
onError: function (error) {
|
|
22866
|
+
setIsSubmittingEntry(false);
|
|
22867
|
+
setError(error.message);
|
|
22868
|
+
pendingFilesRef.current = []; // Clear pending files on error
|
|
22869
|
+
},
|
|
22870
|
+
isNewEntry: !entryId || entryId <= 0,
|
|
22871
|
+
}), submitEntry = _h.submitEntry, isSubmitLoading = _h.isSubmitLoading;
|
|
22872
|
+
// Sync entryId prop with currentEntryId state
|
|
22873
|
+
useEffect(function () {
|
|
22874
|
+
setCurrentEntryId(entryId);
|
|
22875
|
+
}, [entryId]);
|
|
22876
|
+
// Query for fetching attachments
|
|
22877
|
+
var _j = useQuery({
|
|
22878
|
+
queryKey: ["entryAttachments", currentEntryId],
|
|
22879
|
+
queryFn: function () { return getEntryAttachments(currentEntryId); },
|
|
22880
|
+
enabled: !!currentEntryId && currentEntryId > 0,
|
|
22881
|
+
}), _k = _j.data, attachments = _k === void 0 ? [] : _k, isLoading = _j.isLoading, fetchError = _j.error;
|
|
22882
|
+
// Mutations
|
|
22883
|
+
var uploadMutation = useMutation(upsertEntryAttachment, {
|
|
22884
|
+
onSuccess: function () {
|
|
22885
|
+
queryClient.invalidateQueries(["entryAttachments", currentEntryId]);
|
|
22886
|
+
queryClient.invalidateQueries(["entries"]);
|
|
22887
|
+
queryClient.invalidateQueries(["entriesReport"]);
|
|
22888
|
+
},
|
|
22889
|
+
onError: function (error) {
|
|
22890
|
+
setError(error.message);
|
|
22891
|
+
},
|
|
22892
|
+
});
|
|
22893
|
+
var deleteMutation = useMutation(function (_a) {
|
|
22894
|
+
var entryAttachmentId = _a.entryAttachmentId, uploadFileId = _a.uploadFileId;
|
|
22895
|
+
return deleteEntryAttachment(entryAttachmentId, uploadFileId);
|
|
22896
|
+
}, {
|
|
22897
|
+
onSuccess: function () {
|
|
22898
|
+
queryClient.invalidateQueries(["entryAttachments", currentEntryId]);
|
|
22899
|
+
queryClient.invalidateQueries(["entries"]);
|
|
22900
|
+
queryClient.invalidateQueries(["entriesReport"]);
|
|
22901
|
+
},
|
|
22902
|
+
onError: function (error) {
|
|
22903
|
+
setError(error.message);
|
|
22904
|
+
},
|
|
22905
|
+
});
|
|
22906
|
+
// Function to upload files with a specific entry ID (used after background submission)
|
|
22907
|
+
var uploadFilesWithEntryId = useCallback(function (files, targetEntryId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22908
|
+
var _i, files_1, file, uploadResponse, uploadFileId, attachmentURL, error_1;
|
|
22909
|
+
var _a;
|
|
22910
|
+
return __generator(this, function (_b) {
|
|
22911
|
+
switch (_b.label) {
|
|
22912
|
+
case 0:
|
|
22913
|
+
setUploadingFiles(files);
|
|
22914
|
+
setError(null);
|
|
22915
|
+
_b.label = 1;
|
|
22916
|
+
case 1:
|
|
22917
|
+
_b.trys.push([1, 7, 8, 9]);
|
|
22918
|
+
_i = 0, files_1 = files;
|
|
22919
|
+
_b.label = 2;
|
|
22920
|
+
case 2:
|
|
22921
|
+
if (!(_i < files_1.length)) return [3 /*break*/, 6];
|
|
22922
|
+
file = files_1[_i];
|
|
22923
|
+
return [4 /*yield*/, api.uploadFiles([file], "logbook")];
|
|
22924
|
+
case 3:
|
|
22925
|
+
uploadResponse = _b.sent();
|
|
22926
|
+
if (!((_a = uploadResponse === null || uploadResponse === void 0 ? void 0 : uploadResponse.result) === null || _a === void 0 ? void 0 : _a[0])) return [3 /*break*/, 5];
|
|
22927
|
+
uploadFileId = uploadResponse.result[0].UploadFileId;
|
|
22928
|
+
attachmentURL = uploadResponse.result[0].URL;
|
|
22929
|
+
// Then create the attachment record
|
|
22930
|
+
return [4 /*yield*/, uploadMutation.mutateAsync({
|
|
22931
|
+
entryId: targetEntryId,
|
|
22932
|
+
uploadFileId: uploadFileId,
|
|
22933
|
+
attachmentName: file.name,
|
|
22934
|
+
attachmentURL: attachmentURL,
|
|
22935
|
+
})];
|
|
22936
|
+
case 4:
|
|
22937
|
+
// Then create the attachment record
|
|
22938
|
+
_b.sent();
|
|
22939
|
+
// Invalidate queries for the specific entry and the main entries lists
|
|
22940
|
+
queryClient.invalidateQueries(["entryAttachments", targetEntryId]);
|
|
22941
|
+
queryClient.invalidateQueries(["entries"]);
|
|
22942
|
+
queryClient.invalidateQueries(["entriesReport"]);
|
|
22943
|
+
_b.label = 5;
|
|
22944
|
+
case 5:
|
|
22945
|
+
_i++;
|
|
22946
|
+
return [3 /*break*/, 2];
|
|
22947
|
+
case 6: return [3 /*break*/, 9];
|
|
22948
|
+
case 7:
|
|
22949
|
+
error_1 = _b.sent();
|
|
22950
|
+
setError("Failed to upload files: ".concat(error_1));
|
|
22951
|
+
return [3 /*break*/, 9];
|
|
22952
|
+
case 8:
|
|
22953
|
+
setUploadingFiles([]);
|
|
22954
|
+
return [7 /*endfinally*/];
|
|
22955
|
+
case 9: return [2 /*return*/];
|
|
22956
|
+
}
|
|
22957
|
+
});
|
|
22958
|
+
}); }, [api, uploadMutation, queryClient]);
|
|
22959
|
+
var handleFileUpload = useCallback(function (files) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22960
|
+
var targetEntryId, error_2, _i, files_2, file, uploadResponse, uploadFileId, attachmentURL, error_3;
|
|
22961
|
+
var _a;
|
|
22962
|
+
return __generator(this, function (_b) {
|
|
22963
|
+
switch (_b.label) {
|
|
22964
|
+
case 0:
|
|
22965
|
+
targetEntryId = currentEntryId;
|
|
22966
|
+
if (!((!targetEntryId || targetEntryId <= 0) &&
|
|
22967
|
+
entryData &&
|
|
22968
|
+
!isSubmittingEntry)) return [3 /*break*/, 4];
|
|
22969
|
+
_b.label = 1;
|
|
22970
|
+
case 1:
|
|
22971
|
+
_b.trys.push([1, 3, , 4]);
|
|
22972
|
+
setError(null);
|
|
22973
|
+
setIsSubmittingEntry(true);
|
|
22974
|
+
// Store files to upload after entry is created
|
|
22975
|
+
pendingFilesRef.current = files;
|
|
22976
|
+
return [4 /*yield*/, submitEntry(entryData)];
|
|
22977
|
+
case 2:
|
|
22978
|
+
_b.sent();
|
|
22979
|
+
// The files will be uploaded in the success callback
|
|
22980
|
+
return [2 /*return*/];
|
|
22981
|
+
case 3:
|
|
22982
|
+
error_2 = _b.sent();
|
|
22983
|
+
setIsSubmittingEntry(false);
|
|
22984
|
+
setError("Failed to save entry before uploading files: ".concat(error_2));
|
|
22985
|
+
pendingFilesRef.current = [];
|
|
22986
|
+
return [2 /*return*/];
|
|
22987
|
+
case 4:
|
|
22988
|
+
if (!targetEntryId || targetEntryId <= 0) {
|
|
22989
|
+
setError("Entry must be saved before adding attachments");
|
|
22990
|
+
return [2 /*return*/];
|
|
22991
|
+
}
|
|
22992
|
+
setUploadingFiles(files);
|
|
22993
|
+
setError(null);
|
|
22994
|
+
_b.label = 5;
|
|
22995
|
+
case 5:
|
|
22996
|
+
_b.trys.push([5, 11, 12, 13]);
|
|
22997
|
+
_i = 0, files_2 = files;
|
|
22998
|
+
_b.label = 6;
|
|
22999
|
+
case 6:
|
|
23000
|
+
if (!(_i < files_2.length)) return [3 /*break*/, 10];
|
|
23001
|
+
file = files_2[_i];
|
|
23002
|
+
return [4 /*yield*/, api.uploadFiles([file], "logbook")];
|
|
23003
|
+
case 7:
|
|
23004
|
+
uploadResponse = _b.sent();
|
|
23005
|
+
if (!((_a = uploadResponse === null || uploadResponse === void 0 ? void 0 : uploadResponse.result) === null || _a === void 0 ? void 0 : _a[0])) return [3 /*break*/, 9];
|
|
23006
|
+
uploadFileId = uploadResponse.result[0].UploadFileId;
|
|
23007
|
+
attachmentURL = uploadResponse.result[0].URL;
|
|
23008
|
+
// Then create the attachment record
|
|
23009
|
+
return [4 /*yield*/, uploadMutation.mutateAsync({
|
|
23010
|
+
entryId: targetEntryId,
|
|
23011
|
+
uploadFileId: uploadFileId,
|
|
23012
|
+
attachmentName: file.name,
|
|
23013
|
+
attachmentURL: attachmentURL,
|
|
23014
|
+
})];
|
|
23015
|
+
case 8:
|
|
23016
|
+
// Then create the attachment record
|
|
23017
|
+
_b.sent();
|
|
23018
|
+
_b.label = 9;
|
|
23019
|
+
case 9:
|
|
23020
|
+
_i++;
|
|
23021
|
+
return [3 /*break*/, 6];
|
|
23022
|
+
case 10: return [3 /*break*/, 13];
|
|
23023
|
+
case 11:
|
|
23024
|
+
error_3 = _b.sent();
|
|
23025
|
+
setError("Failed to upload files: ".concat(error_3));
|
|
23026
|
+
return [3 /*break*/, 13];
|
|
23027
|
+
case 12:
|
|
23028
|
+
setUploadingFiles([]);
|
|
23029
|
+
return [7 /*endfinally*/];
|
|
23030
|
+
case 13: return [2 /*return*/];
|
|
23031
|
+
}
|
|
23032
|
+
});
|
|
23033
|
+
}); }, [
|
|
23034
|
+
currentEntryId,
|
|
23035
|
+
entryData,
|
|
23036
|
+
api,
|
|
23037
|
+
uploadMutation,
|
|
23038
|
+
submitEntry,
|
|
23039
|
+
isSubmittingEntry,
|
|
23040
|
+
]);
|
|
23041
|
+
var handleDeleteAttachment = function (attachmentId, uploadFileId, attachmentName) {
|
|
23042
|
+
setAttachmentToDelete({
|
|
23043
|
+
id: attachmentId,
|
|
23044
|
+
uploadFileId: uploadFileId,
|
|
23045
|
+
name: attachmentName,
|
|
23046
|
+
});
|
|
23047
|
+
setShowDeleteConfirmation(true);
|
|
23048
|
+
};
|
|
23049
|
+
var handleDeleteConfirmation = function (confirmed) {
|
|
23050
|
+
setShowDeleteConfirmation(false);
|
|
23051
|
+
if (confirmed && attachmentToDelete) {
|
|
23052
|
+
deleteMutation.mutate({
|
|
23053
|
+
entryAttachmentId: attachmentToDelete.id,
|
|
23054
|
+
uploadFileId: attachmentToDelete.uploadFileId,
|
|
23055
|
+
});
|
|
23056
|
+
}
|
|
23057
|
+
setAttachmentToDelete(null);
|
|
23058
|
+
};
|
|
23059
|
+
// This function is no longer needed as we're using direct anchor links
|
|
23060
|
+
// Keeping it as a reference in case it's needed elsewhere
|
|
23061
|
+
/*
|
|
23062
|
+
const handleDownloadAttachment = (attachment: EntryAttachment) => {
|
|
23063
|
+
// Use the URL property with proper encoding
|
|
23064
|
+
const encodedUrl = attachment.URL;
|
|
23065
|
+
const link = document.createElement("a");
|
|
23066
|
+
link.href = encodedUrl;
|
|
23067
|
+
link.download = attachment.AttachmentName;
|
|
23068
|
+
link.target = "_blank";
|
|
23069
|
+
document.body.appendChild(link);
|
|
23070
|
+
link.click();
|
|
23071
|
+
document.body.removeChild(link);
|
|
23072
|
+
};
|
|
23073
|
+
*/
|
|
23074
|
+
var onDrop = useCallback(function (acceptedFiles) {
|
|
23075
|
+
if (isEditing) {
|
|
23076
|
+
handleFileUpload(acceptedFiles);
|
|
23077
|
+
}
|
|
23078
|
+
}, [handleFileUpload, isEditing]);
|
|
23079
|
+
var _l = useDropzone({
|
|
23080
|
+
onDrop: onDrop,
|
|
23081
|
+
disabled: !isEditing,
|
|
23082
|
+
multiple: true,
|
|
23083
|
+
}), getRootProps = _l.getRootProps, getInputProps = _l.getInputProps, isDragActive = _l.isDragActive;
|
|
23084
|
+
var isUploading = uploadingFiles.length > 0 ||
|
|
23085
|
+
uploadMutation.isLoading ||
|
|
23086
|
+
isSubmitLoading ||
|
|
23087
|
+
isSubmittingEntry;
|
|
23088
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
23089
|
+
React__default.createElement(Dialog$1, { open: open, onClose: onClose, maxWidth: "md", fullWidth: true, "aria-labelledby": "attachment-dialog-title" },
|
|
23090
|
+
React__default.createElement(DialogTitle$1, { id: "attachment-dialog-title" },
|
|
23091
|
+
"Attachments (",
|
|
23092
|
+
attachments.length,
|
|
23093
|
+
")"),
|
|
23094
|
+
React__default.createElement(DialogContent$1, { dividers: true },
|
|
23095
|
+
isEditing ? (React__default.createElement(Box, { mb: 2 },
|
|
23096
|
+
React__default.createElement(Box, __assign({}, getRootProps(), { sx: {
|
|
23097
|
+
border: function (theme) { return "2px dashed ".concat(theme.palette.primary.main); },
|
|
23098
|
+
borderRadius: function (theme) { return theme.shape.borderRadius; },
|
|
23099
|
+
padding: function (theme) { return theme.spacing(3); },
|
|
23100
|
+
textAlign: "center",
|
|
23101
|
+
cursor: "pointer",
|
|
23102
|
+
marginBottom: function (theme) { return theme.spacing(2); },
|
|
23103
|
+
borderColor: function (theme) {
|
|
23104
|
+
return isDragActive
|
|
23105
|
+
? theme.palette.secondary.main
|
|
23106
|
+
: theme.palette.primary.main;
|
|
23107
|
+
},
|
|
23108
|
+
backgroundColor: function (theme) {
|
|
23109
|
+
return isDragActive
|
|
23110
|
+
? theme.palette.action.selected
|
|
23111
|
+
: theme.palette.background.default;
|
|
23112
|
+
},
|
|
23113
|
+
"&:hover": {
|
|
23114
|
+
backgroundColor: function (theme) { return theme.palette.action.hover; },
|
|
23115
|
+
},
|
|
23116
|
+
} }),
|
|
23117
|
+
React__default.createElement("input", __assign({}, getInputProps())),
|
|
23118
|
+
React__default.createElement(CloudUpload, { sx: {
|
|
23119
|
+
fontSize: 48,
|
|
23120
|
+
color: function (theme) { return theme.palette.primary.main; },
|
|
23121
|
+
marginBottom: function (theme) { return theme.spacing(1); },
|
|
23122
|
+
} }),
|
|
23123
|
+
React__default.createElement(Typography$1, { variant: "h6", gutterBottom: true }, isDragActive
|
|
23124
|
+
? "Drop files here..."
|
|
23125
|
+
: "Drag & drop files here, or click to select"),
|
|
23126
|
+
React__default.createElement(Typography$1, { variant: "body2", color: "textSecondary" }, "All file types are supported")))) : null,
|
|
23127
|
+
!currentEntryId || currentEntryId <= 0 ? (isEditing && entryData ? (React__default.createElement(Typography$1, { variant: "body1", color: "textSecondary", align: "center" }, isSubmitLoading || isSubmittingEntry
|
|
23128
|
+
? "Saving entry..."
|
|
23129
|
+
: "Upload files to automatically save and attach to this entry")) : (React__default.createElement(Typography$1, { variant: "body1", color: "textSecondary", align: "center" }, "Save the entry first to add attachments"))) : isLoading ? (React__default.createElement("div", { style: {
|
|
23130
|
+
display: "flex",
|
|
23131
|
+
justifyContent: "center",
|
|
23132
|
+
alignItems: "center",
|
|
23133
|
+
minHeight: 100,
|
|
23134
|
+
} },
|
|
23135
|
+
React__default.createElement(CircularProgress, null))) : attachments.length === 0 ? (React__default.createElement(Typography$1, { variant: "body1", color: "textSecondary", align: "center" }, "No attachments yet")) : (React__default.createElement(List, { sx: {
|
|
23136
|
+
maxHeight: 300,
|
|
23137
|
+
overflow: "auto",
|
|
23138
|
+
} }, attachments.map(function (attachment) { return (React__default.createElement(ListItem, { key: attachment.EntryAttachmentId, sx: {
|
|
23139
|
+
border: function (theme) { return "1px solid ".concat(theme.palette.divider); },
|
|
23140
|
+
borderRadius: function (theme) { return theme.shape.borderRadius; },
|
|
23141
|
+
marginBottom: function (theme) { return theme.spacing(1); },
|
|
23142
|
+
} },
|
|
23143
|
+
React__default.createElement(ListItemIcon, null,
|
|
23144
|
+
React__default.createElement(AttachFile, null)),
|
|
23145
|
+
React__default.createElement(ListItemText, { primary: attachment.AttachmentName, secondary: "Added by ".concat(attachment.CreatedBy, " on ").concat(attachment.CreationTime.toLocaleDateString()) }),
|
|
23146
|
+
React__default.createElement(ListItemSecondaryAction, null,
|
|
23147
|
+
React__default.createElement("a", { href: attachment.URL, target: "_blank", rel: "noopener noreferrer", title: "Download", style: {
|
|
23148
|
+
display: "inline-flex",
|
|
23149
|
+
padding: 8,
|
|
23150
|
+
borderRadius: "50%",
|
|
23151
|
+
color: "inherit",
|
|
23152
|
+
textDecoration: "none",
|
|
23153
|
+
}, className: "MuiButtonBase-root MuiIconButton-root" },
|
|
23154
|
+
React__default.createElement(GetApp, null)),
|
|
23155
|
+
isEditing && (React__default.createElement(IconButton$1, { edge: "end", onClick: function () {
|
|
23156
|
+
return handleDeleteAttachment(attachment.EntryAttachmentId, attachment.UploadFileId, attachment.AttachmentName);
|
|
23157
|
+
}, title: "Delete", disabled: deleteMutation.isLoading },
|
|
23158
|
+
React__default.createElement(Delete, null)))))); }))),
|
|
23159
|
+
isUploading && (React__default.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center", mt: 2 },
|
|
23160
|
+
React__default.createElement(CircularProgress, { size: 20 }),
|
|
23161
|
+
React__default.createElement(Typography$1, { variant: "body2", style: { marginLeft: 8 } },
|
|
23162
|
+
"Uploading ",
|
|
23163
|
+
uploadingFiles.length,
|
|
23164
|
+
" file(s)...")))),
|
|
23165
|
+
React__default.createElement(DialogActions$1, null,
|
|
23166
|
+
React__default.createElement(Button, { onClick: onClose, color: "primary" }, "Close"))),
|
|
23167
|
+
React__default.createElement(DeleteAttachmentConfirmationDialog, { open: showDeleteConfirmation, attachmentName: (attachmentToDelete === null || attachmentToDelete === void 0 ? void 0 : attachmentToDelete.name) || "", onClose: handleDeleteConfirmation, isDeleting: deleteMutation.isLoading }),
|
|
23168
|
+
React__default.createElement(ErrorModal, { error: error || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.message), onHide: function () { return setError(null); } })));
|
|
23169
|
+
};
|
|
23170
|
+
|
|
23171
|
+
var AttachmentPlugin = /** @class */ (function (_super) {
|
|
23172
|
+
__extends(AttachmentPlugin, _super);
|
|
23173
|
+
function AttachmentPlugin() {
|
|
23174
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
23175
|
+
}
|
|
23176
|
+
AttachmentPlugin.prototype.render = function () {
|
|
23177
|
+
var _a = this.props
|
|
23178
|
+
.config, attachmentCount = _a.attachmentCount, onAttachmentClick = _a.onAttachmentClick;
|
|
23179
|
+
return (React__default.createElement("span", { className: "button button-type-attachment", title: "Attachments (".concat(attachmentCount, ")"), onClick: onAttachmentClick, style: {
|
|
23180
|
+
display: "inline-flex",
|
|
23181
|
+
alignItems: "center",
|
|
23182
|
+
padding: "4px 8px",
|
|
23183
|
+
cursor: "pointer",
|
|
23184
|
+
borderRadius: "4px",
|
|
23185
|
+
backgroundColor: attachmentCount > 0 ? "#e3f2fd" : "transparent",
|
|
23186
|
+
border: attachmentCount > 0 ? "1px solid #2196f3" : "1px solid transparent",
|
|
23187
|
+
color: attachmentCount > 0 ? "#1976d2" : "#666",
|
|
23188
|
+
fontSize: "0.75rem",
|
|
23189
|
+
fontWeight: attachmentCount > 0 ? 600 : 400,
|
|
23190
|
+
transition: "all 0.2s ease-in-out",
|
|
23191
|
+
}, onMouseEnter: function (e) {
|
|
23192
|
+
e.currentTarget.style.backgroundColor = "#e3f2fd";
|
|
23193
|
+
e.currentTarget.style.borderColor = "#2196f3";
|
|
23194
|
+
}, onMouseLeave: function (e) {
|
|
23195
|
+
if (attachmentCount === 0) {
|
|
23196
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
23197
|
+
e.currentTarget.style.borderColor = "transparent";
|
|
23198
|
+
}
|
|
23199
|
+
} },
|
|
23200
|
+
React__default.createElement(AttachFile, { style: {
|
|
23201
|
+
fontSize: 16,
|
|
23202
|
+
marginRight: 4,
|
|
23203
|
+
color: attachmentCount > 0 ? "#1976d2" : "#666",
|
|
23204
|
+
} }),
|
|
23205
|
+
"Attachments (",
|
|
23206
|
+
attachmentCount,
|
|
23207
|
+
")"));
|
|
23208
|
+
};
|
|
23209
|
+
AttachmentPlugin.pluginName = "attachment";
|
|
23210
|
+
AttachmentPlugin.align = "left";
|
|
23211
|
+
AttachmentPlugin.defaultConfig = {
|
|
23212
|
+
start: 0,
|
|
23213
|
+
end: 0,
|
|
23214
|
+
};
|
|
23215
|
+
return AttachmentPlugin;
|
|
23216
|
+
}(PluginComponent));
|
|
23217
|
+
|
|
23218
|
+
var ContentInput = function (_a) {
|
|
23219
|
+
var value = _a.value, onChange = _a.onChange, isEditing = _a.isEditing, UpdateTimestamp = _a.UpdateTimestamp, UpdatedBy = _a.UpdatedBy, isNewEntry = _a.isNewEntry, entryId = _a.entryId, entryData = _a.entryData, onEntrySubmitted = _a.onEntrySubmitted, _b = _a.allowAttachments, allowAttachments = _b === void 0 ? false : _b;
|
|
23220
|
+
var mdParser = new MarkdownIt();
|
|
23221
|
+
var api = new MESApiService();
|
|
23222
|
+
var urlEntryId = useParams().entryId;
|
|
23223
|
+
var _c = useState(0), key = _c[0], setKey = _c[1];
|
|
23224
|
+
var _d = useState(null), error = _d[0], setError = _d[1];
|
|
23225
|
+
var _e = useState(false), attachmentModalOpen = _e[0], setAttachmentModalOpen = _e[1];
|
|
23226
|
+
// Use URL entryId as fallback when form entryId is not available yet
|
|
23227
|
+
var effectiveEntryId = entryId ||
|
|
23228
|
+
(urlEntryId && urlEntryId !== "new" ? parseInt(urlEntryId) : null);
|
|
23229
|
+
// Query for fetching attachment count
|
|
23230
|
+
var _f = useQuery({
|
|
23231
|
+
queryKey: ["entryAttachments", effectiveEntryId],
|
|
23232
|
+
queryFn: function () { return getEntryAttachments(effectiveEntryId); },
|
|
23233
|
+
enabled: !!effectiveEntryId && effectiveEntryId > 0,
|
|
23234
|
+
retry: 1,
|
|
23235
|
+
onError: function (err) {
|
|
23236
|
+
console.error("Failed to fetch attachments:", err);
|
|
23237
|
+
},
|
|
23238
|
+
}), _g = _f.data, attachments = _g === void 0 ? [] : _g, attachmentError = _f.error;
|
|
23239
|
+
var attachmentCount = attachments.length;
|
|
23240
|
+
var handleChange = function (_a) {
|
|
23241
|
+
var text = _a.text;
|
|
23242
|
+
onChange(text);
|
|
23243
|
+
};
|
|
23244
|
+
var onImageUpload = function (files) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23245
|
+
var res;
|
|
23246
|
+
var _a;
|
|
23247
|
+
return __generator(this, function (_b) {
|
|
23248
|
+
switch (_b.label) {
|
|
23249
|
+
case 0:
|
|
23250
|
+
_b.trys.push([0, 2, , 3]);
|
|
23251
|
+
setError(null);
|
|
23252
|
+
return [4 /*yield*/, api.uploadFiles(files, "logbook")];
|
|
23253
|
+
case 1:
|
|
23254
|
+
res = _b.sent();
|
|
23255
|
+
if (res) {
|
|
23256
|
+
return [2 /*return*/, (_a = res.result[0]) === null || _a === void 0 ? void 0 : _a.URL];
|
|
23257
|
+
}
|
|
23258
|
+
return [3 /*break*/, 3];
|
|
23259
|
+
case 2:
|
|
23260
|
+
_b.sent();
|
|
23261
|
+
setError("Failed to upload files");
|
|
23262
|
+
return [2 /*return*/, ""];
|
|
23263
|
+
case 3: return [2 /*return*/];
|
|
23264
|
+
}
|
|
23265
|
+
});
|
|
23266
|
+
}); };
|
|
23267
|
+
useEffect(function () {
|
|
23268
|
+
setKey(function (prevKey) { return prevKey + 1; });
|
|
23269
|
+
}, [isEditing, attachmentCount]);
|
|
23270
|
+
// Register the attachment plugin
|
|
23271
|
+
useEffect(function () {
|
|
23272
|
+
MdEditor.use(AttachmentPlugin, {
|
|
23273
|
+
attachmentCount: attachmentCount,
|
|
23274
|
+
onAttachmentClick: function () {
|
|
23275
|
+
if (entryData.title && entryData.author) {
|
|
23276
|
+
setAttachmentModalOpen(true);
|
|
23277
|
+
}
|
|
23278
|
+
else {
|
|
23279
|
+
setError("Title and Author are required");
|
|
23280
|
+
}
|
|
23281
|
+
},
|
|
23282
|
+
});
|
|
23283
|
+
}, [attachmentCount, entryData.title, entryData.author]);
|
|
23284
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
23285
|
+
React__default.createElement(Box, { sx: {
|
|
23286
|
+
height: "100%",
|
|
23287
|
+
width: "100%",
|
|
23288
|
+
overflow: "hidden",
|
|
23289
|
+
display: "flex",
|
|
23290
|
+
flexDirection: "column",
|
|
23291
|
+
"& .MuiInput-underline:before": {
|
|
23292
|
+
borderBottom: "none",
|
|
23293
|
+
},
|
|
23294
|
+
"& .MuiInput-underline:after": {
|
|
23295
|
+
borderBottom: "none",
|
|
23296
|
+
},
|
|
23297
|
+
"& .MuiInput-underline:hover:not(.Mui-disabled):before": {
|
|
23298
|
+
borderBottom: "none",
|
|
23299
|
+
},
|
|
23300
|
+
} },
|
|
23301
|
+
React__default.createElement(Grid2, { sx: {
|
|
23302
|
+
flexGrow: 1,
|
|
23303
|
+
display: "flex",
|
|
23304
|
+
flexDirection: "column",
|
|
23305
|
+
overflow: "hidden",
|
|
23306
|
+
} },
|
|
23307
|
+
React__default.createElement(Box, { sx: {
|
|
23308
|
+
height: "100%",
|
|
23309
|
+
"& .rc-md-editor": {
|
|
23310
|
+
height: "100%",
|
|
23311
|
+
},
|
|
23312
|
+
"& .rc-md-navigation": {
|
|
23313
|
+
backgroundColor: function (theme) { return theme.palette.background.paper; },
|
|
23314
|
+
},
|
|
23315
|
+
"& .rc-md-editor, & .section-container": {
|
|
23316
|
+
height: "100%",
|
|
23317
|
+
},
|
|
23318
|
+
} },
|
|
23319
|
+
React__default.createElement(MdEditor, { key: key, style: { height: "100%", width: "100%" }, value: value || "", renderHTML: function (text) { return mdParser.render(text || ""); }, onChange: handleChange, view: {
|
|
23320
|
+
menu: allowAttachments ? true : isEditing, // Always show menu to display attachment button (if allowed)
|
|
23321
|
+
md: isEditing ? true : false,
|
|
23322
|
+
html: !isEditing,
|
|
23323
|
+
}, plugins: isEditing
|
|
23324
|
+
? [
|
|
23325
|
+
"header",
|
|
23326
|
+
"font-bold",
|
|
23327
|
+
"font-italic",
|
|
23328
|
+
"font-underline",
|
|
23329
|
+
"font-strikethrough",
|
|
23330
|
+
"list-unordered",
|
|
23331
|
+
"list-ordered",
|
|
23332
|
+
"block-quote",
|
|
23333
|
+
"block-wrap",
|
|
23334
|
+
"block-code-inline",
|
|
23335
|
+
"block-code-block",
|
|
23336
|
+
"table",
|
|
23337
|
+
"image",
|
|
23338
|
+
"link",
|
|
23339
|
+
"clear",
|
|
23340
|
+
"logger",
|
|
23341
|
+
"mode-toggle",
|
|
23342
|
+
"full-screen",
|
|
23343
|
+
"tab-insert",
|
|
23344
|
+
allowAttachments ? "attachment" : "",
|
|
23345
|
+
]
|
|
23346
|
+
: allowAttachments
|
|
23347
|
+
? [
|
|
23348
|
+
"attachment", // Only show attachment button in preview mode and with attachments allowed
|
|
23349
|
+
]
|
|
23350
|
+
: [], config: {
|
|
23351
|
+
attachment: allowAttachments
|
|
23352
|
+
? {
|
|
23353
|
+
attachmentCount: attachmentCount,
|
|
23354
|
+
onAttachmentClick: function () {
|
|
23355
|
+
if (entryData.title && entryData.author) {
|
|
23356
|
+
setAttachmentModalOpen(true);
|
|
23357
|
+
}
|
|
23358
|
+
else {
|
|
23359
|
+
setError("Title and Author are required");
|
|
23360
|
+
}
|
|
23361
|
+
},
|
|
23362
|
+
}
|
|
23363
|
+
: null,
|
|
23364
|
+
}, autoFocus: !isNewEntry, onImageUpload: function (file) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23365
|
+
var markdownImage;
|
|
23366
|
+
return __generator(this, function (_a) {
|
|
23367
|
+
switch (_a.label) {
|
|
23368
|
+
case 0: return [4 /*yield*/, onImageUpload([file])];
|
|
23369
|
+
case 1:
|
|
23370
|
+
markdownImage = _a.sent();
|
|
23371
|
+
return [2 /*return*/, markdownImage];
|
|
23372
|
+
}
|
|
23373
|
+
});
|
|
23374
|
+
}); } }))),
|
|
23375
|
+
(UpdatedBy === null || UpdatedBy === void 0 ? void 0 : UpdatedBy.length) > 0 && (React__default.createElement(Box, { sx: {
|
|
23376
|
+
backgroundColor: function (theme) { return theme.palette.background.paper; },
|
|
23377
|
+
borderTop: function (theme) { return "0px solid ".concat(theme.palette.divider); },
|
|
23378
|
+
paddingLeft: 10,
|
|
23379
|
+
} },
|
|
23380
|
+
React__default.createElement(TextField, { variant: "standard", disabled: true, value: "This entry was updated on ".concat(dxtToLocalServerTime(UpdateTimestamp, "MM/dd/yy hh:mm a"), " by ").concat(UpdatedBy), fullWidth: true, margin: "none", autoComplete: "off", InputProps: {
|
|
23381
|
+
style: {
|
|
23382
|
+
fontSize: "0.7rem",
|
|
23383
|
+
},
|
|
23384
|
+
disableUnderline: true,
|
|
23385
|
+
}, InputLabelProps: {
|
|
23386
|
+
style: {
|
|
23387
|
+
fontSize: "0.7rem",
|
|
23388
|
+
},
|
|
23389
|
+
} })))),
|
|
23390
|
+
React__default.createElement(AttachmentModal, { open: attachmentModalOpen, onClose: function () { return setAttachmentModalOpen(false); }, entryId: effectiveEntryId, isEditing: isEditing, entryData: entryData, onEntrySubmitted: onEntrySubmitted }),
|
|
23391
|
+
React__default.createElement(ErrorModal, { error: error || (attachmentError === null || attachmentError === void 0 ? void 0 : attachmentError.message), onHide: function () { return setError(""); } })));
|
|
23392
|
+
};
|
|
23393
|
+
|
|
23394
|
+
var moment$4 = getMomentTz();
|
|
23395
|
+
var EntryViewer$1 = function (_a) {
|
|
23396
|
+
var entry = _a.entry, show = _a.show, onChangeShow = _a.onChangeShow, onHide = _a.onHide, preselectedAssetId = _a.preselectedAssetId, withAssetFilter = _a.withAssetFilter, canEditAsset = _a.canEditAsset, canEditShift = _a.canEditShift, filterAssets = _a.filterAssets, allowAttachments = _a.allowAttachments, shiftsRange = _a.shiftsRange;
|
|
23397
|
+
var settings = useUTLSettingsContext().state.settings;
|
|
23398
|
+
var defaultAssetId = Number(get(settings, "DefaultAssetId", 15));
|
|
23399
|
+
var shiftIdParam = useParams().shiftId;
|
|
23400
|
+
var searchParams = useSearchParams()[0];
|
|
23401
|
+
var entryId = searchParams.get("entryId");
|
|
23402
|
+
var action = searchParams.get("action");
|
|
23403
|
+
var shiftInfo = useShiftNavigator().shiftInfo;
|
|
23404
|
+
var isNewEntry = action === "new";
|
|
23405
|
+
var _b = useState(""), notificationMessage = _b[0], setNotificationMessage = _b[1];
|
|
23406
|
+
var _c = useState(null), shiftTimestamp = _c[0], setShiftTimestamp = _c[1];
|
|
23407
|
+
var _d = useState(""), error = _d[0], setError = _d[1];
|
|
23408
|
+
// Section state
|
|
23409
|
+
var _e = useState(null), selectedSection = _e[0], setSelectedSection = _e[1];
|
|
23410
|
+
var _f = useForm(), control = _f.control, handleSubmit = _f.handleSubmit, reset = _f.reset, _g = _f.formState; _g.isValid; var dirtyFields = _g.dirtyFields, watch = _f.watch, setValue = _f.setValue;
|
|
23411
|
+
var isFormDirty = !(Object.keys(dirtyFields).length === 0);
|
|
23412
|
+
var updatedBy = watch("UpdatedBy");
|
|
23413
|
+
var updateTimestamp = watch("UpdateTimestamp");
|
|
23414
|
+
var createTimestamp = watch("CreateTimestamp");
|
|
23415
|
+
watch("Content");
|
|
23416
|
+
var entryIdValue = watch("EntryId");
|
|
23417
|
+
var title = watch("Title");
|
|
23418
|
+
var author = watch("Author");
|
|
23419
|
+
var shiftId = watch("ShiftId");
|
|
23420
|
+
var assetId = watch("AssetId");
|
|
23421
|
+
var shift = watch("Shift");
|
|
23422
|
+
var crew = watch("Crew");
|
|
23423
|
+
// Handler for when entry is submitted via attachment modal
|
|
23424
|
+
var handleEntrySubmitted = function (newEntryId, newEntryData) {
|
|
23425
|
+
setNotificationMessage("Entry created successfully");
|
|
23426
|
+
// If we have the new entry data, update the form immediately
|
|
23427
|
+
if (newEntryData) {
|
|
23428
|
+
reset(newEntryData);
|
|
23429
|
+
}
|
|
23430
|
+
// Add a setTimeout to delay navigation, giving the system time to process everything
|
|
23431
|
+
setTimeout(function () {
|
|
23432
|
+
onHide(newEntryId, true); // true = shouldStayInEditMode
|
|
23433
|
+
}, 1000); // 1000ms delay to ensure all processing is complete
|
|
23434
|
+
};
|
|
23435
|
+
// Use the shared entry submission hook
|
|
23436
|
+
var _h = useEntrySubmission({
|
|
23437
|
+
onSuccess: function (entry) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23438
|
+
var err_1;
|
|
23439
|
+
return __generator(this, function (_a) {
|
|
23440
|
+
switch (_a.label) {
|
|
23441
|
+
case 0:
|
|
23442
|
+
if (!(entry && entry.EntryId)) return [3 /*break*/, 5];
|
|
23443
|
+
if (!selectedSection) return [3 /*break*/, 4];
|
|
23444
|
+
_a.label = 1;
|
|
23445
|
+
case 1:
|
|
23446
|
+
_a.trys.push([1, 3, , 4]);
|
|
23447
|
+
return [4 /*yield*/, upsertSectionEntry({
|
|
23448
|
+
entryId: entry.EntryId,
|
|
23449
|
+
sectionId: selectedSection.SectionId,
|
|
23450
|
+
})];
|
|
23451
|
+
case 2:
|
|
23452
|
+
_a.sent();
|
|
23453
|
+
return [3 /*break*/, 4];
|
|
23454
|
+
case 3:
|
|
23455
|
+
err_1 = _a.sent();
|
|
23456
|
+
console.error("Error saving section entry:", err_1);
|
|
23457
|
+
setError(err_1.message || "Error saving section data");
|
|
23458
|
+
return [2 /*return*/];
|
|
23459
|
+
case 4:
|
|
23460
|
+
setNotificationMessage(entryId === "new"
|
|
23461
|
+
? "Entry created successfully"
|
|
23462
|
+
: "Entry updated successfully");
|
|
23463
|
+
// Add a setTimeout to delay navigation
|
|
23464
|
+
setTimeout(function () {
|
|
23465
|
+
onHide(entry.EntryId);
|
|
23466
|
+
}, 1000);
|
|
23467
|
+
return [3 /*break*/, 6];
|
|
23468
|
+
case 5:
|
|
23469
|
+
console.error("No EntryId received from API response", entry);
|
|
23470
|
+
setError("Failed to get entry ID from server response");
|
|
23471
|
+
_a.label = 6;
|
|
23472
|
+
case 6: return [2 /*return*/];
|
|
23473
|
+
}
|
|
23474
|
+
});
|
|
23475
|
+
}); },
|
|
23476
|
+
onError: function (error) {
|
|
23477
|
+
setError(error.message);
|
|
23478
|
+
},
|
|
23479
|
+
isNewEntry: isNewEntry,
|
|
23480
|
+
onHide: function () { return onHide(); },
|
|
23481
|
+
}), submitEntry = _h.submitEntry, isSubmitLoading = _h.isSubmitLoading, showConfirmationDialog = _h.showConfirmationDialog, handleConfirmationClose = _h.handleConfirmationClose;
|
|
23482
|
+
var onSubmit = function (formData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23483
|
+
var submissionData;
|
|
23484
|
+
var _a;
|
|
23485
|
+
return __generator(this, function (_b) {
|
|
23486
|
+
switch (_b.label) {
|
|
23487
|
+
case 0:
|
|
23488
|
+
setError("");
|
|
23489
|
+
submissionData = {
|
|
23490
|
+
assetId: formData.AssetId,
|
|
23491
|
+
entryId: formData.EntryId,
|
|
23492
|
+
shiftId: formData.ShiftId,
|
|
23493
|
+
isForOtherShift: (entry === null || entry === void 0 ? void 0 : entry.ShiftId)
|
|
23494
|
+
? entry.ShiftId !== formData.ShiftId
|
|
23495
|
+
: (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId) !== formData.ShiftId,
|
|
23496
|
+
title: formData.Title,
|
|
23497
|
+
content: formData.Content,
|
|
23498
|
+
author: (_a = formData.Author) !== null && _a !== void 0 ? _a : "",
|
|
23499
|
+
createTimestamp: isNewEntry ? new Date() : formData.CreateTimestamp,
|
|
23500
|
+
};
|
|
23501
|
+
return [4 /*yield*/, submitEntry(submissionData)];
|
|
23502
|
+
case 1:
|
|
23503
|
+
_b.sent();
|
|
23504
|
+
return [2 /*return*/];
|
|
23505
|
+
}
|
|
23506
|
+
});
|
|
23507
|
+
}); };
|
|
23508
|
+
useEffect(function () {
|
|
23509
|
+
var _a, _b, _c;
|
|
23510
|
+
if (shiftInfo || !isNewEntry) {
|
|
23511
|
+
var newEntry = __assign(__assign({}, ENTRY_INITIAL_VALUES), { ShiftId: shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId, Shift: (_a = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShift) !== null && _a !== void 0 ? _a : "", Crew: (_b = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentCrew) !== null && _b !== void 0 ? _b : "", CreateTimestamp: new Date(), AssetId: (_c = preselectedAssetId !== null && preselectedAssetId !== void 0 ? preselectedAssetId : defaultAssetId) !== null && _c !== void 0 ? _c : null });
|
|
23512
|
+
reset((isNewEntry ? newEntry : entry) || ENTRY_INITIAL_VALUES);
|
|
23513
|
+
}
|
|
23514
|
+
}, [entry, shiftInfo, entryId, reset, defaultAssetId]);
|
|
23515
|
+
useEffect(function () {
|
|
23516
|
+
var _a;
|
|
23517
|
+
if (isNewEntry) {
|
|
23518
|
+
setValue("AssetId", (_a = preselectedAssetId !== null && preselectedAssetId !== void 0 ? preselectedAssetId : defaultAssetId) !== null && _a !== void 0 ? _a : null);
|
|
23519
|
+
}
|
|
23520
|
+
}, [preselectedAssetId, defaultAssetId]);
|
|
23521
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
23522
|
+
isNewEntry || (entry === null || entry === void 0 ? void 0 : entry.EntryId) ? (React__default.createElement(HelmetDexteel, { title: "".concat(isNewEntry ? "New Entry" : "'".concat(entry === null || entry === void 0 ? void 0 : entry.Title, "' by ").concat(entry === null || entry === void 0 ? void 0 : entry.Author), " - Logbook Entry") })) : null,
|
|
23523
|
+
isNewEntry || (entry === null || entry === void 0 ? void 0 : entry.EntryId) ? (React__default.createElement(Paper, { elevation: 1, sx: {
|
|
23524
|
+
width: "100%",
|
|
23525
|
+
height: "100%",
|
|
23526
|
+
display: "flex",
|
|
23527
|
+
flexDirection: "column",
|
|
23528
|
+
} },
|
|
23529
|
+
React__default.createElement(Grid2, { container: true, spacing: 1, component: "form", onSubmit: handleSubmit(onSubmit), height: "100%", flexDirection: "column", flexWrap: "nowrap", p: 1 },
|
|
23530
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
23531
|
+
React__default.createElement(Controller, { name: "Title", control: control, rules: {
|
|
23532
|
+
required: "Title is required",
|
|
23533
|
+
validate: function (value) {
|
|
23534
|
+
return !!(value === null || value === void 0 ? void 0 : value.trim()) || "Title cannot be empty";
|
|
23535
|
+
},
|
|
23536
|
+
}, render: function (_a) {
|
|
23537
|
+
var _b = _a.field, value = _b.value, onChange = _b.onChange, error = _a.fieldState.error;
|
|
23538
|
+
return (React__default.createElement(TextField, { label: "Title", value: value !== null && value !== void 0 ? value : "", onChange: onChange, error: !!error, helperText: error === null || error === void 0 ? void 0 : error.message, autoFocus: isNewEntry, size: "medium" }));
|
|
23539
|
+
} })),
|
|
23540
|
+
React__default.createElement(Grid2, { container: true, size: { xs: 12 }, spacing: 2 },
|
|
23541
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
23542
|
+
React__default.createElement(Controller, { name: "CreateTimestamp", control: control, render: function (_a) {
|
|
23543
|
+
var value = _a.field.value;
|
|
23544
|
+
return (React__default.createElement(DateTimePicker, { label: "Creation Time", timezone: TimeService.getInstance().getServerTimeZone(), format: "MM/DD/YYYY HH:mm", value: value ? moment$4(value) : null, disabled: true, slotProps: {
|
|
23545
|
+
textField: {
|
|
23546
|
+
variant: "outlined",
|
|
23547
|
+
size: "small",
|
|
23548
|
+
fullWidth: true,
|
|
23549
|
+
InputLabelProps: {
|
|
23550
|
+
shrink: true,
|
|
23551
|
+
style: {
|
|
23552
|
+
fontSize: ".875rem",
|
|
23553
|
+
marginTop: -2,
|
|
23554
|
+
},
|
|
23555
|
+
},
|
|
23556
|
+
},
|
|
23557
|
+
} }));
|
|
23558
|
+
} })),
|
|
23559
|
+
canEditShift ? (React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
23560
|
+
React__default.createElement(Controller, { name: "ShiftId", control: control, render: function (_a) {
|
|
23561
|
+
var _b;
|
|
23562
|
+
var field = _a.field;
|
|
23563
|
+
return (React__default.createElement(ShiftAutocomplete, { currentShiftId: (_b = Number(shiftIdParam)) !== null && _b !== void 0 ? _b : shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId, onShiftSelected: function (selectedShift) {
|
|
23564
|
+
if (selectedShift) {
|
|
23565
|
+
setValue("Shift", selectedShift.Shift, {
|
|
23566
|
+
shouldDirty: true,
|
|
23567
|
+
});
|
|
23568
|
+
setValue("Crew", selectedShift.Crew, {
|
|
23569
|
+
shouldDirty: true,
|
|
23570
|
+
});
|
|
23571
|
+
setShiftTimestamp(new Date(selectedShift.Start));
|
|
23572
|
+
field.onChange(selectedShift.ShiftId);
|
|
23573
|
+
}
|
|
23574
|
+
else {
|
|
23575
|
+
setValue("Shift", null, { shouldDirty: true });
|
|
23576
|
+
setValue("Crew", null, { shouldDirty: true });
|
|
23577
|
+
setShiftTimestamp(null);
|
|
23578
|
+
field.onChange(null);
|
|
23579
|
+
}
|
|
23580
|
+
}, value: field.value, disabled: !isNewEntry && show !== "edit", shiftsRange: shiftsRange }));
|
|
23581
|
+
} }))) : (React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
23582
|
+
React__default.createElement(Controller, { name: "ShiftId", control: control, render: function (_a) {
|
|
23583
|
+
var field = _a.field;
|
|
23584
|
+
return (React__default.createElement(ShiftSelector, { onChange: field.onChange, value: field.value, disabled: true }));
|
|
23585
|
+
} }))),
|
|
23586
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: canEditAsset ? 2 : 6 } },
|
|
23587
|
+
React__default.createElement(Controller, { name: "Author", control: control, rules: {
|
|
23588
|
+
required: "Author is required",
|
|
23589
|
+
}, render: function (_a) {
|
|
23590
|
+
var _b = _a.field, value = _b.value, onChange = _b.onChange, error = _a.fieldState.error;
|
|
23591
|
+
return (React__default.createElement(TextField, { label: "Author", variant: "outlined", value: value !== null && value !== void 0 ? value : "", onChange: onChange, fullWidth: true, error: !!error, helperText: error === null || error === void 0 ? void 0 : error.message, disabled: !isNewEntry, size: "small" }));
|
|
23592
|
+
} })),
|
|
23593
|
+
canEditAsset ? (withAssetFilter === "tree" ? (React__default.createElement(Grid2, { size: { md: 4, xs: 12 } },
|
|
23594
|
+
React__default.createElement(Controller, { name: "AssetId", control: control, render: function (_a) {
|
|
23595
|
+
var field = _a.field;
|
|
23596
|
+
return (React__default.createElement(AssetTreePicker, { label: "Asset", value: field.value || 0, onChange: field.onChange }));
|
|
23597
|
+
} }))) : withAssetFilter === "selector" ? (React__default.createElement(Grid2, { size: { md: 4, xs: 12 } },
|
|
23598
|
+
React__default.createElement(Controller, { name: "AssetId", control: control, render: function (_a) {
|
|
23599
|
+
var field = _a.field;
|
|
23600
|
+
return (React__default.createElement(AssetsFilter, { value: field.value, onChange: field.onChange, filterAreaAssets: filterAssets === "area" }));
|
|
23601
|
+
} }))) : null) : null),
|
|
23602
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
23603
|
+
React__default.createElement(SectionSelector, { value: selectedSection, onChange: function (section) {
|
|
23604
|
+
setSelectedSection(section);
|
|
23605
|
+
if (section) {
|
|
23606
|
+
setValue("SectionId", section.SectionId, {
|
|
23607
|
+
shouldDirty: true,
|
|
23608
|
+
});
|
|
23609
|
+
setValue("SectionName", section.SectionName, {
|
|
23610
|
+
shouldDirty: true,
|
|
23611
|
+
});
|
|
23612
|
+
}
|
|
23613
|
+
else {
|
|
23614
|
+
setValue("SectionId", null, { shouldDirty: true });
|
|
23615
|
+
setValue("SectionName", undefined, {
|
|
23616
|
+
shouldDirty: true,
|
|
23617
|
+
});
|
|
23618
|
+
}
|
|
23619
|
+
}, disabled: !isNewEntry && show !== "edit" })),
|
|
23620
|
+
React__default.createElement(Grid2, { size: { md: 12 }, height: "100%", flexGrow: 1, overflow: "auto" },
|
|
23621
|
+
React__default.createElement(Controller, { name: "Content", control: control, render: function (_a) {
|
|
23622
|
+
var _b = _a.field, value = _b.value, onChange = _b.onChange;
|
|
23623
|
+
return (React__default.createElement(ContentInput, { UpdatedBy: updatedBy, UpdateTimestamp: updateTimestamp, onChange: function (val) { return onChange(val); }, value: value, isEditing: show === "edit", isNewEntry: isNewEntry, entryId: entryIdValue, entryData: {
|
|
23624
|
+
assetId: assetId,
|
|
23625
|
+
entryId: entryIdValue,
|
|
23626
|
+
shiftId: shiftId,
|
|
23627
|
+
title: title,
|
|
23628
|
+
content: value,
|
|
23629
|
+
author: author,
|
|
23630
|
+
createTimestamp: isNewEntry
|
|
23631
|
+
? new Date()
|
|
23632
|
+
: createTimestamp,
|
|
23633
|
+
}, onEntrySubmitted: handleEntrySubmitted, allowAttachments: allowAttachments }));
|
|
23634
|
+
} })),
|
|
23635
|
+
React__default.createElement(Grid2, { container: true, size: { xs: 12 } },
|
|
23636
|
+
React__default.createElement(Grid2, { container: true, size: { md: 6, xs: 12 }, spacing: 1 },
|
|
23637
|
+
React__default.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
23638
|
+
React__default.createElement(Button, { fullWidth: true, variant: "contained", color: "inherit", onClick: function () { return onHide(); } }, "Close")),
|
|
23639
|
+
React__default.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
23640
|
+
React__default.createElement(Button, { fullWidth: true, variant: "contained", color: "primary", onClick: function () { return onChangeShow(); } }, show === "edit" ? "Preview" : "Edit"))),
|
|
23641
|
+
React__default.createElement(Grid2, { container: true, size: { md: 6, xs: 12 }, style: { display: "flex", justifyContent: "flex-end" } },
|
|
23642
|
+
React__default.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
23643
|
+
React__default.createElement(Button, { fullWidth: true, startIcon: isSubmitLoading && React__default.createElement(CircularProgress, { size: "1rem" }), disabled: isSubmitLoading || !isFormDirty, variant: "contained", color: "primary", type: "submit" }, isNewEntry ? "Create" : "Save"))))))) : null,
|
|
23644
|
+
React__default.createElement(NotificationSnackBar, { message: notificationMessage, onHide: function () { return setNotificationMessage(""); } }),
|
|
23645
|
+
React__default.createElement(ConfirmationDialogRaw, { open: showConfirmationDialog, onClose: handleConfirmationClose, title: "Shift Submission Confirmation", message: "You are about to ".concat(isNewEntry ? "create" : "save", " an entry for ").concat(moment$4(shiftTimestamp).format("MM/DD/YYYY"), " ").concat(shift, " - ").concat(crew, ". Are you sure you want to proceed?"), suffixTitle: "Logbook Entry" }),
|
|
23646
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
23647
|
+
};
|
|
23648
|
+
|
|
23649
|
+
var Filters$1 = function (_a) {
|
|
23650
|
+
var quickFilter = _a.quickFilter, onQuickFilterChange = _a.onQuickFilterChange, selectedSections = _a.selectedSections, onSectionsChange = _a.onSectionsChange;
|
|
23651
|
+
useMesfRealtime({
|
|
23652
|
+
onReceiveMessage: function (author, message) {
|
|
23653
|
+
if (message.replaceAll("[", "").replaceAll("]", "") == "LB.GetEntries") ;
|
|
23654
|
+
},
|
|
23655
|
+
});
|
|
23656
|
+
return (React__default.createElement(Grid2, { container: true, justifyContent: "center", alignItems: "center", component: Paper, size: { md: 12 }, spacing: 1, p: 1 },
|
|
23657
|
+
React__default.createElement(Grid2, { maxWidth: "fit-content", justifyContent: "center" },
|
|
23658
|
+
React__default.createElement(ShiftDayNavigatorControl, { preventInit: true, withPaper: false })),
|
|
23659
|
+
React__default.createElement(Grid2, { size: { md: 4.5, xs: 12 } },
|
|
23660
|
+
React__default.createElement(TextField, { label: "Search", value: quickFilter, onChange: function (event) {
|
|
23661
|
+
onQuickFilterChange(event === null || event === void 0 ? void 0 : event.target.value);
|
|
23662
|
+
}, size: "small", fullWidth: true, slotProps: {
|
|
23663
|
+
input: {
|
|
23664
|
+
startAdornment: (React__default.createElement(InputAdornment, { position: "start" },
|
|
23665
|
+
React__default.createElement(SearchIcon, { fontSize: "small", sx: { color: "action.active" } }))),
|
|
23666
|
+
},
|
|
23667
|
+
} })),
|
|
23668
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
23669
|
+
React__default.createElement(SectionMultiSelect, { value: selectedSections, onChange: onSectionsChange, label: "Sections" }))));
|
|
23670
|
+
};
|
|
23671
|
+
|
|
23672
|
+
var moment$3 = getMomentTz();
|
|
23673
|
+
var Logbook$1 = function () {
|
|
23674
|
+
var entry = useLogbookSettings().entry;
|
|
23675
|
+
var allowAttachments = entry.allowAttachments;
|
|
23676
|
+
var canEditShift = entry.canEditShift;
|
|
23677
|
+
var showShiftCrew = entry.showShiftCrew;
|
|
23678
|
+
var exportToExcel = entry.exportToExcel;
|
|
23679
|
+
var shiftsRange = entry.shiftsRange;
|
|
23680
|
+
// Asset settings
|
|
23681
|
+
var withAssetFilter = entry.withAssetFilter;
|
|
23682
|
+
var canEditAsset = entry.canEditAsset;
|
|
23683
|
+
var filterAssets = entry.filterAssets;
|
|
23684
|
+
var navigate = useNavigate();
|
|
23685
|
+
var searchParams = useSearchParams()[0];
|
|
23686
|
+
var entryId = searchParams.get("entryId");
|
|
23687
|
+
var action = searchParams.get("action");
|
|
23688
|
+
var shiftId = useParams().shiftId;
|
|
23689
|
+
var _a = useShiftNavigator(), shiftInfo = _a.shiftInfo, getShiftDataFromAPI = _a.getShiftDataFromAPI;
|
|
23690
|
+
var isEditMode = action === "edit";
|
|
23691
|
+
var shiftIdRef = useRef(null);
|
|
23692
|
+
var gridApiRef = useRef(null);
|
|
23693
|
+
var _b = useState(""), error = _b[0], setError = _b[1];
|
|
23694
|
+
var _c = useState(""), show = _c[0], setShow = _c[1];
|
|
23695
|
+
var _d = useState(""), quickFilter = _d[0], setQuickFilter = _d[1];
|
|
23696
|
+
// Section filter state - multi-select
|
|
23697
|
+
var _e = useState([]), filterSections = _e[0], setFilterSections = _e[1];
|
|
23698
|
+
var _f = useState(null), selectedRowData = _f[0], setSelectedRowData = _f[1];
|
|
23699
|
+
var _g = useState(false), showRemoveDialog = _g[0], setShowRemoveDialog = _g[1];
|
|
23700
|
+
var _h = useContextMenuMESF(), registerConfig = _h.registerConfig, showContextMenu = _h.showContextMenu;
|
|
23701
|
+
var _j = useEntries({
|
|
23702
|
+
shiftId: shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId,
|
|
23703
|
+
sectionIds: filterSections.map(function (s) { return s.SectionId; }),
|
|
23704
|
+
}), rows = _j.data, isLoading = _j.isLoading, e = _j.error, isError = _j.isError, refetch = _j.refetch;
|
|
23705
|
+
var columnDefs = useTableData$1({
|
|
23706
|
+
showContextMenu: showContextMenu,
|
|
23707
|
+
allowAttachments: allowAttachments,
|
|
23708
|
+
showShiftCrew: showShiftCrew,
|
|
23709
|
+
}).columnDefs;
|
|
23710
|
+
var defaultColDef = useGridDefinitions({}).defaultColDef;
|
|
23711
|
+
var onQuickFilterChange = function (text) {
|
|
23712
|
+
var _a;
|
|
23713
|
+
setQuickFilter(text);
|
|
23714
|
+
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.setGridOption("quickFilterText", text);
|
|
23715
|
+
};
|
|
23716
|
+
var handleNewEntry = function () {
|
|
23717
|
+
var _a;
|
|
23718
|
+
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.deselectAll();
|
|
23719
|
+
setSelectedRowData(__assign({}, ENTRY_INITIAL_VALUES));
|
|
23720
|
+
navigate("".concat(routeLogbookEntry, "/").concat(shiftIdRef.current, "?action=new"), {
|
|
23721
|
+
replace: true,
|
|
23722
|
+
});
|
|
23723
|
+
setShow("edit");
|
|
23724
|
+
};
|
|
23725
|
+
var rowClicked = function (event) {
|
|
23726
|
+
var _a;
|
|
23727
|
+
var currentShiftId = shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId);
|
|
23728
|
+
setSelectedRowData(event === null || event === void 0 ? void 0 : event.data);
|
|
23729
|
+
navigate("".concat(routeLogbookEntry, "/").concat(currentShiftId, "?entryId=").concat((_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.EntryId, "&action=view"));
|
|
23730
|
+
setShow("view");
|
|
23731
|
+
};
|
|
23732
|
+
var onCellKeyDown = useCallback(function (event) {
|
|
23733
|
+
var api = event.api, node = event.node, keyEvent = event.event;
|
|
23734
|
+
if (!keyEvent)
|
|
23735
|
+
return;
|
|
23736
|
+
var key = keyEvent.key;
|
|
23737
|
+
if (key === "ArrowUp" || key === "ArrowDown") {
|
|
23738
|
+
keyEvent.preventDefault();
|
|
23739
|
+
var currentIndex = node.rowIndex !== null ? node.rowIndex : -1;
|
|
23740
|
+
var nextRowIndex = key === "ArrowUp" ? currentIndex - 1 : currentIndex + 1;
|
|
23741
|
+
var nextNode = api.getDisplayedRowAtIndex(nextRowIndex);
|
|
23742
|
+
if (nextNode) {
|
|
23743
|
+
var currentShiftId = shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId);
|
|
23744
|
+
nextNode.setSelected(true);
|
|
23745
|
+
api.ensureIndexVisible(nextRowIndex);
|
|
23746
|
+
setSelectedRowData(nextNode.data);
|
|
23747
|
+
navigate("".concat(routeLogbookEntry, "/").concat(currentShiftId, "/?entryId=").concat(nextNode.data.EntryId, "&action=view"));
|
|
23748
|
+
}
|
|
23749
|
+
}
|
|
23750
|
+
}, [setSelectedRowData, shiftId, shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId]);
|
|
23751
|
+
var getContextMenuItems = useCallback(function (params) {
|
|
23752
|
+
var _a, _b;
|
|
23753
|
+
var data = (_a = params.node) === null || _a === void 0 ? void 0 : _a.data;
|
|
23754
|
+
showContextMenu(event, data, "logbookEntryContext");
|
|
23755
|
+
if (data) {
|
|
23756
|
+
params.api.deselectAll();
|
|
23757
|
+
(_b = params.node) === null || _b === void 0 ? void 0 : _b.setSelected(true);
|
|
23758
|
+
}
|
|
23759
|
+
return [];
|
|
23760
|
+
}, [rows]);
|
|
23761
|
+
var getMenuOptions = useLogbookEntryOptionsFunctions({
|
|
23762
|
+
setSelectedRowData: setSelectedRowData,
|
|
23763
|
+
setShow: setShow,
|
|
23764
|
+
setShowRemoveDialog: setShowRemoveDialog,
|
|
23765
|
+
handleNewEntry: handleNewEntry,
|
|
23766
|
+
}).getMenuOptions;
|
|
23767
|
+
var handleExportToExcel = function () {
|
|
23768
|
+
if (!gridApiRef.current)
|
|
23769
|
+
return;
|
|
23770
|
+
var params = {
|
|
23771
|
+
fileName: "Logbook_Entries_Export.xlsx",
|
|
23772
|
+
columnKeys: [
|
|
23773
|
+
"AssetName",
|
|
23774
|
+
"CreateTimestamp",
|
|
23775
|
+
"Shift",
|
|
23776
|
+
"Crew",
|
|
23777
|
+
"Title",
|
|
23778
|
+
"CreatedBy",
|
|
23779
|
+
"Author",
|
|
23780
|
+
"Content",
|
|
23781
|
+
],
|
|
23782
|
+
processCellCallback: function (params) {
|
|
23783
|
+
if (params.column.colId === "CreateTimestamp") {
|
|
23784
|
+
return moment$3(params.value).format("MM/DD/yy - HH:mm");
|
|
23785
|
+
}
|
|
23786
|
+
return params.value;
|
|
23787
|
+
},
|
|
23788
|
+
};
|
|
23789
|
+
gridApiRef.current.exportDataAsExcel(params);
|
|
23790
|
+
};
|
|
23791
|
+
useEffect(function () {
|
|
23792
|
+
var _a, _b;
|
|
23793
|
+
if (!isLoading && entryId && entryId !== "new" && gridApiRef.current) {
|
|
23794
|
+
var rowNode = (_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.getRowNode(entryId);
|
|
23795
|
+
if (rowNode) {
|
|
23796
|
+
(_b = gridApiRef.current) === null || _b === void 0 ? void 0 : _b.ensureNodeVisible(rowNode);
|
|
23797
|
+
rowNode.setSelected(true);
|
|
23798
|
+
setSelectedRowData(rowNode.data);
|
|
23799
|
+
setShow(isEditMode ? "edit" : "view");
|
|
23800
|
+
}
|
|
23801
|
+
else {
|
|
23802
|
+
// If the row node is not found, it might be a newly created entry
|
|
23803
|
+
// Try to refetch the data and then look for the entry
|
|
23804
|
+
setTimeout(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
23805
|
+
var newRowNode;
|
|
23806
|
+
var _a, _b;
|
|
23807
|
+
return __generator(this, function (_c) {
|
|
23808
|
+
switch (_c.label) {
|
|
23809
|
+
case 0: return [4 /*yield*/, refetch()];
|
|
23810
|
+
case 1:
|
|
23811
|
+
_c.sent();
|
|
23812
|
+
newRowNode = (_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.getRowNode(entryId);
|
|
23813
|
+
if (newRowNode) {
|
|
23814
|
+
(_b = gridApiRef.current) === null || _b === void 0 ? void 0 : _b.ensureNodeVisible(newRowNode);
|
|
23815
|
+
newRowNode.setSelected(true);
|
|
23816
|
+
setSelectedRowData(newRowNode.data);
|
|
23817
|
+
setShow(isEditMode ? "edit" : "view");
|
|
23818
|
+
}
|
|
23819
|
+
return [2 /*return*/];
|
|
23820
|
+
}
|
|
23821
|
+
});
|
|
23822
|
+
}); }, 500);
|
|
23823
|
+
}
|
|
23824
|
+
}
|
|
23825
|
+
}, [gridApiRef.current, isLoading, entryId, isEditMode, refetch]);
|
|
23826
|
+
useEffect(function () {
|
|
23827
|
+
registerConfig({
|
|
23828
|
+
id: "logbookEntryContext",
|
|
23829
|
+
getOptions: getMenuOptions,
|
|
23830
|
+
});
|
|
23831
|
+
}, []);
|
|
23832
|
+
useEffect(function () {
|
|
23833
|
+
if (isError) {
|
|
23834
|
+
setError(e.message);
|
|
23835
|
+
}
|
|
23836
|
+
}, [isError, e]);
|
|
23837
|
+
useEffect(function () {
|
|
23838
|
+
if (shiftInfo) {
|
|
23839
|
+
setShow("");
|
|
23840
|
+
setSelectedRowData(null);
|
|
23841
|
+
if (entryId &&
|
|
23842
|
+
(shiftIdRef.current == null ||
|
|
23843
|
+
shiftIdRef.current === (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId))) {
|
|
23844
|
+
navigate("".concat(routeLogbookEntry, "/").concat(shiftInfo.CurrentShiftId, "?entryId=").concat(entryId, "&action=").concat(action));
|
|
23845
|
+
}
|
|
23846
|
+
else {
|
|
23847
|
+
navigate("".concat(routeLogbookEntry, "/").concat(shiftInfo.CurrentShiftId));
|
|
23848
|
+
}
|
|
23849
|
+
shiftIdRef.current = shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId;
|
|
23850
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
23851
|
+
return __generator(this, function (_a) {
|
|
23852
|
+
switch (_a.label) {
|
|
23853
|
+
case 0: return [4 /*yield*/, refetch()];
|
|
23854
|
+
case 1:
|
|
23855
|
+
_a.sent();
|
|
23856
|
+
return [2 /*return*/];
|
|
23857
|
+
}
|
|
23858
|
+
});
|
|
23859
|
+
}); })();
|
|
23860
|
+
}
|
|
23861
|
+
}, [shiftInfo]);
|
|
23862
|
+
useEffect(function () {
|
|
23863
|
+
if (shiftId) {
|
|
23864
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
23865
|
+
var shiftIdNumber;
|
|
23866
|
+
return __generator(this, function (_a) {
|
|
23867
|
+
switch (_a.label) {
|
|
23868
|
+
case 0:
|
|
23869
|
+
shiftIdNumber = Number(shiftId);
|
|
23870
|
+
return [4 /*yield*/, getShiftDataFromAPI(null, shiftIdNumber)];
|
|
23871
|
+
case 1:
|
|
23872
|
+
_a.sent();
|
|
23873
|
+
return [2 /*return*/];
|
|
23874
|
+
}
|
|
23875
|
+
});
|
|
23876
|
+
}); })();
|
|
23877
|
+
}
|
|
23878
|
+
else {
|
|
23879
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
23880
|
+
return __generator(this, function (_a) {
|
|
23881
|
+
switch (_a.label) {
|
|
23882
|
+
case 0: return [4 /*yield*/, getShiftDataFromAPI(null, 0)];
|
|
23883
|
+
case 1:
|
|
23884
|
+
_a.sent();
|
|
23885
|
+
return [2 /*return*/];
|
|
23886
|
+
}
|
|
23887
|
+
});
|
|
23888
|
+
}); })();
|
|
23889
|
+
}
|
|
23890
|
+
}, []);
|
|
23891
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
23892
|
+
React__default.createElement(Grid2, { container: true, size: {
|
|
23893
|
+
xs: 12,
|
|
23894
|
+
}, spacing: 2, justifyContent: "flex-start" },
|
|
23895
|
+
React__default.createElement(Grid2, { size: { md: 12, xs: 12 } },
|
|
23896
|
+
React__default.createElement(Typography$1, { variant: "h5", style: {
|
|
23897
|
+
fontWeight: 600,
|
|
23898
|
+
userSelect: "none",
|
|
23899
|
+
} }, "LOGBOOK")),
|
|
23900
|
+
React__default.createElement(Grid2, { container: true, size: { xs: 12, md: 5 }, spacing: 1 },
|
|
23901
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
23902
|
+
React__default.createElement(Filters$1, { quickFilter: quickFilter, onQuickFilterChange: onQuickFilterChange, selectedSections: filterSections, onSectionsChange: setFilterSections })),
|
|
23903
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
23904
|
+
React__default.createElement(Paper, { elevation: 1, style: {
|
|
23905
|
+
height: "62vh",
|
|
23906
|
+
width: "100%",
|
|
23907
|
+
} },
|
|
23908
|
+
React__default.createElement(AgGridReact, { loading: isLoading, rowData: rows, columnDefs: columnDefs, defaultColDef: defaultColDef, rowHeight: 38, headerHeight: 42, loadingOverlayComponent: CenteredLazyLoading, animateRows: true, getContextMenuItems: getContextMenuItems, onRowClicked: rowClicked, onCellKeyDown: onCellKeyDown, onGridReady: function (params) { return (gridApiRef.current = params.api); }, getRowId: function (params) { return "".concat(params.data.EntryId); }, gridOptions: {
|
|
23909
|
+
rowSelection: {
|
|
23910
|
+
mode: "singleRow",
|
|
23911
|
+
checkboxes: false,
|
|
23912
|
+
enableClickSelection: true,
|
|
23913
|
+
},
|
|
23914
|
+
statusBar: {
|
|
23915
|
+
statusPanels: [
|
|
23916
|
+
exportToExcel
|
|
23917
|
+
? {
|
|
23918
|
+
statusPanel: function (params) { return (React__default.createElement("div", { style: {
|
|
23919
|
+
display: "flex",
|
|
23920
|
+
alignItems: "center",
|
|
23921
|
+
paddingTop: 5,
|
|
23922
|
+
} },
|
|
23923
|
+
React__default.createElement(ExcelButton, { handleExportToExcel: handleExportToExcel }))); },
|
|
23924
|
+
align: "right",
|
|
23925
|
+
}
|
|
23926
|
+
: {},
|
|
23927
|
+
{
|
|
23928
|
+
statusPanel: function (params) { return (React__default.createElement(CustomStatusPanel, { handleNew: handleNewEntry })); },
|
|
23929
|
+
align: "left",
|
|
23930
|
+
},
|
|
23931
|
+
],
|
|
23932
|
+
},
|
|
23933
|
+
} })))),
|
|
23934
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 7 } },
|
|
23935
|
+
React__default.createElement(EntryViewer$1, { entry: selectedRowData, show: show, onChangeShow: function () {
|
|
23936
|
+
var newShow = show === "view" ? "edit" : "view";
|
|
23937
|
+
setShow(newShow);
|
|
23938
|
+
if (entryId && entryId !== "new") {
|
|
23939
|
+
var targetUrl = newShow === "edit"
|
|
23940
|
+
? "/logbook/entry/".concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId), "?entryId=").concat(entryId, "&action=edit")
|
|
23941
|
+
: "/logbook/entry/".concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId), "?entryId=").concat(entryId, "&action=view");
|
|
23942
|
+
navigate(targetUrl);
|
|
23943
|
+
}
|
|
23944
|
+
}, canEditShift: canEditShift, allowAttachments: allowAttachments, shiftsRange: shiftsRange, withAssetFilter: withAssetFilter, canEditAsset: canEditAsset, filterAssets: filterAssets, onHide: function (entryId, shouldStayInEditMode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23945
|
+
var targetUrl;
|
|
23946
|
+
var _a;
|
|
23947
|
+
return __generator(this, function (_b) {
|
|
23948
|
+
switch (_b.label) {
|
|
23949
|
+
case 0:
|
|
23950
|
+
if (!entryId) return [3 /*break*/, 2];
|
|
23951
|
+
// First refetch to ensure we have the latest data
|
|
23952
|
+
return [4 /*yield*/, refetch()];
|
|
23953
|
+
case 1:
|
|
23954
|
+
// First refetch to ensure we have the latest data
|
|
23955
|
+
_b.sent();
|
|
23956
|
+
targetUrl = shouldStayInEditMode
|
|
23957
|
+
? "/logbook/entry/".concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId), "?entryId=").concat(entryId, "&action=edit")
|
|
23958
|
+
: "/logbook/entry/".concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId), "?entryId=").concat(entryId, "&action=view");
|
|
23959
|
+
navigate(targetUrl);
|
|
23960
|
+
setShow(shouldStayInEditMode ? "edit" : "view");
|
|
23961
|
+
// Additional delay to allow navigation and state updates to complete
|
|
23962
|
+
setTimeout(function () {
|
|
23963
|
+
var _a, _b;
|
|
23964
|
+
var rowNode = (_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.getRowNode(entryId.toString());
|
|
23965
|
+
if (rowNode) {
|
|
23966
|
+
(_b = gridApiRef.current) === null || _b === void 0 ? void 0 : _b.ensureNodeVisible(rowNode);
|
|
23967
|
+
rowNode.setSelected(true);
|
|
23968
|
+
setSelectedRowData(rowNode.data);
|
|
23969
|
+
}
|
|
23970
|
+
else {
|
|
23971
|
+
// If still not found, try one more refetch
|
|
23972
|
+
setTimeout(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
23973
|
+
var retryRowNode;
|
|
23974
|
+
var _a, _b, _c;
|
|
23975
|
+
return __generator(this, function (_d) {
|
|
23976
|
+
switch (_d.label) {
|
|
23977
|
+
case 0: return [4 /*yield*/, refetch()];
|
|
23978
|
+
case 1:
|
|
23979
|
+
_d.sent();
|
|
23980
|
+
retryRowNode = (_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.getRowNode(entryId.toString());
|
|
23981
|
+
if (retryRowNode) {
|
|
23982
|
+
(_b = gridApiRef.current) === null || _b === void 0 ? void 0 : _b.ensureNodeVisible(retryRowNode);
|
|
23983
|
+
retryRowNode.setSelected(true);
|
|
23984
|
+
setSelectedRowData(retryRowNode.data);
|
|
23985
|
+
}
|
|
23986
|
+
else {
|
|
23987
|
+
setShow("");
|
|
23988
|
+
setSelectedRowData(null);
|
|
23989
|
+
(_c = gridApiRef.current) === null || _c === void 0 ? void 0 : _c.deselectAll();
|
|
23990
|
+
}
|
|
23991
|
+
return [2 /*return*/];
|
|
23992
|
+
}
|
|
23993
|
+
});
|
|
23994
|
+
}); }, 500);
|
|
23995
|
+
}
|
|
23996
|
+
}, 200);
|
|
23997
|
+
return [3 /*break*/, 3];
|
|
23998
|
+
case 2:
|
|
23999
|
+
setShow("");
|
|
24000
|
+
setSelectedRowData(null);
|
|
24001
|
+
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.deselectAll();
|
|
24002
|
+
navigate("".concat(routeLogbookEntry, "/").concat(shiftId || (shiftInfo === null || shiftInfo === void 0 ? void 0 : shiftInfo.CurrentShiftId)));
|
|
24003
|
+
_b.label = 3;
|
|
24004
|
+
case 3: return [2 /*return*/];
|
|
24005
|
+
}
|
|
24006
|
+
});
|
|
24007
|
+
}); } }))),
|
|
24008
|
+
React__default.createElement(RemoveEntryDialog, { entry: selectedRowData, show: showRemoveDialog, onHide: function (shouldUpdate) {
|
|
24009
|
+
if (shouldUpdate) {
|
|
24010
|
+
refetch();
|
|
24011
|
+
}
|
|
24012
|
+
setShowRemoveDialog(false);
|
|
24013
|
+
setSelectedRowData(null);
|
|
24014
|
+
setShow("");
|
|
24015
|
+
} }),
|
|
24016
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
24017
|
+
};
|
|
24018
|
+
|
|
24019
|
+
var LogbookPage$1 = function () {
|
|
24020
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
24021
|
+
React__default.createElement(HelmetDexteel, { title: "Logbook Entry" }),
|
|
24022
|
+
React__default.createElement(Grid2, { container: true, style: { padding: "1.5rem" } },
|
|
24023
|
+
React__default.createElement(Logbook$1, null))));
|
|
24024
|
+
};
|
|
24025
|
+
|
|
24026
|
+
var MESFLogbookEntry = function () {
|
|
24027
|
+
return React__default.createElement(LogbookPage$1, null);
|
|
24028
|
+
};
|
|
24029
|
+
|
|
24030
|
+
var moment$2 = getMomentTz();
|
|
24031
|
+
var getEntriesReport = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
24032
|
+
var apiService, parameters, resp, rows;
|
|
24033
|
+
var startShiftId = _b.startShiftId, endShiftId = _b.endShiftId, assetId = _b.assetId, sectionIds = _b.sectionIds, signal = _b.signal;
|
|
24034
|
+
return __generator(this, function (_c) {
|
|
24035
|
+
switch (_c.label) {
|
|
24036
|
+
case 0:
|
|
24037
|
+
apiService = new MESApiService();
|
|
24038
|
+
parameters = [
|
|
24039
|
+
{ name: "StartShiftId", value: startShiftId },
|
|
24040
|
+
{ name: "EndShiftId", value: endShiftId },
|
|
24041
|
+
];
|
|
24042
|
+
if (assetId) {
|
|
24043
|
+
parameters.push({ name: "AssetId", value: assetId });
|
|
24044
|
+
}
|
|
24045
|
+
// Pass comma-separated sectionIds for multi-select filter
|
|
24046
|
+
if (sectionIds && sectionIds.length > 0) {
|
|
24047
|
+
parameters.push({ name: "SectionIds", value: sectionIds.join(",") });
|
|
24048
|
+
}
|
|
24049
|
+
return [4 /*yield*/, apiService.callV2("[SWV].[GetSectionLogbookEntries]", parameters, signal)];
|
|
24050
|
+
case 1:
|
|
24051
|
+
resp = _c.sent();
|
|
24052
|
+
if (resp.ok) {
|
|
24053
|
+
rows = get(resp, "data.tables[0].rows", []);
|
|
24054
|
+
rows = rows.map(function (entry) { return (__assign(__assign({}, entry), { CreateTimestamp: entry.CreateTimestamp
|
|
24055
|
+
? moment$2.utc(entry["CreateTimestamp"]).toDate()
|
|
24056
|
+
: null, UpdateTimestamp: entry.UpdateTimestamp
|
|
24057
|
+
? moment$2.utc(entry["UpdateTimestamp"]).toDate()
|
|
24058
|
+
: null })); });
|
|
24059
|
+
return [2 /*return*/, rows];
|
|
24060
|
+
}
|
|
24061
|
+
else {
|
|
24062
|
+
throw new Error(resp.message || "Error fetching entries");
|
|
24063
|
+
}
|
|
24064
|
+
}
|
|
24065
|
+
});
|
|
24066
|
+
}); };
|
|
24067
|
+
|
|
24068
|
+
var useEntriesReport = function (_a) {
|
|
24069
|
+
var startShiftId = _a.startShiftId, endShiftId = _a.endShiftId, assetId = _a.assetId, sectionIds = _a.sectionIds;
|
|
24070
|
+
return useQuery({
|
|
24071
|
+
queryKey: ["entriesReport", startShiftId, endShiftId, assetId, sectionIds],
|
|
24072
|
+
queryFn: function (_a) {
|
|
24073
|
+
var signal = _a.signal;
|
|
24074
|
+
return getEntriesReport({
|
|
24075
|
+
startShiftId: startShiftId,
|
|
24076
|
+
endShiftId: endShiftId,
|
|
24077
|
+
assetId: assetId,
|
|
24078
|
+
sectionIds: sectionIds,
|
|
24079
|
+
signal: signal,
|
|
24080
|
+
});
|
|
24081
|
+
},
|
|
24082
|
+
});
|
|
24083
|
+
};
|
|
24084
|
+
|
|
24085
|
+
var useTableData = function (_a) {
|
|
24086
|
+
var showAttachments = _a.showAttachments, showAsset = _a.showAsset, showShiftCrew = _a.showShiftCrew;
|
|
24087
|
+
var columnDefs = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
24088
|
+
{
|
|
24089
|
+
field: "CreateTimestamp",
|
|
24090
|
+
headerName: "Created",
|
|
24091
|
+
flex: 2,
|
|
24092
|
+
valueGetter: function (params) {
|
|
24093
|
+
return dxtToLocalServerTime(params.data.CreateTimestamp, "MM/dd/yy HH:mm");
|
|
24094
|
+
},
|
|
24095
|
+
}
|
|
24096
|
+
], (showAsset
|
|
24097
|
+
? [
|
|
24098
|
+
{
|
|
24099
|
+
field: "AssetName",
|
|
24100
|
+
headerName: "Asset",
|
|
24101
|
+
sortable: true,
|
|
24102
|
+
flex: 2,
|
|
24103
|
+
minWidth: 70,
|
|
24104
|
+
wrapText: true,
|
|
24105
|
+
autoHeight: true,
|
|
24106
|
+
},
|
|
24107
|
+
]
|
|
24108
|
+
: []), true), [
|
|
24109
|
+
{
|
|
24110
|
+
field: "Title",
|
|
24111
|
+
headerName: "Title",
|
|
24112
|
+
flex: 4,
|
|
24113
|
+
},
|
|
24114
|
+
{
|
|
24115
|
+
field: "SectionName",
|
|
24116
|
+
headerName: "Section",
|
|
24117
|
+
flex: 2,
|
|
24118
|
+
},
|
|
24119
|
+
{
|
|
24120
|
+
field: "Author",
|
|
24121
|
+
headerName: "Created By",
|
|
24122
|
+
flex: 2,
|
|
24123
|
+
}
|
|
24124
|
+
], false), (showShiftCrew
|
|
24125
|
+
? [
|
|
24126
|
+
{
|
|
24127
|
+
field: "Shift",
|
|
24128
|
+
headerName: "Shift",
|
|
24129
|
+
sortable: false,
|
|
24130
|
+
flex: 1,
|
|
24131
|
+
minWidth: 60,
|
|
24132
|
+
maxWidth: 60,
|
|
24133
|
+
},
|
|
24134
|
+
{
|
|
24135
|
+
field: "Crew",
|
|
24136
|
+
headerName: "Crew",
|
|
24137
|
+
sortable: false,
|
|
24138
|
+
flex: 1,
|
|
24139
|
+
minWidth: 60,
|
|
24140
|
+
maxWidth: 60,
|
|
24141
|
+
},
|
|
24142
|
+
]
|
|
24143
|
+
: []), true), (showAttachments
|
|
24144
|
+
? [
|
|
24145
|
+
{
|
|
24146
|
+
field: "AttachmentCount",
|
|
24147
|
+
headerName: "",
|
|
24148
|
+
flex: 1,
|
|
24149
|
+
headerComponent: function () { return (React__default.createElement("div", { style: {
|
|
24150
|
+
display: "flex",
|
|
24151
|
+
alignItems: "center",
|
|
24152
|
+
justifyContent: "center",
|
|
24153
|
+
height: "100%",
|
|
24154
|
+
width: "100%",
|
|
24155
|
+
textAlign: "center",
|
|
24156
|
+
} },
|
|
24157
|
+
React__default.createElement(AttachFile, { style: { fontSize: 18, color: "#666" } }))); },
|
|
24158
|
+
cellRenderer: function (params) {
|
|
24159
|
+
var count = params.data.AttachmentCount || 0;
|
|
24160
|
+
if (count === 0) {
|
|
24161
|
+
return null;
|
|
24162
|
+
}
|
|
24163
|
+
return (React__default.createElement("div", { style: {
|
|
24164
|
+
display: "flex",
|
|
24165
|
+
alignItems: "center",
|
|
24166
|
+
height: "100%",
|
|
24167
|
+
justifyContent: "center",
|
|
24168
|
+
} },
|
|
24169
|
+
React__default.createElement(Chip, { icon: React__default.createElement(AttachFile, { style: { fontSize: 16 } }), label: count, size: "small", variant: "outlined", color: "primary" })));
|
|
24170
|
+
},
|
|
24171
|
+
},
|
|
24172
|
+
]
|
|
24173
|
+
: []), true), [
|
|
24174
|
+
{
|
|
24175
|
+
field: "Content",
|
|
24176
|
+
headerName: "Content",
|
|
24177
|
+
hide: true,
|
|
24178
|
+
},
|
|
24179
|
+
], false);
|
|
24180
|
+
return { columnDefs: columnDefs };
|
|
24181
|
+
};
|
|
24182
|
+
|
|
24183
|
+
var moment$1 = getMomentTz();
|
|
24184
|
+
var EntryViewer = function (_a) {
|
|
24185
|
+
var entry = _a.entry, show = _a.show, onHide = _a.onHide, showAsset = _a.showAsset, _b = _a.showAttachments, showAttachments = _b === void 0 ? false : _b, _c = _a.showSection, showSection = _c === void 0 ? false : _c;
|
|
24186
|
+
var _d = useState(""), error = _d[0], setError = _d[1];
|
|
24187
|
+
var _e = useForm(), control = _e.control, setValue = _e.setValue, reset = _e.reset, watch = _e.watch; _e.getValues;
|
|
24188
|
+
var content = watch("Content");
|
|
24189
|
+
var updatedBy = watch("UpdatedBy");
|
|
24190
|
+
var updateTimestamp = watch("UpdateTimestamp");
|
|
24191
|
+
var entryId = watch("EntryId");
|
|
24192
|
+
var title = watch("Title");
|
|
24193
|
+
var author = watch("Author");
|
|
24194
|
+
var shiftId = watch("ShiftId");
|
|
24195
|
+
var assetId = watch("AssetId");
|
|
24196
|
+
var createTimestamp = watch("CreateTimestamp");
|
|
24197
|
+
useEffect(function () {
|
|
24198
|
+
reset(entry || ENTRY_INITIAL_VALUES);
|
|
24199
|
+
}, [entry, show]);
|
|
24200
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
24201
|
+
(entry === null || entry === void 0 ? void 0 : entry.EntryId) && (React__default.createElement(HelmetDexteel, { title: "'".concat(entry === null || entry === void 0 ? void 0 : entry.Title, "' by ").concat(entry.Author, " - Logbook Report") })),
|
|
24202
|
+
(entry === null || entry === void 0 ? void 0 : entry.EntryId) ? (React__default.createElement(Paper, { elevation: 1, sx: {
|
|
24203
|
+
width: "100%",
|
|
24204
|
+
height: "100%",
|
|
24205
|
+
display: "flex",
|
|
24206
|
+
flexDirection: "column",
|
|
24207
|
+
} },
|
|
24208
|
+
React__default.createElement(Grid2, { container: true, spacing: 1, component: "form", height: "100%", flexDirection: "column", flexWrap: "nowrap", p: 1 },
|
|
24209
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
24210
|
+
React__default.createElement(Controller, { name: "Title", control: control, render: function (_a) {
|
|
24211
|
+
var value = _a.field.value;
|
|
24212
|
+
return (React__default.createElement(TextField, { label: "Title", value: value !== null && value !== void 0 ? value : "", size: "medium", disabled: true }));
|
|
24213
|
+
} })),
|
|
24214
|
+
React__default.createElement(Grid2, { container: true, size: { xs: 12 }, spacing: 2 },
|
|
24215
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
24216
|
+
React__default.createElement(Controller, { name: "CreateTimestamp", control: control, render: function (_a) {
|
|
24217
|
+
var value = _a.field.value;
|
|
24218
|
+
return (React__default.createElement(DateTimePicker, { label: "Creation Time", timezone: TimeService.getInstance().getServerTimeZone(), format: "MM/DD/YYYY HH:mm", value: value ? moment$1(value) : null, disabled: true, slotProps: {
|
|
24219
|
+
textField: {
|
|
24220
|
+
variant: "outlined",
|
|
24221
|
+
size: "small",
|
|
24222
|
+
fullWidth: true,
|
|
24223
|
+
InputLabelProps: {
|
|
24224
|
+
shrink: true,
|
|
24225
|
+
},
|
|
24226
|
+
},
|
|
24227
|
+
} }));
|
|
24228
|
+
} })),
|
|
24229
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
24230
|
+
React__default.createElement(Controller, { name: "ShiftId", control: control, render: function (_a) {
|
|
24231
|
+
var field = _a.field;
|
|
24232
|
+
return (React__default.createElement(ShiftSelector, { value: field.value, disabled: true }));
|
|
24233
|
+
} })),
|
|
24234
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: showAsset ? 2 : 6 } },
|
|
24235
|
+
React__default.createElement(Controller, { name: "Author", control: control, rules: {
|
|
24236
|
+
required: "Author is required",
|
|
24237
|
+
}, render: function (_a) {
|
|
24238
|
+
var value = _a.field.value; _a.fieldState.error;
|
|
24239
|
+
return (React__default.createElement(TextField, { label: "Author", variant: "outlined", value: value !== null && value !== void 0 ? value : "", fullWidth: true, disabled: true, size: "small" }));
|
|
24240
|
+
} })),
|
|
24241
|
+
showAsset ? (React__default.createElement(Grid2, { size: { md: 4, xs: 12 } },
|
|
24242
|
+
React__default.createElement(Controller, { name: "AssetId", control: control, render: function (_a) {
|
|
24243
|
+
var field = _a.field;
|
|
24244
|
+
return (React__default.createElement(AssetsFilter, { value: field.value, onChange: field.onChange, disabled: true }));
|
|
24245
|
+
} }))) : null),
|
|
24246
|
+
showSection && (entry === null || entry === void 0 ? void 0 : entry.SectionName) && (React__default.createElement(Grid2, { size: { xs: 12 }, sx: { display: "flex", alignItems: "center", gap: 1 } },
|
|
24247
|
+
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, "Section:"),
|
|
24248
|
+
React__default.createElement(Chip, { label: entry.SectionName, size: "small", color: "primary", variant: "outlined" }))),
|
|
24249
|
+
React__default.createElement(Grid2, { size: { md: 12 }, height: "100%", flexGrow: 1, overflow: "auto" },
|
|
24250
|
+
React__default.createElement(Controller, { name: "Content", control: control, render: function (_a) {
|
|
24251
|
+
var _b = _a.field; _b.value; _b.onChange;
|
|
24252
|
+
return (React__default.createElement(ContentInput, { UpdatedBy: updatedBy, UpdateTimestamp: updateTimestamp, onChange: function (val) { return setValue("Content", val); }, value: content, isEditing: false, isNewEntry: false, entryId: entryId, entryData: {
|
|
24253
|
+
assetId: assetId,
|
|
24254
|
+
entryId: entryId,
|
|
24255
|
+
shiftId: shiftId,
|
|
24256
|
+
title: title,
|
|
24257
|
+
content: content,
|
|
24258
|
+
author: author,
|
|
24259
|
+
createTimestamp: createTimestamp,
|
|
24260
|
+
}, onEntrySubmitted: undefined, allowAttachments: showAttachments }));
|
|
24261
|
+
} })),
|
|
24262
|
+
React__default.createElement(Grid2, { container: true, size: { xs: 12 } },
|
|
24263
|
+
React__default.createElement(Grid2, { container: true, size: { md: 6, xs: 12 }, spacing: 1 },
|
|
24264
|
+
React__default.createElement(Grid2, { size: { md: 6, xs: 12 } },
|
|
24265
|
+
React__default.createElement(Button, { fullWidth: true, variant: "contained", color: "inherit", onClick: function () { return onHide(); } }, "Close"))))))) : null,
|
|
24266
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
24267
|
+
};
|
|
24268
|
+
|
|
24269
|
+
var customPeriodOptions = [
|
|
24270
|
+
{ value: "Day", label: "Day" },
|
|
24271
|
+
{ value: "4Days", label: "4 Days" },
|
|
24272
|
+
{ value: "Week", label: "Week" },
|
|
24273
|
+
{ value: "Month", label: "Month" },
|
|
24274
|
+
{ value: "Custom", label: "Custom" },
|
|
24275
|
+
];
|
|
24276
|
+
var Filters = function (_a) {
|
|
24277
|
+
var quickFilter = _a.quickFilter, onQuickFilterChange = _a.onQuickFilterChange, shiftPeriod = _a.shiftPeriod, onChangeShiftPeriod = _a.onChangeShiftPeriod, actualPeriod = _a.actualPeriod, selectedSections = _a.selectedSections, onSectionsChange = _a.onSectionsChange;
|
|
24278
|
+
var handleShiftPeriodChange = function (value, period) {
|
|
24279
|
+
onChangeShiftPeriod(value, period);
|
|
24280
|
+
};
|
|
24281
|
+
useMesfRealtime({
|
|
24282
|
+
onReceiveMessage: function (author, message) {
|
|
24283
|
+
if (message.replaceAll("[", "").replaceAll("]", "") == "LB.GetEntries") ;
|
|
24284
|
+
},
|
|
24285
|
+
});
|
|
24286
|
+
return (React__default.createElement(Paper, { elevation: 1, style: { padding: 8 } },
|
|
24287
|
+
React__default.createElement(Grid2, { container: true, spacing: 1 },
|
|
24288
|
+
React__default.createElement(Grid2, { size: { xs: 12 }, alignItems: "center", justifyContent: "center" },
|
|
24289
|
+
React__default.createElement(ShiftPeriodNavigatorControl, { onChange: handleShiftPeriodChange, value: shiftPeriod, actualPeriod: actualPeriod, showShiftAndCrews: false, dateFormat: "MM/DD/YYYY", periodOptions: customPeriodOptions })),
|
|
24290
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 3 } },
|
|
24291
|
+
React__default.createElement(TextField, { fullWidth: true, label: "Search", variant: "outlined", size: "small", value: quickFilter, onChange: function (event) {
|
|
24292
|
+
onQuickFilterChange(event === null || event === void 0 ? void 0 : event.target.value);
|
|
24293
|
+
}, InputProps: {
|
|
24294
|
+
startAdornment: (React__default.createElement(InputAdornment, { position: "start" },
|
|
24295
|
+
React__default.createElement(IconButton$1, { edge: "start", type: "submit" },
|
|
24296
|
+
React__default.createElement(SearchIcon, null)))),
|
|
24297
|
+
} })),
|
|
24298
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 9 } },
|
|
24299
|
+
React__default.createElement(SectionMultiSelect, { value: selectedSections, onChange: onSectionsChange, label: "Sections" })))));
|
|
24300
|
+
};
|
|
24301
|
+
|
|
24302
|
+
var moment = getMomentTz();
|
|
24303
|
+
var Logbook = function () {
|
|
24304
|
+
var report = useLogbookSettings().report;
|
|
24305
|
+
var showAttachments = report.showAttachments;
|
|
24306
|
+
var showAsset = report.showAsset;
|
|
24307
|
+
var showShiftCrew = report.showShiftCrew;
|
|
24308
|
+
var exportToExcel = report.exportToExcel;
|
|
24309
|
+
var _a = useSearchParams(), searchParams = _a[0], setSearchParams = _a[1];
|
|
24310
|
+
var entryId = searchParams.get("entryId");
|
|
24311
|
+
var gridApiRef = useRef(null);
|
|
24312
|
+
var _b = useState(""), error = _b[0], setError = _b[1];
|
|
24313
|
+
var _c = useState(""), show = _c[0], setShow = _c[1];
|
|
24314
|
+
var _d = useState(function () {
|
|
24315
|
+
var startShiftIdParam = searchParams.get("startShiftId");
|
|
24316
|
+
var endShiftIdParam = searchParams.get("endShiftId");
|
|
24317
|
+
return {
|
|
24318
|
+
StartShiftId: startShiftIdParam ? Number(startShiftIdParam) : null,
|
|
24319
|
+
EndShiftId: endShiftIdParam ? Number(endShiftIdParam) : null,
|
|
24320
|
+
};
|
|
24321
|
+
}), shiftPeriod = _d[0], setShiftPeriod = _d[1];
|
|
24322
|
+
var _e = useState(""), quickFilter = _e[0], setQuickFilter = _e[1];
|
|
24323
|
+
var _f = useState(null), selectedRowData = _f[0], setSelectedRowData = _f[1];
|
|
24324
|
+
// Section filter state
|
|
24325
|
+
var _g = useState([]), filterSections = _g[0], setFilterSections = _g[1];
|
|
24326
|
+
var updateUrl = function (_a) {
|
|
24327
|
+
var startShiftId = _a.startShiftId, endShiftId = _a.endShiftId, period = _a.period, entryId = _a.entryId;
|
|
24328
|
+
var newParams = new URLSearchParams(searchParams);
|
|
24329
|
+
if (startShiftId) {
|
|
24330
|
+
newParams.set("startShiftId", startShiftId.toString());
|
|
24331
|
+
}
|
|
24332
|
+
else if (startShiftId === null) {
|
|
24333
|
+
newParams.delete("startShiftId");
|
|
24334
|
+
}
|
|
24335
|
+
if (endShiftId) {
|
|
24336
|
+
newParams.set("endShiftId", endShiftId.toString());
|
|
24337
|
+
}
|
|
24338
|
+
else if (endShiftId === null) {
|
|
24339
|
+
newParams.delete("endShiftId");
|
|
24340
|
+
}
|
|
24341
|
+
if (period) {
|
|
24342
|
+
newParams.set("period", period);
|
|
24343
|
+
}
|
|
24344
|
+
else if (period === null) {
|
|
24345
|
+
newParams.delete("period");
|
|
24346
|
+
}
|
|
24347
|
+
if (entryId) {
|
|
24348
|
+
newParams.set("entryId", entryId);
|
|
24349
|
+
}
|
|
24350
|
+
else if (entryId === null) {
|
|
24351
|
+
newParams.delete("entryId");
|
|
24352
|
+
}
|
|
24353
|
+
setSearchParams(newParams);
|
|
24354
|
+
};
|
|
24355
|
+
var _h = useEntriesReport({
|
|
24356
|
+
startShiftId: shiftPeriod.StartShiftId,
|
|
24357
|
+
endShiftId: shiftPeriod.EndShiftId,
|
|
24358
|
+
assetId: null,
|
|
24359
|
+
sectionIds: filterSections.map(function (s) { return s.SectionId; }),
|
|
24360
|
+
}), rows = _h.data, isLoading = _h.isLoading, e = _h.error, isError = _h.isError, refetch = _h.refetch;
|
|
24361
|
+
var columnDefs = useTableData({
|
|
24362
|
+
showAttachments: showAttachments,
|
|
24363
|
+
showAsset: showAsset,
|
|
24364
|
+
showShiftCrew: showShiftCrew,
|
|
24365
|
+
}).columnDefs;
|
|
24366
|
+
var defaultColDef = useGridDefinitions({}).defaultColDef;
|
|
24367
|
+
var onQuickFilterChange = function (text) {
|
|
24368
|
+
var _a;
|
|
24369
|
+
setQuickFilter(text);
|
|
24370
|
+
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.setGridOption("quickFilterText", text);
|
|
24371
|
+
};
|
|
24372
|
+
var rowClicked = function (event) {
|
|
24373
|
+
var _a, _b;
|
|
24374
|
+
setSelectedRowData(event === null || event === void 0 ? void 0 : event.data);
|
|
24375
|
+
updateUrl({ entryId: (_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.EntryId) === null || _b === void 0 ? void 0 : _b.toString() });
|
|
24376
|
+
setShow("view");
|
|
24377
|
+
};
|
|
24378
|
+
var onCellKeyDown = useCallback(function (event) {
|
|
24379
|
+
var _a, _b;
|
|
24380
|
+
var api = event.api, node = event.node, keyEvent = event.event;
|
|
24381
|
+
if (!keyEvent)
|
|
24382
|
+
return;
|
|
24383
|
+
var key = keyEvent.key;
|
|
24384
|
+
if (key === "ArrowUp" || key === "ArrowDown") {
|
|
24385
|
+
keyEvent.preventDefault();
|
|
24386
|
+
var currentIndex = node.rowIndex !== null ? node.rowIndex : -1;
|
|
24387
|
+
var nextRowIndex = key === "ArrowUp" ? currentIndex - 1 : currentIndex + 1;
|
|
24388
|
+
var nextNode = api.getDisplayedRowAtIndex(nextRowIndex);
|
|
24389
|
+
if (nextNode) {
|
|
24390
|
+
nextNode.setSelected(true);
|
|
24391
|
+
api.ensureIndexVisible(nextRowIndex);
|
|
24392
|
+
setSelectedRowData(nextNode.data);
|
|
24393
|
+
updateUrl({ entryId: (_b = (_a = nextNode.data) === null || _a === void 0 ? void 0 : _a.EntryId) === null || _b === void 0 ? void 0 : _b.toString() });
|
|
24394
|
+
}
|
|
24395
|
+
}
|
|
24396
|
+
}, [setSelectedRowData]);
|
|
24397
|
+
var handleExportToExcel = function () {
|
|
24398
|
+
if (!gridApiRef.current)
|
|
24399
|
+
return;
|
|
24400
|
+
var params = {
|
|
24401
|
+
fileName: "Logbook_Report_Export.xlsx",
|
|
24402
|
+
columnKeys: [
|
|
24403
|
+
"AssetName",
|
|
24404
|
+
"CreateTimestamp",
|
|
24405
|
+
"Shift",
|
|
24406
|
+
"Crew",
|
|
24407
|
+
"Title",
|
|
24408
|
+
"CreatedBy",
|
|
24409
|
+
"Author",
|
|
24410
|
+
"Content",
|
|
24411
|
+
],
|
|
24412
|
+
processCellCallback: function (params) {
|
|
24413
|
+
if (params.column.colId === "CreateTimestamp") {
|
|
24414
|
+
return moment(params.value).format("MM/DD/yy - HH:mm");
|
|
24415
|
+
}
|
|
24416
|
+
return params.value;
|
|
24417
|
+
},
|
|
24418
|
+
};
|
|
24419
|
+
gridApiRef.current.exportDataAsExcel(params);
|
|
24420
|
+
};
|
|
24421
|
+
useEffect(function () {
|
|
24422
|
+
var _a, _b, _c;
|
|
24423
|
+
if (!isLoading && entryId && gridApiRef.current) {
|
|
24424
|
+
var rowNode = (_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.getRowNode(entryId);
|
|
24425
|
+
if (rowNode) {
|
|
24426
|
+
(_b = gridApiRef.current) === null || _b === void 0 ? void 0 : _b.ensureNodeVisible(rowNode);
|
|
24427
|
+
rowNode.setSelected(true);
|
|
24428
|
+
setSelectedRowData(rowNode.data);
|
|
24429
|
+
setShow("view");
|
|
24430
|
+
}
|
|
24431
|
+
}
|
|
24432
|
+
else if (!entryId) {
|
|
24433
|
+
setShow("");
|
|
24434
|
+
setSelectedRowData(null);
|
|
24435
|
+
(_c = gridApiRef.current) === null || _c === void 0 ? void 0 : _c.deselectAll();
|
|
24436
|
+
}
|
|
24437
|
+
}, [gridApiRef.current, isLoading, entryId]);
|
|
24438
|
+
useEffect(function () {
|
|
24439
|
+
if (isError) {
|
|
24440
|
+
setError(e.message);
|
|
24441
|
+
}
|
|
24442
|
+
}, [isError, e]);
|
|
24443
|
+
useEffect(function () {
|
|
24444
|
+
var _a;
|
|
24445
|
+
var startShiftIdParam = searchParams.get("startShiftId");
|
|
24446
|
+
var endShiftIdParam = searchParams.get("endShiftId");
|
|
24447
|
+
var entryIdParam = searchParams.get("entryId");
|
|
24448
|
+
if (startShiftIdParam || endShiftIdParam) {
|
|
24449
|
+
setShiftPeriod({
|
|
24450
|
+
StartShiftId: startShiftIdParam ? Number(startShiftIdParam) : null,
|
|
24451
|
+
EndShiftId: endShiftIdParam ? Number(endShiftIdParam) : null,
|
|
24452
|
+
});
|
|
24453
|
+
}
|
|
24454
|
+
// Handle entryId from URL on initial load
|
|
24455
|
+
if (entryIdParam && gridApiRef.current) {
|
|
24456
|
+
var rowNode = (_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.getRowNode(entryIdParam);
|
|
24457
|
+
if (rowNode) {
|
|
24458
|
+
rowNode.setSelected(true);
|
|
24459
|
+
setSelectedRowData(rowNode.data);
|
|
24460
|
+
setShow("view");
|
|
24461
|
+
}
|
|
24462
|
+
}
|
|
24463
|
+
}, []);
|
|
24464
|
+
useEffect(function () {
|
|
24465
|
+
if (shiftPeriod.StartShiftId !== null || shiftPeriod.EndShiftId !== null) {
|
|
24466
|
+
setShow("");
|
|
24467
|
+
setSelectedRowData(null);
|
|
24468
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
24469
|
+
return __generator(this, function (_a) {
|
|
24470
|
+
switch (_a.label) {
|
|
24471
|
+
case 0: return [4 /*yield*/, refetch()];
|
|
24472
|
+
case 1:
|
|
24473
|
+
_a.sent();
|
|
24474
|
+
return [2 /*return*/];
|
|
24475
|
+
}
|
|
24476
|
+
});
|
|
24477
|
+
}); })();
|
|
24478
|
+
}
|
|
24479
|
+
}, [shiftPeriod.StartShiftId, shiftPeriod.EndShiftId]);
|
|
24480
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
24481
|
+
React__default.createElement(Grid2, { container: true, size: {
|
|
24482
|
+
xs: 12,
|
|
24483
|
+
}, spacing: 2, justifyContent: "flex-start" },
|
|
24484
|
+
React__default.createElement(Grid2, { size: { md: 12, xs: 12 } },
|
|
24485
|
+
React__default.createElement(Typography$1, { variant: "h5", style: {
|
|
24486
|
+
fontWeight: 600,
|
|
24487
|
+
userSelect: "none",
|
|
24488
|
+
} }, "LOGBOOK REPORT")),
|
|
24489
|
+
React__default.createElement(Grid2, { container: true, size: { xs: 12, md: 5 }, spacing: 1 },
|
|
24490
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
24491
|
+
React__default.createElement(Filters, { quickFilter: quickFilter, onQuickFilterChange: onQuickFilterChange, shiftPeriod: shiftPeriod, onChangeShiftPeriod: function (value, period) {
|
|
24492
|
+
setShiftPeriod(value);
|
|
24493
|
+
updateUrl({
|
|
24494
|
+
startShiftId: value.StartShiftId,
|
|
24495
|
+
endShiftId: value.EndShiftId,
|
|
24496
|
+
period: period,
|
|
24497
|
+
entryId: searchParams.get("entryId"),
|
|
24498
|
+
});
|
|
24499
|
+
}, actualPeriod: searchParams.get("period"), selectedSections: filterSections, onSectionsChange: setFilterSections })),
|
|
24500
|
+
React__default.createElement(Grid2, { size: { xs: 12 } },
|
|
24501
|
+
React__default.createElement(Paper, { elevation: 1, style: {
|
|
24502
|
+
height: "62vh",
|
|
24503
|
+
width: "100%",
|
|
24504
|
+
} },
|
|
24505
|
+
React__default.createElement(AgGridReact, { loading: isLoading, rowData: rows, columnDefs: columnDefs, defaultColDef: defaultColDef, rowHeight: 38, headerHeight: 42, loadingOverlayComponent: CenteredLazyLoading, animateRows: true, onRowClicked: rowClicked, onCellKeyDown: onCellKeyDown, onGridReady: function (params) { return (gridApiRef.current = params.api); }, getRowId: function (params) { return "".concat(params.data.EntryId); }, gridOptions: {
|
|
24506
|
+
rowSelection: {
|
|
24507
|
+
mode: "singleRow",
|
|
24508
|
+
checkboxes: false,
|
|
24509
|
+
enableClickSelection: true,
|
|
24510
|
+
},
|
|
24511
|
+
statusBar: {
|
|
24512
|
+
statusPanels: [
|
|
24513
|
+
exportToExcel
|
|
24514
|
+
? {
|
|
24515
|
+
statusPanel: function (params) { return (React__default.createElement("div", { style: {
|
|
24516
|
+
display: "flex",
|
|
24517
|
+
alignItems: "center",
|
|
24518
|
+
paddingTop: 1,
|
|
24519
|
+
paddingBottom: 1,
|
|
24520
|
+
} },
|
|
24521
|
+
React__default.createElement(ExcelButton, { handleExportToExcel: handleExportToExcel }))); },
|
|
24522
|
+
align: "right",
|
|
24523
|
+
}
|
|
24524
|
+
: {},
|
|
24525
|
+
],
|
|
24526
|
+
},
|
|
24527
|
+
} })))),
|
|
24528
|
+
React__default.createElement(Grid2, { size: { xs: 12, md: 7 } },
|
|
24529
|
+
React__default.createElement(EntryViewer, { entry: selectedRowData, show: show, onChangeShow: function () { return setShow(show === "view" ? "edit" : "view"); }, onHide: function () {
|
|
24530
|
+
var _a;
|
|
24531
|
+
setShow("");
|
|
24532
|
+
setSelectedRowData(null);
|
|
24533
|
+
(_a = gridApiRef.current) === null || _a === void 0 ? void 0 : _a.deselectAll();
|
|
24534
|
+
updateUrl({ entryId: null });
|
|
24535
|
+
}, showAsset: showAsset, showAttachments: showAttachments, showSection: true }))),
|
|
24536
|
+
React__default.createElement(ErrorModal, { error: error, onHide: function () { return setError(""); } })));
|
|
24537
|
+
};
|
|
24538
|
+
|
|
24539
|
+
var LogbookPage = function () {
|
|
24540
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
24541
|
+
React__default.createElement(HelmetDexteel, { title: "Logbook Report" }),
|
|
24542
|
+
React__default.createElement(Grid2, { container: true, style: { padding: "1.5rem" } },
|
|
24543
|
+
React__default.createElement(Logbook, null))));
|
|
24544
|
+
};
|
|
24545
|
+
|
|
24546
|
+
var MESFLogbookReport = function () {
|
|
24547
|
+
return React__default.createElement(LogbookPage, null);
|
|
24548
|
+
};
|
|
24549
|
+
|
|
24550
|
+
var sectionLogbookRoutesMESF = [
|
|
24551
|
+
{
|
|
24552
|
+
path: "/logbook/entry",
|
|
24553
|
+
element: React__default.createElement(MESFLogbookEntry),
|
|
24554
|
+
},
|
|
24555
|
+
{
|
|
24556
|
+
path: "/logbook/entry/:shiftId",
|
|
24557
|
+
element: React__default.createElement(MESFLogbookEntry),
|
|
24558
|
+
},
|
|
24559
|
+
{
|
|
24560
|
+
path: "/logbook/report",
|
|
24561
|
+
element: React__default.createElement(MESFLogbookReport),
|
|
24562
|
+
},
|
|
24563
|
+
];
|
|
24564
|
+
var sectionLogbookNavbar = [
|
|
24565
|
+
{
|
|
24566
|
+
id: "logbook",
|
|
24567
|
+
label: "Logbook",
|
|
24568
|
+
items: [
|
|
24569
|
+
{
|
|
24570
|
+
label: "Logbook Entry",
|
|
24571
|
+
to: "/logbook/entry",
|
|
24572
|
+
},
|
|
24573
|
+
{
|
|
24574
|
+
label: "Logbook Report",
|
|
24575
|
+
to: "/logbook/report",
|
|
24576
|
+
},
|
|
24577
|
+
],
|
|
24578
|
+
},
|
|
24579
|
+
];
|
|
24580
|
+
|
|
21985
24581
|
var AreaSelector = function () {
|
|
21986
24582
|
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
21987
24583
|
var _b = useState(""), error = _b[0], setError = _b[1];
|
|
@@ -22110,5 +24706,5 @@ var areaSelector = /*#__PURE__*/Object.freeze({
|
|
|
22110
24706
|
AreaSelector: AreaSelector
|
|
22111
24707
|
});
|
|
22112
24708
|
|
|
22113
|
-
export { Account, AssetProvider, AssetTreePicker, AuthContext, AuthProvider, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CreateNewAssetDialog, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ENTRY_INITIAL_VALUES, EditAssetDialog, ErrorModal, ExcelIcon, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HelmetDexteel, IntegerFormatter, LogbookSettingsInitialState, LogbookSettingsProvider, Login, Logout, LongFilterPanel, MESApiService, MESFLogbookEntry, MESFLogbookReport, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, RemoveAssetDialog, SPExecutorPage, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getEntries, getError, getMomentTz, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, logbookNavbar, logbookRoutesMESF, renewToken, routeLogbookEntry, routeLogbookReport, useSearchAssets as searchAssets, useSearchSeries as searchSeries, useSearchTagsTree as searchTagsTree, useSearchViewTags as searchViewTags, useSearchViews as searchViews, setPassword, setProfilesToUser, themeDXT, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useHasPermission, useHasProfile, useLogbookSettings, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useToken, useUTLSettingsContext, useUserContext };
|
|
24709
|
+
export { Account, AssetProvider, AssetTreePicker, AuthContext, AuthProvider, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CreateNewAssetDialog, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ENTRY_INITIAL_VALUES$1 as ENTRY_INITIAL_VALUES, EditAssetDialog, ErrorModal, ExcelIcon, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HelmetDexteel, IntegerFormatter, LogbookSettingsInitialState, LogbookSettingsProvider, Login, Logout, LongFilterPanel, MESApiService, MESFLogbookEntry$1 as MESFLogbookEntry, MESFLogbookReport$1 as MESFLogbookReport, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, RemoveAssetDialog, SPExecutorPage, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getEntries$1 as getEntries, getError, getMomentTz, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, logbookNavbar, logbookRoutesMESF, renewToken, routeLogbookEntry$1 as routeLogbookEntry, routeLogbookReport, useSearchAssets as searchAssets, useSearchSeries as searchSeries, useSearchTagsTree as searchTagsTree, useSearchViewTags as searchViewTags, useSearchViews as searchViews, sectionLogbookNavbar, sectionLogbookRoutesMESF, setPassword, setProfilesToUser, themeDXT, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useHasPermission, useHasProfile, useLogbookSettings, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useToken, useUTLSettingsContext, useUserContext };
|
|
22114
24710
|
//# sourceMappingURL=index.esm.js.map
|