From 7afe3f8ddc737a0dbc42eb383948e1c07bf8ec38 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 5 May 2017 13:14:50 -0400 Subject: [PATCH] webstaff: update review pane to display pattern summary Signed-off-by: Galen Charlton --- .../templates/staff/serials/t_pattern_summary.tt2 | 48 ++++++++++++++++++++++ .../staff/serials/t_prediction_wizard.tt2 | 25 ++++++++++- .../staff/serials/directives/prediction_wizard.js | 42 ++++++++++++++++++- 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/templates/staff/serials/t_pattern_summary.tt2 diff --git a/Open-ILS/src/templates/staff/serials/t_pattern_summary.tt2 b/Open-ILS/src/templates/staff/serials/t_pattern_summary.tt2 new file mode 100644 index 0000000000..ce985560e3 --- /dev/null +++ b/Open-ILS/src/templates/staff/serials/t_pattern_summary.tt2 @@ -0,0 +1,48 @@ +
+
+ [% l('Enumeration captions:') %] + {{pattern.display_enum_captions()}} +
+
+ [% l('Alternative enumeration captions:') %] + {{pattern.display_alt_enum_captions()}} +
+
+ [% l('Chronology captions:') %] + {{pattern.display_chron_captions()}} +
+
+ [% l('Alternative chronology captions:') %] + {{pattern.display_alt_chron_captions()}} +
+
+ [% l('Frequency:') %] + + + [% l('Daily') %] + [% l('Weekly (Weekly)') %] + [% l('2 x per week (Semiweekly)') %] + [% l('3 x per week (Three times a week)') %] + [% l('Every two weeks (Biweekly)') %] + [% l('Monthly') %] + [% l('2 x per month (Semimonthly)') %] + [% l('3 x per month (Three times a month)') %] + [% l('Every other month (Bimonthly)') %] + [% l('Quarterly') %] + [% l('2 x per year (Semiannual)') %] + [% l('3 x per year (Three times a year)') %] + [% l('Yearly (Annual)') %] + [% l('Every other year (Biennial)') %] + [% l('Every three years (Triennial)') %] + [% l('Completely irregular') %] + [% l('Continuously updated') %] + + + + [% l('[_1] issues per year', '{{pattern.frequency_numeric}}') %] + +
+
+ [% l('Specifies regularity adjustments') %] +
+
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 0a4e33e54b..6a30a1182f 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 @@ -416,7 +416,30 @@
- Pattern code: {{pattern.compile()}} +
+ [% l('Raw Pattern Code') %] + + + + + + +
+
+
{{pattern.compile_stringify()}}
+
+
+
+
+ [% l('Pattern Summary') %] +
+
+ +
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 01e8e3bfbe..ff370fc76b 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 @@ -357,7 +357,11 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { patternCode.push(val); }); } - return JSON.stringify(patternCode); + return patternCode; + } + + this.compile_stringify = function() { + return JSON.stringify(this.compile(), null, 2); } this.add_enum_level = function() { @@ -447,6 +451,26 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { } } + this.display_enum_captions = function() { + return self.enum_levels.map(function(lvl) { + return lvl.caption; + }).join(', '); + } + this.display_alt_enum_captions = function() { + return self.alt_enum_levels.map(function(lvl) { + return lvl.caption; + }).join(', '); + } + this.display_chron_captions = function() { + return self.chron_levels.map(function(lvl) { + return lvl.caption; + }).join(', '); + } + this.display_alt_chron_captions = function() { + return self.alt_chron_levels.map(function(lvl) { + return lvl.caption; + }).join(', '); + } } // TODO chron only @@ -557,3 +581,19 @@ function($scope , $q) { }] } }) + +.directive('egPredictionPatternSummary', function() { + return { + transclude: true, + restrict: 'E', + scope: { + pattern : '<' + }, + templateUrl: './serials/t_pattern_summary', + controller: + ['$scope','$q', +function($scope , $q) { +}] + } +}) + -- 2.11.0