Missed in last commit IO-575
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import { Col, Row } from "antd";
|
||||
import React from "react";
|
||||
|
||||
export default function FooterComponent() {
|
||||
return (
|
||||
<Row>
|
||||
<Col span={8} offset={8}>
|
||||
Copyright Snapt Software 2019. All rights reserved.
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
@@ -232,6 +232,7 @@ export function JobLinesComponent({
|
||||
<JobLinesBillRefernece
|
||||
jobline={record}
|
||||
loading={billLinesLoading}
|
||||
error={billLinesError}
|
||||
billLinesObject={billLinesDataObj}
|
||||
/>
|
||||
),
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Spin } from "antd";
|
||||
import React from "react";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
|
||||
export default function JobLinesBillRefernece({
|
||||
jobline,
|
||||
loading,
|
||||
error,
|
||||
billLinesObject,
|
||||
}) {
|
||||
if (loading)
|
||||
@@ -17,6 +19,8 @@ export default function JobLinesBillRefernece({
|
||||
const billLine = billLinesObject[jobline.id];
|
||||
if (!billLine) return null;
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return (
|
||||
<div>{`${(billLine.actual_price * billLine.quantity).toFixed(2)} (${
|
||||
billLine.bill.vendor.name
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import moment from "moment";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import moment from "moment";
|
||||
import { onlyUnique } from "../../utils/arrayHelper";
|
||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
|
||||
|
||||
export default function TimeTicketList({
|
||||
disabled,
|
||||
@@ -24,6 +23,19 @@ export default function TimeTicketList({
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const totals = useMemo(() => {
|
||||
if (timetickets)
|
||||
return timetickets.reduce(
|
||||
(acc, val) => {
|
||||
acc.productivehrs = acc.productivehrs + val.productivehrs;
|
||||
acc.actualhrs = acc.actualhrs + val.actualhrs;
|
||||
return acc;
|
||||
},
|
||||
{ productivehrs: 0, actualhrs: 0 }
|
||||
);
|
||||
return { productivehrs: 0, actualhrs: 0 };
|
||||
}, [timetickets]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("timetickets.fields.date"),
|
||||
@@ -182,6 +194,29 @@ export default function TimeTicketList({
|
||||
rowKey="id"
|
||||
dataSource={timetickets}
|
||||
onChange={handleTableChange}
|
||||
summary={() => {
|
||||
return (
|
||||
<Table.Summary.Row>
|
||||
<Table.Summary.Cell>
|
||||
{t("general.labels.totals")}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell />
|
||||
<Table.Summary.Cell />
|
||||
<Table.Summary.Cell>{totals.productivehrs}</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>{totals.actualhrs}</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals.actualhrs === 0 || !totals.actualhrs
|
||||
? "∞"
|
||||
: `${((totals.productivehrs / totals.actualhrs) * 100).toFixed(
|
||||
2
|
||||
)}% ${t("timetickets.labels.efficiency")}`}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell />
|
||||
<Table.Summary.Cell />
|
||||
<Table.Summary.Cell />
|
||||
</Table.Summary.Row>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user