2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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, DataService,
24 DeleteResumeService, CreationService, UtilityService) {
26 $scope.isDialogVisible = false;
27 $scope.summaryControl = {};
28 $scope.userProvidedControl = {};
30 var callbackFunction = undefined;
31 var componentId = undefined;
32 var volumeGroups = undefined;
33 $scope.dialogMethod = COMPONENT.DELETE;
35 $scope.$on(COMPONENT.DELETE_RESUME_COMPONENT, function(event, request) {
37 $scope.isE2EService = false;
38 $scope.isDataVisible = false;
39 $scope.isSpinnerVisible = false;
40 $scope.isErrorVisible = false;
41 $scope.isDialogVisible = true;
42 $scope.popup.isVisible = true;
43 $scope.isConfirmEnabled = false;
44 $scope.dialogMethod = request.dialogMethod;
45 $scope.serviceStatus = request.serviceStatus;
46 callbackFunction = request.callbackFunction;
47 componentId = request.componentId;
48 volumeGroups = request.volumeGroups ? request.volumeGroups : [];
49 DeleteResumeService.initializeComponent(request.componentId);
51 $scope.componentName = DeleteResumeService.getComponentDisplayName();
52 $scope.summaryControl.setList(DeleteResumeService.getSummaryList());
54 DeleteResumeService.getParameters(handleGetParametersResponse);
58 var handleGetParametersResponse = function(parameters, dontshow) {
59 $scope.summaryControl.setList(parameters.summaryList);
60 $scope.userProvidedControl.setList(parameters.userProvidedList);
62 $scope.isSpinnerVisible = false;
64 $scope.isDataVisible = false;
66 $scope.isDataVisible = true;
67 $scope.isConfirmEnabled = true;
70 $scope.userParameterChanged = function(id) {
71 DeleteResumeService.updateUserParameterList(id, $scope.userProvidedControl);
74 $scope.confirm = function() {
75 DataService.setE2EService($scope.isE2EService); //VoLTE support
76 var requiredFields = $scope.userProvidedControl.getRequiredFields();
77 if (requiredFields === "") {
78 $scope.isErrorVisible = false;
80 showError(FIELD.ERROR.MISSING_DATA, requiredFields);
86 var callbackAfterMSO = function(isSuccessful) {
88 $scope.popup.isVisible = false;
91 $scope.isDialogVisible = true;
96 $scope.isDialogVisible = false;
98 if ($scope.dialogMethod == COMPONENT.DELETE)
101 var requestDetails = DeleteResumeService.getMsoRequestDetails($scope.userProvidedControl.getList());
103 if(!DataService.getE2EService() && DeleteResumeService.isMacro === true){
104 requestDetails.requestParameters.aLaCarte = false;
107 $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
108 url : DeleteResumeService.getMsoUrl($scope.serviceStatus),
109 requestDetails : requestDetails,
110 componentId: componentId,
111 callbackFunction : callbackAfterMSO
115 if ($scope.dialogMethod == COMPONENT.RESUME)
117 CreationService.initializeComponent(componentId);
118 CreationService.setInventoryInfo();
120 var parameterList = $scope.userProvidedControl.getList();
122 if (volumeGroups && volumeGroups.length > 0) {
123 var volumeGroupList = FIELD.PARAMETER.AVAILABLE_VOLUME_GROUP;
124 volumeGroupList.value = _.map(volumeGroups, function (volumeGroup) {
125 return volumeGroup.name;
127 parameterList.push(volumeGroupList);
130 var requestDetails = CreationService.getMsoRequestDetails(parameterList);
132 $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
133 url : CreationService.getMsoUrl(),
134 requestDetails : requestDetails,
135 componentId: componentId,
136 callbackFunction : callbackAfterMSO
144 $scope.cancel = function() {
145 $scope.isDialogVisible = false;
146 $scope.popup.isVisible = false;
150 var runCallback = function(isSuccessful) {
151 if (angular.isFunction(callbackFunction)) {
153 isSuccessful : isSuccessful
159 appDS2.controller("deleteResumeDialogController", [ "COMPONENT", "FIELD", "$scope", "$http",
160 "$timeout", "$log", "DataService", "DeleteResumeService","CreationService", "UtilityService",
161 deleteResumeDialogController]);