/* barcode inputs are everywhere. Let's have a consistent style. */
.barcode { width: 16em !important; }
+/* use strike-through to mark something that has been acknowledged,
+ e.g., a copy alert */
+.acknowledged { text-decoration: line-through; }
+
/* bootstrap alerts are heavily padded. use this to reduce */
.alert-less-pad {padding: 5px;}
--- /dev/null
+<!--
+ Copy alert manager dialog
+-->
+<div>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title alert alert-info">[% l('Copy alerts') %]</h4>
+ </div>
+ <div class="modal-body">
+ <div>
+ <div class="row" ng-repeat="alert in alerts">
+ <div class="col-md-8" ng-class="{ acknowledged: isAcknowledged(alert) }">{{alert.note()}}</div>
+ <div class="col-md-4">
+ <button ng-if="canBeAcknowledged(alert)"
+ class="btn btn-xs btn-default"
+ ng-click="alert.acked = !alert.acked" >[% l('Acknowledge') %]</button>
+ </div>
+ </div>
+ <div>
+ </div>
+ <div class="modal-footer">
+ [% dialog_footer %]
+ <input type="submit" class="btn btn-primary"
+ ng-click="ok()" value="[% l('OK/Continue') %]"/>
+ <button class="btn btn-warning"
+ ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+</div>
angular.module('egCoreMod')
.factory('egCirc',
- ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog',
+ ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egCopyAlertManagerDialog',
'egWorkLog',
-function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog,
+function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egCopyAlertManagerDialog,
egWorkLog) {
var service = {
return service[action](params, options);
});
} else { // we got a list of copy alert objects ...
- // TODO: build a chain of alert ack (and maybe status selection) dialogs
+ return egCopyAlertManagerDialog.open({
+ alerts : evt.payload,
+ ok : function() {},
+ cancel : function() {}
+ }).result.then(function() {
+ options.override = true;
+ return service[action](params, options);
+ });
}
}
return service;
}])
+/**
+ * egCopyAlertManagerDialog - manage copy alerts
+ */
+.factory('egCopyAlertManagerDialog',
+ ['$modal','$interpolate','egCore',
+function($modal , $interpolate , egCore) {
+ var service = {};
+
+ service.open = function(args) {
+ return $modal.open({
+ templateUrl: './share/t_copy_alert_manager_dialog',
+ controller: ['$scope', '$modalInstance',
+ function($scope, $modalInstance) {
+ $scope.alerts = args.alerts;
+ $scope.mode = args.mode || 'checkin';
+
+ $scope.isAcknowledged = function(copy_alert) {
+ return (copy_alert.ack_time() || copy_alert.acked);
+ };
+ $scope.canBeAcknowledged = function(copy_alert) {
+ return (!copy_alert.ack_time() && copy_alert.temp());
+ };
+ $scope.ok = function() {
+ var acks = [];
+ angular.forEach($scope.alerts, function (copy_alert) {
+ if (copy_alert.acked) {
+ copy_alert.ack_time('now');
+ copy_alert.ack_staff(egCore.auth.user().id());
+ copy_alert.ischanged(true);
+ acks.push(copy_alert);
+ }
+ });
+ if (acks.length > 0) {
+ egCore.pcrud.apply(acks);
+ }
+ if (args.ok) args.ok();
+ $modalInstance.close()
+ }
+ $scope.cancel = function() {
+ if (args.cancel) args.cancel();
+ $modalInstance.dismiss();
+ }
+ }
+ ]
+ })
+ }
+
+ return service;
+}])
+
.directive('aDisabled', function() {
return {
restrict : 'A',