- progress update.

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-25 15:23:42 -05:00
parent 80483b617b
commit 461bc726aa
2 changed files with 382 additions and 370 deletions

View File

@@ -51,12 +51,23 @@ const Eula = ({currentEula, currentUser, acceptEula}) => {
try {
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({
variables: {
eulaAcceptance: {
eulaid: eulaId,
useremail,
...otherFormValues,
...trimmedFormValues,
date_accepted: new Date(),
}
}
@@ -101,7 +112,7 @@ const Eula = ({currentEula, currentUser, acceptEula}) => {
>
<Card type='inner' className='eula-markdown-card' onScroll={handleScroll} ref={markdownCardRef}>
<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>
</Card>

View File

@@ -1,13 +1,13 @@
import { useQuery } from "@apollo/client";
import { Col, Row } from "antd";
import {useQuery} from "@apollo/client";
import {Col, Row} from "antd";
import _ from "lodash";
import dayjs from "../../utils/day";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_TIME_TICKETS_IN_RANGE_SB } from "../../graphql/timetickets.queries";
import { selectBodyshop } from "../../redux/user/user.selectors";
import React, {useMemo} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {QUERY_TIME_TICKETS_IN_RANGE_SB} from "../../graphql/timetickets.queries";
import {selectBodyshop} from "../../redux/user/user.selectors";
import AlertComponent from "../alert/alert.component";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
@@ -27,8 +27,8 @@ export default connect(
mapDispatchToProps
)(ScoreboardTimeTicketsStats);
export function ScoreboardTimeTicketsStats({ bodyshop }) {
const { t } = useTranslation();
export function ScoreboardTimeTicketsStats({bodyshop}) {
const {t} = useTranslation();
const startDate = dayjs().startOf("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: {
start: startDate.format("YYYY-MM-DD"),
end: endDate.format("YYYY-MM-DD"),
@@ -337,22 +337,23 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
lab.accHrs = acc_lab;
lar.accHrs = acc_lar;
combinedData.push({ ...r, ...combined });
labData.push({ ...r, ...lab });
larData.push({ ...r, ...lar });
combinedData.push({...r, ...combined});
labData.push({...r, ...lab});
larData.push({...r, ...lar});
});
const jobData = {};
data.jobs.forEach((job) => {
job.tthrs = job.joblines.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
});
const dataJobs = data.jobs.map((job) => ({
...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)
.toFixed(1);
jobData.count = data.jobs.length.toFixed(0);
jobData.count = dataJobs.length.toFixed(0);
return {
fixed: ret,
@@ -363,12 +364,12 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
};
}, [fixedPeriods, data, bodyshop]);
if (error) return <AlertComponent message={error.message} type="error" />;
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error"/>;
if (loading) return <LoadingSpinner/>;
return (
<Row gutter={[16, 16]}>
<Col span={24}>
<ScoreboardTimeticketsTargetsTable />
<ScoreboardTimeticketsTargetsTable/>
</Col>
<Col span={24}>
<ScoreboardTicketsStats