Blame view

app/partials/ContactView/ContactView.controller.js 1.82 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
          
          $(document).ready(function() {
              $('#contacts').DataTable();
          });
          
          ContactViewService.getContacts().then(function(result) {
2c476c756   Anchit Jindal   added new code
12
          	$scope.contactList = result;
2c476c756   Anchit Jindal   added new code
13
          })
7e481a068   Rishav   implement toogle ...
14

7152ff131   Rishav   model handle
15
16
17
          $scope.reset = function(){
            $("input").val("");
          }
7e481a068   Rishav   implement toogle ...
18
          $scope.changePriceEmail = function(id, index){
d24318592   Rishav   changes and new i...
19
            event.stopPropagation();
67044e31e   Rishav Singla   modify changes an...
20
21
22
23
24
25
26
27
28
            // var contactId = id;
            // var statusData = "status=" + $scope.contactList[index].priceEmail;
            // ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) {
            //     if(result.success){
            //         toastr.success(''+result.success+'', {
            //             closeButton: true
            //         })
            //     }
            // })
7e481a068   Rishav   implement toogle ...
29
          }
2c476c756   Anchit Jindal   added new code
30
31
          
          ContactViewService.getCompanies().then(function(result) {
2c476c756   Anchit Jindal   added new code
32
33
34
35
36
37
38
          	$scope.companies = result;
            
          })
          
          $scope.contactData = {};
          $scope.contactData.contactList = [];
          $scope.addContact = function(){
2c476c756   Anchit Jindal   added new code
39
40
41
42
43
44
45
46
47
48
49
50
51
52
            $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...
53
54
  
      }]);