IO-1652 Add production filtered by technician

This commit is contained in:
Patrick Fic
2022-01-20 08:27:38 -08:00
parent 968da48399
commit 6fbf954dc2
6 changed files with 83 additions and 21 deletions

View File

@@ -38175,6 +38175,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>production_by_technician_one</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>purchases_by_cost_center_detail</name>
<definition_loaded>false</definition_loaded>

View File

@@ -4,9 +4,24 @@ import { TemplateList } from "../../utils/TemplateConstants";
import { useTranslation } from "react-i18next";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const ProdTemplates = TemplateList("production");
const ProductionByTech = TemplateList("special").production_by_technician_one;
export default function ProductionListPrint() {
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(ProductionListPrint);
export function ProductionListPrint({ bodyshop }) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
return (
@@ -33,6 +48,29 @@ export default function ProductionListPrint() {
{ProdTemplates[key].title}
</Menu.Item>
))}
<Menu.SubMenu
title={t("reportcenter.templates.production_by_technician_one")}
>
{bodyshop.employees.map((e) => (
<Menu.Item
key={e.id}
onClick={async () => {
setLoading(true);
await GenerateDocument(
{
name: ProductionByTech.key,
variables: { id: e.id },
},
{},
"p"
);
setLoading(false);
}}
>
{e.first_name} {e.last_name}
</Menu.Item>
))}
</Menu.SubMenu>
</Menu>
}
>

View File

@@ -2268,6 +2268,7 @@
"production_by_ro": "Production by RO",
"production_by_target_date": "Production by Target Date",
"production_by_technician": "Production by Technician",
"production_by_technician_one": "Production filtered by Technician",
"purchases_by_cost_center_detail": "Purchases by Cost Center (Detail)",
"purchases_by_cost_center_summary": "Purchases by Cost Center (Summary)",
"purchases_by_date_range_detail": "Purchases by Date - Detail",

View File

@@ -2268,6 +2268,7 @@
"production_by_ro": "",
"production_by_target_date": "",
"production_by_technician": "",
"production_by_technician_one": "",
"purchases_by_cost_center_detail": "",
"purchases_by_cost_center_summary": "",
"purchases_by_date_range_detail": "",

View File

@@ -2268,6 +2268,7 @@
"production_by_ro": "",
"production_by_target_date": "",
"production_by_technician": "",
"production_by_technician_one": "",
"purchases_by_cost_center_detail": "",
"purchases_by_cost_center_summary": "",
"purchases_by_date_range_detail": "",

View File

@@ -1590,26 +1590,6 @@ export const TemplateList = (type, context) => {
//idtype: "vendor",
disabled: false,
},
production_by_technician: {
title: i18n.t("reportcenter.templates.production_by_technician"),
description: "",
subject: i18n.t("reportcenter.templates.production_by_technician"),
key: "production_by_technician",
//idtype: "vendor",
disabled: false,
},
production_by_technician_one: {
title: i18n.t(
"reportcenter.templates.production_by_technician_one"
),
description: "",
subject: i18n.t(
"reportcenter.templates.production_by_technician_one"
),
key: "production_by_technician_one",
//idtype: "vendor",
disabled: false,
},
production_by_category: {
title: i18n.t("reportcenter.templates.production_by_category"),
description: "",
@@ -1618,6 +1598,14 @@ export const TemplateList = (type, context) => {
//idtype: "vendor",
disabled: false,
},
production_by_technician: {
title: i18n.t("reportcenter.templates.production_by_technician"),
description: "",
subject: i18n.t("reportcenter.templates.production_by_technician"),
key: "production_by_technician",
//idtype: "vendor",
disabled: false,
},
}
: {}),
...(!type || type === "special"
@@ -1629,6 +1617,18 @@ export const TemplateList = (type, context) => {
key: "ca_bc_etf_table",
disabled: false,
},
production_by_technician_one: {
title: i18n.t(
"reportcenter.templates.production_by_technician_one"
),
description: "",
subject: i18n.t(
"reportcenter.templates.production_by_technician_one"
),
key: "production_by_technician_one",
//idtype: "vendor",
disabled: false,
},
}
: {}),
};