billing docs/fixes; moving rec out to service
authorBill Erickson <berick@esilibrary.com>
Mon, 9 Jun 2014 15:31:57 +0000 (11:31 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 9 Jun 2014 15:31:57 +0000 (11:31 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/cat/item/index.tt2
Open-ILS/src/templates/staff/cat/item/summary_header.tt2 [deleted file]
Open-ILS/src/templates/staff/cat/item/t_view.tt2
Open-ILS/src/templates/staff/cat/share/t_record_summary.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/t_xact_details.tt2
Open-ILS/web/js/ui/default/staff/cat/item/app.js
Open-ILS/web/js/ui/default/staff/cat/services/record.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/cat/services/record_html.js [deleted file]
Open-ILS/web/js/ui/default/staff/circ/services/billing.js

index af7f795..61f063d 100644 (file)
@@ -10,7 +10,7 @@
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/file.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/item/app.js"></script>
-<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record_html.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record.js"></script>
 [% END %]
 
 <style>
diff --git a/Open-ILS/src/templates/staff/cat/item/summary_header.tt2 b/Open-ILS/src/templates/staff/cat/item/summary_header.tt2
deleted file mode 100644 (file)
index 64a8300..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-
-<div class="flex-container-striped flex-container-bordered"
-  ng-hide="context.itemNotFound">
-  <div class="flex-row">
-    <div class="flex-cell strong-text">[% l('Title:') %]</div>
-    <div class="flex-cell flex-2">
-      {{copy.call_number().record().simple_record().title() || copy.dummy_title()}}
-    </div>
-
-    <div class="flex-cell strong-text">[% l('Edition:') %]</div>
-    <div class="flex-cell"><!-- FIXME: no edition field on simple record --></div>
-
-    <div class="flex-cell strong-text">[% l('TCN:') %]</div>
-    <div class="flex-cell">{{copy.call_number().record().tcn_value()}}</div>
-
-    <div class="flex-cell strong-text">[% l('Created By:') %]</div>
-    <div class="flex-cell">{{copy.call_number().record().creator().usrname()}}</div>
-  </div><!-- flex-row -->
-
-  <div class="flex-row">
-    <div class="flex-cell strong-text">[% l('Author:') %]</div>
-    <div class="flex-cell flex-2">
-      {{copy.call_number().record().simple_record().author() || copy.dummy_author()}}
-    </div>
-
-    <div class="flex-cell strong-text">[% l('Pub Date:') %]</div>
-    <div class="flex-cell">
-      {{copy.call_number().record().simple_record().pubdate()}}
-    </div>
-
-    <div class="flex-cell strong-text">[% l('Databse ID:') %]</div>
-    <div class="flex-cell">{{copy.call_number().record().id()}}</div>
-
-    <div class="flex-cell strong-text">[% l('Last Edited By:') %]</div>
-    <div class="flex-cell">{{copy.call_number().record().editor().usrname()}}</div>
-  </div><!-- flex-row -->
-
-  <div class="flex-row">
-    <div class="flex-cell strong-text">[% l('Bib Call #:') %]</div>
-    <div class="flex-cell flex-2"><!-- FIXME: no bib call no on simple rec --></div>
-
-    <div class="flex-cell strong-text">[% l('Item Call #:') %]</div>
-    <div class="flex-cell">{{copy.call_number().label()}}</div>
-
-    <div class="flex-cell strong-text">[% l('Record Owner:') %]</div>
-    <div class="flex-cell">{{copy.call_number().record().owner().shortname()}}</div>
-
-    <div class="flex-cell strong-text">[% l('Last Edited On:') %]</div>
-    <div class="flex-cell">{{copy.edit_date() | date:'short'}}</div>
-  </div><!-- flex-row -->
-</div>
-
index 124ff16..e449591 100644 (file)
@@ -1,4 +1,4 @@
-[% INCLUDE 'staff/cat/item/summary_header.tt2' %]
+<eg-record-summary record="summaryRecord"></eg-record-summary>
 
 <!-- tabbed copy data view -->
 
diff --git a/Open-ILS/src/templates/staff/cat/share/t_record_summary.tt2 b/Open-ILS/src/templates/staff/cat/share/t_record_summary.tt2
new file mode 100644 (file)
index 0000000..c5066dd
--- /dev/null
@@ -0,0 +1,48 @@
+<div class="strong-text-2">[% l('Record Summary') %]</div>
+
+<div class="flex-container-striped flex-container-bordered">
+  <div class="flex-row">
+    <div class="flex-cell strong-text">[% l('Title:') %]</div>
+    <div class="flex-cell flex-2">{{record.simple_record().title()}}</div>
+
+    <div class="flex-cell strong-text">[% l('Edition:') %]</div>
+    <div class="flex-cell"><!-- FIXME: no edition field on simple record --></div>
+
+    <div class="flex-cell strong-text">[% l('TCN:') %]</div>
+    <div class="flex-cell">{{record.tcn_value()}}</div>
+
+    <div class="flex-cell strong-text">[% l('Created By:') %]</div>
+    <div class="flex-cell">{{record.creator().usrname()}}</div>
+  </div><!-- flex-row -->
+
+  <div class="flex-row">
+    <div class="flex-cell strong-text">[% l('Author:') %]</div>
+    <div class="flex-cell flex-2">{{record.simple_record().author()}}</div>
+
+    <div class="flex-cell strong-text">[% l('Pub Date:') %]</div>
+    <div class="flex-cell">
+      {{record.simple_record().pubdate()}}
+    </div>
+
+    <div class="flex-cell strong-text">[% l('Databse ID:') %]</div>
+    <div class="flex-cell">{{record.id()}}</div>
+
+    <div class="flex-cell strong-text">[% l('Last Edited By:') %]</div>
+    <div class="flex-cell">{{record.editor().usrname()}}</div>
+  </div><!-- flex-row -->
+
+  <div class="flex-row">
+    <div class="flex-cell strong-text">[% l('Bib Call #:') %]</div>
+    <div class="flex-cell flex-2"><!-- FIXME: no bib call no on simple rec --></div>
+
+    <div class="flex-cell strong-text"></div>
+    <div class="flex-cell"></div>
+
+    <div class="flex-cell strong-text">[% l('Record Owner:') %]</div>
+    <div class="flex-cell">{{record.owner().shortname()}}</div>
+
+    <div class="flex-cell strong-text">[% l('Last Edited On:') %]</div>
+    <div class="flex-cell">{{record.edit_date() | date:'short'}}</div>
+  </div><!-- flex-row -->
+</div>
+
index 078b9f1..1d11369 100644 (file)
 </div>
 
 
-<!-- TODO item summary -->
-
 <!-- set a lower default page size (limit) to allow for more space -->
 <hr/>
 <eg-grid
index 980714a..2ac0b09 100644 (file)
@@ -248,6 +248,7 @@ function($scope , $q, $location , $routeParams , egCore , itemSvc) {
             copyId = copy.id();
             $scope.copy = copy;
             $scope.recordId = copy.call_number().record().id();
+            $scope.summaryRecord = copy.call_number().record();
             $scope.args.barcode = '';
 
             // locally flesh org units
diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/record.js b/Open-ILS/web/js/ui/default/staff/cat/services/record.js
new file mode 100644 (file)
index 0000000..0dbc251
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * Simple directive for rending the HTML view of a bib record.
+ *
+ * <eg-record-html record-id="myRecordIdScopeVariable"></eg-record-id>
+ *
+ * The value of myRecordIdScopeVariable is watched internally and the 
+ * record is updated to match.
+ */
+angular.module('egCoreMod')
+
+.directive('egRecordHtml', function() {
+    return {
+        restrict : 'AE',
+        scope : {recordId : '='},
+        link : function(scope, element, attrs) {
+            scope.element = angular.element(element);
+
+            // kill refs to destroyed DOM elements
+            element.bind("$destroy", function() {
+                delete scope.element;
+            });
+        },
+        controller : 
+                   ['$scope','egCore',
+            function($scope , egCore) {
+
+                function loadRecordHtml() {
+                    egCore.net.request(
+                        'open-ils.search',
+                        'open-ils.search.biblio.record.html',
+                        $scope.recordId
+                    ).then(function(html) {
+                        if (!html) return;
+
+                        // Remove those pesky non-i8n labels / actions.
+                        // Note: for printing, use the browser print page
+                        // option.  The end result is the same.
+                        html = html.replace(
+                            /<button onclick="window.print(.*?)<\/button>/,'');
+                        html = html.replace(/<title>(.*?)<\/title>/,'');
+
+                        // remove reference to nonexistant CSS file
+                        html = html.replace(/<link(.*?)\/>/,'');
+
+                        $scope.element.html(html);
+                    });
+                }
+
+                $scope.$watch('recordId', 
+                    function(newVal, oldVal) {
+                        if (newVal && newVal !== oldVal) {
+                            loadRecordHtml();
+                        }
+                    }
+                );
+
+                if ($scope.recordId) 
+                    loadRecordHtml();
+            }
+        ]
+    }
+})
+
+.directive('egRecordSummary', function() {
+    return {
+        restrict : 'AE',
+        scope : {
+            recordId : '=',
+            record : '='
+        },
+        templateUrl : '/eg/staff/cat/share/t_record_summary', // FIXME: ABS URL
+        controller : 
+                   ['$scope','egCore',
+            function($scope , egCore) {
+
+                function loadRecord() {
+                    egCore.pcrud.retrieve('bre', $scope.recordId, {
+                        flesh : 1,
+                        flesh_fields : {
+                            bre : ['simple_record']
+                        }
+                    }).then(function(rec) {
+                        $scope.record = rec;
+                    });
+                }
+
+                $scope.$watch('recordId', 
+                    function(newVal, oldVal) {
+                        if (newVal && newVal !== oldVal) {
+                            loadRecord();
+                        }
+                    }
+                );
+
+                if ($scope.recordId) 
+                    loadRecord();
+            }
+        ]
+    }
+})
diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/record_html.js b/Open-ILS/web/js/ui/default/staff/cat/services/record_html.js
deleted file mode 100644 (file)
index 5aeff5a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Simple directive for rending the HTML view of a bib record.
- *
- * <eg-record-html record-id="myRecordIdScopeVariable"></eg-record-id>
- *
- * The value of myRecordIdScopeVariable is watched internally and the 
- * record is updated to match.
- */
-angular.module('egCoreMod')
-
-.directive('egRecordHtml', function() {
-    return {
-        restrict : 'AE',
-        scope : {recordId : '='},
-        link : function(scope, element, attrs) {
-            scope.element = angular.element(element);
-
-            // kill refs to destroyed DOM elements
-            element.bind("$destroy", function() {
-                delete scope.element;
-            });
-        },
-        controller : 
-                   ['$scope','egCore',
-            function($scope , egCore) {
-
-                function loadRecordHtml() {
-                    egCore.net.request(
-                        'open-ils.search',
-                        'open-ils.search.biblio.record.html',
-                        $scope.recordId
-                    ).then(function(html) {
-                        if (!html) return;
-
-                        // Remove those pesky non-i8n labels / actions.
-                        // Note: for printing, use the browser print page
-                        // option.  The end result is the same.
-                        html = html.replace(
-                            /<button onclick="window.print(.*?)<\/button>/,'');
-                        html = html.replace(/<title>(.*?)<\/title>/,'');
-
-                        // remove reference to nonexistant CSS file
-                        html = html.replace(/<link(.*?)\/>/,'');
-
-                        $scope.element.html(html);
-                    });
-                }
-
-                $scope.$watch('recordId', 
-                    function(newVal, oldVal) {
-                        if (newVal && newVal !== oldVal) {
-                            loadRecordHtml();
-                        }
-                    }
-                );
-
-                if ($scope.recordId) 
-                    loadRecordHtml();
-            }
-        ]
-    }
-});
index 4f10f8f..57fe012 100644 (file)
@@ -11,6 +11,7 @@ function($modal , $q , egCore , egUser) {
 
     var service = {};
 
+    // fetch a fleshed money.billable_xact
     service.fetchXact = function(xact_id) {
         return egCore.pcrud.retrieve('mbt', {
             flesh : 5,
@@ -26,6 +27,8 @@ function($modal , $q , egCore , egUser) {
         );
     }
 
+    // apply a patron billing.  If no xact is provided, a grocery xact is
+    // created.
     service.billPatron = function(args, xact) {
         // apply a billing to an existing transaction
         if (xact) return service.createBilling(xact.id, args);
@@ -37,6 +40,7 @@ function($modal , $q , egCore , egUser) {
         });
     }
 
+    // create a new grocery xact
     service.createGroceryXact = function(args) {
         var groc = new egCore.idl.mg();
         groc.billing_location(egCore.auth.user().ws_ou());
@@ -57,6 +61,8 @@ function($modal , $q , egCore , egUser) {
         });
     }
 
+    // fetch the org-focused billing types
+    // Cache on egEnv
     service.fetchBillingTypes = function() {
         if (egCore.env.cbt) 
             return $q.when(egCore.env.cbt.list);
@@ -74,6 +80,7 @@ function($modal , $q , egCore , egUser) {
         });
     }
 
+    // create a patron billing
     service.createBilling = function(xact_id, args) {
         var bill = new egCore.idl.mb();
         bill.xact(xact_id);
@@ -98,6 +105,8 @@ function($modal , $q , egCore , egUser) {
     }
 
 
+    // Show the billing dialog.  
+    // Allows users to select amount, billing type, and note.
     // args:
     //   xact OR xact_id : if null, creates a grocery xact
     //   patron OR patron_id