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=========================================================
23 var deleteResumeDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log,
24 DeleteResumeService, CreationService, DataService, UtilityService) {
26 $scope.isDialogVisible = false;
27 $scope.summaryControl = {};
28 $scope.userProvidedControl = {};
30 var callbackFunction = undefined;
31 var componentId = undefined;
32 $scope.dialogMethod = COMPONENT.DELETE;
34 $scope.$on(COMPONENT.DELETE_RESUME_COMPONENT, function(event, request) {
36 $scope.isE2EService = false;
37 $scope.isDataVisible = false;
38 $scope.isSpinnerVisible = false;
39 $scope.isErrorVisible = false;
40 $scope.isDialogVisible = true;
41 $scope.popup.isVisible = true;
42 $scope.isConfirmEnabled = false;
43 $scope.dialogMethod = request.dialogMethod;
44 $scope.serviceStatus = request.serviceStatus;
45 callbackFunction = request.callbackFunction;
46 componentId = request.componentId;
48 DeleteResumeService.initializeComponent(request.componentId);
50 $scope.componentName = DeleteResumeService.getComponentDisplayName();
51 $scope.summaryControl.setList(DeleteResumeService.getSummaryList());
53 DeleteResumeService.getParameters(handleGetParametersResponse);
57 var handleGetParametersResponse = function(parameters, dontshow) {
58 $scope.summaryControl.setList(parameters.summaryList);
59 $scope.userProvidedControl.setList(parameters.userProvidedList);
61 $scope.isSpinnerVisible = false;
63 $scope.isDataVisible = false;
65 $scope.isDataVisible = true;
66 $scope.isConfirmEnabled = true;
69 $scope.userParameterChanged = function(id) {
70 DeleteResumeService.updateUserParameterList(id, $scope.userProvidedControl);
73 $scope.confirm = function() {
74 DataService.setE2EService($scope.isE2EService); //VoLTE support
75 var requiredFields = $scope.userProvidedControl.getRequiredFields();
76 if (requiredFields === "") {
77 $scope.isErrorVisible = false;
79 showError(FIELD.ERROR.MISSING_DATA, requiredFields);
85 var callbackAfterMSO = function(isSuccessful) {
87 $scope.popup.isVisible = false;
90 $scope.isDialogVisible = true;
95 $scope.isDialogVisible = false;
97 if ($scope.dialogMethod == COMPONENT.DELETE)
100 var requestDetails = DeleteResumeService.getMsoRequestDetails($scope.userProvidedControl.getList());
102 if(!DataService.getE2EService() && DeleteResumeService.isMacro === true){
103 requestDetails.requestParameters.aLaCarte = false;
106 $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
107 url : DeleteResumeService.getMsoUrl($scope.serviceStatus),
108 requestDetails : requestDetails,
109 componentId: componentId,
110 callbackFunction : callbackAfterMSO
114 if ($scope.dialogMethod == COMPONENT.RESUME)
116 CreationService.initializeComponent(componentId);
117 CreationService.setInventoryInfo();
119 var requestDetails = CreationService.getMsoRequestDetails($scope.userProvidedControl.getList());
122 $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
123 url : CreationService.getMsoUrl(),
124 requestDetails : requestDetails,
125 componentId: componentId,
126 callbackFunction : callbackAfterMSO
134 $scope.cancel = function() {
135 $scope.isDialogVisible = false;
136 $scope.popup.isVisible = false;
140 var runCallback = function(isSuccessful) {
141 if (angular.isFunction(callbackFunction)) {
143 isSuccessful : isSuccessful
149 appDS2.controller("deleteResumeDialogController", [ "COMPONENT", "FIELD", "$scope", "$http",
150 "$timeout", "$log", "DeleteResumeService","CreationService", "DataService", "UtilityService",
151 deleteResumeDialogController]);