Removed references to allocations objects. Added new fields to job for employee assignment + created new component. BOD-100

This commit is contained in:
Patrick Fic
2020-07-16 13:59:27 -07:00
parent bbc0359e3a
commit fbb7bbad15
37 changed files with 2127 additions and 55 deletions

View File

@@ -8,9 +8,9 @@ import { setModalContext } from "../../redux/modals/modals.actions";
import { onlyUnique } from "../../utils/arrayHelper";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { alphaSort } from "../../utils/sorters";
import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
// import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
// import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
const mapDispatchToProps = (dispatch) => ({
@@ -173,35 +173,35 @@ export function JobLinesComponent({
[],
onFilter: (value, record) => value.includes(record.status),
},
{
title: t("allocations.fields.employee"),
dataIndex: "employee",
key: "employee",
sorter: (a, b) =>
alphaSort(
a.allocations[0] &&
a.allocations[0].employee.first_name +
a.allocations[0].employee.last_name,
b.allocations[0] &&
b.allocations[0].employee.first_name +
b.allocations[0].employee.last_name
),
sortOrder:
state.sortedInfo.columnKey === "employee" && state.sortedInfo.order,
render: (text, record) => (
<span>
{record.allocations && record.allocations.length > 0
? record.allocations.map((item) => (
<AllocationsEmployeeLabelContainer
key={item.id}
refetch={refetch}
allocation={item}
/>
))
: null}
</span>
),
},
// {
// title: t("allocations.fields.employee"),
// dataIndex: "employee",
// key: "employee",
// sorter: (a, b) =>
// alphaSort(
// a.allocations[0] &&
// a.allocations[0].employee.first_name +
// a.allocations[0].employee.last_name,
// b.allocations[0] &&
// b.allocations[0].employee.first_name +
// b.allocations[0].employee.last_name
// ),
// sortOrder:
// state.sortedInfo.columnKey === "employee" && state.sortedInfo.order,
// render: (text, record) => (
// <span>
// {record.allocations && record.allocations.length > 0
// ? record.allocations.map((item) => (
// <AllocationsEmployeeLabelContainer
// key={item.id}
// refetch={refetch}
// allocation={item}
// />
// ))
// : null}
// </span>
// ),
// },
{
title: t("general.labels.actions"),
dataIndex: "actions",
@@ -217,12 +217,14 @@ export function JobLinesComponent({
}}>
{t("general.actions.edit")}
</Button>
<AllocationsAssignmentContainer
key={record.id}
refetch={refetch}
jobLineId={record.id}
hours={record.mod_lb_hrs}
/>
{
// <AllocationsAssignmentContainer
// key={record.id}
// refetch={refetch}
// jobLineId={record.id}
// hours={record.mod_lb_hrs}
// />
}
</div>
),
},
@@ -278,10 +280,12 @@ export function JobLinesComponent({
<Dropdown overlay={markMenu} trigger={["click"]}>
<Button>{t("jobs.actions.mark")}</Button>
</Dropdown>
<AllocationsBulkAssignmentContainer
jobLines={selectedLines}
refetch={refetch}
/>
{
// <AllocationsBulkAssignmentContainer
// jobLines={selectedLines}
// refetch={refetch}
// />
}
<Button
onClick={() => {
setJobLineEditContext({