Missed in last commit IO-575

This commit is contained in:
Patrick Fic
2021-01-21 14:20:00 -08:00
parent 7495d83200
commit 7961e27eee
7 changed files with 52 additions and 18 deletions

View File

@@ -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>
);
}

View File

@@ -232,6 +232,7 @@ export function JobLinesComponent({
<JobLinesBillRefernece
jobline={record}
loading={billLinesLoading}
error={billLinesError}
billLinesObject={billLinesDataObj}
/>
),

View File

@@ -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

View File

@@ -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>
);
}}
/>
);
}

View File

@@ -706,6 +706,7 @@
"sendagain": "Send Again",
"sendby": "Send By",
"text": "Text",
"totals": "Totals",
"unknown": "Unknown",
"username": "Username",
"view": "View",
@@ -1546,6 +1547,7 @@
"clockintojob": "Clock In to Job",
"deleteconfirm": "Are you sure you want to delete this time ticket? This cannot be undone.",
"edit": "Edit Time Ticket",
"efficiency": "Efficiency",
"flat_rate": "Flat Rate",
"jobhours": "Job Related Time Tickets Summary",
"lunch": "Lunch",

View File

@@ -706,6 +706,7 @@
"sendagain": "",
"sendby": "",
"text": "",
"totals": "",
"unknown": "Desconocido",
"username": "",
"view": "",
@@ -1546,6 +1547,7 @@
"clockintojob": "",
"deleteconfirm": "",
"edit": "",
"efficiency": "",
"flat_rate": "",
"jobhours": "",
"lunch": "",

View File

@@ -706,6 +706,7 @@
"sendagain": "",
"sendby": "",
"text": "",
"totals": "",
"unknown": "Inconnu",
"username": "",
"view": "",
@@ -1546,6 +1547,7 @@
"clockintojob": "",
"deleteconfirm": "",
"edit": "",
"efficiency": "",
"flat_rate": "",
"jobhours": "",
"lunch": "",