<div class="flex-row">
<div class="flex-cell">[% l('Copy Alerts') %]</div>
<div id="item-status-alert-msg">
+ <button class="btn btn-default" ng-click="addCopyAlerts(copy.id())" >[% l('Add') %]</button>
<button class="btn btn-default" ng-click="manageCopyAlerts(copy.id())" >[% l('Manage') %]</button>
</div>
</div>
label="[% l('Abort Transits') %]">
</eg-grid-action>
<eg-grid-action
+ handler="addCopyAlerts"
+ label="[% l('Add Copy Alerts') %]">
+ </eg-grid-action>
+ <eg-grid-action
handler="manageCopyAlerts"
label="[% l('Acknowledge Alerts') %]">
</eg-grid-action>
persist-key="circ.patron.checkout">
<eg-grid-action
+ handler="addCopyAlerts"
+ label="[% l('Add Copy Alerts') %]">
+ </eg-grid-action>
+ <eg-grid-action
handler="manageCopyAlerts"
label="[% l('Acknowledge Alerts') %]">
</eg-grid-action>
label="[% l('Abort Transits') %]">
</eg-grid-action>
<eg-grid-action divider="true"></eg-grid-action>
- <eg-grid-action wq
+ <eg-grid-action
+ handler="addCopyAlerts"
+ label="[% l('Add Copy Alerts') %]">
+ </eg-grid-action>
+ <eg-grid-action
handler="manageCopyAlerts"
label="[% l('Acknowledge Alerts') %]">
</eg-grid-action>
--- /dev/null
+<form ng-submit="ok(copy_alert)" role="form">
+ <div class="modal-header">
+ <button type="button" class="close" ng-click="cancel()"
+ aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Add Copy Alert') %]</h4>
+ </div>
+ <div class="modal-body">
+ <div class="row">
+ <div class="col-md-6 form-inline">
+ <label for="copy-alert-type-selector"> [% l('Type') %]</label>
+ <select id="copy-alert-type-selector" class="form-control"
+ ng-model="copy_alert.alert_type"
+ ng-options="at.id() as at.name() for at in alert_types">
+ </select>
+ </div>
+ <div class="col-md-3">
+ <label>
+ <input type="checkbox" ng-model="copy_alert.temp"/>
+ [% l('Temporary') %]
+ </label>
+ </div>
+ </div>
+ <div class="row pad-vert">
+ <div class="col-md-12">
+ <textarea class="form-control"
+ ng-model="copy_alert.note" placeholder="[% l('Alert...') %]">
+ </textarea>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <div class="row">
+ <div class="col-md-10 pull-right">
+ <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
+ <button class="btn btn-warning" ng-click="cancel($event)">[% l('Cancel') %]</button>
+ </div>
+ </div>
+
+ </div>
+</form>
return;
}
+ $scope.addCopyAlerts = function(copy_id) {
+ egCirc.add_copy_alerts([copy_id]).then(function() {
+ // update grid items?
+ });
+ }
$scope.manageCopyAlerts = function(copy_id) {
egCirc.manage_copy_alerts([copy_id]).then(function() {
// update grid items?
});
}
+ $scope.addCopyAlerts = function(items) {
+ var copy_ids = [];
+ angular.forEach(items, function(item) {
+ if (item.acp) copy_ids.push(item.acp.id());
+ });
+ egCirc.add_copy_alerts(copy_ids).then(function() {
+ // update grid items?
+ });
+ }
+
$scope.manageCopyAlerts = function(items) {
var copy_ids = [];
angular.forEach(items, function(item) {
}
}
+ $scope.addCopyAlerts = function(items) {
+ var copy_ids = [];
+ angular.forEach(items, function(item) {
+ if (item.acp) copy_ids.push(item.acp.id());
+ });
+ egCirc.add_copy_alerts(copy_ids).then(function() {
+ // update grid items?
+ });
+ }
+
$scope.manageCopyAlerts = function(items) {
var copy_ids = [];
angular.forEach(items, function(item) {
});
}
+ $scope.addCopyAlerts = function(items) {
+ var copy_ids = [];
+ angular.forEach(items, function(item) {
+ if (item.acp) copy_ids.push(item.acp.id());
+ });
+ egCirc.add_copy_alerts(copy_ids).then(function() {
+ // update grid items?
+ });
+ }
+
$scope.manageCopyAlerts = function(items) {
var copy_ids = [];
angular.forEach(items, function(item) {
angular.module('egCoreMod')
.factory('egCirc',
- ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egCopyAlertManagerDialog',
+ ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egAddCopyAlertDialog','egCopyAlertManagerDialog',
'egWorkLog',
-function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egCopyAlertManagerDialog,
+function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAlertDialog , egCopyAlertManagerDialog,
egWorkLog) {
var service = {
});
}
+ service.add_copy_alerts = function(item_ids) {
+ return egAddCopyAlertDialog.open({
+ copy_ids : item_ids,
+ ok : function() { },
+ cancel : function() {}
+ }).result.then(function() { });
+ }
+
service.manage_copy_alerts = function(item_ids) {
return egCopyAlertManagerDialog.open({
copy_id : item_ids[0],
}])
/**
+ * egAddCopyAlertDialog - manage copy alerts
+ */
+.factory('egAddCopyAlertDialog',
+ ['$modal','$interpolate','egCore',
+function($modal , $interpolate , egCore) {
+ var service = {};
+
+ service.open = function(args) {
+ return $modal.open({
+ templateUrl: './share/t_add_copy_alert_dialog',
+ controller: ['$scope','$q','$modalInstance',
+ function( $scope , $q , $modalInstance) {
+
+ $scope.copy_ids = args.copy_ids;
+ egCore.pcrud.search('ccat',
+ { active : 't' },
+ {},
+ { atomic : true }
+ ).then(function (ccat) {
+ $scope.alert_types = ccat;
+ });
+
+ $scope.copy_alert = {
+ create_staff : egCore.auth.user().id(),
+ note : '',
+ temp : false
+ };
+
+ $scope.ok = function(copy_alert) {
+ if (typeof(copy_alert.note) != 'undefined' &&
+ copy_alert.note != '') {
+ copy_alerts = [];
+ angular.forEach($scope.copy_ids, function (cp_id) {
+ var a = new egCore.idl.aca();
+ a.isnew(1);
+ a.create_staff(copy_alert.create_staff);
+ a.note(copy_alert.note);
+ a.temp(copy_alert.temp ? 't' : 'f');
+ a.copy(cp_id);
+ a.ack_time(null);
+ a.alert_type(
+ $scope.alert_types.filter(function(at) {
+ return at.id() == copy_alert.alert_type;
+ })[0]
+ );
+ copy_alerts.push( a );
+ });
+ if (copy_alerts.length > 0) {
+ egCore.pcrud.apply(copy_alerts);
+ }
+ }
+ if (args.ok) args.ok();
+ $modalInstance.close()
+ }
+ $scope.cancel = function() {
+ if (args.cancel) args.cancel();
+ $modalInstance.dismiss();
+ }
+ }
+ ]
+ })
+ }
+
+ return service;
+}])
+
+/**
* egCopyAlertManagerDialog - manage copy alerts
*/
.factory('egCopyAlertManagerDialog',