Skip to content

Commit

Permalink
feat: Number generator
Browse files Browse the repository at this point in the history
Swapped implementation to full Modal implementation as per the other apps
  • Loading branch information
EthanFreestone committed Sep 8, 2023
1 parent 3305486 commit 5366269
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';

import { stripesConnect, useStripes } from '@folio/stripes/core';
import { Col, Row, TextField } from '@folio/stripes/components';
import { NumberGeneratorButton } from '@folio/service-interaction';
import { NumberGeneratorModalButton } from '@folio/service-interaction';

import { fetchOrgsByParam } from '../../../../common/resources';
import { validateOrgCode } from './validateOrgCode';
Expand Down Expand Up @@ -48,11 +48,16 @@ const FieldCode = ({ orgId, mutator }) => {
vendorCodeSetting === 'useBoth'
) &&
<Col xs={12}>
<NumberGeneratorButton
<NumberGeneratorModalButton
buttonLabel={<FormattedMessage id="ui-organizations.numberGenerator.generateVendorCode" />}
callback={(generated) => change('code', generated)}
fullWidth
id="vendor-code-generator"
generateButtonLabel={<FormattedMessage id="ui-organizations.numberGenerator.generateVendorCode" />}
generator="organizations_vendorCode"
sequence="vendor"
modalProps={{
label: <FormattedMessage id="ui-organizations.numberGenerator.vendorCodeGenerator" />

Check failure on line 59 in src/Organizations/OrganizationForm/OrganizationSummaryForm/FieldCode/FieldCode.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing trailing comma

Check failure on line 59 in src/Organizations/OrganizationForm/OrganizationSummaryForm/FieldCode/FieldCode.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing trailing comma
}}
/>
</Col>
}
Expand Down
16 changes: 8 additions & 8 deletions src/Settings/NumberGeneratorOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ const NumberGeneratorOptions = (props) => {
>
<Row>
<Col xs={12}>
<Field
component={RadioButton}
id="useGenerator"
name="vendorGeneratorSetting"
label={<FormattedMessage id="ui-organizations.settings.numberGeneratorOptions.useGeneratorForVendor" />}
type="radio"
value="useGenerator"
/>
<Field
component={RadioButton}
id="useTextField"
Expand All @@ -73,6 +65,14 @@ const NumberGeneratorOptions = (props) => {
type="radio"
value="useBoth"
/>
<Field
component={RadioButton}
id="useGenerator"
name="vendorGeneratorSetting"
label={<FormattedMessage id="ui-organizations.settings.numberGeneratorOptions.useGeneratorForVendor" />}
type="radio"
value="useGenerator"
/>
</Col>
</Row>
</ConnectedConfigManager>
Expand Down
2 changes: 2 additions & 0 deletions translations/ui-organizations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@
"settings.numberGeneratorOptions.useGeneratorForVendor": "Number generator on, fixed: the vendor code can be filled using the generator only.",
"settings.numberGeneratorOptions.useTextFieldForVendor": "Number generator off: the vendor code can be filled manually only.",
"settings.numberGeneratorOptions.useBothForVendor": "Number generator on, editable: the vendor code can be filled using the generator and be edited, or filled manually.",
"numberGenerator.vendorCodeGenerator": "Vendor code generator",
"numberGenerator.generateVendorCode": "Generate vendor code",
"permission.view": "Organizations: View",
"permission.edit": "Organizations: View, edit",
"permission.create": "Organizations: View, edit, create",
Expand Down

0 comments on commit 5366269

Please sign in to comment.