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

@@ -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) => {