--- /dev/null
+<div class="modal-header">
+ <button type="button" class="close" ng-click="cancel()"
+ aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Add To Bucket') %]</h4>
+</div>
+<div class="modal-body">
+ <div class="row">
+ <div class="form-inline">
+ <div class="form-gruop">
+ <label for="select-bucket">[% l('Copy this record into which bucket?') %]</label>
+ <select id="select-bucket" class="form-control" ng-model="bucket_id"
+ ng-options="bucket.name() for bucket in allBuckets track by bucket.id()">
+ </select>
+ <button class="btn btn-primary" ng-class="{disabled : !bucket_id}"
+ ng-click="add_to_bucket()">[% l('Add To Selected Bucket') %]</button>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="form-inline">
+ <div class="form-gruop">
+ <label for="new-bucket-name">[% l('Name For New Bucket') %]</label>
+ <input type="text" class="form-control" id="new-bucket-name" ng-model="newBucketName" />
+ <button class="btn btn-primary" ng-class="{disabled : !newBucketName}"
+ ng-click="add_to_new_bucket()">[% l('Add To New Bucket') %]</button>
+ </div>
+ </div>
+ </div>
+</div>
+<div class="modal-footer">
+ <div class="col-md-6 pull-right">
+ <button class="btn btn-warning" ng-click="cancel($event)">[% l('Cancel') %]</button>
+ </div>
+</div>
}
}
+ $scope.add_to_record_bucket = function() {
+ var recId = $scope.record_id;
+ return $modal.open({
+ templateUrl: './cat/catalog/t_add_to_bucket',
+ animation: true,
+ size: 'md',
+ controller:
+ ['$scope','$modalInstance',
+ function($scope , $modalInstance) {
+
+ $scope.bucket_id = 0;
+ $scope.newBucketName = '';
+ $scope.allBuckets = [];
+ egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.container.retrieve_by_class.authoritative',
+ egCore.auth.token(), egCore.auth.user().id(),
+ 'biblio', 'staff_client'
+ ).then(function(buckets) { $scope.allBuckets = buckets; });
+
+ $scope.add_to_bucket = function() {
+ var item = new egCore.idl.cbrebi();
+ item.bucket($scope.bucket_id);
+ item.target_biblio_record_entry(recId);
+ egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.container.item.create',
+ egCore.auth.token(), 'biblio', item
+ ).then(function(resp) {
+ $modalInstance.close();
+ });
+ }
+
+ $scope.add_to_new_bucket = function() {
+ var bucket = new egCore.idl.cbreb();
+ bucket.owner(egCore.auth.user().id());
+ bucket.name($scope.newBucketName);
+ bucket.description('');
+ bucket.btype('staff_client');
+
+ egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.container.create',
+ egCore.auth.token(), 'biblio', bucket
+ ).then(function(bucket) {
+ $scope.bucket_id = bucket;
+ $scope.add_to_bucket();
+ });
+ }
+
+ $scope.cancel = function() {
+ $modalInstance.dismiss();
+ }
+ }]
+ });
+ }
+
$scope.stop_unload = false;
$scope.$watch('stop_unload',
function(newVal, oldVal) {