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>
</translations>
</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>
<name>parts_tax_rates</name>
<definition_loaded>false</definition_loaded>
@@ -31189,6 +31210,37 @@
</folder_node>
</children>
</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>
<name>owners</name>
<children>

View File

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

View File

@@ -21,6 +21,7 @@ import ProductionListColumnStatus from "./production-list-columns.status.compone
import ProductionListColumnCategory from "./production-list-columns.status.category";
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
import ProductionListColumnComment from "./production-list-columns.comment.component";
import ProductionListColumnPartsReceived from "./production-list-columns.partsreceived.component";
const r = ({ technician, state, activeStatuses, bodyshop }) => {
return [
@@ -96,7 +97,7 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
sortOrder:
state.sortedInfo.columnKey === "actual_in" && state.sortedInfo.order,
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;

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) => {
console.log(
"🚀 ~ file: production-list-table.component.jsx ~ line 91 ~ pagination, filters, sorter",
pagination,
filters,
sorter
);
setState({
...state,
filteredInfo: filters,

View File

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

View File

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

View File

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

View File

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