viewCompany.controller.js
2.22 KB
1
2
3
4
5
6
7
8
9
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
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
70
71
72
73
'use strict';
//Load controller
angular.module('acufuel')
.controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', function($scope , $uibModal, $stateParams, ViewCompanyService) {
$scope.data = {};
$scope.data.priceEmail = true;
$scope.open = function(){
$scope.editSmsModal = $uibModal.open({
templateUrl: 'partials/NewCompany/NewCompany.html',
backdrop: true,
scope: $scope,
})
}
$(function() {
$('#toggle-one2').bootstrapToggle();
})
$(function() {
$('#toggle-one1').bootstrapToggle();
})
$(function() {
$('#toggle-two').bootstrapToggle();
})
$(function() {
$('#toggle-three').bootstrapToggle();
})
$(function() {
$('#toggle-four').bootstrapToggle();
})
$(function() {
$('#price-one2').bootstrapToggle();
$('#price-one2').change(function() {
$('#console-event').html('Toggle: ' + $(this).prop('checked'));
$scope.data.priceEmail = $(this).prop('checked');
})
})
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
})
}
})
}
}]);