app.controller('ReviewExpenseController', ['$scope', '$state', '$stateParams', '$timeout', '$modal', 'spinnerService', 'globalMessagesService', 'expenseRestService',

function($scope, $state, $stateParams, $timeout, $modal, spinnerService, globalMessagesService, expenseRestService) {
	"use strict";

	$scope.expenseUid = $stateParams.uid;
	$scope.expenseItems = [];

	$scope.submitButtonShown = false;

	$scope.$watch('expenseItems', function(newValue) {
		$scope.submitButtonShown = false;
		for(var i=0; i<newValue.length; i++) {
			if(newValue[i].state !== "INITIAL") {
				$scope.submitButtonShown = true;
				break;
			}
		}
	});

	function updateExpense() {
		expenseRestService.getExpense($scope.expenseUid).then(function(response) {
			if(response.data.state === 'ASSIGNED_TO_PROFESSOR') {
				$scope.expenseAccountingText = response.data.accounting;
			}
			else {
				$state.go('dashboard');
			}
		}, function(response) {
			response.errorHandled = true;
			$state.go('dashboard');
		});
	}
	updateExpense();

	$scope.editExpenseSap = function() {
		var modalInstance = $modal.open({
			templateUrl: 'expense/edit-expense-sap.tpl.html',
			controller: 'EditExpenseSapController',
			resolve: {
				accountingText: function() {
					return $scope.expenseAccountingText;
				},
				expenseUid: function() {
					return $scope.expenseUid;
				}
			}
		});
		modalInstance.result.then(updateExpense);
	};

	$scope.returnToDashboard = function() {
		$state.go('dashboard');
	};

	$scope.accept = function() {
		expenseRestService.assignToFinanceAdmin($scope.expenseUid).then(function() {
			$state.go('dashboard');
		}, function(response) {
			response.errorHandled = true;
			$state.go('dashboard');
		});
	};

	$scope.decline = function() {
		expenseRestService.rejectExpense($scope.expenseUid).then(function() {
			$state.go('dashboard');
		}, function(response) {
			response.errorHandled = true;
			$state.go('dashboard');
		});
	};

}]);

@@ -1515,421 +1515,396 @@
 %7B%0A%09%09
-expenseRestService.assignToFinanceAdmin($scope.expenseUid).then(function() %7B%0A%09%09%09$state.go('dashboard');%0A%09%09%7D, function(response) %7B%0A%09%09%09response.errorHandled = true;%0A%09%09%09$state.go('dashboard');%0A%09%09%7D);%0A%09%7D;%0A%0A%09$scope.decline = function() %7B%0A%09%09expenseRestService.rejectExpense($scope.expenseUid).then(function() %7B%0A%09%09%09$state.go('dashboard');%0A%09%09%7D, function(response) %7B%0A%09%09%09response.errorHandled = true;%0A%09%09%09$state.go('d
+acceptRejectModal(true);%0A%09%7D;%0A%0A%09$scope.decline = function() %7B%0A%09%09acceptRejectModal(false);%0A%09%7D;%0A%0A%09function acceptRejectModal(state) %7B%0A%09%09var modalInstance = $modal.open(%7B%0A%09%09%09templateUrl: %22expense/accept-reject.tpl.html%22,%0A%09%09%09controller: %22AcceptRejectController%22,%0A%09%09%09resolve: %7B%0A%09%09%09%09isAccept: function() %7B%0A%09%09%09%09%09return state;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D);%0A%0A%09%09modalInstance.result.then($scope.returnToD
 ashboard
 ');%0A
@@ -1903,21 +1903,13 @@
 oard
-'
 );%0A%09
-%09%7D);%0A%09%7D;
+%7D
 %0A%0A%7D%5D

add accept/reject modal opening logic into review-expense