Added detail for departing jos ons chedule BOD-254
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
import Icon from "@ant-design/icons";
|
||||
import { Statistic } from "antd";
|
||||
import { Popover, Statistic } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MdFileDownload, MdFileUpload } from "react-icons/md";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import {
|
||||
selectScheduleLoad,
|
||||
selectScheduleLoadCalculating,
|
||||
} from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import ScheduleBlockDay from "../schedule-block-day/schedule-block-day.component";
|
||||
|
||||
const ShopTargetHrs = 100;
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
load: selectScheduleLoad,
|
||||
calculating: selectScheduleLoadCalculating,
|
||||
});
|
||||
@@ -24,6 +27,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
|
||||
export function ScheduleCalendarHeaderComponent({
|
||||
bodyshop,
|
||||
label,
|
||||
refetch,
|
||||
date,
|
||||
@@ -31,28 +35,70 @@ export function ScheduleCalendarHeaderComponent({
|
||||
calculating,
|
||||
...otherProps
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const loadData = load[date.toISOString().substr(0, 10)];
|
||||
|
||||
const LoadComponent = loadData ? (
|
||||
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
||||
<Icon component={MdFileDownload} style={{ color: "green" }} />
|
||||
{(loadData.hoursIn || 0) && loadData.hoursIn.toFixed(2)}
|
||||
<Icon component={MdFileUpload} style={{ color: "red" }} />
|
||||
{(loadData.hoursOut || 0) && loadData.hoursOut.toFixed(2)}
|
||||
<Statistic
|
||||
value={((loadData.expectedLoad || 0) / ShopTargetHrs) * 100}
|
||||
suffix={"%"}
|
||||
precision={0}
|
||||
valueStyle={{
|
||||
color:
|
||||
Math.abs(
|
||||
100 - ((loadData.expectedLoad || 0) / ShopTargetHrs) * 100
|
||||
) <= 10
|
||||
? "green"
|
||||
: "red",
|
||||
}}
|
||||
/>
|
||||
const popContent = () => (
|
||||
<div onClick={(e) => e.stopPropagation()}>
|
||||
<table>
|
||||
<tbody>
|
||||
{loadData && loadData.jobsOut ? (
|
||||
loadData.jobsOut.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_completion}
|
||||
</DateTimeFormatter>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td>{t("appointments.labels.nocompletingjobs")}</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">
|
||||
<Icon component={MdFileDownload} style={{ color: "green" }} />
|
||||
{(loadData.hoursIn || 0) && loadData.hoursIn.toFixed(2)}
|
||||
<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>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
|
||||
@@ -153,6 +153,18 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
||||
>
|
||||
<InputNumber min={0} max={12} precision={0} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.prodtargethrs")}
|
||||
name={["prodtargethrs"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber min={1} precision={1} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_referral_sources"]}
|
||||
label={t("bodyshop.fields.md_referral_sources")}
|
||||
|
||||
@@ -143,6 +143,8 @@ export const QUERY_SCHEDULE_LOAD_DATA = gql`
|
||||
where: { scheduled_completion: { _gte: $start, _lte: $end } }
|
||||
) {
|
||||
id
|
||||
est_number
|
||||
ro_number
|
||||
scheduled_completion
|
||||
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
|
||||
aggregate {
|
||||
|
||||
@@ -53,6 +53,7 @@ export const QUERY_BODYSHOP = gql`
|
||||
md_parts_locations
|
||||
md_notes_presets
|
||||
md_rbac
|
||||
prodtargethrs
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
@@ -112,6 +113,7 @@ export const UPDATE_SHOP = gql`
|
||||
md_parts_locations
|
||||
md_notes_presets
|
||||
md_rbac
|
||||
prodtargethrs
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
"arrivedon": "Arrived on: ",
|
||||
"blocked": "Blocked",
|
||||
"cancelledappointment": "Canceled appointment for: ",
|
||||
"completingjobs": "Completing Jobs",
|
||||
"history": "History",
|
||||
"nocompletingjobs": "No jobs scheduled for completion.",
|
||||
"nodateselected": "No date has been selected.",
|
||||
"priorappointments": "Previous Appointments",
|
||||
"scheduledfor": "Scheduled appointment for: "
|
||||
@@ -104,6 +106,7 @@
|
||||
"noteslabel": "Note Label",
|
||||
"notestext": "Note Text",
|
||||
"partslocation": "Parts Location",
|
||||
"prodtargethrs": "Production Target Hours",
|
||||
"responsibilitycenter": "Responsibility Center",
|
||||
"responsibilitycenter_accountdesc": "Account Description",
|
||||
"responsibilitycenter_accountitem": "Item",
|
||||
@@ -443,6 +446,7 @@
|
||||
"email": "Email",
|
||||
"errors": "Errors",
|
||||
"exceptiontitle": "An error has occurred.",
|
||||
"hours": "hrs",
|
||||
"in": "In",
|
||||
"instanceconflictext": "Your $t(titles.app) account can only be used on one device at any given time. Refresh your session to take control.",
|
||||
"instanceconflictitle": "Your account is being used elsewhere.",
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
"arrivedon": "Llegado el:",
|
||||
"blocked": "",
|
||||
"cancelledappointment": "Cita cancelada para:",
|
||||
"completingjobs": "",
|
||||
"history": "",
|
||||
"nocompletingjobs": "",
|
||||
"nodateselected": "No se ha seleccionado ninguna fecha.",
|
||||
"priorappointments": "Nombramientos previos",
|
||||
"scheduledfor": "Cita programada para:"
|
||||
@@ -104,6 +106,7 @@
|
||||
"noteslabel": "",
|
||||
"notestext": "",
|
||||
"partslocation": "",
|
||||
"prodtargethrs": "",
|
||||
"responsibilitycenter": "",
|
||||
"responsibilitycenter_accountdesc": "",
|
||||
"responsibilitycenter_accountitem": "",
|
||||
@@ -443,6 +446,7 @@
|
||||
"email": "",
|
||||
"errors": "",
|
||||
"exceptiontitle": "",
|
||||
"hours": "",
|
||||
"in": "en",
|
||||
"instanceconflictext": "",
|
||||
"instanceconflictitle": "",
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
"arrivedon": "Arrivé le:",
|
||||
"blocked": "",
|
||||
"cancelledappointment": "Rendez-vous annulé pour:",
|
||||
"completingjobs": "",
|
||||
"history": "",
|
||||
"nocompletingjobs": "",
|
||||
"nodateselected": "Aucune date n'a été sélectionnée.",
|
||||
"priorappointments": "Rendez-vous précédents",
|
||||
"scheduledfor": "Rendez-vous prévu pour:"
|
||||
@@ -104,6 +106,7 @@
|
||||
"noteslabel": "",
|
||||
"notestext": "",
|
||||
"partslocation": "",
|
||||
"prodtargethrs": "",
|
||||
"responsibilitycenter": "",
|
||||
"responsibilitycenter_accountdesc": "",
|
||||
"responsibilitycenter_accountitem": "",
|
||||
@@ -443,6 +446,7 @@
|
||||
"email": "",
|
||||
"errors": "",
|
||||
"exceptiontitle": "",
|
||||
"hours": "",
|
||||
"in": "dans",
|
||||
"instanceconflictext": "",
|
||||
"instanceconflictitle": "",
|
||||
|
||||
Reference in New Issue
Block a user