--- /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('Manage Copy Alerts') %]</h4>
+ </div>
+ <div class="modal-body">
+ <div class="row" ng-repeat="a in copy_alert_list" ng-init="temp = (a.temp() == 't'); note = a.note(); acked = (a.ack_time() !== null); alert_type = a.alert_type().id()">
+ <div class="col-md-12">
+ <div class="row">
+ <div class="col-md-6 form-inline">
+ <label for="copy-alert-type-select-{{a.id()}}">[% l('Type') %]</label>
+ <select id="copy-alert-type-select-{{a.id()}}" class="form-control"
+ ng-model="alert_type"
+ ng-change="a.alert_type(alert_type) && a.ischanged(1)"
+ 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="temp" ng-change="a.temp(temp ? 't' : 'f') && a.ischanged(1)" ng-disabled="acked"/>
+ [% l('Temporary') %]
+ </label>
+ </div>
+ <div class="col-md-3">
+ <label>
+ <input type="checkbox" ng-model="acked" ng-change="(acked ? a.ack_time('now') : a.ack_time(null)) && a.ischanged(1)"/>
+ [% l('Clear?') %]
+ </label>
+ </div>
+ </div>
+ <div class="row pad-vert">
+ <div class="col-md-12">
+ <textarea class="form-control" ng-change="a.note(note) && a.ischanged(1)"
+ ng-model="note" placeholder="[% l('Alert...') %]" ng-disabled="acked">
+ </textarea>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <hr/>
+ </div>
+ </div>
+ </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>
.factory('egCirc',
- ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egAddCopyAlertDialog','egCopyAlertManagerDialog',
+ ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egAddCopyAlertDialog','egCopyAlertManagerDialog','egCopyAlertEditorDialog',
'egWorkLog',
-function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAlertDialog , egCopyAlertManagerDialog,
+function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAlertDialog , egCopyAlertManagerDialog, egCopyAlertEditorDialog ,
egWorkLog) {
var service = {
}
service.manage_copy_alerts = function(item_ids) {
- return egCopyAlertManagerDialog.open({
+ return egCopyAlertEditorDialog.open({
copy_id : item_ids[0],
- mode : 'manage',
ok : function() { },
cancel : function() {}
}).result.then(function() { });
return service;
}])
+/**
+ * egCopyAlertEditorDialog - manage copy alerts
+ */
+.factory('egCopyAlertEditorDialog',
+ ['$uibModal','$interpolate','egCore',
+function($uibModal , $interpolate , egCore) {
+ var service = {};
+
+ service.get_user_copy_alerts = function(copy_id) {
+ return egCore.pcrud.search('aca', { copy : copy_id, ack_time : null },
+ { flesh : 1, flesh_fields : { aca : ['alert_type'] } },
+ { atomic : true }
+ );
+ }
+
+ service.get_copy_alert_types = function() {
+ return egCore.pcrud.search('ccat',
+ { active : 't' },
+ {},
+ { atomic : true }
+ );
+ };
+
+ service.open = function(args) {
+ return $uibModal.open({
+ templateUrl: './share/t_copy_alert_editor_dialog',
+ controller: ['$scope','$q','$uibModalInstance',
+ function( $scope , $q , $uibModalInstance) {
+
+ function init(args) {
+ var defer = $q.defer();
+ if (args.copy_id) {
+ service.get_user_copy_alerts(args.copy_id).then(function(aca) {
+ defer.resolve(aca);
+ });
+ } else {
+ defer.resolve(args.alerts);
+ }
+ return defer.promise;
+ }
+
+ init(args).then(function(copy_alerts) {
+ $scope.copy_alert_list = copy_alerts;
+ });
+ service.get_copy_alert_types().then(function(ccat) {
+ $scope.alert_types = ccat;
+ });
+
+ $scope.ok = function() {
+ egCore.pcrud.apply($scope.copy_alert_list);
+ $uibModalInstance.close()
+ }
+ $scope.cancel = function() {
+ if (args.cancel) args.cancel();
+ $uibModalInstance.dismiss();
+ }
+ }
+ ]
+ })
+ }
+
+ return service;
+}])
.directive('aDisabled', function() {
return {
restrict : 'A',