IO-2132 Updated approach to ATS summary.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project version="1.2" be_version="2.7.1">
|
<babeledit_project be_version="2.7.1" version="1.2">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { Space } from "antd";
|
import { Space } from "antd";
|
||||||
import React from "react";
|
import React, { useMemo } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { useLocation } from "react-router-dom";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectScheduleLoad } from "../../redux/application/application.selectors";
|
import { selectScheduleLoad } from "../../redux/application/application.selectors";
|
||||||
import queryString from "query-string";
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
scheduleLoad: selectScheduleLoad,
|
scheduleLoad: selectScheduleLoad,
|
||||||
@@ -14,20 +12,33 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ScheduleAtsSummary({ scheduleLoad }) {
|
export function ScheduleAtsSummary({ scheduleLoad, appointments }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const search = queryString.parse(useLocation().search);
|
|
||||||
|
|
||||||
if (
|
const atsSummary = useMemo(() => {
|
||||||
(search.view === undefined || search.view === "week") &&
|
let atsSummary = {};
|
||||||
scheduleLoad.atsSummary &&
|
if (!appointments || appointments.length === 0) {
|
||||||
Object.keys(scheduleLoad.atsSummary).length > 0
|
return {};
|
||||||
)
|
}
|
||||||
|
appointments
|
||||||
|
.filter((a) => a.isintake)
|
||||||
|
.forEach((a) => {
|
||||||
|
if (!a.job.alt_transport) return;
|
||||||
|
if (!atsSummary[a.job.alt_transport]) {
|
||||||
|
atsSummary[a.job.alt_transport] = 1;
|
||||||
|
} else {
|
||||||
|
atsSummary[a.job.alt_transport] = atsSummary[a.job.alt_transport] + 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return atsSummary;
|
||||||
|
}, [appointments]);
|
||||||
|
|
||||||
|
if (Object.keys(atsSummary).length > 0)
|
||||||
return (
|
return (
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{t("schedule.labels.atssummary")}
|
{t("schedule.labels.atssummary")}
|
||||||
{Object.keys(scheduleLoad.atsSummary).map((key) => (
|
{Object.keys(atsSummary).map((key) => (
|
||||||
<span key={key}>{`${key}: ${scheduleLoad.atsSummary[key]}`}</span>
|
<span key={key}>{`${key}: ${atsSummary[key]}`}</span>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +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 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";
|
||||||
@@ -11,7 +11,6 @@ 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,
|
||||||
@@ -37,7 +36,7 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
|||||||
<PageHeader
|
<PageHeader
|
||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<ScheduleAtsSummary/>
|
<ScheduleAtsSummary appointments={filteredData} />
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={filter?.intake}
|
checked={filter?.intake}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
@@ -73,8 +72,6 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
|||||||
<ScheduleProductionList />
|
<ScheduleProductionList />
|
||||||
|
|
||||||
<ScheduleManualEvent />
|
<ScheduleManualEvent />
|
||||||
|
|
||||||
|
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -172,21 +172,6 @@ export function* calculateScheduleLoad({ payload: end }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//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) {
|
||||||
|
|||||||
@@ -2501,7 +2501,7 @@
|
|||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
"labels": {
|
"labels": {
|
||||||
"atssummary": "Weekly ATS Summary",
|
"atssummary": "ATS Summary",
|
||||||
"employeevacation": "Employee Vacations",
|
"employeevacation": "Employee Vacations",
|
||||||
"intake": "Intake Events",
|
"intake": "Intake Events",
|
||||||
"manual": "Manual Events",
|
"manual": "Manual Events",
|
||||||
|
|||||||
Reference in New Issue
Block a user