2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
24 class ConfirmBoxService {
25 constructor($q, $log, ngDialog) {
28 this.ngDialog = ngDialog;
31 showInformation(message) {
32 let deferred = this.$q.defer();
34 templateUrl: 'app/views/confirmation-box/information-box.tpl.html',
35 controller: 'ConfirmationBoxCtrl',
36 controllerAs: 'confirmBox',
37 className: 'confirm-box ngdialog-theme-default',
42 }).closePromise.then(confirmed => {
43 deferred.resolve(confirmed.value);
47 return deferred.promise;
51 let deferred = this.$q.defer();
53 templateUrl: 'app/views/confirmation-box/confirmation-box.tpl.html',
54 controller: 'ConfirmationBoxCtrl',
55 controllerAs: 'confirmBox',
56 className: 'confirm-box ngdialog-theme-default',
61 }).closePromise.then(confirmed => {
62 deferred.resolve(confirmed.value);
66 return deferred.promise;
70 showDynamicInformation(message, templatePath, controller) {
71 let deferred = this.$q.defer();
73 templateUrl: templatePath,
74 controller: controller,
75 controllerAs: 'confirmBox',
76 className: 'confirm-box ngdialog-theme-default',
81 }).closePromise.then(confirmed => {
82 deferred.resolve(confirmed.value);
86 return deferred.promise;
90 let deferred = this.$q.defer();
92 templateUrl: 'app/views/confirmation-box/confirmation-box.tpl.html',
93 controller: 'ConfirmationBoxCtrl',
94 controllerAs: 'confirmBox',
95 className: 'confirm-box ngdialog-theme-default',
99 title: 'Functional Menu - Delete'
101 }).closePromise.then(confirmed => {
102 deferred.resolve(confirmed.value);
104 deferred.reject(err);
106 return deferred.promise;
109 moveMenuItem(message) {
110 let deferred = this.$q.defer();
112 templateUrl: 'app/views/confirmation-box/dragdrop-confirmation-box.tpl.html',
113 controller: 'ConfirmationBoxCtrl',
114 controllerAs: 'confirmBox',
115 className: 'confirm-box ngdialog-theme-default',
119 title:'Functional Menu - Move'
121 }).closePromise.then(confirmed => {
122 deferred.resolve(confirmed.value);
124 deferred.reject(err);
126 return deferred.promise;
129 makeAdminChanges(message) {
130 let deferred = this.$q.defer();
132 templateUrl: 'app/views/confirmation-box/admin-confirmation-box.tpl.html',
133 controller: 'ConfirmationBoxCtrl',
134 controllerAs: 'confirmBox',
135 className: 'confirm-box ngdialog-theme-default',
139 title: 'Admin Update'
141 }).closePromise.then(confirmed => {
142 deferred.resolve(confirmed.value);
144 deferred.reject(err);
146 return deferred.promise;
151 ConfirmBoxService.$inject = ['$q', '$log', 'ngDialog'];
152 angular.module('ecompApp').service('confirmBoxService', ConfirmBoxService)