From ed99d7e6fd4e4504f4439eef573fc185aefc7dc9 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 28 Apr 2017 17:01:58 -0400 Subject: [PATCH] webstaff: finish first pass at enumeration pane Includes three new directives: egMonthSelector egSeasonSelector egMonthDaySelector Signed-off-by: Galen Charlton --- .../staff/serials/t_month_day_selector.tt2 | 17 ++++ .../templates/staff/serials/t_month_selector.tt2 | 14 ++++ .../staff/serials/t_prediction_wizard.tt2 | 31 ++++++++ .../templates/staff/serials/t_season_selector.tt2 | 6 ++ .../staff/serials/directives/prediction_wizard.js | 90 ++++++++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 Open-ILS/src/templates/staff/serials/t_month_day_selector.tt2 create mode 100644 Open-ILS/src/templates/staff/serials/t_month_selector.tt2 create mode 100644 Open-ILS/src/templates/staff/serials/t_season_selector.tt2 diff --git a/Open-ILS/src/templates/staff/serials/t_month_day_selector.tt2 b/Open-ILS/src/templates/staff/serials/t_month_day_selector.tt2 new file mode 100644 index 0000000000..5a1a38fea8 --- /dev/null +++ b/Open-ILS/src/templates/staff/serials/t_month_day_selector.tt2 @@ -0,0 +1,17 @@ +
+ + + + +
diff --git a/Open-ILS/src/templates/staff/serials/t_month_selector.tt2 b/Open-ILS/src/templates/staff/serials/t_month_selector.tt2 new file mode 100644 index 0000000000..a9329f0768 --- /dev/null +++ b/Open-ILS/src/templates/staff/serials/t_month_selector.tt2 @@ -0,0 +1,14 @@ + diff --git a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 index 34533db476..9da3b69494 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 @@ -120,6 +120,37 @@
+
+ +
+
+
+
+
+ +
+
+ + + +
+
+ + +
+
+
+
+
diff --git a/Open-ILS/src/templates/staff/serials/t_season_selector.tt2 b/Open-ILS/src/templates/staff/serials/t_season_selector.tt2 new file mode 100644 index 0000000000..f93950342d --- /dev/null +++ b/Open-ILS/src/templates/staff/serials/t_season_selector.tt2 @@ -0,0 +1,6 @@ + diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js index 63f3385073..1a739c2fee 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js @@ -24,6 +24,7 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { this.use_enum = false; this.use_alt_enum = false; this.use_chron = false; + this.use_calendar_changes = false; this.compress_expand = '3'; this.caption_evaluation = '0'; this.enum_levels = []; @@ -145,20 +146,25 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { } } if (sf == 'x') { + this.use_calendar_change = true; this.calendar_change = []; value.split(',').forEach(function(chg) { var calendar_change = { + type : null, season : null, month : null, day : null } if (chg.length == 2) { if (chg >= '21') { + calendar_change.type = 'season'; calendar_change.season = chg; } else { + calendar_change.type = 'month'; calendar_change.month = chg; } } else if (chg.length == 4) { + calendar_change.type = 'date'; calendar_change.month = chg.substring(0, 2); calendar_change.day = chg.substring(2, 4); } @@ -200,6 +206,19 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { self.alt_enum_levels.pop(); } } + this.remove_calendar_change = function(idx) { + if (self.calendar_change.length > idx) { + self.calendar_change.splice(idx, 1); + } + } + this.add_calendar_change = function() { + self.calendar_change.push({ + type : null, + season : null, + month : null, + day : null + }); + } } // TODO chron only @@ -209,3 +228,74 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { }] } }) + +.directive('egMonthSelector', function() { + return { + transclude: true, + restrict: 'E', + scope: { + ngModel : '=' + }, + templateUrl: './serials/t_month_selector', + controller: + ['$scope','$q', +function($scope , $q) { +}] + } +}) + +.directive('egSeasonSelector', function() { + return { + transclude: true, + restrict: 'E', + scope: { + ngModel : '=' + }, + templateUrl: './serials/t_season_selector', + controller: + ['$scope','$q', +function($scope , $q) { +}] + } +}) + +.directive('egMonthDaySelector', function() { + return { + transclude: true, + restrict: 'E', + scope: { + month : '=', + day : '=' + }, + templateUrl: './serials/t_month_day_selector', + controller: + ['$scope','$q', +function($scope , $q) { + if ($scope.month == null) $scope.month = '01'; + if ($scope.day == null) $scope.day = '01'; + $scope.dt = new Date(2012, parseInt($scope.month) - 1, parseInt($scope.day), 1); + $scope.options = { + minMode : 'day', + maxMode : 'day', + datepickerMode : 'day', + showWeeks : false, + // use a leap year, though any publisher who uses 29 February as a + // calendar change is simply trolling + // also note that when https://github.com/angular-ui/bootstrap/issues/1993 + // is fixed, setting minDate and maxDate would make sense, as + // user wouldn't be able to keeping hit the left or right arrows + // past the end of the range + // minDate : new Date('2012-01-01 00:00:01'), + // maxDate : new Date('2012-12-31 23:59:59'), + formatDayTitle : 'MMMM', + } + $scope.datePickerIsOpen = false; + $scope.$watch('dt', function(newVal, oldVal) { + if (newVal != oldVal) { + $scope.day = ('00' + $scope.dt.getDate() ).slice(-2); + $scope.month = ('00' + ($scope.dt.getMonth() + 1)).slice(-2); + } + }); +}] + } +}) -- 2.11.0