diff --git a/app/partials/viewcontact/viewcontact.controller.js b/app/partials/viewcontact/viewcontact.controller.js index e3106df..2ee1f97 100644 --- a/app/partials/viewcontact/viewcontact.controller.js +++ b/app/partials/viewcontact/viewcontact.controller.js @@ -4,12 +4,14 @@ angular.module('acufuel') .controller('viewcontactController', ['$scope', '$stateParams', 'ViewcontactService', 'ViewCompanyService', function($scope, $stateParams, ViewcontactService, ViewCompanyService) { - + $scope.showLoader = true; + $scope.showUpdateBtn = false; var contactId = $stateParams.id; $scope.contactDetail = {}; var value = ""; ViewcontactService.getContact(contactId).then(function(result) { $scope.contactDetail = result; + $scope.showLoader = false; }) $scope.contactIdList = {}; @@ -20,22 +22,26 @@ ViewcontactService.getContactsList(contactId).then(function(list){ $scope.contactIdList = list; index = $scope.contactIdList.indexOf(contactId); - selectedId = $scope.contactIdList[index] + selectedId = $scope.contactIdList[index]; }) $scope.nextContact = function(){ + $scope.showLoader = true; index = index + one; selectedId = $scope.contactIdList[index]; ViewcontactService.getContact(selectedId).then(function(result) { $scope.contactDetail = result; + $scope.showLoader = false; }) } $scope.prevContact = function(){ + $scope.showLoader = true; index = index - one; selectedId = $scope.contactIdList[index]; ViewcontactService.getContact(selectedId).then(function(result) { $scope.contactDetail = result; + $scope.showLoader = false; }) } @@ -74,27 +80,34 @@ $scope.nameEdit = function(){ $scope.editName = false; + $scope.showUpdateBtn = true; } $scope.addressEdit = function(){ $scope.editAddress = false; + $scope.showUpdateBtn = true; } $scope.phoneEdit = function(){ $scope.editPhone = false; + $scope.showUpdateBtn = true; } $scope.mobileEdit = function(){ $scope.editMobile = false; + $scope.showUpdateBtn = true; } $scope.emailEdit = function(){ $scope.editEmail = false; + $scope.showUpdateBtn = true; } $scope.notesEdit = function(){ $scope.editContactNotes = false; + $scope.showUpdateBtn = true; } $scope.conData = {}; $scope.contactData = {}; $scope.contactData.contactList = []; $scope.updateContact = function(data){ + $scope.showLoader = true; $scope.editName = true; $scope.editCompany = true; $scope.editAddress = true; @@ -125,11 +138,13 @@ toastr.success(''+result.success+'', { closeButton: true }) + $scope.showUpdateBtn = false; }else{ toastr.error(''+result.statusText+'', { closeButton: true }) } + $scope.showLoader = false; }) } diff --git a/app/partials/viewcontact/viewcontact.html b/app/partials/viewcontact/viewcontact.html index e4c395f..0294b3b 100644 --- a/app/partials/viewcontact/viewcontact.html +++ b/app/partials/viewcontact/viewcontact.html @@ -1,3 +1,6 @@ +