release/2025-08-15 - Add LogImexEvent for Theme toggling / remove Tooltip with translations (no longer necessary)
This commit is contained in:
@@ -33,7 +33,6 @@ import { RiSurveyLine } from "react-icons/ri";
|
||||
import { IoBusinessOutline } from "react-icons/io5";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import LockWrapper from "../../components/lock-wrapper/lock-wrapper.component.jsx";
|
||||
import { Tooltip } from "antd";
|
||||
|
||||
const buildLeftMenuItems = ({
|
||||
t,
|
||||
@@ -338,9 +337,7 @@ const buildLeftMenuItems = ({
|
||||
key: "darkmode-toggle",
|
||||
id: "header-darkmode-toggle",
|
||||
label: darkMode ? t("user.actions.light_theme") : t("user.actions.dark_theme"),
|
||||
icon: (
|
||||
<Tooltip title={darkMode ? t("Light mode") : t("Dark mode")}>{darkMode ? <FaSun /> : <FaMoon />}</Tooltip>
|
||||
),
|
||||
icon: darkMode ? <FaSun /> : <FaMoon />,
|
||||
onClick: handleDarkModeToggle
|
||||
},
|
||||
{
|
||||
|
||||
@@ -105,11 +105,13 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
alerts: newAlertsMap
|
||||
};
|
||||
}
|
||||
case ApplicationActionTypes.TOGGLE_DARK_MODE:
|
||||
case ApplicationActionTypes.TOGGLE_DARK_MODE: {
|
||||
const newDarkModeState = !state.darkMode;
|
||||
return {
|
||||
...state,
|
||||
darkMode: !state.darkMode
|
||||
darkMode: newDarkModeState
|
||||
};
|
||||
}
|
||||
case ApplicationActionTypes.SET_DARK_MODE:
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -6,6 +6,7 @@ import client from "../../utils/GraphQLClient";
|
||||
import { CalculateLoad, CheckJobBucket } from "../../utils/SSSUtils";
|
||||
import { scheduleLoadFailure, scheduleLoadSuccess, setProblemJobs } from "./application.actions";
|
||||
import ApplicationActionTypes from "./application.types";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
|
||||
export function* onCalculateScheduleLoad() {
|
||||
yield takeLatest(ApplicationActionTypes.CALCULATE_SCHEDULE_LOAD, calculateScheduleLoad);
|
||||
@@ -106,17 +107,14 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
|
||||
const AddJobForSchedulingCalc = !item.inproduction;
|
||||
|
||||
if (!!load[itemDate]) {
|
||||
if (load[itemDate]) {
|
||||
load[itemDate].allHoursIn =
|
||||
(load[itemDate].allHoursIn || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].allHoursInBody =
|
||||
(load[itemDate].allHoursInBody || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].allHoursInBody = (load[itemDate].allHoursInBody || 0) + item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].allHoursInRefinish =
|
||||
(load[itemDate].allHoursInRefinish || 0) +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
(load[itemDate].allHoursInRefinish || 0) + item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
//If the job hasn't already arrived, add it to the jobs in list.
|
||||
// Make sure it also hasn't already been completed, or isn't an in and out job.
|
||||
//This prevents the duplicate counting.
|
||||
@@ -124,15 +122,9 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
if (AddJobForSchedulingCalc) {
|
||||
load[itemDate].jobsIn.push(item);
|
||||
load[itemDate].hoursIn =
|
||||
(load[itemDate].hoursIn || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursInBody =
|
||||
(load[itemDate].hoursInBody || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursInRefinish =
|
||||
(load[itemDate].hoursInRefinish || 0) +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
(load[itemDate].hoursIn || 0) + item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursInBody = (load[itemDate].hoursInBody || 0) + item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursInRefinish = (load[itemDate].hoursInRefinish || 0) + item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
}
|
||||
} else {
|
||||
load[itemDate] = {
|
||||
@@ -140,21 +132,14 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
jobsIn: AddJobForSchedulingCalc ? [item] : [], //Same as above, only add it if it isn't already in production.
|
||||
jobsOut: [],
|
||||
allJobsOut: [],
|
||||
allHoursIn:
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursIn: item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursInBody: item.labhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursInRefinish: item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
hoursIn: AddJobForSchedulingCalc
|
||||
? item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs
|
||||
: 0,
|
||||
hoursInBody: AddJobForSchedulingCalc
|
||||
? item.labhrs.aggregate.sum.mod_lb_hrs
|
||||
: 0,
|
||||
hoursInRefinish: AddJobForSchedulingCalc
|
||||
? item.larhrs.aggregate.sum.mod_lb_hrs
|
||||
? item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs
|
||||
: 0,
|
||||
hoursInBody: AddJobForSchedulingCalc ? item.labhrs.aggregate.sum.mod_lb_hrs : 0,
|
||||
hoursInRefinish: AddJobForSchedulingCalc ? item.larhrs.aggregate.sum.mod_lb_hrs : 0
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -170,17 +155,14 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
const itemDate = dayjs(item.actual_completion || item.scheduled_completion).format("YYYY-MM-DD");
|
||||
//Skip it, it's already completed.
|
||||
|
||||
if (!!load[itemDate]) {
|
||||
if (load[itemDate]) {
|
||||
load[itemDate].allHoursOut =
|
||||
(load[itemDate].allHoursOut || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].allHoursOutBody =
|
||||
(load[itemDate].allHoursOutBody || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].allHoursOutBody = (load[itemDate].allHoursOutBody || 0) + item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].allHoursOutRefinish =
|
||||
(load[itemDate].allHoursOutRefinish || 0) +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
(load[itemDate].allHoursOutRefinish || 0) + item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
//Add only the jobs that are still in production to get rid of.
|
||||
//If it's not in production, we'd subtract unnecessarily.
|
||||
load[itemDate].allJobsOut.push(item);
|
||||
@@ -191,12 +173,9 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
(load[itemDate].hoursOut || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursOutBody =
|
||||
(load[itemDate].hoursOutBody || 0) +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursOutBody = (load[itemDate].hoursOutBody || 0) + item.labhrs.aggregate.sum.mod_lb_hrs;
|
||||
load[itemDate].hoursOutRefinish =
|
||||
(load[itemDate].hoursOutRefinish || 0) +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
(load[itemDate].hoursOutRefinish || 0) + item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
}
|
||||
} else {
|
||||
load[itemDate] = {
|
||||
@@ -205,11 +184,9 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
hoursOut: AddJobForSchedulingCalc
|
||||
? item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs
|
||||
: 0,
|
||||
allHoursOut:
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursOut: item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursOutBody: item.labhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursOutRefinish: item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
allHoursOutRefinish: item.larhrs.aggregate.sum.mod_lb_hrs
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -222,7 +199,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
const prev = dayjs(today)
|
||||
.add(day - 1, "day")
|
||||
.format("YYYY-MM-DD");
|
||||
if (!!!load[current]) {
|
||||
if (!load[current]) {
|
||||
load[current] = {};
|
||||
}
|
||||
|
||||
@@ -298,6 +275,14 @@ export function* insertAuditTrailSaga({ payload: { jobid, billid, operation, typ
|
||||
});
|
||||
}
|
||||
|
||||
export function* applicationSagas() {
|
||||
yield all([call(onCalculateScheduleLoad), call(onInsertAuditTrail)]);
|
||||
export function* onToggleDarkMode() {
|
||||
yield takeLatest(ApplicationActionTypes.TOGGLE_DARK_MODE, function* () {
|
||||
const state = yield select();
|
||||
const darkMode = state.application.darkMode;
|
||||
logImEXEvent("dark_mode_toggled", { darkMode });
|
||||
});
|
||||
}
|
||||
|
||||
export function* applicationSagas() {
|
||||
yield all([call(onCalculateScheduleLoad), call(onInsertAuditTrail), call(onToggleDarkMode)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user