<form ng-submit="search()">
<div class="input-group">
<span class="input-group-addon">[% l('Scan Item') %]</span>
- <input type="text" class="form-control" focus-me="focusMe"
+ <input type="text" class="form-control" select-me="context.selectPendingBC"
ng-model="bucketSvc.barcodeString" placeholder="[% l('Barcode...') %]">
</div>
</form>
</div>
</div>
+<div class="row pad-vert" ng-if="context.itemNotFound">
+ <div class="col-md-6">
+ <div class="alert alert-danger">
+ [% l('Item Not Found') %]
+ </div>
+ </div>
+</div>
+
<br/>
<eg-grid
function($scope, $routeParams, bucketSvc , egGridDataProvider, egCore) {
$scope.setTab('pending');
+ $scope.context = {
+ copyNotFound : false,
+ selectPendingBC : true
+ };
+
var query;
$scope.gridControls = {
setQuery : function(q) {
return {id : bucketSvc.pendingList};
else
return null;
+ },
+ allItemsRetrieved : function() {
+ $scope.context.selectPendingBC = true;
}
}
$scope.search = function() {
bucketSvc.barcodeRecords = [];
+ $scope.context.itemNotFound = false;
+
+ // clear selection so re-selecting can have an effect
+ $scope.context.selectPendingBC = false;
egCore.pcrud.search(
'acp',
{barcode : bucketSvc.barcodeString, deleted : 'f'},
{}
- ).then(null, null, function(copy) {
- bucketSvc.pendingList.push(copy.id());
- $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+ ).then(function(copy) {
+ if (copy) {
+ bucketSvc.pendingList.push(copy.id());
+ $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+ bucketSvc.barcodeString = ''; // clear form on valid copy
+ } else {
+ $scope.context.itemNotFound = true;
+ $scope.context.selectPendingBC = true;
+ }
});
}