Added parts location to job line list view. BOD-208

This commit is contained in:
Patrick Fic
2020-07-31 10:25:58 -07:00
parent 23f8243002
commit 4d60ffd597
25 changed files with 933 additions and 1 deletions

View File

@@ -886,6 +886,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>addpartslocation</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>
<name>addspeedprint</name>
<definition_loaded>false</definition_loaded>
@@ -1379,6 +1400,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>partslocation</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>
<name>responsibilitycenter</name>
<definition_loaded>false</definition_loaded>
@@ -8601,6 +8643,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>location</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>
<name>mod_lb_hrs</name>
<definition_loaded>false</definition_loaded>

View File

@@ -13,6 +13,7 @@ import { alphaSort } from "../../utils/sorters";
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
import JobLineNotePopup from "../job-line-note-popup/job-line-note-popup.component";
import JobLineLocationPopup from "../job-line-location-popup/job-line-location-popup.component";
const mapDispatchToProps = (dispatch) => ({
setJobLineEditContext: (context) =>
@@ -170,6 +171,12 @@ export function JobLinesComponent({
key: "notes",
render: (text, record) => <JobLineNotePopup jobline={record} />,
},
{
title: t("joblines.fields.location"),
dataIndex: "location",
key: "location",
render: (text, record) => <JobLineLocationPopup jobline={record} />,
},
{
title: t("joblines.fields.status"),
dataIndex: "status",

View File

@@ -0,0 +1,83 @@
import React, { useState, useEffect } from "react";
import { Input, notification, Select } from "antd";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
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 { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function JobLineLocationPopup({ bodyshop, jobline }) {
const [editing, setEditing] = useState(false);
const [loading, setLoading] = useState(false);
const [location, setLocation] = useState(jobline.location);
const [updateJob] = useMutation(UPDATE_JOB_LINE);
const { t } = useTranslation();
useEffect(() => {
if (editing) setLocation(jobline.location);
}, [editing, jobline.location]);
const handleChange = (e) => {
setLocation(e);
};
const handleSave = async (e) => {
setLoading(true);
const result = await updateJob({
variables: { lineId: jobline.id, line: { location: location || "" } },
});
if (!!!result.errors) {
notification["success"]({ message: t("joblines.successes.saved") });
} else {
notification["error"]({
message: t("joblines.errors.saving", {
error: JSON.stringify(result.errors),
}),
});
}
setLoading(false);
setEditing(false);
};
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>
</div>
);
return (
<div
style={{ width: "100%", minHeight: "2rem", cursor: "pointer" }}
onClick={() => setEditing(true)}
>
{jobline.location}
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(JobLineLocationPopup);

View File

@@ -17,6 +17,7 @@ import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component";
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
export default function ShopInfoComponent({ form, saveLoading }) {
const { t } = useTranslation();
@@ -273,6 +274,61 @@ export default function ShopInfoComponent({ form, saveLoading }) {
);
}}
</Form.List>
<Form.List name={["md_parts_locations"]}>
{(fields, { add, remove, move }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item
key={field.key}
style={{ padding: 0, margin: 2 }}
>
<div className="imex-flex-row">
<Form.Item
className="imex-flex-row__margin"
label={t("bodyshop.fields.partslocation")}
key={`${index}`}
name={[field.name]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
<DeleteFilled
className="imex-flex-row__margin"
onClick={() => {
remove(field.name);
}}
/>
<FormListMoveArrows
move={move}
index={index}
total={fields.length}
/>
</div>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("bodyshop.actions.addpartslocation")}
</Button>
</Form.Item>
</div>
);
}}
</Form.List>
</Collapse.Panel>
<Collapse.Panel
key="speedprint"

View File

@@ -1,5 +1,5 @@
import { DeleteFilled } from "@ant-design/icons";
import { Button, Col, Form, Input, InputNumber, Row, Select } from "antd";
import { Button, Form, Input, Select } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { TemplateList } from "../../utils/TemplateConstants";

View File

@@ -48,6 +48,7 @@ export const QUERY_BODYSHOP = gql`
md_messaging_presets
intakechecklist
speedprint
md_parts_locations
employees {
id
first_name
@@ -104,6 +105,7 @@ export const UPDATE_SHOP = gql`
md_messaging_presets
intakechecklist
speedprint
md_parts_locations
employees {
id
first_name

View File

@@ -21,6 +21,7 @@ export const GET_JOB_LINES_BY_PK = gql`
op_code_desc
status
notes
location
parts_order_lines {
id
parts_order {
@@ -103,6 +104,8 @@ export const UPDATE_JOB_LINE = gql`
act_price
line_desc
oem_partno
notes
location
}
}
}

View File

@@ -73,6 +73,7 @@
"bodyshop": {
"actions": {
"addbucket": "Add Bucket",
"addpartslocation": "Add Parts Location",
"addspeedprint": "Add Speed Print",
"addtemplate": "Add Template",
"newstatus": "Add Status"
@@ -100,6 +101,7 @@
"md_referral_sources": "Referral Sources",
"messaginglabel": "Messaging Preset Label",
"messagingtext": "Messaging Preset Text",
"partslocation": "Parts Location",
"responsibilitycenter": "Responsibility Center",
"responsibilitycenter_accountdesc": "Account Description",
"responsibilitycenter_accountitem": "Item",
@@ -569,6 +571,7 @@
"line_desc": "Line Desc.",
"line_ind": "S#",
"line_no": "Line #",
"location": "Location",
"mod_lb_hrs": "Hrs",
"mod_lbr_ty": "Labor Type",
"notes": "Notes",

View File

@@ -73,6 +73,7 @@
"bodyshop": {
"actions": {
"addbucket": "",
"addpartslocation": "",
"addspeedprint": "",
"addtemplate": "",
"newstatus": ""
@@ -100,6 +101,7 @@
"md_referral_sources": "",
"messaginglabel": "",
"messagingtext": "",
"partslocation": "",
"responsibilitycenter": "",
"responsibilitycenter_accountdesc": "",
"responsibilitycenter_accountitem": "",
@@ -569,6 +571,7 @@
"line_desc": "Descripción de línea",
"line_ind": "S#",
"line_no": "",
"location": "",
"mod_lb_hrs": "Horas laborales",
"mod_lbr_ty": "Tipo de trabajo",
"notes": "",

View File

@@ -73,6 +73,7 @@
"bodyshop": {
"actions": {
"addbucket": "",
"addpartslocation": "",
"addspeedprint": "",
"addtemplate": "",
"newstatus": ""
@@ -100,6 +101,7 @@
"md_referral_sources": "",
"messaginglabel": "",
"messagingtext": "",
"partslocation": "",
"responsibilitycenter": "",
"responsibilitycenter_accountdesc": "",
"responsibilitycenter_accountitem": "",
@@ -569,6 +571,7 @@
"line_desc": "Description de la ligne",
"line_ind": "S#",
"line_no": "",
"location": "",
"mod_lb_hrs": "Heures de travail",
"mod_lbr_ty": "Type de travail",
"notes": "",

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "md_parts_locations";
type: run_sql

View File

@@ -0,0 +1,6 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "md_parts_locations" jsonb NULL
DEFAULT jsonb_build_array();
type: run_sql

View File

@@ -0,0 +1,58 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- accountingconfig
- address1
- address2
- appt_length
- city
- country
- created_at
- email
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- invoice_tax_rates
- logo_img_path
- md_messaging_presets
- md_order_statuses
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- messagingservicesid
- production_config
- region_config
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- stripe_acct_id
- template_header
- textid
- updated_at
- zip_post
computed_fields: []
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: bodyshops
schema: public
type: create_select_permission

View File

@@ -0,0 +1,59 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- accountingconfig
- address1
- address2
- appt_length
- city
- country
- created_at
- email
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- invoice_tax_rates
- logo_img_path
- md_messaging_presets
- md_order_statuses
- md_parts_locations
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- messagingservicesid
- production_config
- region_config
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- stripe_acct_id
- template_header
- textid
- updated_at
- zip_post
computed_fields: []
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: bodyshops
schema: public
type: create_select_permission

View File

@@ -0,0 +1,52 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission
- args:
permission:
columns:
- accountingconfig
- address1
- address2
- appt_length
- city
- country
- created_at
- email
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- invoice_tax_rates
- logo_img_path
- md_messaging_presets
- md_order_statuses
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- production_config
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- updated_at
- zip_post
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -0,0 +1,53 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission
- args:
permission:
columns:
- accountingconfig
- address1
- address2
- appt_length
- city
- country
- created_at
- email
- federal_tax_id
- id
- inhousevendorid
- insurance_vendor_id
- intakechecklist
- invoice_tax_rates
- logo_img_path
- md_messaging_presets
- md_order_statuses
- md_parts_locations
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- production_config
- scoreboard_target
- shopname
- shoprates
- speedprint
- ssbuckets
- state
- state_tax_id
- updated_at
- zip_post
filter:
associations:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."joblines" DROP COLUMN "location";
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."joblines" ADD COLUMN "location" text NULL;
type: run_sql

View File

@@ -0,0 +1,76 @@
- args:
role: user
table:
name: joblines
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- act_price
- alt_co_id
- alt_overrd
- alt_part_i
- alt_partm
- alt_partno
- bett_amt
- bett_pctg
- bett_tax
- bett_type
- cert_part
- created_at
- db_hrs
- db_price
- db_ref
- est_seq
- glass_flag
- id
- jobid
- lbr_amt
- lbr_hrs_j
- lbr_inc
- lbr_op
- lbr_op_j
- lbr_tax
- lbr_typ_j
- line_desc
- line_ind
- line_no
- line_ref
- misc_amt
- misc_sublt
- misc_tax
- mod_lb_hrs
- mod_lbr_ty
- notes
- oem_partno
- op_code_desc
- paint_stg
- paint_tone
- part_qty
- part_type
- price_inc
- price_j
- prt_dsmk_m
- prt_dsmk_p
- removed
- status
- tax_part
- unq_seq
- updated_at
set: {}
role: user
table:
name: joblines
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,77 @@
- args:
role: user
table:
name: joblines
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- act_price
- alt_co_id
- alt_overrd
- alt_part_i
- alt_partm
- alt_partno
- bett_amt
- bett_pctg
- bett_tax
- bett_type
- cert_part
- created_at
- db_hrs
- db_price
- db_ref
- est_seq
- glass_flag
- id
- jobid
- lbr_amt
- lbr_hrs_j
- lbr_inc
- lbr_op
- lbr_op_j
- lbr_tax
- lbr_typ_j
- line_desc
- line_ind
- line_no
- line_ref
- location
- misc_amt
- misc_sublt
- misc_tax
- mod_lb_hrs
- mod_lbr_ty
- notes
- oem_partno
- op_code_desc
- paint_stg
- paint_tone
- part_qty
- part_type
- price_inc
- price_j
- prt_dsmk_m
- prt_dsmk_p
- removed
- status
- tax_part
- unq_seq
- updated_at
set: {}
role: user
table:
name: joblines
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,77 @@
- args:
role: user
table:
name: joblines
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- act_price
- alt_co_id
- alt_overrd
- alt_part_i
- alt_partm
- alt_partno
- bett_amt
- bett_pctg
- bett_tax
- bett_type
- cert_part
- created_at
- db_hrs
- db_price
- db_ref
- est_seq
- glass_flag
- id
- jobid
- lbr_amt
- lbr_hrs_j
- lbr_inc
- lbr_op
- lbr_op_j
- lbr_tax
- lbr_typ_j
- line_desc
- line_ind
- line_no
- line_ref
- misc_amt
- misc_sublt
- misc_tax
- mod_lb_hrs
- mod_lbr_ty
- notes
- oem_partno
- op_code_desc
- paint_stg
- paint_tone
- part_qty
- part_type
- price_inc
- price_j
- prt_dsmk_m
- prt_dsmk_p
- removed
- status
- tax_part
- unq_seq
- updated_at
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: joblines
schema: public
type: create_select_permission

View File

@@ -0,0 +1,78 @@
- args:
role: user
table:
name: joblines
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- act_price
- alt_co_id
- alt_overrd
- alt_part_i
- alt_partm
- alt_partno
- bett_amt
- bett_pctg
- bett_tax
- bett_type
- cert_part
- created_at
- db_hrs
- db_price
- db_ref
- est_seq
- glass_flag
- id
- jobid
- lbr_amt
- lbr_hrs_j
- lbr_inc
- lbr_op
- lbr_op_j
- lbr_tax
- lbr_typ_j
- line_desc
- line_ind
- line_no
- line_ref
- location
- misc_amt
- misc_sublt
- misc_tax
- mod_lb_hrs
- mod_lbr_ty
- notes
- oem_partno
- op_code_desc
- paint_stg
- paint_tone
- part_qty
- part_type
- price_inc
- price_j
- prt_dsmk_m
- prt_dsmk_p
- removed
- status
- tax_part
- unq_seq
- updated_at
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: joblines
schema: public
type: create_select_permission

View File

@@ -0,0 +1,76 @@
- args:
role: user
table:
name: joblines
schema: public
type: drop_update_permission
- args:
permission:
columns:
- act_price
- alt_co_id
- alt_overrd
- alt_part_i
- alt_partm
- alt_partno
- bett_amt
- bett_pctg
- bett_tax
- bett_type
- cert_part
- created_at
- db_hrs
- db_price
- db_ref
- est_seq
- glass_flag
- id
- jobid
- lbr_amt
- lbr_hrs_j
- lbr_inc
- lbr_op
- lbr_op_j
- lbr_tax
- lbr_typ_j
- line_desc
- line_ind
- line_no
- line_ref
- misc_amt
- misc_sublt
- misc_tax
- mod_lb_hrs
- mod_lbr_ty
- notes
- oem_partno
- op_code_desc
- paint_stg
- paint_tone
- part_qty
- part_type
- price_inc
- price_j
- prt_dsmk_m
- prt_dsmk_p
- removed
- status
- tax_part
- unq_seq
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: joblines
schema: public
type: create_update_permission

View File

@@ -0,0 +1,77 @@
- args:
role: user
table:
name: joblines
schema: public
type: drop_update_permission
- args:
permission:
columns:
- act_price
- alt_co_id
- alt_overrd
- alt_part_i
- alt_partm
- alt_partno
- bett_amt
- bett_pctg
- bett_tax
- bett_type
- cert_part
- created_at
- db_hrs
- db_price
- db_ref
- est_seq
- glass_flag
- id
- jobid
- lbr_amt
- lbr_hrs_j
- lbr_inc
- lbr_op
- lbr_op_j
- lbr_tax
- lbr_typ_j
- line_desc
- line_ind
- line_no
- line_ref
- location
- misc_amt
- misc_sublt
- misc_tax
- mod_lb_hrs
- mod_lbr_ty
- notes
- oem_partno
- op_code_desc
- paint_stg
- paint_tone
- part_qty
- part_type
- price_inc
- price_j
- prt_dsmk_m
- prt_dsmk_p
- removed
- status
- tax_part
- unq_seq
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: joblines
schema: public
type: create_update_permission

View File

@@ -475,6 +475,7 @@ tables:
- logo_img_path
- md_messaging_presets
- md_order_statuses
- md_parts_locations
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
@@ -521,6 +522,7 @@ tables:
- logo_img_path
- md_messaging_presets
- md_order_statuses
- md_parts_locations
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
@@ -1711,6 +1713,7 @@ tables:
- line_ind
- line_no
- line_ref
- location
- misc_amt
- misc_sublt
- misc_tax
@@ -1766,6 +1769,7 @@ tables:
- line_ind
- line_no
- line_ref
- location
- misc_amt
- misc_sublt
- misc_tax
@@ -1832,6 +1836,7 @@ tables:
- line_ind
- line_no
- line_ref
- location
- misc_amt
- misc_sublt
- misc_tax