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
|
||||
@@ -42381,6 +42381,27 @@
|
||||
<folder_node>
|
||||
<name>labels</name>
|
||||
<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>
|
||||
<name>employeevacation</name>
|
||||
<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 React, { useMemo } from "react";
|
||||
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 ScheduleModal from "../schedule-job-modal/schedule-job-modal.container";
|
||||
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";
|
||||
|
||||
export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||
|
||||
const [filter, setFilter] = useLocalStorage("filter_events", {
|
||||
intake: true,
|
||||
manual: true,
|
||||
@@ -35,6 +37,7 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||
<PageHeader
|
||||
extra={
|
||||
<Space wrap>
|
||||
<ScheduleAtsSummary/>
|
||||
<Checkbox
|
||||
checked={filter?.intake}
|
||||
onChange={(e) => {
|
||||
@@ -70,6 +73,8 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||
<ScheduleProductionList />
|
||||
|
||||
<ScheduleManualEvent />
|
||||
|
||||
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -364,6 +364,7 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
alt_transport
|
||||
labhrs: joblines_aggregate(
|
||||
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.
|
||||
const range = Math.round(moment.duration(end.diff(today)).asDays());
|
||||
for (var day = 0; day < range; day++) {
|
||||
@@ -175,6 +171,22 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
(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(scheduleLoadSuccess(load));
|
||||
} catch (error) {
|
||||
|
||||
@@ -2500,6 +2500,7 @@
|
||||
},
|
||||
"schedule": {
|
||||
"labels": {
|
||||
"atssummary": "Weekly ATS Summary",
|
||||
"employeevacation": "Employee Vacations",
|
||||
"intake": "Intake Events",
|
||||
"manual": "Manual Events",
|
||||
|
||||
@@ -2500,6 +2500,7 @@
|
||||
},
|
||||
"schedule": {
|
||||
"labels": {
|
||||
"atssummary": "",
|
||||
"employeevacation": "",
|
||||
"intake": "",
|
||||
"manual": "",
|
||||
|
||||
@@ -2500,6 +2500,7 @@
|
||||
},
|
||||
"schedule": {
|
||||
"labels": {
|
||||
"atssummary": "",
|
||||
"employeevacation": "",
|
||||
"intake": "",
|
||||
"manual": "",
|
||||
|
||||
Reference in New Issue
Block a user