2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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 * ============LICENSE_END=========================================================
20 angular.module("modalServices",[]).service('modalService', ['$modal', function ($modal) {
23 this.showSuccess = function(heading, messageBody){
24 var modalInstance = $modal.open({
25 templateUrl: 'modal_informative.html',
26 controller: 'modalpopupController',
28 message: function () {
29 $(".overlayed").css("display","none");
30 $(".loadingId").css("display","none");
40 this.showFailure = function(heading, messageBody){
41 var modalInstance = $modal.open({
42 templateUrl: 'modal_warning.html',
43 controller: 'modalpopupController',
45 message: function () {
56 this.showMessage = function(heading, messageBody){
57 var modalInstance = $modal.open({
58 templateUrl: 'modal_message.html',
59 controller: 'modalpopupController',
61 message: function () {
72 this.showWarning = function(heading, messageBody){
73 var modalInstance = $modal.open({
74 templateUrl: 'modal_warning_message.html',
75 controller: 'modalpopupController',
77 message: function () {
88 this.popupConfirmWin = function(title, msgBody, callback){
89 var modalInstance = $modal.open({
90 templateUrl: 'confirmation_informative.html',
91 controller: 'modalpopupController',
93 message: function () {
102 var args = Array.prototype.slice.call( arguments, 0 );
104 modalInstance.result.then(function(){
105 callback.apply(null, args);
107 })['finally'](function(){
108 modalInstance = undefined;
112 this.popupConfirmWinWithCancel = function(title, msgBody, callback,dismissCallback){
113 var modalInstance = $modal.open({
114 templateUrl: 'confirmation_informative.html',
115 controller: 'modalpopupController',
117 message: function () {
126 var args = Array.prototype.slice.call( arguments, 0 );
128 modalInstance.result.then(function(){
129 callback.apply(null, args);
132 })['finally'](function(){
133 modalInstance = undefined;
137 this.popupDeleteConfirmWin = function(title, msgBody, callback, argForCallBack){
138 var modalInstance = $modal.open({
139 templateUrl: 'confirmation_for_delete.html',
140 controller: 'modalpopupController',
142 message: function () {
152 modalInstance.result.then(function(){
153 callback(argForCallBack);
155 })['finally'](function(){
156 modalInstance = undefined;
161 this.popupSuccessRedirectWin = function(title, msgBody, redirectUrl){
162 var modalInstance = $modal.open({
163 templateUrl: 'modal_informative.html',
164 controller: 'modalpopupController',
166 message: function () {
175 modalInstance.result.then(function() {
177 window.location.href=redirectUrl;
178 })['finally'](function(){
179 modalInstance = undefined;
183 this.popupWarningRedirectWin = function(title, msgBody, redirectUrl){
184 var modalInstance = $modal.open({
185 templateUrl: 'modal_warning_message.html',
186 controller: 'modalpopupController',
188 message: function () {
197 modalInstance.result.then(function() {
199 window.location.href=redirectUrl;
200 })['finally'](function(){
201 modalInstance = undefined;