IO-1708 Add shop timezone & update server side calculations.
This commit is contained in:
@@ -38,6 +38,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
|
||||
if (!!ticketsByDate[val]) {
|
||||
dailyHrs = ticketsByDate[val].reduce(
|
||||
(dayAcc, dayVal) => {
|
||||
console.log(dayAcc);
|
||||
return {
|
||||
actual: dayAcc.actual + dayVal.actualhrs,
|
||||
productive: dayAcc.actual + dayVal.productivehrs,
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
import { DatePicker } from "antd";
|
||||
import moment from "moment";
|
||||
import moment from "moment-timezone";
|
||||
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))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
|
||||
|
||||
const dateFormat = "MM/DD/YYYY";
|
||||
|
||||
export default function FormDatePicker({
|
||||
export function FormDatePicker({
|
||||
bodyshop,
|
||||
value,
|
||||
onChange,
|
||||
onBlur,
|
||||
@@ -23,7 +36,7 @@ export default function FormDatePicker({
|
||||
const handleKeyDown = (e) => {
|
||||
if (e.key.toLowerCase() === "t") {
|
||||
if (onChange) {
|
||||
onChange(new moment());
|
||||
onChange(moment());
|
||||
// if (ref.current && ref.current.blur) ref.current.blur();
|
||||
}
|
||||
} else if (e.key.toLowerCase() === "enter") {
|
||||
|
||||
@@ -65,6 +65,7 @@ export function ScheduleCalendarContainer({ calculateScheduleLoad }) {
|
||||
color: "red",
|
||||
start: moment(e.start).startOf("day").toDate(),
|
||||
end: moment(e.end).startOf("day").toDate(),
|
||||
allDay: true,
|
||||
vacation: true,
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -19,6 +19,9 @@ import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||
|
||||
import momentTZ from "moment-timezone";
|
||||
const timeZonesList = momentTZ.tz.names();
|
||||
|
||||
export default function ShopInfoGeneral({ form }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
@@ -84,6 +87,7 @@ export default function ShopInfoGeneral({ form }) {
|
||||
<Form.Item label={t("bodyshop.fields.email")} name="email">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.phone")}
|
||||
name="phone"
|
||||
@@ -97,6 +101,23 @@ export default function ShopInfoGeneral({ form }) {
|
||||
<Form.Item label={t("bodyshop.fields.website")} name="website">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.timezone")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name="timezone"
|
||||
>
|
||||
<Select
|
||||
showSearch
|
||||
options={timeZonesList.map((z) => {
|
||||
return { label: z, value: z };
|
||||
})}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.insurance_vendor_id")}
|
||||
name="insurance_vendor_id"
|
||||
|
||||
@@ -100,6 +100,7 @@ export const QUERY_BODYSHOP = gql`
|
||||
pbs_serialnumber
|
||||
md_filehandlers
|
||||
md_email_cc
|
||||
timezone
|
||||
employees {
|
||||
user_email
|
||||
id
|
||||
@@ -197,6 +198,7 @@ export const UPDATE_SHOP = gql`
|
||||
pbs_serialnumber
|
||||
md_filehandlers
|
||||
md_email_cc
|
||||
timezone
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
|
||||
@@ -41,6 +41,9 @@ import UserActionTypes from "./user.types";
|
||||
import axios from "axios";
|
||||
import { messaging } from "../../firebase/firebase.utils";
|
||||
import { getToken } from "firebase/messaging";
|
||||
|
||||
import moment from "moment-timezone";
|
||||
|
||||
export function* onEmailSignInStart() {
|
||||
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
|
||||
}
|
||||
@@ -266,6 +269,12 @@ export function* onSetShopDetails() {
|
||||
export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
try {
|
||||
const userEmail = yield select((state) => state.user.currentUser.email);
|
||||
try {
|
||||
console.log("Setting shop timezone.");
|
||||
moment.tz.setDefault(payload.timezone);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
factory.client(payload.imexshopid);
|
||||
|
||||
|
||||
@@ -483,6 +483,7 @@
|
||||
"production_statuses": "Production Statuses"
|
||||
},
|
||||
"target_touchtime": "Target Touch Time",
|
||||
"timezone": "Timezone",
|
||||
"tt_allow_post_to_invoiced": "Allow Time Tickets to be posted to Invoiced & Exported Jobs",
|
||||
"use_fippa": "Use FIPPA for Names on Generated Documents?",
|
||||
"website": "Website",
|
||||
|
||||
@@ -483,6 +483,7 @@
|
||||
"production_statuses": ""
|
||||
},
|
||||
"target_touchtime": "",
|
||||
"timezone": "",
|
||||
"tt_allow_post_to_invoiced": "",
|
||||
"use_fippa": "",
|
||||
"website": "",
|
||||
|
||||
@@ -483,6 +483,7 @@
|
||||
"production_statuses": ""
|
||||
},
|
||||
"target_touchtime": "",
|
||||
"timezone": "",
|
||||
"tt_allow_post_to_invoiced": "",
|
||||
"use_fippa": "",
|
||||
"website": "",
|
||||
|
||||
Reference in New Issue
Block a user