var app = angular.module("pagingtable",['bw.paging']); app.controller('activityTableCtrl', function($scope, $http, $interval, $location, $timeout, $rootScope) { $scope.currentPage = 1; $scope.totalItems = 0; $scope.pa = 10; $scope.ge = ''; $scope.l = ''; $scope.me = ''; $scope.pageSize = '100'; $scope.searchText = ''; getData(); $scope.menu = function(id) { location.href = id; }; function getData() { $http.get('/ajax/json/bolim.php?page=' + $scope.currentPage + '&size=' + $scope.pageSize + '&search=' + $scope.searchText + '&ge=' + $scope.ge + '&me=' + $scope.me + '&l=' + $scope.l) .success(function(data) { $scope.kos = data.ko; $scope.ne = data.ne; $scope.activity = []; $scope.korzinka = data.korzinka; $scope.totalItems = data.totalCount; $scope.startItem = ($scope.currentPage - 1) * $scope.pageSize + 1; $scope.endItem = $scope.currentPage * $scope.pageSize; if ($scope.endItem > $scope.totalCount) {$scope.endItem = $scope.totalCount;} angular.forEach(data.Biodata, function(temp){ $scope.activity.push(temp); }); }); } $scope.pageChanged = function(text, page, pageSize, total) { $scope.currentPage = page; getData(); } $scope.paChanged = function() { $scope.pageSize = $scope.pa; $scope.currentPage = 1; getData(); } $scope.pageSizeChanged = function() { $scope.currentPage = 1; getData(); } $scope.searchTextChanged = function() { $scope.currentPage = 1; getData(); } $scope.litr = function(l) { $scope.l = l; $scope.currentPage = 1; getData(); } $scope.yuChanged = function() { $scope.yu = $scope.yu; $scope.currentPage = 1; getData(); } $scope.openModal = function(){ var modal_popup = angular.element('#crudmodal'); modal_popup.modal('show'); }; $scope.eshopCat = function(){ $scope.smallhide = 'small-show'; }; $scope.closeModal = function(){ var modal_popu = angular.element('#och'); modal_popu.modal('hide'); var modal_popup = angular.element('#crudmodal'); modal_popup.modal('hide'); }; $scope.deModal = function(){ var modal_popup = angular.element('#och'); modal_popup.modal('show'); }; $scope.checked = function(id){ $http({ method:"POST", url:"/ajax/json/bolim.php?e=checked", data:{'id':id} }).success(function(data){ $scope.ak = data.ak; }); }; $scope.ko = function(id){ $http({ method:"POST", url:"/ajax/json/bolim.php?e=ko", data:{'id':id} }).success(function(data){ var audio = document.querySelector("#audio_notify"); audio.pause(); audio.loop = false; audio.currentTime = 0; audio.play(); $scope.currentPage = $scope.currentPage; getData(); }); }; $scope.pilus = function(id){ $http({ method:"POST", url:"/ajax/json/bolim.php?e=p", data:{'id':id} }).success(function(data){ $scope.currentPage = $scope.currentPage; getData(); }); }; $scope.minus = function(id){ $http({ method:"POST", url:"/ajax/json/bolim.php?e=m", data:{'id':id} }).success(function(data){ $scope.currentPage = $scope.currentPage; getData(); }); }; $scope.bonus = function(id, t){ $http({ method:"POST", url:"/ajax/json/bolim.php?e=bonus", data:{'id':id, 't':t} }).success(function(data){ console.log(data); location.href = '/ID'; }); }; $scope.gChanged = function(){ $scope.ge = $scope.g; $scope.currentPage = 1; getData(); }; $scope.mChanged = function(){ $scope.me = $scope.m; $scope.currentPage = 1; getData(); }; });