This is a breaking change, moment is no longer with us, let us have a dayjs of silence.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {useMutation, useQuery} from "@apollo/client";
|
||||
import {Button, Form, Popconfirm, Space} from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, {useState} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
@@ -240,7 +240,7 @@ const transformData = (data) => {
|
||||
},
|
||||
};
|
||||
}),
|
||||
date: data.bills_by_pk ? moment(data.bills_by_pk.date) : null,
|
||||
date: data.bills_by_pk ? dayjs(data.bills_by_pk.date) : null,
|
||||
}
|
||||
: {};
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
Switch,
|
||||
Upload,
|
||||
} from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MdOpenInNew } from "react-icons/md";
|
||||
@@ -274,17 +274,17 @@ export function BillFormComponent({
|
||||
bodyshop.accountingconfig.ClosingPeriod
|
||||
) {
|
||||
if (
|
||||
moment(value)
|
||||
dayjs(value)
|
||||
.startOf("day")
|
||||
.isSameOrAfter(
|
||||
moment(
|
||||
dayjs(
|
||||
bodyshop.accountingconfig.ClosingPeriod[0]
|
||||
).startOf("day")
|
||||
) &&
|
||||
moment(value)
|
||||
dayjs(value)
|
||||
.startOf("day")
|
||||
.isSameOrBefore(
|
||||
moment(
|
||||
dayjs(
|
||||
bodyshop.accountingconfig.ClosingPeriod[1]
|
||||
).endOf("day")
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FileAddFilled } from "@ant-design/icons";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, notification, Tooltip } from "antd";
|
||||
import { t } from "i18next";
|
||||
import moment from "moment";
|
||||
import dayjs from "./../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -49,7 +49,7 @@ export function BilllineAddInventory({
|
||||
jobid: jobid,
|
||||
isinhouse: true,
|
||||
is_credit_memo: true,
|
||||
date: moment().format("YYYY-MM-DD"),
|
||||
date: dayjs().format("YYYY-MM-DD"),
|
||||
federal_tax_rate: bodyshop.bill_tax_rates.federal_tax_rate,
|
||||
state_tax_rate: bodyshop.bill_tax_rates.state_tax_rate,
|
||||
local_tax_rate: bodyshop.bill_tax_rates.local_tax_rate,
|
||||
@@ -91,7 +91,7 @@ export function BilllineAddInventory({
|
||||
pol: {
|
||||
returnfrombill: billid,
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
deliver_by: moment().format("YYYY-MM-DD"),
|
||||
deliver_by: dayjs().format("YYYY-MM-DD"),
|
||||
parts_order_lines: {
|
||||
data: [
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
notification,
|
||||
} from "antd";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -117,7 +117,7 @@ const CardPaymentModalComponent = ({
|
||||
payer: t("payments.labels.customer"),
|
||||
type: values.paymentResponse.cardbrand,
|
||||
jobid: payment.jobid,
|
||||
date: moment(Date.now()),
|
||||
date: dayjs(Date.now()),
|
||||
payment_responses: {
|
||||
data: [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Icon from "@ant-design/icons";
|
||||
import { Tooltip } from "antd";
|
||||
import i18n from "i18next";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { MdDone, MdDoneAll } from "react-icons/md";
|
||||
import {
|
||||
@@ -52,7 +52,7 @@ export default function ChatMessageListComponent({ messages }) {
|
||||
<div style={{ fontSize: 10 }}>
|
||||
{i18n.t("messaging.labels.sentby", {
|
||||
by: messages[index].userid,
|
||||
time: moment(messages[index].created_at).format(
|
||||
time: dayjs(messages[index].created_at).format(
|
||||
"MM/DD/YYYY @ hh:mm a"
|
||||
),
|
||||
})}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { QUERY_AVAILABLE_CC } from "../../graphql/courtesy-car.queries";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
@@ -7,7 +7,7 @@ import ContractCarsComponent from "./contract-cars.component";
|
||||
|
||||
export default function ContractCarsContainer({ selectedCarState, form }) {
|
||||
const { loading, error, data } = useQuery(QUERY_AVAILABLE_CC, {
|
||||
variables: { today: moment().format("YYYY-MM-DD") },
|
||||
variables: { today: dayjs().format("YYYY-MM-DD") },
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Space,
|
||||
} from "antd";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -46,8 +46,8 @@ export function ContractConvertToRo({
|
||||
const handleFinish = async (values) => {
|
||||
setLoading(true);
|
||||
|
||||
const contractLength = moment(contract.actualreturn).diff(
|
||||
moment(contract.start),
|
||||
const contractLength = dayjs(contract.actualreturn).diff(
|
||||
dayjs(contract.start),
|
||||
"days"
|
||||
);
|
||||
const billingLines = [];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { WarningFilled } from "@ant-design/icons";
|
||||
import { Form, Input, InputNumber, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
@@ -96,8 +96,8 @@ export default function ContractFormComponent({
|
||||
const dueForService =
|
||||
selectedCar &&
|
||||
selectedCar.nextservicedate &&
|
||||
moment(selectedCar.nextservicedate).isBefore(
|
||||
moment(form.getFieldValue("scheduledreturn"))
|
||||
dayjs(selectedCar.nextservicedate).isBefore(
|
||||
dayjs(form.getFieldValue("scheduledreturn"))
|
||||
);
|
||||
|
||||
if (mileageOver || dueForService)
|
||||
@@ -190,9 +190,9 @@ export default function ContractFormComponent({
|
||||
}
|
||||
>
|
||||
{() => {
|
||||
const dlExpiresBeforeReturn = moment(
|
||||
const dlExpiresBeforeReturn = dayjs(
|
||||
form.getFieldValue("driver_dlexpiry")
|
||||
).isBefore(moment(form.getFieldValue("scheduledreturn")));
|
||||
).isBefore(dayjs(form.getFieldValue("scheduledreturn")));
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, Input, Modal, Typography } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import aamva from "../../utils/aamva";
|
||||
@@ -26,8 +26,8 @@ export default function ContractLicenseDecodeButton({ form }) {
|
||||
|
||||
const values = {
|
||||
driver_dlnumber: decodedBarcode.dl,
|
||||
driver_dlexpiry: moment(
|
||||
`20${decodedBarcode.expiration_date}${moment(
|
||||
driver_dlexpiry: dayjs(
|
||||
`20${decodedBarcode.expiration_date}${dayjs(
|
||||
decodedBarcode.birthday
|
||||
).format("DD")}`
|
||||
),
|
||||
@@ -38,7 +38,7 @@ export default function ContractLicenseDecodeButton({ form }) {
|
||||
driver_city: decodedBarcode.city,
|
||||
driver_state: decodedBarcode.state,
|
||||
driver_zip: decodedBarcode.postal_code,
|
||||
driver_dob: moment(decodedBarcode.birthday),
|
||||
driver_dob: dayjs(decodedBarcode.birthday),
|
||||
};
|
||||
|
||||
form.setFieldsValue(values);
|
||||
@@ -94,14 +94,14 @@ export default function ContractLicenseDecodeButton({ form }) {
|
||||
{decodedBarcode.address}
|
||||
</DataLabel>
|
||||
<DataLabel label={t("contracts.fields.driver_dlexpiry")}>
|
||||
{moment(
|
||||
`20${decodedBarcode.expiration_date}${moment(
|
||||
{dayjs(
|
||||
`20${decodedBarcode.expiration_date}${dayjs(
|
||||
decodedBarcode.birthday
|
||||
).format("DD")}`
|
||||
).format("MM/DD/YYYY")}
|
||||
</DataLabel>
|
||||
<DataLabel label={t("contracts.fields.driver_dob")}>
|
||||
{moment(decodedBarcode.birthday).format("MM/DD/YYYY")}
|
||||
{dayjs(decodedBarcode.birthday).format("MM/DD/YYYY")}
|
||||
</DataLabel>
|
||||
<div>
|
||||
<Typography.Title level={4}>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import ContractsFindModalContainer from "../contracts-find-modal/contracts-find-modal.container";
|
||||
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
@@ -152,8 +152,8 @@ export function ContractsList({
|
||||
render: (text, record) =>
|
||||
(record.actualreturn &&
|
||||
record.start &&
|
||||
`${moment(record.actualreturn)
|
||||
.diff(moment(record.start), "days", true)
|
||||
`${dayjs(record.actualreturn)
|
||||
.diff(dayjs(record.start), "days", true)
|
||||
.toFixed(1)} days`) ||
|
||||
"",
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import { WarningFilled } from "@ant-design/icons";
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { Button, Form, Input, InputNumber, Space } from "antd";
|
||||
import {PageHeader} from "@ant-design/pro-layout";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { CHECK_CC_FLEET_NUMBER } from "../../graphql/courtesy-car.queries";
|
||||
@@ -259,7 +259,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
||||
const nextservicedate = form.getFieldValue("nextservicedate");
|
||||
const dueForService =
|
||||
nextservicedate &&
|
||||
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
|
||||
dayjs(nextservicedate).endOf("day").isSameOrBefore(dayjs());
|
||||
|
||||
if (dueForService)
|
||||
return (
|
||||
@@ -300,7 +300,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
||||
const expires = form.getFieldValue("registrationexpires");
|
||||
|
||||
const dateover =
|
||||
expires && moment(expires).endOf("day").isBefore(moment());
|
||||
expires && dayjs(expires).endOf("day").isBefore(dayjs());
|
||||
|
||||
if (dateover)
|
||||
return (
|
||||
@@ -336,7 +336,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
||||
const expires = form.getFieldValue("insuranceexpires");
|
||||
|
||||
const dateover =
|
||||
expires && moment(expires).endOf("day").isBefore(moment());
|
||||
expires && dayjs(expires).endOf("day").isBefore(dayjs());
|
||||
|
||||
if (dateover)
|
||||
return (
|
||||
|
||||
@@ -7,7 +7,7 @@ import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||
import { selectCourtesyCarReturn } from "../../redux/modals/modals.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CourtesyCarReturnModalComponent from "./courtesy-car-return-modal.component";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { RETURN_CONTRACT } from "../../graphql/cccontracts.queries";
|
||||
import { useMutation } from "@apollo/client";
|
||||
|
||||
@@ -74,7 +74,7 @@ export function CCReturnModalContainer({
|
||||
<Form
|
||||
form={form}
|
||||
onFinish={handleFinish}
|
||||
initialValues={{ fuel: 100, actualreturn: moment(new Date()) }}
|
||||
initialValues={{ fuel: 100, actualreturn: dayjs(new Date()) }}
|
||||
>
|
||||
<CourtesyCarReturnModalComponent />
|
||||
</Form>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Table,
|
||||
Tooltip,
|
||||
} from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -77,7 +77,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
||||
const mileageOver = nextservicekm <= mileage;
|
||||
|
||||
const dueForService =
|
||||
nextservicedate && moment(nextservicedate).isBefore(moment());
|
||||
nextservicedate && dayjs(nextservicedate).isBefore(dayjs());
|
||||
|
||||
return (
|
||||
<Space>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Card } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
@@ -27,7 +27,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
|
||||
return <DashboardRefreshRequired {...cardProps} />;
|
||||
|
||||
const ticketsByDate = _.groupBy(data.monthly_employee_efficiency, (item) =>
|
||||
moment(item.date).format("YYYY-MM-DD")
|
||||
dayjs(item.date).format("YYYY-MM-DD")
|
||||
);
|
||||
|
||||
const listOfDays = Utils.ListOfDaysInCurrentMonth();
|
||||
@@ -53,7 +53,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
|
||||
((dailyHrs.productive - dailyHrs.actual) / dailyHrs.actual + 1) * 100;
|
||||
|
||||
const theValue = {
|
||||
date: moment(val).format("DD"),
|
||||
date: dayjs(val).format("DD"),
|
||||
// ...dailyHrs,
|
||||
actual: dailyHrs.actual.toFixed(1),
|
||||
productive: dailyHrs.productive.toFixed(1),
|
||||
@@ -159,9 +159,9 @@ export default function DashboardMonthlyEmployeeEfficiency({
|
||||
}
|
||||
|
||||
export const DashboardMonthlyEmployeeEfficiencyGql = `
|
||||
monthly_employee_efficiency: timetickets(where: {_and: [{date: {_gte: "${moment()
|
||||
monthly_employee_efficiency: timetickets(where: {_and: [{date: {_gte: "${dayjs()
|
||||
.startOf("month")
|
||||
.format("YYYY-MM-DD")}"}},{date: {_lte: "${moment()
|
||||
.format("YYYY-MM-DD")}"}},{date: {_lte: "${dayjs()
|
||||
.endOf("month")
|
||||
.format("YYYY-MM-DD")}"}} ]}) {
|
||||
actualhrs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Card } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import _ from "lodash";
|
||||
@@ -24,7 +24,7 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
|
||||
if (!data.monthly_sales) return <DashboardRefreshRequired {...cardProps} />;
|
||||
|
||||
const jobsByDate = _.groupBy(data.monthly_sales, (item) =>
|
||||
moment(item.date_invoiced).format("YYYY-MM-DD")
|
||||
dayjs(item.date_invoiced).format("YYYY-MM-DD")
|
||||
);
|
||||
|
||||
const listOfDays = Utils.ListOfDaysInCurrentMonth();
|
||||
@@ -43,7 +43,7 @@ export default function DashboardMonthlyRevenueGraph({ data, ...cardProps }) {
|
||||
}
|
||||
|
||||
const theValue = {
|
||||
date: moment(val).format("DD"),
|
||||
date: dayjs(val).format("DD"),
|
||||
dailySales: dailySales.getAmount() / 100,
|
||||
accSales:
|
||||
acc.length > 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Card, Statistic } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import DashboardRefreshRequired from "../refresh-required.component";
|
||||
@@ -36,10 +36,10 @@ export const DashboardProjectedMonthlySalesGql = `
|
||||
_or: [
|
||||
{_and: [
|
||||
{date_invoiced:{_is_null: false }},
|
||||
{date_invoiced: {_gte: "${moment()
|
||||
{date_invoiced: {_gte: "${dayjs()
|
||||
.startOf("month")
|
||||
.startOf("day")
|
||||
.toISOString()}"}}, {date_invoiced: {_lte: "${moment()
|
||||
.toISOString()}"}}, {date_invoiced: {_lte: "${dayjs()
|
||||
.endOf("month")
|
||||
.endOf("day")
|
||||
.toISOString()}"}}]},
|
||||
@@ -47,10 +47,10 @@ export const DashboardProjectedMonthlySalesGql = `
|
||||
|
||||
_and:[
|
||||
{date_invoiced:{_is_null: true }},
|
||||
{actual_completion: {_gte: "${moment()
|
||||
{actual_completion: {_gte: "${dayjs()
|
||||
.startOf("month")
|
||||
.startOf("day")
|
||||
.toISOString()}"}}, {actual_completion: {_lte: "${moment()
|
||||
.toISOString()}"}}, {actual_completion: {_lte: "${dayjs()
|
||||
.endOf("month")
|
||||
.endOf("day")
|
||||
.toISOString()}"}}
|
||||
@@ -61,10 +61,10 @@ _and:[
|
||||
{_and: [
|
||||
{date_invoiced: {_is_null: true}},
|
||||
{actual_completion: {_is_null: true}}
|
||||
{scheduled_completion: {_gte: "${moment()
|
||||
{scheduled_completion: {_gte: "${dayjs()
|
||||
.startOf("month")
|
||||
.startOf("day")
|
||||
.toISOString()}"}}, {scheduled_completion: {_lte: "${moment()
|
||||
.toISOString()}"}}, {scheduled_completion: {_lte: "${dayjs()
|
||||
.endOf("month")
|
||||
.endOf("day")
|
||||
.toISOString()}"}}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
PauseCircleOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { Card, Space, Table, Tooltip } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -49,14 +49,14 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
||||
v_vin: item.job.v_vin,
|
||||
vehicleid: item.job.vehicleid,
|
||||
note: item.note,
|
||||
start: moment(item.start).format("hh:mm a"),
|
||||
start: dayjs(item.start).format("hh:mm a"),
|
||||
title: item.title,
|
||||
};
|
||||
appt.push(i);
|
||||
}
|
||||
});
|
||||
appt.sort(function (a, b) {
|
||||
return new moment(a.start) - new moment(b.start);
|
||||
return new dayjs(a.start) - new dayjs(b.start);
|
||||
});
|
||||
|
||||
const columns = [
|
||||
@@ -189,7 +189,7 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
||||
return (
|
||||
<Card
|
||||
title={t("dashboard.titles.scheduledintoday", {
|
||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
||||
date: dayjs().startOf("day").format("MM/DD/YYYY"),
|
||||
})}
|
||||
{...cardProps}
|
||||
>
|
||||
@@ -209,9 +209,9 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
||||
}
|
||||
|
||||
export const DashboardScheduledInTodayGql = `
|
||||
scheduled_in_today: appointments(where: {start: {_gte: "${moment()
|
||||
scheduled_in_today: appointments(where: {start: {_gte: "${dayjs()
|
||||
.startOf("day")
|
||||
.toISOString()}", _lte: "${moment()
|
||||
.toISOString()}", _lte: "${dayjs()
|
||||
.endOf("day")
|
||||
.toISOString()}"}, canceled: {_eq: false}, block: {_neq: true}}) {
|
||||
canceled
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
PauseCircleOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { Card, Space, Table, Tooltip } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -23,7 +23,7 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
||||
return <DashboardRefreshRequired {...cardProps} />;
|
||||
|
||||
data.scheduled_out_today.forEach((item) => {
|
||||
item.scheduled_completion= moment(item.scheduled_completion).format("hh:mm a")
|
||||
item.scheduled_completion= dayjs(item.scheduled_completion).format("hh:mm a")
|
||||
});
|
||||
data.scheduled_out_today.sort(function (a, b) {
|
||||
return new Date(a.scheduled_completion) - new Date(b.scheduled_completion);
|
||||
@@ -159,7 +159,7 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
||||
return (
|
||||
<Card
|
||||
title={t("dashboard.titles.scheduledouttoday", {
|
||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
||||
date: dayjs().startOf("day").format("MM/DD/YYYY"),
|
||||
})}
|
||||
{...cardProps}
|
||||
>
|
||||
@@ -183,8 +183,8 @@ export const DashboardScheduledOutTodayGql = `
|
||||
date_invoiced: {_is_null: true},
|
||||
ro_number: {_is_null: false},
|
||||
voided: {_eq: false},
|
||||
scheduled_completion: {_gte: "${moment().startOf("day").toISOString()}",
|
||||
_lte: "${moment().endOf("day").toISOString()}"}}) {
|
||||
scheduled_completion: {_gte: "${dayjs().startOf("day").toISOString()}",
|
||||
_lte: "${dayjs().endOf("day").toISOString()}"}}) {
|
||||
alt_transport
|
||||
clm_no
|
||||
jobid: id
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button, Dropdown, Menu, Space, notification } from "antd";
|
||||
import {PageHeader} from "@ant-design/pro-layout";
|
||||
import i18next from "i18next";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { Responsive, WidthProvider } from "react-grid-layout";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -277,7 +277,7 @@ const componentList = {
|
||||
},
|
||||
ScheduleInToday: {
|
||||
label: i18next.t("dashboard.titles.scheduledintoday", {
|
||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
||||
date: dayjs().startOf("day").format("MM/DD/YYYY"),
|
||||
}),
|
||||
component: DashboardScheduledInToday,
|
||||
gqlFragment: DashboardScheduledInTodayGql,
|
||||
@@ -288,7 +288,7 @@ const componentList = {
|
||||
},
|
||||
ScheduleOutToday: {
|
||||
label: i18next.t("dashboard.titles.scheduledouttoday", {
|
||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
||||
date: dayjs().startOf("day").format("MM/DD/YYYY"),
|
||||
}),
|
||||
component: DashboardScheduledOutToday,
|
||||
gqlFragment: DashboardScheduledOutTodayGql,
|
||||
@@ -311,10 +311,10 @@ const createDashboardQuery = (state) => {
|
||||
${componentBasedAdditions || ""}
|
||||
monthly_sales: jobs(where: {_and: [
|
||||
{ voided: {_eq: false}},
|
||||
{date_invoiced: {_gte: "${moment()
|
||||
{date_invoiced: {_gte: "${dayjs()
|
||||
.startOf("month")
|
||||
.startOf("day")
|
||||
.toISOString()}"}}, {date_invoiced: {_lte: "${moment()
|
||||
.toISOString()}"}}, {date_invoiced: {_lte: "${dayjs()
|
||||
.endOf("month")
|
||||
.endOf("day")
|
||||
.toISOString()}"}}]}) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Divider, Space, Tag, Timeline } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -29,7 +29,7 @@ export function DmsLogEvents({ socket, logs, bodyshop }) {
|
||||
<Timeline.Item key={idx} color={LogLevelHierarchy(log.level)}>
|
||||
<Space wrap align="start" style={{}}>
|
||||
<Tag color={LogLevelHierarchy(log.level)}>{log.level}</Tag>
|
||||
<span>{moment(log.timestamp).format("MM/DD/YYYY HH:mm:ss")}</span>
|
||||
<span>{dayjs(log.timestamp).format("MM/DD/YYYY HH:mm:ss")}</span>
|
||||
<Divider type="vertical" />
|
||||
<span>{log.message}</span>
|
||||
</Space>
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
Typography,
|
||||
} from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -101,7 +101,7 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
||||
})
|
||||
: ""
|
||||
}`.substr(0, 239),
|
||||
inservicedate: moment("2019-01-01"),
|
||||
inservicedate: dayjs("2019-01-01"),
|
||||
}}
|
||||
>
|
||||
<LayoutFormRow grow>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -27,16 +27,16 @@ export function EmailTestComponent({ currentUser, setEmailOptions }) {
|
||||
variables: {
|
||||
...(values.start
|
||||
? {
|
||||
start: moment(values.start).startOf("day").format("YYYY-MM-DD"),
|
||||
start: dayjs(values.start).startOf("day").format("YYYY-MM-DD"),
|
||||
}
|
||||
: {}),
|
||||
...(values.end
|
||||
? { end: moment(values.end).endOf("day").format("YYYY-MM-DD") }
|
||||
? { end: dayjs(values.end).endOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(values.start
|
||||
? { starttz: moment(values.start).startOf("day") }
|
||||
? { starttz: dayjs(values.start).startOf("day") }
|
||||
: {}),
|
||||
...(values.end ? { endtz: moment(values.end).endOf("day") } : {}),
|
||||
...(values.end ? { endtz: dayjs(values.end).endOf("day") } : {}),
|
||||
|
||||
...(values.id ? { id: values.id } : {}),
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -34,7 +34,7 @@ function FeatureWrapper({
|
||||
export function HasFeatureAccess({ featureName, bodyshop }) {
|
||||
return (
|
||||
bodyshop.features.allAccess ||
|
||||
moment(bodyshop.features[featureName]).isAfter(moment())
|
||||
dayjs(bodyshop.features[featureName]).isAfter(dayjs())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,29 @@
|
||||
import { DatePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useRef } from "react";
|
||||
//To be used as a form element only.
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
|
||||
|
||||
const dateFormat = "MM/DD/YYYY";
|
||||
|
||||
|
||||
// TODO, this is causing a dirty change when it should not (click the picker, click off the picker)
|
||||
export function FormDatePicker({
|
||||
bodyshop,
|
||||
value,
|
||||
onChange,
|
||||
onBlur,
|
||||
onlyFuture,
|
||||
isDateOnly = true,
|
||||
...restProps
|
||||
}) {
|
||||
bodyshop,
|
||||
value,
|
||||
onChange,
|
||||
onBlur,
|
||||
onlyFuture,
|
||||
isDateOnly = true,
|
||||
...restProps
|
||||
}) {
|
||||
const ref = useRef();
|
||||
|
||||
const handleChange = (newDate) => {
|
||||
@@ -37,8 +35,7 @@ export function FormDatePicker({
|
||||
const handleKeyDown = (e) => {
|
||||
if (e.key.toLowerCase() === "t") {
|
||||
if (onChange) {
|
||||
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment());
|
||||
// if (ref.current && ref.current.blur) ref.current.blur();
|
||||
onChange(isDateOnly ? dayjs().format("YYYY-MM-DD") : dayjs());
|
||||
}
|
||||
} else if (e.key.toLowerCase() === "enter") {
|
||||
if (ref.current && ref.current.blur) ref.current.blur();
|
||||
@@ -49,14 +46,23 @@ export function FormDatePicker({
|
||||
const v = e.target.value;
|
||||
if (!v) return;
|
||||
|
||||
const _a = moment(
|
||||
v,
|
||||
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
|
||||
"en",
|
||||
false
|
||||
const _a = dayjs(
|
||||
v,
|
||||
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
|
||||
"en",
|
||||
false
|
||||
);
|
||||
|
||||
if (_a.isValid() && value && value.isValid && value.isValid()) {
|
||||
if (
|
||||
_a.isValid()
|
||||
&& value
|
||||
&& value.isValid
|
||||
&& value.isValid()
|
||||
&& typeof value.hours === 'function'
|
||||
&& typeof value.minutes === 'function'
|
||||
&& typeof value.seconds === 'function'
|
||||
&& typeof value.milliseconds === 'function'
|
||||
) {
|
||||
_a.set({
|
||||
hours: value.hours(),
|
||||
minutes: value.minutes(),
|
||||
@@ -67,10 +73,10 @@ export function FormDatePicker({
|
||||
|
||||
if (_a.isValid() && onChange) {
|
||||
if (onlyFuture) {
|
||||
if (moment().subtract(1, "day").isBefore(_a)) {
|
||||
if (dayjs().subtract(1, "day").isBefore(_a)) {
|
||||
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
|
||||
} else {
|
||||
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment());
|
||||
onChange(isDateOnly ? dayjs().format("YYYY-MM-DD") : dayjs());
|
||||
}
|
||||
} else {
|
||||
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
|
||||
@@ -79,20 +85,20 @@ export function FormDatePicker({
|
||||
};
|
||||
|
||||
return (
|
||||
<div onKeyDown={handleKeyDown}>
|
||||
<DatePicker
|
||||
ref={ref}
|
||||
value={value ? moment(value) : null}
|
||||
onChange={handleChange}
|
||||
format={dateFormat}
|
||||
onBlur={onBlur || handleBlur}
|
||||
showToday={false}
|
||||
disabledTime
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
|
||||
})}
|
||||
{...restProps}
|
||||
/>
|
||||
</div>
|
||||
<div onKeyDown={handleKeyDown}>
|
||||
<DatePicker
|
||||
ref={ref}
|
||||
value={value ? dayjs(value) : null}
|
||||
onChange={handleChange}
|
||||
format={dateFormat}
|
||||
onBlur={onBlur || handleBlur}
|
||||
showToday={false}
|
||||
disabledTime
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => dayjs().subtract(1, "day").isAfter(d),
|
||||
})}
|
||||
{...restProps}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import React, { forwardRef } from "react";
|
||||
//import DatePicker from "react-datepicker";
|
||||
//import "react-datepicker/src/stylesheets/datepicker.scss";
|
||||
import { TimePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
//To be used as a form element only.
|
||||
|
||||
@@ -21,7 +21,7 @@ const DateTimePicker = (
|
||||
<FormDatePicker
|
||||
{...restProps}
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
|
||||
disabledDate: (d) => dayjs().subtract(1, "day").isAfter(d),
|
||||
})}
|
||||
value={value}
|
||||
onBlur={onBlur}
|
||||
@@ -31,9 +31,9 @@ const DateTimePicker = (
|
||||
/>
|
||||
|
||||
<TimePicker
|
||||
value={value ? moment(value) : null}
|
||||
value={value ? dayjs(value) : null}
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => moment().isAfter(d),
|
||||
disabledDate: (d) => dayjs().isAfter(d),
|
||||
})}
|
||||
onChange={onChange}
|
||||
showSecond={false}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { useTranslation } from "react-i18next";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -35,7 +35,7 @@ export function InventoryBillRo({
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
invoice_number: "ih",
|
||||
isinhouse: true,
|
||||
date: moment(),
|
||||
date: dayjs(),
|
||||
total: 0,
|
||||
billlines: [{}],
|
||||
// billlines: selectedLines.map((p) => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
Space,
|
||||
} from "antd";
|
||||
import parsePhoneNumber from "libphonenumber-js";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -218,8 +218,8 @@ export function ScheduleEventComponent({
|
||||
setMessage(
|
||||
t("appointments.labels.reminder", {
|
||||
shopname: bodyshop.shopname,
|
||||
date: moment(event.start).format("MM/DD/YYYY"),
|
||||
time: moment(event.start).format("HH:mm a"),
|
||||
date: dayjs(event.start).format("MM/DD/YYYY"),
|
||||
time: dayjs(event.start).format("HH:mm a"),
|
||||
})
|
||||
);
|
||||
setVisible(false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, Input, notification, Switch } from "antd";
|
||||
import moment from "moment-business-days";
|
||||
import dayjs from "../../../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -87,7 +87,7 @@ export function JobChecklistForm({
|
||||
bodyshop.intakechecklist &&
|
||||
bodyshop.intakechecklist.next_contact_hours &&
|
||||
bodyshop.intakechecklist.next_contact_hours > 0 && {
|
||||
date_next_contact: moment().add(
|
||||
date_next_contact: dayjs().add(
|
||||
bodyshop.intakechecklist.next_contact_hours,
|
||||
"hours"
|
||||
),
|
||||
@@ -218,26 +218,26 @@ export function JobChecklistForm({
|
||||
scheduled_completion:
|
||||
(job &&
|
||||
job.scheduled_completion &&
|
||||
moment(job.scheduled_completion)) ||
|
||||
dayjs(job.scheduled_completion)) ||
|
||||
(job &&
|
||||
job.labhrs &&
|
||||
job.larhrs &&
|
||||
moment().businessAdd(
|
||||
dayjs().businessDaysAdd(
|
||||
(job.labhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0 + job.larhrs.aggregate.sum.mod_lb_hrs ||
|
||||
0) / bodyshop.target_touchtime,
|
||||
"days"
|
||||
)),
|
||||
scheduled_delivery:
|
||||
job.scheduled_delivery && moment(job.scheduled_delivery),
|
||||
job.scheduled_delivery && dayjs(job.scheduled_delivery),
|
||||
production_vars: job.production_vars,
|
||||
}),
|
||||
...(type === "deliver" && {
|
||||
removeFromProduction: true,
|
||||
actual_completion:
|
||||
job && job.actual_completion && moment(job.actual_completion),
|
||||
job && job.actual_completion && dayjs(job.actual_completion),
|
||||
actual_delivery:
|
||||
job && job.actual_delivery && moment(job.actual_delivery),
|
||||
job && job.actual_delivery && dayjs(job.actual_delivery),
|
||||
}),
|
||||
...formItems
|
||||
.filter((fi) => fi.value)
|
||||
|
||||
@@ -43,7 +43,7 @@ import _ from "lodash";
|
||||
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
||||
import JobLinesExpander from "./job-lines-expander.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
@@ -466,7 +466,7 @@ export function JobLinesComponent({
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
invoice_number: "ih",
|
||||
isinhouse: true,
|
||||
date: new moment(),
|
||||
date: new dayjs(),
|
||||
total: 0,
|
||||
billlines: selectedLines.map((p) => {
|
||||
return {
|
||||
|
||||
@@ -210,7 +210,7 @@ export function JobLineConvertToLabor({
|
||||
setLoading(true);
|
||||
|
||||
form.setFieldsValue({
|
||||
// date: new moment(),
|
||||
// date: new dayjs(),
|
||||
// bodyhrs: Math.round(v.bodyhrs * 10) / 10,
|
||||
// painthrs: Math.round(v.painthrs * 10) / 10,
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Popover,
|
||||
Space,
|
||||
} from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
@@ -177,7 +177,7 @@ export default function ScoreboardAddButton({
|
||||
return acc + job.lbr_adjustments[val];
|
||||
}, 0);
|
||||
form.setFieldsValue({
|
||||
date: new moment(),
|
||||
date: new dayjs(),
|
||||
bodyhrs: Math.round(v.bodyhrs * 10) / 10,
|
||||
painthrs: Math.round(v.painthrs * 10) / 10,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Form, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
@@ -53,7 +53,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
||||
jobid: job.id,
|
||||
operation: AuditTrailMapping.admin_jobfieldchange(
|
||||
key,
|
||||
changedAuditFields[key] instanceof moment
|
||||
changedAuditFields[key] instanceof dayjs
|
||||
? DateTimeFormat(changedAuditFields[key])
|
||||
: changedAuditFields[key]
|
||||
),
|
||||
@@ -89,7 +89,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
||||
initialValues={{
|
||||
...job,
|
||||
date_estimated: job.date_estimated
|
||||
? moment(job.date_estimated)
|
||||
? dayjs(job.date_estimated)
|
||||
: null,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Button, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||
@@ -108,7 +108,7 @@ export function JobAdminMarkReexport({
|
||||
const handleMarkExported = async () => {
|
||||
setLoading(true);
|
||||
const result = await markJobExported({
|
||||
variables: { jobId: job.id, date_exported: moment() },
|
||||
variables: { jobId: job.id, date_exported: dayjs() },
|
||||
});
|
||||
|
||||
await insertExportLog({
|
||||
|
||||
@@ -63,8 +63,8 @@ mutation UNVOID_JOB($jobId: uuid!) {
|
||||
// created_by: currentUser.email,
|
||||
// audit: true,
|
||||
// text: t("jobs.labels.voidnote", {
|
||||
// date: moment().format("MM/DD/yyy"),
|
||||
// time: moment().format("hh:mm a"),
|
||||
// date: dayjs().format("MM/DD/yyy"),
|
||||
// time: dayjs().format("hh:mm a"),
|
||||
// }),
|
||||
// },
|
||||
// ],
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Col, notification, Row } from "antd";
|
||||
import Axios from "axios";
|
||||
import Dinero from "dinero.js";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -137,7 +137,7 @@ export function JobsAvailableContainer({
|
||||
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
|
||||
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
|
||||
job_totals: newTotals,
|
||||
date_open: moment(),
|
||||
date_open: dayjs(),
|
||||
status: bodyshop.md_ro_statuses.default_imported,
|
||||
notes: {
|
||||
data: {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Select,
|
||||
Space,
|
||||
} from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -110,7 +110,7 @@ export function JobsDetailHeaderAddEvent({ bodyshop, jobid, ...props }) {
|
||||
async validator(rule, value) {
|
||||
if (value) {
|
||||
const { start } = form.getFieldsValue();
|
||||
if (moment(start).isAfter(moment(value))) {
|
||||
if (dayjs(start).isAfter(dayjs(value))) {
|
||||
return Promise.reject(
|
||||
t("employees.labels.endmustbeafterstart")
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@ import Axios from "axios";
|
||||
import _ from "lodash";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { INSERT_NEW_JOB, QUERY_JOB_FOR_DUPE } from "../../graphql/jobs.queries";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import i18n from "i18next";
|
||||
|
||||
export default async function DuplicateJob(
|
||||
@@ -92,7 +92,7 @@ export async function CreateIouForJob(
|
||||
converted: true,
|
||||
status: status,
|
||||
iouparent: jobId,
|
||||
date_open: moment(),
|
||||
date_open: dayjs(),
|
||||
audit_trails: {
|
||||
data: [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery, useApolloClient } from "@apollo/client";
|
||||
import { Form, Modal, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -108,7 +108,7 @@ export function PartsOrderModalContainer({
|
||||
po: [
|
||||
{
|
||||
...values,
|
||||
order_date: moment().format("YYYY-MM-DD"),
|
||||
order_date: dayjs().format("YYYY-MM-DD"),
|
||||
orderedby: currentUser.email,
|
||||
jobid: jobId,
|
||||
user_email: currentUser.email,
|
||||
@@ -185,7 +185,7 @@ export function PartsOrderModalContainer({
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
invoice_number: "ih",
|
||||
isinhouse: true,
|
||||
date: new moment(),
|
||||
date: new dayjs(),
|
||||
total: 0,
|
||||
billlines: values.parts_order_lines.data.map((p) => {
|
||||
return {
|
||||
@@ -318,7 +318,7 @@ export function PartsOrderModalContainer({
|
||||
const initialValues = {
|
||||
jobid: jobId,
|
||||
return: isReturn,
|
||||
deliver_by: isReturn ? moment(new Date()) : null,
|
||||
deliver_by: isReturn ? dayjs(new Date()) : null,
|
||||
vendorid: vendorId,
|
||||
returnfrombill: returnFromBill,
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
notification,
|
||||
} from "antd";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
@@ -64,7 +64,7 @@ const PaymentExpandedRowComponent = ({ record, bodyshop }) => {
|
||||
payer: record.payer,
|
||||
type: "Refund",
|
||||
jobid: payment_response.jobid,
|
||||
date: moment(Date.now()),
|
||||
date: dayjs(Date.now()),
|
||||
},
|
||||
},
|
||||
update(cache, { data }) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import ProductionAlert from "../production-list-columns/production-list-columns.
|
||||
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
|
||||
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
|
||||
import "./production-board-card.styles.scss";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
||||
|
||||
@@ -72,11 +72,11 @@ export default function ProductionBoardCard(
|
||||
|
||||
const pastDueAlert =
|
||||
!!card.scheduled_completion &&
|
||||
((moment().isSameOrAfter(moment(card.scheduled_completion), "day") &&
|
||||
((dayjs().isSameOrAfter(dayjs(card.scheduled_completion), "day") &&
|
||||
"production-completion-past") ||
|
||||
(moment()
|
||||
(dayjs()
|
||||
.add(1, "day")
|
||||
.isSame(moment(card.scheduled_completion), "day") &&
|
||||
.isSame(dayjs(card.scheduled_completion), "day") &&
|
||||
"production-completion-soon"));
|
||||
|
||||
const totalHrs =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PauseCircleOutlined, BranchesOutlined } from "@ant-design/icons";
|
||||
import { Space, Tooltip } from "antd";
|
||||
import i18n from "i18next";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { Link } from "react-router-dom";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { TimeFormatter } from "../../utils/DateFormatter";
|
||||
@@ -176,7 +176,7 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
style={{
|
||||
color:
|
||||
record.date_next_contact &&
|
||||
moment(record.date_next_contact).isBefore(moment())
|
||||
dayjs(record.date_next_contact).isBefore(dayjs())
|
||||
? "red"
|
||||
: "",
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Dropdown, TimePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
@@ -20,7 +20,7 @@ export default function ProductionListDate({
|
||||
|
||||
const handleChange = (date) => {
|
||||
logImEXEvent("product_toggle_date", { field });
|
||||
// if (date.isSame(record[field] && moment(record[field]))) {
|
||||
// if (date.isSame(record[field] && dayjs(record[field]))) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
@@ -50,9 +50,9 @@ export default function ProductionListDate({
|
||||
if (pastIndicator) {
|
||||
className =
|
||||
!!record[field] &&
|
||||
((moment().isSameOrAfter(moment(record[field]), "day") &&
|
||||
((dayjs().isSameOrAfter(dayjs(record[field]), "day") &&
|
||||
"production-completion-past") ||
|
||||
(moment().add(1, "day").isSame(moment(record[field]), "day") &&
|
||||
(dayjs().add(1, "day").isSame(dayjs(record[field]), "day") &&
|
||||
"production-completion-soon"));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function ProductionListDate({
|
||||
<Card style={{ padding: "1rem" }} onClick={(e) => e.stopPropagation()}>
|
||||
<FormDatePicker
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
value={(record[field] && moment(record[field])) || null}
|
||||
value={(record[field] && dayjs(record[field])) || null}
|
||||
onChange={handleChange}
|
||||
format="MM/DD/YYYY"
|
||||
isDateOnly={!time}
|
||||
@@ -76,7 +76,7 @@ export default function ProductionListDate({
|
||||
{time && (
|
||||
<TimePicker
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
value={(record[field] && moment(record[field])) || null}
|
||||
value={(record[field] && dayjs(record[field])) || null}
|
||||
onChange={handleChange}
|
||||
minuteStep={15}
|
||||
format="hh:mm a"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Dropdown, Form, Input, notification, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -84,7 +84,7 @@ export function ProductionLastContacted({ currentUser, record }) {
|
||||
form.setFieldsValue({
|
||||
note: null,
|
||||
date_last_contacted:
|
||||
record.date_last_contacted && moment(record.date_last_contacted),
|
||||
record.date_last_contacted && dayjs(record.date_last_contacted),
|
||||
});
|
||||
}
|
||||
}, [visible, form, record.date_last_contacted]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useMemo } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -21,8 +21,8 @@ export function ProductionlistColumnTouchTime({ bodyshop, job }) {
|
||||
(job.larhrs.aggregate.sum.mod_lb_hrs || 0) +
|
||||
(job.labhrs.aggregate.sum.mod_lb_hrs || 0);
|
||||
|
||||
const Difference_In_Days = moment().diff(
|
||||
moment(job.actual_in),
|
||||
const Difference_In_Days = dayjs().diff(
|
||||
dayjs(job.actual_in),
|
||||
"days",
|
||||
true
|
||||
);
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Typography,
|
||||
} from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -77,13 +77,13 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
||||
name: values.key,
|
||||
variables: {
|
||||
...(start
|
||||
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
||||
? { start: dayjs(start).startOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(end
|
||||
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
|
||||
? { end: dayjs(end).endOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(start ? { starttz: moment(start).startOf("day") } : {}),
|
||||
...(end ? { endtz: moment(end).endOf("day") } : {}),
|
||||
...(start ? { starttz: dayjs(start).startOf("day") } : {}),
|
||||
...(end ? { endtz: dayjs(end).endOf("day") } : {}),
|
||||
|
||||
...(id ? { id: id } : {}),
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Dropdown, Menu, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -34,8 +34,8 @@ export function ScheduleBlockDay({
|
||||
block: true,
|
||||
isintake: false,
|
||||
bodyshopid: bodyshop.id,
|
||||
start: moment(date).startOf("day"),
|
||||
end: moment(date).endOf("day"),
|
||||
start: dayjs(date).startOf("day"),
|
||||
end: dayjs(date).endOf("day"),
|
||||
};
|
||||
logImEXEvent("dashboard_change_layout");
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import Icon from "@ant-design/icons";
|
||||
import { Popover } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
|
||||
import React, { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MdFileDownload, MdFileUpload } from "react-icons/md";
|
||||
@@ -43,7 +44,7 @@ export function ScheduleCalendarHeaderComponent({
|
||||
(e) =>
|
||||
!e.vacation &&
|
||||
e.isintake &&
|
||||
moment(date).isSame(moment(e.start), "day")
|
||||
dayjs(date).isSame(dayjs(e.start), "day")
|
||||
),
|
||||
"job.alt_transport"
|
||||
);
|
||||
@@ -54,7 +55,7 @@ export function ScheduleCalendarHeaderComponent({
|
||||
return (
|
||||
events &&
|
||||
events.filter(
|
||||
(e) => moment(date).isSame(moment(e.start), "day") && e.block
|
||||
(e) => dayjs(date).isSame(dayjs(e.start), "day") && e.block
|
||||
)
|
||||
);
|
||||
}, [events, date]);
|
||||
@@ -170,7 +171,7 @@ export function ScheduleCalendarHeaderComponent({
|
||||
|
||||
const isShopOpen = (date) => {
|
||||
let day;
|
||||
switch (moment(date).day()) {
|
||||
switch (dayjs(date).day()) {
|
||||
case 0:
|
||||
day = "sunday";
|
||||
break;
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
|
||||
export function getRange(dateParam, viewParam) {
|
||||
let start, end;
|
||||
let date = dateParam || new Date();
|
||||
let view = viewParam || "week";
|
||||
// if view is day: from moment(date).startOf('day') to moment(date).endOf('day');
|
||||
// if view is day: from dayjs(date).startOf('day') to dayjs(date).endOf('day');
|
||||
if (view === "day") {
|
||||
start = moment(date).startOf("day");
|
||||
end = moment(date).endOf("day");
|
||||
start = dayjs(date).startOf("day");
|
||||
end = dayjs(date).endOf("day");
|
||||
}
|
||||
// if view is week: from moment(date).startOf('isoWeek') to moment(date).endOf('isoWeek');
|
||||
// if view is week: from dayjs(date).startOf('isoWeek') to dayjs(date).endOf('isoWeek');
|
||||
else if (view === "week") {
|
||||
start = moment(date).startOf("week");
|
||||
end = moment(date).endOf("week");
|
||||
start = dayjs(date).startOf("week");
|
||||
end = dayjs(date).endOf("week");
|
||||
}
|
||||
//if view is month: from moment(date).startOf('month').subtract(7, 'days') to moment(date).endOf('month').add(7, 'days'); i do additional 7 days math because you can see adjacent weeks on month view (that is the way how i generate my recurrent events for the Big Calendar, but if you need only start-end of month - just remove that math);
|
||||
//if view is month: from dayjs(date).startOf('month').subtract(7, 'days') to dayjs(date).endOf('month').add(7, 'days'); i do additional 7 days math because you can see adjacent weeks on month view (that is the way how i generate my recurrent events for the Big Calendar, but if you need only start-end of month - just remove that math);
|
||||
else if (view === "month") {
|
||||
start = moment(date).startOf("month").subtract(7, "days");
|
||||
end = moment(date).endOf("month").add(7, "days");
|
||||
start = dayjs(date).startOf("month").subtract(7, "days");
|
||||
end = dayjs(date).endOf("month").add(7, "days");
|
||||
}
|
||||
// if view is agenda: from moment(date).startOf('day') to moment(date).endOf('day').add(1, 'month');
|
||||
// if view is agenda: from dayjs(date).startOf('day') to dayjs(date).endOf('day').add(1, 'month');
|
||||
else if (view === "agenda") {
|
||||
start = moment(date).startOf("day");
|
||||
end = moment(date).endOf("day").add(1, "month");
|
||||
start = dayjs(date).startOf("day");
|
||||
end = dayjs(date).endOf("day").add(1, "month");
|
||||
}
|
||||
|
||||
return { start, end };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React from "react";
|
||||
import { Calendar, momentLocalizer } from "react-big-calendar";
|
||||
import { Calendar, dayjsLocalizer } from "react-big-calendar";
|
||||
import { connect } from "react-redux";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -19,7 +19,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
problemJobs: selectProblemJobs,
|
||||
});
|
||||
const localizer = momentLocalizer(moment);
|
||||
const localizer = dayjsLocalizer(dayjs);
|
||||
export function ScheduleCalendarWrapperComponent({
|
||||
bodyshop,
|
||||
problemJobs,
|
||||
@@ -49,7 +49,7 @@ export function ScheduleCalendarWrapperComponent({
|
||||
};
|
||||
};
|
||||
|
||||
const selectedDate = new Date(date || moment(search.date) || Date.now());
|
||||
const selectedDate = new Date(date || dayjs(search.date) || Date.now());
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -10,7 +10,7 @@ import ScheduleCalendarComponent from "./schedule-calendar.component";
|
||||
import { calculateScheduleLoad } from "../../redux/application/application.actions";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
});
|
||||
@@ -63,8 +63,8 @@ export function ScheduleCalendarContainer({ calculateScheduleLoad }) {
|
||||
(e.employee.first_name && e.employee.first_name.substr(0, 1)) || ""
|
||||
} ${e.employee.last_name || ""} OUT`,
|
||||
color: "red",
|
||||
start: moment(e.start).startOf("day").toDate(),
|
||||
end: moment(e.end).startOf("day").toDate(),
|
||||
start: dayjs(e.start).startOf("day").toDate(),
|
||||
end: dayjs(e.end).startOf("day").toDate(),
|
||||
allDay: true,
|
||||
vacation: true,
|
||||
};
|
||||
|
||||
@@ -3,18 +3,18 @@ import ScheduleDayViewComponent from "./schedule-day-view.component";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { QUERY_APPOINTMENT_BY_DATE } from "../../graphql/appointments.queries";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function ScheduleDayViewContainer({ day }) {
|
||||
const { loading, error, data } = useQuery(QUERY_APPOINTMENT_BY_DATE, {
|
||||
variables: {
|
||||
start: moment(day).startOf("day"),
|
||||
end: moment(day).endOf("day"),
|
||||
startd: moment(day).startOf("day").format("YYYY-MM-DD"),
|
||||
endd: moment(day).add(1, "day").format("YYYY-MM-DD"),
|
||||
start: dayjs(day).startOf("day"),
|
||||
end: dayjs(day).endOf("day"),
|
||||
startd: dayjs(day).startOf("day").format("YYYY-MM-DD"),
|
||||
endd: dayjs(day).add(1, "day").format("YYYY-MM-DD"),
|
||||
},
|
||||
skip: !moment(day).isValid(),
|
||||
skip: !dayjs(day).isValid(),
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
@@ -43,8 +43,8 @@ export default function ScheduleDayViewContainer({ day }) {
|
||||
(e.employee.first_name && e.employee.first_name.substr(0, 1)) || ""
|
||||
} ${e.employee.last_name || ""} OUT`,
|
||||
color: "red",
|
||||
start: moment(e.start).startOf("day").toDate(),
|
||||
end: moment(e.end).startOf("day").toDate(),
|
||||
start: dayjs(e.start).startOf("day").toDate(),
|
||||
end: dayjs(e.end).startOf("day").toDate(),
|
||||
vacation: true,
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Typography,
|
||||
} from "antd";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -68,7 +68,7 @@ export function ScheduleJobModalComponent({
|
||||
|
||||
if (values.start && !values.scheduled_completion)
|
||||
form.setFieldsValue({
|
||||
scheduled_completion: moment(values.start).businessAdd(
|
||||
scheduled_completion: dayjs(values.start).businessAdd(
|
||||
totalHours / bodyshop.target_touchtime,
|
||||
"days"
|
||||
),
|
||||
@@ -134,11 +134,11 @@ export function ScheduleJobModalComponent({
|
||||
className="imex-flex-row__margin"
|
||||
key={idx}
|
||||
onClick={() => {
|
||||
const ssDate = moment(d);
|
||||
if (ssDate.isBefore(moment())) {
|
||||
form.setFieldsValue({ start: moment() });
|
||||
const ssDate = dayjs(d);
|
||||
if (ssDate.isBefore(dayjs())) {
|
||||
form.setFieldsValue({ start: dayjs() });
|
||||
} else {
|
||||
form.setFieldsValue({ start: moment(d).add(8, "hours") });
|
||||
form.setFieldsValue({ start: dayjs(d).add(8, "hours") });
|
||||
}
|
||||
handleDateBlur();
|
||||
}}
|
||||
@@ -201,7 +201,7 @@ export function ScheduleJobModalComponent({
|
||||
{() => {
|
||||
const values = form.getFieldsValue();
|
||||
if (values.start) {
|
||||
calculateScheduleLoad(moment(values.start).add(3, "days"));
|
||||
calculateScheduleLoad(dayjs(values.start).add(3, "days"));
|
||||
}
|
||||
return (
|
||||
<div className="schedule-job-modal">
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useMutation, useQuery } from "@apollo/client";
|
||||
//import moment from "moment";
|
||||
import { Form, Modal, notification } from "antd";
|
||||
import moment from "moment-business-days";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -129,8 +128,8 @@ export function ScheduleJobModalContainer({
|
||||
app: {
|
||||
jobid: jobId,
|
||||
bodyshopid: bodyshop.id,
|
||||
start: moment(values.start),
|
||||
end: moment(values.start).add(bodyshop.appt_length || 60, "minutes"),
|
||||
start: dayjs(values.start),
|
||||
end: dayjs(values.start).add(bodyshop.appt_length || 60, "minutes"),
|
||||
color: values.color,
|
||||
note: values.note,
|
||||
created_by: currentUser.email,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, Input, Popover, Select, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -111,7 +111,7 @@ export function ScheduleManualEvent({ bodyshop, event }) {
|
||||
async validator(rule, value) {
|
||||
if (value) {
|
||||
const { start } = form.getFieldsValue();
|
||||
if (moment(start).isAfter(moment(value))) {
|
||||
if (dayjs(start).isAfter(dayjs(value))) {
|
||||
return Promise.reject(
|
||||
t("employees.labels.endmustbeafterstart")
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useApolloClient } from "@apollo/client";
|
||||
import { Button } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -27,7 +27,7 @@ export function ScheduleVerifyIntegrity({ currentUser }) {
|
||||
data: { arrJobs, compJobs, prodJobs },
|
||||
} = await client.query({
|
||||
query: QUERY_SCHEDULE_LOAD_DATA,
|
||||
variables: { start: moment(), end: moment().add(180, "days") },
|
||||
variables: { start: dayjs(), end: dayjs().add(180, "days") },
|
||||
});
|
||||
|
||||
//check that the leaving jobs are either in the arriving list, or in production.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Card } from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
@@ -61,7 +61,7 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
|
||||
}
|
||||
|
||||
const theValue = {
|
||||
date: moment(val).format("D ddd"),
|
||||
date: dayjs(val).format("D ddd"),
|
||||
paintHrs: _.round(dayhrs.painthrs, 1),
|
||||
bodyHrs: _.round(dayhrs.bodyhrs, 1),
|
||||
accTargetHrs: _.round(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Card, Divider, Statistic } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -27,7 +27,7 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={moment(date).format("D - ddd")}
|
||||
title={dayjs(date).format("D - ddd")}
|
||||
className="ant-card-grid-hoverable"
|
||||
style={{ height: "100%" }}
|
||||
>
|
||||
|
||||
@@ -7,7 +7,7 @@ import ScoreboardTargetsTable from "../scoreboard-targets-table/scoreboard-targe
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { useApolloClient, useQuery } from "@apollo/client";
|
||||
import {
|
||||
GET_BLOCKED_DAYS,
|
||||
@@ -28,8 +28,8 @@ export default connect(
|
||||
export function ScoreboardDisplayComponent({ bodyshop }) {
|
||||
const scoreboardSubscription = useQuery(QUERY_SCOREBOARD, {
|
||||
variables: {
|
||||
start: moment().startOf("month"),
|
||||
end: moment().endOf("month"),
|
||||
start: dayjs().startOf("month"),
|
||||
end: dayjs().endOf("month"),
|
||||
},
|
||||
pollInterval: 60000,
|
||||
});
|
||||
@@ -50,26 +50,26 @@ export function ScoreboardDisplayComponent({ bodyshop }) {
|
||||
|
||||
useEffect(() => {
|
||||
//Update the locals.
|
||||
async function setMomentSettings() {
|
||||
async function setDayJSSettings() {
|
||||
let appointments;
|
||||
|
||||
if (!bodyshop.scoreboard_target.ignoreblockeddays) {
|
||||
const { data } = await client.query({
|
||||
query: GET_BLOCKED_DAYS,
|
||||
variables: {
|
||||
start: moment().startOf("month"),
|
||||
end: moment().endOf("month"),
|
||||
start: dayjs().startOf("month"),
|
||||
end: dayjs().endOf("month"),
|
||||
},
|
||||
});
|
||||
appointments = data.appointments;
|
||||
}
|
||||
|
||||
moment.updateLocale("ca", {
|
||||
dayjs.updateLocale("ca", {
|
||||
workingWeekdays: translateSettingsToWorkingDays(bodyshop.workingdays),
|
||||
...(appointments
|
||||
? {
|
||||
holidays: appointments.map((h) =>
|
||||
moment(h.start).format("MM-DD-YYYY")
|
||||
dayjs(h.start).format("MM-DD-YYYY")
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
@@ -77,7 +77,7 @@ export function ScoreboardDisplayComponent({ bodyshop }) {
|
||||
});
|
||||
}
|
||||
|
||||
setMomentSettings();
|
||||
setDayJSSettings();
|
||||
}, [client, bodyshop]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import ScoreboardDayStat from "../scoreboard-day-stats/scoreboard-day-stats.component";
|
||||
import { Row, Col } from "antd";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
@@ -15,11 +15,12 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
|
||||
export function ScoreboardLastDays({ bodyshop, sbEntriesByDate }) {
|
||||
|
||||
const { lastNumberWorkingDays } = bodyshop.scoreboard_target;
|
||||
|
||||
const ArrayOfDate = [];
|
||||
for (var i = lastNumberWorkingDays - 1; i >= 0; i--) {
|
||||
ArrayOfDate.push(moment().businessSubtract(i, "day").format("yyyy-MM-DD"));
|
||||
ArrayOfDate.push(dayjs().businessDaysSubtract(i, "day").format("yyyy-MM-DD"));
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CalendarOutlined } from "@ant-design/icons";
|
||||
import { Card, Col, Divider, Row, Statistic } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -35,7 +35,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
||||
toDatePaint: 0,
|
||||
};
|
||||
|
||||
const today = moment();
|
||||
const today = dayjs();
|
||||
if (dateHash[today.format("YYYY-MM-DD")]) {
|
||||
dateHash[today.format("YYYY-MM-DD")].forEach((d) => {
|
||||
ret.todayBody = ret.todayBody + d.bodyhrs;
|
||||
@@ -43,7 +43,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
||||
});
|
||||
}
|
||||
|
||||
let StartOfWeek = moment().startOf("week");
|
||||
let StartOfWeek = dayjs().startOf("week");
|
||||
while (StartOfWeek.isSameOrBefore(today)) {
|
||||
if (dateHash[StartOfWeek.format("YYYY-MM-DD")]) {
|
||||
dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => {
|
||||
@@ -54,7 +54,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
||||
StartOfWeek = StartOfWeek.add(1, "day");
|
||||
}
|
||||
|
||||
let startOfMonth = moment().startOf("month");
|
||||
let startOfMonth = dayjs().startOf("month");
|
||||
while (startOfMonth.isSameOrBefore(today)) {
|
||||
if (dateHash[startOfMonth.format("YYYY-MM-DD")]) {
|
||||
dateHash[startOfMonth.format("YYYY-MM-DD")].forEach((d) => {
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import moment from "moment-business-days";
|
||||
import dayjs from "../../utils/day";
|
||||
|
||||
// moment.updateLocale("ca", {
|
||||
// dayjs.updateLocale("ca", {
|
||||
// workingWeekdays: [1, 2, 3, 4, 5, 6],
|
||||
// });
|
||||
|
||||
export const CalculateWorkingDaysThisMonth = () => {
|
||||
return moment().endOf("month").businessDaysIntoMonth();
|
||||
return dayjs().endOf("month").businessDaysInMonth();
|
||||
};
|
||||
|
||||
export const CalculateWorkingDaysInPeriod = (start, end) => {
|
||||
return moment(start).businessDiff(moment(end));
|
||||
return dayjs(start).businessDiff(dayjs(end));
|
||||
};
|
||||
|
||||
export const CalculateWorkingDaysAsOfToday = () => {
|
||||
return moment().businessDaysIntoMonth();
|
||||
return dayjs().businessDaysInMonth();
|
||||
};
|
||||
|
||||
export const CalculateWorkingDaysLastMonth = () => {
|
||||
return moment().subtract(1, "month").endOf("month").businessDaysIntoMonth();
|
||||
return dayjs().subtract(1, "month").endOf("month").businessDaysInMonth();
|
||||
};
|
||||
|
||||
export const WeeklyTargetHrs = (dailyTargetHrs, bodyshop) => {
|
||||
return (
|
||||
dailyTargetHrs *
|
||||
CalculateWorkingDaysInPeriod(
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week")
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week")
|
||||
)
|
||||
);
|
||||
};
|
||||
@@ -53,20 +53,22 @@ export const AsOfTodayTargetHrs = (dailyTargetHrs, bodyshop) => {
|
||||
|
||||
export const AsOfDateTargetHours = (dailyTargetHours, date) => {
|
||||
return (
|
||||
dailyTargetHours * moment().startOf("month").businessDiff(moment(date))
|
||||
dailyTargetHours * dayjs().startOf("month").businessDiff(dayjs(date))
|
||||
);
|
||||
};
|
||||
|
||||
export const ListOfBusinessDaysInCurrentMonth = () => {
|
||||
const momentListOfDays = moment().monthBusinessDays();
|
||||
// TODO This is probably broken :/
|
||||
console.log('Hit!!!!')
|
||||
const momentListOfDays = dayjs().businessDaysInMonth();
|
||||
|
||||
return momentListOfDays.map((i) => i.format("YYYY-MM-DD"));
|
||||
};
|
||||
|
||||
export const ListOfDaysInCurrentMonth = () => {
|
||||
const days = [];
|
||||
const dateStart = moment().startOf("month");
|
||||
const dateEnd = moment().endOf("month");
|
||||
const dateStart = dayjs().startOf("month");
|
||||
const dateEnd = dayjs().endOf("month");
|
||||
while (dateEnd.diff(dateStart, "days") > 0) {
|
||||
days.push(dateStart.format("YYYY-MM-DD"));
|
||||
dateStart.add(1, "days");
|
||||
@@ -77,8 +79,8 @@ export const ListOfDaysInCurrentMonth = () => {
|
||||
|
||||
export const ListDaysBetween = ({ start, end }) => {
|
||||
const days = [];
|
||||
const dateStart = moment(start);
|
||||
const dateEnd = moment(end);
|
||||
const dateStart = dayjs(start);
|
||||
const dateEnd = dayjs(end);
|
||||
while (dateEnd.diff(dateStart, "days") > 0) {
|
||||
days.push(dateStart.format("YYYY-MM-DD"));
|
||||
dateStart.add(1, "days");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Col, Row } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -29,24 +29,24 @@ export default connect(
|
||||
|
||||
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const startDate = moment().startOf("month")
|
||||
const endDate = moment().endOf("month");
|
||||
const startDate = dayjs().startOf("month")
|
||||
const endDate = dayjs().endOf("month");
|
||||
|
||||
const fixedPeriods = useMemo(() => {
|
||||
const endOfThisMonth = moment().endOf("month");
|
||||
const startofthisMonth = moment().startOf("month");
|
||||
const endOfThisMonth = dayjs().endOf("month");
|
||||
const startofthisMonth = dayjs().startOf("month");
|
||||
|
||||
const endOfLastmonth = moment().subtract(1, "month").endOf("month");
|
||||
const startOfLastmonth = moment().subtract(1, "month").startOf("month");
|
||||
const endOfLastmonth = dayjs().subtract(1, "month").endOf("month");
|
||||
const startOfLastmonth = dayjs().subtract(1, "month").startOf("month");
|
||||
|
||||
const endOfThisWeek = moment().endOf("week");
|
||||
const startOfThisWeek = moment().startOf("week");
|
||||
const endOfThisWeek = dayjs().endOf("week");
|
||||
const startOfThisWeek = dayjs().startOf("week");
|
||||
|
||||
const endOfLastWeek = moment().subtract(1, "week").endOf("week");
|
||||
const startOfLastWeek = moment().subtract(1, "week").startOf("week");
|
||||
const endOfLastWeek = dayjs().subtract(1, "week").endOf("week");
|
||||
const startOfLastWeek = dayjs().subtract(1, "week").startOf("week");
|
||||
|
||||
const endOfPriorWeek = moment().subtract(2, "week").endOf("week");
|
||||
const startOfPriorWeek = moment().subtract(2, "week").startOf("week");
|
||||
const endOfPriorWeek = dayjs().subtract(2, "week").endOf("week");
|
||||
const startOfPriorWeek = dayjs().subtract(2, "week").startOf("week");
|
||||
|
||||
const allDates = [
|
||||
endOfThisMonth,
|
||||
@@ -60,8 +60,8 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
endOfPriorWeek,
|
||||
startOfPriorWeek,
|
||||
];
|
||||
const start = moment.min(allDates);
|
||||
const end = moment.max(allDates);
|
||||
const start = dayjs.min(allDates);
|
||||
const end = dayjs.max(allDates);
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
@@ -155,7 +155,7 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
};
|
||||
|
||||
data.fixedperiod.forEach((ticket) => {
|
||||
const ticketDate = moment(ticket.date);
|
||||
const ticketDate = dayjs(ticket.date);
|
||||
if (
|
||||
ticketDate.isBetween(
|
||||
fixedPeriods.startOfThisWeek,
|
||||
@@ -172,24 +172,24 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
|
||||
//Seperate out to Day of Week
|
||||
ret.seperatedThisWeek[
|
||||
moment(ticket.date).format("dddd").toLowerCase()
|
||||
dayjs(ticket.date).format("dddd").toLowerCase()
|
||||
].total =
|
||||
ret.seperatedThisWeek[
|
||||
moment(ticket.date).format("dddd").toLowerCase()
|
||||
dayjs(ticket.date).format("dddd").toLowerCase()
|
||||
].total + ticket.productivehrs;
|
||||
if (ticket.ciecacode !== "LAR")
|
||||
ret.seperatedThisWeek[
|
||||
moment(ticket.date).format("dddd").toLowerCase()
|
||||
dayjs(ticket.date).format("dddd").toLowerCase()
|
||||
].lab =
|
||||
ret.seperatedThisWeek[
|
||||
moment(ticket.date).format("dddd").toLowerCase()
|
||||
dayjs(ticket.date).format("dddd").toLowerCase()
|
||||
].lab + ticket.productivehrs;
|
||||
if (ticket.ciecacode === "LAR")
|
||||
ret.seperatedThisWeek[
|
||||
moment(ticket.date).format("dddd").toLowerCase()
|
||||
dayjs(ticket.date).format("dddd").toLowerCase()
|
||||
].lar =
|
||||
ret.seperatedThisWeek[
|
||||
moment(ticket.date).format("dddd").toLowerCase()
|
||||
dayjs(ticket.date).format("dddd").toLowerCase()
|
||||
].lar + ticket.productivehrs;
|
||||
} else if (
|
||||
ticketDate.isBetween(
|
||||
@@ -280,7 +280,7 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||
|
||||
listOfDays.forEach((day) => {
|
||||
const r = {
|
||||
date: moment(day).format("MM/DD"),
|
||||
date: dayjs(day).format("MM/DD"),
|
||||
actualhrs: 0,
|
||||
productivehrs: 0,
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Switch,
|
||||
Typography,
|
||||
} from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -49,8 +49,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
const statisticWeight = isLarge ? 550 : "normal";
|
||||
const daySpan =
|
||||
Util.CalculateWorkingDaysInPeriod(
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week")
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week")
|
||||
) > 5
|
||||
? 3
|
||||
: 4;
|
||||
@@ -170,14 +170,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalThisWeek) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
) +
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -202,8 +202,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalThisWeekLAB) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -226,8 +226,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalThisWeekLAR) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -252,14 +252,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalLastWeek) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
) +
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -284,8 +284,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalLastWeekLAB) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -308,8 +308,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalLastWeekLAR) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -334,14 +334,14 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalPriorWeek) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
) +
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -366,8 +366,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalPriorWeekLAB) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
@@ -390,8 +390,8 @@ export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||
parseFloat(data.totalPriorWeekLAR) >=
|
||||
Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
? "green"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CalendarOutlined } from "@ant-design/icons";
|
||||
import { Card, Col, Divider, Row, Statistic } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -46,8 +46,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
title={t("scoreboard.labels.thisweek")}
|
||||
value={Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
)}
|
||||
/>
|
||||
@@ -57,8 +57,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
title={t("scoreboard.labels.lastweek")}
|
||||
value={Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
)}
|
||||
/>
|
||||
@@ -68,8 +68,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
title={t("scoreboard.labels.priorweek")}
|
||||
value={Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
)}
|
||||
/>
|
||||
@@ -113,8 +113,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
<Statistic
|
||||
value={Util.WeeklyTargetHrsInPeriod(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
)}
|
||||
/>
|
||||
@@ -123,8 +123,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
<Statistic
|
||||
value={Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
)}
|
||||
/>
|
||||
@@ -133,8 +133,8 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
<Statistic
|
||||
value={Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
)}
|
||||
/>
|
||||
@@ -182,14 +182,14 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
value={(
|
||||
Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
) +
|
||||
Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().startOf("week"),
|
||||
moment().endOf("week"),
|
||||
dayjs().startOf("week"),
|
||||
dayjs().endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
).toFixed(1)}
|
||||
@@ -200,14 +200,14 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
value={(
|
||||
Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
) +
|
||||
Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(1, "week").startOf("week"),
|
||||
moment().subtract(1, "week").endOf("week"),
|
||||
dayjs().subtract(1, "week").startOf("week"),
|
||||
dayjs().subtract(1, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
).toFixed(1)}
|
||||
@@ -218,14 +218,14 @@ export function ScoreboardTimeticketsTargetsTable({ bodyshop }) {
|
||||
value={(
|
||||
Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyBodyTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
) +
|
||||
Util.WeeklyTargetHrs(
|
||||
bodyshop.scoreboard_target.dailyPaintTarget,
|
||||
moment().subtract(2, "week").startOf("week"),
|
||||
moment().subtract(2, "week").endOf("week"),
|
||||
dayjs().subtract(2, "week").startOf("week"),
|
||||
dayjs().subtract(2, "week").endOf("week"),
|
||||
bodyshop
|
||||
)
|
||||
).toFixed(1)}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Col, Row } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useMemo } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
@@ -16,22 +16,22 @@ export default function ScoreboardTimeTickets() {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { start, end } = searchParams;
|
||||
const startDate = start
|
||||
? moment(start)
|
||||
: moment().startOf("week").subtract(7, "days");
|
||||
const endDate = end ? moment(end) : moment().endOf("week");
|
||||
? dayjs(start)
|
||||
: dayjs().startOf("week").subtract(7, "days");
|
||||
const endDate = end ? dayjs(end) : dayjs().endOf("week");
|
||||
|
||||
const fixedPeriods = useMemo(() => {
|
||||
const endOfThisMonth = moment().endOf("month");
|
||||
const startofthisMonth = moment().startOf("month");
|
||||
const endOfThisMonth = dayjs().endOf("month");
|
||||
const startofthisMonth = dayjs().startOf("month");
|
||||
|
||||
const endOfLastmonth = moment().subtract(1, "month").endOf("month");
|
||||
const startOfLastmonth = moment().subtract(1, "month").startOf("month");
|
||||
const endOfLastmonth = dayjs().subtract(1, "month").endOf("month");
|
||||
const startOfLastmonth = dayjs().subtract(1, "month").startOf("month");
|
||||
|
||||
const endOfThisWeek = moment().endOf("week");
|
||||
const startOfThisWeek = moment().startOf("week");
|
||||
const endOfThisWeek = dayjs().endOf("week");
|
||||
const startOfThisWeek = dayjs().startOf("week");
|
||||
|
||||
const endOfLastWeek = moment().subtract(1, "week").endOf("week");
|
||||
const startOfLastWeek = moment().subtract(1, "week").startOf("week");
|
||||
const endOfLastWeek = dayjs().subtract(1, "week").endOf("week");
|
||||
const startOfLastWeek = dayjs().subtract(1, "week").startOf("week");
|
||||
|
||||
const allDates = [
|
||||
endOfThisMonth,
|
||||
@@ -43,8 +43,8 @@ export default function ScoreboardTimeTickets() {
|
||||
endOfLastWeek,
|
||||
startOfLastWeek,
|
||||
];
|
||||
const start = moment.min(allDates);
|
||||
const end = moment.max(allDates);
|
||||
const start = dayjs.min(allDates);
|
||||
const end = dayjs.max(allDates);
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
@@ -85,7 +85,7 @@ export default function ScoreboardTimeTickets() {
|
||||
employees: {},
|
||||
};
|
||||
data.fixedperiod.forEach((ticket) => {
|
||||
const ticketDate = moment(ticket.date);
|
||||
const ticketDate = dayjs(ticket.date);
|
||||
|
||||
if (!ret.employees[ticket.employee.employee_number]) {
|
||||
ret.employees[ticket.employee.employee_number] = {
|
||||
@@ -167,7 +167,7 @@ export default function ScoreboardTimeTickets() {
|
||||
|
||||
listOfDays.forEach((day) => {
|
||||
const r = {
|
||||
date: moment(day).format("MM/DD"),
|
||||
date: dayjs(day).format("MM/DD"),
|
||||
actualtotal: 0,
|
||||
productivetotal: 0,
|
||||
employees: {},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, notification, Popover, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
@@ -78,7 +78,7 @@ export default function ShopEmployeeAddVacation({ employee }) {
|
||||
async validator(rule, value) {
|
||||
if (value) {
|
||||
const { start } = form.getFieldsValue();
|
||||
if (moment(start).isAfter(moment(value))) {
|
||||
if (dayjs(start).isAfter(dayjs(value))) {
|
||||
return Promise.reject(
|
||||
t("employees.labels.endmustbeafterstart")
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
Table,
|
||||
} from "antd";
|
||||
import { useForm } from "antd/es/form/Form";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -132,7 +132,7 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
||||
dataIndex: "length",
|
||||
key: "length",
|
||||
render: (text, record) =>
|
||||
moment(record.end).diff(moment(record.start), "days", true).toFixed(1),
|
||||
dayjs(record.end).diff(dayjs(record.start), "days", true).toFixed(1),
|
||||
},
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery } from "@apollo/client";
|
||||
import { Form, notification } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
@@ -58,21 +58,21 @@ export default function ShopInfoContainer() {
|
||||
accountingconfig: {
|
||||
...data.bodyshops[0].accountingconfig,
|
||||
ClosingPeriod: [
|
||||
moment(data.bodyshops[0].accountingconfig.ClosingPeriod[0]),
|
||||
moment(data.bodyshops[0].accountingconfig.ClosingPeriod[1]),
|
||||
dayjs(data.bodyshops[0].accountingconfig.ClosingPeriod[0]),
|
||||
dayjs(data.bodyshops[0].accountingconfig.ClosingPeriod[1]),
|
||||
],
|
||||
},
|
||||
schedule_start_time: moment(
|
||||
schedule_start_time: dayjs(
|
||||
data.bodyshops[0].schedule_start_time
|
||||
),
|
||||
schedule_end_time: moment(data.bodyshops[0].schedule_end_time),
|
||||
schedule_end_time: dayjs(data.bodyshops[0].schedule_end_time),
|
||||
}
|
||||
: {
|
||||
...data.bodyshops[0],
|
||||
schedule_start_time: moment(
|
||||
schedule_start_time: dayjs(
|
||||
data.bodyshops[0].schedule_start_time
|
||||
),
|
||||
schedule_end_time: moment(data.bodyshops[0].schedule_end_time),
|
||||
schedule_end_time: dayjs(data.bodyshops[0].schedule_end_time),
|
||||
}
|
||||
: null
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
Space,
|
||||
Switch,
|
||||
} from "antd";
|
||||
import momentTZ from "moment-timezone";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -25,7 +24,8 @@ import PhoneFormItem, {
|
||||
} from "../form-items-formatted/phone-form-item.component";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
const timeZonesList = momentTZ.tz.names();
|
||||
// TODO: Client Update, this might break
|
||||
const timeZonesList = Intl.supportedValuesOf('timeZone');
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, notification, Space } from "antd";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import momenttz from "moment-timezone";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -58,13 +57,14 @@ export function TechClockInContainer({
|
||||
employeeid: technician.id,
|
||||
date:
|
||||
typeof bodyshop.timezone === "string"
|
||||
? momenttz.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
|
||||
// TODO: Client Update - This may be broken
|
||||
? dayjs.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
|
||||
: typeof bodyshop.timezone === "number"
|
||||
? moment(theTime)
|
||||
? dayjs(theTime)
|
||||
.format("YYYY-MM-DD")
|
||||
.utcOffset(bodyshop.timezone)
|
||||
: moment(theTime).format("YYYY-MM-DD"),
|
||||
clockon: moment(theTime),
|
||||
: dayjs(theTime).format("YYYY-MM-DD"),
|
||||
clockon: dayjs(theTime),
|
||||
jobid: values.jobid,
|
||||
cost_center: values.cost_center,
|
||||
ciecacode:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, Card, DatePicker, Form, Popover, Radio, Space } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -51,13 +51,13 @@ export function TechJobPrintTickets({ technician, event, attendacePrint }) {
|
||||
: Templates.timetickets_employee.key,
|
||||
variables: {
|
||||
...(start
|
||||
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
||||
? { start: dayjs(start).startOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(end
|
||||
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
|
||||
? { end: dayjs(end).endOf("day").format("YYYY-MM-DD") }
|
||||
: {}),
|
||||
...(start ? { starttz: moment(start).startOf("day") } : {}),
|
||||
...(end ? { endtz: moment(end).endOf("day") } : {}),
|
||||
...(start ? { starttz: dayjs(start).startOf("day") } : {}),
|
||||
...(end ? { endtz: dayjs(end).endOf("day") } : {}),
|
||||
|
||||
id: technician.id,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Card, Col, Space, Statistic, Typography } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -19,8 +19,8 @@ const mapDispatchToProps = (dispatch) => ({});
|
||||
const TechJobStatistics = ({ technician }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const startDate = moment().startOf("week");
|
||||
const endDate = moment().endOf("week");
|
||||
const startDate = dayjs().startOf("week");
|
||||
const endDate = dayjs().endOf("week");
|
||||
|
||||
const { loading, error, data } = useQuery(
|
||||
QUERY_TIME_TICKETS_TECHNICIAN_IN_RANGE,
|
||||
@@ -28,8 +28,8 @@ const TechJobStatistics = ({ technician }) => {
|
||||
variables: {
|
||||
start: startDate.format("YYYY-MM-DD"),
|
||||
end: endDate.format("YYYY-MM-DD"),
|
||||
fixedStart: moment().startOf("month").format("YYYY-MM-DD"),
|
||||
fixedEnd: moment().endOf("month").format("YYYY-MM-DD"),
|
||||
fixedStart: dayjs().startOf("month").format("YYYY-MM-DD"),
|
||||
fixedEnd: dayjs().endOf("month").format("YYYY-MM-DD"),
|
||||
employeeid: technician.id,
|
||||
},
|
||||
fetchPolicy: "network-only",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import DatePickerRanges from "../../utils/DatePickerRanges";
|
||||
import { DatePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React from "react";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
@@ -37,8 +37,8 @@ export default function TimeTicketsDatesSelector() {
|
||||
return (
|
||||
<DatePicker.RangePicker
|
||||
defaultValue={[
|
||||
start ? moment(start) : moment().startOf("week").subtract(7, "days"),
|
||||
end ? moment(end) : moment().endOf("week"),
|
||||
start ? dayjs(start) : dayjs().startOf("week").subtract(7, "days"),
|
||||
end ? dayjs(end) : dayjs().endOf("week"),
|
||||
]}
|
||||
format="MM/DD/YYYY"
|
||||
ranges={DatePickerRanges}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EditFilled } from "@ant-design/icons";
|
||||
import { Card, Space, Table } from "antd";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -186,8 +186,8 @@ export function TimeTicketList({
|
||||
if (record.clockoff && record.clockon)
|
||||
return (
|
||||
<div>
|
||||
{moment(record.clockoff)
|
||||
.diff(moment(record.clockon), "hours", true)
|
||||
{dayjs(record.clockoff)
|
||||
.diff(dayjs(record.clockon), "hours", true)
|
||||
.toFixed(2)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -291,6 +291,7 @@ export function TimeTicketModalComponent({
|
||||
return Promise.reject(
|
||||
t("timetickets.validation.clockoffwithoutclockon")
|
||||
);
|
||||
// TODO - Verify this exists
|
||||
if (
|
||||
value &&
|
||||
value.isSameOrAfter &&
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMutation, useQuery } from "@apollo/client";
|
||||
import { Button, Form, Modal, Space, notification } from "antd";
|
||||
import {PageHeader} from "@ant-design/pro-layout";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -210,7 +210,7 @@ export function TimeTicketModalContainer({
|
||||
timeTicketModal.context.timeticket.jobid ||
|
||||
null,
|
||||
date: timeTicketModal.context.timeticket.date
|
||||
? moment(timeTicketModal.context.timeticket.date)
|
||||
? dayjs(timeTicketModal.context.timeticket.date)
|
||||
: null,
|
||||
}
|
||||
: { jobid: timeTicketModal.context.jobId || null }
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Form, Space, notification } from "antd";
|
||||
import axios from "axios";
|
||||
import moment from "moment";
|
||||
import momenttz from "moment-timezone";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -59,7 +58,7 @@ export function TimeTicektShiftContainer({
|
||||
message: t("timetickets.errors.shiftalreadyclockedon"),
|
||||
});
|
||||
} else {
|
||||
const theTime = moment((await axios.post("/utils/time")).data);
|
||||
const theTime = dayjs((await axios.post("/utils/time")).data);
|
||||
|
||||
const result = await insertTimeTicket({
|
||||
variables: {
|
||||
@@ -71,12 +70,13 @@ export function TimeTicektShiftContainer({
|
||||
clockon: theTime,
|
||||
date:
|
||||
typeof bodyshop.timezone === "string"
|
||||
? momenttz.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
|
||||
// TODO: Client Update - This may be broken
|
||||
? dayjs.tz(theTime, bodyshop.timezone).format("YYYY-MM-DD")
|
||||
: typeof bodyshop.timezone === "number"
|
||||
? moment(theTime)
|
||||
? dayjs(theTime)
|
||||
.utcOffset(bodyshop.timezone)
|
||||
.format("YYYY-MM-DD")
|
||||
: moment(theTime).format("YYYY-MM-DD"),
|
||||
: dayjs(theTime).format("YYYY-MM-DD"),
|
||||
memo: values.memo,
|
||||
created_by: isTechConsole
|
||||
? currentUser.email.concat(
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useLocation } from "react-router-dom";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
const AttendanceCsv = TemplateList("special").attendance_detail_csv;
|
||||
|
||||
export default function TimeTicketsAttendanceTable() {
|
||||
@@ -23,8 +23,8 @@ export default function TimeTicketsAttendanceTable() {
|
||||
variables: {
|
||||
start: start
|
||||
? start
|
||||
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
|
||||
end: end ? end : moment().endOf("week").format("YYYY-MM-DD"),
|
||||
: dayjs().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
|
||||
end: end ? end : dayjs().endOf("week").format("YYYY-MM-DD"),
|
||||
},
|
||||
},
|
||||
{},
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useLocation } from "react-router-dom";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
const PayrollTemplate = TemplateList("special").exported_payroll;
|
||||
export default function TimeTicketsPayrollTable() {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
@@ -22,8 +22,8 @@ export default function TimeTicketsPayrollTable() {
|
||||
variables: {
|
||||
start: start
|
||||
? start
|
||||
: moment().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
|
||||
end: end ? end : moment().endOf("week").format("YYYY-MM-DD"),
|
||||
: dayjs().startOf("week").subtract(7, "days").format("YYYY-MM-DD"),
|
||||
end: end ? end : dayjs().endOf("week").format("YYYY-MM-DD"),
|
||||
},
|
||||
},
|
||||
{},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Card, Col, Row, Table } from "antd";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -124,7 +124,7 @@ const JobRelatedTicketsTable = ({
|
||||
if (!!val.clockoff && !!val.clockon)
|
||||
return (
|
||||
acc +
|
||||
moment(val.clockoff).diff(moment(val.clockon), "hours", true)
|
||||
dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
|
||||
);
|
||||
return acc;
|
||||
}, 0);
|
||||
@@ -251,7 +251,7 @@ const ShiftRelatedTicketsTable = ({
|
||||
const clockHrs = item.tickets.reduce((acc, val) => {
|
||||
if (!!val.clockoff && !!val.clockon)
|
||||
return (
|
||||
acc + moment(val.clockoff).diff(moment(val.clockon), "hours", true)
|
||||
acc + dayjs(val.clockoff).diff(dayjs(val.clockon), "hours", true)
|
||||
);
|
||||
return acc;
|
||||
}, 0);
|
||||
|
||||
@@ -4,7 +4,7 @@ import {PageHeader} from "@ant-design/pro-layout";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import VehicleDetailFormComponent from "./vehicle-detail-form.component";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { DELETE_VEHICLE, UPDATE_VEHICLE } from "../../graphql/vehicles.queries";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
@@ -97,7 +97,7 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
|
||||
layout="vertical"
|
||||
initialValues={{
|
||||
...vehicle,
|
||||
v_prod_dt: vehicle.v_prod_dt ? moment(vehicle.v_prod_dt) : null,
|
||||
v_prod_dt: vehicle.v_prod_dt ? dayjs(vehicle.v_prod_dt) : null,
|
||||
}}
|
||||
>
|
||||
<VehicleDetailFormComponent form={form} loading={loading} />
|
||||
|
||||
Reference in New Issue
Block a user