diff --git a/modules/survey_accounts/jsx/surveyAccountsIndex.js b/modules/survey_accounts/jsx/surveyAccountsIndex.js index 45606a23dfe..e6ecb6340ac 100644 --- a/modules/survey_accounts/jsx/surveyAccountsIndex.js +++ b/modules/survey_accounts/jsx/surveyAccountsIndex.js @@ -1,5 +1,5 @@ -import { createRoot } from 'react-dom/client'; -import React, { Component } from 'react'; +import {createRoot} from 'react-dom/client'; +import React, {Component} from 'react'; import PropTypes from 'prop-types'; import swal from 'sweetalert2'; import Loader from 'Loader'; @@ -31,7 +31,7 @@ class SurveyAccountsIndex extends Component { */ componentDidMount() { this.fetchData() - .then(() => this.setState({ isLoaded: true })); + .then(() => this.setState({isLoaded: true})); } /** @@ -42,11 +42,11 @@ class SurveyAccountsIndex extends Component { * @return {object} */ fetchData() { - return fetch(this.props.dataURL, { credentials: 'same-origin' }) + return fetch(this.props.dataURL, {credentials: 'same-origin'}) .then((resp) => resp.json()) - .then((data) => this.setState({ data })) + .then((data) => this.setState({data})) .catch((error) => { - this.setState({ error: true }); + this.setState({error: true}); console.error(error); }); } @@ -62,38 +62,38 @@ class SurveyAccountsIndex extends Component { formatColumn(column, cell, row) { let result = {cell}; switch (column) { - case 'URL': { - const url = loris.BaseURL + '/survey.php?key=' + row.URL; - result = {cell}; - break; - } - case 'Instrument': { - const instruments = this.state.data.fieldOptions.instruments; - result = {instruments[cell]}; - break; + case 'URL': { + const url = loris.BaseURL + '/survey.php?key=' + row.URL; + result = {cell}; + break; + } + case 'Instrument': { + const instruments = this.state.data.fieldOptions.instruments; + result = {instruments[cell]}; + break; + } + case 'Edit': { + if (!loris.userHasPermission('user_account')) { + return; } - case 'Edit': { - if (!loris.userHasPermission('user_account')) { - return; - } - result = ( - - - + - - ); - break; - } + + + ); + break; + } } return result; } @@ -188,11 +188,11 @@ class SurveyAccountsIndex extends Component { */ const options = this.state.data.fieldOptions; const fields = [ - { label: 'PSCID', show: true, filter: { name: 'pscid', type: 'text' } }, + {label: 'PSCID', show: true, filter: {name: 'pscid', type: 'text'}}, { label: 'Visit', show: true, - filter: { name: 'visit', type: 'select', options: options.visits }, + filter: {name: 'visit', type: 'select', options: options.visits}, }, { label: 'Instrument', @@ -203,7 +203,7 @@ class SurveyAccountsIndex extends Component { options: options.instruments, }, }, - { label: 'URL', show: true }, + {label: 'URL', show: true}, { label: 'Status', show: true, @@ -213,16 +213,16 @@ class SurveyAccountsIndex extends Component { options: options.statusOptions, }, }, - { label: 'Edit', show: true }, - { label: 'centerID', show: false }, - { label: 'projectID', show: false }, + {label: 'Edit', show: true}, + {label: 'centerID', show: false}, + {label: 'projectID', show: false}, ]; const addSurvey = () => { location.href = '/survey_accounts/addSurvey/'; }; const actions = [ - { label: 'Add Survey', action: addSurvey }, + {label: 'Add Survey', action: addSurvey}, ]; return (