@@ -51,12 +51,23 @@ const Eula = ({currentEula, currentUser, acceptEula}) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const {accepted_terms, ...otherFormValues} = formValues;
|
const {accepted_terms, ...otherFormValues} = formValues;
|
||||||
|
|
||||||
|
// Trim the values of the fields before submitting
|
||||||
|
const trimmedFormValues = {
|
||||||
|
first_name: otherFormValues.first_name.trim(),
|
||||||
|
last_name: otherFormValues.last_name.trim(),
|
||||||
|
business_name: otherFormValues.business_name.trim(),
|
||||||
|
address: otherFormValues.address.trim(),
|
||||||
|
phone_number: otherFormValues.phone_number.trim(),
|
||||||
|
};
|
||||||
|
|
||||||
await insertEulaAcceptance({
|
await insertEulaAcceptance({
|
||||||
variables: {
|
variables: {
|
||||||
eulaAcceptance: {
|
eulaAcceptance: {
|
||||||
eulaid: eulaId,
|
eulaid: eulaId,
|
||||||
useremail,
|
useremail,
|
||||||
...otherFormValues,
|
...otherFormValues,
|
||||||
|
...trimmedFormValues,
|
||||||
date_accepted: new Date(),
|
date_accepted: new Date(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +112,7 @@ const Eula = ({currentEula, currentUser, acceptEula}) => {
|
|||||||
>
|
>
|
||||||
<Card type='inner' className='eula-markdown-card' onScroll={handleScroll} ref={markdownCardRef}>
|
<Card type='inner' className='eula-markdown-card' onScroll={handleScroll} ref={markdownCardRef}>
|
||||||
<div id='markdowndiv' className='eula-markdown-div'>
|
<div id='markdowndiv' className='eula-markdown-div'>
|
||||||
<Markdown children={currentEula?.content?.replace(/\\n/g, '\n')}/>
|
<Markdown children={currentEula?.content?.replace(/\\n|\\r|\\n\\r|\\r\\n/g, '\n')}/>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
import {useQuery} from "@apollo/client";
|
||||||
import { Col, Row } from "antd";
|
import {Col, Row} from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import React, { useMemo } from "react";
|
import React, {useMemo} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { QUERY_TIME_TICKETS_IN_RANGE_SB } from "../../graphql/timetickets.queries";
|
import {QUERY_TIME_TICKETS_IN_RANGE_SB} from "../../graphql/timetickets.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
|
||||||
@@ -27,8 +27,8 @@ export default connect(
|
|||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(ScoreboardTimeTicketsStats);
|
)(ScoreboardTimeTicketsStats);
|
||||||
|
|
||||||
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
export function ScoreboardTimeTicketsStats({bodyshop}) {
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const startDate = dayjs().startOf("month")
|
const startDate = dayjs().startOf("month")
|
||||||
const endDate = dayjs().endOf("month");
|
const endDate = dayjs().endOf("month");
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const { loading, error, data } = useQuery(QUERY_TIME_TICKETS_IN_RANGE_SB, {
|
const {loading, error, data} = useQuery(QUERY_TIME_TICKETS_IN_RANGE_SB, {
|
||||||
variables: {
|
variables: {
|
||||||
start: startDate.format("YYYY-MM-DD"),
|
start: startDate.format("YYYY-MM-DD"),
|
||||||
end: endDate.format("YYYY-MM-DD"),
|
end: endDate.format("YYYY-MM-DD"),
|
||||||
@@ -337,22 +337,23 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
lab.accHrs = acc_lab;
|
lab.accHrs = acc_lab;
|
||||||
lar.accHrs = acc_lar;
|
lar.accHrs = acc_lar;
|
||||||
|
|
||||||
combinedData.push({ ...r, ...combined });
|
combinedData.push({...r, ...combined});
|
||||||
labData.push({ ...r, ...lab });
|
labData.push({...r, ...lab});
|
||||||
larData.push({ ...r, ...lar });
|
larData.push({...r, ...lar});
|
||||||
});
|
});
|
||||||
|
|
||||||
const jobData = {};
|
const jobData = {};
|
||||||
|
|
||||||
data.jobs.forEach((job) => {
|
const dataJobs = data.jobs.map((job) => ({
|
||||||
job.tthrs = job.joblines.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
|
...job,
|
||||||
});
|
tthrs: job.joblines.reduce((acc, val) => acc + val.mod_lb_hrs, 0)
|
||||||
|
}));
|
||||||
|
|
||||||
jobData.tthrs = data.jobs
|
jobData.tthrs = dataJobs
|
||||||
.reduce((acc, val) => acc + val.tthrs, 0)
|
.reduce((acc, val) => acc + val.tthrs, 0)
|
||||||
.toFixed(1);
|
.toFixed(1);
|
||||||
|
|
||||||
jobData.count = data.jobs.length.toFixed(0);
|
jobData.count = dataJobs.length.toFixed(0);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fixed: ret,
|
fixed: ret,
|
||||||
@@ -363,12 +364,12 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
};
|
};
|
||||||
}, [fixedPeriods, data, bodyshop]);
|
}, [fixedPeriods, data, bodyshop]);
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||||
if (loading) return <LoadingSpinner />;
|
if (loading) return <LoadingSpinner/>;
|
||||||
return (
|
return (
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<ScoreboardTimeticketsTargetsTable />
|
<ScoreboardTimeticketsTargetsTable/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<ScoreboardTicketsStats
|
<ScoreboardTicketsStats
|
||||||
|
|||||||
Reference in New Issue
Block a user