--- /dev/null
+<div class="form-inline row" ng-show="!have_template">
+ <div class="col-xs-6">
+ <div class="form-group">
+ <label for="select-marc-template" class="control-label">[% l('Select MARC template') %]</label>
+ <select id="select-marc-template" class="form-control" ng-model="template_name" ng-options="name as name for name in template_list"></select>
+ </div>
+ <button class="btn btn-primary" ng-click="loadTemplate()">[% l('Load') %]</button>
+ <button class="btn btn-default" ng-click="setDefaultTemplate()">[% l('Set Workstation Default') %]</button>
+ </div>
+</div>
+<div ng-show="have_template" class="row col-md-12">
+ <eg-marc-edit-record dirty-flag="stop_unload" record_id="new_bib_id" marc-xml="marc_template" record-type="bre" />
+</div>
resolve : resolver
});
+ $routeProvider.when('/cat/catalog/new_bib', {
+ templateUrl: './cat/catalog/t_new_bib',
+ controller: 'NewBibCtrl',
+ resolve : resolver
+ });
+
// create some catalog page-specific mappings
$routeProvider.when('/cat/catalog/record/:record_id', {
templateUrl: './cat/catalog/t_catalog',
}])
+.controller('NewBibCtrl',
+ ['$scope','$routeParams','$location','$window','$q','egCore',
+ 'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc',
+function($scope , $routeParams , $location , $window , $q , egCore) {
+
+ $scope.have_template = false;
+ $scope.marc_template = '';
+ $scope.stop_unload = false;
+ $scope.template_list = [];
+ $scope.template_name = '';
+ $scope.new_bib_id = 0;
+
+ egCore.net.request(
+ 'open-ils.cat',
+ 'open-ils.cat.marc_template.types.retrieve'
+ ).then(function(resp) {
+ angular.forEach(resp, function(name) {
+ $scope.template_list.push(name);
+ });
+ $scope.template_list.sort();
+ });
+ egCore.hatch.getItem('cat.default_bib_marc_template').then(function(template) {
+ $scope.template_name = template;
+ });
+
+ $scope.loadTemplate = function() {
+ if ($scope.template_name) {
+ egCore.net.request(
+ 'open-ils.cat',
+ 'open-ils.cat.biblio.marc_template.retrieve',
+ $scope.template_name
+ ).then(function(template) {
+ $scope.marc_template = template;
+ $scope.have_template = true;
+ });
+ }
+ }
+
+ $scope.setDefaultTemplate = function() {
+ var hatch_key = "cat.default_bib_marc_template";
+ if ($scope.template_name) {
+ egCore.hatch.setItem(hatch_key, $scope.template_name);
+ } else {
+ egCore.hatch.removeItem(hatch_key);
+ }
+ }
+
+ $scope.$watch('new_bib_id', function(newVal, oldVal) {
+ if (newVal) {
+ $location.path('/cat/catalog/record/' + $scope.new_bib_id);
+ }
+ });
+
+
+}])
+
.controller('CatalogCtrl',
['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc',
'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc',