Removed productionview view from Hasura and replaced with standard GQL queries. BOD-243

This commit is contained in:
Patrick Fic
2020-08-03 13:43:39 -07:00
parent 3a8b4ddf5a
commit 75b1ed44e8
8 changed files with 68 additions and 135 deletions

View File

@@ -7,35 +7,54 @@ import { Link } from "react-router-dom";
import "./production-board-card.styles.scss";
export default function ProductionBoardCard(card) {
// console.log("card", card);
return (
<Card
className='react-kanban-card imex-kanban-card tight-antd-rows'
className="react-kanban-card imex-kanban-card tight-antd-rows"
style={{ margin: ".2rem 0rem" }}
size='small'
size="small"
title={`${card.ro_number || card.est_number} - ${card.v_model_yr} ${
card.v_make_desc || ""
} ${card.v_model_desc || ""}`}>
} ${card.v_model_desc || ""}`}
>
<Row>
<Col span={24}>
<div className='ellipses'>{`${card.ownr_fn || ""} ${
<div className="ellipses">{`${card.ownr_fn || ""} ${
card.ownr_ln || ""
} ${card.ownr_co_nm || ""}`}</div>
</Col>
</Row>
<Row>
<Col span={12}>
<div className='ellipses'>{card.clm_no || ""}</div>
<div className="ellipses">{card.clm_no || ""}</div>
</Col>
<Col span={12}>
<div className='ellipses'>{card.ins_co_nm || ""}</div>
<div className="ellipses">{card.ins_co_nm || ""}</div>
</Col>
</Row>
<Row>
<Col span={24}>
<div className='imex-flex-row imex-flex-row__flex-space-around'>
<div>{`B: ${card.labhrs || "?"}`}</div>
<div>{`R: ${card.labhrs || "?"}`}</div>
<div className="imex-flex-row imex-flex-row__flex-space-around">
<div className="mex-flex-row__margin">
<div>{`B: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}</div>
<div>{`R: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}</div>
</div>
<div className="mex-flex-row__margin">
<div>{`B: ${
card.employee_body_rel
? `${card.employee_body_rel.first_name} ${card.employee_body_rel.last_name}`
: ""
}`}</div>
<div>{`P: ${
card.employee_prep_rel
? `${card.employee_prep_rel.first_name} ${card.employee_prep_rel.last_name}`
: ""
}`}</div>
<div>{`R: ${
card.employee_refinish_rel
? `${card.employee_refinish_rel.first_name} ${card.employee_refinish_rel.last_name}`
: ""
}`}</div>
</div>
</div>
</Col>
</Row>
@@ -44,10 +63,10 @@ export default function ProductionBoardCard(card) {
<DateTimeFormatter>{card.scheduled_completion}</DateTimeFormatter>
</Col>
</Row>
<div className='imex-flex-row imex-flex-row__flex-space-around'>
<ProductionAlert record={card} key='alert' />
<div className="imex-flex-row imex-flex-row__flex-space-around">
<ProductionAlert record={card} key="alert" />
<Link to={`/manage/jobs/${card.id}`}>
<EyeFilled key='setting' />
<EyeFilled key="setting" />
</Link>
</div>
</Card>

View File

@@ -20,7 +20,7 @@ export function ProductionBoardKanbanContainer({ bodyshop }) {
return (
<ProductionBoardKanbanComponent
loading={loading}
data={data ? data.productionview : []}
data={data ? data.jobs : []}
/>
);
}

View File

@@ -13,7 +13,7 @@ export default function ProductionListColumnAlert({ record }) {
const handleAlertToggle = (e) => {
logImEXEvent("production_toggle_alert");
e.stopPropagation();
//e.stopPropagation();
updateAlert({
variables: {
jobId: record.id,
@@ -36,21 +36,23 @@ export default function ProductionListColumnAlert({ record }) {
<Dropdown
overlay={
<Menu>
<Menu.Item key='toggleAlert' onClick={handleAlertToggle}>
<Menu.Item key="toggleAlert" onClick={handleAlertToggle}>
{record.production_vars && record.production_vars.alert
? t("production.labels.alertoff")
: t("production.labels.alerton")}
</Menu.Item>
</Menu>
}
trigger={["contextMenu"]}>
trigger={["contextMenu"]}
>
<div
style={{
//width: "100%",
height: "19px",
}}>
}}
>
{record.production_vars && record.production_vars.alert ? (
<ExclamationCircleFilled className='production-alert' />
<ExclamationCircleFilled className="production-alert" />
) : null}
</div>
</Dropdown>

View File

@@ -34,7 +34,7 @@ export function ProductionListTableContainer({ bodyshop }) {
return (
<ProductionListTable
loading={loading}
data={data ? data.productionview : []}
data={data ? data.jobs : []}
columnState={columnState}
/>
);

View File

@@ -50,53 +50,9 @@ export const QUERY_ALL_ACTIVE_JOBS = gql`
}
`;
export const QUERY_JOBS_IN_PRODUCTION = gql`
query QUERY_JOBS_IN_PRODUCTION {
productionview {
id
status
ro_number
est_number
ownr_fn
ownr_ln
v_model_yr
v_model_desc
clm_no
v_make_desc
v_color
plate_no
actual_in
scheduled_completion
scheduled_delivery
ins_co_nm
clm_total
ownr_ph1
special_coverage_policy
production_vars
labhrs
larhrs
employee_body_rel {
id
first_name
last_name
}
employee_refinish_rel {
id
first_name
last_name
}
employee_prep_rel{
id
first_name
last_name
}
}
}
`;
export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
subscription SUBSCRIPTION_JOBS_IN_PRODUCTION($statusList: [String!]!) {
productionview(where: { status: { _in: $statusList } }) {
jobs(where: { status: { _in: $statusList } }) {
id
status
ro_number
@@ -117,9 +73,6 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
ownr_ph1
special_coverage_policy
production_vars
labhrs
larhrs
partcount
kanbanparent
employee_body_rel {
id
@@ -136,6 +89,26 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
first_name
last_name
}
partcount: joblines_aggregate {
nodes {
status
}
}
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
}
`;

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: DROP VIEW "public"."productionview";
type: run_sql

View File

@@ -3421,73 +3421,6 @@ tables:
_eq: X-Hasura-User-Id
- active:
_eq: true
- table:
schema: public
name: productionview
object_relationships:
- name: bodyshop
using:
manual_configuration:
remote_table:
schema: public
name: bodyshops
column_mapping:
shopid: id
- name: employee_body_rel
using:
manual_configuration:
remote_table:
schema: public
name: employees
column_mapping:
employee_body: id
- name: employee_refinish_rel
using:
manual_configuration:
remote_table:
schema: public
name: employees
column_mapping:
employee_refinish: id
select_permissions:
- role: user
permission:
columns:
- id
- status
- ro_number
- est_number
- ownr_fn
- ownr_ln
- v_model_yr
- v_model_desc
- clm_no
- v_make_desc
- v_color
- plate_no
- actual_in
- scheduled_completion
- scheduled_delivery
- ins_co_nm
- clm_total
- ownr_ph1
- special_coverage_policy
- production_vars
- labhrs
- larhrs
- shopid
- partcount
- kanbanparent
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
allow_aggregations: true
- table:
schema: public
name: scoreboard