--------------------------------

Agent Bookings ( GetAgentBookings )

// Find repeat row and add:
//		ng-repeat="booking in bookings"
  GetAgentBookings.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.bookings =  $scope.post.records;
  });

---------------------------------

Sales ( GetSales )

// Find repeat row and add:
//		ng-repeat="sale in sales"

  GetSales.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.sales =  $scope.post.records;
  });

---------------------------------

Add Agent ( GetOffices, AddAgent )

// Find Agent Name <input> and add:
//		ng-model="data.agent"
// Find Office <select> tag and add:
//		ng-model="data.office" ng-options="office.OfficeID as office.OfficeLocation for office in offices"
// Find Add Agent <button> tag and add:
//		ng-click="addAgent()" ng-hide="hideButton"

  $scope.offices = [];    

  $scope.data = {};

  $scope.addAgent = function(){
    var agent = $scope.data.agent;
    var office = $scope.data.office;
    $scope.hideButton=true;

    AddAgent.getPost(agent, office) 
    .then(function(response) {
      $scope.post = response;
     });
  };

  GetOffices.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.offices =  $scope.post.records;
	$scope.offices.unshift({ "OfficeID": 0, "OfficeLocation": "--- Select Office Location ---" });
  });
  $scope.data.office=0;

---------------------------------

Add Sale ( GetAgents, GetDestinations, AddSale )

// Find Agent <select> tag and add:
//		ng-model="data.agent" ng-options="agent.AgentID as agent.AgentName for agent in agents"
// Find Date <input> and add:
//		ng-model="data.saleDate"
// Find Amount <input> and add:
//		ng-model="data.amount"
// Find Destination <select> tag and add:
//		ng-model="data.destination" ng-options="destination.DestinationID as destination.DestinationName for destination in destinations"
// Find Add Sale <button> tag and add:
//		ng-click="addSale()" ng-hide="hideButton"

  $scope.destinations = [];    
  $scope.agents = [];    

  $scope.data = {};

  $scope.addSale = function(){
    var agent = $scope.data.agent;
    var destination = $scope.data.destination;
    var saleDate = $scope.data.saleDate;
    var amount = $scope.data.amount;
    $scope.hideButton=true;

    AddSale.getPost(agent, saleDate, amount, destination) 
    .then(function(response) {
      $scope.post = response;
     });
  };

  GetAgents.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.offices =  $scope.post.records;
	$scope.agents.unshift({ "AgentID": 0, "AgentName": "--- Select Agent ---" });
  });
  $scope.data.agent=0;

  GetDestinations.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.destinations =  $scope.post.records;
	$scope.destinations.unshift({ "DestinationID": 0, "DestinationName": "--- Select Destination ---" });
  });
  $scope.data.destination=0;

---------------------------------

Search Sales ( GetAgents, GetDestinations )

// Find Agent <select> tag and add:
//		ng-model="data.agent" ng-options="agent.AgentID as agent.AgentName for agent in agents"
// Find Destination <select> tag and add:
//		ng-model="data.destination" ng-options="destination.DestinationID as destination.DestinationName for destination in destinations"
// Find AmountsAbove <input> and add:
//		ng-model="data.above"
// Find AmountsBelow <input> and add:
//		ng-model="data.below"

// Find Search Sales button that starts with <a ui-sref="campusTravel.searchResults" ...>Search Sales</a>

//		Add arguments to "campusTravel.searchResults(...)". The four arguments are passed as a JavaScipt JSON object as follows:
//			({"agent":""+ data.agent +"","destination":""+ data.destination +"","above":""+ data.above +"","below":""+ data.below +""})

//		Next, change all quote characters (") to the HTML encoding: &quot; (6 characters)"
//			({&quot;agent&quot;:&quot;&quot;+ data.agent +&quot;&quot;,&quot;destination&quot;:&quot;&quot;+ data.destination +&quot;&quot;,&quot;above&quot;:&quot;&quot;+ data.above +&quot;&quot;,&quot;below&quot;:&quot;&quot;+ data.below +&quot;&quot;})

//		Add the above string after campusTravel.searchResults and before the quote so it looks as follows:
//	<a ui-sref="campusTravel.searchResults({&quot;agent&quot;:&quot;&quot;+ data.agent +&quot;&quot;,&quot;destination&quot;:&quot;&quot;+ data.destination +&quot;&quot;,&quot;above&quot;:&quot;&quot;+ data.above +&quot;&quot;,&quot;below&quot;:&quot;&quot;+ data.below +&quot;&quot;})" ...

//		Also add the following two attributes:
//			ng-click="searchSales()" ng-hide="hideButton"

  $scope.destinations = [];    
  $scope.agents = [];    

  $scope.data = { };

  GetAgents.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.agents =  $scope.post.records;
	$scope.agents.unshift({ "AgentID": 0, "AgentName": "--- Select Agent ---" });
  });
  $scope.data.agent=0;

  GetDestinations.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.destinations =  $scope.post.records;
	$scope.destinations.unshift({ "DestinationID": 0, "DestinationName": "--- Select Destination ---" });
  });
  $scope.data.destination=0;

---------------------------------

Search Results ( SearchSales )

// Find repeat row and add:
//		ng-repeat="sale in sales"

//	Add arguments to "campus.Travel.searchResults(...)". The four arguments are passed as a JavaScipt JSON object as follows:
//		({"saleId":""+ sale.SaleID +""})
//		({&quot;saleId&quot;:&quot;&quot;+ sale.SaleID +&quot;&quot;})

// In route.js, find the .state('campusTravel.searchResults' ... specification.
// In between the "url: '/page ," and "views: {" lines, add the following on a new line:
//	params: { agent: "0", destination: "0", above: "0", below: "0"},

  $scope.data = { 
	  "agent": $stateParams.agent,
	  "destination": $stateParams.destination,
	  "above": $stateParams.above,
	  "below": $stateParams.below
  };

  var criteria = '';
  if($scope.data.agent > 0) criteria += ", AgentID = "+$scope.data.agent;
  if($scope.data.destination > 0) criteria += ", DestinationID = "+$scope.data.destination;
  if($scope.data.above > 0) criteria += ", Amounts Above $"+$scope.data.above;
  if($scope.data.below > 0) criteria += ", Amounts Below $"+$scope.data.below;

  $scope.data.criteria = criteria.substr(2);

  SearchSales.getPost($scope.data.agent, $scope.data.destination, $scope.data.above, $scope.data.below)
  .then(function(response) {
    $scope.post = response;
    $scope.sales =  $scope.post.records;
  });

---------------------------------

Update Sale ( GetAgents, GetDestinations, GetSale, DeleteSale, UpdateSale )

// Find Delete <button> tag and add:
//		ng-click="deleteSale()" ng-hide="hideDeleteButton"
// Find Agent <select> tag and add:
//		ng-model="data.agent" ng-options="agent.AgentID as agent.AgentName for agent in agents"
// Find Date <input> and add:
//		ng-model="data.saleDate"
// Find Amount <input> and add:
//		ng-model="data.amount"
// Find Destination <select> tag and add:
//		ng-model="data.destination" ng-options="destination.DestinationID as destination.DestinationName for destination in destinations"
// Find Update Sale <button> tag and add:
//		ng-click="updateSale()"

// In route.js, find the .state('campusTravel.updateSale' ... specification.
// In between the "url: '/page ," and "views: {" lines, add the following on a new line:
//	params: { saleId: "1" },

  $scope.destinations = [];    
  $scope.agents = [];
  $scope.sale = {};

  $scope.data = { "saleId": $stateParams.saleId };

  GetSale.getPost($scope.data.saleId)
  .then(function(response) {
    $scope.post = response;
    $scope.sale =  $scope.post.records[0];
  });

  var originalAgent = $scope.sale.AgentKey;
  var originalSaleDate = $scope.sale.SaleDate;
  var originalAmount = $scope.sale.Amount;
  var originalDestination = $scope.sale.DestinationKey;


  $scope.deleteSale = function(){
    if(confirm("Are you sure you want to delete this sale?"))
    {
      $scope.hideButton=true;

      DeleteSale.getPost(saleID, originalAgent, originalSaleDate, originalAmount, originalDestination) 
      .then(function(response) {
        $scope.post = response;
       });
	}
  };

  $scope.updateSale = function(){
    $scope.hideButton=true;

    UpdateSale.getPost(saleID, originalAgent, originalSaleDate, originalAmount, originalDestination, $scope.data.agent, $scope.data.saleDate, $scope.data.amount, $scope.data.destination) 
    .then(function(response) {
      $scope.post = response;
      $scope.sale =  $scope.post.SaleRecord;
     });
  };

  GetAgents.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.agents =  $scope.post.records;
  });

  GetDestinations.getPost()
  .then(function(response) {
    $scope.post = response;
    $scope.destinations =  $scope.post.records;
  });

  $scope.data.agent = $scope.sale.AgentKey;
  $scope.data.destination = $scope.sale.DestinationKey;
  $scope.data.saleDate = $scope.sale.SaleDate;
  $scope.data.amount = $scope.sale.Amount;

---------------------------------