Added log rocket + analytics to ensure functionality
This commit is contained in:
@@ -5,18 +5,24 @@ import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { DELETE_JOB } from "../../../graphql/jobs.queries";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { setSelectedJobId } from "../../../redux/application/application.actions";
|
||||
const { ipcRenderer } = window;
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setSelectedJobId: (id) => dispatch(setSelectedJobId(id)),
|
||||
});
|
||||
|
||||
export function DeleteJobAtom({ setSelectedJobId, jobId }) {
|
||||
const [deleteJob] = useMutation(DELETE_JOB);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const handleDelete = async () => {
|
||||
setLoading(true);
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "DELETE_JOB",
|
||||
});
|
||||
const result = await deleteJob({
|
||||
variables: { jobId: jobId },
|
||||
});
|
||||
|
||||
@@ -2,13 +2,20 @@ import { useMutation } from "@apollo/client";
|
||||
import { message, Switch } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { UPDATE_JOB_LINE } from "../../../graphql/joblines.queries";
|
||||
const { log } = window;
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
const { log, ipcRenderer } = window;
|
||||
|
||||
export default function IgnoreJobLineAtom({ ignore, lineId }) {
|
||||
export default function IgnoreJobLineAtom({ ignore, lineId, line_desc }) {
|
||||
const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const handleChange = async (checked) => {
|
||||
setLoading(true);
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "TOGGLE_IGNORE_LINE",
|
||||
line_desc: line_desc,
|
||||
ignore: checked,
|
||||
});
|
||||
|
||||
const result = await updateJobLine({
|
||||
variables: { lineId: lineId, line: { ignore: checked } },
|
||||
});
|
||||
|
||||
@@ -5,7 +5,10 @@ import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { UPDATE_JOB } from "../../../graphql/jobs.queries";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { selectBodyshop } from "../../../redux/user/user.selectors";
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -15,11 +18,17 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobGroupMolecule);
|
||||
|
||||
export function JobGroupMolecule({ bodyshop, jobId, group }) {
|
||||
export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
|
||||
const handleMenuClick = async (value) => {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "CHANGE_VEHICLE_GROUP",
|
||||
vehicle: `${job.v_model_yr} ${job.v_makedesc} ${job.v_model} (${job.v_type})`,
|
||||
oldGroup: group,
|
||||
newGroup: value.key,
|
||||
});
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: { jobId: jobId, job: { group: value.key } },
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) {
|
||||
<CurrencyFormatterAtom>{job.clm_total}</CurrencyFormatterAtom>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="Group">
|
||||
<JobGroupMolecule jobId={job.id} group={job.group} />
|
||||
<JobGroupMolecule jobId={job.id} group={job.group} job={job} />
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="Age">{job.v_age}</Descriptions.Item>
|
||||
<Descriptions.Item label="Close Date">
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { Input, Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { alphaSort } from "../../../util/sorters";
|
||||
import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-formatter.atom";
|
||||
import IgnoreJobLine from "../../atoms/ignore-job-line/ignore-job-line.atom";
|
||||
import partTypeConverterAtom from "../../atoms/part-type-converter/part-type-converter.atom";
|
||||
import PriceDiffPcFormatterAtom from "../../atoms/price-diff-pc-formatter/price-diff-pc-formatter.atom";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
export default function JobLinesTableMolecule({ loading, job }) {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
@@ -92,7 +95,11 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
],
|
||||
onFilter: (value, record) => value === record.ignore,
|
||||
render: (text, record) => (
|
||||
<IgnoreJobLine lineId={record.id} ignore={record.ignore} />
|
||||
<IgnoreJobLine
|
||||
lineId={record.id}
|
||||
ignore={record.ignore}
|
||||
line_desc={record.line_desc}
|
||||
/>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -111,6 +118,10 @@ export default function JobLinesTableMolecule({ loading, job }) {
|
||||
<Input.Search
|
||||
placeholder="Search"
|
||||
onSearch={(val) => {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "JOB_LINES_SEARCH",
|
||||
query: val,
|
||||
});
|
||||
setSearchText(val);
|
||||
}}
|
||||
enterButton
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import { SearchOutlined } from "@ant-design/icons";
|
||||
import { Button, DatePicker, Form, Input } from "antd";
|
||||
import React from "react";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
const { ipcRenderer } = window;
|
||||
export default function JobsSearchFieldsMolecule({ callSearchQuery }) {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleFinish = (values) => {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "SEARCH_JOBS",
|
||||
query: values.search,
|
||||
datesIncluded: !!values.dateRange,
|
||||
});
|
||||
callSearchQuery({
|
||||
variables: {
|
||||
search: values.search || "",
|
||||
|
||||
@@ -18,7 +18,6 @@ export function ReportingDatesMolecule({ queryReportingData }) {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleFinish = (values) => {
|
||||
console.log("values", values);
|
||||
queryReportingData({
|
||||
startDate: values.dateRange[0],
|
||||
endDate: values.dateRange[1],
|
||||
|
||||
@@ -9,7 +9,6 @@ export default function ShopSettingsFormMolecule({ form, saveLoading }) {
|
||||
form.getFieldValue("groups") || []
|
||||
);
|
||||
const handleBlur = () => {
|
||||
console.log(form.getFieldValue("groups") || []);
|
||||
setGroupOptions(form.getFieldValue("groups") || []);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import React, { useEffect, useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { QUERY_BODYSHOP, UPDATE_SHOP } from "../../../graphql/bodyshop.queries";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { setBodyshop } from "../../../redux/user/user.actions";
|
||||
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
|
||||
import ShopSettingsFormMolecule from "../../molecules/shop-settings-form/shop-settings-form.molecule";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
});
|
||||
@@ -15,10 +16,6 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
setBodyshop: (shop) => dispatch(setBodyshop(shop)),
|
||||
});
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ShopSettingsOrganism);
|
||||
|
||||
export function ShopSettingsOrganism({ setBodyshop }) {
|
||||
const { loading, error, data } = useQuery(QUERY_BODYSHOP);
|
||||
@@ -32,6 +29,9 @@ export function ShopSettingsOrganism({ setBodyshop }) {
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
setSaveLoading(true);
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "UPDATE_SHOP_DETAILS",
|
||||
});
|
||||
|
||||
const result = await updateBodyshop({
|
||||
variables: { id: data.bodyshops[0].id, shop: values },
|
||||
@@ -70,3 +70,8 @@ export function ShopSettingsOrganism({ setBodyshop }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ShopSettingsOrganism);
|
||||
|
||||
@@ -5,8 +5,10 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import ImEXOnlineLogo from "../../../assets/logo192.png";
|
||||
import { emailSignInStart } from "../../../redux/user/user.actions";
|
||||
import { sendPasswordReset } from "../../../redux/user/user.actions";
|
||||
import {
|
||||
selectLoginLoading,
|
||||
selectPasswordReset,
|
||||
selectSignInError,
|
||||
} from "../../../redux/user/user.selectors";
|
||||
import "./sign-in.page.styles.scss";
|
||||
@@ -14,20 +16,33 @@ import "./sign-in.page.styles.scss";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
signInError: selectSignInError,
|
||||
loginLoading: selectLoginLoading,
|
||||
passwordReset: selectPasswordReset,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
emailSignInStart: (email, password) =>
|
||||
dispatch(emailSignInStart({ email, password })),
|
||||
sendPasswordReset: (email) => dispatch(sendPasswordReset(email)),
|
||||
});
|
||||
|
||||
export function SignInPage({ emailSignInStart, signInError, loginLoading }) {
|
||||
export function SignInPage({
|
||||
emailSignInStart,
|
||||
signInError,
|
||||
loginLoading,
|
||||
sendPasswordReset,
|
||||
passwordReset,
|
||||
}) {
|
||||
const handleFinish = (values) => {
|
||||
const { email, password } = values;
|
||||
emailSignInStart(email, password);
|
||||
};
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleReset = () => {
|
||||
const email = form.getFieldValue("email");
|
||||
sendPasswordReset(email);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="login-container">
|
||||
<div className="login-logo-container">
|
||||
@@ -35,10 +50,16 @@ export function SignInPage({ emailSignInStart, signInError, loginLoading }) {
|
||||
<Typography.Title>ImEX RPS</Typography.Title>
|
||||
</div>
|
||||
<Form onFinish={handleFinish} form={form} size="large">
|
||||
<Form.Item name="email" rules={[{ required: true }]}>
|
||||
<Form.Item
|
||||
name="email"
|
||||
rules={[{ required: true, message: "Please enter a valid email." }]}
|
||||
>
|
||||
<Input prefix={<UserOutlined />} placeholder="Email" />
|
||||
</Form.Item>
|
||||
<Form.Item name="password" rules={[{ required: true }]}>
|
||||
<Form.Item
|
||||
name="password"
|
||||
rules={[{ required: true, message: "Please enter your password." }]}
|
||||
>
|
||||
<Input
|
||||
prefix={<LockOutlined />}
|
||||
type="password"
|
||||
@@ -46,7 +67,7 @@ export function SignInPage({ emailSignInStart, signInError, loginLoading }) {
|
||||
/>
|
||||
</Form.Item>
|
||||
{signInError ? (
|
||||
<Alert type="error" message={signInError.message} />
|
||||
<Alert type="error" message={signInError.messagePretty} />
|
||||
) : null}
|
||||
<Button
|
||||
className="login-btn"
|
||||
@@ -56,7 +77,21 @@ export function SignInPage({ emailSignInStart, signInError, loginLoading }) {
|
||||
>
|
||||
Login
|
||||
</Button>
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
return (
|
||||
<Button
|
||||
className="login-btn"
|
||||
disabled={!form.getFieldValue("email")}
|
||||
onClick={handleReset}
|
||||
>
|
||||
Reset Password
|
||||
</Button>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{passwordReset.error && <div>{passwordReset.error}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user