Include analytics & new ES routes.
This commit is contained in:
@@ -35,6 +35,12 @@ export function App({ currentUser, checkUserSession, darkMode }) {
|
||||
checkUserSession();
|
||||
}, [checkUserSession]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentUser && currentUser.email) {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.setUserName, currentUser.email);
|
||||
}
|
||||
}, [currentUser]);
|
||||
|
||||
useEffect(() => {
|
||||
//
|
||||
return () => {
|
||||
|
||||
@@ -4,6 +4,9 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { queryReportingData } from "../../../redux/reporting/reporting.actions";
|
||||
import dayjs from "../../../util/day.js";
|
||||
import ipcTypes from "../../../ipc.types.js";
|
||||
import { range } from "lodash";
|
||||
const { ipcRenderer } = window;
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
});
|
||||
@@ -24,139 +27,169 @@ export function ReportingDatesMolecule({ queryReportingData }) {
|
||||
|
||||
return (
|
||||
<Form form={form} onFinish={handleFinish}>
|
||||
<Space wrap align="start">
|
||||
<Form.Item
|
||||
label="Ready for Payment Date Between"
|
||||
name="dateRange"
|
||||
rules={[
|
||||
{ type: "array", required: true },
|
||||
{
|
||||
validator(rule, value) {
|
||||
if (!value || !value.length === 2) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
<Space wrap align="baseline">
|
||||
<Space wrap align="start">
|
||||
<Form.Item
|
||||
label="Ready for Payment Date Between"
|
||||
name="dateRange"
|
||||
rules={[
|
||||
{ type: "array", required: true },
|
||||
{
|
||||
validator(rule, value) {
|
||||
if (!value || !value.length === 2) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (dayjs(value[1]).diff(dayjs(value[0]), "years", true) > 1) {
|
||||
return Promise.reject("Time period exceeds 1 year. Please select a shorter date range.");
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
if (dayjs(value[1]).diff(dayjs(value[0]), "years", true) > 1) {
|
||||
return Promise.reject("Time period exceeds 1 year. Please select a shorter date range.");
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="MM/DD/YYYY"
|
||||
ranges={{
|
||||
"Last Month": [
|
||||
dayjs().startOf("month").subtract(1, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
],
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="MM/DD/YYYY"
|
||||
ranges={{
|
||||
"Last Month": [
|
||||
dayjs().startOf("month").subtract(1, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
],
|
||||
|
||||
"This Month": [dayjs().startOf("month"), dayjs().endOf("month")],
|
||||
"Next Month": [
|
||||
dayjs().startOf("month").add(1, "month"),
|
||||
dayjs().startOf("month").add(1, "month").endOf("month")
|
||||
],
|
||||
"Last Quarter": [
|
||||
dayjs().startOf("quarter").subtract(1, "quarter"),
|
||||
dayjs().startOf("quarter").subtract(1, "day")
|
||||
],
|
||||
"This Quarter": [
|
||||
dayjs().startOf("quarter"),
|
||||
dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day")
|
||||
],
|
||||
"Last 3 Months (Exlcusive)": [
|
||||
dayjs().startOf("month").subtract(3, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
],
|
||||
"Last 3 Months (Inclusive)": [dayjs().startOf("month").subtract(2, "month"), dayjs().endOf("month")]
|
||||
"This Month": [dayjs().startOf("month"), dayjs().endOf("month")],
|
||||
"Next Month": [
|
||||
dayjs().startOf("month").add(1, "month"),
|
||||
dayjs().startOf("month").add(1, "month").endOf("month")
|
||||
],
|
||||
"Last Quarter": [
|
||||
dayjs().startOf("quarter").subtract(1, "quarter"),
|
||||
dayjs().startOf("quarter").subtract(1, "day")
|
||||
],
|
||||
"This Quarter": [
|
||||
dayjs().startOf("quarter"),
|
||||
dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day")
|
||||
],
|
||||
"Last 3 Months (Exlcusive)": [
|
||||
dayjs().startOf("month").subtract(3, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
],
|
||||
"Last 3 Months (Inclusive)": [dayjs().startOf("month").subtract(2, "month"), dayjs().endOf("month")]
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit">
|
||||
Run Search
|
||||
</Button>
|
||||
</Space>
|
||||
<Space align="baseline" wrap>
|
||||
<Typography.Title level={5}>Quick Ranges:</Typography.Title>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "Last Month"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("month").subtract(1, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
]
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit">
|
||||
Run Search
|
||||
</Button>
|
||||
</Space>
|
||||
<Space align="baseline" wrap>
|
||||
<Typography.Title level={5}>Quick Ranges:</Typography.Title>
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("month").subtract(1, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
]
|
||||
})
|
||||
}
|
||||
>
|
||||
Last Month
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [dayjs().startOf("month"), dayjs().endOf("month")]
|
||||
})
|
||||
}
|
||||
>
|
||||
This Month
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("month").add(1, "month"),
|
||||
dayjs().startOf("month").add(1, "month").endOf("month")
|
||||
]
|
||||
})
|
||||
}
|
||||
>
|
||||
Next Month
|
||||
</Button>
|
||||
<Divider type="vertical" />
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("month").subtract(3, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
]
|
||||
})
|
||||
}
|
||||
>
|
||||
Last 3 Months (Exclusive)
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [dayjs().startOf("month").subtract(2, "month"), dayjs().endOf("month")]
|
||||
})
|
||||
}
|
||||
>
|
||||
Last 3 Months (Inclusive)
|
||||
</Button>
|
||||
<Divider type="vertical" />
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("quarter").subtract(1, "quarter"),
|
||||
dayjs().startOf("quarter").subtract(1, "day")
|
||||
]
|
||||
})
|
||||
}
|
||||
>
|
||||
Last Quarter
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleFinish({
|
||||
dateRange: [dayjs().startOf("quarter"), dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day")]
|
||||
})
|
||||
}
|
||||
>
|
||||
This Quarter
|
||||
</Button>
|
||||
>
|
||||
Last Month
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "This Month"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [dayjs().startOf("month"), dayjs().endOf("month")]
|
||||
});
|
||||
}}
|
||||
>
|
||||
This Month
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "Next Month"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("month").add(1, "month"),
|
||||
dayjs().startOf("month").add(1, "month").endOf("month")
|
||||
]
|
||||
});
|
||||
}}
|
||||
>
|
||||
Next Month
|
||||
</Button>
|
||||
<Divider type="vertical" />
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "3 Months Exclusive"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("month").subtract(3, "month"),
|
||||
dayjs().startOf("month").subtract(1, "month").endOf("month")
|
||||
]
|
||||
});
|
||||
}}
|
||||
>
|
||||
Last 3 Months (Exclusive)
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "3 Months Inclusive"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [dayjs().startOf("month").subtract(2, "month"), dayjs().endOf("month")]
|
||||
});
|
||||
}}
|
||||
>
|
||||
Last 3 Months (Inclusive)
|
||||
</Button>
|
||||
<Divider type="vertical" />
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "Last Quarter"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [
|
||||
dayjs().startOf("quarter").subtract(1, "quarter"),
|
||||
dayjs().startOf("quarter").subtract(1, "day")
|
||||
]
|
||||
});
|
||||
}}
|
||||
>
|
||||
Last Quarter
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "REPORT_QUICK_DATE_RANGE",
|
||||
range: "This Quarter"
|
||||
});
|
||||
handleFinish({
|
||||
dateRange: [dayjs().startOf("quarter"), dayjs().startOf("quarter").add(1, "quarter").subtract(1, "day")]
|
||||
});
|
||||
}}
|
||||
>
|
||||
This Quarter
|
||||
</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -185,6 +185,9 @@ export function ReportingJobsListMolecule({
|
||||
checked={excludedIds.includes(record.id)}
|
||||
onChange={(checked) => {
|
||||
checked ? addExcludedId(record.id) : removeExcludedId(record.id);
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "TOGGLE_SCENARIO_MANAGER",
|
||||
});
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -56,7 +56,9 @@ export function AuditPage({ auditError, queryReportingData, bodyshop, reportingE
|
||||
};
|
||||
|
||||
const handleRunAudit = async ({ sheetName, dateRange }) => {
|
||||
console.log("🚀 ~ handleRunAudit ~ sheetName:", sheetName);
|
||||
ipcRenderer.send(ipcTypes.app.toMain.track, {
|
||||
event: "RUN_AUDIT"
|
||||
});
|
||||
ipcRenderer.send(ipcTypes.audit.toMain.runAudit, { sheetName });
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user