Merged in feature/IO-2385-Tech-Console-Attendance-Report (pull request #943)
IO-2385 Tech Console to print Attendance Report from Shift Clock
This commit is contained in:
@@ -32,7 +32,7 @@ export function TechClockInContainer({
|
|||||||
currentUser,
|
currentUser,
|
||||||
}) {
|
}) {
|
||||||
console.log(
|
console.log(
|
||||||
"🚀 ~ file: tech-job-clock-in-form.container.jsx:29 ~ technician:",
|
"🚀 ~ file: tech-job-clock-in-form.container.jsx:30 ~ technician:",
|
||||||
technician
|
technician
|
||||||
);
|
);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
@@ -128,7 +128,7 @@ export function TechClockInContainer({
|
|||||||
>
|
>
|
||||||
{t("timetickets.actions.enter")}
|
{t("timetickets.actions.enter")}
|
||||||
</Button>
|
</Button>
|
||||||
<TechJobPrintTickets />
|
<TechJobPrintTickets attendacePrint={false} />
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => form.submit()}
|
onClick={() => form.submit()}
|
||||||
|
|||||||
@@ -21,12 +21,13 @@ export default connect(
|
|||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(TechJobPrintTickets);
|
)(TechJobPrintTickets);
|
||||||
|
|
||||||
export function TechJobPrintTickets({ technician, event }) {
|
export function TechJobPrintTickets({ technician, event, attendacePrint }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [visibility, setVisibility] = useState(false);
|
const [visibility, setVisibility] = useState(false);
|
||||||
|
const Templates = TemplateList("report_center");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visibility && event) {
|
if (visibility && event) {
|
||||||
@@ -44,7 +45,10 @@ export function TechJobPrintTickets({ technician, event }) {
|
|||||||
try {
|
try {
|
||||||
await GenerateDocument(
|
await GenerateDocument(
|
||||||
{
|
{
|
||||||
name: TemplateList().timetickets_employee.key,
|
name:
|
||||||
|
attendacePrint === true
|
||||||
|
? Templates.attendance_employee.key
|
||||||
|
: Templates.timetickets_employee.key,
|
||||||
variables: {
|
variables: {
|
||||||
...(start
|
...(start
|
||||||
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
||||||
@@ -60,7 +64,10 @@ export function TechJobPrintTickets({ technician, event }) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
to: technician.email,
|
to: technician.email,
|
||||||
subject: TemplateList().timetickets_employee.subject,
|
subject:
|
||||||
|
attendacePrint === true
|
||||||
|
? Templates.attendance_employee.subject
|
||||||
|
: Templates.timetickets_employee.subject,
|
||||||
},
|
},
|
||||||
"p"
|
"p"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,48 +4,67 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import DataLabel from "../data-label/data-label.component";
|
import DataLabel from "../data-label/data-label.component";
|
||||||
import TechClockOffButton from "../tech-job-clock-out-button/tech-job-clock-out-button.component";
|
import TechClockOffButton from "../tech-job-clock-out-button/tech-job-clock-out-button.component";
|
||||||
|
import TechJobPrintTickets from "../tech-job-print-tickets/tech-job-print-tickets.component";
|
||||||
|
|
||||||
export default function TimeTicketShiftActive({ timetickets, refetch }) {
|
export default function TimeTicketShiftActive({
|
||||||
|
timetickets,
|
||||||
|
refetch,
|
||||||
|
isTechConsole,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{timetickets.length > 0 ? (
|
{timetickets.length > 0 ? (
|
||||||
<div>
|
<div
|
||||||
<Typography.Title level={2}>
|
style={{
|
||||||
{t("timetickets.labels.shiftalreadyclockedon")}
|
display: "flex",
|
||||||
</Typography.Title>
|
justifyContent: "space-between",
|
||||||
<List
|
flexDirection: "column",
|
||||||
grid={{
|
height: "100%",
|
||||||
gutter: 32,
|
}}
|
||||||
xs: 1,
|
>
|
||||||
sm: 2,
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
md: 3,
|
<Typography.Title level={2}>
|
||||||
lg: 4,
|
{t("timetickets.labels.shiftalreadyclockedon")}
|
||||||
xl: 5,
|
</Typography.Title>
|
||||||
xxl: 6,
|
{isTechConsole ? (
|
||||||
}}
|
<TechJobPrintTickets attendacePrint={true} />
|
||||||
dataSource={timetickets || []}
|
) : null}
|
||||||
renderItem={(ticket) => (
|
</div>
|
||||||
<List.Item>
|
<div style={{ flexGrow: 1 }}>
|
||||||
<Card
|
<List
|
||||||
title={t(ticket.memo)}
|
grid={{
|
||||||
actions={[
|
gutter: 32,
|
||||||
<TechClockOffButton
|
xs: 1,
|
||||||
jobId={ticket.jobid}
|
sm: 2,
|
||||||
timeTicketId={ticket.id}
|
md: 3,
|
||||||
completedCallback={refetch}
|
lg: 4,
|
||||||
isShiftTicket
|
xl: 5,
|
||||||
/>,
|
xxl: 6,
|
||||||
]}
|
}}
|
||||||
>
|
dataSource={timetickets || []}
|
||||||
<DataLabel label={t("timetickets.fields.clockon")}>
|
renderItem={(ticket) => (
|
||||||
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
|
<List.Item>
|
||||||
</DataLabel>
|
<Card
|
||||||
</Card>
|
title={t(ticket.memo)}
|
||||||
</List.Item>
|
actions={[
|
||||||
)}
|
<TechClockOffButton
|
||||||
></List>
|
jobId={ticket.jobid}
|
||||||
|
timeTicketId={ticket.id}
|
||||||
|
completedCallback={refetch}
|
||||||
|
isShiftTicket
|
||||||
|
/>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<DataLabel label={t("timetickets.fields.clockon")}>
|
||||||
|
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
|
||||||
|
</DataLabel>
|
||||||
|
</Card>
|
||||||
|
</List.Item>
|
||||||
|
)}
|
||||||
|
></List>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Form, notification } from "antd";
|
import { Button, Form, Space, notification } from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useMemo, useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import TechJobPrintTickets from "../tech-job-print-tickets/tech-job-print-tickets.component";
|
||||||
import TimeTicektShiftComponent from "./time-ticket-shift-form.component";
|
import TimeTicektShiftComponent from "./time-ticket-shift-form.component";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -29,6 +30,10 @@ export function TimeTicektShiftContainer({
|
|||||||
isTechConsole,
|
isTechConsole,
|
||||||
checkIfAlreadyClocked,
|
checkIfAlreadyClocked,
|
||||||
}) {
|
}) {
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: time-ticket-shift-form.container.jsx:28 ~ technician:",
|
||||||
|
technician
|
||||||
|
);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET);
|
const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -113,9 +118,14 @@ export function TimeTicektShiftContainer({
|
|||||||
initialValues={{ cost_center: t("timetickets.labels.shift") }}
|
initialValues={{ cost_center: t("timetickets.labels.shift") }}
|
||||||
>
|
>
|
||||||
<TimeTicektShiftComponent form={form} />
|
<TimeTicektShiftComponent form={form} />
|
||||||
<Button htmlType="submit" loading={loading}>
|
<Space wrap>
|
||||||
{t("timetickets.actions.clockin")}
|
<Button htmlType="submit" loading={loading} type="primary">
|
||||||
</Button>
|
{t("timetickets.actions.clockin")}
|
||||||
|
</Button>
|
||||||
|
{isTechConsole === true ? (
|
||||||
|
<TechJobPrintTickets attendacePrint={true} />
|
||||||
|
) : null}
|
||||||
|
</Space>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ export function TimeTicketShiftContainer({
|
|||||||
<TimeTicketShiftActive
|
<TimeTicketShiftActive
|
||||||
timetickets={data ? data.timetickets : []}
|
timetickets={data ? data.timetickets : []}
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
|
isTechConsole={isTechConsole}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<TimeTicketShiftFormContainer
|
<TimeTicketShiftFormContainer
|
||||||
|
|||||||
Reference in New Issue
Block a user