webstaff: Supply a "defaults" interface for disabling element and setting call number...
authorMike Rylander <mrylander@gmail.com>
Fri, 21 Aug 2015 17:11:49 +0000 (13:11 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:16 +0000 (15:44 -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_attr_edit.tt2
Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2
Open-ILS/src/templates/staff/cat/volcopy/t_view.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 509a3da..92a9abe 100644 (file)
                     <div class="row">
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.circulate" value="t"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.circulate" ng-model="working.circulate" value="t"/>
                                 [% l('Yes') %]
                             </label>
                         </div>
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.circulate" value="f"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.circulate" ng-model="working.circulate" value="f"/>
                                 [% l('No') %]
                             </label>
                         </div>
@@ -65,7 +65,7 @@
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.status !== undefined}">
                     <select class="form-control"
-                        ng-model="working.status"
+                        ng-disabled="!defaults.attributes.status" ng-model="working.status"
                         ng-options="s.id() as s.name() for s in status_list"
                     ></select>
                 </div>
                     <div class="row">
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.ref" value="t"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.ref" ng-model="working.ref" value="t"/>
                                 [% l('Yes') %]
                             </label>
                         </div>
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.ref" value="f"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.ref" ng-model="working.ref" value="f"/>
                                 [% l('No') %]
                             </label>
                         </div>
             <div class="row">
                 <div class="col-md-6" ng-class="{'bg-success': working.location !== undefined}">
                     <select class="form-control"
-                        ng-model="working.location"
+                        ng-disabled="!defaults.attributes.location" ng-model="working.location"
                         ng-options="l.id() as l.name() for l in location_list"
                     ></select>
                 </div>
                     <div class="row">
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.opac_visible" value="t"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.opac_visible" ng-model="working.opac_visible" value="t"/>
                                 [% l('Yes') %]
                             </label>
                         </div>
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.opac_visible" value="f"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.opac_visible" ng-model="working.opac_visible" value="f"/>
                                 [% l('No') %]
                             </label>
                         </div>
             <div class="row">
                 <div class="col-md-6" ng-class="{'bg-success': working.circ_modifier !== undefined}">
                     <select class="form-control"
-                        ng-model="working.circ_modifier"
+                        ng-disabled="!defaults.attributes.circ_modifier" ng-model="working.circ_modifier"
                         ng-options="m.code() as m.name() for m in circ_modifier_list"
                     >
                         <option value="">[% l('<NONE>') %]</option>
                     </select>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.price !== undefined}">
-                    <input class="form-control" ng-model="working.price" type="text"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.price" ng-model="working.price" type="text"/>
                 </div>
             </div>
 
 
             <div class="row">
                 <div class="col-md-6" ng-class="{'bg-success': working.loan_duration !== undefined}">
-                    <select class="form-control" ng-model="working.loan_duration">
+                    <select class="form-control" ng-disabled="!defaults.attributes.loan_duration" ng-model="working.loan_duration">
                         <option value="1">[% l('Short') %]</option>
                         <option value="2" selected>[% l('Normal') %]</option>
                         <option value="3">[% l('Extended') %]</option>
                     </select>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.cost !== undefined}">
-                    <input class="form-control" ng-model="working.cost" type="text"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.cost" ng-model="working.cost" type="text"/>
                 </div>
             </div>
 
             <div class="row">
                 <div class="col-md-6" ng-class="{'bg-success': working.circ_as_type !== undefined}">
                     <select class="form-control"
-                        ng-model="working.circ_as_type"
+                        ng-disabled="!defaults.attributes.circ_as_type" ng-model="working.circ_as_type"
                         ng-options="t.code() as t.value() for t in circ_type_list"
                     ></select>
                 </div>
                     <div class="row">
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.deposit" value="t"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.deposit" ng-model="working.deposit" value="t"/>
                                 [% l('Yes') %]
                             </label>
                         </div>
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.deposit" value="f"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.deposit" ng-model="working.deposit" value="f"/>
                                 [% l('No') %]
                             </label>
                         </div>
                     <div class="row">
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.holdable" value="t"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.holdable" ng-model="working.holdable" value="t"/>
                                 [% l('Yes') %]
                             </label>
                         </div>
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.holdable" value="f"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.holdable" ng-model="working.holdable" value="f"/>
                                 [% l('No') %]
                             </label>
                         </div>
                     </div>
                 </div>
                 <div class="col-md-6" ng-class="{'bg-success': working.deposit_amount !== undefined}">
-                    <input class="form-control" ng-model="working.deposit_amount" type="text"/>
+                    <input class="form-control" ng-disabled="!defaults.attributes.deposit_amount" ng-model="working.deposit_amount" type="text"/>
                 </div>
             </div>
 
             <div class="row">
                 <div class="col-md-6" ng-class="{'bg-success': working.age_protect !== undefined}">
                     <select class="form-control"
-                        ng-model="working.age_protect"
+                        ng-disabled="!defaults.attributes.age_protect" ng-model="working.age_protect"
                         ng-options="a.id() as a.name() for a in age_protect_list"
                     ></select>
                 </div>
                     <div class="row">
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.mint_condition" value="t"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.mint_condition" ng-model="working.mint_condition" value="t"/>
                                 [% l('Good') %]
                             </label>
                         </div>
                         <div class="col-xs-3">
                             <label>
-                                <input type="radio" ng-model="working.mint_condition" value="f"/>
+                                <input type="radio" ng-disabled="!defaults.attributes.mint_condition" ng-model="working.mint_condition" value="f"/>
                                 [% l('Damaged') %]
                             </label>
                         </div>
 
             <div class="row">
                 <div class="col-md-6" ng-class="{'bg-success': working.fine_level !== undefined}">
-                    <select class="form-control" ng-model="working.fine_level">
+                    <select class="form-control" ng-disabled="!defaults.attributes.fine_level" ng-model="working.fine_level">
                         <option value="1">[% l('Low') %]</option>
                         <option value="2" selected>[% l('Normal') %]</option>
                         <option value="3">[% l('High') %]</option>
diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2
new file mode 100644 (file)
index 0000000..9f74e13
--- /dev/null
@@ -0,0 +1,291 @@
+<div class="container-fluid">
+    <div class="row">
+        <div class="col-md-3">
+            <div class="row">
+                <div class="col-xs-12">
+                    <h4>[% l('Volume/Copy Detail defaults') %]</h4>
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.always_volumes"/>
+                        [% l('Always display Volume/Copy Detail pane') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-12">
+                    <h4 class="pad-vert">[% l('Creation Defaults') %]</h4>
+                    <select class="form-control" ng-change="saveDefaults()" ng-model="defaults.classification" ng-options="cl.id() as cl.name() for cl in classification_list">
+                        <option value="">Unset Default Classification Scheme</option>
+                    </select>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-12">
+                    <select class="form-control" ng-change="saveDefaults()" ng-model="defaults.prefix" ng-options="p.id() as p.label() for p in prefix_list">
+                        <option value="">Unset Default Prefix</option>
+                    </select>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-12">
+                    <select class="form-control" ng-change="saveDefaults()" ng-model="defaults.suffix" ng-options="s.id() as s.label() for s in suffix_list">
+                        <option value="">Unset Default Suffix</option>
+                    </select>
+                </div>
+            </div>
+
+            <div class="row pad-vert">
+                <div class="col-xs-12">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.auto_gen_barcode"/>
+                        [% l('Auto-generate Barcodes') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-12">
+                    <label style="padding-left: 25px">
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.barcode_checkdigit"/>
+                        [% l('Use checkdigit') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row pad-vert">
+                <div class="col-xs-12">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.print_spine_labels"/>
+                        [% l('Print Spine Labels') %]
+                    </label>
+                </div>
+            </div>
+
+        </div>
+
+        <div class="col-md-5">
+            <div class="row">
+                <div class="col-xs-12">
+                    <h4>[% l('Display defaults for Working Copy tab') %]</h4>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <h6>[% l('Copy display') %]</h6>
+                </div>
+                <div class="col-xs-6">
+                    <h6>[% l('Miscellaneous') %]</h6>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="workingGridControls.saveConfig()" ng-model="workingGridControls.columnMap()['active_date'].visible"/>
+                        [% l('Activated') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.alerts"/>
+                        [% l('Alerts') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="workingGridControls.saveConfig()" ng-model="workingGridControls.columnMap()['create_date'].visible"/>
+                        [% l('Created') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.deposit"/>
+                        [% l('Deposit?') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="workingGridControls.saveConfig()" ng-model="workingGridControls.columnMap()['call_number.label'].visible"/>
+                        [% l('Call Number') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.deposit_amount"/>
+                        [% l('Deposit Amount') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.opac_visible"/>
+                        [% l('OPAC Visible?') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <h6>[% l('Circulation') %]</h6>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.price"/>
+                        [% l('Price') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.circulate"/>
+                        [% l('Circulate?') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.mint_condition"/>
+                        [% l('Quality') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.circ_lib"/>
+                        [% l('Circulation Library') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.ref"/>
+                        [% l('Reference?') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.circ_modifier"/>
+                        [% l('Circulation Modifier') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.cost"/>
+                        [% l('Cost') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.circ_as_type"/>
+                        [% l('Circulate as Type') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.status"/>
+                        [% l('Status') %]
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.loan_duration"/>
+                        [% l('Loan Duration') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.fine_level"/>
+                        [% l('Fine Level') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <h6>[% l('Statistical Categories') %]</h6>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.location"/>
+                        [% l('Shelving Location') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                    <label>
+                        <eg-org-selector selected="defaults.statcats.org_filter" noDefault label="[% l('Default Filter Library') %]" disableTest="cant_have_vols"></eg-org-selector>
+                    </label>
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.holdable"/>
+                        [% l('Holdable?') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                </div>
+            </div>
+
+            <div class="row">
+                <div class="col-xs-6">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.attributes.age_protect"/>
+                        [% l('Age-based Hold Protection') %]
+                    </label>
+                </div>
+                <div class="col-xs-6">
+                </div>
+            </div>
+
+        </div>
+
+        <div class="col-md-4">
+            <div class="row">
+                <div class="col-xs-12">
+                    <h4>[% l('Display defaults for Completed Copies tab') %]</h4>
+                </div>
+            </div>
+
+            <div class="row" ng-repeat="col in completedGridControls.columnsProvider().columns">
+                <div class="col-xs-12">
+                    <label>
+                        <input ng-change="completedGridControls.saveConfig()" type="checkbox" ng-model="col.visible"/>
+                        {{col.label}}
+                    </label>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>        
index 7eefe82..c663610 100644 (file)
             <div class="col-xs-10">
                 <div class="row">
                     <div class="col-xs-2">
-                        <select class="form-control" ng-model="batch.classification" ng-options="cl.id() as cl.name() for cl in classification_list">
-                        </select>
+                        <select class="form-control" ng-model="batch.classification" ng-options="cl.id() as cl.name() for cl in classification_list"></select>
                     </div>
                     <div class="col-xs-1">
-                        <select class="form-control" ng-model="batch.prefix" ng-options="p.id() as p.label() for p in prefix_list">
-                        </select>
+                        <select class="form-control" ng-model="batch.prefix" ng-options="p.id() as p.label() for p in prefix_list"></select>
                     </div>
                     <div class="col-xs-2">
                         <input class="form-control" type="text" ng-model="batch.label"/>
                     </div>
                     <div class="col-xs-1">
-                        <select class="form-control" ng-model="batch.suffix" ng-options="s.id() as s.label() for s in suffix_list">
-                        </select>
+                        <select class="form-control" ng-model="batch.suffix" ng-options="s.id() as s.label() for s in suffix_list"></select>
                     </div>
                     <div class="col-xs-1"></div>
                     <div class="col-xs-5">
index cbaa192..0379fad 100644 (file)
     <div ng-show="tab == 'templates'">
       <eg-vol-template></eg-vol-template>
     </div>
-<!--
     <div ng-show="tab == 'defaults'">
-      <div ng-include="'[% ctx.base_path %]/staff/cat/volcopy/t_'+tab"></div>
+      <div ng-include="'[% ctx.base_path %]/staff/cat/volcopy/t_defaults'"></div>
     </div>
--->
   </div>
 </div>
 
index 92d2366..27498fc 100644 (file)
@@ -482,6 +482,47 @@ function(egCore , $q) {
        ['$scope','$q','$routeParams','$location','$timeout','egCore','egNet','egGridDataProvider','itemSvc',
 function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc) {
 
+    $scope.defaults = { // If defaults are not set at all, allow everything
+        attributes : {
+            status : true,
+            loan_duration : true,
+            fine_level : true,
+            cost : true,
+            alerts : true,
+            deposit : true,
+            deposit_amount : true,
+            opac_visible : true,
+            price : true,
+            circulate : true,
+            mint_condition : true,
+            circ_lib : true,
+            ref : true,
+            circ_modifier : true,
+            circ_as_type : true,
+            location : true,
+            holdable : true,
+            age_protect : true
+        }
+    };
+
+    $scope.saveDefaults = function () {
+        egCore.hatch.setItem('cat.copy.defaults', $scope.defaults);
+    }
+
+    $scope.fetchDefaults = function () {
+        egCore.hatch.getItem('cat.copy.defaults').then(function(t) {
+            if (t) {
+                $scope.defaults = t;
+                if (!$scope.batch) $scope.batch = {};
+                $scope.batch.classification = $scope.defaults.classification;
+                $scope.batch.prefix = $scope.defaults.prefix;
+                $scope.batch.suffix = $scope.defaults.suffix;
+                if ($scope.defaults.always_vols) $scope.show_vols = true;
+            }
+        });
+    }
+    $scope.fetchDefaults();
+
     $scope.dirty = false;
 
     $scope.show_vols = true;
@@ -577,7 +618,7 @@ function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , eg
         $scope.completed_copies = [];
         $scope.location_orgs = [];
         $scope.location_cache = {};
-        $scope.batch = {};
+        if (!$scope.batch) $scope.batch = {};
 
         $scope.applyBatchCNValues = function () {
             if ($scope.data.tree) {
@@ -630,7 +671,7 @@ function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , eg
         ).then(function (data) {
 
             if (data) {
-                if (data.hide_vols) $scope.show_vols = false;
+                if (data.hide_vols && !$scope.defaults.always_vols) $scope.show_vols = false;
                 if (data.hide_copies) $scope.show_copies = false;
 
                 $scope.record_id = data.record_id;
@@ -769,6 +810,38 @@ function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , eg
         controller : ['$scope','itemSvc','egCore',
             function ( $scope , itemSvc , egCore ) {
 
+                $scope.defaults = { // If defaults are not set at all, allow everything
+                    attributes : {
+                        status : true,
+                        loan_duration : true,
+                        fine_level : true,
+                        cost : true,
+                        alerts : true,
+                        deposit : true,
+                        deposit_amount : true,
+                        opac_visible : true,
+                        price : true,
+                        circulate : true,
+                        mint_condition : true,
+                        circ_lib : true,
+                        ref : true,
+                        circ_modifier : true,
+                        circ_as_type : true,
+                        location : true,
+                        holdable : true,
+                        age_protect : true
+                    }
+                };
+
+                $scope.fetchDefaults = function () {
+                    egCore.hatch.getItem('cat.copy.defaults').then(function(t) {
+                        if (t) {
+                            $scope.defaults = t;
+                        }
+                    });
+                }
+                $scope.fetchDefaults();
+
                 $scope.dirty = false;
                 $scope.template_controls = true;