Blame view

app/partials/viewCompany/viewCompany.controller.js 2.22 KB
feacde5ff   Rishav   setup acuefuel in...
1
2
3
4
5
  
  'use strict';
  
   //Load controller
    angular.module('acufuel')
55e075d7e   Rishav   add contact, add ...
6
7
8
  	.controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', function($scope , $uibModal, $stateParams, ViewCompanyService) {
          $scope.data = {};
          $scope.data.priceEmail = true;
4bb02bb84   Rishav   new integration w...
9
          $scope.open = function(){
4bb02bb84   Rishav   new integration w...
10
11
12
13
14
15
16
17
18
              $scope.editSmsModal = $uibModal.open({
                  templateUrl: 'partials/NewCompany/NewCompany.html',
                  backdrop: true,
                  scope: $scope,
              })
          }
          $(function() {
           $('#toggle-one2').bootstrapToggle();
          })
feacde5ff   Rishav   setup acuefuel in...
19

4bb02bb84   Rishav   new integration w...
20
21
22
23
24
25
26
27
28
29
30
          $(function() {
           $('#toggle-one1').bootstrapToggle();
          })   
          $(function() {
           $('#toggle-two').bootstrapToggle();
          })   
          $(function() {
           $('#toggle-three').bootstrapToggle();
          })   
          $(function() {
           $('#toggle-four').bootstrapToggle();
55e075d7e   Rishav   add contact, add ...
31
32
33
34
35
36
37
38
39
          })
  
          $(function() {
            $('#price-one2').bootstrapToggle();
            $('#price-one2').change(function() {
              $('#console-event').html('Toggle: ' + $(this).prop('checked'));
              $scope.data.priceEmail = $(this).prop('checked');
            })
          })
feacde5ff   Rishav   setup acuefuel in...
40

55e075d7e   Rishav   add contact, add ...
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
          var companyId = $stateParams.id;
          console.log(companyId)
          ViewCompanyService.getCompany(companyId).then(function(result) {
            $scope.aircraftMakeList = result;
          })
  
          ViewCompanyService.getContact(companyId).then(function(result) {
            $scope.aircraftMakeList = result;
          })
  
          $scope.contactData = {};
          $scope.contactData.contactList = [];
          $scope.addContact = function(){
            $scope.data.companyId = companyId;
            $scope.contactData.contactList.push($scope.data);
            console.log($scope.contactData)
            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
                  })
              }
            })
          }
feacde5ff   Rishav   setup acuefuel in...
70

55e075d7e   Rishav   add contact, add ...
71
    }]);