diff --git a/app/js/app.js b/app/js/app.js
index 113695c..a0ff9c9 100644
--- a/app/js/app.js
+++ b/app/js/app.js
@@ -205,7 +205,7 @@
})
.state("app.viewCompany", {
- url: "/viewCompany",
+ url: "/viewCompany/:id",
templateUrl: "partials/viewCompany/viewCompany.html",
controller: "viewCompanyController"
})
diff --git a/app/partials/customers/customers.controller.js b/app/partials/customers/customers.controller.js
index 7f59d05..5663565 100644
--- a/app/partials/customers/customers.controller.js
+++ b/app/partials/customers/customers.controller.js
@@ -2,52 +2,20 @@
//Load controller
angular.module('acufuel')
- .controller('customersController', ['$scope', '$rootScope', '$uibModal', '$filter', 'CustomersService', customersController]);
+ .controller('customersController', ['$scope', '$rootScope', '$uibModal', '$filter', '$http', 'CustomersService', customersController]);
- function customersController($scope, $rootScope, $uibModal, $filter, CustomersService) {
+ function customersController($scope, $rootScope, $uibModal, $filter, $http, CustomersService) {
$(document).ready(function() {
$('#example').DataTable();
});
$scope.data = {};
$scope.aircraft = {};
$scope.data.activate = true;
- $scope.customerList = [{
- "companyName": "Name and inc",
- "Fleet": 3,
- "phone":"1010101010",
- "contact":"jimmy",
- "Base":"Kiad",
- "status":'Active',
- "source": "tenant",
- "allIn" : "$123"
- },{
- "companyName": "Name and inc",
- "Fleet": 3,
- "phone":"1010101010",
- "contact":"jimmy",
- "Base":"Kiad",
- "status":'Inactive',
- "source": "tenant",
- "allIn" : "$123"
- },{
- "companyName": "Name and inc",
- "Fleet": 3,
- "phone":"1010101010",
- "contact":"jimmy",
- "Base":"Kiad",
- "status":'Active',
- "source": "tenant",
- "allIn" : "$123"
- },{
- "companyName": "Name and inc",
- "Fleet": 3,
- "phone":"1010101010",
- "contact":"jimmy",
- "Base":"Kiad",
- "status":'Active',
- "source": "tenant",
- "allIn" : "$123"
- }]
+
+ CustomersService.getAllCompanies().then(function(result) {
+ console.log(result)
+ $scope.companyList = result;
+ })
$(function() {
$('#toggle-one2').bootstrapToggle();
@@ -62,168 +30,98 @@
getData();
function getData(){
CustomersService.getAircraftMake().then(function(result) {
- console.log("result", result)
$scope.aircraftMakeList = result;
- $scope.aircraft.make = $scope.aircraftMakeList[0];
- CustomersService.getModal($scope.aircraft.make).then(function(result) {
- $scope.aircraftModalList = result;
- $scope.aircraft.model = $scope.aircraftModalList[0];
- CustomersService.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) {
- $scope.aircraftSizeList = result;
- $scope.aircraft.size = $scope.aircraftSizeList[0];
- })
- })
-
})
}
-
- $scope.getModal = function(){
- var makeId = $scope.aircraft.make;
- CustomersService.getModal(makeId).then(function(result) {
- $scope.aircraftModalList = result;
- $scope.aircraft.model = $scope.aircraftModalList[0];
- CustomersService.getAircraftSize(makeId, $scope.aircraft.model).then(function(result) {
- $scope.aircraftSizeList = result;
- $scope.aircraft.size = $scope.aircraftSizeList[0];
- })
- })
- }
-
- $scope.getSize = function(){
- CustomersService.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) {
- $scope.aircraftSizeList = result;
- $scope.aircraft.size = $scope.aircraftSizeList[0];
- })
- }
-
$scope.addFirstData = function(sel, step){
// console.log($scope.data)
- // var companyData = "companyName=" + $scope.data.companyName + "&masterMargin=" + $scope.data.masterMargin
- // + "&addressOne=" + $scope.data.addressOne + "&addressTwo=" + $scope.data.addressTwo + "&city=" + $scope.data.city + "&state="
- // + $scope.data.state + "&country=" + $scope.data.country + "&zipcode=" + $scope.data.zipcode + "&internalNote="
- // + $scope.data.internalNote + "&certificateType=" + $scope.data.certificateType + "&baseTenant=" + $scope.data.baseTenant
- // + "&fuelerlinxCustomer=" + $scope.data.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.data.contractFuelVendor
- // + "&activate=" + $scope.data.activate + "&baseIcao=" + $scope.data.baseIcao;
-
- // CustomersService.addCompany(companyData).then(function(result) {
- // console.log(result)
- // $scope.accountId = result;
- //$scope.aircraft.accountId = $scope.accountId;
- // })
+ var companyData = "companyName=" + $scope.data.companyName + "&masterMargin=" + $scope.data.masterMargin
+ + "&addressOne=" + $scope.data.addressOne + "&addressTwo=" + $scope.data.addressTwo + "&city=" + $scope.data.city + "&state="
+ + $scope.data.state + "&country=" + $scope.data.country + "&zipcode=" + $scope.data.zipcode + "&internalNote="
+ + $scope.data.internalNote + "&certificateType=" + $scope.data.certificateType + "&baseTenant=" + $scope.data.baseTenant
+ + "&fuelerlinxCustomer=" + $scope.data.fuelerlinxCustomer + "&contractFuelVendor=" + $scope.data.contractFuelVendor
+ + "&activate=" + $scope.data.activate + "&baseIcao=" + $scope.data.baseIcao;
+
+ CustomersService.addCompany(companyData).then(function(result) {
+ console.log(result)
+ $scope.accountId = result;
+ $scope.aircraft.accountId = $scope.accountId;
+ })
$(sel).trigger('next.m.' + step);
getData();
}
- $scope.users = [
- {id: 1, name: 'awesome user1', status: 2, group: 4, groupName: 'admin'},
- {id: 2, name: 'awesome user2', status: undefined, group: 3, groupName: 'vip'},
- {id: 3, name: 'awesome user3', status: 2, group: null}
- ];
-
- $scope.statuses = [
- {value: 1, text: 'status1'},
- {value: 2, text: 'status2'},
- {value: 3, text: 'status3'},
- {value: 4, text: 'status4'}
- ];
-
- $scope.groups = [];
- $scope.loadGroups = function() {
- return $scope.groups.length ? null : $http.get('/groups').success(function(data) {
- $scope.groups = data;
- });
- };
-
- $scope.showGroup = function(user) {
- if(user.group && $scope.groups.length) {
- var selected = $filter('filter')($scope.groups, {id: user.group});
- return selected.length ? selected[0].text : 'Not set';
- } else {
- return user.groupName || 'Not set';
- }
- };
-
- $scope.showStatus = function(user) {
- var selected = [];
- if(user.status) {
- selected = $filter('filter')($scope.statuses, {value: user.status});
- }
- return selected.length ? selected[0].text : 'Not set';
- };
-
- $scope.checkName = function(data, id) {
- if (id === 2 && data !== 'awesome') {
- return "Username 2 should be `awesome`";
- }
- };
-
- // filter users to show
- $scope.filterUser = function(user) {
- return user.isDeleted !== true;
- };
-
- // mark user as deleted
- $scope.deleteUser = function(id) {
- var filtered = $filter('filter')($scope.users, {id: id});
- if (filtered.length) {
- filtered[0].isDeleted = true;
- }
- };
-
- // add user
- $scope.addUser = function() {
- $scope.users.push({
- id: $scope.users.length+1,
- name: '',
- status: null,
- group: null,
- isNew: true
- });
- };
-
- // cancel all changes
- $scope.cancel = function() {
- for (var i = $scope.users.length; i--;) {
- var user = $scope.users[i];
- // undelete
- if (user.isDeleted) {
- delete user.isDeleted;
- }
- // remove new
- if (user.isNew) {
- $scope.users.splice(i, 1);
- }
- };
- };
-
- // save edits
- $scope.saveTable = function() {
- var results = [];
- for (var i = $scope.users.length; i--;) {
- var user = $scope.users[i];
- // actually delete user
- if (user.isDeleted) {
- $scope.users.splice(i, 1);
- }
- // mark as not new
- if (user.isNew) {
- user.isNew = false;
- }
-
- // send on server
- results.push($http.post('/saveUser', user));
- }
-
- return $q.all(results);
- };
+ $scope.aircraftDetails = [{
+ 'tail':'',
+ 'make': '',
+ 'model': '',
+ 'size' : ''
+ }];
+
+ $scope.addNew = function(){
+ $scope.aircraftDetails.push({
+ 'tail':'',
+ 'make': '',
+ 'model': '',
+ 'size' : ''
+ });
+ console.log($scope.aircraftDetails)
+ };
+
+ $scope.getModal = function(makeId, index){
+ $scope.aircraft.make = makeId;
+ //var makeId = makeId;
+ CustomersService.getModal($scope.aircraft.make).then(function(result) {
+ $scope.aircraftDetails[index].aircraftModalList = result;
+ //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0];
+ })
+ }
- $scope.appendText = function() {
- getData();
- var newRow = $('
| | | | |
');
- $('table.addRow').append(newRow);
- }
+ $scope.getSize = function(model, index){
+ CustomersService.getAircraftSize($scope.aircraft.make, model).then(function(result) {
+ $scope.aircraftDetails[index].aircraftSizeList = result;
+ //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0];
+ console.log($scope.aircraftDetails[index].size)
+ })
+ }
+
+ $scope.aircraftListData = {};
+ $scope.addData = [];
+ $scope.saveCompanyData = function(){
+ for(var i=0; i<$scope.aircraftDetails.length;i++){
+ $scope.addData.push({
+ 'tail': $scope.aircraftDetails[i].tail,
+ 'make': $scope.aircraftDetails[i].make,
+ 'model': $scope.aircraftDetails[i].model,
+ 'size' : $scope.aircraftDetails[i].size
+ });
+ }
+ $scope.aircraftListData.aircraftList = $scope.addData;
+ $scope.aircraftListData.accountId = $scope.aircraft.accountId;
+
+ CustomersService.addAircraft($scope.aircraftListData).then(function(result) {
+ console.log(result)
+ if(result.success){
+ toastr.success(''+result.success+'', {
+ closeButton: true
+ })
+ $('#demo-modal-3').modal('hide');
+ }else{
+ toastr.error(''+result.statusText+'', {
+ closeButton: true
+ })
+ }
+ });
+
+ }
+
+ // $scope.appendText = function() {
+ // getData();
+ // var newRow = $(' | | | | |
');
+ // $('table.addRow').append(newRow);
+ // }
}
\ No newline at end of file
diff --git a/app/partials/customers/customers.html b/app/partials/customers/customers.html
index 0022d4d..7a6104d 100644
--- a/app/partials/customers/customers.html
+++ b/app/partials/customers/customers.html
@@ -142,15 +142,17 @@
|
-
- {{customer.companyName}} |
+
+
+ {{customer.companyName}}
+ |
{{customer.Fleet}} |
{{customer.phone}} |
{{customer.contact}} |
- {{customer.Base}} |
+ {{customer.baseIcao}} |
-
-
+
+
|
@@ -300,7 +302,7 @@
- |
-->
-
-
- Name |
- Status |
- Group |
- Action |
-
-
-
-
-
- {{ user.name || 'empty' }}
-
- |
-
-
-
- {{ showStatus(user) }}
-
- |
-
-
-
- {{ showGroup(user) }}
-
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
View Contacts
View Fuel Vendors
Research Flight Dept
diff --git a/app/partials/viewCompany/viewCompany.controller.js b/app/partials/viewCompany/viewCompany.controller.js
index 4467b1a..e98a0e7 100644
--- a/app/partials/viewCompany/viewCompany.controller.js
+++ b/app/partials/viewCompany/viewCompany.controller.js
@@ -4,10 +4,11 @@
//Load controller
angular.module('acufuel')
- .controller('viewCompanyController', ['$scope','$uibModal', function($scope , $uibModal) {
- console.log("$uibModal",$uibModal);
+ .controller('viewCompanyController', ['$scope','$uibModal', '$stateParams', 'ViewCompanyService', function($scope , $uibModal, $stateParams, ViewCompanyService) {
+ $scope.data = {};
+ $scope.data.priceEmail = true;
+
$scope.open = function(){
- console.log("asndfsahdasd");
$scope.editSmsModal = $uibModal.open({
templateUrl: 'partials/NewCompany/NewCompany.html',
backdrop: true,
@@ -29,8 +30,44 @@
})
$(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
+ })
+ }
+ })
+ }
+ }]);
\ No newline at end of file
diff --git a/app/partials/viewCompany/viewCompany.html b/app/partials/viewCompany/viewCompany.html
index 53417df..4fa07e4 100644
--- a/app/partials/viewCompany/viewCompany.html
+++ b/app/partials/viewCompany/viewCompany.html
@@ -251,7 +251,7 @@
Contact List
-
+
@@ -366,6 +366,164 @@
+
@@ -375,4 +533,4 @@
height: 250,
extraPlugins: 'divarea'
} );
- -->
\ No newline at end of file
+ -->
diff --git a/app/partials/viewCompany/viewCompany.service.js b/app/partials/viewCompany/viewCompany.service.js
index d481f13..8069dad 100644
--- a/app/partials/viewCompany/viewCompany.service.js
+++ b/app/partials/viewCompany/viewCompany.service.js
@@ -1,12 +1,58 @@
(function(){
'use strict';
angular.module('acufuel')
- .service('viewCompanyService', ['$q', '$http', 'BE', viewCompanyService]);
-
- function viewCompanyService($q, $http, BE) {
- var temp = {};
+ .service('ViewCompanyService', ['$q', '$http', 'BASE_URL', ViewCompanyService]);
+ function ViewCompanyService($q, $http, BASE_URL) {
+ this.getCompany = function(id) {
+
+ var deferred = $q.defer();
+ $http({
+ method : 'GET',
+ url : BASE_URL.url +'/company/'+id,
+ headers : {'Content-Type': 'application/json'},
+ })
+ .then(function (result){
+ deferred.resolve(result.data);
+ },function (result){
+ deferred.resolve(result.data);
+ })
+ return deferred.promise;
+ }
+
+ this.getContact = function(id) {
+
+ var deferred = $q.defer();
+ $http({
+ method : 'GET',
+ url : BASE_URL.url +'/company/contact/'+id,
+ headers : {'Content-Type': 'application/json'},
+ })
+ .then(function (result){
+ deferred.resolve(result.data);
+ },function (result){
+ deferred.resolve(result.data);
+ })
+ return deferred.promise;
+ }
+
+ this.addContact = function(data) {
+
+ var deferred = $q.defer();
+ $http({
+ method : 'POST',
+ url : BASE_URL.url +'/company/add/contact',
+ data : data,
+ headers : {'Content-Type': 'application/json'},
+ })
+ .then(function (result){
+ deferred.resolve(result.data);
+ },function (result){
+ deferred.resolve(result.data);
+ })
+ return deferred.promise;
+ }
}