From 872afac45ec12ed027eff643812d019270b2e9c2 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Thu, 30 Nov 2023 13:30:32 +0100 Subject: [PATCH 01/13] [New #18] Added role specific buttons depending on extension --- js/components/record/Record.js | 23 +++++++++++++++++++---- js/constants/DefaultConstants.js | 5 +++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 6ec3ac62..3cfe955d 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -9,10 +9,11 @@ import HorizontalInput from "../HorizontalInput"; import RecordForm from "./RecordForm"; import RecordProvenance from "./RecordProvenance"; import RequiredAttributes from "./RequiredAttributes"; -import {ACTION_STATUS, ALERT_TYPES, ROLE} from "../../constants/DefaultConstants"; +import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, ROLE} from "../../constants/DefaultConstants"; import AlertMessage from "../AlertMessage"; import {LoaderCard, LoaderSmall} from "../Loader"; import {processTypeaheadOptions} from "./TypeaheadAnswer"; +import {EXTENSIONS} from "../../../config"; class Record extends React.Component { constructor(props) { @@ -105,17 +106,31 @@ class Record extends React.Component { const {record, recordSaved, formgen} = this.props; return
- -
} + _renderRoleSpecificButtons() { + return <> + {EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER && + <> + + + + } + {EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR && + } + ; + } + _renderInstitution() { const record = this.props.record; if (!record.institution) { diff --git a/js/constants/DefaultConstants.js b/js/constants/DefaultConstants.js index a0839700..6284dfc2 100644 --- a/js/constants/DefaultConstants.js +++ b/js/constants/DefaultConstants.js @@ -118,3 +118,8 @@ export const MediaType = { EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", JSON: "application/json" } + +export const EXTENSION_CONSTANTS = { + SUPPLIER: "supplier", + OPERATOR: "operator" +} From 4ce67275f491b5396c1c2421f68e43070c4e8431 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Thu, 30 Nov 2023 14:38:11 +0100 Subject: [PATCH 02/13] [Upd #18] Added i18n for specific buttons --- js/components/record/Record.js | 6 +++--- js/i18n/cs.js | 3 +++ js/i18n/en.js | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 3cfe955d..1de24004 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -122,12 +122,12 @@ class Record extends React.Component { return <> {EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER && <> - - + + } {EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR && - } + } ; } diff --git a/js/i18n/cs.js b/js/i18n/cs.js index fb047b78..069c7e1d 100644 --- a/js/i18n/cs.js +++ b/js/i18n/cs.js @@ -33,6 +33,9 @@ export default { 'please-wait': 'Prosím, čekejte...', 'actions': 'Akce', 'required': 'Políčka označená * jsou povinná', + 'reject': 'Odmítnout', + 'accept':'Přijmout', + 'complete': 'Dokončit', 'login.title': Constants.APP_NAME + ' - Přihlášení', 'login.username': 'Uživatelské jméno', diff --git a/js/i18n/en.js b/js/i18n/en.js index b1740ae9..6f0b12eb 100644 --- a/js/i18n/en.js +++ b/js/i18n/en.js @@ -33,6 +33,9 @@ export default { 'please-wait': 'Please wait...', 'actions': 'Actions', 'required': 'Fields marked with * are required', + 'reject': 'Reject', + 'accept':'Accept', + 'complete': 'Complete', 'login.title': Constants.APP_NAME + ' - Login', 'login.username': 'Username', From c5977e1d05222b97993032c3a3690710db6c817c Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Thu, 30 Nov 2023 14:43:55 +0100 Subject: [PATCH 03/13] [New #18] Added Publish button for Admin Operator --- js/components/record/Records.js | 13 +++++++++++-- js/i18n/cs.js | 1 + js/i18n/en.js | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/js/components/record/Records.js b/js/components/record/Records.js index 200c148c..e84656f3 100644 --- a/js/components/record/Records.js +++ b/js/components/record/Records.js @@ -1,13 +1,16 @@ +'use strict'; + import React from "react"; import {Button, Card} from "react-bootstrap"; import {injectIntl} from "react-intl"; import withI18n from "../../i18n/withI18n"; import RecordTable from "./RecordTable"; -import {ACTION_STATUS, ALERT_TYPES, ROLE} from "../../constants/DefaultConstants"; +import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, ROLE} from "../../constants/DefaultConstants"; import AlertMessage from "../AlertMessage"; import {LoaderSmall} from "../Loader"; import PropTypes from "prop-types"; import {processTypeaheadOptions} from "./TypeaheadAnswer"; +import {EXTENSIONS} from "../../../config"; import ExportRecordsDropdown from "./ExportRecordsDropdown"; const STUDY_CLOSED_FOR_ADDITION = false; @@ -35,6 +38,9 @@ class Records extends React.Component { const showCreateButton = STUDY_CREATE_AT_MOST_ONE_RECORD ? (!recordsLoaded.records || (recordsLoaded.records.length < 1)) : true; + const showPublishButton = + this.props.currentUser.role === ROLE.ADMIN + && EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR; const createRecordDisabled = STUDY_CLOSED_FOR_ADDITION && (!this._isAdmin()); @@ -54,11 +60,14 @@ class Records extends React.Component {
{showCreateButton - ? : null} + {showPublishButton ? + + : null}
{showAlert && recordDeleted.status === ACTION_STATUS.ERROR && diff --git a/js/i18n/cs.js b/js/i18n/cs.js index 069c7e1d..3f6508a3 100644 --- a/js/i18n/cs.js +++ b/js/i18n/cs.js @@ -36,6 +36,7 @@ export default { 'reject': 'Odmítnout', 'accept':'Přijmout', 'complete': 'Dokončit', + 'publish': 'Publikovat', 'login.title': Constants.APP_NAME + ' - Přihlášení', 'login.username': 'Uživatelské jméno', diff --git a/js/i18n/en.js b/js/i18n/en.js index 6f0b12eb..44130464 100644 --- a/js/i18n/en.js +++ b/js/i18n/en.js @@ -36,6 +36,7 @@ export default { 'reject': 'Reject', 'accept':'Accept', 'complete': 'Complete', + 'publish': 'Publish', 'login.title': Constants.APP_NAME + ' - Login', 'login.username': 'Username', From 8a1b3bd861fa7b1ba22f1fe7fa3358e6e2121b01 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Thu, 30 Nov 2023 19:30:41 +0100 Subject: [PATCH 04/13] [New #18] Added record in progress icon and set it as default --- js/components/HelpIcon.js | 3 +++ js/components/record/RecordRow.js | 2 +- js/constants/DefaultConstants.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/js/components/HelpIcon.js b/js/components/HelpIcon.js index fcc707d8..d5ac3931 100644 --- a/js/components/HelpIcon.js +++ b/js/components/HelpIcon.js @@ -6,6 +6,7 @@ import PropTypes from "prop-types"; import {FaQuestionCircle} from 'react-icons/fa'; import {FaCheck} from 'react-icons/fa'; import {FaTimes} from 'react-icons/fa'; +import {FaTasks} from "react-icons/fa"; const HelpIcon = (props) => { const tooltip = {props.text}; @@ -18,6 +19,8 @@ const HelpIcon = (props) => { return ; case "remove": return ; + case "progress": + return ; default: return null; } diff --git a/js/components/record/RecordRow.js b/js/components/record/RecordRow.js index feaef814..43d1f8f4 100644 --- a/js/components/record/RecordRow.js +++ b/js/components/record/RecordRow.js @@ -44,7 +44,7 @@ let RecordRow = (props) => { { isAdmin && - + } diff --git a/js/constants/DefaultConstants.js b/js/constants/DefaultConstants.js index 6284dfc2..f093543a 100644 --- a/js/constants/DefaultConstants.js +++ b/js/constants/DefaultConstants.js @@ -68,7 +68,7 @@ export const INPUT_LENGTH_THRESHOLD = 70; export const PASSWORD_LENGTH = 4; -export const RECORD_REQUIRED_FIELDS = ['localName']; +export const RECORD_REQUIRED_FIELDS = ['localName', 'completed']; export const ALERT_TYPES = { INFO: 'info', From 9e21e5d5173d40f3b45bb7a2d8798c77bf91f80d Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Wed, 13 Dec 2023 13:02:08 +0100 Subject: [PATCH 05/13] [New #18] Added rejected, completed and published buttons --- js/components/HelpIcon.js | 8 ++++--- js/components/record/Record.js | 13 ++++++----- js/components/record/RecordController.js | 27 +++++++++++++++++++++-- js/components/record/RecordRow.js | 14 +++++++++--- js/components/record/Records.js | 5 ++++- js/components/record/RecordsController.js | 26 ++++++++++++++++++++-- js/constants/DefaultConstants.js | 8 +++++++ js/i18n/cs.js | 1 - js/i18n/en.js | 1 - js/utils/EntityFactory.js | 4 +++- 10 files changed, 88 insertions(+), 19 deletions(-) diff --git a/js/components/HelpIcon.js b/js/components/HelpIcon.js index d5ac3931..a7bfa4d4 100644 --- a/js/components/HelpIcon.js +++ b/js/components/HelpIcon.js @@ -3,7 +3,7 @@ import React from 'react'; import {OverlayTrigger, Tooltip} from 'react-bootstrap'; import PropTypes from "prop-types"; -import {FaQuestionCircle} from 'react-icons/fa'; +import {FaEnvelope, FaQuestionCircle} from 'react-icons/fa'; import {FaCheck} from 'react-icons/fa'; import {FaTimes} from 'react-icons/fa'; import {FaTasks} from "react-icons/fa"; @@ -19,8 +19,10 @@ const HelpIcon = (props) => { return ; case "remove": return ; - case "progress": - return ; + case "to-do": + return ; + case "envelope": + return default: return null; } diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 1de24004..2711657e 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -121,13 +121,16 @@ class Record extends React.Component { _renderRoleSpecificButtons() { return <> {EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER && - <> - - - + } {EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR && - } + } ; } diff --git a/js/components/record/RecordController.js b/js/components/record/RecordController.js index 3aa74e3d..d83045ec 100644 --- a/js/components/record/RecordController.js +++ b/js/components/record/RecordController.js @@ -6,7 +6,7 @@ import withI18n from '../../i18n/withI18n'; import Record from './Record'; import Routes from "../../constants/RoutesConstants"; import {transitionToWithOpts} from '../../utils/Routing'; -import {ACTION_FLAG, ACTION_STATUS} from "../../constants/DefaultConstants"; +import {ACTION_FLAG, ACTION_STATUS, RECORD_PHASE} from "../../constants/DefaultConstants"; import {connect} from "react-redux"; import {bindActionCreators} from "redux"; import { @@ -126,6 +126,27 @@ class RecordController extends React.Component { this.setState({record: update}); }; + _onComplete = () => { + this._handlePhaseChange(RECORD_PHASE.COMPLETED); + }; + + _onReject = () => { + this._handlePhaseChange(RECORD_PHASE.REJECTED); + }; + + _handlePhaseChange = (newPhase) => { + const currentUser = this.props.currentUser; + + this.setState((prevState) => { + const update = {...prevState.record}; + update.phase = newPhase; + return {record: update}; + }, () => { + const updatedRecord = this.state.record; + this.props.updateRecord(updatedRecord, currentUser); + }); + }; + _getLocalName() { if (EXTENSIONS.split(",").includes("kodi")) { // return name of the record based on answer of specific question return this._getKodiLocaLName(); @@ -158,7 +179,9 @@ class RecordController extends React.Component { const handlers = { onSave: this._onSave, onCancel: this._onCancel, - onChange: this._onChange + onChange: this._onChange, + onComplete: this._onComplete, + onReject: this._onReject }; return { const record = props.record, @@ -18,7 +18,15 @@ let RecordRow = (props) => { deleteButton = props.disableDelete ? null : ; + }, + recordPhase = props.record.phase; + + const getGlyph = () => { + if (recordPhase === RECORD_PHASE.OPEN) return "to-do"; + if (recordPhase === RECORD_PHASE.COMPLETED) return "ok"; + if (recordPhase === RECORD_PHASE.PUBLISHED) return "envelope"; + if (recordPhase === RECORD_PHASE.REJECTED) return "remove"; + } return {isAdmin && @@ -44,7 +52,7 @@ let RecordRow = (props) => { { isAdmin && - + } diff --git a/js/components/record/Records.js b/js/components/record/Records.js index e84656f3..6a6de6fa 100644 --- a/js/components/record/Records.js +++ b/js/components/record/Records.js @@ -66,7 +66,10 @@ class Records extends React.Component { onClick={onCreateWithFormTemplate}>{this.i18n('records.create-tile')} : null} {showPublishButton ? - + : null} diff --git a/js/components/record/RecordsController.js b/js/components/record/RecordsController.js index 16fe4905..f1c9f208 100644 --- a/js/components/record/RecordsController.js +++ b/js/components/record/RecordsController.js @@ -10,9 +10,10 @@ import {injectIntl} from "react-intl"; import withI18n from "../../i18n/withI18n"; import {connect} from "react-redux"; import {bindActionCreators} from "redux"; -import {deleteRecord} from "../../actions/RecordActions"; +import {deleteRecord, updateRecord} from "../../actions/RecordActions"; import {loadFormTemplates} from "../../actions/FormTemplatesActions"; import {extractQueryParam} from "../../utils/Utils" +import {RECORD_PHASE} from "../../constants/DefaultConstants"; class RecordsController extends React.Component { constructor(props) { @@ -53,6 +54,25 @@ class RecordsController extends React.Component { this.setState({showAlert: true}); }; + _onPublishRecords = async () => { + const currentUser = this.props.currentUser; + + this.setState({ + records: this.props.recordsLoaded.records + }, async () => { + const updatedRecords = this.state.records.map(async (record) => { + if (record.phase === RECORD_PHASE.COMPLETED) { + const updatedRecord = {...record, phase: RECORD_PHASE.PUBLISHED}; + await this.props.updateRecord(updatedRecord, currentUser); + return updatedRecord; + } + }); + + return await Promise.all(updatedRecords); + }) + + }; + _onExportRecords = (exportType) => { this.props.exportRecords(exportType); }; @@ -67,6 +87,7 @@ class RecordsController extends React.Component { onEdit: this._onEditRecord, onCreate: this._onAddRecord, onDelete: this._onDeleteRecord, + onPublish: this._onPublishRecords, onExport: this._onExportRecords }; return Date: Wed, 13 Dec 2023 13:22:30 +0100 Subject: [PATCH 06/13] [New #18] Added record status tooltip for rejected and published phases --- js/components/record/RecordRow.js | 45 +++++++++++++++++++++---------- js/constants/DefaultConstants.js | 2 +- js/i18n/cs.js | 2 ++ js/i18n/en.js | 2 ++ 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/js/components/record/RecordRow.js b/js/components/record/RecordRow.js index 7d29093a..9c40e256 100644 --- a/js/components/record/RecordRow.js +++ b/js/components/record/RecordRow.js @@ -4,7 +4,6 @@ import HelpIcon from "../HelpIcon"; import {Button} from "react-bootstrap"; import {injectIntl} from "react-intl"; import withI18n from "../../i18n/withI18n"; -import RecordValidator from "../../validation/RecordValidator"; import {LoaderSmall} from "../Loader"; import PropTypes from "prop-types"; import {RECORD_PHASE, ROLE} from "../../constants/DefaultConstants"; @@ -12,21 +11,42 @@ import {RECORD_PHASE, ROLE} from "../../constants/DefaultConstants"; let RecordRow = (props) => { const record = props.record, formTemplateOptions = props.formTemplateOptions, - isComplete = RecordValidator.isComplete(record), - completionTooltip = props.i18n(isComplete ? 'records.completion-status-tooltip.complete' : 'records.completion-status-tooltip.incomplete'), + recordPhase = props.record.phase, isAdmin = props.currentUser.role === ROLE.ADMIN, deleteButton = props.disableDelete ? null : , - recordPhase = props.record.phase; + }; const getGlyph = () => { - if (recordPhase === RECORD_PHASE.OPEN) return "to-do"; - if (recordPhase === RECORD_PHASE.COMPLETED) return "ok"; - if (recordPhase === RECORD_PHASE.PUBLISHED) return "envelope"; - if (recordPhase === RECORD_PHASE.REJECTED) return "remove"; - } + switch (recordPhase) { + case RECORD_PHASE.OPEN: + return 'to-do'; + case RECORD_PHASE.COMPLETED: + return 'ok'; + case RECORD_PHASE.PUBLISHED: + return 'envelope'; + case RECORD_PHASE.REJECTED: + return 'remove'; + default: + return ''; + } + }; + + const getCompletionStatusTooltip = () => { + switch (recordPhase) { + case RECORD_PHASE.COMPLETED: + return props.i18n('records.completion-status-tooltip.complete'); + case RECORD_PHASE.OPEN: + return props.i18n('records.completion-status-tooltip.incomplete'); + case RECORD_PHASE.REJECTED: + return props.i18n('records.completion-status-tooltip.rejected'); + case RECORD_PHASE.PUBLISHED: + return props.i18n('records.completion-status-tooltip.published'); + default: + return ""; + } + }; return {isAdmin && @@ -52,7 +72,7 @@ let RecordRow = (props) => { { isAdmin && - + } @@ -63,9 +83,6 @@ let RecordRow = (props) => { }; -const isAdvancedView = {} - - const getFormTemplateOptionName = (formTemplate, formTemplatesOptions) => { if (!formTemplate) { return ""; diff --git a/js/constants/DefaultConstants.js b/js/constants/DefaultConstants.js index 8b3dcb6a..96a7dc1d 100644 --- a/js/constants/DefaultConstants.js +++ b/js/constants/DefaultConstants.js @@ -68,7 +68,7 @@ export const INPUT_LENGTH_THRESHOLD = 70; export const PASSWORD_LENGTH = 4; -export const RECORD_REQUIRED_FIELDS = ['localName', 'completed']; +export const RECORD_REQUIRED_FIELDS = ['localName']; export const ALERT_TYPES = { INFO: 'info', diff --git a/js/i18n/cs.js b/js/i18n/cs.js index 1905fdbd..1d6f0485 100644 --- a/js/i18n/cs.js +++ b/js/i18n/cs.js @@ -148,6 +148,8 @@ export default { 'records.completion-status': 'Stav vyplnění', 'records.completion-status-tooltip.complete': 'Všechny povinné informace ze záznamu byly vyplněny.', 'records.completion-status-tooltip.incomplete': 'Některé povinné informace ze záznamu ještě nebyly vyplněny.', + 'records.completion-status-tooltip.rejected': 'Formulář byl odmítnut', + 'records.completion-status-tooltip.published': 'Formulář byl zveřejněn', 'records.last-modified': 'Naposledy upraveno', 'records.open-tooltip': 'Zobrazit či upravit tento záznam', 'records.delete-tooltip': 'Smazat tento záznam', diff --git a/js/i18n/en.js b/js/i18n/en.js index 9d1a0629..217ec59a 100644 --- a/js/i18n/en.js +++ b/js/i18n/en.js @@ -148,6 +148,8 @@ export default { 'records.completion-status': 'Completion status', 'records.completion-status-tooltip.complete': 'All required fields of the record have been filled out.', 'records.completion-status-tooltip.incomplete': 'Some of the required fields of the record have not yet been filled out.', + 'records.completion-status-tooltip.rejected': 'The form was rejected', + 'records.completion-status-tooltip.published': 'The form has been published', 'records.last-modified': 'Last modified', 'records.open-tooltip': 'View and edit the record', 'records.delete-tooltip': 'Delete this record', From 46df9bb98985cf96ffb14fac032a2b9446e4e994 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Wed, 13 Dec 2023 13:34:05 +0100 Subject: [PATCH 07/13] [New #18] Added loading wheel for buttons --- js/components/record/Record.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 2711657e..4242cae8 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -119,17 +119,23 @@ class Record extends React.Component { } _renderRoleSpecificButtons() { + const {record, recordSaved, formgen} = this.props; + return <> {EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER && } {EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR && } ; } From 39eba0e63c27be568725d52ab3979734ae2e961b Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Wed, 13 Dec 2023 13:37:15 +0100 Subject: [PATCH 08/13] [Upd #18] Added validation for reject and complete buttons --- js/components/record/Record.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 4242cae8..d62a9afe 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -9,7 +9,7 @@ import HorizontalInput from "../HorizontalInput"; import RecordForm from "./RecordForm"; import RecordProvenance from "./RecordProvenance"; import RequiredAttributes from "./RequiredAttributes"; -import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, ROLE} from "../../constants/DefaultConstants"; +import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, RECORD_PHASE, ROLE} from "../../constants/DefaultConstants"; import AlertMessage from "../AlertMessage"; import {LoaderCard, LoaderSmall} from "../Loader"; import {processTypeaheadOptions} from "./TypeaheadAnswer"; @@ -125,7 +125,7 @@ class Record extends React.Component { {EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER && @@ -133,7 +133,7 @@ class Record extends React.Component { {EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR && } From d1dd48a5b40faff3b2553f08dda57f0d513c2a92 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Wed, 13 Dec 2023 15:25:17 +0100 Subject: [PATCH 09/13] [Upd #18] Changed label of record status --- js/i18n/cs.js | 2 +- js/i18n/en.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/i18n/cs.js b/js/i18n/cs.js index 1d6f0485..34c9cf4e 100644 --- a/js/i18n/cs.js +++ b/js/i18n/cs.js @@ -145,7 +145,7 @@ export default { 'records.id': 'Id', 'records.form-template': 'Šablona', 'records.local-name': 'Název', - 'records.completion-status': 'Stav vyplnění', + 'records.completion-status': 'Stav', 'records.completion-status-tooltip.complete': 'Všechny povinné informace ze záznamu byly vyplněny.', 'records.completion-status-tooltip.incomplete': 'Některé povinné informace ze záznamu ještě nebyly vyplněny.', 'records.completion-status-tooltip.rejected': 'Formulář byl odmítnut', diff --git a/js/i18n/en.js b/js/i18n/en.js index 217ec59a..226fe8fb 100644 --- a/js/i18n/en.js +++ b/js/i18n/en.js @@ -145,7 +145,7 @@ export default { 'records.id': 'Id', 'records.form-template': 'Template', 'records.local-name': 'Name', - 'records.completion-status': 'Completion status', + 'records.completion-status': 'Status', 'records.completion-status-tooltip.complete': 'All required fields of the record have been filled out.', 'records.completion-status-tooltip.incomplete': 'Some of the required fields of the record have not yet been filled out.', 'records.completion-status-tooltip.rejected': 'The form was rejected', From 39702f46081ecb6fbd213f5c171e650f3b04af66 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Wed, 13 Dec 2023 15:33:22 +0100 Subject: [PATCH 10/13] [Upd #18] Record status is now visible by regular user --- js/components/record/RecordRow.js | 9 ++++----- js/components/record/RecordTable.js | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/js/components/record/RecordRow.js b/js/components/record/RecordRow.js index 9c40e256..4fec6c6d 100644 --- a/js/components/record/RecordRow.js +++ b/js/components/record/RecordRow.js @@ -70,11 +70,10 @@ let RecordRow = (props) => { {formatDate(new Date(record.lastModified ? record.lastModified : record.dateCreated))} - { isAdmin && - - - - } + + + + diff --git a/js/components/record/RecordTable.js b/js/components/record/RecordTable.js index feee6bbd..f6cd4f3f 100644 --- a/js/components/record/RecordTable.js +++ b/js/components/record/RecordTable.js @@ -94,9 +94,7 @@ class RecordTable extends React.Component { && {this.i18n('records.form-template')} } {this.i18n('records.last-modified')} - {(this._isAdmin()) - && {this.i18n('records.completion-status')} - } + {this.i18n('records.completion-status')} {this.i18n('actions')} From a16f6647473c5ced1acb4b7043a041b30e1d96b7 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Wed, 13 Dec 2023 16:01:05 +0100 Subject: [PATCH 11/13] [Upd #18] Updated buttons hiding dependent on user role --- js/components/record/Record.js | 44 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/js/components/record/Record.js b/js/components/record/Record.js index d62a9afe..63856316 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -106,40 +106,38 @@ class Record extends React.Component { const {record, recordSaved, formgen} = this.props; return
- {this._renderRoleSpecificButtons()} + + + +
} - _renderRoleSpecificButtons() { - const {record, recordSaved, formgen} = this.props; - - return <> - {EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER && - - } - {EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR && - } - ; - } - _renderInstitution() { const record = this.props.record; if (!record.institution) { From 033e1fcc6e2b716b7340754b77c4ce89ac1bb837 Mon Sep 17 00:00:00 2001 From: Max Chopart Date: Thu, 14 Dec 2023 15:31:49 +0100 Subject: [PATCH 12/13] [Fix #18] Fix tests --- js/components/record/Record.js | 60 +++++++++++------------ tests/__tests__/components/Record.spec.js | 2 + 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 63856316..ee0ea389 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -57,25 +57,25 @@ class Record extends React.Component { } return
-
- - {this._showInstitution() && this._renderInstitution()} - - - {this._renderForm()} - {this._renderButtons()} - {showAlert && recordSaved.status === ACTION_STATUS.ERROR && +
+ + {this._showInstitution() && this._renderInstitution()} + + + {this._renderForm()} + {this._renderButtons()} + {showAlert && recordSaved.status === ACTION_STATUS.ERROR &&

} - {showAlert && recordSaved.status === ACTION_STATUS.SUCCESS && + {showAlert && recordSaved.status === ACTION_STATUS.SUCCESS &&

} -
; + ; } _renderHeader() { @@ -106,23 +106,23 @@ class Record extends React.Component { const {record, recordSaved, formgen} = this.props; return
- - - + {record.phase === RECORD_PHASE.COMPLETED + || EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR + && } + + {record.phase === RECORD_PHASE.COMPLETED + || record.phase === RECORD_PHASE.PUBLISHED + && }