webstaff: create serials distribution/stream grid
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 17 Apr 2017 21:46:05 +0000 (17:46 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 17 Apr 2017 21:46:05 +0000 (17:46 -0400)
TODO: move most of this to a separate directive

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/serials/index.tt2
Open-ILS/src/templates/staff/serials/t_manage.tt2
Open-ILS/web/js/ui/default/staff/serials/app.js

index 9eaa08f..bbb73ac 100644 (file)
@@ -6,6 +6,7 @@
 
 [% BLOCK APP_JS %]
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/grid.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/serials/services/core.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/serials/app.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record.js"></script>
 
index bbd82da..78d7112 100644 (file)
@@ -9,6 +9,50 @@
            otherwise selecting the active table won't work cleanly -->
       <uib-tab index="'create-subscription'" heading="[% l('Create Subscription') %]">
         <p>Create Subscription TODO</p>
+<!-- TODO: move the grid to a separate template file -->
+<div>
+  <eg-grid
+    id-field="index"
+    features="-display,-sort,-multisort"
+    items-provider="distStreamGridDataProvider"
+    grid-controls="distStreamGridControls"
+    persist-key="serials.dist_stream_grid">
+
+    <eg-grid-action handler="apply_receiving_template"
+      label="[% l('Apply Receiving Template') %]"></eg-grid-action>
+    <eg-grid-action handler="apply_binding_template"
+      label="[% l('Apply Binding Template') %]"></eg-grid-action>
+    <eg-grid-action handler="additional_routing"
+      label="[% l('Additional Routing') %]"></eg-grid-action>
+    <eg-grid-action handler="link_mfhd"
+      label="[% l('Link MFHD') %]"></eg-grid-action>
+    <eg-grid-action handler="edit_offsets"
+      label="[% l('Edit Offets') %]"></eg-grid-action>
+    <eg-grid-action handler="clone_subscription"
+      label="[% l('Clone Subscription') %]"></eg-grid-action>
+
+    <eg-grid-field label="[% l('Owning Library') %]" path="owning_lib.name" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Distribution Library') %]" path="sdist.holding_lib.name" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Distribution Label') %]" path="sdist.label" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Copy Stream') %]" path="sstr.id" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Offset') %]" path="expected_date_offset" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Start Date') %]" path="start_date" datatype="timestamp" visible></eg-grid-field>
+    <eg-grid-field label="[% l('End Date') %]" path="end_date" datatype="timestamp" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Route To') %]" path="sstr.routing_label" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Additional Routing') %]" path="sstr.additional_routing" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Receiving Template') %]" path="sdist.receive_unit_template.name" visible></eg-grid-field>
+    <eg-grid-field label="[% l('MFHD ID') %]" path="sdist.record_entry" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Summary Display') %]" path="sdist.summary_method" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Receiving Call Number') %]" path="sdist.receive_call_number.label"></eg-grid-field>
+    <eg-grid-field label="[% l('Binding Call Number') %]" path="sdist.bind_call_number.label"></eg-grid-field>
+    <eg-grid-field label="[% l('Binding Template') %]" path="sdist.bind_unit_template.name"></eg-grid-field>
+    <eg-grid-field label="[% l('Unit Label Prefix') %]" path="sdist.unit_label_prefix"></eg-grid-field>
+    <eg-grid-field label="[% l('Unit Label Suffix') %]" path="sdist.unit_label_suffix"></eg-grid-field>
+    <eg-grid-field label="[% l('Display Grouping') %]" path="sdist.display_grouping"></eg-grid-field>
+    <eg-grid-field label="[% l('Subscription ID') %]" path="id"></eg-grid-field>
+    <eg-grid-field label="[% l('Distribution ID') %]" path="sdist.id"></eg-grid-field>
+  </eg-grid>
+</div>
       </uib-tab>
       <uib-tab index="'prediction'" heading="[% l('Manage Predictions') %]">
         <p>Frequency TODO</p>
index 5936333..636f710 100644 (file)
@@ -1,4 +1,4 @@
-angular.module('egSerialsApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod','ngToast'])
+angular.module('egSerialsApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod','ngToast','egSerialsMod'])
 
 .config(['ngToastProvider', function(ngToastProvider) {
   ngToastProvider.configure({
@@ -27,9 +27,22 @@ angular.module('egSerialsApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod'
 })
 
 .controller('ManageCtrl',
-       ['$scope','$routeParams','$location','$window','$q',
-function($scope , $routeParams , $location , $window , $q
+       ['$scope','$routeParams','$location','$window','$q','egSerialsCoreSvc','egCore',
+        'egGridDataProvider',
+function($scope , $routeParams , $location , $window , $q , egSerialsCoreSvc , egCore ,
+         egGridDataProvider
 ) {
     $scope.bib_id = $routeParams.bib_id;
     $scope.active_tab = $routeParams.active_tab ?  $routeParams.active_tab : 'create-subscription';
+    egSerialsCoreSvc.fetch($scope.bib_id).then(function() {
+    });
+    $scope.distStreamGridControls = {
+        activateItem : function (item) { } // TODO
+    };
+    $scope.distStreamGridDataProvider = egGridDataProvider.instance({
+        get : function(offset, count) {
+            return this.arrayNotifier(egSerialsCoreSvc.subList, offset, count);
+        }
+    });
+
 }])