dashboard: rename CountdownController to TimerController
This commit is contained in:
parent
deb12052b5
commit
3df8d24e33
@ -46,7 +46,7 @@
|
|||||||
<div class="card-header bg-{{s.params.color}} text-light" ng-if="s.params.title">
|
<div class="card-header bg-{{s.params.color}} text-light" ng-if="s.params.title">
|
||||||
<h3 style="margin:0"><strong ng-bind="s.params.title"></strong></h3>
|
<h3 style="margin:0"><strong ng-bind="s.params.title"></strong></h3>
|
||||||
</div>
|
</div>
|
||||||
<div ng-controller="CountdownController" ng-init="s.params.end?init(s.params.end):initT(startAt)">
|
<div ng-controller="TimerController" ng-init="s.params.end?init(s.params.end):initStart()">
|
||||||
<div class="card-body text-center" style="font-size: 450%;" ng-if="duration > 0">{{ duration / 60 | time }} <span class="point">:</span> {{ duration % 60 | time }}</div>
|
<div class="card-body text-center" style="font-size: 450%;" ng-if="duration > 0">{{ duration / 60 | time }} <span class="point">:</span> {{ duration % 60 | time }}</div>
|
||||||
<div class="card-body text-center" style="font-size: 450%;" ng-if="!duration || duration <= 0">{{ s.params.lead }}</div>
|
<div class="card-body text-center" style="font-size: 450%;" ng-if="!duration || duration <= 0">{{ s.params.lead }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,16 +118,22 @@ angular.module("FICApp")
|
|||||||
refreshEvents()
|
refreshEvents()
|
||||||
$interval(refreshEvents, 2100);
|
$interval(refreshEvents, 2100);
|
||||||
})
|
})
|
||||||
.controller("CountdownController", function($scope, $interval) {
|
.controller("TimerController", function($scope, $rootScope, $interval) {
|
||||||
$scope.duration = 0;
|
$scope.duration = 0;
|
||||||
|
|
||||||
$scope.init = function(end) {
|
$scope.init = function(end) {
|
||||||
$scope.initT(Date.parse(end)/1000);
|
$scope.initT(Date.parse(end));
|
||||||
|
}
|
||||||
|
$scope.initStart = function() {
|
||||||
|
$scope.$watch("settings", function(settings){
|
||||||
|
if (settings)
|
||||||
|
$scope.initT(settings.start);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
$scope.initT = function(end) {
|
$scope.initT = function(end) {
|
||||||
var time = angular.fromJson(sessionStorage.userService);
|
var time = angular.fromJson(sessionStorage.userService);
|
||||||
var srv_cur = (Date.now() + (time.cu * 1000 - time.he)) / 1000;
|
var srv_cur = new Date(Date.now() + (time.cu - time.he));
|
||||||
$scope.duration += Math.floor(end - srv_cur);
|
$scope.duration = Math.floor((end - srv_cur)/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var stop = $interval(function() {
|
var stop = $interval(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user