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

Added export records UI #32

Merged
merged 4 commits into from
Dec 11, 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: 4 additions & 1 deletion js/components/institution/InstitutionPatients.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import React from 'react';
import {Card} from 'react-bootstrap';
import {Button, Card} from 'react-bootstrap';

import withI18n from '../../i18n/withI18n';
import {injectIntl} from "react-intl";
Expand All @@ -20,6 +20,9 @@ const InstitutionPatients = (props) => {
handlers={{onEdit: onEdit}}
disableDelete={true}
currentUser={currentUser}/>
<div className="d-flex justify-content-end">
<Button className="mx-1" variant='primary' size='sm'>{props.i18n('export')}</Button>
</div>
</Card.Body>
</Card>;
};
Expand Down
14 changes: 9 additions & 5 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,12 +54,15 @@ class Records extends React.Component {
</Card.Header>
<Card.Body>
<RecordTable {...this.props}/>
<div>
<div className="d-flex justify-content-between">
{showCreateButton
? <Button variant='primary' size='sm'
disabled={createRecordDisabled}
title={createRecordTooltip}
onClick={onCreateWithFormTemplate}>{this.i18n('records.create-tile')}</Button>
disabled={createRecordDisabled}
title={createRecordTooltip}
onClick={onCreateWithFormTemplate}>{this.i18n('records.create-tile')}</Button>
: null}
{showExportButton ?
<Button className="mx-1" variant='primary' size='sm'>{this.i18n('export')}</Button>
: null}
</div>
{showAlert && recordDeleted.status === ACTION_STATUS.ERROR &&
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
2 changes: 1 addition & 1 deletion tests/__tests__/components/Institution.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('Institution', function () {
institutionSaved={institutionSaved}/>
</IntlProvider>);
const buttons = TestUtils.scryRenderedDOMComponentsWithTag(tree, "Button");
expect(buttons.length).toEqual(3);
expect(buttons.length).toEqual(4);

TestUtils.Simulate.click(buttons[1]); // cancel
expect(handlers.onCancel).toHaveBeenCalled();
Expand Down
Loading