Added report center IO-636
This commit is contained in:
@@ -20306,6 +20306,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>reportcenter</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>schedule</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -24357,6 +24378,131 @@
|
||||
</folder_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>reportcenter</name>
|
||||
<children>
|
||||
<folder_node>
|
||||
<name>actions</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>generate</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>labels</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>dates</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>generateasemail</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>key</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>templates</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>payment_by_date</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>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>scoreboard</name>
|
||||
<children>
|
||||
|
||||
@@ -48,6 +48,8 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
dispatch(setModalContext({ context: context, modal: "timeTicket" })),
|
||||
setPaymentContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "payment" })),
|
||||
setReportCenterContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: "reportCenter" })),
|
||||
signOutStart: () => dispatch(signOutStart()),
|
||||
});
|
||||
|
||||
@@ -59,6 +61,7 @@ function Header({
|
||||
setBillEnterContext,
|
||||
setTimeTicketContext,
|
||||
setPaymentContext,
|
||||
setReportCenterContext,
|
||||
recentItems,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
@@ -268,7 +271,17 @@ function Header({
|
||||
{t("menus.header.shop_templates")}
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
|
||||
<Menu.Item
|
||||
key="reportcenter"
|
||||
onClick={() => {
|
||||
setReportCenterContext({
|
||||
actions: {},
|
||||
context: {},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("menus.header.reportcenter")}
|
||||
</Menu.Item>
|
||||
<Menu.Item key="shop-vendors">
|
||||
<Link to="/manage/shop/vendors">
|
||||
{t("menus.header.shop_vendors")}
|
||||
|
||||
@@ -72,8 +72,16 @@ const renderTemplateList = (templates) => {
|
||||
<span className="imex-flex-row__margin">
|
||||
{templates.map((template, idx) => {
|
||||
if (idx === templates.length - 1)
|
||||
return TemplateListGenerated[template].title;
|
||||
return `${TemplateListGenerated[template].title}, `;
|
||||
return (
|
||||
(TemplateListGenerated[template] &&
|
||||
TemplateListGenerated[template].title) ||
|
||||
""
|
||||
);
|
||||
return `${
|
||||
(TemplateListGenerated[template] &&
|
||||
TemplateListGenerated[template].title) ||
|
||||
""
|
||||
}, `;
|
||||
})}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
import { Button, DatePicker, Form, Select, Switch } from "antd";
|
||||
import moment from "moment";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
|
||||
export default function ReportCenterModalComponent({ context }) {
|
||||
const [form] = Form.useForm();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const Templates = TemplateList("report_center");
|
||||
|
||||
const handleFinish = (values) => {
|
||||
const start = values.dates[0];
|
||||
const end = values.dates[1];
|
||||
console.log("values", values);
|
||||
GenerateDocument(
|
||||
{
|
||||
name: values.key,
|
||||
variables: {
|
||||
...(start ? { start: start } : {}),
|
||||
...(end ? { end: end } : {}),
|
||||
},
|
||||
},
|
||||
{
|
||||
to: values.to,
|
||||
},
|
||||
values.email ? "e" : "p"
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Form
|
||||
onFinish={handleFinish}
|
||||
autoComplete={"off"}
|
||||
layout="vertical"
|
||||
form={form}
|
||||
initialValues={{
|
||||
to: [
|
||||
"allan.carr@thinkimex.com",
|
||||
"allanlcarr@outlook.com",
|
||||
"allanlcarr@icloud.com",
|
||||
],
|
||||
}}
|
||||
>
|
||||
<Form.Item
|
||||
name="key"
|
||||
label={t("reportcenter.labels.key")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select>
|
||||
{Object.keys(Templates).map((key) => (
|
||||
<Select.Option key={key}>{Templates[key].title}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="dates"
|
||||
label={t("reportcenter.labels.dates")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="YYYY-MM-DD"
|
||||
ranges={{
|
||||
Today: [moment(), moment()],
|
||||
"Last 14 days": [moment().subtract(14, "days"), moment()],
|
||||
"Last 7 days": [moment().subtract(7, "days"), moment()],
|
||||
"Next 7 days": [moment(), moment().add(7, "days")],
|
||||
"Next 14 days": [moment(), moment().add(14, "days")],
|
||||
"Last Month": [
|
||||
moment().startOf("month").subtract(1, "month"),
|
||||
moment().startOf("month").subtract(1, "month").endOf("month"),
|
||||
],
|
||||
"This Month": [
|
||||
moment().startOf("month"),
|
||||
moment().endOf("month"),
|
||||
],
|
||||
"Next Month": [
|
||||
moment().startOf("month").add(1, "month"),
|
||||
moment().startOf("month").add(1, "month").endOf("month"),
|
||||
],
|
||||
"Last Quarter": [
|
||||
moment().startOf("quarter").subtract(1, "quarters"),
|
||||
moment().startOf("quarter").subtract(1, "day"),
|
||||
],
|
||||
"This Quarter": [
|
||||
moment().startOf("quarter"),
|
||||
moment()
|
||||
.startOf("quarter")
|
||||
.add(1, "quarter")
|
||||
.subtract(1, "day"),
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="email"
|
||||
label={t("reportcenter.labels.generateasemail")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
marginTop: "1rem",
|
||||
}}
|
||||
>
|
||||
<Button onClick={() => form.submit()} style={{}}>
|
||||
{t("reportcenter.actions.generate")}
|
||||
</Button>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Modal } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||
import { selectReportCenter } from "../../redux/modals/modals.selectors";
|
||||
import ReportCenterModalComponent from "./report-center-modal.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
reportCenterModal: selectReportCenter,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
toggleModalVisible: () => dispatch(toggleModalVisible("reportCenter")),
|
||||
});
|
||||
|
||||
export function ReportCenterModalContainer({
|
||||
reportCenterModal,
|
||||
toggleModalVisible,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { visible } = reportCenterModal;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
title={t("printcenter.labels.reportcentermodal")}
|
||||
onOk={() => toggleModalVisible()}
|
||||
cancelButtonProps={{ style: { display: "none" } }}
|
||||
destroyOnClose
|
||||
>
|
||||
<ReportCenterModalComponent />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ReportCenterModalContainer);
|
||||
@@ -80,6 +80,9 @@ const BillsListPage = lazy(() => import("../bills/bills.page.container"));
|
||||
const JobCostingModal = lazy(() =>
|
||||
import("../../components/job-costing-modal/job-costing-modal.container")
|
||||
);
|
||||
const ReportCenterModal = lazy(() =>
|
||||
import("../../components/report-center-modal/report-center-modal.container")
|
||||
);
|
||||
const BillEnterModalContainer = lazy(() =>
|
||||
import("../../components/bill-enter-modal/bill-enter-modal.container")
|
||||
);
|
||||
@@ -183,6 +186,7 @@ export function Manage({ match, conflict }) {
|
||||
<BreadCrumbs />
|
||||
<BillEnterModalContainer />
|
||||
<JobCostingModal />
|
||||
<ReportCenterModal />
|
||||
<EmailOverlayContainer />
|
||||
<TimeTicketModalContainer />
|
||||
<PrintCenterModalContainer />
|
||||
|
||||
@@ -20,12 +20,12 @@ const INITIAL_STATE = {
|
||||
reconciliation: { ...baseModal },
|
||||
payment: { ...baseModal },
|
||||
jobCosting: { ...baseModal },
|
||||
reportCenter: { ...baseModal },
|
||||
};
|
||||
|
||||
const modalsReducer = (state = INITIAL_STATE, action) => {
|
||||
switch (action.type) {
|
||||
case ModalsActionTypes.TOGGLE_MODAL_VISIBLE:
|
||||
//logImEXEvent("redux_toggle_modal_visible", { modal: action.payload });
|
||||
return {
|
||||
...state,
|
||||
[action.payload]: {
|
||||
@@ -34,8 +34,6 @@ const modalsReducer = (state = INITIAL_STATE, action) => {
|
||||
},
|
||||
};
|
||||
case ModalsActionTypes.SET_MODAL_CONTEXT:
|
||||
// logImEXEvent("redux_set_modal_context", { modal: action.payload.modal });
|
||||
|
||||
return {
|
||||
...state,
|
||||
[action.payload.modal]: {
|
||||
|
||||
@@ -55,3 +55,8 @@ export const selectJobCosting = createSelector(
|
||||
[selectModals],
|
||||
(modals) => modals.jobCosting
|
||||
);
|
||||
|
||||
export const selectReportCenter = createSelector(
|
||||
[selectModals],
|
||||
(modals) => modals.reportCenter
|
||||
);
|
||||
|
||||
@@ -1218,6 +1218,7 @@
|
||||
"productionboard": "Production Board - Visual",
|
||||
"productionlist": "Production Board - List",
|
||||
"recent": "Recent Items",
|
||||
"reportcenter": "Report Center",
|
||||
"schedule": "Schedule",
|
||||
"scoreboard": "Scoreboard",
|
||||
"search": {
|
||||
@@ -1492,6 +1493,19 @@
|
||||
"activeshop": "Active Shop"
|
||||
}
|
||||
},
|
||||
"reportcenter": {
|
||||
"actions": {
|
||||
"generate": "Generate"
|
||||
},
|
||||
"labels": {
|
||||
"dates": "Dates",
|
||||
"generateasemail": "Generate as Email?",
|
||||
"key": "Report"
|
||||
},
|
||||
"templates": {
|
||||
"payment_by_date": "Payments by Date Range"
|
||||
}
|
||||
},
|
||||
"scoreboard": {
|
||||
"actions": {
|
||||
"edit": "Edit"
|
||||
|
||||
@@ -1218,6 +1218,7 @@
|
||||
"productionboard": "",
|
||||
"productionlist": "",
|
||||
"recent": "",
|
||||
"reportcenter": "",
|
||||
"schedule": "Programar",
|
||||
"scoreboard": "",
|
||||
"search": {
|
||||
@@ -1492,6 +1493,19 @@
|
||||
"activeshop": ""
|
||||
}
|
||||
},
|
||||
"reportcenter": {
|
||||
"actions": {
|
||||
"generate": ""
|
||||
},
|
||||
"labels": {
|
||||
"dates": "",
|
||||
"generateasemail": "",
|
||||
"key": ""
|
||||
},
|
||||
"templates": {
|
||||
"payment_by_date": ""
|
||||
}
|
||||
},
|
||||
"scoreboard": {
|
||||
"actions": {
|
||||
"edit": ""
|
||||
|
||||
@@ -1218,6 +1218,7 @@
|
||||
"productionboard": "",
|
||||
"productionlist": "",
|
||||
"recent": "",
|
||||
"reportcenter": "",
|
||||
"schedule": "Programme",
|
||||
"scoreboard": "",
|
||||
"search": {
|
||||
@@ -1492,6 +1493,19 @@
|
||||
"activeshop": ""
|
||||
}
|
||||
},
|
||||
"reportcenter": {
|
||||
"actions": {
|
||||
"generate": ""
|
||||
},
|
||||
"labels": {
|
||||
"dates": "",
|
||||
"generateasemail": "",
|
||||
"key": ""
|
||||
},
|
||||
"templates": {
|
||||
"payment_by_date": ""
|
||||
}
|
||||
},
|
||||
"scoreboard": {
|
||||
"actions": {
|
||||
"edit": ""
|
||||
|
||||
@@ -136,6 +136,18 @@ export const TemplateList = (type, context) => {
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(!type || type === "job" ? {} : {}),
|
||||
...(!type || type === "report_center"
|
||||
? {
|
||||
payment_by_date: {
|
||||
title: i18n.t("reportcenter.templates.payment_by_date"),
|
||||
description: "Est Detail",
|
||||
subject: `${i18n.t("reportcenter.templates.payment_by_date")} - ${
|
||||
context && context.job && context.job.ro_number
|
||||
}`,
|
||||
key: "payment_by_date",
|
||||
disabled: false,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user