-
Notifications
You must be signed in to change notification settings - Fork 19
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
self-checkout: make barcode always uppercase #646
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ export class ManualCheckout extends React.Component { | |
super(props); | ||
|
||
this.state = { | ||
manualBarcode: null, | ||
manualBarcode: '', | ||
}; | ||
this.inputRef = React.createRef(); | ||
} | ||
|
@@ -22,25 +22,29 @@ export class ManualCheckout extends React.Component { | |
} | ||
|
||
render() { | ||
const { show, onChange, label } = this.props; | ||
const { show, onBarcodeInput, label } = this.props; | ||
const { manualBarcode } = this.state; | ||
if (show) { | ||
return ( | ||
<Container className="pt-1 center"> | ||
<Message compact> | ||
<Header className="pb-1" as="h5"> | ||
{label} Add the barcode manually: | ||
{label} Insert the barcode manually: | ||
</Header> | ||
<Input | ||
id="barcodeInput" | ||
type="text" | ||
placeholder="Barcode..." | ||
className="pb-1" | ||
ref={this.inputRef} | ||
onChange={(e) => this.setState({ manualBarcode: e.target.value })} | ||
value={manualBarcode} | ||
onChange={(e) => | ||
this.setState({ manualBarcode: e.target.value?.toUpperCase() }) | ||
} | ||
/> | ||
<Button | ||
onClick={() => onChange(manualBarcode)} | ||
onClick={() => manualBarcode && onBarcodeInput(manualBarcode)} | ||
disabled={!manualBarcode} | ||
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. Disable the btn if no barcode inserted |
||
className="ml-10" | ||
type="submit" | ||
> | ||
|
@@ -57,13 +61,13 @@ export class ManualCheckout extends React.Component { | |
|
||
ManualCheckout.propTypes = { | ||
show: PropTypes.bool, | ||
onChange: PropTypes.func.isRequired, | ||
onBarcodeInput: PropTypes.func.isRequired, | ||
label: PropTypes.string, | ||
autofocus: PropTypes.bool, | ||
}; | ||
|
||
ManualCheckout.defaultProps = { | ||
show: false, | ||
label: 'Can’t scan the barcode?', | ||
label: "Can't scan the barcode?", | ||
autofocus: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,10 @@ export const notifyResultMessage = (message) => { | |
}; | ||
|
||
const searchItem = async (dispatch, term) => { | ||
const response = await itemApi.list(itemApi.query().withBarcode(term).qs()); | ||
const upperCasedTerm = term.toUpperCase(); | ||
const response = await itemApi.list( | ||
itemApi.query().withBarcode(upperCasedTerm).qs() | ||
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. should not be needed, but just in case.... |
||
); | ||
const item = _first(response.data.hits) || null; | ||
|
||
dispatch({ | ||
|
@@ -59,10 +62,9 @@ export const checkoutItem = (documentPid, itemPid, patronPid) => { | |
const { pid } = response.data.metadata; | ||
const linkToLoan = ( | ||
<p> | ||
The loan {pid} has been created by you!{' '} | ||
<Link to={FrontSiteRoutes.patronProfile}> | ||
You can now view the loan details. | ||
</Link> | ||
The loan {pid} has been created by you! You can view all your current | ||
loans on your <Link to={FrontSiteRoutes.patronProfile}>profile</Link>{' '} | ||
page. | ||
</p> | ||
); | ||
dispatch(sendSuccessNotification('Success!', linkToLoan)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Automatic uppercase on typing