Added est line status + expandable row for previous orders on jobs lines detail

This commit is contained in:
Patrick Fic
2020-02-20 11:52:41 -08:00
parent c90cccb6be
commit b845e62070
15 changed files with 577 additions and 6 deletions

View File

@@ -1707,6 +1707,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>status</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>unq_seq</name>
<definition_loaded>false</definition_loaded>
@@ -6047,6 +6068,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>orderhistory</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>print</name>
<definition_loaded>false</definition_loaded>

View File

@@ -3,6 +3,7 @@ import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { alphaSort } from "../../utils/sorters";
import { Link } from "react-router-dom";
//import EditableCell from "./job-lines-cell.component";
import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
@@ -111,6 +112,14 @@ export default function JobLinesComponent({
sortOrder:
state.sortedInfo.columnKey === "mod_lb_hrs" && state.sortedInfo.order
},
{
title: t("joblines.fields.status"),
dataIndex: "status",
key: "status",
sorter: (a, b) => alphaSort(a.status, b.status),
sortOrder:
state.sortedInfo.columnKey === "status" && state.sortedInfo.order
},
{
title: t("allocations.fields.employee"),
dataIndex: "employee",
@@ -170,6 +179,7 @@ export default function JobLinesComponent({
<PartsOrderModalContainer
partsOrderModalVisible={partsOrderModalVisible}
linesToOrder={selectedLines}
refetch={refetch}
jobId={jobId}
/>
) : null}
@@ -200,6 +210,20 @@ export default function JobLinesComponent({
{...formItemLayout}
loading={loading}
size='small'
expandedRowRender={record => (
<div style={{ margin: 0 }}>
<strong>{t("parts_orders.labels.orderhistory")}</strong>
{record.parts_order_lines.map(item => (
<div key={item.id}>
{`${item.parts_order.order_number || ""} from `}
<Link to={`/manage/shop/vendors/${item.parts_order.vendor.id}`}>
{item.parts_order.vendor.name || ""}
</Link>
{` on ${item.parts_order.order_date || ""}`}
</div>
))}
</div>
)}
pagination={{ position: "top", defaultPageSize: 25 }}
rowSelection={{
// selectedRowKeys: selectedLines,

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { INSERT_NEW_PARTS_ORDERS } from "../../graphql/parts-orders.queries";
import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries";
import { QUERY_ALL_VENDORS_FOR_ORDER } from "../../graphql/vendors.queries";
import {
selectBodyshop,
@@ -26,7 +27,8 @@ export default connect(
linesToOrder,
jobId,
currentUser,
bodyshop
bodyshop,
refetch
}) {
const { t } = useTranslation();
const [modalVisible, setModalVisible] = partsOrderModalVisible;
@@ -40,7 +42,7 @@ export default connect(
db_price: value.db_price,
act_price: value.act_price,
line_remarks: "Alalala",
joblineid: value.joblineid,
job_line_id: value.id,
status: bodyshop.md_order_statuses.default_ordered || "Ordered*"
});
return acc;
@@ -61,6 +63,7 @@ export default connect(
skip: !modalVisible
});
const [insertPartOrder] = useMutation(INSERT_NEW_PARTS_ORDERS);
const [updateJobLines] = useMutation(UPDATE_JOB_LINE_STATUS);
const handleOk = () => {
insertPartOrder({
@@ -77,10 +80,25 @@ export default connect(
}
})
.then(r => {
notification["success"]({
message: t("parts_orders.successes.created")
});
setModalVisible(false);
updateJobLines({
variables: {
ids: linesToOrder.map(item => item.id),
status: bodyshop.md_order_statuses.default_ordered || "Ordered*"
}
})
.then(response => {
notification["success"]({
message: t("parts_orders.successes.created")
});
if (refetch) refetch();
setModalVisible(false);
})
.catch(error => {
notification["error"]({
message: t("parts_orders.errors.creating"),
description: error.message
});
});
})
.catch(error => {
notification["error"]({

View File

@@ -18,6 +18,20 @@ export const GET_JOB_LINES_BY_PK = gql`
lbr_op
lbr_amt
op_code_desc
status
parts_order_lines {
id
parts_order {
id
order_number
order_date
user_email
vendor {
id
name
}
}
}
allocations {
id
hours
@@ -30,3 +44,11 @@ export const GET_JOB_LINES_BY_PK = gql`
}
}
`;
export const UPDATE_JOB_LINE_STATUS = gql`
mutation UPDATE_JOB_LINE_STATUS($ids: [uuid!]!, $status: String!) {
update_joblines(where: { id: { _in: $ids } }, _set: { status: $status }) {
affected_rows
}
}
`;

View File

@@ -135,6 +135,7 @@
"mod_lb_hrs": "Labor Hours",
"oem_partno": "OEM Part #",
"part_type": "Part Type",
"status": "Status",
"unq_seq": "Seq #"
}
},
@@ -391,6 +392,7 @@
"labels": {
"email": "Send by Email",
"inthisorder": "Parts in this Order",
"orderhistory": "Order History",
"print": "Show Printed Form"
},
"successes": {

View File

@@ -135,6 +135,7 @@
"mod_lb_hrs": "Horas laborales",
"oem_partno": "OEM parte #",
"part_type": "Tipo de parte",
"status": "Estado",
"unq_seq": "Seq #"
}
},
@@ -391,6 +392,7 @@
"labels": {
"email": "Enviar por correo electrónico",
"inthisorder": "Partes en este pedido",
"orderhistory": "Historial de pedidos",
"print": "Mostrar formulario impreso"
},
"successes": {

View File

@@ -135,6 +135,7 @@
"mod_lb_hrs": "Heures de travail",
"oem_partno": "Pièce OEM #",
"part_type": "Type de pièce",
"status": "Statut",
"unq_seq": "Seq #"
}
},
@@ -391,6 +392,7 @@
"labels": {
"email": "Envoyé par email",
"inthisorder": "Pièces dans cette commande",
"orderhistory": "Historique des commandes",
"print": "Afficher le formulaire imprimé"
},
"successes": {

View File

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

View File

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

View File

@@ -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:
- id
- created_at
- updated_at
- jobid
- unq_seq
- line_ind
- line_desc
- part_type
- oem_partno
- est_seq
- db_ref
- line_ref
- tax_part
- db_price
- act_price
- part_qty
- alt_partno
- mod_lbr_ty
- db_hrs
- mod_lb_hrs
- lbr_op
- lbr_amt
- glass_flag
- price_inc
- alt_part_i
- price_j
- cert_part
- alt_co_id
- alt_overrd
- alt_partm
- prt_dsmk_p
- prt_dsmk_m
- lbr_inc
- lbr_hrs_j
- lbr_typ_j
- lbr_op_j
- paint_stg
- paint_tone
- lbr_tax
- misc_amt
- misc_sublt
- misc_tax
- bett_type
- bett_pctg
- bett_amt
- bett_tax
- op_code_desc
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: joblines
schema: public
type: create_insert_permission

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:
- id
- created_at
- updated_at
- jobid
- unq_seq
- line_ind
- line_desc
- part_type
- oem_partno
- est_seq
- db_ref
- line_ref
- tax_part
- db_price
- act_price
- part_qty
- alt_partno
- mod_lbr_ty
- db_hrs
- mod_lb_hrs
- lbr_op
- lbr_amt
- glass_flag
- price_inc
- alt_part_i
- price_j
- cert_part
- alt_co_id
- alt_overrd
- alt_partm
- prt_dsmk_p
- prt_dsmk_m
- lbr_inc
- lbr_hrs_j
- lbr_typ_j
- lbr_op_j
- paint_stg
- paint_tone
- lbr_tax
- misc_amt
- misc_sublt
- misc_tax
- bett_type
- bett_pctg
- bett_amt
- bett_tax
- op_code_desc
- status
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: joblines
schema: public
type: create_insert_permission

View File

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

View File

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