bukazu-portal-react 2.0.18 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.MD CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Next release
4
4
 
5
+ - Show actual prices for searched period instead of min_weekprice
6
+
5
7
  ## 2.0.12
6
8
 
7
9
  - Fix bug in required extra_booking field
@@ -8,8 +8,9 @@
8
8
  <body>
9
9
  <h1>Bukazu Test Calendar</h1>
10
10
 
11
- <div class="bukazu-app" id="bukazu-app" portal-code="050497a0" object-code="DE0002" language='nl' filters='123'></div>
11
+ <!-- <div class="bukazu-app" id="bukazu-app" portal-code="050497a0" object-code="DE0002" language='nl' filters='123'></div> -->
12
12
  <!-- <div class="bukazu-app" id="bukazu-app" portal-code="72902823" object-code="NL1443" language='nl' filters='123'></div> -->
13
+ <div id='bukazu-app' class='bukazu-app' portal-code="2b063dcd" object-code="AT0047" language="nl"></div>
13
14
 
14
15
  <script src="./index.js"></script>
15
16
  </body>
package/build/index.js CHANGED
@@ -14892,11 +14892,11 @@ var Loading = function Loading() {
14892
14892
  })));
14893
14893
  };
14894
14894
 
14895
- var _templateObject$5, _templateObject2$1, _templateObject3, _templateObject4;
14895
+ var _templateObject$5, _templateObject2$1, _templateObject3$1, _templateObject4;
14896
14896
  var PORTAL_QUERY = gql(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n query PortalSiteQuery($id: ID!) {\n PortalSite(id: $id) {\n portal_code\n options\n countries {\n id\n name\n }\n regions {\n id\n name\n country_id\n }\n cities {\n id\n name\n region\n country_id\n }\n extra_search\n max_bathrooms\n max_bedrooms\n max_nights\n max_persons\n max_weekprice\n country_placeholder\n categories\n countries_label\n country_placeholder\n regions_label\n cities_label\n arrival_date_label\n departure_date_label\n max_weekprice_label\n persons_min_label\n persons_max_label\n bedrooms_min_label\n bathrooms_min_label\n weekprice_max_label\n no_nights_label\n extra_search_label\n properties_label\n }\n }\n"])));
14897
14897
  var CALENDAR_QUERY$1 = gql(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n query PortalSiteHousesQuery(\n $id: ID!\n $house_id: String!\n $starts_at: Date!\n $ends_at: Date!\n ) {\n PortalSite(id: $id) {\n houses(house_code: $house_id) {\n id\n name\n last_minute_days\n availabilities(starts_at: $starts_at, ends_at: $ends_at) {\n arrival\n arrival_time_from\n arrival_time_to\n date\n departure\n departure_time\n max_nights\n min_nights\n special_offer\n }\n }\n }\n Discounts(\n house_code: $house_id\n discount_starts_at: $ends_at\n discount_ends_at: $starts_at\n active_today: true\n ) {\n name\n discount_starts_at\n discount_ends_at\n }\n }\n "])));
14898
- var BOOKING_PRICE_QUERY = gql(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n query BookingPriceQuery(\n $id: ID!\n $house_id: String!\n $starts_at: Date!\n $ends_at: Date!\n ) {\n PortalSite(id: $id) {\n options\n first_name_label\n preposition_label\n last_name_label\n email_label\n zipcode_label\n city_label\n address_label\n house_number_label\n phone_label\n phone_mobile_label\n country_label\n iban_label\n holder_label\n bic_label\n comment_label\n company_name_label\n extra_fields_drivers_license_label\n extra_fields_destination_label\n booking_fields {\n id\n label\n field_type\n options\n placeholder\n }\n houses(house_code: $house_id) {\n id\n name\n code\n allow_option\n persons\n image_url\n discounts\n discounts_info\n house_type\n rental_terms\n cancel_insurance\n damage_insurance\n damage_insurance_required\n travel_insurance\n babies_extra\n booking_price(starts_at: $starts_at, ends_at: $ends_at)\n }\n }\n }\n"])));
14899
- var CREATE_BOOKING_MUTATION = gql(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n mutation CreateBooking(\n $first_name: String!\n $preposition: String\n $last_name: String!\n $company_name: String\n $is_option: Boolean!\n $address: String\n $house_number: String\n $zipcode: String\n $city: String\n $phone: String\n $phone_mobile: String\n $email: String!\n $house_code: String!\n $portal_code: String\n $language: String\n $country: String!\n $adults: Int!\n $children: Int\n $babies: Int\n $discount: Int\n $damage_insurance: Int\n $cancel_insurance: Int\n $travel_insurance: Int\n $discount_reason: String\n $discount_code: String\n $comment: String\n $arrival_date: String!\n $departure_date: String!\n $costs: Json\n $extra_fields: String\n ) {\n createBooking(\n first_name: $first_name\n preposition: $preposition\n company_name: $company_name\n last_name: $last_name\n is_option: $is_option\n address: $address\n house_number: $house_number\n zipcode: $zipcode\n city: $city\n phone: $phone\n phone_mobile: $phone_mobile\n email: $email\n house_code: $house_code\n portal_code: $portal_code\n language: $language\n country: $country\n adults: $adults\n children: $children\n babies: $babies\n discount: $discount\n discount_code: $discount_code\n damage_insurance: $damage_insurance\n cancel_insurance: $cancel_insurance\n travel_insurance: $travel_insurance\n discount_reason: $discount_reason\n arrival_date: $arrival_date\n departure_date: $departure_date\n comment: $comment\n costs: $costs\n extra_fields: $extra_fields\n ) {\n booking_nr\n }\n }\n"])));
14898
+ var BOOKING_PRICE_QUERY = gql(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n query BookingPriceQuery(\n $id: ID!\n $house_id: String!\n $starts_at: Date!\n $ends_at: Date!\n ) {\n PortalSite(id: $id) {\n options\n first_name_label\n preposition_label\n last_name_label\n email_label\n zipcode_label\n city_label\n address_label\n house_number_label\n phone_label\n phone_mobile_label\n country_label\n iban_label\n holder_label\n bic_label\n comment_label\n company_name_label\n extra_fields_drivers_license_label\n extra_fields_destination_label\n booking_fields {\n id\n label\n field_type\n options\n placeholder\n }\n houses(house_code: $house_id) {\n id\n name\n code\n allow_option\n persons\n image_url\n discounts\n discounts_info\n house_type\n rental_terms\n cancel_insurance\n damage_insurance\n damage_insurance_required\n travel_insurance\n babies_extra\n booking_price(starts_at: $starts_at, ends_at: $ends_at)\n }\n }\n }\n"])));
14899
+ var CREATE_BOOKING_MUTATION = gql(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n mutation CreateBooking(\n $first_name: String!\n $preposition: String\n $last_name: String!\n $company_name: String\n $is_option: Boolean!\n $address: String\n $house_number: String\n $zipcode: String\n $city: String\n $phone: String\n $phone_mobile: String\n $iban: String\n $bic: String\n $holder: String\n $email: String!\n $house_code: String!\n $portal_code: String\n $language: String\n $country: String!\n $adults: Int!\n $children: Int\n $babies: Int\n $discount: Int\n $damage_insurance: Int\n $cancel_insurance: Int\n $travel_insurance: Int\n $discount_reason: String\n $discount_code: String\n $comment: String\n $arrival_date: String!\n $departure_date: String!\n $costs: Json\n $extra_fields: String\n ) {\n createBooking(\n first_name: $first_name\n preposition: $preposition\n company_name: $company_name\n last_name: $last_name\n is_option: $is_option\n address: $address\n house_number: $house_number\n zipcode: $zipcode\n city: $city\n phone: $phone\n phone_mobile: $phone_mobile\n iban: $iban\n bic: $bic\n holder: $holder\n email: $email\n house_code: $house_code\n portal_code: $portal_code\n language: $language\n country: $country\n adults: $adults\n children: $children\n babies: $babies\n discount: $discount\n discount_code: $discount_code\n damage_insurance: $damage_insurance\n cancel_insurance: $cancel_insurance\n travel_insurance: $travel_insurance\n discount_reason: $discount_reason\n arrival_date: $arrival_date\n departure_date: $departure_date\n comment: $comment\n costs: $costs\n extra_fields: $extra_fields\n ) {\n booking_nr\n }\n }\n"])));
14900
14900
 
14901
14901
  var entry$1 = {};
14902
14902
 
@@ -34215,7 +34215,15 @@ function SingleResult(_ref) {
34215
34215
  id: "bathrooms"
34216
34216
  }))), thisOptions.showPrice && /*#__PURE__*/React__default['default'].createElement("div", {
34217
34217
  className: "result-price"
34218
- }, /*#__PURE__*/React__default['default'].createElement(FormattedMessage$1, {
34218
+ }, result.booking_price ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormattedMessage$1, {
34219
+ id: "price_from"
34220
+ }), /*#__PURE__*/React__default['default'].createElement("span", {
34221
+ className: "price"
34222
+ }, "\u20AC", ' ', /*#__PURE__*/React__default['default'].createElement(FormattedNumber, {
34223
+ value: result.booking_price.total_price,
34224
+ minimumFractionDigits: 0,
34225
+ maximumFractionDigits: 0
34226
+ }))) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(FormattedMessage$1, {
34219
34227
  id: "minimum_week_price"
34220
34228
  }), /*#__PURE__*/React__default['default'].createElement("span", {
34221
34229
  className: "price"
@@ -34223,10 +34231,11 @@ function SingleResult(_ref) {
34223
34231
  value: result.minimum_week_price,
34224
34232
  minimumFractionDigits: 0,
34225
34233
  maximumFractionDigits: 0
34226
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
34234
+ })))), /*#__PURE__*/React__default['default'].createElement("div", {
34227
34235
  className: "result-button"
34228
34236
  }, /*#__PURE__*/React__default['default'].createElement(ArrowRight$1, null)))));
34229
34237
  }
34238
+
34230
34239
  SingleResult.propTypes = {
34231
34240
  result: PropTypes.object.isRequired,
34232
34241
  options: PropTypes.object.isRequired
@@ -34765,9 +34774,10 @@ _defineProperty(Pagination, "defaultProps", {
34765
34774
 
34766
34775
  var Pagination = /*@__PURE__*/getDefaultExportFromCjs(Pagination$1);
34767
34776
 
34768
- var _templateObject$4, _templateObject2;
34777
+ var _templateObject$4, _templateObject2, _templateObject3;
34769
34778
  var HOUSES_QUERY = gql(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n query PortalSiteHousesQuery(\n $id: ID!\n $country_id: ID\n $region_id: String\n $city_id: String\n $persons_min: Int\n $persons_max: Int\n $bedrooms_min: Int\n $bathrooms_min: Int\n $arrival_date: String\n $no_nights: Int\n $properties: String\n $weekprice_max: Int\n $limit: Int\n $skip: Int\n ) {\n PortalSite(id: $id) {\n houses(\n country_id: $country_id\n region_id: $region_id\n city_id: $city_id\n persons_min: $persons_min\n persons_max: $persons_max\n bedrooms_min: $bedrooms_min\n bathrooms_min: $bathrooms_min\n arrival_date: $arrival_date\n weekprice_max: $weekprice_max\n no_nights_min: $no_nights\n properties: $properties\n limit: $limit\n skip: $skip\n ) {\n id\n name\n persons\n bathrooms\n bedrooms\n description\n image_url\n house_url\n province\n city\n country_name\n minimum_week_price\n }\n }\n }\n"])));
34770
- var HOUSE_COUNT_QUERY = gql(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n query PortalSiteHousesQuery(\n $id: ID!\n $country_id: ID\n $region_id: String\n $city_id: String\n $persons_min: Int\n $persons_max: Int\n $bedrooms_min: Int\n $bathrooms_min: Int\n $arrival_date: String\n $no_nights: Int\n $properties: String\n $weekprice_max: Int\n ) {\n PortalSite(id: $id) {\n houses(\n country_id: $country_id\n region_id: $region_id\n city_id: $city_id\n persons_min: $persons_min\n persons_max: $persons_max\n bedrooms_min: $bedrooms_min\n bathrooms_min: $bathrooms_min\n arrival_date: $arrival_date\n weekprice_max: $weekprice_max\n no_nights_min: $no_nights\n properties: $properties\n ) {\n id\n }\n }\n }\n"])));
34779
+ var HOUSES_PRICE_QUERY = gql(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n query PortalSiteHousesQuery(\n $id: ID!\n $country_id: ID\n $region_id: String\n $city_id: String\n $persons_min: Int\n $persons_max: Int\n $bedrooms_min: Int\n $bathrooms_min: Int\n $arrival_date: String\n $starts_at: Date!\n $ends_at: Date!\n $no_nights: Int\n $properties: String\n $weekprice_max: Int\n $limit: Int\n $skip: Int\n ) {\n PortalSite(id: $id) {\n houses(\n country_id: $country_id\n region_id: $region_id\n city_id: $city_id\n persons_min: $persons_min\n persons_max: $persons_max\n bedrooms_min: $bedrooms_min\n bathrooms_min: $bathrooms_min\n arrival_date: $arrival_date\n weekprice_max: $weekprice_max\n no_nights_min: $no_nights\n properties: $properties\n limit: $limit\n skip: $skip\n ) {\n id\n name\n persons\n bathrooms\n bedrooms\n description\n image_url\n house_url\n province\n city\n country_name\n minimum_week_price\n booking_price(starts_at: $starts_at, ends_at: $ends_at)\n }\n }\n }\n"])));
34780
+ var HOUSE_COUNT_QUERY = gql(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n query PortalSiteHousesQuery(\n $id: ID!\n $country_id: ID\n $region_id: String\n $city_id: String\n $persons_min: Int\n $persons_max: Int\n $bedrooms_min: Int\n $bathrooms_min: Int\n $arrival_date: String\n $no_nights: Int\n $properties: String\n $weekprice_max: Int\n ) {\n PortalSite(id: $id) {\n houses(\n country_id: $country_id\n region_id: $region_id\n city_id: $city_id\n persons_min: $persons_min\n persons_max: $persons_max\n bedrooms_min: $bedrooms_min\n bathrooms_min: $bathrooms_min\n arrival_date: $arrival_date\n weekprice_max: $weekprice_max\n no_nights_min: $no_nights\n properties: $properties\n ) {\n id\n }\n }\n }\n"])));
34771
34781
 
34772
34782
  function Paginator(_ref) {
34773
34783
  var onPageChange = _ref.onPageChange,
@@ -34987,9 +34997,11 @@ function Results(_ref) {
34987
34997
  onPageChange = _ref.onPageChange,
34988
34998
  activePage = _ref.activePage;
34989
34999
  var min_nights = null;
35000
+ var requestPrices = false;
34990
35001
 
34991
35002
  if (filters.departure_date && filters.arrival_date) {
34992
35003
  min_nights = difference_in_calendar_days(filters.departure_date, filters.arrival_date);
35004
+ requestPrices = true;
34993
35005
  } else if (filters.arrival_date) {
34994
35006
  min_nights = 1;
34995
35007
  }
@@ -35009,6 +35021,8 @@ function Results(_ref) {
35009
35021
  bedrooms_min: Number(filters.bedrooms_min),
35010
35022
  bathrooms_min: Number(filters.bathrooms_min),
35011
35023
  arrival_date: filters.arrival_date,
35024
+ starts_at: filters.arrival_date,
35025
+ ends_at: filters.departure_date,
35012
35026
  no_nights: Number(min_nights) || null,
35013
35027
  extra_search: filters.extra_search,
35014
35028
  properties: properties,
@@ -35018,7 +35032,7 @@ function Results(_ref) {
35018
35032
  locale: locale
35019
35033
  };
35020
35034
  return /*#__PURE__*/React__default['default'].createElement(Query, {
35021
- query: HOUSES_QUERY,
35035
+ query: requestPrices ? HOUSES_PRICE_QUERY : HOUSES_QUERY,
35022
35036
  variables: variables
35023
35037
  }, function (_ref2) {
35024
35038
  var loading = _ref2.loading,
@@ -41355,7 +41369,7 @@ var Discount = function Discount(_ref) {
41355
41369
  if (house.discounts && house.discounts !== '0' || (_options$bookingForm = options.bookingForm) !== null && _options$bookingForm !== void 0 && _options$bookingForm.showDiscountCode) {
41356
41370
  var _options$bookingForm2;
41357
41371
 
41358
- var discounts = house.discounts.split(',');
41372
+ var discounts = house.discounts ? house.discounts.split(',') : [];
41359
41373
  return /*#__PURE__*/React__default['default'].createElement("div", {
41360
41374
  className: "form-section"
41361
41375
  }, house.discounts && house.discounts !== '0' && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -41788,7 +41802,7 @@ function CostSummary(_ref) {
41788
41802
  var persons = Number(values.children) + Number(values.adults) + babies;
41789
41803
 
41790
41804
  var _useQuery = useQuery(BOOKING_PRICE_TOTAL_QUERY, {
41791
- variables: _objectSpread2(_objectSpread2({}, values), {}, {
41805
+ variables: {
41792
41806
  id: values.portalCode,
41793
41807
  persons: persons,
41794
41808
  house_id: values.objectCode,
@@ -41796,8 +41810,9 @@ function CostSummary(_ref) {
41796
41810
  ends_at: JSON.stringify(values.departureDate.date),
41797
41811
  costs: JSON.stringify(values.costs),
41798
41812
  discount: Number(values.discount),
41813
+ discount_code: values.discount_code,
41799
41814
  cancel_insurance: Number(values.cancel_insurance)
41800
- }),
41815
+ },
41801
41816
  fetchPolicy: 'network-only'
41802
41817
  }),
41803
41818
  loading = _useQuery.loading,
@@ -41857,6 +41872,9 @@ function Summary(_ref) {
41857
41872
  var values = _ref.values,
41858
41873
  house = _ref.house,
41859
41874
  locale = _ref.locale;
41875
+ console.log({
41876
+ values: values
41877
+ });
41860
41878
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(Object$1, {
41861
41879
  house: house,
41862
41880
  values: values
@@ -48322,9 +48340,6 @@ var FormCreator = /*#__PURE__*/function (_React$Component) {
48322
48340
  });
48323
48341
  }
48324
48342
 
48325
- console.log({
48326
- errors: errors
48327
- });
48328
48343
  return errors;
48329
48344
  });
48330
48345
 
@@ -48380,18 +48395,9 @@ var FormCreator = /*#__PURE__*/function (_React$Component) {
48380
48395
  }),
48381
48396
  onSubmit: function onSubmit(values, _ref2) {
48382
48397
  _ref2.setSubmitting;
48383
- var variables = {
48384
- first_name: values.first_name,
48385
- preposition: values.preposition,
48386
- last_name: values.last_name,
48387
- company_name: values.company_name,
48398
+
48399
+ var variables = _objectSpread2(_objectSpread2({}, values), {}, {
48388
48400
  is_option: JSON.parse(values.is_option),
48389
- address: values.address || '',
48390
- zipcode: values.zipcode || '',
48391
- city: values.city || '',
48392
- phone: values.phone || '',
48393
- phone_mobile: values.phone_mobile || '',
48394
- email: values.email,
48395
48401
  house_code: values.objectCode,
48396
48402
  portal_code: values.portalCode,
48397
48403
  comment: values.comment || '',
@@ -48405,12 +48411,12 @@ var FormCreator = /*#__PURE__*/function (_React$Component) {
48405
48411
  damage_insurance: Number(values.damage_insurance) || 0,
48406
48412
  cancel_insurance: Number(values.cancel_insurance) || 0,
48407
48413
  travel_insurance: Number(values.travel_insurance) || 0,
48408
- discount_reason: values.discount_reason || '',
48409
48414
  arrival_date: values.arrivalDate.date,
48410
48415
  departure_date: values.departureDate.date,
48411
48416
  costs: JSON.stringify(values.costs),
48412
48417
  extra_fields: JSON.stringify(values.extra_fields)
48413
- };
48418
+ });
48419
+
48414
48420
  createBooking({
48415
48421
  variables: variables
48416
48422
  }).then(function () {
@@ -48743,7 +48749,7 @@ var ReviewsPage = /*#__PURE__*/function (_Component) {
48743
48749
 
48744
48750
  var pjson = {
48745
48751
  name: "bukazu-portal-react",
48746
- version: "2.0.17",
48752
+ version: "2.1.0",
48747
48753
  description: "A package for loading the calendar and search module from bukazu loading into a react app.",
48748
48754
  main: "build/index.js",
48749
48755
  repository: "https://github.com/BUKAZU/React-portal",
@@ -49241,7 +49247,8 @@ var en = {
49241
49247
  no_discount_code_found: "No discount found with entered code",
49242
49248
  discount_code: "Discount code",
49243
49249
  minimum_nights: "At least {minimum} nights",
49244
- can_only_take_insurance_in_de_be_nl: "You can only take out insurance if you live in the Netherlands, Germany or Belgium."
49250
+ can_only_take_insurance_in_de_be_nl: "You can only take out insurance if you live in the Netherlands, Germany or Belgium.",
49251
+ price_from: "Price from"
49245
49252
  };
49246
49253
 
49247
49254
  var nl = {
@@ -49353,7 +49360,8 @@ var nl = {
49353
49360
  no_discount_code_found: "Geen korting gevonden met ingegeven code",
49354
49361
  discount_code: "Kortingscode",
49355
49362
  minimum_nights: "Minstens {minimum} nachten",
49356
- can_only_take_insurance_in_de_be_nl: "U kunt alleen een verzekering afsluiten, wanneer u woont in Nederland, Duitsland of België."
49363
+ can_only_take_insurance_in_de_be_nl: "U kunt alleen een verzekering afsluiten, wanneer u woont in Nederland, Duitsland of België.",
49364
+ price_from: "Prijs vanaf"
49357
49365
  };
49358
49366
 
49359
49367
  var de = {
@@ -49464,7 +49472,8 @@ var de = {
49464
49472
  no_discount_code_found: "Kein Rabatt mit eingegebenem Code gefunden",
49465
49473
  discount_code: "Rabatt-Code",
49466
49474
  minimum_nights: "Mindestens {minimum} Nächte",
49467
- can_only_take_insurance_in_de_be_nl: "Sie können sich nur versichern, wenn Sie in den Niederlanden, Deutschland oder Belgien wohnen."
49475
+ can_only_take_insurance_in_de_be_nl: "Sie können sich nur versichern, wenn Sie in den Niederlanden, Deutschland oder Belgien wohnen.",
49476
+ price_from: "Preis von"
49468
49477
  };
49469
49478
 
49470
49479
  var fr = {
@@ -49571,7 +49580,8 @@ var fr = {
49571
49580
  "camper.pick_your_arrivaldate_in_the_calendar": "Choisissez une date de pick-up",
49572
49581
  no: "Non",
49573
49582
  minimum_nights: "Au moins {minimum} nuits",
49574
- can_only_take_insurance_in_de_be_nl: "Vous ne pouvez souscrire une assurance que si vous résidez aux Pays-Bas, en Allemagne ou en Belgique."
49583
+ can_only_take_insurance_in_de_be_nl: "Vous ne pouvez souscrire une assurance que si vous résidez aux Pays-Bas, en Allemagne ou en Belgique.",
49584
+ price_from: "Le prix de"
49575
49585
  };
49576
49586
 
49577
49587
  var es = {
@@ -49678,7 +49688,8 @@ var es = {
49678
49688
  "camper.pick_your_arrivaldate_in_the_calendar": "Elija una fecha de recogida",
49679
49689
  no: "No",
49680
49690
  minimum_nights: "Al menos {minimum} noches",
49681
- can_only_take_insurance_in_de_be_nl: "Solo puede contratar un seguro si vive en los Países Bajos, Alemania o Bélgica."
49691
+ can_only_take_insurance_in_de_be_nl: "Solo puede contratar un seguro si vive en los Países Bajos, Alemania o Bélgica.",
49692
+ price_from: "Precio de"
49682
49693
  };
49683
49694
 
49684
49695
  var it = {
@@ -49785,7 +49796,8 @@ var it = {
49785
49796
  "camper.pick_your_arrivaldate_in_the_calendar": "Scegli una data di ritiro",
49786
49797
  no: "No",
49787
49798
  minimum_nights: "Almeno {minimum} notti",
49788
- can_only_take_insurance_in_de_be_nl: "Puoi stipulare un'assicurazione solo se vivi nei Paesi Bassi, in Germania o in Belgio."
49799
+ can_only_take_insurance_in_de_be_nl: "Puoi stipulare un'assicurazione solo se vivi nei Paesi Bassi, in Germania o in Belgio.",
49800
+ price_from: "Prezzo da"
49789
49801
  };
49790
49802
 
49791
49803
  function Portal(_ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bukazu-portal-react",
3
- "version": "2.0.18",
3
+ "version": "2.1.0",
4
4
  "description": "A package for loading the calendar and search module from bukazu loading into a react app.",
5
5
  "main": "build/index.js",
6
6
  "repository": "https://github.com/BUKAZU/React-portal",
@@ -50,6 +50,59 @@ export const HOUSES_QUERY = gql`
50
50
  }
51
51
  `;
52
52
 
53
+ export const HOUSES_PRICE_QUERY = gql`
54
+ query PortalSiteHousesQuery(
55
+ $id: ID!
56
+ $country_id: ID
57
+ $region_id: String
58
+ $city_id: String
59
+ $persons_min: Int
60
+ $persons_max: Int
61
+ $bedrooms_min: Int
62
+ $bathrooms_min: Int
63
+ $arrival_date: String
64
+ $starts_at: Date!
65
+ $ends_at: Date!
66
+ $no_nights: Int
67
+ $properties: String
68
+ $weekprice_max: Int
69
+ $limit: Int
70
+ $skip: Int
71
+ ) {
72
+ PortalSite(id: $id) {
73
+ houses(
74
+ country_id: $country_id
75
+ region_id: $region_id
76
+ city_id: $city_id
77
+ persons_min: $persons_min
78
+ persons_max: $persons_max
79
+ bedrooms_min: $bedrooms_min
80
+ bathrooms_min: $bathrooms_min
81
+ arrival_date: $arrival_date
82
+ weekprice_max: $weekprice_max
83
+ no_nights_min: $no_nights
84
+ properties: $properties
85
+ limit: $limit
86
+ skip: $skip
87
+ ) {
88
+ id
89
+ name
90
+ persons
91
+ bathrooms
92
+ bedrooms
93
+ description
94
+ image_url
95
+ house_url
96
+ province
97
+ city
98
+ country_name
99
+ minimum_week_price
100
+ booking_price(starts_at: $starts_at, ends_at: $ends_at)
101
+ }
102
+ }
103
+ }
104
+ `;
105
+
53
106
  export const HOUSE_COUNT_QUERY = gql`
54
107
  query PortalSiteHousesQuery(
55
108
  $id: ID!
@@ -154,6 +154,9 @@ export const CREATE_BOOKING_MUTATION = gql`
154
154
  $city: String
155
155
  $phone: String
156
156
  $phone_mobile: String
157
+ $iban: String
158
+ $bic: String
159
+ $holder: String
157
160
  $email: String!
158
161
  $house_code: String!
159
162
  $portal_code: String
@@ -186,6 +189,9 @@ export const CREATE_BOOKING_MUTATION = gql`
186
189
  city: $city
187
190
  phone: $phone
188
191
  phone_mobile: $phone_mobile
192
+ iban: $iban
193
+ bic: $bic
194
+ holder: $holder
189
195
  email: $email
190
196
  house_code: $house_code
191
197
  portal_code: $portal_code
@@ -41,13 +41,13 @@ class FormCreator extends React.Component {
41
41
  if (field.required) {
42
42
  if (isInt(field.id)) {
43
43
  const validateValue = byString(values, `extra_fields.booking_field_${field.id}`);
44
-
44
+
45
45
  if (!validateValue || validateValue === '') {
46
46
  errors[field.id] = <FormattedMessage id="required" />;
47
47
  }
48
48
  } else {
49
49
  const validateValue = byString(values, field.id);
50
-
50
+
51
51
  if (!validateValue || validateValue === '') {
52
52
  errors[field.id] = <FormattedMessage id="required" />;
53
53
  }
@@ -91,7 +91,6 @@ class FormCreator extends React.Component {
91
91
  );
92
92
  }
93
93
 
94
- console.log({ errors });
95
94
  return errors;
96
95
  };
97
96
 
@@ -127,17 +126,8 @@ class FormCreator extends React.Component {
127
126
  }}
128
127
  onSubmit={(values, { setSubmitting }) => {
129
128
  let variables = {
130
- first_name: values.first_name,
131
- preposition: values.preposition,
132
- last_name: values.last_name,
133
- company_name: values.company_name,
129
+ ...values,
134
130
  is_option: JSON.parse(values.is_option),
135
- address: values.address || '',
136
- zipcode: values.zipcode || '',
137
- city: values.city || '',
138
- phone: values.phone || '',
139
- phone_mobile: values.phone_mobile || '',
140
- email: values.email,
141
131
  house_code: values.objectCode,
142
132
  portal_code: values.portalCode,
143
133
  comment: values.comment || '',
@@ -151,7 +141,6 @@ class FormCreator extends React.Component {
151
141
  damage_insurance: Number(values.damage_insurance) || 0,
152
142
  cancel_insurance: Number(values.cancel_insurance) || 0,
153
143
  travel_insurance: Number(values.travel_insurance) || 0,
154
- discount_reason: values.discount_reason || '',
155
144
  arrival_date: values.arrivalDate.date,
156
145
  departure_date: values.departureDate.date,
157
146
  costs: JSON.stringify(values.costs),
@@ -214,7 +203,7 @@ class FormCreator extends React.Component {
214
203
  </div>
215
204
  )}
216
205
  </div>
217
- <Discount errors={errors} house={house} options={options} values={values} />
206
+ <Discount errors={errors} house={house} options={options} values={values} />
218
207
 
219
208
  <Insurances house={house} values={values} />
220
209
 
@@ -229,7 +218,7 @@ class FormCreator extends React.Component {
229
218
  />
230
219
  </div>
231
220
 
232
- <div className="form-sum">
221
+ <div className="form-sum">
233
222
  <Summary house={house} values={values} />
234
223
  {status && status.msg && <div>{status.msg}</div>}
235
224
  <div className="terms">
@@ -16,7 +16,6 @@ function CostSummary({ values, house }) {
16
16
 
17
17
  const { loading, error, data } = useQuery(BOOKING_PRICE_TOTAL_QUERY, {
18
18
  variables: {
19
- ...values,
20
19
  id: values.portalCode,
21
20
  persons: persons,
22
21
  house_id: values.objectCode,
@@ -24,6 +23,7 @@ function CostSummary({ values, house }) {
24
23
  ends_at: JSON.stringify(values.departureDate.date),
25
24
  costs: JSON.stringify(values.costs),
26
25
  discount: Number(values.discount),
26
+ discount_code: values.discount_code,
27
27
  cancel_insurance: Number(values.cancel_insurance),
28
28
  },
29
29
  fetchPolicy: 'network-only',
@@ -6,6 +6,7 @@ import { Object } from "./Object";
6
6
 
7
7
 
8
8
  function Summary({ values, house, locale }) {
9
+ console.log({ values });
9
10
  return (
10
11
  <div>
11
12
  <Object house={house} values={values} />
@@ -7,7 +7,7 @@ import Loading from '../icons/loading.svg';
7
7
  import SingleResult from './SingleResult';
8
8
  import Paginator from './Paginator';
9
9
 
10
- import { HOUSES_QUERY } from '../../_lib/SearchQueries';
10
+ import { HOUSES_PRICE_QUERY, HOUSES_QUERY } from '../../_lib/SearchQueries';
11
11
  import { ApiError } from '../Error';
12
12
 
13
13
  function Results({
@@ -20,11 +20,13 @@ function Results({
20
20
  activePage,
21
21
  }) {
22
22
  let min_nights = null;
23
+ let requestPrices = false
23
24
  if (filters.departure_date && filters.arrival_date) {
24
25
  min_nights = differenceInCalendarDays(
25
26
  filters.departure_date,
26
27
  filters.arrival_date
27
28
  );
29
+ requestPrices = true
28
30
  } else if (filters.arrival_date) {
29
31
  min_nights = 1;
30
32
  }
@@ -45,6 +47,8 @@ function Results({
45
47
  bedrooms_min: Number(filters.bedrooms_min),
46
48
  bathrooms_min: Number(filters.bathrooms_min),
47
49
  arrival_date: filters.arrival_date,
50
+ starts_at: filters.arrival_date,
51
+ ends_at: filters.departure_date,
48
52
  no_nights: Number(min_nights) || null,
49
53
  extra_search: filters.extra_search,
50
54
  properties,
@@ -55,7 +59,7 @@ function Results({
55
59
  };
56
60
 
57
61
  return (
58
- <Query query={HOUSES_QUERY} variables={variables}>
62
+ <Query query={requestPrices ? HOUSES_PRICE_QUERY : HOUSES_QUERY} variables={variables}>
59
63
  {({ loading, error, data }) => {
60
64
  if (loading)
61
65
  return (
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types';
3
3
  import Filters from './Filters';
4
4
  import Results from './Results';
5
5
 
6
- // import './SearchPage.css'
7
-
8
6
  class SearchPage extends Component {
9
7
  constructor(props) {
10
8
  super(props);
@@ -42,15 +42,31 @@ function SingleResult({ result, options }) {
42
42
  </div>
43
43
  {thisOptions.showPrice && (
44
44
  <div className="result-price">
45
- <FormattedMessage id="minimum_week_price" />
46
- <span className="price">
47
- €{' '}
48
- <FormattedNumber
49
- value={result.minimum_week_price}
50
- minimumFractionDigits={0}
51
- maximumFractionDigits={0}
52
- />
53
- </span>
45
+ {result.booking_price ? (
46
+ <>
47
+ <FormattedMessage id="price_from" />
48
+ <span className="price">
49
+ {' '}
50
+ <FormattedNumber
51
+ value={result.booking_price.total_price}
52
+ minimumFractionDigits={0}
53
+ maximumFractionDigits={0}
54
+ />
55
+ </span>
56
+ </>
57
+ ) : (
58
+ <>
59
+ <FormattedMessage id="minimum_week_price" />
60
+ <span className="price">
61
+ €{' '}
62
+ <FormattedNumber
63
+ value={result.minimum_week_price}
64
+ minimumFractionDigits={0}
65
+ maximumFractionDigits={0}
66
+ />
67
+ </span>
68
+ </>
69
+ )}
54
70
  </div>
55
71
  )}
56
72
  <div className="result-button">
@@ -60,7 +76,7 @@ function SingleResult({ result, options }) {
60
76
  </div>
61
77
  </a>
62
78
  );
63
- };
79
+ }
64
80
 
65
81
  SingleResult.propTypes = {
66
82
  result: PropTypes.object.isRequired,
@@ -106,5 +106,6 @@
106
106
  "no_discount_code_found": "Kein Rabatt mit eingegebenem Code gefunden",
107
107
  "discount_code": "Rabatt-Code",
108
108
  "minimum_nights": "Mindestens {minimum} Nächte",
109
- "can_only_take_insurance_in_de_be_nl": "Sie können sich nur versichern, wenn Sie in den Niederlanden, Deutschland oder Belgien wohnen."
109
+ "can_only_take_insurance_in_de_be_nl": "Sie können sich nur versichern, wenn Sie in den Niederlanden, Deutschland oder Belgien wohnen.",
110
+ "price_from": "Preis von"
110
111
  }
@@ -107,5 +107,6 @@
107
107
  "no_discount_code_found": "No discount found with entered code",
108
108
  "discount_code": "Discount code",
109
109
  "minimum_nights": "At least {minimum} nights",
110
- "can_only_take_insurance_in_de_be_nl": "You can only take out insurance if you live in the Netherlands, Germany or Belgium."
110
+ "can_only_take_insurance_in_de_be_nl": "You can only take out insurance if you live in the Netherlands, Germany or Belgium.",
111
+ "price_from": "Price from"
111
112
  }
@@ -102,5 +102,6 @@
102
102
  "camper.pick_your_arrivaldate_in_the_calendar": "Elija una fecha de recogida",
103
103
  "no": "No",
104
104
  "minimum_nights": "Al menos {minimum} noches",
105
- "can_only_take_insurance_in_de_be_nl": "Solo puede contratar un seguro si vive en los Países Bajos, Alemania o Bélgica."
105
+ "can_only_take_insurance_in_de_be_nl": "Solo puede contratar un seguro si vive en los Países Bajos, Alemania o Bélgica.",
106
+ "price_from": "Precio de"
106
107
  }
@@ -102,5 +102,6 @@
102
102
  "camper.pick_your_arrivaldate_in_the_calendar": "Choisissez une date de pick-up",
103
103
  "no": "Non",
104
104
  "minimum_nights": "Au moins {minimum} nuits",
105
- "can_only_take_insurance_in_de_be_nl": "Vous ne pouvez souscrire une assurance que si vous résidez aux Pays-Bas, en Allemagne ou en Belgique."
105
+ "can_only_take_insurance_in_de_be_nl": "Vous ne pouvez souscrire une assurance que si vous résidez aux Pays-Bas, en Allemagne ou en Belgique.",
106
+ "price_from": "Le prix de"
106
107
  }
@@ -102,5 +102,6 @@
102
102
  "camper.pick_your_arrivaldate_in_the_calendar": "Scegli una data di ritiro",
103
103
  "no": "No",
104
104
  "minimum_nights": "Almeno {minimum} notti",
105
- "can_only_take_insurance_in_de_be_nl": "Puoi stipulare un'assicurazione solo se vivi nei Paesi Bassi, in Germania o in Belgio."
105
+ "can_only_take_insurance_in_de_be_nl": "Puoi stipulare un'assicurazione solo se vivi nei Paesi Bassi, in Germania o in Belgio.",
106
+ "price_from": "Prezzo da"
106
107
  }
@@ -107,5 +107,6 @@
107
107
  "no_discount_code_found": "Geen korting gevonden met ingegeven code",
108
108
  "discount_code": "Kortingscode",
109
109
  "minimum_nights": "Minstens {minimum} nachten",
110
- "can_only_take_insurance_in_de_be_nl": "U kunt alleen een verzekering afsluiten, wanneer u woont in Nederland, Duitsland of België."
110
+ "can_only_take_insurance_in_de_be_nl": "U kunt alleen een verzekering afsluiten, wanneer u woont in Nederland, Duitsland of België.",
111
+ "price_from": "Prijs vanaf"
111
112
  }