Technician clock issues IO-731

This commit is contained in:
Patrick Fic
2021-03-04 10:48:52 -08:00
parent 92ee548713
commit 7566f61d83
11 changed files with 66 additions and 17 deletions

View File

@@ -22603,6 +22603,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>shiftclockin</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children> </children>
</folder_node> </folder_node>
</children> </children>

View File

@@ -47,13 +47,14 @@ export function JobLinesComponent({
form, form,
}) { }) {
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK); const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
const { const {
loading: billLinesLoading, loading: billLinesLoading,
error: billLinesError, error: billLinesError,
data: billLinesData, data: billLinesData,
} = useQuery(QUERY_BILLS_BY_JOB_REF, { } = useQuery(QUERY_BILLS_BY_JOB_REF, {
variables: { jobId: job.id }, variables: { jobId: job && job.id },
skip: loading, skip: loading || !job,
}); });
const billLinesDataObj = useMemo(() => { const billLinesDataObj = useMemo(() => {

View File

@@ -1,19 +1,21 @@
import { Form } from "antd"; import { Form, Select } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors";
import JobSearchSelect from "../job-search-select/job-search-select.component"; import JobSearchSelect from "../job-search-select/job-search-select.component";
import JobsDetailLaborContainer from "../jobs-detail-labor/jobs-detail-labor.container"; import JobsDetailLaborContainer from "../jobs-detail-labor/jobs-detail-labor.container";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
technician: selectTechnician,
}); });
export function TechClockInComponent({ form, bodyshop }) { export function TechClockInComponent({ form, bodyshop, technician }) {
const { t } = useTranslation(); const { t } = useTranslation();
const emps = bodyshop.employees.filter((e) => e.id === technician.id)[0];
return ( return (
<div> <div>
<Form.Item <Form.Item
@@ -29,6 +31,26 @@ export function TechClockInComponent({ form, bodyshop }) {
<JobSearchSelect /> <JobSearchSelect />
</Form.Item> </Form.Item>
<Form.Item
name="cost_center"
label={t("timetickets.fields.cost_center")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Select>
{emps &&
emps.rates.map((item) => (
<Select.Option key={item.cost_center}>
{item.cost_center}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item <Form.Item
shouldUpdate={(prevValues, curValues) => shouldUpdate={(prevValues, curValues) =>
prevValues.jobid !== curValues.jobid prevValues.jobid !== curValues.jobid

View File

@@ -35,7 +35,7 @@ export function TechClockInContainer({ technician, bodyshop }) {
date: theTime, date: theTime,
clockon: theTime, clockon: theTime,
jobid: values.jobid, jobid: values.jobid,
cost_center: technician.cost_center, cost_center: values.cost_center,
ciecacode: Object.keys( ciecacode: Object.keys(
bodyshop.md_responsibility_centers.defaults.costs bodyshop.md_responsibility_centers.defaults.costs
).find((key) => { ).find((key) => {

View File

@@ -30,6 +30,7 @@ export function TechClockOffButton({
const [form] = Form.useForm(); const [form] = Form.useForm();
const { t } = useTranslation(); const { t } = useTranslation();
const emps = bodyshop.employees.filter((e) => e.id === technician.id)[0];
const handleFinish = async (values) => { const handleFinish = async (values) => {
logImEXEvent("tech_clock_out_job"); logImEXEvent("tech_clock_out_job");
@@ -120,9 +121,10 @@ export function TechClockOffButton({
{t("timetickets.labels.shift")} {t("timetickets.labels.shift")}
</Select.Option> </Select.Option>
) : ( ) : (
bodyshop.md_responsibility_centers.costs.map((i, idx) => ( emps &&
<Select.Option key={idx} value={i.name}> emps.rates.map((item) => (
{i.name} <Select.Option key={item.cost_center}>
{item.cost_center}
</Select.Option> </Select.Option>
)) ))
)} )}

View File

@@ -81,6 +81,9 @@ export function TechClockedInList({ technician }) {
<DataLabel label={t("timetickets.fields.clockon")}> <DataLabel label={t("timetickets.fields.clockon")}>
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter> <DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
</DataLabel> </DataLabel>
<DataLabel label={t("timetickets.fields.cost_center")}>
{ticket.cost_center}{" "}
</DataLabel>
</Card> </Card>
</List.Item> </List.Item>
)} )}

View File

@@ -116,16 +116,12 @@ export function JobDetailCards({ setPrintCenterContext }) {
</Button> </Button>
} }
> >
<Row gutter={[16, 16]}>
<Col {...colBreakPoints}> What would be good to have here?</Col>
<Col {...colBreakPoints}> What would be good to have here?</Col>
<Col {...colBreakPoints}> What would be good to have here?</Col>
</Row>
<Tabs size="large"> <Tabs size="large">
<Tabs.TabPane key="lines" tab={t("jobs.labels.lines")}> <Tabs.TabPane key="lines" tab={t("jobs.labels.lines")}>
<JobLinesContainer <JobLinesContainer
jobId={selected} jobId={selected}
joblines={data.jobs_by_pk.joblines} joblines={data.jobs_by_pk.joblines}
job={data.jobs_by_pk}
refetch={refetch} refetch={refetch}
/> />
</Tabs.TabPane> </Tabs.TabPane>

View File

@@ -115,6 +115,7 @@ export const QUERY_ACTIVE_TIME_TICKETS = gql`
id id
clockon clockon
memo memo
cost_center
job { job {
id id

View File

@@ -1344,7 +1344,8 @@
"login": "Login", "login": "Login",
"logout": "Logout", "logout": "Logout",
"productionboard": "Production Board - Visual", "productionboard": "Production Board - Visual",
"productionlist": "Production List" "productionlist": "Production List",
"shiftclockin": "Shift Clock"
} }
}, },
"messaging": { "messaging": {

View File

@@ -1344,7 +1344,8 @@
"login": "", "login": "",
"logout": "", "logout": "",
"productionboard": "", "productionboard": "",
"productionlist": "" "productionlist": "",
"shiftclockin": ""
} }
}, },
"messaging": { "messaging": {

View File

@@ -1344,7 +1344,8 @@
"login": "", "login": "",
"logout": "", "logout": "",
"productionboard": "", "productionboard": "",
"productionlist": "" "productionlist": "",
"shiftclockin": ""
} }
}, },
"messaging": { "messaging": {