Fixed file list display

This commit is contained in:
Patrick McDonagh
2016-03-26 16:45:18 -05:00
parent b3bc0cd90c
commit 1a9bb6de7a
2 changed files with 19 additions and 9 deletions

View File

@@ -627,6 +627,10 @@ wellCtrls.controller('fileListPreviousCtrl', function($scope, $http, $routeParam
$scope.pageLoading = true;
var getFileList = json.getFilePage(paramDate, page, $scope.numPerPage);
getFileList.then(function(data) {
data.files = data.files.map(function(x){
x.Stroke_Time = new Date(x.Stroke_Time);
return x;
});
$scope.filteredFiles = data.files;
$scope.pageLoading = false;
});
@@ -667,19 +671,25 @@ wellCtrls.controller('fileListTodayCtrl', function($scope, $http, $routeParams,
getDateList.then(function(data) {
$scope.dates = data.dates;
$scope.currentDate = $scope.dates[0];
$log.info($scope.currentDate);
var getCardCount = json.getCardCount($scope.currentDate.unconv);
getCardCount.then(function(cdata){
$scope.numCards = cdata.count;
$scope.numPages = Math.ceil(cdata.count / $scope.numPerPage);
});
$scope.switchPage(1);
});
var getCardCount = json.getCardCount(paramDate);
getCardCount.then(function(cdata){
$scope.numCards = cdata.count;
$scope.numPages = Math.ceil(cdata.count / $scope.numPerPage);
});
$scope.switchPage = function(page){
$scope.currentPage = page;
$scope.pageLoading = true;
var getFileList = json.getFilePage($scope.currentDate.unconv, page, $scope.numPerPage);
getFileList.then(function(data) {
data.files = data.files.map(function(x){
x.Stroke_Time = new Date(x.Stroke_Time);
return x;
});
$scope.filteredFiles = data.files;
$scope.pageLoading = false;
});

View File

@@ -24,7 +24,7 @@
<tr>
<th></th>
<th style="text-align:center;">Date</th>
<th style="text-align:center;">Fillage</th>
<!-- <th style="text-align:center;">Fillage</th> -->
<th style="text-align:center;">Type</th>
<th style="text-align:center;"></th>
</tr>
@@ -33,9 +33,9 @@
<tbody>
<tr ng-repeat="file in filteredFiles">
<td style="vertical-align: middle;text-align:center;"><input type="checkbox" ng-model="file.selected"></a></td>
<td style="vertical-align: middle;text-align:center;"><a href="/#/card/{{file.id}}">{{file.Stroke_Time | date: "medium"}}</a></td>
<td style="vertical-align: middle;text-align:center;">{{file.Fillage_Percent | number: 2}} %</td>
<td style="vertical-align: middle;text-align:center;"><span class="btn" ng-class="{'btn-success':file.Card_Type=='Normal', 'btn-warning': file.Card_Type=='Shutdown', 'btn-danger': file.Card_Type=='Alarm'}">{{file.Card_Type}}</span></td>
<td style="vertical-align: middle;text-align:center;"><a href="/#/card/{{file.id}}">{{new Date(file.Stroke_Time) | date: "medium"}}</a></td>
<!-- <td style="vertical-align: middle;text-align:center;">{{file.Fillage_Percent | number: 2}} %</td> -->
<td style="vertical-align: middle;text-align:center;"><span class="btn" ng-class="{'btn-success':file.Card_Type=='Normal', 'btn-primary': file.Card_Type=='Shutdown', 'btn-danger': file.Card_Type=='Alarm', 'btn-warning':file.Card_Type=='Low Fillage',}">{{file.Card_Type}}</span></td>
<td style="vertical-align: middle;text-align:center;"><a href="/csv/{{file.id}}" class="btn btn-primary active">Download CSV</a></td>
</tr>