diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 63076ed45..2330a00c0 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -8533,6 +8533,27 @@ + + notes + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + oem_partno false @@ -8753,6 +8774,27 @@ + + saved + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + updated false diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 17dbddbb7..1bf80838b 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -12,6 +12,7 @@ import { alphaSort } from "../../utils/sorters"; // import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container"; // 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"; const mapDispatchToProps = (dispatch) => ({ setJobLineEditContext: (context) => @@ -161,6 +162,12 @@ export function JobLinesComponent({ sortOrder: state.sortedInfo.columnKey === "mod_lb_hrs" && state.sortedInfo.order, }, + { + title: t("joblines.fields.notes"), + dataIndex: "notes", + key: "notes", + render: (text, record) => , + }, { title: t("joblines.fields.status"), dataIndex: "status", @@ -223,7 +230,8 @@ export function JobLinesComponent({ actions: { refetch: refetch }, context: record, }); - }}> + }} + > {t("general.actions.edit")} { @@ -249,9 +257,9 @@ export function JobLinesComponent({ const markMenu = ( - PAA - PAN - PAL + PAA + PAN + PAL ); @@ -260,16 +268,19 @@ export function JobLinesComponent({ { return ( -
+
@@ -283,7 +294,8 @@ export function JobLinesComponent({ linesToOrder: selectedLines, }, }); - }}> + }} + > {t("parts.actions.order")} @@ -301,10 +313,11 @@ export function JobLinesComponent({ actions: { refetch: refetch }, context: { jobid: jobId }, }); - }}> + }} + > {t("joblines.actions.new")} -
+
{ @@ -322,7 +335,8 @@ export function JobLinesComponent({ {record.parts_order_lines.map((item) => (
+ to={`/manage/jobs/${jobId}?tab=partssublet&partsorderid=${item.parts_order.id}`} + > {item.parts_order.order_number || ""} - diff --git a/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx b/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx new file mode 100644 index 000000000..9af48be12 --- /dev/null +++ b/client/src/components/job-line-note-popup/job-line-note-popup.component.jsx @@ -0,0 +1,65 @@ +import React, { useState, useEffect } from "react"; +import { Input, notification } 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"; + +export default function JobLineNotePopup({ jobline }) { + const [editing, setEditing] = useState(false); + const [loading, setLoading] = useState(false); + const [note, setNote] = useState(jobline.note); + const [updateJob] = useMutation(UPDATE_JOB_LINE); + const { t } = useTranslation(); + + useEffect(() => { + if (editing) setNote(jobline.notes); + }, [editing, jobline.notes]); + + const handleChange = (e) => { + e.stopPropagation(); + setNote(e.currentTarget.value); + }; + + const handleSave = async (e) => { + e.stopPropagation(); + setLoading(true); + const result = await updateJob({ + variables: { lineId: jobline.id, line: { notes: note || "" } }, + }); + + 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 ( +
+ : null} + value={note} + onChange={handleChange} + onPressEnter={handleSave} + onBlur={handleSave} + /> +
+ ); + return ( +
setEditing(true)} + > + {jobline.notes} +
+ ); +} diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index 892ec6708..5d57c0a33 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -20,6 +20,7 @@ export const GET_JOB_LINES_BY_PK = gql` lbr_amt op_code_desc status + notes parts_order_lines { id parts_order { @@ -95,6 +96,13 @@ export const UPDATE_JOB_LINE = gql` update_joblines(where: { id: { _eq: $lineId } }, _set: $line) { returning { id + notes + mod_lbr_ty + part_qty + db_price + act_price + line_desc + oem_partno } } } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index ae3b5bf7a..eb44e35de 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -564,6 +564,7 @@ "line_no": "Line #", "mod_lb_hrs": "Hrs", "mod_lbr_ty": "Labor Type", + "notes": "Notes", "oem_partno": "OEM Part #", "op_code_desc": "Operation Code Description", "part_qty": "Qty.", @@ -578,6 +579,7 @@ }, "successes": { "created": "Job line created successfully.", + "saved": "Job line saved.", "updated": "Job line updated successfully." } }, diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index fdcbfc6c7..3aa5bd19f 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -564,6 +564,7 @@ "line_no": "", "mod_lb_hrs": "Horas laborales", "mod_lbr_ty": "Tipo de trabajo", + "notes": "", "oem_partno": "OEM parte #", "op_code_desc": "", "part_qty": "", @@ -578,6 +579,7 @@ }, "successes": { "created": "", + "saved": "", "updated": "" } }, diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 5f27d98aa..8ad2afcc4 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -564,6 +564,7 @@ "line_no": "", "mod_lb_hrs": "Heures de travail", "mod_lbr_ty": "Type de travail", + "notes": "", "oem_partno": "Pièce OEM #", "op_code_desc": "", "part_qty": "", @@ -578,6 +579,7 @@ }, "successes": { "created": "", + "saved": "", "updated": "" } }, diff --git a/hasura/migrations/1596048774767_alter_table_public_joblines_add_column_notes/down.yaml b/hasura/migrations/1596048774767_alter_table_public_joblines_add_column_notes/down.yaml new file mode 100644 index 000000000..765a7e089 --- /dev/null +++ b/hasura/migrations/1596048774767_alter_table_public_joblines_add_column_notes/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."joblines" DROP COLUMN "notes"; + type: run_sql diff --git a/hasura/migrations/1596048774767_alter_table_public_joblines_add_column_notes/up.yaml b/hasura/migrations/1596048774767_alter_table_public_joblines_add_column_notes/up.yaml new file mode 100644 index 000000000..58f644049 --- /dev/null +++ b/hasura/migrations/1596048774767_alter_table_public_joblines_add_column_notes/up.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."joblines" ADD COLUMN "notes" text NULL; + type: run_sql diff --git a/hasura/migrations/1596048785701_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1596048785701_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..2db656081 --- /dev/null +++ b/hasura/migrations/1596048785701_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,75 @@ +- 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 + - 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 diff --git a/hasura/migrations/1596048785701_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1596048785701_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..b13a06795 --- /dev/null +++ b/hasura/migrations/1596048785701_update_permission_user_public_table_joblines/up.yaml @@ -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 diff --git a/hasura/migrations/1596048860276_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1596048860276_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..ce9b320bc --- /dev/null +++ b/hasura/migrations/1596048860276_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,76 @@ +- 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 + - 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 diff --git a/hasura/migrations/1596048860276_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1596048860276_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..30be7464c --- /dev/null +++ b/hasura/migrations/1596048860276_update_permission_user_public_table_joblines/up.yaml @@ -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 diff --git a/hasura/migrations/1596048875858_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1596048875858_update_permission_user_public_table_joblines/down.yaml new file mode 100644 index 000000000..c32212f9d --- /dev/null +++ b/hasura/migrations/1596048875858_update_permission_user_public_table_joblines/down.yaml @@ -0,0 +1,75 @@ +- 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 + - 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 diff --git a/hasura/migrations/1596048875858_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1596048875858_update_permission_user_public_table_joblines/up.yaml new file mode 100644 index 000000000..bf210013d --- /dev/null +++ b/hasura/migrations/1596048875858_update_permission_user_public_table_joblines/up.yaml @@ -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 diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index c4a3896f3..0f10fb3e3 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -1714,6 +1714,7 @@ tables: - misc_tax - mod_lb_hrs - mod_lbr_ty + - notes - oem_partno - op_code_desc - paint_stg @@ -1768,6 +1769,7 @@ tables: - misc_tax - mod_lb_hrs - mod_lbr_ty + - notes - oem_partno - op_code_desc - paint_stg @@ -1833,6 +1835,7 @@ tables: - misc_tax - mod_lb_hrs - mod_lbr_ty + - notes - oem_partno - op_code_desc - paint_stg