webstaff: Add the beginnings of copy attribute editing
authorMike Rylander <mrylander@gmail.com>
Mon, 17 Aug 2015 20:14:58 +0000 (16:14 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:20 +0000 (13:39 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 4889e7c..113fb74 100644 (file)
 
 <style> input[type=number] { width: 50px } </style>
 <style> select { width: 80px } </style>
-<div class="container-fluid">
-    <div class="row">
-        <div class="col-xs-1">[% l('Library') %]</div>
-        <div class="col-xs-1">[% l('Volumes') %]</div>
-        <div class="col-xs-10">
-            <div class="container-fluid">
-                <div class="row">
-                    <div class="col-xs-1">[% l('Classification') %]</div>
-                    <div class="col-xs-1">[% l('Prefix') %]</div>
-                    <div class="col-xs-3">[% l('Call Number') %]</div>
-                    <div class="col-xs-1">[% l('Suffix') %]</div>
-                    <div class="col-xs-1">[% l('Copies') %]</div>
-                    <div class="col-xs-5">
-                        <div class="container-fluid">
-                            <div class="row">
-                                <div class="col-xs-6">[% l('Barcode') %]</div>
-                                <div class="col-xs-3">[% l('Copy #') %]</div>
-                                <div class="col-xs-3">[% l('Part') %]</div>
+
+<accordion close-others="false">
+    <accordion-group heading="Volume Editor" is-open="show_vols">
+
+        <div collapse="hide_vols" class="container-fluid">
+            <div class="row">
+                <div class="col-xs-1">[% l('Library') %]</div>
+                <div class="col-xs-1">[% l('Volumes') %]</div>
+                <div class="col-xs-10">
+                    <div class="container-fluid">
+                        <div class="row">
+                            <div class="col-xs-1">[% l('Classification') %]</div>
+                            <div class="col-xs-1">[% l('Prefix') %]</div>
+                            <div class="col-xs-3">[% l('Call Number') %]</div>
+                            <div class="col-xs-1">[% l('Suffix') %]</div>
+                            <div class="col-xs-1">[% l('Copies') %]</div>
+                            <div class="col-xs-5">
+                                <div class="container-fluid">
+                                    <div class="row">
+                                        <div class="col-xs-6">[% l('Barcode') %]</div>
+                                        <div class="col-xs-3">[% l('Copy #') %]</div>
+                                        <div class="col-xs-3">[% l('Part') %]</div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div> <!-- row -->
+            <eg-vol-edit ng-repeat="(lib,callnumbers) in data" record="{{record.id()}}" lib="{{lib}}" struct="data[lib]"></eg-vol-edit>
+        </div> <!-- container -->
+
+    </accordion-group>
+    <accordion-group heading="Copy Editor" is-open="show_copies">
+
+    <div collapse="hide_vols" class="container-fluid">
+        <div class="row">
+            <div class="col-lg-4">
+
+                <eg-grid
+                  id-field="id"
+                  idl-class="acp"
+                  features="startSelected,-pagination,-actions,-menu,-picker,-index"
+                  main-label="[% l('Working Copies') %]"
+                  items-provider="workingGridDataProvider"
+                  grid-controls="workingGridControls"
+                  persist-key="cat.volcopy.copies">
+                
+                  <eg-grid-field label="[% l('Barcode') %]"     path='barcode' visible></eg-grid-field>
+                  <eg-grid-field label="[% l('Created') %]"     path="create_date" visible></eg-grid-field>
+                  <eg-grid-field label="[% l('Activated') %]"   path="active_date" visible></eg-grid-field>
+                  <eg-grid-field label="[% l('Call Number') %]" path="call_number.label" visible></eg-grid-field>
+                
+                </eg-grid>
+
+            </div>
+            <div class="col-lg-8">
+                <div class="container-fluid">
+                    <div class="row">
+
+                        <div class="col-md-4">
+                            <div class="container-fluid"> <!-- first column -->
+                                <div class="row">
+                                    <div class="col-md-12">
+                                        <b>[% l('Circulate?') %]</b>
+                                    </div>
+                                </div>
+                                <div class="row">
+                                    <div class="col-md-12">
+                                        <div class="container-fluid"> <!-- circulate? -->
+                                            <div class="row">
+                                                <div class="col-xs-6">
+                                                    <label>
+                                                        <input type="radio" ng-model="working.circulate" value="t"/>
+                                                        [% l('Yes') %]
+                                                    </label>
+                                                </div>
+                                                <div class="col-xs-6">
+                                                    <label>
+                                                        <input type="radio" ng-model="working.circulate" value="f"/>
+                                                        [% l('No') %]
+                                                    </label>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="col-md-4">
+                            <div class="container-fluid"> <!-- second column -->
+                                <div class="row">
+                                    <div class="col-md-12">
+                                        <b>[% l('Status') %]</b>
+                                    </div>
+                                </div>
+                                <div class="row">
+                                    <div class="col-md-12">
+                                        <select
+                                            ng-model="working.status"
+                                            ng-change="updateWorkingStatus()"
+                                            ng-options="s.name() for s in status_list track by idTracker(s)"
+                                        ></select>
+                                    </div>
+                                </div>
                             </div>
                         </div>
+
+                        <div class="col-md-4">
+                            <div class="container-fluid"> <!-- third column -->
+                                <div class="row">
+                                    <div class="col-md-12">
+                                        <b>[% l('Statistical Catagories') %]</b>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
                     </div>
                 </div>
             </div>
         </div>
-    </div> <!-- row -->
-    <eg-vol-edit ng-repeat="(lib,callnumbers) in data" record="{{record.id()}}" lib="{{lib}}" struct="data[lib]"></eg-vol-edit>
-</div> <!-- container -->
+    </div>
+
+    </accordion-group>
+</accordion>
index a754e3e..8da67ee 100644 (file)
@@ -76,6 +76,19 @@ function(egCore , $q) {
 
     };
 
+    service.get_statuses = function() {
+        if (egCore.env.ccs)
+            return $q.when(egCore.env.ccs.list);
+
+        return egCore.pcrud.retrieveAll('ccs', {}, {atomic : true}).then(
+            function(list) {
+                egCore.env.absorbList(list, 'ccs');
+                return list;
+            }
+        );
+
+    };
+
     service.bmp_parts = {};
     service.get_parts = function(rec) {
         if (service.bmp_parts[rec])
@@ -94,14 +107,9 @@ function(egCore , $q) {
     service.flesh = {   
         flesh : 3, 
         flesh_fields : {
-            acp : ['call_number','parts'],
+            acp : ['call_number','parts','location'],
             acn : ['label_class','prefix','suffix']
-        },
-        select : { 
-            // avoid fleshing MARC on the bre
-            // note: don't add simple_record.. not sure why
-            bre : ['id','tcn_value','creator','editor'],
-        } 
+        }
     }
 
     service.addCopy = function (cp) {
@@ -146,8 +154,8 @@ function(egCore , $q) {
             function ( $scope , itemSvc ) {
                 $scope.new_part_id = 0;
 
-                $scope.updateBarcode = function () { $scope.copy.barcode($scope.barcode) };
-                $scope.updateCopyNo = function () { $scope.copy.copy_number($scope.copy_number) };
+                $scope.updateBarcode = function () { $scope.copy.barcode($scope.barcode); $scope.copy.ischanged(1); };
+                $scope.updateCopyNo = function () { $scope.copy.copy_number($scope.copy_number); $scope.copy.ischanged(1); };
                 $scope.updatePart = function () {
                     var p = angular.filter($scope.part_list, function (x) {
                         return x.label() == $scope.part
@@ -161,6 +169,7 @@ function(egCore , $q) {
                         part.label( $scope.part );
                         part.record( $scope.callNumber.owning_lib() );
                         $scope.copy.parts([part]);
+                        $scope.copy.ischanged(1);
                     }
                 }
 
@@ -223,26 +232,26 @@ function(egCore , $q) {
                 itemSvc.get_suffixes($scope.callNumber.owning_lib()).then(function(list){
                     $scope.suffix_list = list;
                 });
-                $scope.updateSuffix = function () { $scope.callNumber.suffix($scope.suffix) };
+                $scope.updateSuffix = function () { $scope.callNumber.suffix($scope.suffix); $scope.callNumber.ischanged(1); };
 
                 $scope.prefix_list = [];
                 itemSvc.get_prefixes($scope.callNumber.owning_lib()).then(function(list){
                     $scope.prefix_list = list;
                 });
-                $scope.updatePrefix = function () { $scope.callNumber.prefix($scope.prefix) };
+                $scope.updatePrefix = function () { $scope.callNumber.prefix($scope.prefix); $scope.callNumber.ischanged(1); };
 
                 $scope.classification_list = [];
                 itemSvc.get_classifications().then(function(list){
                     $scope.classification_list = list;
                 });
-                $scope.updateClassification = function () { $scope.callNumber.label_class($scope.classification) };
+                $scope.updateClassification = function () { $scope.callNumber.label_class($scope.classification); $scope.callNumber.ischanged(1); };
 
                 $scope.classification = $scope.callNumber.label_class();
                 $scope.prefix = $scope.callNumber.prefix();
                 $scope.suffix = $scope.callNumber.suffix();
 
                 $scope.label = $scope.callNumber.label();
-                $scope.updateLabel = function () { $scope.callNumber.label($scope.label) };
+                $scope.updateLabel = function () { $scope.callNumber.label($scope.label); $scope.callNumber.ischanged(1); };
 
                 $scope.copy_count = $scope.copies.length;
                 $scope.orig_copy_count = $scope.copy_count;
@@ -341,35 +350,60 @@ function(egCore , $q) {
        ['$scope','$q','$routeParams','$location','$timeout','egCore','egNet','egGridDataProvider','itemSvc',
 function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc) {
 
+    $scope.show_vols = true;
+    $scope.show_copies = true;
+
+    $scope.idTracker = function (x) { if (x) return x.id() };
+
     $timeout(function(){
 
     var dataKey = $routeParams.dataKey;
     console.debug('dataKey: ' + dataKey);
 
     if (dataKey && dataKey.length > 0) {
+        $scope.working = {};
+
         $scope.tab = 'edit';
         $scope.summaryRecord = null;
         $scope.record_id = null;
         $scope.data = {};
 
-        $scope.gridDataProvider = egGridDataProvider.instance({
+        $scope.workingGridDataProvider = egGridDataProvider.instance({
             get : function(offset, count) {
                 //return provider.arrayNotifier(itemSvc.copies, offset, count);
                 return this.arrayNotifier(itemSvc.copies, offset, count);
             }
         });
 
+        $scope.workingGridControls = {};
+
         egNet.request(
             'open-ils.actor',
             'open-ils.actor.anon_cache.get_value',
             dataKey, 'edit-these-copies'
         ).then(function (data) {
+
+            if (data.hide_vols) $scope.show_vols = false;
+            if (data.hide_copies) $scope.show_copies = false;
+
             $scope.record_id = data.record_id;
+
             return itemSvc.fetchIds(data.copies);
         }).then( function() {
             $scope.data = itemSvc.tree;
-            $scope.gridDataProvider.refresh();
+            $scope.workingGridDataProvider.refresh();
+        });
+
+        $scope.status_list = [];
+        itemSvc.get_statuses().then(function(list){
+            $scope.status_list = list;
         });
+        $scope.updateWorkingStatus = function () {
+            angular.forEach(
+                $scope.workingGridControls.selectedItems(),
+                function (cp) { cp.status($scope.working.status.id()); cp.ischanged(1); }
+            );
+        };
     }
 
     });