diff --git a/src/actions/cShift/reducer.actions.js b/src/actions/cShift/reducer.actions.js index 012a246..61cbf2b 100644 --- a/src/actions/cShift/reducer.actions.js +++ b/src/actions/cShift/reducer.actions.js @@ -10,6 +10,7 @@ import { SET_FORM_SHIFT_DURATION, SET_FORM_SHIFT_NOTE, SET_FORM_SHIFT_DATES, + SET_CSHIFT_UUID, SET_CLEAR_CSHIFT_STATE } from "../../constants/cShift.constants"; import { parseError } from "../common.actions"; @@ -43,7 +44,7 @@ export function setCShiftRequestErrors(exceptions) { return { type: SET_CSHIFT_REQUEST_ERRORS, data: errors - } + }; } export function clearCShiftRequestError() { @@ -107,6 +108,13 @@ export function setFormShiftDates(dates) { }; } +export function setCShiftUUID(uuid) { + return { + type: SET_CSHIFT_UUID, + data: uuid + }; +} + export function setClearCShiftState() { return { type: SET_CLEAR_CSHIFT_STATE diff --git a/src/actions/cShift/saga.actions.js b/src/actions/cShift/saga.actions.js index 319d642..00817b9 100644 --- a/src/actions/cShift/saga.actions.js +++ b/src/actions/cShift/saga.actions.js @@ -1,6 +1,8 @@ import { CREATE_MULTIPLE_CSHIFT_REQUEST, - GET_CSHIFTS_REQUEST + GET_CSHIFTS_REQUEST, + GET_CSHIFT_REQUEST, + EDIT_CSHIFT_REQUEST } from "../../constants/cShift.constants"; /** @@ -20,3 +22,17 @@ export function getCShiftsRequest(params) { data: params }; } + +export function getCShiftRequest(payload) { + return { + type: GET_CSHIFT_REQUEST, + data: payload + }; +} + +export function editCShiftRequest(payload) { + return { + type: EDIT_CSHIFT_REQUEST, + data: payload + } +} diff --git a/src/api/cShift.api.js b/src/api/cShift.api.js index fbdba4a..cd76d04 100644 --- a/src/api/cShift.api.js +++ b/src/api/cShift.api.js @@ -1,4 +1,4 @@ -import { get, post } from "./baseApi"; +import { get, put, post } from "./baseApi"; export function createCShifts(postBodies) { return Promise.all( @@ -15,3 +15,11 @@ export function createCShifts(postBodies) { export function getCShifts(params) { return get("/cshift/", params).then(resp => Promise.resolve(resp)); } + +export function getCShift(uuid, params) { + return get(`/cshift/${uuid}/`, params).then(resp => Promise.resolve(resp)); +} + +export function editCShift(uuid, payload) { + return put(`/cshift/${uuid}/`, payload).then(resp => Promise.resolve(resp)); +} diff --git a/src/components/App.jsx b/src/components/App.jsx index 2657166..3165060 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -16,6 +16,7 @@ import UpdatePriceForm from "./User/Client/UpdatePriceForm"; import ClientAddProviderForm from "./User/Client/ClientAddProviderForm"; import ClientShifts from "./User/Client/ClientShifts"; import ClientAddShiftForm from "./User/Client/ClientAddShiftForm"; +import ClientEditShiftForm from "./User/Client/ClientEditShiftForm"; import ProviderClients from "./User/Provider/ProviderClients"; import CompleteRegistration from "./User/CompleteRegistration"; import EditProfile from "./User/EditProfile"; @@ -92,6 +93,10 @@ class App extends Component { path="/user/profile/client/add-shift" component={ClientAddShiftForm} /> + { @@ -177,7 +151,7 @@ class ClientAddShiftForm extends Component { key => shiftDates[key] ); return ( - ( - -
Schedule Shifts
-
- - - - - - - - - - - - - - - - - - - - -