IO-1853 Add Attendance Table excel creation.
This commit is contained in:
@@ -36737,6 +36737,32 @@
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>special</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>attendance_detail_csv</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>subjects</name>
|
||||
<children>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Button } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useState } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import moment from "moment";
|
||||
const AttendanceCsv = TemplateList("special").attendance_detail_csv;
|
||||
|
||||
export default function TimeTicketsAttendanceTable() {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { start, end } = searchParams;
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleClick = async () => {
|
||||
setLoading(true);
|
||||
|
||||
await GenerateDocument(
|
||||
{
|
||||
name: AttendanceCsv.key,
|
||||
variables: {
|
||||
start: start
|
||||
? start
|
||||
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
|
||||
end: end ? end : moment().endOf("week").format("YYYY-MM-DD"),
|
||||
},
|
||||
},
|
||||
{},
|
||||
"x"
|
||||
);
|
||||
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button loading={loading} onClick={handleClick}>
|
||||
{t("printcenter.special.attendance_detail_csv")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import TimeTicketList from "../../components/time-ticket-list/time-ticket-list.c
|
||||
import TimeTicketsPayrollTable from "../../components/time-tickets-payroll-table/time-tickets-payroll-table.component";
|
||||
import TimeTicketsSummaryEmployees from "../../components/time-tickets-summary-employees/time-tickets-summary-employees.component";
|
||||
import { QUERY_TIME_TICKETS_IN_RANGE } from "../../graphql/timetickets.queries";
|
||||
import TimeTicketsAttendanceTable from "../../components/time-tickets-attendance-table/time-tickets-attendance-table.component";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
@@ -71,6 +72,7 @@ export function TimeTicketsContainer({
|
||||
timetickets={data ? data.timetickets : []}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<TimeTicketsAttendanceTable />
|
||||
<TimeTicketsPayrollTable />
|
||||
<TimeTicketsDatesSelector />
|
||||
</Space>
|
||||
|
||||
@@ -2174,6 +2174,9 @@
|
||||
"ca_bc_etf_table": "ICBC ETF Table",
|
||||
"exported_payroll": "Payroll Table"
|
||||
},
|
||||
"special": {
|
||||
"attendance_detail_csv": "Attendance Table"
|
||||
},
|
||||
"subjects": {
|
||||
"jobs": {
|
||||
"parts_order": "Parts Order PO: {{ro_number}} - {{name}}"
|
||||
|
||||
@@ -2174,6 +2174,9 @@
|
||||
"ca_bc_etf_table": "",
|
||||
"exported_payroll": ""
|
||||
},
|
||||
"special": {
|
||||
"attendance_detail_csv": ""
|
||||
},
|
||||
"subjects": {
|
||||
"jobs": {
|
||||
"parts_order": ""
|
||||
|
||||
@@ -2174,6 +2174,9 @@
|
||||
"ca_bc_etf_table": "",
|
||||
"exported_payroll": ""
|
||||
},
|
||||
"special": {
|
||||
"attendance_detail_csv": ""
|
||||
},
|
||||
"subjects": {
|
||||
"jobs": {
|
||||
"parts_order": ""
|
||||
|
||||
@@ -1668,6 +1668,13 @@ export const TemplateList = (type, context) => {
|
||||
key: "exported_payroll",
|
||||
disabled: false,
|
||||
},
|
||||
attendance_detail_csv: {
|
||||
title: i18n.t("printcenter.special.attendance_detail_csv"),
|
||||
description: "Est Detail",
|
||||
subject: i18n.t("printcenter.special.attendance_detail_csv"),
|
||||
key: "attendance_detail_csv",
|
||||
disabled: false,
|
||||
},
|
||||
production_by_technician_one: {
|
||||
title: i18n.t(
|
||||
"reportcenter.templates.production_by_technician_one"
|
||||
|
||||
Reference in New Issue
Block a user