bukazu-portal-react 3.3.3 → 3.3.4
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/build/index.css +1 -1
- package/build/portal.es.js +19931 -20259
- package/build/portal.umd.js +80 -82
- package/package.json +9 -7
- package/.env.development +0 -1
- package/.eslintrc +0 -25
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/node.js.yml +0 -31
- package/.github/workflows/npm-publish.yml +0 -33
- package/.nvmrc +0 -1
- package/.prettierrc +0 -6
- package/.vscode/settings.json +0 -24
- package/CHANGELOG.MD +0 -93
- package/babel.config.json +0 -6
- package/calendar.html +0 -16
- package/coverage/clover.xml +0 -28
- package/coverage/coverage-final.json +0 -2
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helper.ts.html +0 -142
- package/coverage/lcov-report/index.html +0 -116
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -36
- package/cypress/e2e/.examples/actions.spec.js +0 -299
- package/cypress/e2e/.examples/aliasing.spec.js +0 -39
- package/cypress/e2e/.examples/assertions.spec.js +0 -177
- package/cypress/e2e/.examples/connectors.spec.js +0 -97
- package/cypress/e2e/.examples/cookies.spec.js +0 -77
- package/cypress/e2e/.examples/cypress_api.spec.js +0 -202
- package/cypress/e2e/.examples/files.spec.js +0 -89
- package/cypress/e2e/.examples/local_storage.spec.js +0 -52
- package/cypress/e2e/.examples/location.spec.js +0 -32
- package/cypress/e2e/.examples/misc.spec.js +0 -104
- package/cypress/e2e/.examples/navigation.spec.js +0 -56
- package/cypress/e2e/.examples/network_requests.spec.js +0 -163
- package/cypress/e2e/.examples/querying.spec.js +0 -114
- package/cypress/e2e/.examples/spies_stubs_clocks.spec.js +0 -205
- package/cypress/e2e/.examples/traversal.spec.js +0 -121
- package/cypress/e2e/.examples/utilities.spec.js +0 -110
- package/cypress/e2e/.examples/viewport.spec.js +0 -59
- package/cypress/e2e/.examples/waiting.spec.js +0 -31
- package/cypress/e2e/.examples/window.spec.js +0 -22
- package/cypress/e2e/booking.spec.js +0 -81
- package/cypress/e2e/calendar.spec.js +0 -21
- package/cypress/e2e/search.spec.js +0 -25
- package/cypress/fixtures/example.json +0 -5
- package/cypress/plugins/index.js +0 -16
- package/cypress/support/commands.js +0 -25
- package/cypress/support/commands.ts +0 -37
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.ts +0 -39
- package/cypress/support/e2e.js +0 -20
- package/cypress.config.ts +0 -15
- package/dev.tsx +0 -44
- package/index.html +0 -15
- package/invalid-calendar.html +0 -16
- package/jest.config.js +0 -195
- package/postcss.config.js +0 -17
- package/reviews.html +0 -16
- package/src/_lib/SearchQueries.ts +0 -145
- package/src/_lib/Tracking.ts +0 -51
- package/src/_lib/countries/de.json +0 -998
- package/src/_lib/countries/en.json +0 -998
- package/src/_lib/countries/es.json +0 -998
- package/src/_lib/countries/fr.json +0 -998
- package/src/_lib/countries/it.json +0 -998
- package/src/_lib/countries/nl.json +0 -998
- package/src/_lib/countries.ts +0 -15
- package/src/_lib/date_helper.ts +0 -27
- package/src/_lib/queries.ts +0 -244
- package/src/components/App.tsx +0 -108
- package/src/components/AppContext.ts +0 -14
- package/src/components/CalendarPage/BookingForm.tsx +0 -49
- package/src/components/CalendarPage/Calendar.tsx +0 -49
- package/src/components/CalendarPage/CalendarPage.tsx +0 -43
- package/src/components/CalendarPage/CalendarParts/CalendarContext.tsx +0 -89
- package/src/components/CalendarPage/CalendarParts/CalendarHeader.tsx +0 -72
- package/src/components/CalendarPage/CalendarParts/DayClasses.ts +0 -113
- package/src/components/CalendarPage/CalendarParts/GenerateCalendar.tsx +0 -72
- package/src/components/CalendarPage/CalendarParts/Legend.tsx +0 -33
- package/src/components/CalendarPage/CalendarParts/MonthHeader.tsx +0 -15
- package/src/components/CalendarPage/CalendarParts/Months.tsx +0 -37
- package/src/components/CalendarPage/CalendarParts/RenderCells.tsx +0 -97
- package/src/components/CalendarPage/CalendarParts/SingleMonth.tsx +0 -72
- package/src/components/CalendarPage/CalendarParts/StartBooking.tsx +0 -17
- package/src/components/CalendarPage/CalendarParts/WeekDays.tsx +0 -27
- package/src/components/CalendarPage/FormCreator.tsx +0 -230
- package/src/components/CalendarPage/FormItems/Date.tsx +0 -61
- package/src/components/CalendarPage/FormItems/NumberSelect.tsx +0 -39
- package/src/components/CalendarPage/FormItems/Select.tsx +0 -38
- package/src/components/CalendarPage/FormItems/index.ts +0 -4
- package/src/components/CalendarPage/PriceField/Price.tsx +0 -58
- package/src/components/CalendarPage/PriceField/Queries.ts +0 -23
- package/src/components/CalendarPage/PriceField/index.tsx +0 -129
- package/src/components/CalendarPage/Summary/CostRow.tsx +0 -58
- package/src/components/CalendarPage/Summary/CostSection.tsx +0 -15
- package/src/components/CalendarPage/Summary/CostSummary.tsx +0 -61
- package/src/components/CalendarPage/Summary/Description.tsx +0 -27
- package/src/components/CalendarPage/Summary/InsurancesAndRequired.tsx +0 -68
- package/src/components/CalendarPage/Summary/Object.tsx +0 -59
- package/src/components/CalendarPage/Summary/OnSite.tsx +0 -36
- package/src/components/CalendarPage/Summary/OptionalNotOnSite.tsx +0 -43
- package/src/components/CalendarPage/Summary/OptionalOnSite.tsx +0 -39
- package/src/components/CalendarPage/Summary/Queries.ts +0 -31
- package/src/components/CalendarPage/Summary/RentAndDiscount.tsx +0 -30
- package/src/components/CalendarPage/Summary/Totals.tsx +0 -89
- package/src/components/CalendarPage/Summary/cost_types.d.ts +0 -31
- package/src/components/CalendarPage/Summary/index.tsx +0 -24
- package/src/components/CalendarPage/calender_types.d.ts +0 -16
- package/src/components/CalendarPage/formParts/AssistanceMessage.tsx +0 -60
- package/src/components/CalendarPage/formParts/BookingHelpers.tsx +0 -47
- package/src/components/CalendarPage/formParts/BookingOrOption.tsx +0 -35
- package/src/components/CalendarPage/formParts/CancelInsuranceText.tsx +0 -69
- package/src/components/CalendarPage/formParts/DefaultBookingFields.ts +0 -105
- package/src/components/CalendarPage/formParts/DiscountCode.tsx +0 -62
- package/src/components/CalendarPage/formParts/Guests.tsx +0 -77
- package/src/components/CalendarPage/formParts/OptionalBookingFields.tsx +0 -148
- package/src/components/CalendarPage/formParts/OptionalCosts.tsx +0 -103
- package/src/components/CalendarPage/formParts/SuccessMessage.tsx +0 -31
- package/src/components/CalendarPage/formParts/Validations.tsx +0 -64
- package/src/components/CalendarPage/formParts/discount.tsx +0 -69
- package/src/components/CalendarPage/formParts/form_types.d.ts +0 -38
- package/src/components/CalendarPage/formParts/insurances.tsx +0 -62
- package/src/components/CalendarPage/formParts/radioButtons.tsx +0 -66
- package/src/components/Error/ApiError.tsx +0 -33
- package/src/components/Error/IntegrationError.tsx +0 -62
- package/src/components/Error/index.ts +0 -4
- package/src/components/ErrorBoundary.tsx +0 -34
- package/src/components/Modal/index.tsx +0 -46
- package/src/components/ReviewsPage/Queries.ts +0 -26
- package/src/components/ReviewsPage/ReviewsPage.tsx +0 -45
- package/src/components/ReviewsPage/Score.tsx +0 -29
- package/src/components/ReviewsPage/SingleReview.tsx +0 -38
- package/src/components/ReviewsPage/note.tsx +0 -17
- package/src/components/SafeBooking.tsx +0 -96
- package/src/components/SearchPage/Field.tsx +0 -75
- package/src/components/SearchPage/Filters.tsx +0 -91
- package/src/components/SearchPage/Paginator.tsx +0 -63
- package/src/components/SearchPage/Results.tsx +0 -129
- package/src/components/SearchPage/SearchPage.tsx +0 -115
- package/src/components/SearchPage/SingleResult.tsx +0 -93
- package/src/components/SearchPage/filters/Categories.tsx +0 -57
- package/src/components/SearchPage/filters/DateFilter.tsx +0 -34
- package/src/components/SearchPage/filters/List.tsx +0 -80
- package/src/components/SearchPage/filters/NumberFilter.tsx +0 -37
- package/src/components/SearchPage/filters/Radio.tsx +0 -46
- package/src/components/SearchPage/filters/Select.tsx +0 -85
- package/src/components/SearchPage/filters/__tests__/helper.spec.js +0 -13
- package/src/components/SearchPage/filters/filter_types.d.ts +0 -25
- package/src/components/SearchPage/filters/helper.ts +0 -19
- package/src/components/icons/ArrowLeft.svg.tsx +0 -20
- package/src/components/icons/ArrowRight.svg.tsx +0 -16
- package/src/components/icons/Reload.svg.tsx +0 -23
- package/src/components/icons/info.svg.tsx +0 -24
- package/src/components/icons/loading.svg.tsx +0 -98
- package/src/custom.d.ts +0 -10
- package/src/index.tsx +0 -104
- package/src/locales/de.json +0 -137
- package/src/locales/en.json +0 -137
- package/src/locales/es.json +0 -132
- package/src/locales/fr.json +0 -132
- package/src/locales/it.json +0 -128
- package/src/locales/nl.json +0 -138
- package/src/styles/calendar.css +0 -317
- package/src/styles/datepicker.css +0 -6
- package/src/styles/field.css +0 -105
- package/src/styles/filters.css +0 -92
- package/src/styles/form.css +0 -219
- package/src/styles/main.css +0 -80
- package/src/styles/modal.css +0 -79
- package/src/styles/pagination.css +0 -92
- package/src/styles/price-overview.css +0 -111
- package/src/styles/result.css +0 -142
- package/src/styles/results.css +0 -50
- package/src/styles/reviews.css +0 -90
- package/src/styles/success.css +0 -9
- package/src/types.d.ts +0 -91
- package/tmp/cache/vite/last-build-production.json +0 -7
- package/tsconfig.json +0 -17
- package/vite.config.ts +0 -31
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { useQuery } from '@apollo/client';
|
|
3
|
-
import InsurancesAndRequired from './InsurancesAndRequired.tsx';
|
|
4
|
-
import { BOOKING_PRICE_TOTAL_QUERY } from './Queries';
|
|
5
|
-
import RentAndDiscount from './RentAndDiscount';
|
|
6
|
-
import OptionalNotOnSite from './OptionalNotOnSite';
|
|
7
|
-
import OnSite from './OnSite';
|
|
8
|
-
import Totals from './Totals';
|
|
9
|
-
import { AppContext } from '../../AppContext';
|
|
10
|
-
import { HouseType } from '../../../types';
|
|
11
|
-
import { PossibleValues } from '../formParts/form_types';
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
values: PossibleValues;
|
|
15
|
-
house: HouseType;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function CostSummary({ values, house }: Props): React.ReactNode {
|
|
19
|
-
let babies = Number(values.babies) - Number(house.babies_extra);
|
|
20
|
-
if (babies < 0) {
|
|
21
|
-
babies = 0;
|
|
22
|
-
}
|
|
23
|
-
const persons = Number(values.children) + Number(values.adults) + babies;
|
|
24
|
-
const { portalCode, objectCode } = useContext(AppContext);
|
|
25
|
-
|
|
26
|
-
const { loading, error, data } = useQuery(BOOKING_PRICE_TOTAL_QUERY, {
|
|
27
|
-
variables: {
|
|
28
|
-
id: portalCode,
|
|
29
|
-
persons: persons,
|
|
30
|
-
house_id: objectCode,
|
|
31
|
-
starts_at: JSON.stringify(values.arrivalDate.date),
|
|
32
|
-
ends_at: JSON.stringify(values.departureDate.date),
|
|
33
|
-
costs: JSON.stringify(values.costs),
|
|
34
|
-
discount: Number(values.discount),
|
|
35
|
-
discount_code: values.discount_code,
|
|
36
|
-
cancel_insurance: Number(values.cancel_insurance)
|
|
37
|
-
},
|
|
38
|
-
fetchPolicy: 'network-only'
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (loading) {
|
|
42
|
-
return 'Loading...';
|
|
43
|
-
}
|
|
44
|
-
if (error) {
|
|
45
|
-
return <div>{JSON.stringify(error)}</div>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const prices = data.PortalSite.houses[0].booking_price;
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<>
|
|
52
|
-
<RentAndDiscount prices={prices} />
|
|
53
|
-
<InsurancesAndRequired prices={prices} />
|
|
54
|
-
<OptionalNotOnSite prices={prices} />
|
|
55
|
-
<OnSite prices={prices} />
|
|
56
|
-
<Totals prices={prices} />
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default CostSummary;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Icon from '../../icons/info.svg';
|
|
3
|
-
import Modal from '../../Modal';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
description: string | React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function Description({ description }: Props): JSX.Element {
|
|
10
|
-
let val = <span />;
|
|
11
|
-
if (description) {
|
|
12
|
-
val = (
|
|
13
|
-
<span
|
|
14
|
-
style={{
|
|
15
|
-
padding: '0 0 0 8px'
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
<Modal buttonText={<Icon />}>
|
|
19
|
-
<p>{description}</p>
|
|
20
|
-
</Modal>
|
|
21
|
-
</span>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return val;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default Description;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CostRow from './CostRow';
|
|
3
|
-
import { CostType } from './cost_types';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
prices: {
|
|
7
|
-
total_costs: {
|
|
8
|
-
insurances: {
|
|
9
|
-
cancel_insurance: number;
|
|
10
|
-
insurance_costs: number;
|
|
11
|
-
};
|
|
12
|
-
required_costs: {
|
|
13
|
-
not_on_site: CostType[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
required_house_costs: CostType[];
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default function InsurancesAndRequired({
|
|
21
|
-
prices
|
|
22
|
-
}: Props): React.ReactNode {
|
|
23
|
-
const { insurances, required_costs } = prices.total_costs;
|
|
24
|
-
const { not_on_site } = required_costs;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className="costs-section">
|
|
28
|
-
<table>
|
|
29
|
-
<tbody>
|
|
30
|
-
{insurances && (
|
|
31
|
-
<>
|
|
32
|
-
{Object.keys(insurances).map((key: string) => {
|
|
33
|
-
if (insurances[key] > 0) {
|
|
34
|
-
return (
|
|
35
|
-
<CostRow
|
|
36
|
-
name={key}
|
|
37
|
-
key={key}
|
|
38
|
-
formatName={true}
|
|
39
|
-
amount={insurances[key]}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
})}
|
|
44
|
-
</>
|
|
45
|
-
)}
|
|
46
|
-
{prices.required_house_costs.map((cost) => {
|
|
47
|
-
if (!cost.on_site && cost.gl !== '0120') {
|
|
48
|
-
if (cost.method === 'none') {
|
|
49
|
-
return <CostRow key={cost.id} {...cost} />;
|
|
50
|
-
} else {
|
|
51
|
-
if (cost.amount === 0) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
return (
|
|
55
|
-
<CostRow
|
|
56
|
-
key={cost.id}
|
|
57
|
-
{...cost}
|
|
58
|
-
amount={not_on_site?.find((x) => x.id == cost.id).amount}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
})}
|
|
64
|
-
</tbody>
|
|
65
|
-
</table>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
import {
|
|
5
|
-
FormatIntl,
|
|
6
|
-
LONG_DATE_FORMAT,
|
|
7
|
-
Parse_EN_US
|
|
8
|
-
} from '../../../_lib/date_helper';
|
|
9
|
-
import { HouseType } from '../../../types';
|
|
10
|
-
import { PossibleValues } from '../formParts/form_types';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
house: HouseType;
|
|
14
|
-
values: PossibleValues;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const Object = ({ house, values }: Props): React.ReactNode => {
|
|
18
|
-
const { arrivalDate, departureDate } = values;
|
|
19
|
-
return (
|
|
20
|
-
<React.Fragment>
|
|
21
|
-
<h2>
|
|
22
|
-
<FormattedMessage id="booking_details" />
|
|
23
|
-
</h2>
|
|
24
|
-
<div className="house-details">
|
|
25
|
-
<div>{house.name}</div>
|
|
26
|
-
<img src={house.image_url} alt="" />
|
|
27
|
-
<table>
|
|
28
|
-
<tbody>
|
|
29
|
-
<tr>
|
|
30
|
-
<th>
|
|
31
|
-
<FormattedMessage id={`${house.house_type}.arrival`} />
|
|
32
|
-
</th>
|
|
33
|
-
<td className="price">
|
|
34
|
-
{FormatIntl(Parse_EN_US(arrivalDate.date), LONG_DATE_FORMAT)}
|
|
35
|
-
</td>
|
|
36
|
-
<td>
|
|
37
|
-
{arrivalDate.arrival_time_from} - {arrivalDate.arrival_time_to}
|
|
38
|
-
</td>
|
|
39
|
-
</tr>
|
|
40
|
-
<tr>
|
|
41
|
-
<th>
|
|
42
|
-
<FormattedMessage id={`${house.house_type}.departure`} />
|
|
43
|
-
</th>
|
|
44
|
-
<td className="price">
|
|
45
|
-
{FormatIntl(Parse_EN_US(departureDate.date), LONG_DATE_FORMAT)}
|
|
46
|
-
</td>
|
|
47
|
-
<td>{departureDate.departure_time}</td>
|
|
48
|
-
</tr>
|
|
49
|
-
</tbody>
|
|
50
|
-
</table>
|
|
51
|
-
</div>
|
|
52
|
-
</React.Fragment>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
Object.propTypes = {
|
|
57
|
-
house: PropTypes.object.isRequired,
|
|
58
|
-
values: PropTypes.object.isRequired
|
|
59
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CostRow from './CostRow';
|
|
3
|
-
import OptionalOnSite from './OptionalOnSite';
|
|
4
|
-
import { FormattedMessage } from 'react-intl';
|
|
5
|
-
import { PricesType } from './cost_types';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
prices: PricesType;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default function OnSite({ prices }: Props): React.ReactNode {
|
|
12
|
-
const { required_costs } = prices.total_costs;
|
|
13
|
-
const { on_site } = required_costs;
|
|
14
|
-
return (
|
|
15
|
-
<div className="costs-section">
|
|
16
|
-
<strong>
|
|
17
|
-
<FormattedMessage id="costs_on_site" />
|
|
18
|
-
</strong>
|
|
19
|
-
<table>
|
|
20
|
-
<tbody>
|
|
21
|
-
{prices.required_house_costs.map((cost) => {
|
|
22
|
-
if (cost.on_site && cost.gl !== '0120') {
|
|
23
|
-
if (cost.method === 'none') {
|
|
24
|
-
return <CostRow key={cost.id} {...cost} />;
|
|
25
|
-
} else {
|
|
26
|
-
let amount = on_site.find((x) => x.id == cost.id)?.amount;
|
|
27
|
-
return <CostRow key={cost.id} {...cost} amount={amount} />;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
})}
|
|
31
|
-
<OptionalOnSite prices={prices} />
|
|
32
|
-
</tbody>
|
|
33
|
-
</table>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CostRow from './CostRow';
|
|
3
|
-
import { PricesType } from './cost_types';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
prices: PricesType;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function OptionalNotOnSite({ prices }: Props): JSX.Element {
|
|
10
|
-
const { optional_costs } = prices.total_costs;
|
|
11
|
-
const { not_on_site } = optional_costs;
|
|
12
|
-
return (
|
|
13
|
-
<div className="costs-section">
|
|
14
|
-
<table>
|
|
15
|
-
<tbody>
|
|
16
|
-
{prices.optional_house_costs.map((cost) => {
|
|
17
|
-
if (!cost.on_site && cost.gl !== '0120') {
|
|
18
|
-
if (cost.method === 'none') {
|
|
19
|
-
return <CostRow key={cost.id} {...cost} />;
|
|
20
|
-
} else if (cost.method === 'on_site') {
|
|
21
|
-
if (not_on_site.find((x) => x.id == cost.id).nr_of_items > 0) {
|
|
22
|
-
return (
|
|
23
|
-
<CostRow
|
|
24
|
-
key={cost.id}
|
|
25
|
-
{...cost}
|
|
26
|
-
amount={cost.amount}
|
|
27
|
-
forceMethod={true}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
let amount = not_on_site.find((x) => x.id == cost.id).amount;
|
|
33
|
-
if (amount > 0) {
|
|
34
|
-
return <CostRow key={cost.id} {...cost} amount={amount} />;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
})}
|
|
39
|
-
</tbody>
|
|
40
|
-
</table>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CostRow from './CostRow';
|
|
3
|
-
import { PricesType } from './cost_types';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
prices: PricesType;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function OptionalOnSite({ prices }: Props): JSX.Element {
|
|
10
|
-
const { optional_costs } = prices.total_costs;
|
|
11
|
-
const { on_site } = optional_costs;
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
{prices.optional_house_costs.map((cost) => {
|
|
15
|
-
if (cost.on_site && cost.gl !== '0120') {
|
|
16
|
-
if (cost.method === 'none') {
|
|
17
|
-
return <CostRow key={cost.id} {...cost} />;
|
|
18
|
-
} else if (cost.method === 'on_site') {
|
|
19
|
-
if (on_site?.find((x) => x.id == cost.id).nr_of_items > 0) {
|
|
20
|
-
return (
|
|
21
|
-
<CostRow
|
|
22
|
-
key={cost.id}
|
|
23
|
-
{...cost}
|
|
24
|
-
amount={cost.amount}
|
|
25
|
-
forceMethod={true}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
} else {
|
|
30
|
-
let amount = on_site?.find((x) => x.id == cost.id).amount;
|
|
31
|
-
if (amount > 0) {
|
|
32
|
-
return <CostRow key={cost.id} {...cost} amount={amount} />;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
})}
|
|
37
|
-
</>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client';
|
|
2
|
-
|
|
3
|
-
export const BOOKING_PRICE_TOTAL_QUERY = gql`
|
|
4
|
-
query BookingPriceTotalQuery(
|
|
5
|
-
$id: ID!
|
|
6
|
-
$house_id: String!
|
|
7
|
-
$starts_at: Date!
|
|
8
|
-
$ends_at: Date!
|
|
9
|
-
$persons: Int
|
|
10
|
-
$costs: Json
|
|
11
|
-
$cancel_insurance: Int
|
|
12
|
-
$discount: Int
|
|
13
|
-
$discount_code: String
|
|
14
|
-
) {
|
|
15
|
-
PortalSite(id: $id) {
|
|
16
|
-
houses(house_code: $house_id) {
|
|
17
|
-
id
|
|
18
|
-
name
|
|
19
|
-
booking_price(
|
|
20
|
-
starts_at: $starts_at
|
|
21
|
-
ends_at: $ends_at
|
|
22
|
-
persons: $persons
|
|
23
|
-
costs: $costs
|
|
24
|
-
cancel_insurance: $cancel_insurance
|
|
25
|
-
discount: $discount
|
|
26
|
-
discount_code: $discount_code
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CostRow from './CostRow';
|
|
3
|
-
import { PricesType } from './cost_types';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
prices: PricesType;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function RentAndDiscount({ prices }: Props): JSX.Element {
|
|
10
|
-
const { rent_price, discount, discounted_price } = prices;
|
|
11
|
-
return (
|
|
12
|
-
<div className="costs-section">
|
|
13
|
-
<table>
|
|
14
|
-
<tbody>
|
|
15
|
-
<CostRow name="rent_price" formatName={true} amount={rent_price} />
|
|
16
|
-
{discount > 0 ? (
|
|
17
|
-
<>
|
|
18
|
-
<CostRow name="discount" formatName={true} amount={discount} />
|
|
19
|
-
<CostRow
|
|
20
|
-
name="price_after_discount"
|
|
21
|
-
formatName={true}
|
|
22
|
-
amount={discounted_price}
|
|
23
|
-
/>
|
|
24
|
-
</>
|
|
25
|
-
) : null}
|
|
26
|
-
</tbody>
|
|
27
|
-
</table>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CostRow from './CostRow';
|
|
3
|
-
import CostSection from './CostSection';
|
|
4
|
-
import { FormattedMessage, FormattedNumber } from 'react-intl';
|
|
5
|
-
import { PricesType } from './cost_types';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
prices: PricesType;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function Totals({ prices }: Props): JSX.Element {
|
|
12
|
-
return (
|
|
13
|
-
<>
|
|
14
|
-
<CostSection>
|
|
15
|
-
<tr>
|
|
16
|
-
<th
|
|
17
|
-
style={{
|
|
18
|
-
textAlign: 'left',
|
|
19
|
-
testTransform: 'capitalize'
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
<FormattedMessage id="total" />
|
|
23
|
-
</th>
|
|
24
|
-
<th className="price" style={{ fontSize: 18 }}>
|
|
25
|
-
€{' '}
|
|
26
|
-
<FormattedNumber
|
|
27
|
-
value={prices.total_costs.sub_total}
|
|
28
|
-
minimumFractionDigits={2}
|
|
29
|
-
maximumFractionDigits={2}
|
|
30
|
-
/>
|
|
31
|
-
</th>
|
|
32
|
-
</tr>
|
|
33
|
-
</CostSection>
|
|
34
|
-
<CostSection>
|
|
35
|
-
<Deposit
|
|
36
|
-
cost_array={prices.required_house_costs}
|
|
37
|
-
price_array={prices.total_costs.required_costs.on_site}
|
|
38
|
-
/>
|
|
39
|
-
<Deposit
|
|
40
|
-
cost_array={prices.required_house_costs}
|
|
41
|
-
price_array={prices.total_costs.required_costs.not_on_site}
|
|
42
|
-
/>
|
|
43
|
-
<Deposit
|
|
44
|
-
cost_array={prices.optional_house_costs}
|
|
45
|
-
price_array={prices.total_costs.optional_costs.on_site}
|
|
46
|
-
/>
|
|
47
|
-
<Deposit
|
|
48
|
-
cost_array={prices.optional_house_costs}
|
|
49
|
-
price_array={prices.total_costs.optional_costs.not_on_site}
|
|
50
|
-
/>
|
|
51
|
-
</CostSection>
|
|
52
|
-
<CostSection>
|
|
53
|
-
<tr>
|
|
54
|
-
<th
|
|
55
|
-
style={{
|
|
56
|
-
textAlign: 'left',
|
|
57
|
-
testTransform: 'capitalize'
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
<FormattedMessage id="total" />
|
|
61
|
-
</th>
|
|
62
|
-
<td className="price">
|
|
63
|
-
€{' '}
|
|
64
|
-
<FormattedNumber
|
|
65
|
-
value={prices.total_costs.total_price}
|
|
66
|
-
minimumFractionDigits={2}
|
|
67
|
-
maximumFractionDigits={2}
|
|
68
|
-
/>
|
|
69
|
-
</td>
|
|
70
|
-
</tr>
|
|
71
|
-
</CostSection>
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default Totals;
|
|
77
|
-
|
|
78
|
-
function Deposit({ cost_array, price_array }) {
|
|
79
|
-
return (
|
|
80
|
-
<>
|
|
81
|
-
{cost_array.map((cost) => {
|
|
82
|
-
let price = price_array.find((x) => x.id == cost.id);
|
|
83
|
-
if (cost.gl === '0120' && price?.amount > 0) {
|
|
84
|
-
return <CostRow key={cost.id} {...cost} amount={price.amount} />;
|
|
85
|
-
}
|
|
86
|
-
})}
|
|
87
|
-
</>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export type CostType = {
|
|
2
|
-
on_site: boolean;
|
|
3
|
-
gl: string;
|
|
4
|
-
method: string;
|
|
5
|
-
id: number;
|
|
6
|
-
amount: number;
|
|
7
|
-
name: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type PricesType = {
|
|
11
|
-
total_costs: {
|
|
12
|
-
sub_total: number;
|
|
13
|
-
total_price: number;
|
|
14
|
-
insurances: {
|
|
15
|
-
cancel_insurance: number;
|
|
16
|
-
};
|
|
17
|
-
required_costs: {
|
|
18
|
-
not_on_site: CostType[];
|
|
19
|
-
on_site: CostType[];
|
|
20
|
-
};
|
|
21
|
-
optional_costs: {
|
|
22
|
-
not_on_site: CostType[];
|
|
23
|
-
on_site: CostType[];
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
optional_house_costs: CostType[];
|
|
27
|
-
required_house_costs: CostType[];
|
|
28
|
-
rent_price: number;
|
|
29
|
-
discount: number;
|
|
30
|
-
discounted_price: number;
|
|
31
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HouseType } from '../../../types';
|
|
3
|
-
|
|
4
|
-
import BookingOrOption from '../formParts/BookingOrOption';
|
|
5
|
-
import { PossibleValues } from '../formParts/form_types';
|
|
6
|
-
import CostSummary from './CostSummary';
|
|
7
|
-
import { Object } from './Object';
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
values: PossibleValues;
|
|
11
|
-
house: HouseType;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function Summary({ values, house }: Props): React.ReactNode {
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
<Object house={house} values={values} />
|
|
18
|
-
<BookingOrOption house={house} />
|
|
19
|
-
<CostSummary values={values} house={house} />
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default Summary;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BuDate } from '../../types';
|
|
2
|
-
|
|
3
|
-
export type DatesType = {
|
|
4
|
-
arrivalDate: BuDate;
|
|
5
|
-
selectedDate: Date;
|
|
6
|
-
departureDate: BuDate;
|
|
7
|
-
startBooking: Boolean;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type BookingType = {
|
|
11
|
-
arrivalDate: BuDate | null;
|
|
12
|
-
departureDate: BuDate | null;
|
|
13
|
-
selectedDate: Date | null;
|
|
14
|
-
bookingStarted: boolean;
|
|
15
|
-
persons: number;
|
|
16
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
|
-
import { HouseType } from '../../../types';
|
|
4
|
-
import {
|
|
5
|
-
FormatIntl,
|
|
6
|
-
LONG_DATE_FORMAT,
|
|
7
|
-
Parse_EN_US
|
|
8
|
-
} from '../../../_lib/date_helper';
|
|
9
|
-
import { CalendarContext } from '../CalendarParts/CalendarContext';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
house: HouseType;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function AssistanceMessage({ house }: Props): JSX.Element {
|
|
16
|
-
const { departureDate, arrivalDate } = useContext(CalendarContext);
|
|
17
|
-
|
|
18
|
-
if (departureDate?.date) {
|
|
19
|
-
return (
|
|
20
|
-
<div className="assistance">
|
|
21
|
-
<FormattedMessage id={`${house.house_type}.you_picked_arrival_date`} />:{' '}
|
|
22
|
-
{FormatIntl(Parse_EN_US(arrivalDate.date), LONG_DATE_FORMAT)}
|
|
23
|
-
<br />
|
|
24
|
-
<FormattedMessage
|
|
25
|
-
id={`${house.house_type}.you_picked_departure_date`}
|
|
26
|
-
/>
|
|
27
|
-
: {FormatIntl(Parse_EN_US(departureDate.date), LONG_DATE_FORMAT)}
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (arrivalDate?.date) {
|
|
33
|
-
return (
|
|
34
|
-
<div className="assistance">
|
|
35
|
-
<FormattedMessage id={`${house.house_type}.you_picked_arrival_date`} />:{' '}
|
|
36
|
-
{FormatIntl(Parse_EN_US(arrivalDate.date), LONG_DATE_FORMAT)}
|
|
37
|
-
<br />
|
|
38
|
-
<FormattedMessage
|
|
39
|
-
id={`${house.house_type}.pick_your_departure_in_the_calendar`}
|
|
40
|
-
/>
|
|
41
|
-
<br />
|
|
42
|
-
<FormattedMessage
|
|
43
|
-
id="minimum_nights"
|
|
44
|
-
values={{ minimum: arrivalDate.min_nights }}
|
|
45
|
-
defaultMessage="Minimum {minimum} nights"
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<div className="assistance">
|
|
53
|
-
<FormattedMessage
|
|
54
|
-
id={`${house.house_type}.pick_your_arrivaldate_in_the_calendar`}
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default AssistanceMessage;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { subYears, isAfter } from 'date-fns'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
|
|
5
|
-
export function createPeronsArray(persons: number): number[] {
|
|
6
|
-
return Array.apply(null, { length: persons + 1 }).map(Number.call, Number);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function initializeBookingFields(bookingFields: any[]) {
|
|
10
|
-
let obj = {};
|
|
11
|
-
bookingFields.map((field) => {
|
|
12
|
-
obj[field.id] = '';
|
|
13
|
-
});
|
|
14
|
-
return obj;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function byString(o, s) {
|
|
18
|
-
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
|
|
19
|
-
s = s.replace(/^\./, ''); // strip a leading dot
|
|
20
|
-
var a = s.split('.');
|
|
21
|
-
for (var i = 0, n = a.length; i < n; ++i) {
|
|
22
|
-
var k = a[i];
|
|
23
|
-
if (k in o) {
|
|
24
|
-
o = o[k];
|
|
25
|
-
} else {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return o;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function translatedOption(id:string, value: string):JSX.Element {
|
|
33
|
-
return (
|
|
34
|
-
<FormattedMessage id={id}>
|
|
35
|
-
{(formattedMessage) => <option value={value}>{formattedMessage}</option>}
|
|
36
|
-
</FormattedMessage>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function validateAge(string) {
|
|
41
|
-
const dob = new Date(string)
|
|
42
|
-
const minAge = subYears(new Date(), 18)
|
|
43
|
-
|
|
44
|
-
if (isAfter(dob, minAge)) {
|
|
45
|
-
return true;
|
|
46
|
-
} else return false;
|
|
47
|
-
}
|