<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>
+++ /dev/null
-
-<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>
-
-[% INCLUDE 'staff/cat/item/summary_header.tt2' %]
+<eg-record-summary record="summaryRecord"></eg-record-summary>
<!-- tabbed copy data view -->
--- /dev/null
+<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>
+
</div>
-<!-- TODO item summary -->
-
<!-- set a lower default page size (limit) to allow for more space -->
<hr/>
<eg-grid
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
--- /dev/null
+/**
+ * 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();
+ }
+ ]
+ }
+})
+++ /dev/null
-/**
- * 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();
- }
- ]
- }
-});
var service = {};
+ // fetch a fleshed money.billable_xact
service.fetchXact = function(xact_id) {
return egCore.pcrud.retrieve('mbt', {
flesh : 5,
);
}
+ // 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);
});
}
+ // create a new grocery xact
service.createGroceryXact = function(args) {
var groc = new egCore.idl.mg();
groc.billing_location(egCore.auth.user().ws_ou());
});
}
+ // fetch the org-focused billing types
+ // Cache on egEnv
service.fetchBillingTypes = function() {
if (egCore.env.cbt)
return $q.when(egCore.env.cbt.list);
});
}
+ // create a patron billing
service.createBilling = function(xact_id, args) {
var bill = new egCore.idl.mb();
bill.xact(xact_id);
}
+ // 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