Added prepper assignment to job. BOD-214

This commit is contained in:
Patrick Fic
2020-07-31 13:18:09 -07:00
parent a87e9ca9f8
commit 6473feb817
25 changed files with 1723 additions and 26 deletions

View File

@@ -17,6 +17,7 @@ export function JobEmployeeAssignments({
bodyshop,
body,
refinish,
prep,
handleAdd,
handleRemove,
}) {
@@ -34,14 +35,15 @@ export function JobEmployeeAssignments({
const popContent = (
<div>
<Select
id='employeeSelector'
id="employeeSelector"
showSearch
style={{ width: 200 }}
optionFilterProp='children'
optionFilterProp="children"
onChange={onChange}
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}>
}
>
{bodyshop.employees.map((emp) => (
<Select.Option value={emp.id} key={emp.id}>
{`${emp.first_name} ${emp.last_name}`}
@@ -49,12 +51,13 @@ export function JobEmployeeAssignments({
))}
</Select>
<Button
type='primary'
type="primary"
disabled={!assignment.employeeid}
onClick={() => {
handleAdd(assignment);
setVisibility(false);
}}>
}}
>
Assign
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
@@ -69,7 +72,7 @@ export function JobEmployeeAssignments({
<div>
<span>{`${body.first_name || ""} ${body.last_name || ""}`}</span>
<MinusOutlined
operation='body'
operation="body"
onClick={() => handleRemove("body")}
/>
</div>
@@ -82,6 +85,24 @@ export function JobEmployeeAssignments({
/>
)}
</DataLabel>
<DataLabel label={t("jobs.fields.employee_prep")}>
{prep ? (
<div>
<span>{`${prep.first_name || ""} ${prep.last_name || ""}`}</span>
<MinusOutlined
operation="prep"
onClick={() => handleRemove("prep")}
/>
</div>
) : (
<PlusCircleFilled
onClick={() => {
setAssignment({ operation: "prep" });
setVisibility(true);
}}
/>
)}
</DataLabel>
<DataLabel label={t("jobs.fields.employee_refinish")}>
{refinish ? (
<div>
@@ -89,7 +110,7 @@ export function JobEmployeeAssignments({
refinish.last_name || ""
}`}</span>
<MinusOutlined
operation='refinish'
operation="refinish"
onClick={() => handleRemove("refinish")}
/>
</div>

View File

@@ -54,6 +54,7 @@ export default function JobEmployeeAssignmentsContainer({ job }) {
<JobEmployeeAssignmentsComponent
body={job.employee_body_rel}
refinish={job.employee_refinish_rel}
prep={job.employee_prep_rel}
handleAdd={handleAdd}
handleRemove={handleRemove}
/>
@@ -65,7 +66,8 @@ const determineFieldName = (operation) => {
switch (operation) {
case "body":
return "employee_body";
case "prep":
return "employee_prep";
case "refinish":
return "employee_refinish";

View File

@@ -1,13 +1,13 @@
import React, { useState, useEffect } from "react";
import { Input, notification, Select } from "antd";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import { notification, Select } from "antd";
import React, { useEffect, useState } from "react";
import { useMutation } from "react-apollo";
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
import { selectBodyshop } from "../../redux/user/user.selectors";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -53,19 +53,21 @@ export function JobLineLocationPopup({ bodyshop, jobline }) {
if (editing)
return (
<div>
<Select
autoFocus
dropdownMatchSelectWidth={100}
value={location}
onSelect={handleChange}
onBlur={handleSave}
>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
<LoadingSpinner loading={loading}>
<Select
autoFocus
dropdownMatchSelectWidth={100}
value={location}
onSelect={handleChange}
onBlur={handleSave}
>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}
</Select.Option>
))}
</Select>
</LoadingSpinner>
</div>
);
return (

View File

@@ -85,6 +85,11 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
first_name
last_name
}
employee_prep_rel{
id
first_name
last_name
}
}
}
`;
@@ -126,6 +131,11 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
first_name
last_name
}
employee_prep_rel {
id
first_name
last_name
}
}
}
`;
@@ -234,6 +244,11 @@ export const GET_JOB_BY_PK = gql`
first_name
last_name
}
employee_prep_rel {
id
first_name
last_name
}
csr
loss_desc
kmin
@@ -529,6 +544,7 @@ export const QUERY_TECH_JOB_DETAILS = gql`
date_estimated
employee_body
employee_refinish
employee_prep
joblines {
id
unq_seq
@@ -894,6 +910,7 @@ export const QUERY_ALL_JOB_FIELDS = gql`
}
employee_body
employee_refinish
employee_prep
}
}
`;

View File

@@ -674,6 +674,7 @@
"ded_status": "Deductible Status",
"depreciation_taxes": "Depreciation/Taxes",
"employee_body": "Body",
"employee_prep": "Prep",
"employee_refinish": "Refinish",
"est_addr1": "Appraiser Address",
"est_co_nm": "Appraiser",

View File

@@ -674,6 +674,7 @@
"ded_status": "Estado deducible",
"depreciation_taxes": "Depreciación / Impuestos",
"employee_body": "",
"employee_prep": "",
"employee_refinish": "",
"est_addr1": "Dirección del tasador",
"est_co_nm": "Tasador",

View File

@@ -674,6 +674,7 @@
"ded_status": "Statut de franchise",
"depreciation_taxes": "Amortissement / taxes",
"employee_body": "",
"employee_prep": "",
"employee_refinish": "",
"est_addr1": "Adresse de l'évaluateur",
"est_co_nm": "Expert",