diff --git a/schedule/schedule-appengine/gulpfile.js b/schedule/schedule-appengine/gulpfile.js index bda0c63b..1c937fbb 100644 --- a/schedule/schedule-appengine/gulpfile.js +++ b/schedule/schedule-appengine/gulpfile.js @@ -336,7 +336,6 @@ function staticHtml() { } function i18n() { - console.log(paths.i18n); return gulp.src(paths.i18n) .pipe(gulp.dest(paths.build + '/i18n')); } diff --git a/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/booking-via-jasify.js b/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/booking-via-jasify.js index ff3fd8f7..10eb8291 100644 --- a/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/booking-via-jasify.js +++ b/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/booking-via-jasify.js @@ -45,6 +45,7 @@ angular.forEach(this.activityPackages, function (activityPackage) { ActivityPackage.getActivities(activityPackage.id).then(function (result) { vm.activityPackageActivities[activityPackage.id] = result; + activityPackageExistsCheck(activityPackage.id); updateSelectAllFlags(); }); }); @@ -56,6 +57,8 @@ this.disableActivityPackageActivitySelection = disableActivityPackageActivitySelection; this.confirmRemoveActivity = confirmRemoveActivity; this.confirmRemoveActivityPackage = confirmRemoveActivityPackage; + this.confirmClearActivitySelection = confirmClearActivitySelection; + this.confirmClearPackageSelection = confirmClearPackageSelection; this.hasCompletedActivityPackages = hasCompletedActivityPackages; this.packageSelectionIncomplete = packageSelectionIncomplete; this.packageSelectionComplete = packageSelectionComplete; @@ -116,6 +119,23 @@ }); } + function confirmClearPackageSelection() { + var translation = $translate('CLEAR_PACKAGE_SELECTION_PROMPT'); + jasDialogs.ruSure(translation, function () { + $rootScope.$apply(function () { + vm.activityPackageSelection = {}; + }); + }); + } + function confirmClearActivitySelection() { + var translation = $translate('CLEAR_ACTIVITY_SELECTION_PROMPT'); + jasDialogs.ruSure(translation, function () { + $rootScope.$apply(function () { + vm.activitySelection = []; + }); + }); + } + function confirmRemoveActivityPackage(activityPackage) { var translation = $translate('REMOVE_ACTIVITY_PACKAGE'); jasDialogs.ruSure(translation, function () { @@ -206,6 +226,27 @@ vm.activityPackageSelection = localStorageService.get(sessionStorageKeys.activityPackageSelection) || {}; vm.activitySelection = localStorageService.get(sessionStorageKeys.activitySelection) || []; + + activityExistsCheck(vm.activities); + } + + function activityPackageExistsCheck(activityPackageId) { + + var activityPackageSelection = vm.activityPackageSelection[activityPackageId] || []; + + _.remove(activityPackageSelection, function(activityPackageSelectedActivity) { + return !_.find(vm.activityPackageActivities[activityPackageId], { 'id': activityPackageSelectedActivity.id }); + }); + + if (activityPackageSelection.length === 0) { + delete vm.activityPackageSelection[activityPackageId]; + } + } + + function activityExistsCheck(activities) { + _.remove(vm.activitySelection, function(selectedActivity) { + return !_.find(activities, { 'id': selectedActivity.id }); + }); } function canSelectAllForActivityPackage(activityPackage) { @@ -305,4 +346,4 @@ } } } -}(window.angular, _)); \ No newline at end of file +}(window.angular, _)); diff --git a/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/checkout.selection.html b/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/checkout.selection.html index da658f8b..635fc055 100644 --- a/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/checkout.selection.html +++ b/schedule/schedule-appengine/src/main/client/jasify/booking-via-jasify/checkout.selection.html @@ -35,6 +35,10 @@

{{ 'NO_ITEMS_SELECTED' | translate }} class="activity-listview listview lv-bordered lv-lg">

{{ 'SELECTED_ACTIVITY_PACKAGES' | translate }}

+
{{ 'SELECTED_ACTIVITY_PACKAGES' | translate }}

class="activity-listview listview lv-bordered lv-lg">

{{ 'SELECTED_ACTIVITIES' | translate }}

+
diff --git a/schedule/schedule-appengine/src/main/i18n/locale-en.json b/schedule/schedule-appengine/src/main/i18n/locale-en.json index 3fb8f3fb..4c36ac30 100644 --- a/schedule/schedule-appengine/src/main/i18n/locale-en.json +++ b/schedule/schedule-appengine/src/main/i18n/locale-en.json @@ -125,6 +125,10 @@ "PROCEED_TO_BOOKING_VIA_JASIFY": "Booking is done via Jasify. A new window will be opened where you will be able to Sign In or Create an account and proceed to your checkout", "PROFILE_SETTINGS": "Profile Settings", "REMOVE": "Remove", + "CLEAR_PACKAGE_SELECTION": "Clear Package Selection", + "CLEAR_PACKAGE_SELECTION_PROMPT": "Do you want to remove all Packages?", + "CLEAR_ACTIVITY_SELECTION": "Clear Activity Selection", + "CLEAR_ACTIVITY_SELECTION_PROMPT": "Do you want to remove all Activities?", "REMOVE_ACTIVITY": "Do you want to remove this Activity?", "REMOVE_ACTIVITY_PACKAGE": "Do you want to remove this Activity Package?", "REPEAT_DAILY": "Repeat daily",