webstaff: more work on the regularity UI
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 2 May 2017 21:59:37 +0000 (17:59 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:40 +0000 (12:06 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js

index beb2b15..8cb0546 100644 (file)
@@ -306,11 +306,42 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) {
                 self.chron_levels.pop();
             }
         }
+        this.add_regularity = function() {
+            self.regularity.push({
+                regularity_type : null,
+                chron_type : null,
+                parts : [{ sub_type : null }]
+            });
+        }
+        this.remove_regularity = function(idx) {
+            if (self.regularity.length > idx) {
+                self.regularity.splice(idx, 1);
+            }
+            // and add a blank entry back if need be
+            if (self.regularity.length == 0) {
+                self.add_regularity();
+            }
+        }
+        this.add_regularity_part = function(reg) {
+            reg.parts.push({
+                sub_type : null
+            });
+        }
+        this.remove_regularity_part = function(reg, idx) {
+            if (reg.parts.length > idx) {
+                reg.parts.splice(idx, 1);
+            }
+            // and add a blank entry back if need be
+            if (reg.parts.length == 0) {
+                self.add_regularity_part(reg);
+            }
+        }
+
     }
     // TODO chron only
 
     // dummy pattern
-    $scope.pattern = new PredictionPattern(["3","0","8","1","a","v.","b","no.","u","6","v","r","g","sequence","i","(year)","j","month","m","(day)","w","m","x","06,12"]);
+    $scope.pattern = new PredictionPattern(["3","0","8","1","a","v.","b","no.","u","6","v","r","g","sequence","i","(year)","j","month","m","(day)","w","m","x","06,12","y","pw02we","y","ow0402th,0501"]);
     console.debug($scope.pattern);
 }]
     }