Pass time slots to BookingDatesForm

This commit is contained in:
Hannu Lyytikainen 2018-08-08 18:03:51 +03:00
parent 2563bfeb2d
commit bcbeec8aef
5 changed files with 11 additions and 1 deletions

View file

@ -197,6 +197,7 @@ export class ListingPageComponent extends Component {
fetchReviewsError,
sendEnquiryInProgress,
sendEnquiryError,
timeSlots,
categoriesConfig,
amenitiesConfig,
} = this.props;
@ -477,6 +478,7 @@ export class ListingPageComponent extends Component {
handleBookButtonClick={handleBookButtonClick}
handleMobileBookModalClose={handleMobileBookModalClose}
onManageDisableScrolling={onManageDisableScrolling}
timeSlots={timeSlots}
/>
</div>
</div>

View file

@ -24,6 +24,7 @@ const SectionBooking = props => {
handleBookButtonClick,
handleMobileBookModalClose,
onManageDisableScrolling,
timeSlots,
} = props;
const showClosedListingHelpText = listing.id && isClosed;
return (
@ -68,6 +69,7 @@ const SectionBooking = props => {
onSubmit={handleBookingSubmit}
price={price}
isOwnListing={isOwnListing}
timeSlots={timeSlots}
/>
) : null}
</ModalInMobile>

View file

@ -325,6 +325,7 @@ exports[`ListingPage matches snapshot 1`] = `
</span>
}
timeSlots={null}
unitType="line-item/night"
/>
</div>

View file

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { string, bool } from 'prop-types';
import { string, bool, arrayOf } from 'prop-types';
import { compose } from 'redux';
import { Form as FinalForm } from 'react-final-form';
import { FormattedMessage, intlShape, injectIntl } from 'react-intl';
@ -85,6 +85,7 @@ export class BookingDatesFormComponent extends Component {
unitPrice,
unitType,
values,
timeSlots,
} = fieldRenderProps;
const { startDate, endDate } = values && values.bookingDates ? values.bookingDates : {};
@ -160,6 +161,7 @@ export class BookingDatesFormComponent extends Component {
focusedInput={this.state.focusedInput}
onFocusedInputChange={this.onFocusedInputChange}
format={null}
timeSlots={timeSlots}
useMobileMargins
validate={composeValidators(
required(requiredMessage),
@ -197,6 +199,7 @@ BookingDatesFormComponent.defaultProps = {
isOwnListing: false,
startDatePlaceholder: null,
endDatePlaceholder: null,
timeSlots: null,
};
BookingDatesFormComponent.propTypes = {
@ -207,6 +210,7 @@ BookingDatesFormComponent.propTypes = {
unitType: propTypes.bookingUnitType.isRequired,
price: propTypes.money,
isOwnListing: bool,
timeSlots: arrayOf(propTypes.timeSlot),
// from injectIntl
intl: intlShape.isRequired,

View file

@ -22,6 +22,7 @@ exports[`BookingDatesForm matches snapshot without selected dates 1`] = `
render={[Function]}
startDatePlaceholder="today"
submitButtonWrapperClassName={null}
timeSlots={null}
unitPrice={
Money {
"amount": 1099,