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>
</translations>
</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>
</folder_node>
</children>

View File

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

View File

@@ -1,19 +1,21 @@
import { Form } from "antd";
import { Form, Select } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import JobSearchSelect from "../job-search-select/job-search-select.component";
import JobsDetailLaborContainer from "../jobs-detail-labor/jobs-detail-labor.container";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
});
export function TechClockInComponent({ form, bodyshop }) {
export function TechClockInComponent({ form, bodyshop, technician }) {
const { t } = useTranslation();
const emps = bodyshop.employees.filter((e) => e.id === technician.id)[0];
return (
<div>
<Form.Item
@@ -29,6 +31,26 @@ export function TechClockInComponent({ form, bodyshop }) {
<JobSearchSelect />
</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
shouldUpdate={(prevValues, curValues) =>
prevValues.jobid !== curValues.jobid

View File

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

View File

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

View File

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

View File

@@ -116,16 +116,12 @@ export function JobDetailCards({ setPrintCenterContext }) {
</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.TabPane key="lines" tab={t("jobs.labels.lines")}>
<JobLinesContainer
jobId={selected}
joblines={data.jobs_by_pk.joblines}
job={data.jobs_by_pk}
refetch={refetch}
/>
</Tabs.TabPane>

View File

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

View File

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

View File

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

View File

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