Skip to content

Commit

Permalink
Merge pull request #4033 from QuantiModo/feature/doneState
Browse files Browse the repository at this point in the history
doneState
  • Loading branch information
mikepsinn authored Sep 21, 2020
2 parents 2890f68 + d8ad8eb commit d5b09dc
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/js/controllers/reminderAddCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ angular.module('starter').controller('ReminderAddCtrl', ["$scope", "$state", "$s
setupEditReminder($scope.state.trackingReminder);
} // Needed to set dates
qmLog.info("tracking reminder after setup: ", $scope.state.trackingReminder);
setTitle();
});
$scope.showMoreOptions = function(){
$scope.state.showMoreOptions = true;
Expand Down Expand Up @@ -136,17 +137,22 @@ angular.module('starter').controller('ReminderAddCtrl', ["$scope", "$state", "$s
}
}
$scope.oldOpenReminderStartTimePicker = function(order){
var defaultStartTimeInSecondsSinceMidnightLocal = qmService.getSecondsSinceMidnightLocalFromLocalString($rootScope.user.earliestReminderTime);
var defaultStartTimeInSecondsSinceMidnightLocal =
qmService.getSecondsSinceMidnightLocalFromLocalString($rootScope.user.earliestReminderTime);
if(order === 'first' && $scope.state.firstReminderStartTimeLocal){
defaultStartTimeInSecondsSinceMidnightLocal = qmService.getSecondsSinceMidnightLocalFromLocalString($scope.state.firstReminderStartTimeLocal);
defaultStartTimeInSecondsSinceMidnightLocal =
qmService.getSecondsSinceMidnightLocalFromLocalString($scope.state.firstReminderStartTimeLocal);
}
if(order === 'second' && $scope.state.secondReminderStartTimeLocal){
defaultStartTimeInSecondsSinceMidnightLocal = qmService.getSecondsSinceMidnightLocalFromLocalString($scope.state.secondReminderStartTimeLocal);
defaultStartTimeInSecondsSinceMidnightLocal =
qmService.getSecondsSinceMidnightLocalFromLocalString($scope.state.secondReminderStartTimeLocal);
}
if(order === 'third' && $scope.state.thirdReminderStartTimeLocal){
defaultStartTimeInSecondsSinceMidnightLocal = qmService.getSecondsSinceMidnightLocalFromLocalString($scope.state.thirdReminderStartTimeLocal);
defaultStartTimeInSecondsSinceMidnightLocal =
qmService.getSecondsSinceMidnightLocalFromLocalString($scope.state.thirdReminderStartTimeLocal);
}
defaultStartTimeInSecondsSinceMidnightLocal = qmService.getSecondsSinceMidnightLocalRoundedToNearestFifteen(defaultStartTimeInSecondsSinceMidnightLocal);
defaultStartTimeInSecondsSinceMidnightLocal =
qmService.getSecondsSinceMidnightLocalRoundedToNearestFifteen(defaultStartTimeInSecondsSinceMidnightLocal);
$scope.state.timePickerConfiguration = {
callback: function(val){
if(typeof (val) === 'undefined'){
Expand Down Expand Up @@ -356,7 +362,11 @@ angular.module('starter').controller('ReminderAddCtrl', ["$scope", "$state", "$s
var toastMessage = getVariableName($scope) + ' saved';
qmService.showInfoToast(toastMessage);
qmService.hideLoader();
$scope.goBack(); // We can't go back until we get new notifications
if($stateParams.doneState){
qmService.goToState($stateParams.doneState, $stateParams);
} else {
$scope.goBack(); // We can't go back until we get new notifications
}
};
function getFrequencyNameFromFrequencySeconds(frequencyName){
var reverseFrequencyChart = {
Expand Down Expand Up @@ -476,7 +486,7 @@ angular.module('starter').controller('ReminderAddCtrl', ["$scope", "$state", "$s
});
}
var setTitle = function(){
if($stateParams.favorite){
if($stateParams.favorite || $state.current.name === qm.stateNames.favoriteAdd){
$scope.state.selectedFrequencyName = 'As-Needed';
if($stateParams.reminder){
if(getVariableCategoryName() === 'Treatments'){
Expand Down

0 comments on commit d5b09dc

Please sign in to comment.