webstaff: add basic frequency inputs
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 2 May 2017 18:37:08 +0000 (14:37 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 2 May 2017 18:37:08 +0000 (14:37 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2
Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js

index 2635f0e..2ab95cc 100644 (file)
     </uib-tab>
     <uib-tab index="3" disable="tab.active != 3" heading="[% l('Frequency and Regularity') %]">
       <div class="row">
+        <div class="col-md-2">
+          <div class="radio">
+            <label>
+              <input type="radio" ng-model="pattern.frequency_type" value="preset">
+              [% l('Pre-selected') %]
+            </label>
+          </div>
+          <div class="radio">
+            <label>
+              <input type="radio" ng-model="pattern.frequency_type" value="numeric">
+              [% l('Use number of issues per year') %]
+            </label>
+          </div>
+        </div>
+        <div class="col-md-2">
+          <div ng-if="pattern.frequency_type == 'preset'">
+            <select ng-model="pattern.frequency_preset">
+              <option value="d">[% l('Daily') %]</option>
+              <option value="w">[% l('Weekly (Weekly)') %]</option>
+              <option value="c">[% l('2 x per week (Semiweekly)') %]</option>
+              <option value="i">[% l('3 x per week (Three times a week)') %]</option>
+              <option value="e">[% l('Every two weeks (Biweekly)') %]</option>
+              <option value="m">[% l('Monthly') %]</option>
+              <option value="s">[% l('2 x per month (Semimonthly)') %]</option>
+              <option value="j">[% l('3 x per month (Three times a month)') %]</option>
+              <option value="b">[% l('Every other month (Bimonthly)') %]</option>
+              <option value="q">[% l('Quarterly') %]</option>
+              <option value="f">[% l('2 x per year (Semiannual)') %]</option>
+              <option value="t">[% l('3 x per year (Three times a year)') %]</option>
+              <option value="a">[% l('Yearly (Annual)') %]</option>
+              <option value="g">[% l('Every other year (Biennial)') %]</option>
+              <option value="h">[% l('Every three years (Triennial)') %]</option>
+              <option value="x">[% l('Completely irregular') %]</option>
+              <option value="k">[% l('Continuously updated') %]</option>
+            </select>
+          </div>
+          <div ng-if="pattern.frequency_type == 'numeric'">
+            <input ng-model="pattern.frequency_numeric" type="number" step="1">
+          </div>
+        </div>
+      </div>
+      <div class="row">
         <button class="btn btn-warning pull-left" ng-click="tab.active = tab.active - 1">
             [% l('Back') %]
         </button>
index 7e6a46c..8437f18 100644 (file)
@@ -32,6 +32,7 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) {
         this.alt_enum_levels = [];
         this.chron_levels = [];
         this.alt_chron_levels = [];
+        this.frequency_type = 'preset';
 
         var nr_sf_map = {
             '0' : 'link',
@@ -189,6 +190,15 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) {
                 }
             }
         }
+        if (self.frequency) {
+            if (self.frequency.match(/^\d+$/)) {
+                self.frequency_type = 'numeric';
+                self.frequency_numeric = self.frequency;
+            } else {
+                self.frequency_type = 'preset';
+                self.frequency_preset = self.frequency;
+            }
+        }
 
         this.add_enum_level = function() {
             if (self.enum_levels.length < 6) {