Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release tku-v1.8 #276

Merged
merged 15 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/actions/announcementActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createAction } from 'redux-actions';

import types from 'constants/ActionTypes';

export const setMaintenanceMode = createAction(types.UI.SET_MAINTENANCE_MODE);
16 changes: 16 additions & 0 deletions app/assets/styles/_loader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,19 @@
position: relative;
min-height: 100px;
}

.loader-ease-in {
animation: easeIn 0.3s;
}

@keyframes easeIn {
0% {
opacity: 0;
transform: scale(0);
}

100% {
opacity: 1;
transform: scale(1);
}
}
1 change: 1 addition & 0 deletions app/constants/ActionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default {
SELECT_RESERVATION_TO_CANCEL: 'SELECT_RESERVATION_TO_CANCEL',
SELECT_RESERVATION_TO_EDIT: 'SELECT_RESERVATION_TO_EDIT',
SELECT_RESERVATION_TO_SHOW: 'SELECT_RESERVATION_TO_SHOW',
SET_MAINTENANCE_MODE: 'SET_MAINTENANCE_MODE',
SHOW_RESERVATION_INFO_MODAL: 'SHOW_RESERVATION_INFO_MODAL',
START_RESERVATION_EDIT_IN_INFO_MODAL: 'START_RESERVATION_EDIT_IN_INFO_MODAL',
TOGGLE_RESOURCE_SHOW_MAP: 'TOGGLE_RESOURCE_SHOW_MAP',
Expand Down
5 changes: 4 additions & 1 deletion app/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"common.reservationTimeLabel": "Time and date of the reservation",
"common.reserverAddressLabel": "Address",
"common.reserverEmailAddressLabel": "E-mail",
"common.reserverIdLabel": "Business ID / social security number",
"common.reserverIdLabel": "Business ID",
"common.reserverNameLabel": "The person making the reservation / lessee",
"common.reserverPhoneNumberLabel": "Phone",
"common.resourceLabel": "Premises",
Expand Down Expand Up @@ -215,6 +215,7 @@
"NotFoundPage.searchPage": "If you are looking for a certain space, you can search for it through {searchPageLink}.",
"NotFoundPage.searchPageLink": "search page",
"NotFoundPage.title": "404 Page not found",
"Notifications.cannotReserveDuringMaintenance": "Cannot make reservations during maintenance.",
"Notifications.errorMessage": "Something went wrong. Please try again in a moment.",
"Notifications.loginErrorMessage": "Failed to login. Please try again in a moment.",
"Notifications.userFetchErrorMessage": "Failed to retrieve user info. Please try again in a moment.",
Expand Down Expand Up @@ -323,6 +324,8 @@
"ReservationInfoModal.saveComment": "Save comment",
"ReservationInfoModal.title": "Reservation information.",
"ReservationInformationForm.cancelEdit": "Cancel edit",
"ReservationInformationForm.copyConfirmed": "✓ Copied!",
"ReservationInformationForm.copyInfoButtonLabel": "Copy reserver info to payer info",
"ReservationInformationForm.reserverInformationTitle": "Reserver information",
"ReservationInformationForm.eventInformationTitle": "Event information",
"ReservationInformationForm.paymentTermsAndConditionsLink": "the payment terms of the premises",
Expand Down
5 changes: 4 additions & 1 deletion app/i18n/messages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"common.reservationTimeLabel": "Varauksen ajankohta",
"common.reserverAddressLabel": "Osoite",
"common.reserverEmailAddressLabel": "Sähköposti",
"common.reserverIdLabel": "Y-tunnus / henkilötunnus",
"common.reserverIdLabel": "Y-tunnus",
"common.reserverNameLabel": "Varaaja / vuokraaja",
"common.reserverPhoneNumberLabel": "Puhelin",
"common.resourceLabel": "Tila",
Expand Down Expand Up @@ -215,6 +215,7 @@
"NotFoundPage.searchPage": "Jos etsit jotain tiettyä tilaa, voit etsiä sitä {searchPageLink}.",
"NotFoundPage.searchPageLink": "hakusivulta",
"NotFoundPage.title": "404 Sivua ei löydy",
"Notifications.cannotReserveDuringMaintenance": "Huoltotyön aikana ei voi tehdä varauksia.",
"Notifications.errorMessage": "Jotain meni vikaan. Yritä hetken päästä uudelleen.",
"Notifications.loginErrorMessage": "Kirjautuminen epäonnistui. Yritä hetken päästä uudelleen.",
"Notifications.userFetchErrorMessage": "Käyttäjätietojen hakeminen epäonnistui. Yritä hetken päästä uudelleen.",
Expand Down Expand Up @@ -323,6 +324,8 @@
"ReservationInfoModal.saveComment": "Tallenna kommentti",
"ReservationInfoModal.title": "Varauksen tiedot",
"ReservationInformationForm.cancelEdit": "Keskeytä muokkaus",
"ReservationInformationForm.copyConfirmed": "✓ Kopioitu!",
"ReservationInformationForm.copyInfoButtonLabel": "Kopioi varaajan tiedot maksajan tietoihin",
"ReservationInformationForm.reserverInformationTitle": "Varaajan tiedot",
"ReservationInformationForm.eventInformationTitle": "Tilaisuuden tiedot",
"ReservationInformationForm.paymentTermsAndConditionsLink": "tilan maksuehdot",
Expand Down
5 changes: 4 additions & 1 deletion app/i18n/messages/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"common.reservationTimeLabel": "Tidpunkt för bokning",
"common.reserverAddressLabel": "Adress",
"common.reserverEmailAddressLabel": "E-post",
"common.reserverIdLabel": "FO-nummer / personbeteckning",
"common.reserverIdLabel": "FO-nummer",
"common.reserverNameLabel": "Bokare / hyrestagare",
"common.reserverPhoneNumberLabel": "Telefon",
"common.resourceLabel": "Utrymme",
Expand Down Expand Up @@ -217,6 +217,7 @@
"NotFoundPage.searchPage": "Om du letar efter ett särskilt utrymme, kan du använda dig av söksidan {searchPageLink}.",
"NotFoundPage.searchPageLink": "söksidan",
"NotFoundPage.title": "404 Webbplatsen hittades inte",
"Notifications.cannotReserveDuringMaintenance": "Det går inte att göra reservationer under underhåll.",
"Notifications.errorMessage": "Ett fel uppstod. Försök på nytt om en liten stund.",
"Notifications.loginErrorMessage": "Inloggning misslyckades. Försök igen om en liten stund.",
"Notifications.userFetchErrorMessage": "Användarinformations hämtning misslyckades. Försök igen om en liten stund.",
Expand Down Expand Up @@ -325,6 +326,8 @@
"ReservationInfoModal.saveComment": "Spara kommentar",
"ReservationInfoModal.title": "Uppgifter om bokningen",
"ReservationInformationForm.cancelEdit": "Avbryt bearbetningen",
"ReservationInformationForm.copyConfirmed": "✓ Kopierat!",
"ReservationInformationForm.copyInfoButtonLabel": "Kopiera beställarinfo till betalningsinfo",
"ReservationInformationForm.reserverInformationTitle": "Beställarens uppgifter",
"ReservationInformationForm.eventInformationTitle": "Evenemangets uppgifter",
"ReservationInformationForm.paymentTermsAndConditionsLink": "betalningsvillkoren",
Expand Down
4 changes: 3 additions & 1 deletion app/pages/home/HomePage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { Button, Col, Row } from 'react-bootstrap';
import Button from 'react-bootstrap/lib/Button';
import Col from 'react-bootstrap/lib/Col';
import Row from 'react-bootstrap/lib/Row';
import Loader from 'react-loader';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
Expand Down
4 changes: 3 additions & 1 deletion app/pages/manage-reservations/ManageReservationsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import Loader from 'react-loader';
import { Col, Grid, Row } from 'react-bootstrap';
import Col from 'react-bootstrap/lib/Col';
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@


import React from 'react';
import { DropdownButton, MenuItem } from 'react-bootstrap';
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
import MenuItem from 'react-bootstrap/lib/MenuItem';
import PropTypes from 'prop-types';

import constants from 'constants/AppConstants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

import { get } from 'lodash';
import get from 'lodash/get';
import React from 'react';
import {
Button, Col, Grid, Row
} from 'react-bootstrap';
import Button from 'react-bootstrap/lib/Button';
import Col from 'react-bootstrap/lib/Col';
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import PropTypes from 'prop-types';
import { injectIntl, intlShape } from 'react-intl';
import moment from 'moment';
Expand Down
3 changes: 2 additions & 1 deletion app/pages/manage-reservations/filters/filterUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import { isEmpty, omit } from 'lodash';
import isEmpty from 'lodash/isEmpty';
import omit from 'lodash/omit';
import moment from 'moment';

import constants from 'constants/AppConstants';
Expand Down
3 changes: 2 additions & 1 deletion app/pages/manage-reservations/inputs/SelectField.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { ControlLabel, FormGroup } from 'react-bootstrap';
import ControlLabel from 'react-bootstrap/lib/ControlLabel';
import FormGroup from 'react-bootstrap/lib/FormGroup';
import Select from 'react-select';

import injectT from '../../../i18n/injectT';
Expand Down
2 changes: 1 addition & 1 deletion app/pages/manage-reservations/inputs/ToggleField.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { ControlLabel } from 'react-bootstrap';
import ControlLabel from 'react-bootstrap/lib/ControlLabel';
import Toggle from 'react-toggle';

function ToggleField({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Table } from 'react-bootstrap';
import Table from 'react-bootstrap/lib/Table';
import PropTypes from 'prop-types';

import injectT from '../../../i18n/injectT';
Expand Down
2 changes: 1 addition & 1 deletion app/pages/manage-reservations/list/ReservationDataRow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { get } from 'lodash';
import get from 'lodash/get';
import React from 'react';
import PropTypes from 'prop-types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty } from 'lodash';
import isEmpty from 'lodash/isEmpty';

import constants from 'constants/AppConstants';
import { canUserModifyReservation } from 'utils/reservationUtils';
Expand Down
2 changes: 1 addition & 1 deletion app/pages/not-found/NotFoundPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function NotFoundPage({ t }) {
<h1>{t('NotFoundPage.title')}</h1>
<p className="lead">{t('NotFoundPage.lead')}</p>
<Well>
<h5>{t('NotFoundPage.helpHeader')}</h5>
<p className="h4">{t('NotFoundPage.helpHeader')}</p>
<ul>
<li>
<FormattedMessage
Expand Down
13 changes: 13 additions & 0 deletions app/pages/not-found/NotFoundPage.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import Well from 'react-bootstrap/lib/Well';

import PageWrapper from 'pages/PageWrapper';
import { shallowWithIntl } from 'utils/testUtils';
Expand All @@ -20,6 +21,18 @@ describe('pages/not-found/NotFoundPage', () => {
expect(h1.props().children).toBe('NotFoundPage.title');
});

test('renders a Well component', () => {
const well = getWrapper().find(Well);
expect(well.length).toBe(1);
});

test('renders correct help header text within Well', () => {
const p = getWrapper().find(Well).find('p');
expect(p.length).toBe(1);
expect(p.prop('className')).toBe('h4');
expect(p.props().children).toBe('NotFoundPage.helpHeader');
});

test('renders a list and list elements for displaying help to user', () => {
const ul = getWrapper().find('ul');
const lis = getWrapper().find('li');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Well } from 'react-bootstrap';
import Well from 'react-bootstrap/lib/Well';
import moment from 'moment';

import injectT from '../../../i18n/injectT';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ class ReservationInformation extends Component {
return {};
}

getRequiredFormFields(resource, termsAndConditions) {
getRequiredFormFields(
resource, termsAndConditions, paymentTermsAndConditions, hasPayments = false) {
const requiredFormFields = [...resource.requiredReservationExtraFields.map(
field => camelCase(field)
)];
Expand All @@ -160,7 +161,7 @@ class ReservationInformation extends Component {
requiredFormFields.push('termsAndConditions');
}

if (hasProducts(resource)) {
if (paymentTermsAndConditions && hasPayments) {
requiredFormFields.push('paymentTermsAndConditions');
}

Expand Down Expand Up @@ -223,7 +224,8 @@ class ReservationInformation extends Component {
openResourcePaymentTermsModal={openResourcePaymentTermsModal}
openResourceTermsModal={openResourceTermsModal}
paymentTermsAndConditions={paymentTermsAndConditions}
requiredFields={this.getRequiredFormFields(resource, termsAndConditions)}
requiredFields={this.getRequiredFormFields(
resource, termsAndConditions, paymentTermsAndConditions, hasPayment(order))}
resource={resource}
termsAndConditions={termsAndConditions}
user={user}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,30 @@ describe('pages/reservation/reservation-information/ReservationInformation', ()
expect(actual).toEqual(['someField1', 'someField2', 'termsAndConditions']);
});

test('does not return paymentTermsAndConditions if they are defined but reservation has no payments', () => {
const resource = Resource.build({
paymentTermsAndConditions: 'payment terms and conditions'
});
const instance = getWrapper().instance();
const hasPayments = false;
const actual = instance.getRequiredFormFields(
resource, undefined, resource.paymentTermsAndConditions, hasPayments);

expect(actual).toEqual([]);
});

test('returns paymentTermsAndConditions if they are defined and reservation has payments', () => {
const resource = Resource.build({
paymentTermsAndConditions: 'payment terms and conditions'
});
const instance = getWrapper().instance();
const hasPayments = true;
const actual = instance.getRequiredFormFields(
resource, undefined, resource.paymentTermsAndConditions, hasPayments);

expect(actual).toEqual(['paymentTermsAndConditions']);
});

test('returns required form field and universalData if resource has universalField with content', () => {
let resource = Resource.build({
requiredReservationExtraFields: ['some_field_1', 'some_field_2'],
Expand Down
Loading
Loading