Skip to content

Commit

Permalink
[New #26] Added export records UI
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Dec 7, 2023
1 parent bdae508 commit efa2eed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
24 changes: 16 additions & 8 deletions js/components/record/Records.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ class Records extends React.Component {
}

render() {
const {showAlert, recordDeleted, formTemplate} = this.props;
const {showAlert, recordDeleted, formTemplate, recordsLoaded} = this.props;
const showCreateButton = STUDY_CREATE_AT_MOST_ONE_RECORD
? (!this.props.recordsLoaded.records || (this.props.recordsLoaded.records.length < 1))
: true;
const showExportButton = !!recordsLoaded.records;
const createRecordDisabled =
STUDY_CLOSED_FOR_ADDITION
&& (!this._isAdmin());
Expand All @@ -53,13 +54,20 @@ class Records extends React.Component {
</Card.Header>
<Card.Body>
<RecordTable {...this.props}/>
<div>
{showCreateButton
? <Button variant='primary' size='sm'
disabled={createRecordDisabled}
title={createRecordTooltip}
onClick={onCreateWithFormTemplate}>{this.i18n('records.create-tile')}</Button>
: null}
<div className="row">
<div className="col-10">
{showCreateButton
? <Button variant='primary' size='sm'
disabled={createRecordDisabled}
title={createRecordTooltip}
onClick={onCreateWithFormTemplate}>{this.i18n('records.create-tile')}</Button>
: null}
</div>
<div className="col-2">
{showExportButton ?
<Button className="mx-1" variant='primary' size='sm'>{this.i18n('export')}</Button>
: null}
</div>
</div>
{showAlert && recordDeleted.status === ACTION_STATUS.ERROR &&
<AlertMessage type={ALERT_TYPES.DANGER}
Expand Down
1 change: 1 addition & 0 deletions js/i18n/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
'please-wait': 'Prosím, čekejte...',
'actions': 'Akce',
'required': 'Políčka označená * jsou povinná',
'export': 'Export',

'login.title': Constants.APP_NAME + ' - Přihlášení',
'login.username': 'Uživatelské jméno',
Expand Down
1 change: 1 addition & 0 deletions js/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
'please-wait': 'Please wait...',
'actions': 'Actions',
'required': 'Fields marked with * are required',
'export': 'Export',

'login.title': Constants.APP_NAME + ' - Login',
'login.username': 'Username',
Expand Down

0 comments on commit efa2eed

Please sign in to comment.