--- /dev/null
+'use strict';
+
+alloWebadminControllers
+ .controller('ContractListCtrl', ['$scope', '$routeParams', '$http', 'Contract',
+ function ($scope, $routeParams, $http, Contract) {
+ $scope.contractsPerPage = 20;
+ $scope.itemsPerPage = $scope.contractsPerPage;
+ $scope.orderProp = 'number';
+ $scope.contracts = [];
+ getResultsPage(1);
+
+ $scope.pagination = {
+ current: 1
+ };
+
+ $scope.pageChanged = function() {
+ getResultsPage($scope.pagination.current);
+ };
+
+ function getResultsPage(pageNumber) {
+ var offset = (pageNumber-1)*$scope.contractsPerPage;
+ if(offset == null || offset == undefined || offset < 0) {
+ offset = 0;
+ }
+ Contract.all({limit:$scope.contractsPerPage, offset:offset}).$promise.then(function(data) {
+ $scope.contracts = data;
+ for(var item in $scope.contracts.result) {
+ var dirty_state = $scope.contracts.result[item].state;
+ $scope.contracts.result[item].state = dirty_state.replace(/[&\/\\#,+()$~%^.'":*?<>{}]/g,'');
+ }
+ });
+ Contract.nb().$promise.then(function(data) {
+ $scope.totalContracts = data;
+ $scope.totalItems = $scope.totalContracts.result;
+ });
+ }
+ }]
+ );
\ No newline at end of file