1 angular.module('egCoreMod')
3 .factory('egPatronMerge',
4 ['$uibModal','$q','egCore',
5 function($uibModal , $q , egCore) {
9 service.do_merge = function(patron_ids) {
10 var deferred = $q.defer();
12 templateUrl: './circ/share/t_merge_patrons',
15 windowClass: 'eg-wide-modal',
17 ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) {
19 $scope.patron_ids = patron_ids;
20 $scope.ok = function() {
21 $uibModalInstance.close({ lead_id : $scope.lead_id });
23 $scope.cancel = function () { $uibModalInstance.dismiss() }
25 }).result.then(function (args) {
26 if (args.lead_id == 0) return;
27 var sub_id = (args.lead_id == patron_ids[0]) ?
32 'open-ils.actor.user.merge',
36 ).then(function(resp) {
37 var evt = egCore.evt.parse(resp);
47 return deferred.promise;
54 .directive('egPatronSummary', ['egUser','patronSvc', function(egUser, patronSvc) {
58 templateUrl : './circ/patron/t_summary',
64 function($scope , egCore) {
67 egUser.get($scope.patronId).then(function(u) {
69 patronSvc.localFlesh(user);
71 patronSvc.getUserStats($scope.patronId).then(function(s) {
74 $scope.patron = function() {
77 $scope.patron_stats = function() {
81 // show/obscure DOB logic copied from the circ patron app
82 $scope._show_dob = {};
83 $scope.show_dob = function (val) {
84 if ($scope.patron()) {
85 if (typeof val != 'undefined') $scope._show_dob[$scope.patron().id()] = val;
86 return $scope._show_dob[$scope.patron().id()];
88 return !egCore.env.aous['circ.obscure_dob'];
91 $scope.obscure_dob = function() {
92 return egCore.env.aous && egCore.env.aous['circ.obscure_dob'];
94 $scope.now_show_dob = function() {
95 return egCore.env.aous && egCore.env.aous['circ.obscure_dob'] ?
96 $scope.show_dob() : true;
99 // needed because this directive shares a template with
100 // the patron summary in circ app, but the circ app
101 // displays the patron name elsewhere.
102 $scope.show_name = function() {