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, UtilityService) {
26 $scope.isDialogVisible = false;
27 $scope.summaryControl = {};
28 $scope.userProvidedControl = {};
30 var callbackFunction = undefined;
31 var componentId = undefined;
33 $scope.$on(COMPONENT.DELETE_RESUME_COMPONENT, function(event, request) {
35 $scope.isDataVisible = false;
36 $scope.isSpinnerVisible = false;
37 $scope.isErrorVisible = false;
38 $scope.isDialogVisible = true;
39 $scope.popup.isVisible = true;
40 $scope.isConfirmEnabled = false;
41 $scope.dialogMethod = request.dialogMethod;
42 callbackFunction = request.callbackFunction;
43 componentId = request.componentId;
45 DeleteResumeService.initializeComponent(request.componentId);
47 $scope.componentName = DeleteResumeService.getComponentDisplayName();
49 $scope.summaryControl.setList(DeleteResumeService.getSummaryList());
51 DeleteResumeService.getParameters(handleGetParametersResponse);
55 var handleGetParametersResponse = function(parameters, dontshow) {
56 $scope.summaryControl.setList(parameters.summaryList);
57 $scope.userProvidedControl.setList(parameters.userProvidedList);
59 $scope.isSpinnerVisible = false;
61 $scope.isDataVisible = false;
63 $scope.isDataVisible = true;
64 $scope.isConfirmEnabled = true;
67 $scope.userParameterChanged = function(id) {
68 DeleteResumeService.updateUserParameterList(id, $scope.userProvidedControl);
71 $scope.confirm = function() {
72 var requiredFields = $scope.userProvidedControl.getRequiredFields();
73 if (requiredFields === "") {
74 $scope.isErrorVisible = false;
76 showError(FIELD.ERROR.MISSING_DATA, requiredFields);
82 var callbackAfterMSO = function(isSuccessful) {
84 $scope.popup.isVisible = false;
87 $scope.isDialogVisible = true;
92 $scope.isDialogVisible = false;
94 if ($scope.dialogMethod == COMPONENT.DELETE)
97 var requestDetails = DeleteResumeService.getMsoRequestDetails($scope.userProvidedControl.getList());
99 if(DeleteResumeService.isMacro === true){
100 requestDetails.requestParameters.aLaCarte = false;
103 $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
104 url : DeleteResumeService.getMsoUrl(),
105 requestDetails : requestDetails,
106 componentId: componentId,
107 callbackFunction : callbackAfterMSO
111 if ($scope.dialogMethod == COMPONENT.RESUME)
113 CreationService.initializeComponent(componentId);
114 CreationService.setInventoryInfo();
116 var requestDetails = CreationService.getMsoRequestDetails($scope.userProvidedControl.getList());
119 $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
120 url : CreationService.getMsoUrl(),
121 requestDetails : requestDetails,
122 componentId: componentId,
123 callbackFunction : callbackAfterMSO
131 $scope.cancel = function() {
132 $scope.isDialogVisible = false;
133 $scope.popup.isVisible = false;
137 var runCallback = function(isSuccessful) {
138 if (angular.isFunction(callbackFunction)) {
140 isSuccessful : isSuccessful
146 appDS2.controller("deleteResumeDialogController", [ "COMPONENT", "FIELD", "$scope", "$http",
147 "$timeout", "$log", "DeleteResumeService","CreationService", "UtilityService",
148 deleteResumeDialogController]);