statcat_filter: undefined
};
+ $scope.copyAlertUpdate = function (alerts) {
+ if (!$scope.in_item_select &&
+ $scope.workingGridControls &&
+ $scope.workingGridControls.selectedItems) {
+ itemSvc.get_copy_alert_types().then(function(ccat) {
+ var ccat_map = {};
+ $scope.alert_types = ccat;
+ angular.forEach(ccat, function(t) {
+ ccat_map[t.id()] = t;
+ });
+ angular.forEach(
+ $scope.workingGridControls.selectedItems(),
+ function (cp) {
+ $scope.dirty = true;
+ angular.forEach(alerts, function(alrt) {
+ var a = egCore.idl.fromHash('aca', alrt);
+ a.isnew(1);
+ a.create_staff(egCore.auth.user().id());
+ a.alert_type(ccat_map[a.alert_type()]);
+ a.ack_time(null);
+ a.copy(cp.id());
+ cp.copy_alerts().push( a );
+ });
+ cp.ischanged(1);
+ }
+ );
+ });
+ }
+ };
+
$scope.copyNoteUpdate = function (notes) {
if (!$scope.in_item_select &&
$scope.workingGridControls &&
$scope.working[k] = egCore.org.get(v);
} else if (k == 'copy_notes' && v.length) {
$scope.copyNoteUpdate(v);
+ } else if (k == 'copy_alerts' && v.length) {
+ $scope.copyAlertUpdate(v);
} else if (!angular.isObject(v)) {
$scope.working[k] = angular.copy(v);
} else {
$scope.working = {
copy_notes: [],
+ copy_alerts: [],
statcats: {},
statcat_filter: undefined
};
});
}
+ $scope.copy_alerts_dialog = function() {
+ var working = $scope.working;
+
+ return $uibModal.open({
+ templateUrl: './cat/volcopy/t_copy_alerts',
+ animation: true,
+ controller:
+ ['$scope','$uibModalInstance',
+ function($scope , $uibModalInstance) {
+
+ itemSvc.get_copy_alert_types().then(function(ccat) {
+ var ccat_map = {};
+ $scope.alert_types = ccat;
+ angular.forEach(ccat, function(t) {
+ ccat_map[t.id()] = t;
+ });
+ $scope.copy_alert_list = [];
+ angular.forEach(working.copy_alerts, function (alrt) {
+ var aca = egCore.idl.fromHash('aca', alrt);
+ aca.alert_type(ccat_map[alrt.alert_type]);
+ aca.ack_time(null);
+ $scope.copy_alert_list.push(aca);
+ });
+ });
+
+ $scope.focusNote = true;
+ $scope.copy_alert = {
+ note : '',
+ temp : false
+ };
+
+ $scope.ok = function(copy_alert) {
+
+ if (!working.copy_alerts) {
+ working.copy_alerts = [];
+ }
+ // clear slate
+ working.copy_alerts.length = 0;
+
+ angular.forEach($scope.copy_alert_list, function(alrt) {
+ if (alrt.ack_time() == null) {
+ working.copy_alerts.push({
+ note : alrt.note(),
+ temp : alrt.temp(),
+ alert_type : alrt.alert_type().id()
+ });
+ }
+ });
+
+ if (typeof(copy_alert.note) != 'undefined' &&
+ copy_alert.note != '') {
+ working.copy_alerts.push({
+ note : copy_alert.note,
+ temp : copy_alert.temp ? 't' : 'f',
+ alert_type : copy_alert.alert_type
+ });
+ }
+
+ $uibModalInstance.close();
+ }
+
+ $scope.cancel = function($event) {
+ $uibModalInstance.dismiss();
+ $event.preventDefault();
+ }
+ }]
+ });
+ }
+
$scope.status_list = [];
itemSvc.get_statuses().then(function(list){
$scope.status_list = list;