Skip to content
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

(design) Scan Barcode Component #1529

Closed
jniles opened this issue Apr 20, 2017 · 1 comment
Closed

(design) Scan Barcode Component #1529

jniles opened this issue Apr 20, 2017 · 1 comment
Assignees

Comments

@jniles
Copy link
Collaborator

jniles commented Apr 20, 2017

Our current barcode scanning sits in a couple of controllers .. yet this is an ideal place for component. Furthermore, the current design is limited because you cannot re-focus the hidden input once it has be blurred.

Design Proposal
I propose we design component bhScanBarcode with the following signature:

<bh-scan-barcode on-scan-callback="ParentCtrl.callback(entity)">
</bh-scan-barcode>

The bhScanBarcode component itself would have the logic for re-focusing the input if it got blurred. In pseudocode, this would look like:

var $input = $('[hidden-barcode-input]');
var $button = $('[input-focus-button]');
$input.on('blur', function () {
  $button.show();
});

$button.on('click', function () {
  $input.focus();
});

When a barcode was successfully scanned, it would need to look up the correct value for the barcode using the /barcode route, and then call the on-scan-callback() with the entity as a parameter. The parent controller would then be responsible for doing any other processing.

In this way, the barcode component would be testable and much easier to work with.

@jniles jniles added the design label Apr 20, 2017
@jniles jniles self-assigned this Mar 27, 2018
jniles added a commit to jniles/bhima that referenced this issue Mar 28, 2018
This commit implements a barcode component to make working with barcodes
a bit easier.  It replaces the cash barcode modal's custom logic with
generic logic to be tested.

Key features:
 1. If the input loses focus, the user is notified and a button appears
 to re-establish focus on the hidden input.
 2. Simple API - only a single callback is provided for the success
 case.
 3. Record agnostic.

Closes IMA-WorldHealth#1529.
jniles added a commit to jniles/bhima that referenced this issue Mar 28, 2018
This commit implements a barcode component to make working with barcodes
a bit easier.  It replaces the cash barcode modal's custom logic with
generic logic to be tested.

Key features:
 1. If the input loses focus, the user is notified and a button appears
 to re-establish focus on the hidden input.
 2. Simple API - only a single callback is provided for the success
 case.
 3. Record agnostic.

Closes IMA-WorldHealth#1529.
jniles added a commit to jniles/bhima that referenced this issue Mar 29, 2018
This commit implements a barcode component to make working with barcodes
a bit easier.  It replaces the cash barcode modal's custom logic with
generic logic to be tested.

Key features:
 1. If the input loses focus, the user is notified and a button appears
 to re-establish focus on the hidden input.
 2. Simple API - only a single callback is provided for the success
 case.
 3. Record agnostic.

Closes IMA-WorldHealth#1529.
@jniles
Copy link
Collaborator Author

jniles commented Apr 6, 2018

Closed in #2630

@jniles jniles closed this as completed Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant