Added ATS Info to Calendar IO-711

This commit is contained in:
Patrick Fic
2021-02-25 15:20:00 -08:00
parent d8ab9105a7
commit efa4a3f42b
7 changed files with 88 additions and 39 deletions

View File

@@ -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
@@ -24845,6 +24845,32 @@
<folder_node> <folder_node>
<name>printcenter</name> <name>printcenter</name>
<children> <children>
<folder_node>
<name>appointments</name>
<children>
<concept_node>
<name>appointment_confirmation</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>
</children>
</folder_node>
<folder_node> <folder_node>
<name>bills</name> <name>bills</name>
<children> <children>

View File

@@ -1,6 +1,8 @@
import Icon from "@ant-design/icons"; import Icon from "@ant-design/icons";
import { Popover } from "antd"; import { Popover } from "antd";
import React from "react"; import _ from "lodash";
import moment from "moment";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { MdFileDownload, MdFileUpload } from "react-icons/md"; import { MdFileDownload, MdFileUpload } from "react-icons/md";
import { connect } from "react-redux"; import { connect } from "react-redux";
@@ -15,8 +17,6 @@ import { DateTimeFormatter } from "../../utils/DateFormatter";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component"; import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component"; import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component";
import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component"; import ScheduleCalendarHeaderGraph from "./schedule-calendar-header-graph.component";
import moment from "moment";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
load: selectScheduleLoad, load: selectScheduleLoad,
@@ -32,8 +32,17 @@ export function ScheduleCalendarHeaderComponent({
date, date,
load, load,
calculating, calculating,
events,
...otherProps ...otherProps
}) { }) {
const ATSToday = useMemo(() => {
if (!events) return [];
return _.groupBy(
events.filter((e) => moment(date).isSame(moment(e.start), "day")),
"job.alt_transport"
);
}, [events, date]);
const { t } = useTranslation(); const { t } = useTranslation();
const loadData = load[date.toISOString().substr(0, 10)]; const loadData = load[date.toISOString().substr(0, 10)];
@@ -102,26 +111,37 @@ export function ScheduleCalendarHeaderComponent({
); );
const LoadComponent = loadData ? ( const LoadComponent = loadData ? (
<div className="imex-flex-row imex-flex-row__flex-space-around"> <div>
<Popover <div className="imex-flex-row imex-flex-row__flex-space-around">
placement={"bottom"} <Popover
content={jobsInPopup} placement={"bottom"}
trigger="hover" content={jobsInPopup}
title={t("appointments.labels.arrivingjobs")} trigger="hover"
> title={t("appointments.labels.arrivingjobs")}
<Icon component={MdFileDownload} style={{ color: "green" }} /> >
{(loadData.hoursIn || 0) && loadData.hoursIn.toFixed(2)} <Icon component={MdFileDownload} style={{ color: "green" }} />
</Popover> {(loadData.hoursIn || 0) && loadData.hoursIn.toFixed(2)}
<Popover </Popover>
placement={"bottom"} <Popover
content={jobsOutPopup} placement={"bottom"}
trigger="hover" content={jobsOutPopup}
title={t("appointments.labels.completingjobs")} trigger="hover"
> title={t("appointments.labels.completingjobs")}
<Icon component={MdFileUpload} style={{ color: "red" }} /> >
{(loadData.hoursOut || 0) && loadData.hoursOut.toFixed(2)} <Icon component={MdFileUpload} style={{ color: "red" }} />
</Popover> {(loadData.hoursOut || 0) && loadData.hoursOut.toFixed(2)}
<ScheduleCalendarHeaderGraph loadData={loadData} /> </Popover>
<ScheduleCalendarHeaderGraph loadData={loadData} />
</div>
<div>
<ul style={{ listStyleType: "none", columns: "2 auto", padding: 0 }}>
{Object.keys(ATSToday).map((key, idx) => (
<li key={idx}>{`${key === "null" ? "N/A" : key}: ${
ATSToday[key].length
}`}</li>
))}
</ul>
</div>
</div> </div>
) : null; ) : null;

View File

@@ -4,6 +4,9 @@
.rbc-time-view .rbc-allday-cell { .rbc-time-view .rbc-allday-cell {
height: unset; height: unset;
} }
.rbc-row-content {
display: none;
}
.rbc-event-label { .rbc-event-label {
display: none; display: none;

View File

@@ -27,16 +27,6 @@ export function ScheduleCalendarWrapperComponent({
const history = useHistory(); const history = useHistory();
const handleEventPropStyles = (event, start, end, isSelected) => { const handleEventPropStyles = (event, start, end, isSelected) => {
// if (!!!bodyshop.ssbuckets) {
// return {};
// }
// const defaultEventColor = "#3174ad";
// const jobHrs = result.jobs_by_pk.jobhrs.aggregate.sum.mod_lb_hrs;
// const JobBucket = bodyshop.ssbuckets.filter(
// (bucket) =>
// bucket.gte <= jobHrs && (!!bucket.lt ? bucket.lt > jobHrs : true)
// )[0];
return { return {
...(event.color ...(event.color
? { ? {
@@ -70,8 +60,8 @@ export function ScheduleCalendarWrapperComponent({
search.view = view; search.view = view;
history.push({ search: queryString.stringify(search) }); history.push({ search: queryString.stringify(search) });
}} }}
step={30} step={15}
timeslots={1} // timeslots={1}
showMultiDayTimes showMultiDayTimes
localizer={localizer} localizer={localizer}
min={ min={
@@ -86,8 +76,9 @@ export function ScheduleCalendarWrapperComponent({
} }
eventPropGetter={handleEventPropStyles} eventPropGetter={handleEventPropStyles}
components={{ components={{
event: (e) => Event({ bodyshop: bodyshop, event: e.event, refetch: refetch }), event: (e) =>
header: HeaderComponent, Event({ bodyshop: bodyshop, event: e.event, refetch: refetch }),
header: (p) => <HeaderComponent {...p} events={data} />,
}} }}
{...otherProps} {...otherProps}
/> />

View File

@@ -1502,6 +1502,9 @@
} }
}, },
"printcenter": { "printcenter": {
"appointments": {
"appointment_confirmation": "Appointment Confirmation"
},
"bills": { "bills": {
"inhouse_invoice": "In House Invoice" "inhouse_invoice": "In House Invoice"
}, },

View File

@@ -1502,6 +1502,9 @@
} }
}, },
"printcenter": { "printcenter": {
"appointments": {
"appointment_confirmation": ""
},
"bills": { "bills": {
"inhouse_invoice": "" "inhouse_invoice": ""
}, },

View File

@@ -1502,6 +1502,9 @@
} }
}, },
"printcenter": { "printcenter": {
"appointments": {
"appointment_confirmation": ""
},
"bills": { "bills": {
"inhouse_invoice": "" "inhouse_invoice": ""
}, },