Blame view

app/partials/ContactView/ContactView.controller.js 1.48 KB
4bb02bb84   Rishav   new integration w...
1
2
3
4
  'use strict';
  
   //Load controller
    angular.module('acufuel')
2c476c756   Anchit Jindal   added new code
5
6
7
8
  	.controller('ContactViewController', ['$scope', '$uibModal', 'ContactViewService', 'ViewCompanyService', function($scope, $uibModal, ContactViewService, ViewCompanyService) {
        	$(function() {
        		$('#toggle-one12').bootstrapToggle();
        		$('#toggle-two21').bootstrapToggle();
4bb02bb84   Rishav   new integration w...
9
          }) 
2c476c756   Anchit Jindal   added new code
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
          
          $(document).ready(function() {
              $('#contacts').DataTable();
          });
          
          ContactViewService.getContacts().then(function(result) {
          	console.log('==========',result);
          	$scope.contactList = result;
            
          })
          
          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...
45
46
  
      }]);