Blame view

app/partials/ContactView/ContactView.controller.js 1.93 KB
4bb02bb84   Rishav   new integration w...
1
2
3
4
  'use strict';
  
   //Load controller
    angular.module('acufuel')
7e481a068   Rishav   implement toogle ...
5
  	.controller('ContactViewController', ['$scope', '$uibModal', 'ContactViewService', 'ViewCompanyService', 'ViewcontactService', function($scope, $uibModal, ContactViewService, ViewCompanyService, ViewcontactService) {
2c476c756   Anchit Jindal   added new code
6
7
8
9
10
11
12
13
14
15
          
          $(document).ready(function() {
              $('#contacts').DataTable();
          });
          
          ContactViewService.getContacts().then(function(result) {
          	console.log('==========',result);
          	$scope.contactList = result;
            
          })
7e481a068   Rishav   implement toogle ...
16
17
  
          $scope.changePriceEmail = function(id, index){
d24318592   Rishav   changes and new i...
18
            event.stopPropagation();
7e481a068   Rishav   implement toogle ...
19
20
21
22
23
24
25
26
27
28
29
            var contactId = id;
            console.log($scope.contactList[index].priceEmail)
            var statusData = "status=" + $scope.contactList[index].priceEmail;
            ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) {
                if(result.success){
                    toastr.success(''+result.success+'', {
                        closeButton: true
                    })
                }
            })
          }
2c476c756   Anchit Jindal   added new code
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
          
          ContactViewService.getCompanies().then(function(result) {
          	console.log('==========',result);
          	$scope.companies = result;
            
          })
          
          $scope.contactData = {};
          $scope.contactData.contactList = [];
          $scope.addContact = function(){
            console.log('==== $scope.data======', $scope.data);
            $scope.contactData.contactList.push($scope.data);
            ViewCompanyService.addContact($scope.contactData).then(function(result) {
              if(result.success){
                toastr.success(''+result.success+'', {
                    closeButton: true
                  })
                  $('#contact-modal-3').modal('hide');
              }else{
                toastr.error(''+result.statusText+'', {
                    closeButton: true
                  })
              }
            })
          }
4bb02bb84   Rishav   new integration w...
55
56
  
      }]);