From 4c639db50f2ece085c370f8f07e23a33ee1b6cea Mon Sep 17 00:00:00 2001 From: Alexander Wong Date: Mon, 23 Apr 2018 12:19:14 -0600 Subject: [PATCH] Working provider check in & check out --- src/actions/pShift/reducer.actions.js | 8 ++ src/components/User/Client/ClientShifts.jsx | 42 +++++- .../User/Provider/ProviderShift.jsx | 130 +++++++++++++++--- .../User/Provider/ProviderShifts.jsx | 43 ++++-- src/constants/pShift.constants.js | 1 + src/reducers/pShiftReducer.js | 9 +- src/sagas/pShift.sagas.js | 4 +- 7 files changed, 201 insertions(+), 36 deletions(-) diff --git a/src/actions/pShift/reducer.actions.js b/src/actions/pShift/reducer.actions.js index 59271a6..dabbc9c 100644 --- a/src/actions/pShift/reducer.actions.js +++ b/src/actions/pShift/reducer.actions.js @@ -4,6 +4,7 @@ import { SET_PSHIFT_REQUEST_ERROR, CLEAR_PSHIFT_REQUEST_ERROR, CLEAR_PSHIFT_REQUEST_SUCCESS, + SET_FORM_SHIFT_CHART, SET_CLEAR_PSHIFT_STATE } from "../../constants/pShift.constants"; import { parseError } from "../common.actions"; @@ -42,6 +43,13 @@ export function clearPShiftRequestSuccess() { }; } +export function setFormShiftChart(chart) { + return { + type: SET_FORM_SHIFT_CHART, + data: chart + }; +} + export function setClearPShiftState() { return { type: SET_CLEAR_PSHIFT_STATE diff --git a/src/components/User/Client/ClientShifts.jsx b/src/components/User/Client/ClientShifts.jsx index feb866f..cd007c4 100644 --- a/src/components/User/Client/ClientShifts.jsx +++ b/src/components/User/Client/ClientShifts.jsx @@ -11,7 +11,9 @@ import { Pagination, Popup, Loader, - Label + Label, + List, + Message } from "semantic-ui-react"; import { getCShiftsRequest, @@ -114,6 +116,10 @@ const ClientShiftsView = ({ const provider = employee.provider || {}; const price = getPriceFromPrice(result.price, user) || {}; const workType = price.work_type; + const checkedIn = + !!result.actual_start && utc(result.actual_start, ISO_8601); + const checkedOut = + !!result.actual_end && utc(result.actual_end, ISO_8601); const min = duration( utc(result.set_end, ISO_8601) - utc(result.set_start, ISO_8601), "milliseconds" @@ -173,7 +179,7 @@ const ClientShiftsView = ({ {provider.email} - {result.actual_start === null && ( + {!checkedIn && ( + {!checkedIn && ( + + {!approved && ( + + )} + {!rejected && ( + + )} + + )} + + {!checkedIn && Pending Check In}{" "} + {checkedIn && ( + + Checked In At:{" "} + {checkedIn.local(false).format("dddd, MMMM Do YYYY, h:mm a Z")} + + )} + {checkedOut && ( + + Checked Out At:{" "} + {checkedOut.local(false).format("dddd, MMMM Do YYYY, h:mm a Z")} + )} - {!rejected && ( - + + {shift.chart && ( + + Chart + {shift.chart} + + )} + {!checkedIn && } + {checkedIn && + !checkedOut && ( +
+ +