IO-1998 Filter schedule by event type.
This commit is contained in:
@@ -41363,6 +41363,69 @@
|
||||
<folder_node>
|
||||
<name>labels</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>employeevacation</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>
|
||||
<concept_node>
|
||||
<name>intake</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>
|
||||
<concept_node>
|
||||
<name>manual</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>
|
||||
<concept_node>
|
||||
<name>manualevent</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -5,8 +5,18 @@ import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { QUERY_AUDIT_TRAIL } from "../../graphql/audit_trail.queries";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobAuditTrail);
|
||||
|
||||
export default function JobAuditTrail({ jobId }) {
|
||||
export function JobAuditTrail({ currentUser, jobId }) {
|
||||
const { t } = useTranslation();
|
||||
const { loading, data, refetch } = useQuery(QUERY_AUDIT_TRAIL, {
|
||||
variables: { jobid: jobId },
|
||||
@@ -75,26 +85,28 @@ export default function JobAuditTrail({ jobId }) {
|
||||
dataIndex: "subject",
|
||||
key: "subject",
|
||||
},
|
||||
// {
|
||||
// title: t("audit.fields.contents"),
|
||||
// dataIndex: "contents",
|
||||
// key: "contents",
|
||||
// width: "10%",
|
||||
// render: (text, record) => (
|
||||
// <Button
|
||||
// onClick={() => {
|
||||
// var win = window.open(
|
||||
// "",
|
||||
// "Title",
|
||||
// "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=400,"
|
||||
// );
|
||||
// win.document.body.innerHTML = record.contents;
|
||||
// }}
|
||||
// >
|
||||
// Preview
|
||||
// </Button>
|
||||
// ),
|
||||
// },
|
||||
...(currentUser?.email.includes("@imex.") && [
|
||||
{
|
||||
title: t("audit.fields.contents"),
|
||||
dataIndex: "contents",
|
||||
key: "contents",
|
||||
width: "10%",
|
||||
render: (text, record) => (
|
||||
<Button
|
||||
onClick={() => {
|
||||
var win = window.open(
|
||||
"",
|
||||
"Title",
|
||||
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=400,"
|
||||
);
|
||||
win.document.body.innerHTML = record.contents;
|
||||
}}
|
||||
>
|
||||
Preview
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
]),
|
||||
];
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { Button, Card, Col, PageHeader, Row, Space } from "antd";
|
||||
import React from "react";
|
||||
import { Button, Card, Checkbox, Col, PageHeader, Row, Space } from "antd";
|
||||
import { t } from "i18next";
|
||||
import React, { useMemo } from "react";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import ScheduleCalendarWrapperComponent from "../schedule-calendar-wrapper/scheduler-calendar-wrapper.component";
|
||||
import ScheduleModal from "../schedule-job-modal/schedule-job-modal.container";
|
||||
import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component";
|
||||
@@ -8,6 +10,23 @@ import ScheduleProductionList from "../schedule-production-list/schedule-product
|
||||
import ScheduleVerifyIntegrity from "../schedule-verify-integrity/schedule-verify-integrity.component";
|
||||
|
||||
export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||
const [filter, setFilter] = useLocalStorage("filter_events", {
|
||||
intake: true,
|
||||
manual: true,
|
||||
employeevacation: true,
|
||||
});
|
||||
const filteredData = useMemo(() => {
|
||||
return data.filter(
|
||||
(d) =>
|
||||
d.block ||
|
||||
(filter.intake && d.isintake) ||
|
||||
(filter.manual && !d.isintake && d.block === false) ||
|
||||
(d.__typename === "employee_vacation" &&
|
||||
filter.employeevacation &&
|
||||
!!d.employee)
|
||||
);
|
||||
}, [data, filter]);
|
||||
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<ScheduleModal />
|
||||
@@ -16,6 +35,30 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||
<PageHeader
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Checkbox
|
||||
checked={filter?.intake}
|
||||
onChange={(e) => {
|
||||
setFilter({ ...filter, intake: e.target.checked });
|
||||
}}
|
||||
>
|
||||
{t("schedule.labels.intake")}
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={filter?.manual}
|
||||
onChange={(e) => {
|
||||
setFilter({ ...filter, manual: e.target.checked });
|
||||
}}
|
||||
>
|
||||
{t("schedule.labels.manual")}
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
checked={filter?.employeevacation}
|
||||
onChange={(e) => {
|
||||
setFilter({ ...filter, employeevacation: e.target.checked });
|
||||
}}
|
||||
>
|
||||
{t("schedule.labels.employeevacation")}
|
||||
</Checkbox>
|
||||
<ScheduleVerifyIntegrity />
|
||||
<Button
|
||||
onClick={() => {
|
||||
@@ -35,7 +78,7 @@ export default function ScheduleCalendarComponent({ data, refetch }) {
|
||||
<Col span={24}>
|
||||
<Card>
|
||||
<ScheduleCalendarWrapperComponent
|
||||
data={data}
|
||||
data={filteredData}
|
||||
refetch={refetch}
|
||||
style={{ height: "100rem" }}
|
||||
/>
|
||||
|
||||
@@ -2448,6 +2448,9 @@
|
||||
},
|
||||
"schedule": {
|
||||
"labels": {
|
||||
"employeevacation": "Employee Vacations",
|
||||
"intake": "Intake Events",
|
||||
"manual": "Manual Events",
|
||||
"manualevent": "Add Manual Event"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2448,6 +2448,9 @@
|
||||
},
|
||||
"schedule": {
|
||||
"labels": {
|
||||
"employeevacation": "",
|
||||
"intake": "",
|
||||
"manual": "",
|
||||
"manualevent": ""
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2448,6 +2448,9 @@
|
||||
},
|
||||
"schedule": {
|
||||
"labels": {
|
||||
"employeevacation": "",
|
||||
"intake": "",
|
||||
"manual": "",
|
||||
"manualevent": ""
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user