Fully functional widgets for adding shifts

- todo: wait for React Datepicker PR 1380
- batch api call and saga handlers
- view/edit
This commit is contained in:
Alexander Wong
2018-04-19 10:30:33 -06:00
parent 0c8defd469
commit 530593b721
5 changed files with 117 additions and 22 deletions
+18 -4
View File
@@ -8,6 +8,8 @@ import {
SET_FORM_PRICE_UUID,
SET_FORM_SHIFT_START_TIME,
SET_FORM_SHIFT_DURATION,
SET_FORM_SHIFT_NOTE,
SET_FORM_SHIFT_DATES,
SET_CLEAR_CSHIFT_STATE
} from "../constants/cShift.constants";
@@ -15,10 +17,12 @@ const initialState = {
isSendingCShiftRequest: false,
cShiftRequestError: "",
cShiftRequestSuccess: "",
employeeUUID: "",
priceUUID: "",
startTime: null,
duration: 60
employeeUUID: "", // Which employee
priceUUID: "", // Which price
startTime: null, // When does the shift begin? moment instance
duration: "", // Duration of shift in minutes
note: "", // Optional note
shiftDates: {} // Dates, map of "YYYY-MM-DD" > moment instance
};
function cShiftReducer(state = initialState, action) {
@@ -68,6 +72,16 @@ function cShiftReducer(state = initialState, action) {
...state,
duration: action.data
};
case SET_FORM_SHIFT_NOTE:
return {
...state,
note: action.data
};
case SET_FORM_SHIFT_DATES:
return {
...state,
shiftDates: action.data
};
case SET_CLEAR_CSHIFT_STATE:
return {
...initialState