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
|
<JobLinesBillRefernece
|
||||||
jobline={record}
|
jobline={record}
|
||||||
loading={billLinesLoading}
|
loading={billLinesLoading}
|
||||||
|
error={billLinesError}
|
||||||
billLinesObject={billLinesDataObj}
|
billLinesObject={billLinesDataObj}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { Spin } from "antd";
|
import { Spin } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
|
||||||
export default function JobLinesBillRefernece({
|
export default function JobLinesBillRefernece({
|
||||||
jobline,
|
jobline,
|
||||||
loading,
|
loading,
|
||||||
|
error,
|
||||||
billLinesObject,
|
billLinesObject,
|
||||||
}) {
|
}) {
|
||||||
if (loading)
|
if (loading)
|
||||||
@@ -17,6 +19,8 @@ export default function JobLinesBillRefernece({
|
|||||||
const billLine = billLinesObject[jobline.id];
|
const billLine = billLinesObject[jobline.id];
|
||||||
if (!billLine) return null;
|
if (!billLine) return null;
|
||||||
|
|
||||||
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>{`${(billLine.actual_price * billLine.quantity).toFixed(2)} (${
|
<div>{`${(billLine.actual_price * billLine.quantity).toFixed(2)} (${
|
||||||
billLine.bill.vendor.name
|
billLine.bill.vendor.name
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import { Table } from "antd";
|
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 { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
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 { onlyUnique } from "../../utils/arrayHelper";
|
||||||
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
|
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
|
||||||
|
|
||||||
export default function TimeTicketList({
|
export default function TimeTicketList({
|
||||||
disabled,
|
disabled,
|
||||||
@@ -24,6 +23,19 @@ export default function TimeTicketList({
|
|||||||
|
|
||||||
const { t } = useTranslation();
|
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 = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("timetickets.fields.date"),
|
title: t("timetickets.fields.date"),
|
||||||
@@ -182,6 +194,29 @@ export default function TimeTicketList({
|
|||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={timetickets}
|
dataSource={timetickets}
|
||||||
onChange={handleTableChange}
|
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>
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -706,6 +706,7 @@
|
|||||||
"sendagain": "Send Again",
|
"sendagain": "Send Again",
|
||||||
"sendby": "Send By",
|
"sendby": "Send By",
|
||||||
"text": "Text",
|
"text": "Text",
|
||||||
|
"totals": "Totals",
|
||||||
"unknown": "Unknown",
|
"unknown": "Unknown",
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
"view": "View",
|
"view": "View",
|
||||||
@@ -1546,6 +1547,7 @@
|
|||||||
"clockintojob": "Clock In to Job",
|
"clockintojob": "Clock In to Job",
|
||||||
"deleteconfirm": "Are you sure you want to delete this time ticket? This cannot be undone.",
|
"deleteconfirm": "Are you sure you want to delete this time ticket? This cannot be undone.",
|
||||||
"edit": "Edit Time Ticket",
|
"edit": "Edit Time Ticket",
|
||||||
|
"efficiency": "Efficiency",
|
||||||
"flat_rate": "Flat Rate",
|
"flat_rate": "Flat Rate",
|
||||||
"jobhours": "Job Related Time Tickets Summary",
|
"jobhours": "Job Related Time Tickets Summary",
|
||||||
"lunch": "Lunch",
|
"lunch": "Lunch",
|
||||||
|
|||||||
@@ -706,6 +706,7 @@
|
|||||||
"sendagain": "",
|
"sendagain": "",
|
||||||
"sendby": "",
|
"sendby": "",
|
||||||
"text": "",
|
"text": "",
|
||||||
|
"totals": "",
|
||||||
"unknown": "Desconocido",
|
"unknown": "Desconocido",
|
||||||
"username": "",
|
"username": "",
|
||||||
"view": "",
|
"view": "",
|
||||||
@@ -1546,6 +1547,7 @@
|
|||||||
"clockintojob": "",
|
"clockintojob": "",
|
||||||
"deleteconfirm": "",
|
"deleteconfirm": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
|
"efficiency": "",
|
||||||
"flat_rate": "",
|
"flat_rate": "",
|
||||||
"jobhours": "",
|
"jobhours": "",
|
||||||
"lunch": "",
|
"lunch": "",
|
||||||
|
|||||||
@@ -706,6 +706,7 @@
|
|||||||
"sendagain": "",
|
"sendagain": "",
|
||||||
"sendby": "",
|
"sendby": "",
|
||||||
"text": "",
|
"text": "",
|
||||||
|
"totals": "",
|
||||||
"unknown": "Inconnu",
|
"unknown": "Inconnu",
|
||||||
"username": "",
|
"username": "",
|
||||||
"view": "",
|
"view": "",
|
||||||
@@ -1546,6 +1547,7 @@
|
|||||||
"clockintojob": "",
|
"clockintojob": "",
|
||||||
"deleteconfirm": "",
|
"deleteconfirm": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
|
"efficiency": "",
|
||||||
"flat_rate": "",
|
"flat_rate": "",
|
||||||
"jobhours": "",
|
"jobhours": "",
|
||||||
"lunch": "",
|
"lunch": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user