Added in jobs to schedule header for greater transparency. BOD-403

This commit is contained in:
Patrick Fic
2020-09-23 08:31:06 -07:00
parent f84520c260
commit 6c2e0dad45
12 changed files with 150 additions and 33 deletions

View File

@@ -484,6 +484,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>arrivingjobs</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>blocked</name>
<definition_loaded>false</definition_loaded>
@@ -589,6 +610,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>noarrivingjobs</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>nocompletingjobs</name>
<definition_loaded>false</definition_loaded>

View File

@@ -136,8 +136,11 @@ export const client = new ApolloClient({
cache,
connectToDevTools: process.env.NODE_ENV !== "production",
defaultOptions: {
query: {
fetchPolicy: "network-only",
},
watchQuery: {
fetchPolicy: "cache-and-network",
fetchPolicy: "network-only",
},
},
});

View File

@@ -13,9 +13,7 @@ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
const mapDispatchToProps = (dispatch) => ({});
export function ScheduleBlockDay({ date, children, refetch, bodyshop }) {
const { t } = useTranslation();

View File

@@ -38,7 +38,7 @@ export function ScheduleCalendarHeaderComponent({
const { t } = useTranslation();
const loadData = load[date.toISOString().substr(0, 10)];
const popContent = () => (
const jobsOutPopup = () => (
<div onClick={(e) => e.stopPropagation()}>
<table>
<tbody>
@@ -71,34 +71,72 @@ export function ScheduleCalendarHeaderComponent({
</div>
);
const jobsInPopup = () => (
<div onClick={(e) => e.stopPropagation()}>
<table>
<tbody>
{loadData && loadData.jobsIn ? (
loadData.jobsIn.map((j) => (
<tr key={j.id}>
<td>
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link>
</td>
<td>
{`(${(
j.labhrs.aggregate.sum.mod_lb_hrs +
j.larhrs.aggregate.sum.mod_lb_hrs
).toFixed(1)} ${t("general.labels.hours")})`}
</td>
<td>
<DateTimeFormatter>{j.scheduled_in}</DateTimeFormatter>
</td>
</tr>
))
) : (
<tr>
<td>{t("appointments.labels.noarrivingjobs")}</td>
</tr>
)}
</tbody>
</table>
</div>
);
const LoadComponent = loadData ? (
<Popover
placement={"bottom"}
content={popContent}
trigger="hover"
title={t("appointments.labels.completingjobs")}
>
<div className="imex-flex-row imex-flex-row__flex-space-around">
<div className="imex-flex-row imex-flex-row__flex-space-around">
<Popover
placement={"bottom"}
content={jobsInPopup}
trigger="hover"
title={t("appointments.labels.arrivingjobs")}
>
<Icon component={MdFileDownload} style={{ color: "green" }} />
{(loadData.hoursIn || 0) && loadData.hoursIn.toFixed(2)}
</Popover>
<Popover
placement={"bottom"}
content={jobsOutPopup}
trigger="hover"
title={t("appointments.labels.completingjobs")}
>
<Icon component={MdFileUpload} style={{ color: "red" }} />
{(loadData.hoursOut || 0) && loadData.hoursOut.toFixed(2)}
<Statistic
value={((loadData.expectedLoad || 0) / bodyshop.prodtargethrs) * 100}
suffix={"%"}
precision={0}
valueStyle={{
color:
Math.abs(
100 -
((loadData.expectedLoad || 0) / bodyshop.prodtargethrs) * 100
) <= 10
? "green"
: "red",
}}
/>
</div>
</Popover>
</Popover>
<Statistic
value={((loadData.expectedLoad || 0) / bodyshop.prodtargethrs) * 100}
suffix={"%"}
precision={0}
valueStyle={{
color:
Math.abs(
100 -
((loadData.expectedLoad || 0) / bodyshop.prodtargethrs) * 100
) <= 10
? "green"
: "red",
}}
/>
</div>
) : null;
return (

View File

@@ -62,7 +62,7 @@ export function ScheduleCalendarWrapperComponent({
search.view = view;
history.push({ search: queryString.stringify(search) });
}}
step={30}
step={15}
timeslots={1}
showMultiDayTimes
localizer={localizer}

View File

@@ -107,10 +107,14 @@ export function ScheduleEventComponent({
const RegularEvent = event.isintake ? (
<div style={{ display: "flex", flexWrap: "wrap" }}>
<strong style={{ margin: ".1rem" }}>{`${
event.job.ro_number || event.job.est_number
}`}</strong>
<div style={{ margin: ".1rem" }}>{`${
(event.job && event.job.ownr_fn) || ""
} ${(event.job && event.job.ownr_ln) || ""} ${
(event.job && event.job.ownr_co_nm) || ""
}`}</strong>
}`}</div>
<div style={{ margin: ".1rem" }}>
{`${(event.job && event.job.v_model_yr) || ""} ${
(event.job && event.job.v_make_desc) || ""
@@ -118,8 +122,10 @@ export function ScheduleEventComponent({
</div>
<div style={{ margin: ".1rem" }}>
{`(${
(event.job && event.job.labhrs.aggregate.sum.mod_lb_hrs) || ""
} / ${(event.job && event.job.larhrs.aggregate.sum.mod_lb_hrs) || ""})`}
(event.job && event.job.labhrs.aggregate.sum.mod_lb_hrs) || "0"
} / ${
(event.job && event.job.larhrs.aggregate.sum.mod_lb_hrs) || "0"
})`}
</div>
</div>
) : (
@@ -129,7 +135,11 @@ export function ScheduleEventComponent({
);
return (
<Popover trigger="click" content={popoverContent}>
<Popover
trigger="click"
content={popoverContent}
style={{ height: "100%", width: "100%" }}
>
{RegularEvent}
</Popover>
);

View File

@@ -42,6 +42,9 @@ export default function ScheduleProductionList() {
<td>{`${j.v_model_yr || ""} ${j.v_make_desc || ""} ${
j.v_model_desc || ""
}`}</td>
<td>{`${j.labhrs.aggregate.sum.mod_lb_hrs || "0"} / ${
j.larhrs.aggregate.sum.mod_lb_hrs || "0"
}`}</td>
<td>
<DateTimeFormatter>
{j.scheduled_completion}

View File

@@ -192,6 +192,8 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
arrJobs: jobs(where: { scheduled_in: { _gte: $start, _lte: $end } }) {
id
scheduled_in
est_number
ro_number
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
aggregate {
sum {

View File

@@ -1016,6 +1016,21 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
v_make_desc
v_model_desc
scheduled_completion
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
}
`;

View File

@@ -38,11 +38,13 @@
},
"labels": {
"arrivedon": "Arrived on: ",
"arrivingjobs": "Arriving Jobs",
"blocked": "Blocked",
"cancelledappointment": "Canceled appointment for: ",
"completingjobs": "Completing Jobs",
"history": "History",
"inproduction": "Jobs In Production",
"noarrivingjobs": "No jobs are arriving.",
"nocompletingjobs": "No jobs scheduled for completion.",
"nodateselected": "No date has been selected.",
"priorappointments": "Previous Appointments",

View File

@@ -38,11 +38,13 @@
},
"labels": {
"arrivedon": "Llegado el:",
"arrivingjobs": "",
"blocked": "",
"cancelledappointment": "Cita cancelada para:",
"completingjobs": "",
"history": "",
"inproduction": "",
"noarrivingjobs": "",
"nocompletingjobs": "",
"nodateselected": "No se ha seleccionado ninguna fecha.",
"priorappointments": "Nombramientos previos",

View File

@@ -38,11 +38,13 @@
},
"labels": {
"arrivedon": "Arrivé le:",
"arrivingjobs": "",
"blocked": "",
"cancelledappointment": "Rendez-vous annulé pour:",
"completingjobs": "",
"history": "",
"inproduction": "",
"noarrivingjobs": "",
"nocompletingjobs": "",
"nodateselected": "Aucune date n'a été sélectionnée.",
"priorappointments": "Rendez-vous précédents",