diff --git a/src/Settings/BankingAccountTypeSettings/BankingAccountTypeSettings.js b/src/Settings/BankingAccountTypeSettings/BankingAccountTypeSettings.js
index 25462f17..705e4ae5 100644
--- a/src/Settings/BankingAccountTypeSettings/BankingAccountTypeSettings.js
+++ b/src/Settings/BankingAccountTypeSettings/BankingAccountTypeSettings.js
@@ -1,69 +1,62 @@
-import React, { Component } from 'react';
import { FormattedMessage } from 'react-intl';
-import { stripesShape } from '@folio/stripes/core';
+import { stripesConnect, stripesShape } from '@folio/stripes/core';
import { ControlledVocab } from '@folio/stripes/smart-components';
import { getControlledVocabTranslations } from '@folio/stripes-acq-components';
-class BankingAccountTypeSettings extends Component {
- constructor(props) {
- super(props);
- this.connectedControlledVocab = props.stripes.connect(ControlledVocab);
- }
-
- render() {
- const { stripes } = this.props;
- const columnMapping = {
- value: ,
- action: ,
- };
-
- const hasEditPerms = stripes.hasPerm('ui-organizations.settings');
- const actionSuppressor = {
- edit: () => !hasEditPerms,
- delete: () => !hasEditPerms,
- };
-
- const ConnectedComponent = this.connectedControlledVocab;
-
- const setUniqValidation = (value, index, items) => {
- const errors = {};
-
- const isAccountTypeExist = items.some(({ id, name }) => {
- return name?.toLowerCase() === value?.name?.toLowerCase() && id !== value?.id;
- });
-
- if (isAccountTypeExist) {
- errors.name = ;
- }
-
- return errors;
- };
-
- return (
- }
- translations={getControlledVocabTranslations('ui-organizations.settings.accountTypes')}
- objectLabel="BankingAccountTypes"
- visibleFields={['name']}
- columnMapping={columnMapping}
- hiddenFields={['lastUpdated', 'numberOfObjects']}
- nameKey="bankingAccountTypes"
- id="bankingAccountTypes"
- validate={setUniqValidation}
- sortby="name"
- />
- );
- }
-}
+import { BANKING_ACCOUNT_TYPES_API } from '../constants';
+
+const BankingAccountTypeSettings = ({ stripes }) => {
+ const ConnectedComponent = stripes.connect(ControlledVocab);
+
+ const columnMapping = {
+ value: ,
+ action: ,
+ };
+
+ const hasEditPerms = stripes.hasPerm('ui-organizations.settings');
+ const actionSuppressor = {
+ edit: () => !hasEditPerms,
+ delete: () => !hasEditPerms,
+ };
+
+ const setUniqValidation = (value, index, items) => {
+ const errors = {};
+
+ const isBankingAccountTypeExist = items.some(({ id, name }) => {
+ return name?.toLowerCase() === value?.name?.toLowerCase() && id !== value?.id;
+ });
+
+ if (isBankingAccountTypeExist) {
+ errors.name = ;
+ }
+
+ return errors;
+ };
+
+ return (
+ }
+ translations={getControlledVocabTranslations('ui-organizations.settings.bankingAccountTypes')}
+ objectLabel="BankingAccountTypes"
+ visibleFields={['name']}
+ columnMapping={columnMapping}
+ hiddenFields={['lastUpdated', 'numberOfObjects']}
+ nameKey="bankingAccountTypes"
+ id="bankingAccountTypes"
+ validate={setUniqValidation}
+ sortby="name"
+ />
+ );
+};
BankingAccountTypeSettings.propTypes = {
stripes: stripesShape.isRequired,
};
-export default BankingAccountTypeSettings;
+export default stripesConnect(BankingAccountTypeSettings);
diff --git a/src/Settings/BankingInformationSettings/BankingInformationSettings.js b/src/Settings/BankingInformationSettings/BankingInformationSettings.js
index 47c23eab..fb29d547 100644
--- a/src/Settings/BankingInformationSettings/BankingInformationSettings.js
+++ b/src/Settings/BankingInformationSettings/BankingInformationSettings.js
@@ -1,25 +1,46 @@
import { FormattedMessage } from 'react-intl';
import { Field, Form } from 'react-final-form';
+import { useQueryClient } from 'react-query';
import {
Button,
Col,
Headline,
+ Loading,
Pane,
RadioButton,
RadioButtonGroup,
Row,
} from '@folio/stripes/components';
+import {
+ useOkapiKy,
+ useNamespace,
+} from '@folio/stripes/core';
+
+import { useBankingInformation } from '../hooks/useBankingInformation';
+import { SETTINGS_API } from '../constants';
const BankingInformationSettings = () => {
- const onSubmit = (values) => {
- console.log(values);
+ const { enabled, key, id: bankingInformationId, isLoading } = useBankingInformation();
+ const ky = useOkapiKy();
+ const queryClient = useQueryClient();
+ const [namespace] = useNamespace({ key: 'banking-information-settings' });
+
+ const onSubmit = ({ value }) => {
+ ky.put(`${SETTINGS_API}/${bankingInformationId}`, {
+ json: { value, key },
+ }).then(() => {
+ queryClient.invalidateQueries([namespace]);
+ });
};
+ if (isLoading) {
+ return ;
+ }
+
return (
}
>
@@ -32,11 +53,11 @@ const BankingInformationSettings = () => {