</div>
<div>
+ <div class="pad-vert">
+ <button class="btn btn-warning" ng-click="startNewScap()">[% l('Add New') %]</button>
+ <button class="btn btn-warning" ng-click="importScapFromBibRecord()">[% l('Import from Bibliographic and/or MFHD Records') %]</button>
+ </div>
+ <div ng-if="new_prediction">
+ <ng-form name="new_prediction.predform" class="form-inline">
+ <div class="col-md-1"><label>[% l('ID') %] {{new_prediction.id}}</label></div>
+ <div class="col-md-1">
+ <label class="checkbox-inline">
+ <input type="checkbox" ng-model="new_prediction.active">[% l('Active') %]
+ </label>
+ </div>
+ <div class="col-md-2">
+ <label>[% l('Start Date') %]</label>
+ {{new_prediction.create_date | date:"shortDate"}}
+ </div>
+ <div class="col-md-3">
+ <label>[% l('Type') %]</label>
+ <select ng-model="new_prediction.type">
+ <option value="basic">[% l('Basic') %]</option>
+ <option value="supplement">[% l('Supplement') %]</option>
+ <option value="index">[% l('Index') %]</option>
+ </select>
+ <button class="btn btn-default" ng-click="openPatternEditorDialog(new_prediction)">[% l('Create Pattern') %]</button>
+ </div>
+ <div>
+ <button type="submit" class="btn btn-primary" ng-disabled="!new_prediction.predform.$dirty" ng-click="createScap(new_prediction)">[% l('Create') %]</button>
+ </div>
+ </form>
+ </div>
+ <h3>[% l('Existing Prediction Patterns') %]</h3>
<div class="row" ng-repeat="pred in predictions | orderBy: 'id' as filtered track by pred.id">
<ng-form name="pred.predform" class="form-inline">
<div class="col-md-1"><label>[% l('ID') %] {{pred.id}}</label></div>
if (newVal && newVal != oldVal) reload(newVal);
});
+ $scope.createScap = function(pred) {
+ var scap = egCore.idl.fromTypedHash(pred);
+ egCore.pcrud.create(scap).then(function() {
+ // completely reset the model in order to reset the
+ // forms; causes a blink, alas
+ $scope.predictions = [];
+ $scope.new_prediction = null;
+ egSerialsCoreSvc.fetch($scope.bibId).then(function() {
+ reload($scope.ssubId);
+ });
+ });
+ }
$scope.updateScap = function(pred) {
var scap = egCore.idl.fromTypedHash(pred);
egCore.pcrud.update(scap).then(function() {
});
}
+ $scope.startNewScap = function() {
+ $scope.new_prediction = egCore.idl.toTypedHash(new egCore.idl.scap());
+ $scope.new_prediction.type = 'basic';
+ $scope.new_prediction.active = true;
+ $scope.new_prediction.create_date = new Date();
+ $scope.new_prediction.subscription = $scope.ssubId;
+ $scope.new_pred = {};
+ }
+
+ $scope.importScapFromBibRecord = function() {
+ }
+
$scope.openPatternEditorDialog = function(pred) {
$uibModal.open({
templateUrl: './serials/t_pattern_editor_dialog',