(function () { "use strict"; var TimelineQuestionController = function ($scope, $location, $routeParams, $window, timelineService) { $scope.id = $routeParams.id; $scope.first = $routeParams.first; $scope.model = {}; $scope.model.cta = 'Continue'; $scope.showEdit = true; $scope.endAction = () => $location.url(`/timelines/${$scope.id}/invitations`); timelineService.get($scope.id).then(timeline => $scope.timeline = timeline); timelineService.getAllPrompts($scope.id).then(prompts => $scope.prompts = prompts); $scope.callback = () => { timelineService.addPrompts($scope.id, $scope.prompts.filter(s => s.selected).map(s => s.promptId)) .then($scope.endAction); }; if ($routeParams.edit) { $scope.model.cta = 'Save'; $scope.showEdit = false; $scope.endAction = () => $window.history.back(); } if ($routeParams.first) { $scope.endAction = () => $location.url(`/nextSteps/${$scope.id}`); } }; TimelineQuestionController.$inject = ['$scope', '$location', '$routeParams', '$window', 'timelineService']; angular.module('streamApp').controller('timelineQuestionController', TimelineQuestionController); })();