1 angular.module('egAdminConfig',
2 ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod','egFmRecordEditorMod'])
4 .controller('CopyTagType',
5 ['$scope','$q','$timeout','$location','$window','$uibModal','egCore','egGridDataProvider',
7 function($scope , $q , $timeout , $location , $window , $uibModal , egCore , egGridDataProvider ,
10 egCore.startup.go(); // standalone mode requires manual startup
12 $scope.new_record = function() {
16 $scope.edit_record = function(items) {
17 if (items.length != 1) return;
18 spawn_editor(items[0].code);
21 spawn_editor = function(code) {
23 if (arguments.length == 1) {
24 templ = '<eg-edit-fm-record idl-class="cctt" mode="update" record-id="code" on-save="ok" on-cancel="cancel"></eg-edit-fm-record>';
26 templ = '<eg-edit-fm-record idl-class="cctt" mode="create" on-save="ok" on-cancel="cancel"></eg-edit-fm-record>';
28 gridControls = $scope.gridControls;
32 '$scope', '$uibModalInstance',
33 function($scope , $uibModalInstance) {
36 $scope.ok = function($event) {
37 $uibModalInstance.close();
38 gridControls.refresh();
41 $scope.cancel = function($event) {
42 $uibModalInstance.dismiss();
49 $scope.delete_record = function(selected) {
50 if (!selected || !selected.length) return;
52 egCore.pcrud.retrieve('cctt', selected[0].code).then(function(rec) {
54 egCore.strings.EG_CONFIRM_DELETE_RECORD_TITLE,
55 egCore.strings.EG_CONFIRM_DELETE_RECORD_BODY,
57 ).result.then(function() {
58 egCore.pcrud.remove(rec).then(function() {
59 $scope.gridControls.refresh();
65 $scope.gridControls = {
66 setQuery : function() {
67 return { 'code' : { '!=' : null } };
69 setSort : function() {