IO-2132 Add Weekly ATS Summary
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project be_version="2.7.1" version="1.2">
|
<babeledit_project version="1.2" be_version="2.7.1">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
@@ -42381,6 +42381,27 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>labels</name>
|
<name>labels</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>atssummary</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>employeevacation</name>
|
<name>employeevacation</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { Space } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectScheduleLoad } from "../../redux/application/application.selectors";
|
||||||
|
import queryString from "query-string";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
scheduleLoad: selectScheduleLoad,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ScheduleAtsSummary({ scheduleLoad }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const search = queryString.parse(useLocation().search);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(search.view === undefined || search.view === "week") &&
|
||||||
|
scheduleLoad.atsSummary &&
|
||||||
|
Object.keys(scheduleLoad.atsSummary).length > 0
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
{t("schedule.labels.atssummary")}
|
||||||
|
{Object.keys(scheduleLoad.atsSummary).map((key) => (
|
||||||
|
<span key={key}>{`${key}: ${scheduleLoad.atsSummary[key]}`}</span>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(ScheduleAtsSummary);
|
||||||
@@ -3,6 +3,7 @@ import { Button, Card, Checkbox, Col, PageHeader, Row, Space } from "antd";
|
|||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
import useLocalStorage from "../../utils/useLocalStorage";
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
|
import ScheduleAtsSummary from "../schedule-ats-summary/schedule-ats-summary.component";
|
||||||
import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component";
|
import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component";
|
||||||
import ScheduleModal from "../schedule-job-modal/schedule-job-modal.container";
|
import ScheduleModal from "../schedule-job-modal/schedule-job-modal.container";
|
||||||
import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component";
|
import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component";
|
||||||
@@ -10,6 +11,7 @@ import ScheduleProductionList from "../schedule-production-list/schedule-product
|
|||||||
import ScheduleVerifyIntegrity from "../schedule-verify-integrity/schedule-verify-integrity.component";
|
import ScheduleVerifyIntegrity from "../schedule-verify-integrity/schedule-verify-integrity.component";
|
||||||
|
|
||||||
export default function ScheduleCalendarComponent({ data, refetch }) {
|
export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||||
|
|
||||||
const [filter, setFilter] = useLocalStorage("filter_events", {
|
const [filter, setFilter] = useLocalStorage("filter_events", {
|
||||||
intake: true,
|
intake: true,
|
||||||
manual: true,
|
manual: true,
|
||||||
@@ -35,6 +37,7 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
|||||||
<PageHeader
|
<PageHeader
|
||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
|
<ScheduleAtsSummary/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={filter?.intake}
|
checked={filter?.intake}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
@@ -70,6 +73,8 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
|||||||
<ScheduleProductionList />
|
<ScheduleProductionList />
|
||||||
|
|
||||||
<ScheduleManualEvent />
|
<ScheduleManualEvent />
|
||||||
|
|
||||||
|
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
|
|||||||
ownr_fn
|
ownr_fn
|
||||||
ownr_ln
|
ownr_ln
|
||||||
ownr_co_nm
|
ownr_co_nm
|
||||||
|
alt_transport
|
||||||
labhrs: joblines_aggregate(
|
labhrs: joblines_aggregate(
|
||||||
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
|
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -136,10 +136,6 @@ export function* calculateScheduleLoad({ payload: end }) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: application.sagas.js:160 ~ function*calculateScheduleLoad ~ load.productionTotal",
|
|
||||||
load.productionTotal
|
|
||||||
);
|
|
||||||
//Propagate the expected load to each day.
|
//Propagate the expected load to each day.
|
||||||
const range = Math.round(moment.duration(end.diff(today)).asDays());
|
const range = Math.round(moment.duration(end.diff(today)).asDays());
|
||||||
for (var day = 0; day < range; day++) {
|
for (var day = 0; day < range; day++) {
|
||||||
@@ -175,6 +171,22 @@ export function* calculateScheduleLoad({ payload: end }) {
|
|||||||
(load[current].hoursOut || 0);
|
(load[current].hoursOut || 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Calculate weekly ATS summary.
|
||||||
|
const startOfWeek = moment(end).startOf("week");
|
||||||
|
const endOfWeek = moment(end).endOf("week");
|
||||||
|
load.atsSummary = {};
|
||||||
|
arrJobs
|
||||||
|
.filter((j) => moment(j.scheduled_in).isBetween(startOfWeek, endOfWeek))
|
||||||
|
.forEach((j) => {
|
||||||
|
if (!load.atsSummary[j.alt_transport]) {
|
||||||
|
load.atsSummary[j.alt_transport] = 1;
|
||||||
|
} else {
|
||||||
|
load.atsSummary[j.alt_transport] =
|
||||||
|
load.atsSummary[j.alt_transport] + 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
yield put(setProblemJobs(problemJobs));
|
yield put(setProblemJobs(problemJobs));
|
||||||
yield put(scheduleLoadSuccess(load));
|
yield put(scheduleLoadSuccess(load));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -2500,6 +2500,7 @@
|
|||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"atssummary": "Weekly ATS Summary",
|
||||||
"employeevacation": "Employee Vacations",
|
"employeevacation": "Employee Vacations",
|
||||||
"intake": "Intake Events",
|
"intake": "Intake Events",
|
||||||
"manual": "Manual Events",
|
"manual": "Manual Events",
|
||||||
|
|||||||
@@ -2500,6 +2500,7 @@
|
|||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"atssummary": "",
|
||||||
"employeevacation": "",
|
"employeevacation": "",
|
||||||
"intake": "",
|
"intake": "",
|
||||||
"manual": "",
|
"manual": "",
|
||||||
|
|||||||
@@ -2500,6 +2500,7 @@
|
|||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"atssummary": "",
|
||||||
"employeevacation": "",
|
"employeevacation": "",
|
||||||
"intake": "",
|
"intake": "",
|
||||||
"manual": "",
|
"manual": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user