- Merge client update into test-beta
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import moment from "moment";
|
||||
import dayjs from "../../utils/day";
|
||||
import { all, call, put, select, takeLatest } from "redux-saga/effects";
|
||||
import { QUERY_SCHEDULE_LOAD_DATA } from "../../graphql/appointments.queries";
|
||||
import { INSERT_AUDIT_TRAIL } from "../../graphql/audit_trail.queries";
|
||||
@@ -18,8 +18,8 @@ export function* onCalculateScheduleLoad() {
|
||||
);
|
||||
}
|
||||
export function* calculateScheduleLoad({ payload: end }) {
|
||||
//REMINDER: Moment.js is not immutable. Today WILL change when adjusted.
|
||||
const today = moment().startOf("day");
|
||||
//REMINDER: dayjs.js is not immutable. Today WILL change when adjusted.
|
||||
const today = dayjs().startOf("day");
|
||||
const state = yield select();
|
||||
const buckets = state.user.bodyshop.ssbuckets;
|
||||
|
||||
@@ -47,7 +47,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
//Add all of the jobs currently in production to the buckets so that we have a starting point.
|
||||
if (
|
||||
!item.actual_completion &&
|
||||
moment(item.scheduled_completion).isBefore(moment().startOf("day"))
|
||||
dayjs(item.scheduled_completion).isBefore(dayjs().startOf("day"))
|
||||
) {
|
||||
problemJobs.push({
|
||||
...item,
|
||||
@@ -57,7 +57,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
|
||||
if (
|
||||
item.actual_completion &&
|
||||
moment(item.actual_completion).isBefore(moment().startOf("day"))
|
||||
dayjs(item.actual_completion).isBefore(dayjs().startOf("day"))
|
||||
) {
|
||||
problemJobs.push({
|
||||
...item,
|
||||
@@ -98,7 +98,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
code: "Job has an actual in date, but no actual completion date and is not marked as in production",
|
||||
});
|
||||
}
|
||||
if (item.actual_in && moment(item.actual_in).isAfter(moment())) {
|
||||
if (item.actual_in && dayjs(item.actual_in).isAfter(dayjs())) {
|
||||
problemJobs.push({
|
||||
...item,
|
||||
code: "Job has an actual in date set in the future",
|
||||
@@ -106,7 +106,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
}
|
||||
if (
|
||||
item.actual_completion &&
|
||||
moment(item.actual_completion).isAfter(moment())
|
||||
dayjs(item.actual_completion).isAfter(dayjs())
|
||||
) {
|
||||
problemJobs.push({
|
||||
...item,
|
||||
@@ -120,8 +120,8 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
});
|
||||
}
|
||||
|
||||
const itemDate = moment(item.actual_in || item.scheduled_in).format(
|
||||
"yyyy-MM-DD"
|
||||
const itemDate = dayjs(item.actual_in || item.scheduled_in).format(
|
||||
"YYYY-MM-DD"
|
||||
);
|
||||
|
||||
const AddJobForSchedulingCalc = !item.inproduction;
|
||||
@@ -169,9 +169,9 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
|
||||
const AddJobForSchedulingCalc = inProdJobs || inArrJobs;
|
||||
|
||||
const itemDate = moment(
|
||||
const itemDate = dayjs(
|
||||
item.actual_completion || item.scheduled_completion
|
||||
).format("yyyy-MM-DD");
|
||||
).format("YYYY-MM-DD");
|
||||
//Skip it, it's already completed.
|
||||
|
||||
if (!!load[itemDate]) {
|
||||
@@ -207,12 +207,12 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
|
||||
//Propagate the expected load to each day.
|
||||
|
||||
const range = Math.round(moment.duration(end.diff(today)).asDays()) + 1;
|
||||
const range = Math.round(dayjs.duration(end.diff(today)).asDays()) + 1;
|
||||
for (var day = 0; day < range; day++) {
|
||||
const current = moment(today).add(day, "days").format("yyyy-MM-DD");
|
||||
const prev = moment(today)
|
||||
.add(day - 1, "days")
|
||||
.format("yyyy-MM-DD");
|
||||
const current = dayjs(today).add(day, "day").format("YYYY-MM-DD");
|
||||
const prev = dayjs(today)
|
||||
.add(day - 1, "day")
|
||||
.format("YYYY-MM-DD");
|
||||
if (!!!load[current]) {
|
||||
load[current] = {};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const INITIAL_STATE = {
|
||||
template: { name: null, variables: {} },
|
||||
},
|
||||
|
||||
visible: false,
|
||||
open: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
@@ -19,13 +19,13 @@ const emailReducer = (state = INITIAL_STATE, action) => {
|
||||
case EmailActionTypes.TOGGLE_EMAIL_OVERLAY_VISIBLE:
|
||||
return {
|
||||
...state,
|
||||
visible: !state.visible,
|
||||
open: !state.open,
|
||||
};
|
||||
case EmailActionTypes.SET_EMAIL_OPTIONS:
|
||||
return {
|
||||
...state,
|
||||
emailConfig: { ...action.payload },
|
||||
visible: true,
|
||||
open: true,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
||||
@@ -4,7 +4,7 @@ const selectEmail = (state) => state.email;
|
||||
|
||||
export const selectEmailVisible = createSelector(
|
||||
[selectEmail],
|
||||
(email) => email.visible
|
||||
(email) => email.open
|
||||
);
|
||||
|
||||
export const selectEmailConfig = createSelector(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import MessagingActionTypes from "./messaging.types";
|
||||
|
||||
const INITIAL_STATE = {
|
||||
visible: false,
|
||||
open: false,
|
||||
selectedConversationId: null,
|
||||
isSending: false,
|
||||
error: null,
|
||||
@@ -16,7 +16,7 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
|
||||
case MessagingActionTypes.TOGGLE_CHAT_VISIBLE:
|
||||
return {
|
||||
...state,
|
||||
visible: !state.visible,
|
||||
open: !state.open,
|
||||
};
|
||||
case MessagingActionTypes.OPEN_CHAT_BY_PHONE:
|
||||
return {
|
||||
@@ -26,7 +26,7 @@ const messagingReducer = (state = INITIAL_STATE, action) => {
|
||||
case MessagingActionTypes.SET_SELECTED_CONVERSATION:
|
||||
return {
|
||||
...state,
|
||||
visible: true,
|
||||
open: true,
|
||||
searchingForConversation: false,
|
||||
selectedConversationId: action.payload,
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ const selectMessaging = (state) => state.messaging;
|
||||
|
||||
export const selectChatVisible = createSelector(
|
||||
[selectMessaging],
|
||||
(messaging) => messaging.visible
|
||||
(messaging) => messaging.open
|
||||
);
|
||||
|
||||
export const selectIsSending = createSelector(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ModalsActionTypes from "./modals.types";
|
||||
|
||||
const baseModal = {
|
||||
visible: false,
|
||||
open: false,
|
||||
context: {},
|
||||
actions: {
|
||||
refetch: null,
|
||||
@@ -36,7 +36,7 @@ const modalsReducer = (state = INITIAL_STATE, action) => {
|
||||
...state,
|
||||
[action.payload]: {
|
||||
...state[action.payload],
|
||||
visible: !state[action.payload].visible,
|
||||
open: !state[action.payload].open,
|
||||
},
|
||||
};
|
||||
case ModalsActionTypes.SET_MODAL_CONTEXT:
|
||||
@@ -45,7 +45,7 @@ const modalsReducer = (state = INITIAL_STATE, action) => {
|
||||
[action.payload.modal]: {
|
||||
...state[action.payload.modal],
|
||||
...action.payload.context,
|
||||
visible: true,
|
||||
open: true,
|
||||
},
|
||||
};
|
||||
default:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { createStore, applyMiddleware, compose } from "redux";
|
||||
import { persistStore } from "redux-persist";
|
||||
import { configureStore } from '@reduxjs/toolkit';
|
||||
import {
|
||||
persistStore,
|
||||
} from "redux-persist";
|
||||
import { createLogger } from "redux-logger";
|
||||
import createSagaMiddleware from "redux-saga";
|
||||
import {
|
||||
@@ -26,24 +28,21 @@ const middlewares = [
|
||||
sagaMiddleWare,
|
||||
createStateSyncMiddleware(reduxSyncConfig),
|
||||
];
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
middlewares.push(createLogger({ collapsed: true, diff: true }));
|
||||
}
|
||||
//middlewares.push(Tracker.use(trackerRedux()));
|
||||
const composeEnhancers =
|
||||
typeof window === "object" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
||||
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
|
||||
})
|
||||
: compose;
|
||||
|
||||
const enhancer = composeEnhancers(
|
||||
applyMiddleware(...middlewares),
|
||||
sentryReduxEnhancer
|
||||
// other store enhancers if any
|
||||
);
|
||||
export const store = configureStore({
|
||||
reducer: rootReducer,
|
||||
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
||||
serializableCheck: false,
|
||||
}).concat(middlewares),
|
||||
// middleware: middlewares,
|
||||
devTools: process.env.NODE_ENV !== 'production',
|
||||
enhancers: (getDefaultEnhancers) => getDefaultEnhancers().concat(sentryReduxEnhancer)
|
||||
});
|
||||
|
||||
export const store = createStore(rootReducer, enhancer);
|
||||
sagaMiddleWare.run(rootSaga);
|
||||
initMessageListener(store);
|
||||
|
||||
@@ -53,4 +52,4 @@ export default e;
|
||||
|
||||
if (window.Cypress) {
|
||||
window.store = store;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
const userEmail = yield select((state) => state.user.currentUser.email);
|
||||
try {
|
||||
//console.log("Setting shop timezone.");
|
||||
// moment.tz.setDefault(payload.timezone);
|
||||
// dayjs.tz.setDefault(payload.timezone);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user