Merged in release/2024-11-01 (pull request #1857)
Release/2024-11-01 into test-AIO - IO-2979-DST
This commit is contained in:
@@ -2,8 +2,6 @@ import { ApolloProvider } from "@apollo/client";
|
|||||||
import { SplitFactoryProvider, SplitSdk } from "@splitsoftware/splitio-react";
|
import { SplitFactoryProvider, SplitSdk } from "@splitsoftware/splitio-react";
|
||||||
import { ConfigProvider } from "antd";
|
import { ConfigProvider } from "antd";
|
||||||
import enLocale from "antd/es/locale/en_US";
|
import enLocale from "antd/es/locale/en_US";
|
||||||
import dayjs from "../utils/day";
|
|
||||||
import "dayjs/locale/en";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
|
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
|
||||||
@@ -19,8 +17,6 @@ if (import.meta.env.DEV) {
|
|||||||
Userpilot.initialize("NX-69145f08");
|
Userpilot.initialize("NX-69145f08");
|
||||||
}
|
}
|
||||||
|
|
||||||
dayjs.locale("en");
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
core: {
|
core: {
|
||||||
authorizationKey: import.meta.env.VITE_APP_SPLIT_API,
|
authorizationKey: import.meta.env.VITE_APP_SPLIT_API,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { INSERT_EULA_ACCEPTANCE } from "../../graphql/user.queries";
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { acceptEula } from "../../redux/user/user.actions";
|
import { acceptEula } from "../../redux/user/user.actions";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
|
|
||||||
import "./eula.styles.scss";
|
import "./eula.styles.scss";
|
||||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||||
@@ -208,7 +208,7 @@ const EulaFormComponent = ({ form, handleChange, onFinish, t }) => (
|
|||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
validator: (_, value) => {
|
validator: (_, value) => {
|
||||||
if (day(value).isSame(day(), "day")) {
|
if (dayjs(value).isSame(dayjs(), "day")) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error(t("eula.messages.date_accepted")));
|
return Promise.reject(new Error(t("eula.messages.date_accepted")));
|
||||||
|
|||||||
@@ -4,19 +4,37 @@ import React, { useCallback, useState } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import { fuzzyMatchDate } from "./formats.js";
|
import { fuzzyMatchDate } from "./formats.js";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors.js";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
const DateTimePicker = ({ value, onChange, onBlur, id, onlyFuture, onlyToday, isDateOnly = false, ...restProps }) => {
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop
|
||||||
|
});
|
||||||
|
|
||||||
|
const DateTimePicker = ({
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
onBlur,
|
||||||
|
id,
|
||||||
|
onlyFuture,
|
||||||
|
onlyToday,
|
||||||
|
isDateOnly = false,
|
||||||
|
bodyshop,
|
||||||
|
...restProps
|
||||||
|
}) => {
|
||||||
const [isManualInput, setIsManualInput] = useState(false);
|
const [isManualInput, setIsManualInput] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleChange = useCallback(
|
const handleChange = useCallback(
|
||||||
(newDate) => {
|
(newDate) => {
|
||||||
|
if (!newDate) return;
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(newDate || null);
|
onChange(bodyshop?.timezone ? dayjs(newDate).tz(bodyshop.timezone, true) : newDate);
|
||||||
}
|
}
|
||||||
setIsManualInput(false);
|
setIsManualInput(false);
|
||||||
},
|
},
|
||||||
[onChange]
|
[onChange, bodyshop?.timezone]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleBlur = useCallback(
|
const handleBlur = useCallback(
|
||||||
@@ -102,4 +120,4 @@ DateTimePicker.propTypes = {
|
|||||||
isDateOnly: PropTypes.bool
|
isDateOnly: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(DateTimePicker);
|
export default connect(mapStateToProps, null)(DateTimePicker);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useCallback, useEffect, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Badge, Card, Space, Table, Tag } from "antd";
|
import { Badge, Card, Space, Table, Tag } from "antd";
|
||||||
import { gql, useQuery } from "@apollo/client";
|
import { gql, useQuery } from "@apollo/client";
|
||||||
@@ -72,7 +72,7 @@ export function JobLifecycleComponent({ job, statuses, ...rest }) {
|
|||||||
dataIndex: "start",
|
dataIndex: "start",
|
||||||
key: "start",
|
key: "start",
|
||||||
render: (text) => DateTimeFormatterFunction(text),
|
render: (text) => DateTimeFormatterFunction(text),
|
||||||
sorter: (a, b) => day(a.start).unix() - day(b.start).unix()
|
sorter: (a, b) => dayjs(a.start).unix() - dayjs(b.start).unix()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("job_lifecycle.columns.relative_start"),
|
title: t("job_lifecycle.columns.relative_start"),
|
||||||
@@ -90,7 +90,7 @@ export function JobLifecycleComponent({ job, statuses, ...rest }) {
|
|||||||
}
|
}
|
||||||
return isEmpty(a.end) ? 1 : -1;
|
return isEmpty(a.end) ? 1 : -1;
|
||||||
}
|
}
|
||||||
return day(a.end).unix() - day(b.end).unix();
|
return dayjs(a.end).unix() - dayjs(b.end).unix();
|
||||||
},
|
},
|
||||||
render: (text) => (isEmpty(text) ? t("job_lifecycle.content.not_available") : DateTimeFormatterFunction(text))
|
render: (text) => (isEmpty(text) ? t("job_lifecycle.content.not_available") : DateTimeFormatterFunction(text))
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|||||||
|
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Form, notification, Popover, Select, Space } from "antd";
|
import { Button, Form, notification, Popover, Select, Space } from "antd";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
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";
|
||||||
@@ -48,7 +48,7 @@ export function JobLineDispatchButton({
|
|||||||
const result = await dispatchLines({
|
const result = await dispatchLines({
|
||||||
variables: {
|
variables: {
|
||||||
partsDispatch: {
|
partsDispatch: {
|
||||||
dispatched_at: day(),
|
dispatched_at: dayjs(),
|
||||||
employeeid: values.employeeid,
|
employeeid: values.employeeid,
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
dispatched_by: currentUser.email,
|
dispatched_by: currentUser.email,
|
||||||
@@ -138,7 +138,11 @@ export function JobLineDispatchButton({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover open={visible} content={popMenu}>
|
<Popover open={visible} content={popMenu}>
|
||||||
<Button disabled={selectedLines.length === 0 || jobRO || disabled} loading={loading} onClick={() => setVisible(true)}>
|
<Button
|
||||||
|
disabled={selectedLines.length === 0 || jobRO || disabled}
|
||||||
|
loading={loading}
|
||||||
|
onClick={() => setVisible(true)}
|
||||||
|
>
|
||||||
{t("joblines.actions.dispatchparts", { count: selectedLines.length })}
|
{t("joblines.actions.dispatchparts", { count: selectedLines.length })}
|
||||||
</Button>
|
</Button>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Card, Col, notification, Row, Table } from "antd";
|
import { Button, Card, Col, notification, Row, Table } from "antd";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { UPDATE_PARTS_DISPATCH_LINE } from "../../graphql/parts-dispatch.queries";
|
import { UPDATE_PARTS_DISPATCH_LINE } from "../../graphql/parts-dispatch.queries";
|
||||||
@@ -11,7 +11,7 @@ export default function PartsDispatchExpander({ dispatch, job }) {
|
|||||||
const [updateDispatchLine] = useMutation(UPDATE_PARTS_DISPATCH_LINE);
|
const [updateDispatchLine] = useMutation(UPDATE_PARTS_DISPATCH_LINE);
|
||||||
|
|
||||||
const handleAccept = async ({ partsDispatchLineId }) => {
|
const handleAccept = async ({ partsDispatchLineId }) => {
|
||||||
const accepted_at = day();
|
const accepted_at = dayjs();
|
||||||
const result = await updateDispatchLine({
|
const result = await updateDispatchLine({
|
||||||
variables: { id: partsDispatchLineId, line: { accepted_at } },
|
variables: { id: partsDispatchLineId, line: { accepted_at } },
|
||||||
optimisticResponse: {
|
optimisticResponse: {
|
||||||
|
|||||||
@@ -120,14 +120,6 @@ var formats = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const localizer = (dayjsLib) => {
|
const localizer = (dayjsLib) => {
|
||||||
// load dayjs plugins
|
|
||||||
dayjsLib.extend(isBetween);
|
|
||||||
dayjsLib.extend(isSameOrAfter);
|
|
||||||
dayjsLib.extend(isSameOrBefore);
|
|
||||||
dayjsLib.extend(localeData);
|
|
||||||
dayjsLib.extend(localizedFormat);
|
|
||||||
dayjsLib.extend(minMax);
|
|
||||||
dayjsLib.extend(utc);
|
|
||||||
var locale = function locale(dj, c) {
|
var locale = function locale(dj, c) {
|
||||||
return c ? dj.locale(c) : dj;
|
return c ? dj.locale(c) : dj;
|
||||||
};
|
};
|
||||||
@@ -136,7 +128,8 @@ const localizer = (dayjsLib) => {
|
|||||||
// then use the timezone aware version
|
// then use the timezone aware version
|
||||||
|
|
||||||
//TODO This was the issue entirely...
|
//TODO This was the issue entirely...
|
||||||
// var dayjs = dayjsLib.tz ? dayjsLib.tz : dayjsLib;
|
// var dayjs = dayjsLib.tz ? dayjsLib.tz : dayjsLib;
|
||||||
|
|
||||||
var dayjs = dayjsLib;
|
var dayjs = dayjsLib;
|
||||||
|
|
||||||
function getTimezoneOffset(date) {
|
function getTimezoneOffset(date) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
problemJobs: selectProblemJobs
|
problemJobs: selectProblemJobs
|
||||||
});
|
});
|
||||||
|
|
||||||
const localizer = local(dayjs);
|
const localizer = local(dayjs);
|
||||||
|
|
||||||
export function ScheduleCalendarWrapperComponent({
|
export function ScheduleCalendarWrapperComponent({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, notification } from "antd";
|
import { Button, notification } from "antd";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -29,7 +29,7 @@ export function TimeTicketsCommit({ bodyshop, currentUser, timeticket, disabled,
|
|||||||
? { commited_by: null, committed_at: null }
|
? { commited_by: null, committed_at: null }
|
||||||
: {
|
: {
|
||||||
commited_by: currentUser.email,
|
commited_by: currentUser.email,
|
||||||
committed_at: day()
|
committed_at: dayjs()
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await updateTimeTicket({
|
const result = await updateTimeTicket({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, notification } from "antd";
|
import { Button, notification } from "antd";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -34,7 +34,7 @@ export function TimeTicketsCommit({
|
|||||||
timeticketIds: timetickets.map((ticket) => ticket.id),
|
timeticketIds: timetickets.map((ticket) => ticket.id),
|
||||||
timeticket: {
|
timeticket: {
|
||||||
commited_by: currentUser.email,
|
commited_by: currentUser.email,
|
||||||
committed_at: day()
|
committed_at: dayjs()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update(cache) {
|
update(cache) {
|
||||||
@@ -47,7 +47,7 @@ export function TimeTicketsCommit({
|
|||||||
return {
|
return {
|
||||||
...ticket,
|
...ticket,
|
||||||
commited_by: currentUser.email,
|
commited_by: currentUser.email,
|
||||||
committed_at: day()
|
committed_at: dayjs()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return ticket;
|
return ticket;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useApolloClient } from "@apollo/client";
|
import { useApolloClient } from "@apollo/client";
|
||||||
import { Button, notification } from "antd";
|
import { Button, notification } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -49,7 +49,7 @@ export function TtApproveButton({
|
|||||||
})),
|
})),
|
||||||
approvalIds: selectedTickets,
|
approvalIds: selectedTickets,
|
||||||
approvalUpdate: {
|
approvalUpdate: {
|
||||||
approved_at: day(),
|
approved_at: dayjs(),
|
||||||
approved_by: currentUser.email
|
approved_by: currentUser.email
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import {
|
|||||||
} from "../../firebase/firebase.utils";
|
} from "../../firebase/firebase.utils";
|
||||||
import { QUERY_EULA } from "../../graphql/bodyshop.queries";
|
import { QUERY_EULA } from "../../graphql/bodyshop.queries";
|
||||||
import client from "../../utils/GraphQLClient";
|
import client from "../../utils/GraphQLClient";
|
||||||
import day from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
import {
|
import {
|
||||||
checkInstanceId,
|
checkInstanceId,
|
||||||
@@ -96,7 +96,7 @@ export function* isUserAuthenticated() {
|
|||||||
const eulaQuery = yield client.query({
|
const eulaQuery = yield client.query({
|
||||||
query: QUERY_EULA,
|
query: QUERY_EULA,
|
||||||
variables: {
|
variables: {
|
||||||
now: day()
|
now: dayjs()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -314,8 +314,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
|||||||
try {
|
try {
|
||||||
const userEmail = yield select((state) => state.user.currentUser.email);
|
const userEmail = yield select((state) => state.user.currentUser.email);
|
||||||
try {
|
try {
|
||||||
console.log("Setting shop timezone.");
|
dayjs.tz.setDefault(payload.timezone);
|
||||||
day.tz.setDefault(payload.timezone);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
import "dayjs/locale/en";
|
||||||
import dayjsBusinessDays from "dayjs-business-days2";
|
import dayjsBusinessDays from "dayjs-business-days2";
|
||||||
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
|
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
|
||||||
import updateLocale from "dayjs/plugin/updateLocale";
|
import updateLocale from "dayjs/plugin/updateLocale";
|
||||||
@@ -64,4 +65,6 @@ dayjs.extend(minMax);
|
|||||||
dayjs.extend(isBetween);
|
dayjs.extend(isBetween);
|
||||||
dayjs.extend(dayjsBusinessDays);
|
dayjs.extend(dayjsBusinessDays);
|
||||||
|
|
||||||
|
dayjs.locale("en");
|
||||||
|
|
||||||
export default dayjs;
|
export default dayjs;
|
||||||
|
|||||||
Reference in New Issue
Block a user