--- /dev/null
+<form ng-submit="ok(type)" role="form">
+ <div class="modal-header">
+ <button type="button" class="close" ng-click="cancel()"
+ aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Attach conjoined items') %]</h4>
+ </div>
+ <div class="modal-body">
+ <div class="row">
+ <div class="col-md-6">
+ <b>[% l('Peer Type:') %]</b>
+ </div>
+ <div class="col-md-6">
+ <select class="form-control" ng-options="t.id() as t.name() for t in peer_type_list" ng-model="type"></select>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <div class="row">
+ <div class="col-md-12 pull-right">
+ <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
+ <button class="btn btn-warning" ng-click="cancel($event)">[% l('Cancel') %]</button>
+ </div>
+ </div>
+ </div>
+</form>
<eg-grid-action handler="requestItems"
label="[% l('Request Items') %]"></eg-grid-action>
+ <eg-grid-action handler="attach_to_peer_bib"
+ label="[% l('Link as Conjoined to Previously Marked Bib Record') %]"></eg-grid-action>
<eg-grid-action handler="selectedHoldingsItemStatus" group="[% l('Show') %]"
label="[% l('Item Status (list)') %]"></eg-grid-action>
});
}
+ $scope.attach_to_peer_bib = function() {
+ var copy_list = gatherSelectedHoldingsIds();
+ if (copy_list.length == 0) return;
+
+ egCore.hatch.getItem('eg.cat.marked_conjoined_record').then(function(target_record) {
+ if (!target_record) return;
+
+ return $modal.open({
+ templateUrl: './cat/catalog/t_conjoined_selector',
+ animation: true,
+ controller:
+ ['$scope','$modalInstance',
+ function($scope , $modalInstance) {
+ $scope.peer_type = null;
+ $scope.peer_type_list = [];
+ holdingsSvc.get_peer_types().then(function(list){
+ $scope.peer_type_list = list;
+ });
+
+ $scope.ok = function(type) {
+ var promises = [];
+
+ angular.forEach(copy_list, function (cp) {
+ var n = new egCore.idl.bpbcm();
+ n.isnew(true);
+ n.peer_record(target_record);
+ n.target_copy(cp);
+ n.peer_type(type);
+ promises.push(egCore.pcrud.create(n));
+ });
+
+ return $q.all(promises).then(function(){$modalInstance.close()});
+ }
+
+ $scope.cancel = function($event) {
+ $modalInstance.dismiss();
+ $event.preventDefault();
+ }
+ }]
+ });
+ });
+ }
+
// ------------------------------------------------------------------
// Holds
);
}
+ // returns a promise resolved with the list of peer bib types
+ service.get_peer_types = function() {
+ if (egCore.env.bpt)
+ return $q.when(egCore.env.bpt.list);
+
+ return egCore.pcrud.retrieveAll('bpt', null, {atomic : true})
+ .then(function(list) {
+ egCore.env.absorbList(list, 'bpt');
+ return list;
+ });
+ };
+
return service;
}])