2016-09-21 23:14:01 +02:00
|
|
|
|
angular
|
|
|
|
|
.module('bit.settings')
|
|
|
|
|
|
2016-09-22 01:30:08 +02:00
|
|
|
|
.controller('settingsSyncController', function ($scope, syncService, toastr) {
|
|
|
|
|
$scope.lastSync = '--';
|
|
|
|
|
setLastSync();
|
2016-09-21 23:14:01 +02:00
|
|
|
|
|
2016-09-22 01:30:08 +02:00
|
|
|
|
$scope.sync = function () {
|
|
|
|
|
syncService.fullSync(function () {
|
|
|
|
|
toastr.success('Syncing complete');
|
|
|
|
|
setLastSync();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function setLastSync() {
|
|
|
|
|
syncService.getLastSync(function (lastSync) {
|
|
|
|
|
if (lastSync) {
|
|
|
|
|
$scope.lastSync = lastSync.toLocaleDateString() + ' ' + lastSync.toLocaleTimeString();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$scope.lastSync = 'Never';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-09-21 23:14:01 +02:00
|
|
|
|
});
|