Added allocation adding + basic pull

This commit is contained in:
Patrick Fic
2020-02-10 19:19:48 -08:00
parent 51a01d452c
commit cf6d51e896
10 changed files with 279 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { alphaSort } from "../../utils/sorters";
//import EditableCell from "./job-lines-cell.component";
import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
export default function JobLinesComponent({
jobLines,
@@ -97,6 +98,38 @@ export default function JobLinesComponent({
render: (text, record) => (
<CurrencyFormatter>{record.act_price}</CurrencyFormatter>
)
},
{
title: t("joblines.fields.mod_lb_hrs"),
dataIndex: "mod_lb_hrs",
key: "mod_lb_hrs",
sorter: (a, b) => a.mod_lb_hrs - b.mod_lb_hrs,
sortOrder:
state.sortedInfo.columnKey === "mod_lb_hrs" && state.sortedInfo.order
},
{
title: t("allocations.fields.employee"),
dataIndex: "employee",
key: "employee",
sorter: (a, b) => a.act_price - b.act_price, //TODO Fix employee sorting.
sortOrder:
state.sortedInfo.columnKey === "employee" && state.sortedInfo.order,
render: (text, record) => (
<span>
{record.allocations && record.allocations.length > 0
? record.allocations.map(item => (
<div
key={item.id}
>{`${item.employee.first_name} ${item.employee.last_name} (${item.hours})`}</div>
))
: null}
<AllocationsAssignmentContainer
key={record.id}
jobLineId={record.id}
hours={record.mod_lb_hrs}
/>
</span>
)
}
];