-
Notifications
You must be signed in to change notification settings - Fork 18
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
UIIN-2546/UIIN-2548/UIIN-2549/UIIN-2556/UIIN-2557 Number generator implementation #2408
base: master
Are you sure you want to change the base?
Changes from all commits
206be77
e939a79
575f064
f7e643a
5f33597
23f0456
8e76340
e9024df
e5cebd6
685ebae
e1a9baa
9e202b8
391442e
657d272
3592bab
beec654
65fbd3e
d2728a4
0bf7177
2702209
00644eb
2f1cab6
a1320ae
1eb29eb
8381957
29c9b5c
ea9eccf
b0a16b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import { | |
import { LoadingView } from '@folio/stripes/components'; | ||
|
||
import { useInstance } from '../../common/hooks'; | ||
import { useCallout } from '../../hooks'; | ||
import { useCallout, useConfigurationQuery } from '../../hooks'; | ||
import HoldingsForm from '../../edit/holdings/HoldingsForm'; | ||
import { switchAffiliation } from '../../utils'; | ||
|
||
|
@@ -26,6 +26,8 @@ const CreateHolding = ({ | |
mutator, | ||
}) => { | ||
const callout = useCallout(); | ||
const { configs } = useConfigurationQuery('number_generator'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move |
||
|
||
const { instance, isLoading: isInstanceLoading } = useInstance(instanceId); | ||
const sourceId = referenceData.holdingsSourcesByName?.FOLIO?.id; | ||
const tenantFrom = location?.state?.tenantFrom || stripes.okapi.tenant; | ||
|
@@ -65,6 +67,7 @@ const CreateHolding = ({ | |
|
||
return ( | ||
<HoldingsForm | ||
configs={configs} | ||
form={instance.id} | ||
id={instance.id} | ||
initialValues={initialValues} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ import { ViewMetaData } from '@folio/stripes/smart-components'; | |
|
||
import stripesFinalForm from '@folio/stripes/final-form'; | ||
|
||
import { NumberGeneratorModalButton } from '@folio/service-interaction'; | ||
|
||
import OptimisticLockingBanner from '../../components/OptimisticLockingBanner'; | ||
import ElectronicAccessFields from '../electronicAccessFields'; | ||
import { handleKeyCommand, validateOptionalField } from '../../utils'; | ||
|
@@ -115,6 +117,9 @@ class HoldingsForm extends React.Component { | |
}), | ||
goTo: PropTypes.func.isRequired, | ||
httpError: PropTypes.object, | ||
configs: PropTypes.shape({ | ||
callNumberGeneratorSettingHoldings: PropTypes.string | ||
}) | ||
}; | ||
|
||
static defaultProps = { | ||
|
@@ -189,6 +194,8 @@ class HoldingsForm extends React.Component { | |
|
||
render() { | ||
const { | ||
configs, | ||
form: { change }, | ||
onCancel, | ||
initialValues, | ||
instance, | ||
|
@@ -225,6 +232,10 @@ class HoldingsForm extends React.Component { | |
}), | ||
) : []; | ||
|
||
const { | ||
callNumberGeneratorSettingHoldings, | ||
} = configs; | ||
|
||
const holdingsTypeOptions = referenceTables.holdingsTypes ? referenceTables.holdingsTypes.map( | ||
it => ({ | ||
label: it.name, | ||
|
@@ -538,15 +549,36 @@ class HoldingsForm extends React.Component { | |
/> | ||
</Col> | ||
<Col sm={2}> | ||
<Field | ||
label={<FormattedMessage id="ui-inventory.callNumber" />} | ||
name="callNumber" | ||
id="additem_callnumber" | ||
component={TextArea} | ||
rows={1} | ||
fullWidth | ||
disabled={this.isFieldBlocked('callNumber')} | ||
/> | ||
<Row> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So currently |
||
<Field | ||
label={<FormattedMessage id="ui-inventory.callNumber" />} | ||
name="callNumber" | ||
id="additem_callnumber" | ||
component={TextArea} | ||
rows={1} | ||
fullWidth | ||
disabled={this.isFieldBlocked('callNumber') || callNumberGeneratorSettingHoldings === 'useGenerator'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move |
||
/> | ||
</Row> | ||
<Row> | ||
{( | ||
callNumberGeneratorSettingHoldings === 'useGenerator' || | ||
callNumberGeneratorSettingHoldings === 'useBoth' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And |
||
) && | ||
<Col xs={12}> | ||
<NumberGeneratorModalButton | ||
buttonLabel={<FormattedMessage id="ui-inventory.numberGenerator.generateCallNumber" />} | ||
callback={(generated) => change('callNumber', generated)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this to a separate func |
||
id="inventoryCallNumber" | ||
generateButtonLabel={<FormattedMessage id="ui-inventory.numberGenerator.generateCallNumber" />} | ||
generator="inventory_callNumber" | ||
modalProps={{ | ||
label: <FormattedMessage id="ui-inventory.numberGenerator.callNumberGenerator" /> | ||
}} | ||
/> | ||
</Col> | ||
} | ||
</Row> | ||
</Col> | ||
<Col sm={2}> | ||
<Field | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,8 @@ import { LocationSelectionWithCheck } from '../common'; | |
import AdministrativeNoteFields from '../administrativeNoteFields'; | ||
import styles from './ItemForm.css'; | ||
import { RemoteStorageWarning } from './RemoteStorageWarning'; | ||
import getNumberGeneratorModals from './getNumberGeneratorModals'; | ||
|
||
import { | ||
BoundWithTitlesFields, | ||
CirculationNotesFields, | ||
|
@@ -197,6 +199,8 @@ class ItemForm extends React.Component { | |
|
||
render() { | ||
const { | ||
configs, | ||
form: { change }, | ||
onCancel, | ||
initialValues, | ||
instance, | ||
|
@@ -312,6 +316,15 @@ class ItemForm extends React.Component { | |
}, | ||
]; | ||
|
||
const { | ||
disableAccessionNumberField, | ||
disableBarcodeField, | ||
disableCallNumberField, | ||
renderAccessionNumberGenerator, | ||
renderBarcodeGenerator, | ||
renderCallNumberGenerator | ||
} = getNumberGeneratorModals(configs, change); | ||
|
||
return ( | ||
<form | ||
data-test-item-page-type={initialValues.id ? 'edit' : 'create'} | ||
|
@@ -437,6 +450,7 @@ class ItemForm extends React.Component { | |
</Col> | ||
<Col sm={2}> | ||
<Field | ||
disabled={disableBarcodeField} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
label={<FormattedMessage id="ui-inventory.barcode" />} | ||
name="barcode" | ||
id="additem_barcode" | ||
|
@@ -445,15 +459,18 @@ class ItemForm extends React.Component { | |
autoFocus | ||
fullWidth | ||
/> | ||
{renderBarcodeGenerator()} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose one way to render the |
||
</Col> | ||
<Col sm={2}> | ||
<Field | ||
disabled={disableAccessionNumberField} | ||
label={<FormattedMessage id="ui-inventory.accessionNumber" />} | ||
name="accessionNumber" | ||
id="additem_accessionnumber" | ||
component={TextField} | ||
fullWidth | ||
/> | ||
{renderAccessionNumberGenerator()} | ||
</Col> | ||
<Col sm={2}> | ||
<Field | ||
|
@@ -547,13 +564,15 @@ class ItemForm extends React.Component { | |
</Col> | ||
<Col sm={2}> | ||
<Field | ||
disabled={disableCallNumberField} | ||
label={<FormattedMessage id="ui-inventory.callNumber" />} | ||
name="itemLevelCallNumber" | ||
id="additem_callnumber" | ||
component={TextArea} | ||
rows={1} | ||
fullWidth | ||
/> | ||
{renderCallNumberGenerator()} | ||
</Col> | ||
<Col sm={2}> | ||
<Field | ||
|
@@ -852,6 +871,7 @@ class ItemForm extends React.Component { | |
} | ||
|
||
ItemForm.propTypes = { | ||
configs: PropTypes.object, | ||
onClose: PropTypes.func, // eslint-disable-line react/no-unused-prop-types | ||
newItem: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types | ||
handleSubmit: PropTypes.func.isRequired, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the new permission to translations as well