webstaff: add another option for choosing volume transfer library
authorGalen Charlton <gmc@esilibrary.com>
Tue, 20 Oct 2015 20:08:44 +0000 (20:08 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:52 +0000 (14:58 -0500)
The actions menu on the holdings view now has two ways of
specifying a library to transfer volumes to:

 * Library as Volume Transfer Destination

   Pops up a modal with a library selector.

 * Library from Selection as Volume Transfer Destination

   Uses the currently selected volume's owning
   library to specify the target library.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/cat/catalog/t_choose_vol_target_lib.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_choose_vol_target_lib.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_choose_vol_target_lib.tt2
new file mode 100644 (file)
index 0000000..74e02c0
--- /dev/null
@@ -0,0 +1,25 @@
+<form ng-submit="ok(org)" role="form">
+    <div class="modal-header">
+      <button type="button" class="close" ng-click="cancel()" 
+        aria-hidden="true">&times;</button>
+      <h4 class="modal-title">[% l('Choose volume transfer target') %]</h4>
+    </div>
+    <div class="modal-body">
+      <div class="row">
+        <div class="col-md-6">
+            <b>[% l('Target library:') %]</b>
+        </div>
+        <div class="col-md-6">
+            <eg-org-selector selected="org" disable-test="cant_have_vols"></eg-org-selector>
+        </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>
index e1eaa08..85d212d 100644 (file)
@@ -55,6 +55,8 @@
       label="[% l('Item as Missing') %]"></eg-grid-action>
     <eg-grid-action handler="markLibAsVolTarget" group="[% l('Mark') %]"
       label="[% l('Library as Volume Transfer Destination') %]"></eg-grid-action>
+    <eg-grid-action handler="markLibFromSelectedAsVolTarget" group="[% l('Mark') %]"
+      label="[% l('Library from Selection as Volume Transfer Destination') %]"></eg-grid-action>
     <eg-grid-action handler="markVolAsItemTarget" group="[% l('Mark') %]" disabled="vols_not_shown"
       label="[% l('Volume as Item Transfer Destination') %]"></eg-grid-action>
 
index 36e8a8b..bb3abda 100644 (file)
@@ -978,6 +978,31 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
     }
 
     $scope.markLibAsVolTarget = function() {
+        return $modal.open({
+            templateUrl: './cat/catalog/t_choose_vol_target_lib',
+            animation: true,
+            controller:
+                   ['$scope','$modalInstance',
+            function($scope , $modalInstance) {
+
+                var orgId = egCore.hatch.getLocalItem('eg.cat.volume_transfer_target') || 1;
+                $scope.org = egCore.org.get(orgId);
+                $scope.cant_have_vols = function (id) { return !egCore.org.CanHaveVolumes(id); };
+                $scope.ok = function(org) {
+                    egCore.hatch.setLocalItem(
+                        'eg.cat.volume_transfer_target',
+                        org.id()
+                    );
+                    $modalInstance.close();
+                }
+                $scope.cancel = function($event) {
+                    $modalInstance.dismiss();
+                    $event.preventDefault();
+                }
+            }]
+        });
+    }
+    $scope.markLibFromSelectedAsVolTarget = function() {
         egCore.hatch.setLocalItem(
             'eg.cat.volume_transfer_target',
             $scope.holdingsGridControls.selectedItems()[0].owner_id