@@ -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
|
||||||
@@ -364,6 +364,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>unblock</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>
|
<concept_node>
|
||||||
<name>viewjob</name>
|
<name>viewjob</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -17755,6 +17776,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>reports</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>
|
<concept_node>
|
||||||
<name>required</name>
|
<name>required</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -19472,6 +19514,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>paymentnum</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>
|
<concept_node>
|
||||||
<name>paymenttype</name>
|
<name>paymenttype</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -24075,6 +24138,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>dms_model_override</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>
|
<concept_node>
|
||||||
<name>dms_unsold</name>
|
<name>dms_unsold</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -43260,6 +43344,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>hours_sold_detail_closed_estimator</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>
|
<concept_node>
|
||||||
<name>hours_sold_detail_closed_ins_co</name>
|
<name>hours_sold_detail_closed_ins_co</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -43344,6 +43449,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>hours_sold_detail_open_estimator</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>
|
<concept_node>
|
||||||
<name>hours_sold_detail_open_ins_co</name>
|
<name>hours_sold_detail_open_ins_co</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -43428,6 +43554,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>hours_sold_summary_closed_estimator</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>
|
<concept_node>
|
||||||
<name>hours_sold_summary_closed_ins_co</name>
|
<name>hours_sold_summary_closed_ins_co</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -43512,6 +43659,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>hours_sold_summary_open_estimator</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>
|
<concept_node>
|
||||||
<name>hours_sold_summary_open_ins_co</name>
|
<name>hours_sold_summary_open_ins_co</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -43848,6 +44016,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>open_orders_referral</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>
|
<concept_node>
|
||||||
<name>open_orders_specific_csr</name>
|
<name>open_orders_specific_csr</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -46227,6 +46416,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>created_by</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>
|
<concept_node>
|
||||||
<name>date</name>
|
<name>date</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
24522
client/package-lock.json
generated
Normal file
24522
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
|||||||
"@apollo/client": "^3.7.9",
|
"@apollo/client": "^3.7.9",
|
||||||
"@asseinfo/react-kanban": "^2.2.0",
|
"@asseinfo/react-kanban": "^2.2.0",
|
||||||
"@craco/craco": "^7.0.0",
|
"@craco/craco": "^7.0.0",
|
||||||
"@fingerprintjs/fingerprintjs": "^3.3.3",
|
"@fingerprintjs/fingerprintjs": "^3.4.2",
|
||||||
"@jsreport/browser-client": "^3.1.0",
|
"@jsreport/browser-client": "^3.1.0",
|
||||||
"@sentry/react": "^7.40.0",
|
"@sentry/react": "^7.40.0",
|
||||||
"@sentry/tracing": "^7.40.0",
|
"@sentry/tracing": "^7.40.0",
|
||||||
|
|||||||
@@ -191,6 +191,13 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
|||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="dms_model_override"
|
||||||
|
label={t("jobs.fields.dms.dms_model_override")}
|
||||||
|
initialValue={false}
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
Divider,
|
Divider,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Form,
|
Form,
|
||||||
|
Input,
|
||||||
Menu,
|
Menu,
|
||||||
notification,
|
notification,
|
||||||
Popover,
|
Popover,
|
||||||
@@ -34,6 +35,8 @@ import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.
|
|||||||
import ScheduleAtChange from "./job-at-change.component";
|
import ScheduleAtChange from "./job-at-change.component";
|
||||||
import ScheduleEventColor from "./schedule-event.color.component";
|
import ScheduleEventColor from "./schedule-event.color.component";
|
||||||
import ScheduleEventNote from "./schedule-event.note.component";
|
import ScheduleEventNote from "./schedule-event.note.component";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { UPDATE_APPOINTMENT } from "../../graphql/appointments.queries";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -58,16 +61,44 @@ export function ScheduleEventComponent({
|
|||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const searchParams = queryString.parse(useLocation().search);
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
|
const [updateAppointment] = useMutation(UPDATE_APPOINTMENT);
|
||||||
|
const [title, setTitle] = useState(event.title);
|
||||||
const blockContent = (
|
const blockContent = (
|
||||||
<div>
|
<Space direction="vertical" wrap>
|
||||||
|
<Input
|
||||||
|
value={title}
|
||||||
|
onChange={(e) => setTitle(e.currentTarget.value)}
|
||||||
|
onBlur={async () => {
|
||||||
|
await updateAppointment({
|
||||||
|
variables: {
|
||||||
|
appid: event.id,
|
||||||
|
app: {
|
||||||
|
title: title,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
optimisticResponse: {
|
||||||
|
update_appointments: {
|
||||||
|
__typename: "appointments_mutation_response",
|
||||||
|
returning: [
|
||||||
|
{
|
||||||
|
...event,
|
||||||
|
title: title,
|
||||||
|
__typename: "appointments",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handleCancel({ id: event.id })}
|
onClick={() => handleCancel({ id: event.id })}
|
||||||
disabled={event.arrived}
|
disabled={event.arrived}
|
||||||
>
|
>
|
||||||
{t("appointments.actions.cancel")}
|
{t("appointments.actions.unblock")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</Space>
|
||||||
);
|
);
|
||||||
|
|
||||||
const popoverContent = (
|
const popoverContent = (
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function JobsConvertButton({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Select>
|
<Select showSearch>
|
||||||
{bodyshop.md_ins_cos.map((s, i) => (
|
{bodyshop.md_ins_cos.map((s, i) => (
|
||||||
<Select.Option key={i} value={s.name}>
|
<Select.Option key={i} value={s.name}>
|
||||||
{s.name}
|
{s.name}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export default async function DuplicateJob(
|
|||||||
delete existingJob.id;
|
delete existingJob.id;
|
||||||
delete existingJob.createdat;
|
delete existingJob.createdat;
|
||||||
delete existingJob.updatedat;
|
delete existingJob.updatedat;
|
||||||
|
delete existingJob.cieca_stl;
|
||||||
|
delete existingJob.cieca_ttl;
|
||||||
|
|
||||||
const newJob = {
|
const newJob = {
|
||||||
...existingJob,
|
...existingJob,
|
||||||
@@ -81,6 +83,8 @@ export async function CreateIouForJob(
|
|||||||
delete existingJob.id;
|
delete existingJob.id;
|
||||||
delete existingJob.createdat;
|
delete existingJob.createdat;
|
||||||
delete existingJob.updatedat;
|
delete existingJob.updatedat;
|
||||||
|
delete existingJob.cieca_stl;
|
||||||
|
delete existingJob.cieca_ttl;
|
||||||
|
|
||||||
const newJob = {
|
const newJob = {
|
||||||
...existingJob,
|
...existingJob,
|
||||||
|
|||||||
@@ -8,18 +8,45 @@ export const CalculateWorkingDaysThisMonth = () => {
|
|||||||
return moment().endOf("month").businessDaysIntoMonth();
|
return moment().endOf("month").businessDaysIntoMonth();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CalculateWorkingDaysInPeriod = (start, end) => {
|
||||||
|
return moment(start).businessDiff(moment(end));
|
||||||
|
};
|
||||||
|
|
||||||
export const CalculateWorkingDaysAsOfToday = () => {
|
export const CalculateWorkingDaysAsOfToday = () => {
|
||||||
return moment().businessDaysIntoMonth();
|
return moment().businessDaysIntoMonth();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CalculateWorkingDaysLastMonth = () => {
|
||||||
|
return moment().subtract(1, "month").endOf("month").businessDaysIntoMonth();
|
||||||
|
};
|
||||||
|
|
||||||
export const WeeklyTargetHrs = (dailyTargetHrs, bodyshop) => {
|
export const WeeklyTargetHrs = (dailyTargetHrs, bodyshop) => {
|
||||||
return dailyTargetHrs * 5;
|
return (
|
||||||
|
dailyTargetHrs *
|
||||||
|
CalculateWorkingDaysInPeriod(
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const WeeklyTargetHrsInPeriod = (
|
||||||
|
dailyTargetHrs,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
bodyshop
|
||||||
|
) => {
|
||||||
|
return dailyTargetHrs * CalculateWorkingDaysInPeriod(start, end);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MonthlyTargetHrs = (dailyTargetHrs, bodyshop) => {
|
export const MonthlyTargetHrs = (dailyTargetHrs, bodyshop) => {
|
||||||
return dailyTargetHrs * CalculateWorkingDaysThisMonth();
|
return dailyTargetHrs * CalculateWorkingDaysThisMonth();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const LastMonthTargetHrs = (dailyTargetHrs, bodyshop) => {
|
||||||
|
return dailyTargetHrs * CalculateWorkingDaysLastMonth();
|
||||||
|
};
|
||||||
|
|
||||||
export const AsOfTodayTargetHrs = (dailyTargetHrs, bodyshop) => {
|
export const AsOfTodayTargetHrs = (dailyTargetHrs, bodyshop) => {
|
||||||
return dailyTargetHrs * CalculateWorkingDaysAsOfToday();
|
return dailyTargetHrs * CalculateWorkingDaysAsOfToday();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
const CustomTooltip = ({ active, payload, label }) => {
|
||||||
|
if (active && payload && payload.length) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
backgroundColor: "white",
|
||||||
|
border: "1px solid gray",
|
||||||
|
padding: "0.5rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<p style={{ margin: "0" }}>{label}</p>
|
||||||
|
{payload.map((data, index) => {
|
||||||
|
return (
|
||||||
|
<p style={{ margin: "10px 0", color: data.color }} key={index}>{`${
|
||||||
|
data.name
|
||||||
|
} : ${data.value.toFixed(1)}`}</p>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CustomTooltip;
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { Card } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import {
|
||||||
|
Area,
|
||||||
|
CartesianGrid,
|
||||||
|
ComposedChart,
|
||||||
|
Legend,
|
||||||
|
Line,
|
||||||
|
ResponsiveContainer,
|
||||||
|
Tooltip,
|
||||||
|
XAxis,
|
||||||
|
YAxis,
|
||||||
|
} from "recharts";
|
||||||
|
import CustomTooltip from "./chart-custom-tooltip";
|
||||||
|
|
||||||
|
const graphProps = {
|
||||||
|
strokeWidth: 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function ScoreboardTimeTicketsChart({ data, chartTitle }) {
|
||||||
|
return (
|
||||||
|
<Card title={chartTitle}>
|
||||||
|
<ResponsiveContainer width="100%" height={275}>
|
||||||
|
<ComposedChart
|
||||||
|
data={data}
|
||||||
|
margin={{ top: 20, right: 20, bottom: 20, left: 20 }}
|
||||||
|
>
|
||||||
|
<CartesianGrid stroke="#f5f5f5" />
|
||||||
|
<XAxis dataKey="date" strokeWidth={graphProps.strokeWidth} />
|
||||||
|
<YAxis yAxisId="left" strokeWidth={graphProps.strokeWidth} />
|
||||||
|
<Tooltip content={<CustomTooltip />} />
|
||||||
|
<Legend />
|
||||||
|
<Line
|
||||||
|
name="Target Hours"
|
||||||
|
type="monotone"
|
||||||
|
dataKey="accTargetHrs"
|
||||||
|
stroke="#ff7300"
|
||||||
|
yAxisId="left"
|
||||||
|
strokeWidth={graphProps.strokeWidth}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Area
|
||||||
|
type="monotone"
|
||||||
|
name="MTD Hours"
|
||||||
|
dataKey="accHrs"
|
||||||
|
fill="lightblue"
|
||||||
|
stroke="blue"
|
||||||
|
yAxisId="left"
|
||||||
|
/>
|
||||||
|
</ComposedChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,399 @@
|
|||||||
|
import { useQuery } from "@apollo/client";
|
||||||
|
import { Col, Row } from "antd";
|
||||||
|
import _ from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
|
import queryString from "query-string";
|
||||||
|
import React, { useMemo } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { QUERY_TIME_TICKETS_IN_RANGE_SB } from "../../graphql/timetickets.queries";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
|
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
||||||
|
import ScoreboardTimeTicketsChart from "./scoreboard-timetickets.chart.component";
|
||||||
|
import ScoreboardTicketsStats from "./scoreboard-timetickets.stats.component";
|
||||||
|
import ScoreboardTimeticketsTargetsTable from "./scoreboard-timetickets.targets-table.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ScoreboardTimeTicketsStats);
|
||||||
|
|
||||||
|
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
|
const { start, end } = searchParams;
|
||||||
|
const startDate = start
|
||||||
|
? moment(start)
|
||||||
|
: moment().startOf("week").subtract(7, "days");
|
||||||
|
const endDate = end ? moment(end) : moment().endOf("week");
|
||||||
|
|
||||||
|
const fixedPeriods = useMemo(() => {
|
||||||
|
const endOfThisMonth = moment().endOf("month");
|
||||||
|
const startofthisMonth = moment().startOf("month");
|
||||||
|
|
||||||
|
const endOfLastmonth = moment().subtract(1, "month").endOf("month");
|
||||||
|
const startOfLastmonth = moment().subtract(1, "month").startOf("month");
|
||||||
|
|
||||||
|
const endOfThisWeek = moment().endOf("week");
|
||||||
|
const startOfThisWeek = moment().startOf("week");
|
||||||
|
|
||||||
|
const endOfLastWeek = moment().subtract(1, "week").endOf("week");
|
||||||
|
const startOfLastWeek = moment().subtract(1, "week").startOf("week");
|
||||||
|
|
||||||
|
const endOfPriorWeek = moment().subtract(2, "week").endOf("week");
|
||||||
|
const startOfPriorWeek = moment().subtract(2, "week").startOf("week");
|
||||||
|
|
||||||
|
const allDates = [
|
||||||
|
endOfThisMonth,
|
||||||
|
startofthisMonth,
|
||||||
|
endOfLastmonth,
|
||||||
|
startOfLastmonth,
|
||||||
|
endOfThisWeek,
|
||||||
|
startOfThisWeek,
|
||||||
|
endOfLastWeek,
|
||||||
|
startOfLastWeek,
|
||||||
|
endOfPriorWeek,
|
||||||
|
startOfPriorWeek,
|
||||||
|
];
|
||||||
|
const start = moment.min(allDates);
|
||||||
|
const end = moment.max(allDates);
|
||||||
|
return {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
endOfThisMonth,
|
||||||
|
startofthisMonth,
|
||||||
|
endOfLastmonth,
|
||||||
|
startOfLastmonth,
|
||||||
|
endOfThisWeek,
|
||||||
|
startOfThisWeek,
|
||||||
|
endOfLastWeek,
|
||||||
|
startOfLastWeek,
|
||||||
|
endOfPriorWeek,
|
||||||
|
startOfPriorWeek,
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const { loading, error, data } = useQuery(QUERY_TIME_TICKETS_IN_RANGE_SB, {
|
||||||
|
variables: {
|
||||||
|
start: startDate.format("YYYY-MM-DD"),
|
||||||
|
end: endDate.format("YYYY-MM-DD"),
|
||||||
|
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
||||||
|
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
||||||
|
},
|
||||||
|
fetchPolicy: "network-only",
|
||||||
|
nextFetchPolicy: "network-only",
|
||||||
|
pollInterval: 60000,
|
||||||
|
skip: !fixedPeriods,
|
||||||
|
});
|
||||||
|
|
||||||
|
const calculatedData = useMemo(() => {
|
||||||
|
if (!data) return [];
|
||||||
|
const ret = {
|
||||||
|
totalThisWeek: 0,
|
||||||
|
totalThisWeekLAB: 0,
|
||||||
|
totalThisWeekLAR: 0,
|
||||||
|
totalLastWeek: 0,
|
||||||
|
totalLastWeekLAB: 0,
|
||||||
|
totalLastWeekLAR: 0,
|
||||||
|
totalPriorWeek: 0,
|
||||||
|
totalPriorWeekLAB: 0,
|
||||||
|
totalPriorWeekLAR: 0,
|
||||||
|
totalThisMonth: 0,
|
||||||
|
totalThisMonthLAB: 0,
|
||||||
|
totalThisMonthLAR: 0,
|
||||||
|
totalLastMonth: 0,
|
||||||
|
totalLastMonthLAB: 0,
|
||||||
|
totalLastMonthLAR: 0,
|
||||||
|
actualTotalOverPeriod: 0,
|
||||||
|
actualTotalOverPeriodLAB: 0,
|
||||||
|
actualTotalOverPeriodLAR: 0,
|
||||||
|
totalEffieciencyOverPeriod: 0,
|
||||||
|
totalEffieciencyOverPeriodLAB: 0,
|
||||||
|
totalEffieciencyOverPeriodLAR: 0,
|
||||||
|
seperatedThisWeek: {
|
||||||
|
sunday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
monday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
tuesday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
wednesday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
thursday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
friday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
saturday: {
|
||||||
|
total: 0,
|
||||||
|
lab: 0,
|
||||||
|
lar: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
data.fixedperiod.forEach((ticket) => {
|
||||||
|
const ticketDate = moment(ticket.date);
|
||||||
|
if (
|
||||||
|
ticketDate.isBetween(
|
||||||
|
fixedPeriods.startOfThisWeek,
|
||||||
|
fixedPeriods.endOfThisWeek,
|
||||||
|
undefined,
|
||||||
|
"[]"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ret.totalThisWeek = ret.totalThisWeek + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode !== "LAR")
|
||||||
|
ret.totalThisWeekLAB = ret.totalThisWeekLAB + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode === "LAR")
|
||||||
|
ret.totalThisWeekLAR = ret.totalThisWeekLAR + ticket.productivehrs;
|
||||||
|
|
||||||
|
//Seperate out to Day of Week
|
||||||
|
ret.seperatedThisWeek[
|
||||||
|
moment(ticket.date).format("dddd").toLowerCase()
|
||||||
|
].total =
|
||||||
|
ret.seperatedThisWeek[
|
||||||
|
moment(ticket.date).format("dddd").toLowerCase()
|
||||||
|
].total + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode !== "LAR")
|
||||||
|
ret.seperatedThisWeek[
|
||||||
|
moment(ticket.date).format("dddd").toLowerCase()
|
||||||
|
].lab =
|
||||||
|
ret.seperatedThisWeek[
|
||||||
|
moment(ticket.date).format("dddd").toLowerCase()
|
||||||
|
].lab + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode === "LAR")
|
||||||
|
ret.seperatedThisWeek[
|
||||||
|
moment(ticket.date).format("dddd").toLowerCase()
|
||||||
|
].lar =
|
||||||
|
ret.seperatedThisWeek[
|
||||||
|
moment(ticket.date).format("dddd").toLowerCase()
|
||||||
|
].lar + ticket.productivehrs;
|
||||||
|
} else if (
|
||||||
|
ticketDate.isBetween(
|
||||||
|
fixedPeriods.startOfLastWeek,
|
||||||
|
fixedPeriods.endOfLastWeek,
|
||||||
|
undefined,
|
||||||
|
"[]"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ret.totalLastWeek = ret.totalLastWeek + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode !== "LAR")
|
||||||
|
ret.totalLastWeekLAB = ret.totalLastWeekLAB + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode === "LAR")
|
||||||
|
ret.totalLastWeekLAR = ret.totalLastWeekLAR + ticket.productivehrs;
|
||||||
|
} else if (
|
||||||
|
ticketDate.isBetween(
|
||||||
|
fixedPeriods.startOfPriorWeek,
|
||||||
|
fixedPeriods.endOfPriorWeek,
|
||||||
|
undefined,
|
||||||
|
"[]"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ret.totalPriorWeek = ret.totalPriorWeek + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode !== "LAR")
|
||||||
|
ret.totalPriorWeekLAB = ret.totalPriorWeekLAB + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode === "LAR")
|
||||||
|
ret.totalPriorWeekLAR = ret.totalPriorWeekLAR + ticket.productivehrs;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
ticketDate.isBetween(
|
||||||
|
fixedPeriods.startofthisMonth,
|
||||||
|
fixedPeriods.endOfThisMonth,
|
||||||
|
undefined,
|
||||||
|
"[]"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ret.totalThisMonth = ret.totalThisMonth + ticket.productivehrs;
|
||||||
|
ret.actualTotalOverPeriod =
|
||||||
|
ret.actualTotalOverPeriod + (ticket.actualhrs || 0);
|
||||||
|
if (ticket.ciecacode !== "LAR") {
|
||||||
|
ret.totalThisMonthLAB = ret.totalThisMonthLAB + ticket.productivehrs;
|
||||||
|
ret.actualTotalOverPeriodLAB =
|
||||||
|
ret.actualTotalOverPeriodLAB + (ticket.actualhrs || 0);
|
||||||
|
}
|
||||||
|
if (ticket.ciecacode === "LAR") {
|
||||||
|
ret.totalThisMonthLAR = ret.totalThisMonthLAR + ticket.productivehrs;
|
||||||
|
ret.actualTotalOverPeriodLAR =
|
||||||
|
ret.actualTotalOverPeriodLAR + (ticket.actualhrs || 0);
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
|
ticketDate.isBetween(
|
||||||
|
fixedPeriods.startOfLastmonth,
|
||||||
|
fixedPeriods.endOfLastmonth,
|
||||||
|
undefined,
|
||||||
|
"[]"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
ret.totalLastMonth = ret.totalLastMonth + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode !== "LAR")
|
||||||
|
ret.totalLastMonthLAB = ret.totalLastMonthLAB + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode === "LAR")
|
||||||
|
ret.totalLastMonthLAR = ret.totalLastMonthLAR + ticket.productivehrs;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ret.totalEffieciencyOverPeriod = ret.actualTotalOverPeriod
|
||||||
|
? (ret.totalThisMonth / ret.actualTotalOverPeriod) * 100
|
||||||
|
: 0;
|
||||||
|
ret.totalEffieciencyOverPeriodLAB = ret.actualTotalOverPeriodLAB
|
||||||
|
? (ret.totalThisMonthLAB / ret.actualTotalOverPeriodLAB) * 100
|
||||||
|
: 0;
|
||||||
|
ret.totalEffieciencyOverPeriodLAR = ret.actualTotalOverPeriodLAR
|
||||||
|
? (ret.totalThisMonthLAR / ret.actualTotalOverPeriodLAR) * 100
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
roundObject(ret);
|
||||||
|
|
||||||
|
const ticketsGroupedByDate = _.groupBy(data.timetickets, "date");
|
||||||
|
|
||||||
|
const listOfDays = Utils.ListOfDaysInCurrentMonth();
|
||||||
|
|
||||||
|
const combinedData = [],
|
||||||
|
labData = [],
|
||||||
|
larData = [];
|
||||||
|
var acc_comb = 0;
|
||||||
|
var acc_lab = 0;
|
||||||
|
var acc_lar = 0;
|
||||||
|
|
||||||
|
listOfDays.forEach((day) => {
|
||||||
|
const r = {
|
||||||
|
date: moment(day).format("MM/DD"),
|
||||||
|
actualhrs: 0,
|
||||||
|
productivehrs: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
const combined = {
|
||||||
|
accTargetHrs: _.round(
|
||||||
|
Utils.AsOfDateTargetHours(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget +
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
day
|
||||||
|
) +
|
||||||
|
(bodyshop.scoreboard_target.dailyBodyTarget +
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget),
|
||||||
|
1
|
||||||
|
),
|
||||||
|
accHrs: 0,
|
||||||
|
};
|
||||||
|
const lab = {
|
||||||
|
accTargetHrs: _.round(
|
||||||
|
Utils.AsOfDateTargetHours(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
day
|
||||||
|
) + bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
1
|
||||||
|
),
|
||||||
|
accHrs: 0,
|
||||||
|
};
|
||||||
|
const lar = {
|
||||||
|
accTargetHrs: _.round(
|
||||||
|
Utils.AsOfDateTargetHours(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
day
|
||||||
|
) + bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
1
|
||||||
|
),
|
||||||
|
accHrs: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ticketsGroupedByDate[day]) {
|
||||||
|
ticketsGroupedByDate[day].forEach((ticket) => {
|
||||||
|
r.actualhrs = r.actualhrs + ticket.actualhrs;
|
||||||
|
r.productivehrs = r.productivehrs + ticket.productivehrs;
|
||||||
|
acc_comb = acc_comb + ticket.productivehrs;
|
||||||
|
|
||||||
|
if (ticket.ciecacode !== "LAR")
|
||||||
|
acc_lab = acc_lab + ticket.productivehrs;
|
||||||
|
if (ticket.ciecacode === "LAR")
|
||||||
|
acc_lar = acc_lar + ticket.productivehrs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
combined.accHrs = acc_comb;
|
||||||
|
lab.accHrs = acc_lab;
|
||||||
|
lar.accHrs = acc_lar;
|
||||||
|
|
||||||
|
combinedData.push({ ...r, ...combined });
|
||||||
|
labData.push({ ...r, ...lab });
|
||||||
|
larData.push({ ...r, ...lar });
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
fixed: ret,
|
||||||
|
combinedData: combinedData,
|
||||||
|
labData: labData,
|
||||||
|
larData: larData,
|
||||||
|
};
|
||||||
|
}, [fixedPeriods, data, bodyshop]);
|
||||||
|
|
||||||
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
if (loading) return <LoadingSpinner />;
|
||||||
|
return (
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<ScoreboardTimeticketsTargetsTable />
|
||||||
|
</Col>
|
||||||
|
<Col span={24}>
|
||||||
|
<ScoreboardTicketsStats data={calculatedData.fixed} />
|
||||||
|
</Col>
|
||||||
|
<Col span={24}>
|
||||||
|
<ScoreboardTimeTicketsChart
|
||||||
|
data={calculatedData.combinedData}
|
||||||
|
chartTitle={t("scoreboard.labels.combinedcharttitle")}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<ScoreboardTimeTicketsChart
|
||||||
|
data={calculatedData.labData}
|
||||||
|
chartTitle={t("scoreboard.labels.bodycharttitle")}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<ScoreboardTimeTicketsChart
|
||||||
|
data={calculatedData.larData}
|
||||||
|
chartTitle={t("scoreboard.labels.refinishcharttitle")}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function roundObject(inputObj) {
|
||||||
|
for (var key of Object.keys(inputObj)) {
|
||||||
|
if (typeof inputObj[key] === "number") {
|
||||||
|
inputObj[key] = inputObj[key].toFixed(1);
|
||||||
|
} else if (Array.isArray(inputObj[key])) {
|
||||||
|
inputObj[key].forEach((item) => roundObject(item));
|
||||||
|
} else if (typeof inputObj[key] === "object") {
|
||||||
|
roundObject(inputObj[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,617 @@
|
|||||||
|
import {
|
||||||
|
Card,
|
||||||
|
Col,
|
||||||
|
Form,
|
||||||
|
Row,
|
||||||
|
Space,
|
||||||
|
Statistic,
|
||||||
|
Switch,
|
||||||
|
Typography,
|
||||||
|
} from "antd";
|
||||||
|
import moment from "moment";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import * as Util from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ScoreboardTicketsStats);
|
||||||
|
|
||||||
|
function useLocalStorage(key, initialValue) {
|
||||||
|
const [storedValue, setStoredValue] = useState(() => {
|
||||||
|
const item = localStorage.getItem(key);
|
||||||
|
return item ? JSON.parse(item) : initialValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
localStorage.setItem(key, JSON.stringify(storedValue));
|
||||||
|
}, [key, storedValue]);
|
||||||
|
|
||||||
|
return [storedValue, setStoredValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [isLarge, setIsLarge] = useLocalStorage("isLargeStatistic", false);
|
||||||
|
|
||||||
|
const statisticSize = isLarge ? 36 : 24;
|
||||||
|
const statisticWeight = isLarge ? 550 : "normal";
|
||||||
|
const daySpan =
|
||||||
|
Util.CalculateWorkingDaysInPeriod(
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week")
|
||||||
|
) > 5
|
||||||
|
? 3
|
||||||
|
: 4;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={t("scoreboard.labels.productivestatistics")}
|
||||||
|
extra={
|
||||||
|
<Form.Item
|
||||||
|
label={t("general.labels.tvmode")}
|
||||||
|
valuePropName="checked"
|
||||||
|
name={["tvmode"]}
|
||||||
|
>
|
||||||
|
<Switch
|
||||||
|
onClick={() => setIsLarge(!isLarge)}
|
||||||
|
defaultChecked={isLarge}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col md={24}>
|
||||||
|
{/* Daily Stats */}
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Row gutter={[16, 16]} align="center">
|
||||||
|
{[
|
||||||
|
"sunday",
|
||||||
|
"monday",
|
||||||
|
"tuesday",
|
||||||
|
"wednesday",
|
||||||
|
"thursday",
|
||||||
|
"friday",
|
||||||
|
"saturday",
|
||||||
|
].map((day) => {
|
||||||
|
if (bodyshop.workingdays[day] === true) {
|
||||||
|
return (
|
||||||
|
<Col key={day} span={daySpan} align="center">
|
||||||
|
<Card size="small" title={t("general.labels." + day)}>
|
||||||
|
<Row gutter={[8, 8]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={data.seperatedThisWeek[day].total}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(
|
||||||
|
data.seperatedThisWeek[day].total
|
||||||
|
) >=
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget +
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.seperatedThisWeek[day].lab}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.seperatedThisWeek[day].lab) >=
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.seperatedThisWeek[day].lar}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.seperatedThisWeek[day].lar) >=
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</Row>
|
||||||
|
{/* Weekly Stats */}
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
{/* This Week */}
|
||||||
|
<Col span={8} align="center">
|
||||||
|
<Card size="small" title={t("scoreboard.labels.thisweek")}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={data.totalThisWeek}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalThisWeek) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalThisWeekLAB}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalThisWeekLAB) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalThisWeekLAR}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalThisWeekLAR) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
{/* Last Week */}
|
||||||
|
<Col span={8} align="center">
|
||||||
|
<Card size="small" title={t("scoreboard.labels.lastweek")}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={data.totalLastWeek}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalLastWeek) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalLastWeekLAB}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalLastWeekLAB) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalLastWeekLAR}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalLastWeekLAR) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
{/* Prior Week */}
|
||||||
|
<Col span={8} align="center">
|
||||||
|
<Card size="small" title={t("scoreboard.labels.priorweek")}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={data.totalPriorWeek}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalPriorWeek) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalPriorWeekLAB}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalPriorWeekLAB) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalPriorWeekLAR}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalPriorWeekLAR) >=
|
||||||
|
Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
{/* Monthly Stats */}
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
{/* This Month */}
|
||||||
|
<Col span={8} align="center">
|
||||||
|
<Card size="small" title={t("scoreboard.labels.thismonth")}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={data.totalThisMonth}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalThisMonth) >=
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalThisMonthLAB}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalThisMonthLAB) >=
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalThisMonthLAR}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalThisMonthLAR) >=
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
{/* Last Month */}
|
||||||
|
<Col span={8} align="center">
|
||||||
|
<Card size="small" title={t("scoreboard.labels.lastmonth")}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={data.totalLastMonth}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalLastMonth) >=
|
||||||
|
Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalLastMonthLAB}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalLastMonthLAB) >=
|
||||||
|
Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={data.totalLastMonthLAR}
|
||||||
|
valueStyle={{
|
||||||
|
color:
|
||||||
|
parseFloat(data.totalLastMonthLAR) >=
|
||||||
|
Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
? "green"
|
||||||
|
: "red",
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
{/* Efficiency Over Period */}
|
||||||
|
<Col span={8} align="center">
|
||||||
|
<Card
|
||||||
|
size="small"
|
||||||
|
title={t("scoreboard.labels.efficiencyoverperiod")}
|
||||||
|
>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={24}>
|
||||||
|
<Statistic
|
||||||
|
value={`${data.totalEffieciencyOverPeriod || 0}%`}
|
||||||
|
valueStyle={{
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.body")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={`${data.totalEffieciencyOverPeriodLAB || 0}%`}
|
||||||
|
valueStyle={{
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Statistic
|
||||||
|
title={
|
||||||
|
<Typography.Text strong>
|
||||||
|
{t("scoreboard.labels.refinish")}
|
||||||
|
</Typography.Text>
|
||||||
|
}
|
||||||
|
value={`${data.totalEffieciencyOverPeriodLAR || 0}%`}
|
||||||
|
valueStyle={{
|
||||||
|
fontSize: statisticSize,
|
||||||
|
fontWeight: statisticWeight,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Space>
|
||||||
|
{/* Disclaimer */}
|
||||||
|
<Typography.Text type="secondary">
|
||||||
|
*{t("scoreboard.labels.calendarperiod")}
|
||||||
|
</Typography.Text>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
import { CalendarOutlined } from "@ant-design/icons";
|
||||||
|
import { Card, Col, Divider, Row, Statistic } from "antd";
|
||||||
|
import moment from "moment";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import * as Util from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
|
||||||
|
const rowGutter = [16, 16];
|
||||||
|
const statSpans = { xs: 24, sm: 3 };
|
||||||
|
|
||||||
|
export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card title={t("scoreboard.labels.targets")}>
|
||||||
|
<Row gutter={rowGutter}>
|
||||||
|
<Col xs={24} sm={{ offset: 0, span: 3 }} lg={{ span: 3 }}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.workingdays")}
|
||||||
|
value={Util.CalculateWorkingDaysThisMonth()}
|
||||||
|
prefix={<CalendarOutlined />}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col xs={24} sm={{ offset: 0, span: 20 }} lg={{ offset: 0, span: 20 }}>
|
||||||
|
<Row>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic title="Type" value={t("scoreboard.labels.body")} />
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.dailytarget")}
|
||||||
|
value={bodyshop.scoreboard_target.dailyBodyTarget}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.thisweek")}
|
||||||
|
value={Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.lastweek")}
|
||||||
|
value={Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.priorweek")}
|
||||||
|
value={Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.thismonth")}
|
||||||
|
value={Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.lastmonth")}
|
||||||
|
value={Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
title={t("scoreboard.labels.asoftodaytarget")}
|
||||||
|
value={Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={t("scoreboard.labels.refinish")} />
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={bodyshop.scoreboard_target.dailyPaintTarget} />
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={Util.WeeklyTargetHrsInPeriod(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Divider style={{ margin: 5 }} />
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col {...statSpans}></Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget +
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().startOf("week"),
|
||||||
|
moment().endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(1, "week").startOf("week"),
|
||||||
|
moment().subtract(1, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.WeeklyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
moment().subtract(2, "week").startOf("week"),
|
||||||
|
moment().subtract(2, "week").endOf("week"),
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.MonthlyTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.LastMonthTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={(
|
||||||
|
Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||||
|
bodyshop
|
||||||
|
) +
|
||||||
|
Util.AsOfTodayTargetHrs(
|
||||||
|
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||||
|
bodyshop
|
||||||
|
)
|
||||||
|
).toFixed(1)}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ScoreboardTimeticketsTargetsTable);
|
||||||
@@ -154,7 +154,6 @@ export function VendorsFormComponent({
|
|||||||
label={t("vendors.fields.phone")}
|
label={t("vendors.fields.phone")}
|
||||||
name="phone"
|
name="phone"
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: t("general.validation.required") },
|
|
||||||
({ getFieldValue }) =>
|
({ getFieldValue }) =>
|
||||||
PhoneItemFormatterValidation(getFieldValue, "phone"),
|
PhoneItemFormatterValidation(getFieldValue, "phone"),
|
||||||
]}
|
]}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
$fixedEnd: date!
|
$fixedEnd: date!
|
||||||
) {
|
) {
|
||||||
timetickets(
|
timetickets(
|
||||||
where: { date: { _gte: $start, _lte: $end } }
|
where: { date: { _gte: $start, _lte: $end }, cost_center: {_neq: "timetickets.labels.shift"} }
|
||||||
order_by: { date: desc_nulls_first }
|
order_by: { date: desc_nulls_first }
|
||||||
) {
|
) {
|
||||||
actualhrs
|
actualhrs
|
||||||
@@ -176,7 +176,7 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fixedperiod: timetickets(
|
fixedperiod: timetickets(
|
||||||
where: { date: { _gte: $fixedStart, _lte: $fixedEnd } }
|
where: { date: { _gte: $fixedStart, _lte: $fixedEnd }, cost_center: {_neq: "timetickets.labels.shift"} }
|
||||||
order_by: { date: desc_nulls_first }
|
order_by: { date: desc_nulls_first }
|
||||||
) {
|
) {
|
||||||
actualhrs
|
actualhrs
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
import Icon, { FieldTimeOutlined } from "@ant-design/icons";
|
import Icon, { FieldTimeOutlined } from "@ant-design/icons";
|
||||||
import { Tabs } from "antd";
|
import { Tabs } from "antd";
|
||||||
|
import queryString from "query-string";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FaShieldAlt } from "react-icons/fa";
|
import { FaShieldAlt } from "react-icons/fa";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { useHistory, useLocation } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import FeatureWrapper from "../../components/feature-wrapper/feature-wrapper.component";
|
import FeatureWrapper from "../../components/feature-wrapper/feature-wrapper.component";
|
||||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||||
import ScoreboardDisplay from "../../components/scoreboard-display/scoreboard-display.component";
|
import ScoreboardDisplay from "../../components/scoreboard-display/scoreboard-display.component";
|
||||||
|
import ScoreboardTimeTicketsStats from "../../components/scoreboard-timetickets-stats/scoreboard-timetickets.component";
|
||||||
import ScoreboardTimeTickets from "../../components/scoreboard-timetickets/scoreboard-timetickets.component";
|
import ScoreboardTimeTickets from "../../components/scoreboard-timetickets/scoreboard-timetickets.component";
|
||||||
import {
|
import {
|
||||||
setBreadcrumbs,
|
setBreadcrumbs,
|
||||||
setSelectedHeader,
|
setSelectedHeader,
|
||||||
} from "../../redux/application/application.actions";
|
} from "../../redux/application/application.actions";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import queryString from "query-string";
|
|
||||||
import { useHistory, useLocation } from "react-router-dom";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -71,7 +72,7 @@ export function ScoreboardContainer({ setBreadcrumbs, setSelectedHeader }) {
|
|||||||
tab={
|
tab={
|
||||||
<span>
|
<span>
|
||||||
<FieldTimeOutlined />
|
<FieldTimeOutlined />
|
||||||
{t("scoreboard.labels.timetickets")}
|
{t("scoreboard.labels.timeticketsemployee")}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
destroyInactiveTabPane
|
destroyInactiveTabPane
|
||||||
@@ -79,6 +80,18 @@ export function ScoreboardContainer({ setBreadcrumbs, setSelectedHeader }) {
|
|||||||
>
|
>
|
||||||
<ScoreboardTimeTickets />
|
<ScoreboardTimeTickets />
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
|
<Tabs.TabPane
|
||||||
|
tab={
|
||||||
|
<span>
|
||||||
|
<FieldTimeOutlined />
|
||||||
|
{t("scoreboard.labels.allemployeetimetickets")}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
destroyInactiveTabPane
|
||||||
|
key="ticketsstats"
|
||||||
|
>
|
||||||
|
<ScoreboardTimeTicketsStats />
|
||||||
|
</Tabs.TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</RbacWrapper>
|
</RbacWrapper>
|
||||||
</FeatureWrapper>
|
</FeatureWrapper>
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import Fingerprint2 from "@fingerprintjs/fingerprintjs";
|
import FingerprintJS from "@fingerprintjs/fingerprintjs";
|
||||||
import * as Sentry from "@sentry/browser";
|
import * as Sentry from "@sentry/browser";
|
||||||
import { notification } from "antd";
|
import { notification } from "antd";
|
||||||
|
import axios from "axios";
|
||||||
import { setUserId, setUserProperties } from "firebase/analytics";
|
import { setUserId, setUserProperties } from "firebase/analytics";
|
||||||
import {
|
import {
|
||||||
checkActionCode,
|
checkActionCode,
|
||||||
confirmPasswordReset,
|
confirmPasswordReset,
|
||||||
|
sendPasswordResetEmail,
|
||||||
signInWithEmailAndPassword,
|
signInWithEmailAndPassword,
|
||||||
signOut,
|
signOut,
|
||||||
sendPasswordResetEmail,
|
|
||||||
} from "firebase/auth";
|
} from "firebase/auth";
|
||||||
import { doc } from "firebase/firestore";
|
import { doc, getDoc, setDoc } from "firebase/firestore";
|
||||||
|
import { getToken } from "firebase/messaging";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import LogRocket from "logrocket";
|
import LogRocket from "logrocket";
|
||||||
import { all, call, delay, put, select, takeLatest } from "redux-saga/effects";
|
import { all, call, delay, put, select, takeLatest } from "redux-saga/effects";
|
||||||
@@ -20,6 +22,7 @@ import {
|
|||||||
firestore,
|
firestore,
|
||||||
getCurrentUser,
|
getCurrentUser,
|
||||||
logImEXEvent,
|
logImEXEvent,
|
||||||
|
messaging,
|
||||||
updateCurrentUser,
|
updateCurrentUser,
|
||||||
} from "../../firebase/firebase.utils";
|
} from "../../firebase/firebase.utils";
|
||||||
import {
|
import {
|
||||||
@@ -28,6 +31,7 @@ import {
|
|||||||
sendPasswordResetSuccess,
|
sendPasswordResetSuccess,
|
||||||
setAuthlevel,
|
setAuthlevel,
|
||||||
setInstanceConflict,
|
setInstanceConflict,
|
||||||
|
setInstanceId,
|
||||||
setLocalFingerprint,
|
setLocalFingerprint,
|
||||||
signInFailure,
|
signInFailure,
|
||||||
signInSuccess,
|
signInSuccess,
|
||||||
@@ -39,9 +43,8 @@ import {
|
|||||||
validatePasswordResetSuccess,
|
validatePasswordResetSuccess,
|
||||||
} from "./user.actions";
|
} from "./user.actions";
|
||||||
import UserActionTypes from "./user.types";
|
import UserActionTypes from "./user.types";
|
||||||
import axios from "axios";
|
|
||||||
import { messaging } from "../../firebase/firebase.utils";
|
const fpPromise = FingerprintJS.load();
|
||||||
import { getToken } from "firebase/messaging";
|
|
||||||
|
|
||||||
export function* onEmailSignInStart() {
|
export function* onEmailSignInStart() {
|
||||||
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
||||||
@@ -148,17 +151,15 @@ export function* setInstanceIdSaga({ payload: uid }) {
|
|||||||
try {
|
try {
|
||||||
const userInstanceRef = doc(firestore, `userInstance/${uid}`);
|
const userInstanceRef = doc(firestore, `userInstance/${uid}`);
|
||||||
|
|
||||||
const fingerprint = Fingerprint2.x64hash128(
|
// Get the visitor identifier when you need it.
|
||||||
(yield Fingerprint2.getPromise({})).map((c) => c.value).join(""),
|
const fp = yield fpPromise;
|
||||||
31
|
const result = yield fp.get();
|
||||||
);
|
yield setDoc(userInstanceRef, {
|
||||||
|
|
||||||
yield userInstanceRef.set({
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
fingerprint,
|
fingerprint: result.visitorId,
|
||||||
});
|
});
|
||||||
|
|
||||||
yield put(setLocalFingerprint(fingerprint));
|
yield put(setLocalFingerprint(result.visitorId));
|
||||||
yield delay(5 * 60 * 1000);
|
yield delay(5 * 60 * 1000);
|
||||||
if (process.env.NODE_ENV === "production") yield put(checkInstanceId(uid));
|
if (process.env.NODE_ENV === "production") yield put(checkInstanceId(uid));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -171,11 +172,9 @@ export function* onCheckInstanceId() {
|
|||||||
}
|
}
|
||||||
export function* checkInstanceIdSaga({ payload: uid }) {
|
export function* checkInstanceIdSaga({ payload: uid }) {
|
||||||
try {
|
try {
|
||||||
const userInstanceRef = doc(firestore, `userInstance/${uid}`);
|
const snapshot = yield getDoc(doc(firestore, `userInstance/${uid}`));
|
||||||
|
|
||||||
const snapshot = yield userInstanceRef.get();
|
|
||||||
let fingerprint = yield select((state) => state.user.fingerprint);
|
let fingerprint = yield select((state) => state.user.fingerprint);
|
||||||
|
yield put(setInstanceConflict());
|
||||||
if (snapshot.data().fingerprint === fingerprint) {
|
if (snapshot.data().fingerprint === fingerprint) {
|
||||||
yield delay(5 * 60 * 1000);
|
yield delay(5 * 60 * 1000);
|
||||||
yield put(checkInstanceId(uid));
|
yield put(checkInstanceId(uid));
|
||||||
@@ -215,7 +214,6 @@ export function* signInSuccessSaga({ payload }) {
|
|||||||
console.log("Error updating Crisp settings.", error);
|
console.log("Error updating Crisp settings.", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!payload.email.includes("@imex.")) yield put(setInstanceId(payload.uid));
|
|
||||||
setUserId(analytics, payload.email);
|
setUserId(analytics, payload.email);
|
||||||
setUserProperties(analytics, payload);
|
setUserProperties(analytics, payload);
|
||||||
yield logImEXEvent("redux_sign_in_success");
|
yield logImEXEvent("redux_sign_in_success");
|
||||||
@@ -289,6 +287,14 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
|||||||
: { validemail: false }
|
: { validemail: false }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (payload.features.singleDeviceOnly) {
|
||||||
|
const user = yield select((state) => state.user.currentUser);
|
||||||
|
|
||||||
|
if (!(user.email.includes("@imex.") || user.email.includes("@rome.")))
|
||||||
|
yield put(setInstanceId(user.uid));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.$crisp.push(["set", "user:company", [payload.shopname]]);
|
window.$crisp.push(["set", "user:company", [payload.shopname]]);
|
||||||
if (authRecord[0] && authRecord[0].user.validemail) {
|
if (authRecord[0] && authRecord[0].user.validemail) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
"preview": "Preview",
|
"preview": "Preview",
|
||||||
"reschedule": "Reschedule",
|
"reschedule": "Reschedule",
|
||||||
"sendreminder": "Send Reminder",
|
"sendreminder": "Send Reminder",
|
||||||
|
"unblock": "Unblock",
|
||||||
"viewjob": "View Job"
|
"viewjob": "View Job"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -1114,6 +1115,7 @@
|
|||||||
"total": "Total",
|
"total": "Total",
|
||||||
"totals": "Totals",
|
"totals": "Totals",
|
||||||
"tuesday": "Tuesday",
|
"tuesday": "Tuesday",
|
||||||
|
"tvmode": "TV Mode",
|
||||||
"unknown": "Unknown",
|
"unknown": "Unknown",
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
"view": "View",
|
"view": "View",
|
||||||
@@ -1462,6 +1464,7 @@
|
|||||||
"cost_dms_acctnumber": "Cost DMS Acct #",
|
"cost_dms_acctnumber": "Cost DMS Acct #",
|
||||||
"dms_make": "DMS Make",
|
"dms_make": "DMS Make",
|
||||||
"dms_model": "DMS Model",
|
"dms_model": "DMS Model",
|
||||||
|
"dms_model_override": "Override DMS Make/Model",
|
||||||
"dms_unsold": "New, Unsold Vehicle",
|
"dms_unsold": "New, Unsold Vehicle",
|
||||||
"dms_wip_acctnumber": "Cost WIP DMS Acct #",
|
"dms_wip_acctnumber": "Cost WIP DMS Acct #",
|
||||||
"id": "DMS ID",
|
"id": "DMS ID",
|
||||||
@@ -2672,8 +2675,12 @@
|
|||||||
"painthrs": "Paint Hours"
|
"painthrs": "Paint Hours"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"allemployeetimetickets": "All Employee Time Tickets",
|
||||||
"asoftodaytarget": "As of Today",
|
"asoftodaytarget": "As of Today",
|
||||||
|
"body": "Body",
|
||||||
|
"bodycharttitle": "Body Targets vs Actual",
|
||||||
"calendarperiod": "Periods based on calendar weeks/months.",
|
"calendarperiod": "Periods based on calendar weeks/months.",
|
||||||
|
"combinedcharttitle": "Combined Targets vs Actual",
|
||||||
"dailyactual": "Actual (D)",
|
"dailyactual": "Actual (D)",
|
||||||
"dailytarget": "Daily",
|
"dailytarget": "Daily",
|
||||||
"efficiencyoverperiod": "Efficiency over Selected Dates",
|
"efficiencyoverperiod": "Efficiency over Selected Dates",
|
||||||
@@ -2682,12 +2689,16 @@
|
|||||||
"lastmonth": "Last Month",
|
"lastmonth": "Last Month",
|
||||||
"lastweek": "Last Week",
|
"lastweek": "Last Week",
|
||||||
"monthlytarget": "Monthly",
|
"monthlytarget": "Monthly",
|
||||||
|
"priorweek": "Prior Week",
|
||||||
"productivestatistics": "Productive Hours Statistics",
|
"productivestatistics": "Productive Hours Statistics",
|
||||||
"productivetimeticketsoverdate": "Productive Hours over Selected Dates",
|
"productivetimeticketsoverdate": "Productive Hours over Selected Dates",
|
||||||
|
"refinish": "Refinish",
|
||||||
|
"refinishcharttitle": "Refinish Targets vs Actual",
|
||||||
"targets": "Targets",
|
"targets": "Targets",
|
||||||
"thismonth": "This Month",
|
"thismonth": "This Month",
|
||||||
"thisweek": "This Week",
|
"thisweek": "This Week",
|
||||||
"timetickets": "Timetickets",
|
"timetickets": "Time Tickets",
|
||||||
|
"timeticketsemployee": "Time Tickets by Employee",
|
||||||
"todateactual": "Actual (MTD)",
|
"todateactual": "Actual (MTD)",
|
||||||
"totaloverperiod": "Total over Selected Dates",
|
"totaloverperiod": "Total over Selected Dates",
|
||||||
"weeklyactual": "Actual (W)",
|
"weeklyactual": "Actual (W)",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
"preview": "",
|
"preview": "",
|
||||||
"reschedule": "Reprogramar",
|
"reschedule": "Reprogramar",
|
||||||
"sendreminder": "",
|
"sendreminder": "",
|
||||||
|
"unblock": "",
|
||||||
"viewjob": "Ver trabajo"
|
"viewjob": "Ver trabajo"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -1114,6 +1115,7 @@
|
|||||||
"total": "",
|
"total": "",
|
||||||
"totals": "",
|
"totals": "",
|
||||||
"tuesday": "",
|
"tuesday": "",
|
||||||
|
"tvmode": "",
|
||||||
"unknown": "Desconocido",
|
"unknown": "Desconocido",
|
||||||
"username": "",
|
"username": "",
|
||||||
"view": "",
|
"view": "",
|
||||||
@@ -1462,6 +1464,7 @@
|
|||||||
"cost_dms_acctnumber": "",
|
"cost_dms_acctnumber": "",
|
||||||
"dms_make": "",
|
"dms_make": "",
|
||||||
"dms_model": "",
|
"dms_model": "",
|
||||||
|
"dms_model_override": "",
|
||||||
"dms_unsold": "",
|
"dms_unsold": "",
|
||||||
"dms_wip_acctnumber": "",
|
"dms_wip_acctnumber": "",
|
||||||
"id": "",
|
"id": "",
|
||||||
@@ -2672,8 +2675,12 @@
|
|||||||
"painthrs": ""
|
"painthrs": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"allemployeetimetickets": "",
|
||||||
"asoftodaytarget": "",
|
"asoftodaytarget": "",
|
||||||
|
"body": "",
|
||||||
|
"bodycharttitle": "",
|
||||||
"calendarperiod": "",
|
"calendarperiod": "",
|
||||||
|
"combinedcharttitle": "",
|
||||||
"dailyactual": "",
|
"dailyactual": "",
|
||||||
"dailytarget": "",
|
"dailytarget": "",
|
||||||
"efficiencyoverperiod": "",
|
"efficiencyoverperiod": "",
|
||||||
@@ -2682,12 +2689,16 @@
|
|||||||
"lastmonth": "",
|
"lastmonth": "",
|
||||||
"lastweek": "",
|
"lastweek": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
|
"priorweek": "",
|
||||||
"productivestatistics": "",
|
"productivestatistics": "",
|
||||||
"productivetimeticketsoverdate": "",
|
"productivetimeticketsoverdate": "",
|
||||||
|
"refinish": "",
|
||||||
|
"refinishcharttitle": "",
|
||||||
"targets": "",
|
"targets": "",
|
||||||
"thismonth": "",
|
"thismonth": "",
|
||||||
"thisweek": "",
|
"thisweek": "",
|
||||||
"timetickets": "",
|
"timetickets": "",
|
||||||
|
"timeticketsemployee": "",
|
||||||
"todateactual": "",
|
"todateactual": "",
|
||||||
"totaloverperiod": "",
|
"totaloverperiod": "",
|
||||||
"weeklyactual": "",
|
"weeklyactual": "",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
"preview": "",
|
"preview": "",
|
||||||
"reschedule": "Replanifier",
|
"reschedule": "Replanifier",
|
||||||
"sendreminder": "",
|
"sendreminder": "",
|
||||||
|
"unblock": "",
|
||||||
"viewjob": "Voir le travail"
|
"viewjob": "Voir le travail"
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
@@ -1114,6 +1115,7 @@
|
|||||||
"total": "",
|
"total": "",
|
||||||
"totals": "",
|
"totals": "",
|
||||||
"tuesday": "",
|
"tuesday": "",
|
||||||
|
"tvmode": "",
|
||||||
"unknown": "Inconnu",
|
"unknown": "Inconnu",
|
||||||
"username": "",
|
"username": "",
|
||||||
"view": "",
|
"view": "",
|
||||||
@@ -1462,6 +1464,7 @@
|
|||||||
"cost_dms_acctnumber": "",
|
"cost_dms_acctnumber": "",
|
||||||
"dms_make": "",
|
"dms_make": "",
|
||||||
"dms_model": "",
|
"dms_model": "",
|
||||||
|
"dms_model_override": "",
|
||||||
"dms_unsold": "",
|
"dms_unsold": "",
|
||||||
"dms_wip_acctnumber": "",
|
"dms_wip_acctnumber": "",
|
||||||
"id": "",
|
"id": "",
|
||||||
@@ -2672,8 +2675,12 @@
|
|||||||
"painthrs": ""
|
"painthrs": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"allemployeetimetickets": "",
|
||||||
"asoftodaytarget": "",
|
"asoftodaytarget": "",
|
||||||
|
"body": "",
|
||||||
|
"bodycharttitle": "",
|
||||||
"calendarperiod": "",
|
"calendarperiod": "",
|
||||||
|
"combinedcharttitle": "",
|
||||||
"dailyactual": "",
|
"dailyactual": "",
|
||||||
"dailytarget": "",
|
"dailytarget": "",
|
||||||
"efficiencyoverperiod": "",
|
"efficiencyoverperiod": "",
|
||||||
@@ -2682,12 +2689,16 @@
|
|||||||
"lastmonth": "",
|
"lastmonth": "",
|
||||||
"lastweek": "",
|
"lastweek": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
|
"priorweek": "",
|
||||||
"productivestatistics": "",
|
"productivestatistics": "",
|
||||||
"productivetimeticketsoverdate": "",
|
"productivetimeticketsoverdate": "",
|
||||||
|
"refinish": "",
|
||||||
|
"refinishcharttitle": "",
|
||||||
"targets": "",
|
"targets": "",
|
||||||
"thismonth": "",
|
"thismonth": "",
|
||||||
"thisweek": "",
|
"thisweek": "",
|
||||||
"timetickets": "",
|
"timetickets": "",
|
||||||
|
"timeticketsemployee": "",
|
||||||
"todateactual": "",
|
"todateactual": "",
|
||||||
"totaloverperiod": "",
|
"totaloverperiod": "",
|
||||||
"weeklyactual": "",
|
"weeklyactual": "",
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ export default async function FcmHandler({ client, payload }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
client.cache.modify({
|
||||||
|
fields: {
|
||||||
|
messages_aggregate(cached) {
|
||||||
|
return { aggregate: { count: cached.aggregate.count + 1 } };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "messaging-outbound":
|
case "messaging-outbound":
|
||||||
client.cache.modify({
|
client.cache.modify({
|
||||||
@@ -30,6 +37,7 @@ export default async function FcmHandler({ client, payload }) {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "messaging-mark-conversation-read":
|
case "messaging-mark-conversation-read":
|
||||||
|
let previousUnreadCount = 0;
|
||||||
client.cache.modify({
|
client.cache.modify({
|
||||||
id: client.cache.identify({
|
id: client.cache.identify({
|
||||||
__typename: "conversations",
|
__typename: "conversations",
|
||||||
@@ -37,10 +45,22 @@ export default async function FcmHandler({ client, payload }) {
|
|||||||
}),
|
}),
|
||||||
fields: {
|
fields: {
|
||||||
messages_aggregate(cached) {
|
messages_aggregate(cached) {
|
||||||
|
previousUnreadCount = cached.aggregate.count;
|
||||||
return { aggregate: { count: 0 } };
|
return { aggregate: { count: 0 } };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
client.cache.modify({
|
||||||
|
fields: {
|
||||||
|
messages_aggregate(cached) {
|
||||||
|
return {
|
||||||
|
aggregate: {
|
||||||
|
count: cached.aggregate.count - previousUnreadCount,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("No payload type set.");
|
console.log("No payload type set.");
|
||||||
|
|||||||
4642
client/yarn.lock
4642
client/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -879,6 +879,12 @@ async function UpdateDmsVehicle(socket) {
|
|||||||
},
|
},
|
||||||
vehicle: {
|
vehicle: {
|
||||||
...socket.DMSVeh.vehicle,
|
...socket.DMSVeh.vehicle,
|
||||||
|
...(socket.txEnvelope.dms_model_override
|
||||||
|
? {
|
||||||
|
make: socket.txEnvelope.dms_make,
|
||||||
|
modelAbrev: socket.txEnvelope.dms_model,
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
deliveryDate:
|
deliveryDate:
|
||||||
socket.txEnvelope.dms_unsold === true
|
socket.txEnvelope.dms_unsold === true
|
||||||
? ""
|
? ""
|
||||||
|
|||||||
Reference in New Issue
Block a user