Merge branch 'release/2021-10-15' into test

This commit is contained in:
Patrick Fic
2021-10-13 13:15:35 -07:00
2 changed files with 15 additions and 6 deletions

View File

@@ -6,9 +6,11 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { selectTechnician } from "../../redux/tech/tech.selectors"; import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser //currentUser: selectCurrentUser
technician: selectTechnician, technician: selectTechnician,
bodyshop: selectBodyshop,
}); });
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language)) //setUserLanguage: language => dispatch(setUserLanguage(language))
@@ -21,6 +23,7 @@ export default connect(
export function ProductionColumnsComponent({ export function ProductionColumnsComponent({
columnState, columnState,
technician, technician,
bodyshop,
tableState, tableState,
}) { }) {
const [columns, setColumns] = columnState; const [columns, setColumns] = columnState;
@@ -29,9 +32,11 @@ export function ProductionColumnsComponent({
const handleAdd = (e) => { const handleAdd = (e) => {
setColumns([ setColumns([
...columns, ...columns,
...dataSource({ technician, state: tableState }).filter( ...dataSource({
(i) => i.key === e.key technician,
), state: tableState,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
}).filter((i) => i.key === e.key),
]); ]);
}; };
@@ -39,7 +44,11 @@ export function ProductionColumnsComponent({
const menu = ( const menu = (
<Menu onClick={handleAdd}> <Menu onClick={handleAdd}>
{dataSource({ technician, state: tableState }) {dataSource({
technician,
state: tableState,
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
})
.filter((i) => !columnKeys.includes(i.key)) .filter((i) => !columnKeys.includes(i.key))
.map((item) => ( .map((item) => (
<Menu.Item key={item.key}>{item.title}</Menu.Item> <Menu.Item key={item.key}>{item.title}</Menu.Item>

View File

@@ -9,11 +9,11 @@ export function alphaSort(a, b) {
} }
export function dateSort(a, b) { export function dateSort(a, b) {
return new Date(b) - new Date(a); return new Date(a) - new Date(b);
} }
export function statusSort(a, b, statusList) { export function statusSort(a, b, statusList) {
return ( return (
statusList.findIndex((x) => x === a) > statusList.findIndex((x) => x === b) statusList.findIndex((x) => x === a) - statusList.findIndex((x) => x === b)
); );
} }