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