added ability for client to adjust shift hours

master
Alexander Wong 6 years ago
parent ffa46b1435
commit fb5f71a881
No known key found for this signature in database
GPG Key ID: E90E5D6448C2C663
  1. 2
      src/api/employer.api.js
  2. 25
      src/components/Shared/ShiftLabel.jsx
  3. 2
      src/components/User/Client/ClientAddShiftForm.jsx
  4. 11
      src/components/User/Client/ClientEditShiftForm.jsx
  5. 9
      src/components/User/Client/ClientShiftFormView.jsx
  6. 198
      src/components/User/Client/ClientShifts.jsx
  7. 47
      src/components/User/Provider/ProviderShift.jsx
  8. 67
      src/components/User/Provider/ProviderShifts.jsx

@ -6,7 +6,7 @@ import { put } from "./baseApi";
* @param {boolean} approved - whether or not to approve employment relationship * @param {boolean} approved - whether or not to approve employment relationship
*/ */
export function updateEmployer(uuid, approved) { export function updateEmployer(uuid, approved) {
return put(`/employer/${uuid}/`, { approved }).then(resp => return put(`/employer/${uuid}/`, { provider_approved: approved }).then(resp =>
Promise.resolve(resp) Promise.resolve(resp)
); );
} }

@ -0,0 +1,25 @@
import React from "react";
import { Label } from "semantic-ui-react";
export default ({
provider_approved,
client_approved_start,
client_approved_end
}) => {
const providerApproved = !!provider_approved;
const clientApproved = !!client_approved_start && providerApproved;
const providerRejected = !provider_approved && provider_approved !== null;
const providerPending = provider_approved === null;
return (
<Label
color={providerApproved ? "green" : providerRejected ? "red" : "grey"}
tag
size="small"
>
{!clientApproved && providerApproved && "Provider Approved Shift"}
{clientApproved && "Client Approved Hours"}
{providerPending && "Provider Approval Pending"}
{providerRejected && "Provider Rejected Shift"}
</Label>
);
};

@ -82,6 +82,8 @@ class ClientAddShiftForm extends Component {
get_price_uuid: priceUUID, get_price_uuid: priceUUID,
set_start: dynamicStartTime.format(), set_start: dynamicStartTime.format(),
set_end: dynamicEndTime.format(), set_end: dynamicEndTime.format(),
approved_start: null,
approved_end: null,
description: note ? note : undefined description: note ? note : undefined
}); });
} }

@ -87,6 +87,7 @@ class ClientEditShiftForm extends Component {
event.preventDefault(); event.preventDefault();
// change this into interable cshift post request bodies // change this into interable cshift post request bodies
const { const {
cShiftRequestSuccess,
cShiftUUID, cShiftUUID,
priceUUID, priceUUID,
startTime, startTime,
@ -94,6 +95,8 @@ class ClientEditShiftForm extends Component {
note, note,
shiftDates shiftDates
} = this.props; } = this.props;
const isProviderCheckedIn = !!cShiftRequestSuccess.actual_start;
const postRequestBodies = []; const postRequestBodies = [];
for (let shiftDateString in shiftDates) { for (let shiftDateString in shiftDates) {
const dynamicStartTime = utc(startTime); const dynamicStartTime = utc(startTime);
@ -107,8 +110,10 @@ class ClientEditShiftForm extends Component {
dynamicEndTime.add(duration, "minutes"); dynamicEndTime.add(duration, "minutes");
postRequestBodies.push({ postRequestBodies.push({
get_price_uuid: priceUUID, get_price_uuid: priceUUID,
set_start: dynamicStartTime.format(), set_start: isProviderCheckedIn ? null : dynamicStartTime.format(),
set_end: dynamicEndTime.format(), set_end: isProviderCheckedIn ? null : dynamicEndTime.format(),
approved_start: isProviderCheckedIn ? dynamicStartTime.format() : null,
approved_end: isProviderCheckedIn ? dynamicEndTime.format() : null,
description: note ? note : undefined description: note ? note : undefined
}); });
} }
@ -131,6 +136,7 @@ class ClientEditShiftForm extends Component {
shiftDates, shiftDates,
cShiftUUID cShiftUUID
} = this.props; } = this.props;
const isProviderCheckedIn = !!cShiftRequestSuccess.actual_start;
if (!selfUser.client) { if (!selfUser.client) {
return <Redirect to="/" />; return <Redirect to="/" />;
@ -206,6 +212,7 @@ class ClientEditShiftForm extends Component {
handleSelectDate={this.handleSelectDate} handleSelectDate={this.handleSelectDate}
onSubmitShifts={this.onSubmitShifts} onSubmitShifts={this.onSubmitShifts}
isEditing={true} isEditing={true}
isProviderCheckedIn={isProviderCheckedIn}
/> />
); );
} }

@ -49,12 +49,14 @@ export const ClientShiftFormView = ({
changeShiftNote, changeShiftNote,
handleSelectDate, handleSelectDate,
onSubmitShifts, onSubmitShifts,
isEditing = false isEditing = false,
isProviderCheckedIn = false
}) => ( }) => (
<Container> <Container>
<Header> <Header>
{!isEditing && "Schedule Shifts"} {!isEditing && "Schedule Shifts"}
{isEditing && "Edit Shift"} {isEditing && !isProviderCheckedIn && "Edit Shift"}
{isEditing && isProviderCheckedIn && "Adjust and Approve Hours"}
</Header> </Header>
<Form <Form
loading={isSendingCShiftRequest} loading={isSendingCShiftRequest}
@ -151,7 +153,8 @@ export const ClientShiftFormView = ({
</Message> </Message>
<Form.Button> <Form.Button>
{!isEditing && "Schedule Shifts"} {!isEditing && "Schedule Shifts"}
{isEditing && "Edit Shift"} {isEditing && !isProviderCheckedIn && "Edit Shift"}
{isEditing && isProviderCheckedIn && "Adjust and Approve Hours"}
</Form.Button> </Form.Button>
</Form> </Form>
</Container> </Container>

@ -1,5 +1,5 @@
import { utc, ISO_8601, duration } from "moment"; import { utc, ISO_8601, duration } from "moment";
import React, { Component } from "react"; import React, { Component, Fragment } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Redirect, Link } from "react-router-dom"; import { Redirect, Link } from "react-router-dom";
import { import {
@ -25,9 +25,11 @@ import {
} from "../../../actions/cShift/reducer.actions"; } from "../../../actions/cShift/reducer.actions";
import { import {
getCShiftsRequest, getCShiftsRequest,
deleteCShiftRequest deleteCShiftRequest,
editCShiftRequest
} from "../../../actions/cShift/saga.actions"; } from "../../../actions/cShift/saga.actions";
import { getEmployeeFromPrice, getPriceFromPrice } from "./ClientShiftShared"; import { getEmployeeFromPrice, getPriceFromPrice } from "./ClientShiftShared";
import ShiftLabel from "../../Shared/ShiftLabel";
class ClientShifts extends Component { class ClientShifts extends Component {
constructor(props) { constructor(props) {
@ -41,7 +43,7 @@ class ClientShifts extends Component {
this.props.dispatch( this.props.dispatch(
getCShiftsRequest({ getCShiftsRequest({
page: this.props.page, page: this.props.page,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.providerFilter, manage: this.props.providerFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -54,7 +56,7 @@ class ClientShifts extends Component {
this.props.dispatch( this.props.dispatch(
getCShiftsRequest({ getCShiftsRequest({
page: activePage, page: activePage,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
manage: this.props.providerFilter, manage: this.props.providerFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
page_size: this.state.pageSize page_size: this.state.pageSize
@ -67,7 +69,7 @@ class ClientShifts extends Component {
this.props.dispatch( this.props.dispatch(
getCShiftsRequest({ getCShiftsRequest({
page: 1, page: 1,
approved: value, provider_approved: value,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.providerFilter, manage: this.props.providerFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -82,7 +84,7 @@ class ClientShifts extends Component {
this.props.dispatch( this.props.dispatch(
getCShiftsRequest({ getCShiftsRequest({
page: 1, page: 1,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: value, completed: value,
manage: this.props.providerFilter, manage: this.props.providerFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -97,7 +99,7 @@ class ClientShifts extends Component {
this.props.dispatch( this.props.dispatch(
getCShiftsRequest({ getCShiftsRequest({
page: 1, page: 1,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: value, manage: value,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -112,7 +114,7 @@ class ClientShifts extends Component {
this.props.dispatch( this.props.dispatch(
getCShiftsRequest({ getCShiftsRequest({
page: 1, page: 1,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.manageFilter, manage: this.props.manageFilter,
work_type: value, work_type: value,
@ -127,6 +129,34 @@ class ClientShifts extends Component {
this.props.dispatch(deleteCShiftRequest(uuid)); this.props.dispatch(deleteCShiftRequest(uuid));
}; };
approveHoursCShift = cshift => {
const {
set_start: approved_start,
set_end: approved_end,
price: get_price_uuid
} = cshift;
this.props.dispatch(
editCShiftRequest({
uuid: cshift.uuid,
get_price_uuid,
approved_start,
approved_end,
set_start: null,
set_end: null
})
);
this.props.dispatch(
getCShiftsRequest({
page: this.props.page,
provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter,
manage: this.props.providerFilter,
work_type: this.props.workTypeFilter,
page_size: this.state.pageSize
})
);
};
render() { render() {
const { const {
isSendingCShiftRequest, isSendingCShiftRequest,
@ -157,6 +187,7 @@ class ClientShifts extends Component {
handleChangeProviderFilter={this.handleChangeProviderFilter} handleChangeProviderFilter={this.handleChangeProviderFilter}
handleChangeWorkTypeFilter={this.handleChangeWorkTypeFilter} handleChangeWorkTypeFilter={this.handleChangeWorkTypeFilter}
deleteCShift={this.deleteCShift} deleteCShift={this.deleteCShift}
approveHoursCShift={this.approveHoursCShift}
/> />
); );
} else { } else {
@ -184,7 +215,8 @@ const ClientShiftsView = ({
handleChangeCompletedFilter, handleChangeCompletedFilter,
handleChangeProviderFilter, handleChangeProviderFilter,
handleChangeWorkTypeFilter, handleChangeWorkTypeFilter,
deleteCShift deleteCShift,
approveHoursCShift
}) => { }) => {
const { count = 0, results = [] } = cShiftRequestSuccess; const { count = 0, results = [] } = cShiftRequestSuccess;
const approvedOptions = [ const approvedOptions = [
@ -240,7 +272,7 @@ const ClientShiftsView = ({
Schedule Shift Schedule Shift
</Button> </Button>
<Segment> <Segment>
{"Filter by Approval "} {"Filter by Provider Approval "}
<Dropdown <Dropdown
inline inline
placeholder={approvalFilter === null ? `All` : `Pending`} placeholder={approvalFilter === null ? `All` : `Pending`}
@ -302,9 +334,7 @@ const ClientShiftsView = ({
"minutes" "minutes"
).humanize()}`; ).humanize()}`;
} }
const approved = !!result.approved;
const rejected = !result.approved && result.approved !== null;
const pending = result.approved === null;
return ( return (
<Item key={result.uuid}> <Item key={result.uuid}>
<Item.Content> <Item.Content>
@ -320,18 +350,14 @@ const ClientShiftsView = ({
{workType.label} {workType.label}
</Item.Header> </Item.Header>
<Item.Extra> <Item.Extra>
<Label <ShiftLabel
color={approved ? "green" : rejected ? "red" : "grey"} provider_approved={result.provider_approved}
tag client_approved_start={result.approved_start}
size="small" client_approved_end={result.approved_end}
> />
{approved && "Approved"}
{pending && "Approval Pending"}
{rejected && "Rejected"}
</Label>
</Item.Extra> </Item.Extra>
<Item.Meta> <Item.Meta>
{"At " + {"Scheduled for " +
utc(result.set_start, ISO_8601) utc(result.set_start, ISO_8601)
.local(false) .local(false)
.format(OLD_PEOPLE_TIME_FORMAT)} .format(OLD_PEOPLE_TIME_FORMAT)}
@ -348,14 +374,6 @@ const ClientShiftsView = ({
</Item.Content> </Item.Content>
{!checkedIn && ( {!checkedIn && (
<Item.Extra> <Item.Extra>
<Button
primary
floated="right"
as={Link}
to={`/user/profile/client/edit-shift/${result.uuid}`}
>
Edit
</Button>
<Popup <Popup
content={ content={
<div> <div>
@ -378,39 +396,109 @@ const ClientShiftsView = ({
on="click" on="click"
position="top right" position="top right"
/> />
<Button
primary
floated="right"
as={Link}
to={`/user/profile/client/edit-shift/${result.uuid}`}
>
Edit
</Button>
</Item.Extra> </Item.Extra>
)} )}
{checkedIn && ( {checkedIn && (
<Item.Content> <Fragment>
<Item.Description> <Item.Content>
{result.description && ( <Item.Description>
<Message>{result.description}</Message> {result.description && (
)} <Message>{result.description}</Message>
<strong>Provider</strong> )}
<List bulleted> {result.approved_start && (
<List.Item> <Fragment>
{"Checked in at " + <strong>Client</strong>
checkedIn <List bulleted>
.local(false) <List.Item>
.format(OLD_PEOPLE_TIME_FORMAT)} {`Approved time start ${utc(
</List.Item> result.approved_start
{checkedOut && ( )
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}`}
</List.Item>
<List.Item>{`Approved time end ${utc(
result.approved_end
)
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}`}</List.Item>
</List>
</Fragment>
)}
<strong>Provider</strong>
<List bulleted>
<List.Item> <List.Item>
{"Checked out at " + {"Checked in at " +
checkedOut checkedIn
.local(false) .local(false)
.format(OLD_PEOPLE_TIME_FORMAT)} .format(OLD_PEOPLE_TIME_FORMAT)}
</List.Item> </List.Item>
{checkedOut && (
<List.Item>
{"Checked out at " +
checkedOut
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}
</List.Item>
)}
</List>
{result.chart && (
<Message>
<Message.Header>Chart</Message.Header>
{result.chart}
</Message>
)} )}
</List> </Item.Description>
{result.chart && ( </Item.Content>
<Message> <Item.Extra>
<Message.Header>Chart</Message.Header> <Popup
{result.chart} content={
</Message> <div>
Are you sure you want to delete this shift?<br />
<Button
basic
color="red"
size="small"
onClick={() => deleteCShift(result.uuid)}
>
Confirm Deletion
</Button>
</div>
}
trigger={
<Button color="red" floated="right">
Delete
</Button>
}
on="click"
position="top right"
/>
<Button
primary
floated="right"
as={Link}
to={`/user/profile/client/edit-shift/${result.uuid}`}
>
Adjust Hours
</Button>
{!result.approved_start && (
<Button
color="green"
floated="right"
onClick={() => approveHoursCShift(result)}
>
Approve Hours
</Button>
)} )}
</Item.Description> </Item.Extra>
</Item.Content> </Fragment>
)} )}
</Item> </Item>
); );

@ -1,5 +1,5 @@
import { utc, duration, ISO_8601 } from "moment"; import { utc, duration, ISO_8601 } from "moment";
import React, { Component } from "react"; import React, { Component, Fragment } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Redirect } from "react-router-dom"; import { Redirect } from "react-router-dom";
import { import {
@ -27,6 +27,7 @@ import {
getWorkTypeFromPrice, getWorkTypeFromPrice,
getPriceFromPrice getPriceFromPrice
} from "./ProviderShiftsShared"; } from "./ProviderShiftsShared";
import ShiftLabel from "../../Shared/ShiftLabel";
class ProviderShift extends Component { class ProviderShift extends Component {
handleChangePShiftApproval = (uuid, approved) => { handleChangePShiftApproval = (uuid, approved) => {
@ -34,7 +35,7 @@ class ProviderShift extends Component {
this.props.dispatch( this.props.dispatch(
updatePShiftRequest({ updatePShiftRequest({
uuid, uuid,
approved, provider_approved: approved,
action: "", action: "",
chart: null, chart: null,
single: true single: true
@ -48,7 +49,7 @@ class ProviderShift extends Component {
this.props.dispatch( this.props.dispatch(
updatePShiftRequest({ updatePShiftRequest({
uuid: pShiftRequestSuccess.uuid, uuid: pShiftRequestSuccess.uuid,
approved: true, provider_approved: true,
action: "checkin", action: "checkin",
chart: null, chart: null,
single: true single: true
@ -65,7 +66,7 @@ class ProviderShift extends Component {
this.props.dispatch( this.props.dispatch(
updatePShiftRequest({ updatePShiftRequest({
uuid: pShiftRequestSuccess.uuid, uuid: pShiftRequestSuccess.uuid,
approved: true, provider_approved: true,
action: "checkout", action: "checkout",
chart, chart,
single: true single: true
@ -128,22 +129,18 @@ const ProviderShiftFormView = ({
displayDuration = duration(Math.floor(min / 60), "hours").humanize(); displayDuration = duration(Math.floor(min / 60), "hours").humanize();
displayDuration += ` and ${duration(min % 60, "minutes").humanize()}`; displayDuration += ` and ${duration(min % 60, "minutes").humanize()}`;
} }
const approved = !!shift.approved; const approved = !!shift.provider_approved;
const rejected = !shift.approved && shift.approved !== null; const rejected = !shift.provider_approved && shift.provider_approved !== null;
const pending = shift.approved === null; // const pending = shift.provider_approved === null;
return ( return (
<Container> <Container>
<Header>Shift Details</Header> <Header>Shift Details</Header>
<Loader active={isSendingPShiftRequest} /> <Loader active={isSendingPShiftRequest} />
<Label <ShiftLabel
color={approved ? "green" : rejected ? "red" : "grey"} provider_approved={shift.provider_approved}
tag client_approved_start={shift.approved_start}
size="small" client_approved_end={shift.approved_end}
> />
{approved && "Approved"}
{pending && "Approval Pending"}
{rejected && "Rejected"}
</Label>
<Label <Label
circular circular
empty empty
@ -155,7 +152,7 @@ const ProviderShiftFormView = ({
{workType.label} {workType.label}
<List bulleted> <List bulleted>
<List.Item> <List.Item>
{"Scheduled at " + {"Scheduled for " +
utc(shift.set_start, ISO_8601) utc(shift.set_start, ISO_8601)
.local(false) .local(false)
.format(OLD_PEOPLE_TIME_FORMAT)} .format(OLD_PEOPLE_TIME_FORMAT)}
@ -194,6 +191,22 @@ const ProviderShiftFormView = ({
)} )}
</Button.Group> </Button.Group>
)} )}
{shift.approved_start && (
<Fragment>
<strong>Client</strong>
<List bulleted>
<List.Item>
{`Approved time start ${utc(shift.approved_start)
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}`}
</List.Item>
<List.Item>{`Approved time end ${utc(shift.approved_end)
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}`}</List.Item>
</List>
</Fragment>
)}
<strong>Provider</strong>
<List bulleted> <List bulleted>
{!checkedIn && <List.Item>Pending Check In</List.Item>}{" "} {!checkedIn && <List.Item>Pending Check In</List.Item>}{" "}
{checkedIn && ( {checkedIn && (

@ -1,5 +1,5 @@
import { utc, ISO_8601, duration } from "moment"; import { utc, ISO_8601, duration } from "moment";
import React, { Component } from "react"; import React, { Component, Fragment } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Redirect, Link } from "react-router-dom"; import { Redirect, Link } from "react-router-dom";
import { import {
@ -11,7 +11,8 @@ import {
Segment, Segment,
Pagination, Pagination,
Loader, Loader,
Label Label,
List
} from "semantic-ui-react"; } from "semantic-ui-react";
import { import {
getEmployerFromPrice, getEmployerFromPrice,
@ -28,6 +29,7 @@ import {
getPShiftsRequest, getPShiftsRequest,
updatePShiftRequest updatePShiftRequest
} from "../../../actions/pShift/saga.actions"; } from "../../../actions/pShift/saga.actions";
import ShiftLabel from "../../Shared/ShiftLabel";
class ProviderShifts extends Component { class ProviderShifts extends Component {
constructor(props) { constructor(props) {
@ -41,7 +43,7 @@ class ProviderShifts extends Component {
this.props.dispatch( this.props.dispatch(
getPShiftsRequest({ getPShiftsRequest({
page: this.props.page, page: this.props.page,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.clientFilter, manage: this.props.clientFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -54,7 +56,7 @@ class ProviderShifts extends Component {
this.props.dispatch( this.props.dispatch(
getPShiftsRequest({ getPShiftsRequest({
page: activePage, page: activePage,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.clientFilter, manage: this.props.clientFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -68,7 +70,7 @@ class ProviderShifts extends Component {
this.props.dispatch( this.props.dispatch(
getPShiftsRequest({ getPShiftsRequest({
page: 1, page: 1,
approved: value, provider_approved: value,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.clientFilter, manage: this.props.clientFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -83,7 +85,7 @@ class ProviderShifts extends Component {
this.props.dispatch( this.props.dispatch(
getPShiftsRequest({ getPShiftsRequest({
page: 1, page: 1,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: value, completed: value,
manage: this.props.clientFilter, manage: this.props.clientFilter,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -98,7 +100,7 @@ class ProviderShifts extends Component {
this.props.dispatch( this.props.dispatch(
getPShiftsRequest({ getPShiftsRequest({
page: 1, page: 1,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: value, manage: value,
work_type: this.props.workTypeFilter, work_type: this.props.workTypeFilter,
@ -113,7 +115,7 @@ class ProviderShifts extends Component {
this.props.dispatch( this.props.dispatch(
getPShiftsRequest({ getPShiftsRequest({
page: 1, page: 1,
approved: this.props.approvalFilter, provider_approved: this.props.approvalFilter,
completed: this.props.completedFilter, completed: this.props.completedFilter,
manage: this.props.clientFilter, manage: this.props.clientFilter,
work_type: value, work_type: value,
@ -127,7 +129,12 @@ class ProviderShifts extends Component {
handleChangePShiftApproval = (uuid, approved) => { handleChangePShiftApproval = (uuid, approved) => {
return () => { return () => {
this.props.dispatch( this.props.dispatch(
updatePShiftRequest({ uuid, approved, action: "", chart: null }) updatePShiftRequest({
uuid,
provider_approved: approved,
action: "",
chart: null
})
); );
}; };
}; };
@ -244,7 +251,7 @@ const ProviderShiftsView = ({
<Header>Shifts</Header> <Header>Shifts</Header>
<Segment.Group horizontal> <Segment.Group horizontal>
<Segment> <Segment>
{"Filter by Approval "} {"Filter by Provider Approval "}
<Dropdown <Dropdown
inline inline
placeholder={approvalFilter === null ? `All` : `Pending`} placeholder={approvalFilter === null ? `All` : `Pending`}
@ -306,9 +313,10 @@ const ProviderShiftsView = ({
"minutes" "minutes"
).humanize()}`; ).humanize()}`;
} }
const approved = !!result.approved; const approved = !!result.provider_approved;
const rejected = !result.approved && result.approved !== null; const rejected =
const pending = result.approved === null; !result.provider_approved && result.provider_approved !== null;
// const pending = result.provider_approved === null;
return ( return (
<Item key={result.uuid}> <Item key={result.uuid}>
<Item.Content> <Item.Content>
@ -324,18 +332,14 @@ const ProviderShiftsView = ({
{workType.label} {workType.label}
</Item.Header> </Item.Header>
<Item.Extra> <Item.Extra>
<Label <ShiftLabel
color={approved ? "green" : rejected ? "red" : "grey"} provider_approved={result.provider_approved}
tag client_approved_start={result.approved_start}
size="small" client_approved_end={result.approved_end}
> />
{approved && "Approved"}
{pending && "Approval Pending"}
{rejected && "Rejected"}
</Label>
</Item.Extra> </Item.Extra>
<Item.Meta> <Item.Meta>
{"At " + {"Scheduled for " +
utc(result.set_start, ISO_8601) utc(result.set_start, ISO_8601)
.local(false) .local(false)
.format(OLD_PEOPLE_TIME_FORMAT)} .format(OLD_PEOPLE_TIME_FORMAT)}
@ -363,6 +367,23 @@ const ProviderShiftsView = ({
.format(OLD_PEOPLE_TIME_FORMAT)} .format(OLD_PEOPLE_TIME_FORMAT)}
</Item.Meta> </Item.Meta>
)} )}
{result.approved_start && (
<Fragment>
<strong>Client</strong>
<List bulleted>
<List.Item>
{`Approved time start ${utc(result.approved_start)
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}`}
</List.Item>
<List.Item>{`Approved time end ${utc(
result.approved_end
)
.local(false)
.format(OLD_PEOPLE_TIME_FORMAT)}`}</List.Item>
</List>
</Fragment>
)}
</Item.Content> </Item.Content>
<Item.Extra> <Item.Extra>
{!checkedIn && ( {!checkedIn && (

Loading…
Cancel
Save