Added time tickets by cost center BOD-239
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
React App:
|
React App:
|
||||||
|
|
||||||
Yarn Dependency Management:
|
Yarn Dependency Management:
|
||||||
To force upgrades for some packages: yarn upgrade-interactive --latest
|
To force upgrades for some packages:
|
||||||
|
yarn upgrade-interactive --latest
|
||||||
|
|
||||||
GraphQL API:
|
GraphQL API:
|
||||||
Hasura is hosted on another dyno. Several environmental variables are required, including disabling the console.
|
Hasura is hosted on another dyno. Several environmental variables are required, including disabling the console.
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
displayTemplateInWindow(html);
|
displayTemplateInWindow(html);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("jobTickets", jobTickets);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<List
|
<List
|
||||||
@@ -90,73 +92,79 @@ export function TimeTicketsSummaryEmployees({
|
|||||||
//dataSource={jobTickets}
|
//dataSource={jobTickets}
|
||||||
>
|
>
|
||||||
{jobTickets.map((item, idx) => {
|
{jobTickets.map((item, idx) => {
|
||||||
const costCenters = item.tickets
|
const employeeCostCenters = item.tickets
|
||||||
.map((i) => i.cost_center)
|
.map((i) => i.cost_center)
|
||||||
.filter(onlyUnique);
|
.filter(onlyUnique);
|
||||||
|
|
||||||
console.log("costCenters", costCenters);
|
console.log("employeeCostCenters", employeeCostCenters);
|
||||||
|
|
||||||
const actHrs = item.tickets.reduce(
|
return employeeCostCenters.map((costCenter) => {
|
||||||
(acc, val) => acc + val.actualhrs,
|
const actHrs = item.tickets
|
||||||
0
|
.filter((ticket) => ticket.cost_center === costCenter)
|
||||||
);
|
.reduce((acc, val) => acc + val.actualhrs, 0);
|
||||||
|
|
||||||
const prodHrs = item.tickets.reduce(
|
const prodHrs = item.tickets
|
||||||
(acc, val) => acc + val.productivehrs,
|
.filter((ticket) => ticket.cost_center === costCenter)
|
||||||
0
|
.reduce((acc, val) => acc + val.productivehrs, 0);
|
||||||
);
|
|
||||||
|
|
||||||
const clockHrs = item.tickets.reduce((acc, val) => {
|
const clockHrs = item.tickets
|
||||||
if (!!val.clockoff && !!val.clockon)
|
.filter((ticket) => ticket.cost_center === costCenter)
|
||||||
return (
|
.reduce((acc, val) => {
|
||||||
acc +
|
if (!!val.clockoff && !!val.clockon)
|
||||||
moment(val.clockoff).diff(moment(val.clockon), "hours", true)
|
return (
|
||||||
);
|
acc +
|
||||||
return acc;
|
moment(val.clockoff).diff(
|
||||||
}, 0);
|
moment(val.clockon),
|
||||||
|
"hours",
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return acc;
|
||||||
|
}, 0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
key={idx}
|
key={`${idx}${costCenter}`}
|
||||||
actions={[
|
actions={[
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handlePrintEmployeeTicket(item.employee.id)}
|
onClick={() => handlePrintEmployeeTicket(item.employee.id)}
|
||||||
>
|
>
|
||||||
{t("timetickets.actions.printemployee")}
|
{t("timetickets.actions.printemployee")}
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<LoadingSkeleton loading={loading}>
|
<LoadingSkeleton loading={loading}>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
title={`${item.employee.first_name} ${item.employee.last_name}`}
|
title={`${item.employee.first_name} ${item.employee.last_name}`}
|
||||||
description="cost center?"
|
description={costCenter}
|
||||||
/>
|
|
||||||
<Space>
|
|
||||||
<Statistic
|
|
||||||
title={t("timetickets.fields.actualhrs")}
|
|
||||||
precision={1}
|
|
||||||
value={actHrs}
|
|
||||||
/>
|
/>
|
||||||
<Statistic
|
<Space>
|
||||||
title={t("timetickets.fields.productivehrs")}
|
<Statistic
|
||||||
precision={1}
|
title={t("timetickets.fields.actualhrs")}
|
||||||
value={prodHrs}
|
precision={1}
|
||||||
/>
|
value={actHrs}
|
||||||
<Statistic
|
/>
|
||||||
title={t("timetickets.fields.efficiency")}
|
<Statistic
|
||||||
precision={1}
|
title={t("timetickets.fields.productivehrs")}
|
||||||
value={(prodHrs / actHrs) * 100}
|
precision={1}
|
||||||
suffix={"%"}
|
value={prodHrs}
|
||||||
/>
|
/>
|
||||||
<Statistic
|
<Statistic
|
||||||
title={t("timetickets.fields.clockhours")}
|
title={t("timetickets.fields.efficiency")}
|
||||||
precision={1}
|
precision={1}
|
||||||
value={clockHrs}
|
value={(prodHrs / actHrs) * 100}
|
||||||
/>
|
suffix={"%"}
|
||||||
</Space>
|
/>
|
||||||
</LoadingSkeleton>
|
<Statistic
|
||||||
</List.Item>
|
title={t("timetickets.fields.clockhours")}
|
||||||
);
|
precision={1}
|
||||||
|
value={clockHrs}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</LoadingSkeleton>
|
||||||
|
</List.Item>
|
||||||
|
);
|
||||||
|
});
|
||||||
})}
|
})}
|
||||||
</List>
|
</List>
|
||||||
<List
|
<List
|
||||||
|
|||||||
Reference in New Issue
Block a user