diff --git a/client/src/components/footer/footer.component.jsx b/client/src/components/footer/footer.component.jsx deleted file mode 100644 index 491546987..000000000 --- a/client/src/components/footer/footer.component.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import { Col, Row } from "antd"; -import React from "react"; - -export default function FooterComponent() { - return ( - - - Copyright Snapt Software 2019. All rights reserved. - - - ); -} diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 85c7ee393..625b12d46 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -232,6 +232,7 @@ export function JobLinesComponent({ ), diff --git a/client/src/components/job-lines-bill-reference/job-lines-bill-reference.component.jsx b/client/src/components/job-lines-bill-reference/job-lines-bill-reference.component.jsx index 342a1bedd..fee230c89 100644 --- a/client/src/components/job-lines-bill-reference/job-lines-bill-reference.component.jsx +++ b/client/src/components/job-lines-bill-reference/job-lines-bill-reference.component.jsx @@ -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 ; + return (
{`${(billLine.actual_price * billLine.quantity).toFixed(2)} (${ billLine.bill.vendor.name diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx index a2f65868a..bc14e9556 100644 --- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx +++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx @@ -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 ( + + + {t("general.labels.totals")} + + + + {totals.productivehrs} + {totals.actualhrs} + + {totals.actualhrs === 0 || !totals.actualhrs + ? "∞" + : `${((totals.productivehrs / totals.actualhrs) * 100).toFixed( + 2 + )}% ${t("timetickets.labels.efficiency")}`} + + + + + + ); + }} /> ); } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 58e3c7e59..b4d652e11 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -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", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 01cdfcd22..61f9f7afe 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -706,6 +706,7 @@ "sendagain": "", "sendby": "", "text": "", + "totals": "", "unknown": "Desconocido", "username": "", "view": "", @@ -1546,6 +1547,7 @@ "clockintojob": "", "deleteconfirm": "", "edit": "", + "efficiency": "", "flat_rate": "", "jobhours": "", "lunch": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 736734ffb..ae6896832 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -706,6 +706,7 @@ "sendagain": "", "sendby": "", "text": "", + "totals": "", "unknown": "Inconnu", "username": "", "view": "", @@ -1546,6 +1547,7 @@ "clockintojob": "", "deleteconfirm": "", "edit": "", + "efficiency": "", "flat_rate": "", "jobhours": "", "lunch": "",