IO-1638 Parts Received % on prod list.

This commit is contained in:
Patrick Fic
2022-03-29 08:14:20 -07:00
parent 6d1581a4e1
commit faf9fbb9d8
9 changed files with 144 additions and 14 deletions

View File

@@ -26589,6 +26589,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>parts_received</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> <concept_node>
<name>parts_tax_rates</name> <name>parts_tax_rates</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -31189,6 +31210,37 @@
</folder_node> </folder_node>
</children> </children>
</folder_node> </folder_node>
<folder_node>
<name>owner</name>
<children>
<folder_node>
<name>labels</name>
<children>
<concept_node>
<name>noownerinfo</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>
</children>
</folder_node>
</children>
</folder_node>
<folder_node> <folder_node>
<name>owners</name> <name>owners</name>
<children> <children>

View File

@@ -63,10 +63,11 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
const vehicleTitle = `${job.v_model_yr || ""} ${job.v_color || ""} const vehicleTitle = `${job.v_model_yr || ""} ${job.v_color || ""}
${job.v_make_desc || ""} ${job.v_make_desc || ""}
${job.v_model_desc || ""}`.trim(); ${job.v_model_desc || ""}`.trim();
console.log(
"🚀 ~ file: jobs-detail-header.component.jsx ~ line 64 ~ vehicleTitle", const ownerTitle = `${job.ownr_fn || ""} ${job.ownr_ln || ""} ${
vehicleTitle.length job.ownr_co_nm || ""
); }`.trim();
return ( return (
<Row gutter={[16, 16]} style={{ alignItems: "stretch" }}> <Row gutter={[16, 16]} style={{ alignItems: "stretch" }}>
<Col {...colSpan}> <Col {...colSpan}>
@@ -159,9 +160,9 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
style={{ height: "100%" }} style={{ height: "100%" }}
title={ title={
<Link to={disabled ? "#" : `/manage/owners/${job.owner.id}`}> <Link to={disabled ? "#" : `/manage/owners/${job.owner.id}`}>
{`${job.ownr_fn || ""} ${job.ownr_ln || ""} ${ {ownerTitle.length > 0
job.ownr_co_nm || "" ? ownerTitle
}`} : t("owner.labels.noownerinfo")}
</Link> </Link>
} }
> >

View File

@@ -21,6 +21,7 @@ import ProductionListColumnStatus from "./production-list-columns.status.compone
import ProductionListColumnCategory from "./production-list-columns.status.category"; import ProductionListColumnCategory from "./production-list-columns.status.category";
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component"; import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
import ProductionListColumnComment from "./production-list-columns.comment.component"; import ProductionListColumnComment from "./production-list-columns.comment.component";
import ProductionListColumnPartsReceived from "./production-list-columns.partsreceived.component";
const r = ({ technician, state, activeStatuses, bodyshop }) => { const r = ({ technician, state, activeStatuses, bodyshop }) => {
return [ return [
@@ -96,7 +97,7 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
sortOrder: sortOrder:
state.sortedInfo.columnKey === "actual_in" && state.sortedInfo.order, state.sortedInfo.columnKey === "actual_in" && state.sortedInfo.order,
render: (text, record) => ( render: (text, record) => (
<ProductionListDate record={record} field="actual_in" time/> <ProductionListDate record={record} field="actual_in" time />
), ),
}, },
{ {
@@ -477,6 +478,14 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
/> />
), ),
}, },
{
title: i18n.t("jobs.labels.parts_received"),
dataIndex: "parts_received",
key: "parts_received",
render: (text, record) => (
<ProductionListColumnPartsReceived record={record} />
),
},
]; ];
}; };
export default r; export default r;

View File

@@ -0,0 +1,41 @@
import { useMemo } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(ProductionListColumnPartsReceived);
export function ProductionListColumnPartsReceived({ bodyshop, record }) {
const amount = useMemo(() => {
const amount = record.joblines_status.reduce(
(acc, val) => {
acc.total += val.count;
acc.received =
val.status === bodyshop.md_order_statuses.default_received
? acc.received + val.count
: acc.received;
return acc;
},
{ total: 0, received: 0 }
);
return {
...amount,
percent:
amount.total !== 0
? ((amount.received / amount.total) * 100).toFixed(0) + "%"
: "N/A",
};
}, [record, bodyshop.md_order_statuses]);
return `${amount.percent} (${amount.received}/${amount.total})`;
}

View File

@@ -88,12 +88,6 @@ export function ProductionListTable({
); );
const handleTableChange = (pagination, filters, sorter) => { const handleTableChange = (pagination, filters, sorter) => {
console.log(
"🚀 ~ file: production-list-table.component.jsx ~ line 91 ~ pagination, filters, sorter",
pagination,
filters,
sorter
);
setState({ setState({
...state, ...state,
filteredInfo: filters, filteredInfo: filters,

View File

@@ -146,6 +146,11 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql`
employee_refinish employee_refinish
employee_prep employee_prep
employee_csr employee_csr
joblines_status{
part_type
status
count
}
labhrs: joblines_aggregate( labhrs: joblines_aggregate(
where: { where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }] _and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
@@ -219,6 +224,11 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql`
employee_refinish employee_refinish
employee_prep employee_prep
employee_csr employee_csr
joblines_status{
part_type
status
count
}
labhrs: joblines_aggregate( labhrs: joblines_aggregate(
where: { where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }] _and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
@@ -294,6 +304,11 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
employee_prep employee_prep
employee_csr employee_csr
suspended suspended
joblines_status{
part_type
status
count
}
labhrs: joblines_aggregate( labhrs: joblines_aggregate(
where: { where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }] _and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]

View File

@@ -1563,6 +1563,7 @@
"override_header": "Override estimate header on import?", "override_header": "Override estimate header on import?",
"ownerassociation": "Owner Association", "ownerassociation": "Owner Association",
"parts": "Parts", "parts": "Parts",
"parts_received": "Parts Rec.",
"parts_tax_rates": "Parts Tax rates", "parts_tax_rates": "Parts Tax rates",
"partsfilter": "Parts Only", "partsfilter": "Parts Only",
"partssubletstotal": "Parts & Sublets Total", "partssubletstotal": "Parts & Sublets Total",
@@ -1842,6 +1843,11 @@
"updated": "Note updated successfully." "updated": "Note updated successfully."
} }
}, },
"owner": {
"labels": {
"noownerinfo": "No owner information."
}
},
"owners": { "owners": {
"actions": { "actions": {
"update": "Update Selected Records" "update": "Update Selected Records"

View File

@@ -1563,6 +1563,7 @@
"override_header": "¿Anular encabezado estimado al importar?", "override_header": "¿Anular encabezado estimado al importar?",
"ownerassociation": "", "ownerassociation": "",
"parts": "Partes", "parts": "Partes",
"parts_received": "",
"parts_tax_rates": "", "parts_tax_rates": "",
"partsfilter": "", "partsfilter": "",
"partssubletstotal": "", "partssubletstotal": "",
@@ -1842,6 +1843,11 @@
"updated": "Nota actualizada con éxito." "updated": "Nota actualizada con éxito."
} }
}, },
"owner": {
"labels": {
"noownerinfo": ""
}
},
"owners": { "owners": {
"actions": { "actions": {
"update": "" "update": ""

View File

@@ -1563,6 +1563,7 @@
"override_header": "Remplacer l'en-tête d'estimation à l'importation?", "override_header": "Remplacer l'en-tête d'estimation à l'importation?",
"ownerassociation": "", "ownerassociation": "",
"parts": "les pièces", "parts": "les pièces",
"parts_received": "",
"parts_tax_rates": "", "parts_tax_rates": "",
"partsfilter": "", "partsfilter": "",
"partssubletstotal": "", "partssubletstotal": "",
@@ -1842,6 +1843,11 @@
"updated": "Remarque mise à jour avec succès." "updated": "Remarque mise à jour avec succès."
} }
}, },
"owner": {
"labels": {
"noownerinfo": ""
}
},
"owners": { "owners": {
"actions": { "actions": {
"update": "" "update": ""