-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to show custom booking prompt
- Loading branch information
1 parent
ad95677
commit e9b833a
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
labotel/indico_labotel/client/js/components/BookRoomFormExtraFields.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// This file is part of the CERN Indico plugins. | ||
// Copyright (C) 2014 - 2024 CERN | ||
// | ||
// The CERN Indico plugins are free software; you can redistribute | ||
// them and/or modify them under the terms of the MIT License; see | ||
// the LICENSE file for more details. | ||
|
||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import {Icon, Segment} from 'semantic-ui-react'; | ||
|
||
import {FinalCheckbox} from 'indico/react/forms'; | ||
import {Markdown} from 'indico/react/util'; | ||
|
||
export default function BookRoomFormExtraFields({room: {confirmationPrompt}, booking, disabled}) { | ||
if (!confirmationPrompt || booking) { | ||
return null; | ||
} | ||
return ( | ||
<Segment inverted color="orange"> | ||
<h3 style={{marginBottom: '0.5em'}}> | ||
<Icon name="warning sign" /> | ||
Confirm requirements | ||
</h3> | ||
<Markdown targetBlank>{confirmationPrompt}</Markdown> | ||
<FinalCheckbox | ||
name="_requirements_confirmed" | ||
required | ||
disabled={disabled} | ||
label="I confirm that I meet the requirements" | ||
/> | ||
</Segment> | ||
); | ||
} | ||
|
||
BookRoomFormExtraFields.propTypes = { | ||
room: PropTypes.shape({ | ||
confirmationPrompt: PropTypes.string, | ||
}).isRequired, | ||
booking: PropTypes.object, | ||
disabled: PropTypes.bool.isRequired, | ||
}; | ||
|
||
BookRoomFormExtraFields.defaultProps = { | ||
booking: null, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters