--- /dev/null
+<form ng-submit="ok(args)" role="form">
+ <div class="modal-header">
+ <button type="button" class="close" ng-click="cancel()"
+ aria-hidden="true">×</button>
+ <h4 class="modal-title">[% l('Patron Barcodes') %]</h4>
+ </div>
+ <div class="modal-body patron-reg-barcodes">
+ <div class="row header">
+ <div class="col-md-4">
+ <label>[% l('Barcode') %]</label>
+ </div>
+ <div class="col-md-4">
+ <label>[% l('Active') %]</label>
+ </div>
+ <div class="col-md-4">
+ <label>[% l('Primary') %]</label>
+ </div>
+ </div>
+ <div class="row" ng-repeat="card in args.cards">
+ <div class="col-md-4">{{card.barcode}}</div>
+ <div class="col-md-4">
+ <input type='checkbox' ng-model='card.active'/>
+ </div>
+ <div class="col-md-4">
+ <input type='radio' name='primary' value='on' ng-model='card._primary'/>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" class="btn btn-primary" value="[% l('Apply Changes') %]"/>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+ </div> <!-- modal-content -->
+</form>
function(field) { patron[field] = patron[field] == 't'; }
);
+ angular.forEach(patron.cards, function(card) {
+ card.active = card.active == 't'
+ if (card.id == patron.card.id)
+ card._primary = 'on';
+ });
+
angular.forEach(patron.addresses,
function(addr) { service.ingest_address(patron, addr) });
function PatronRegCtrl($scope, $routeParams,
- $q, egCore, patronSvc, patronRegSvc) {
+ $q, $modal, egCore, patronSvc, patronRegSvc) {
$scope.clone_id = $routeParams.clone_id;
}
$scope.post_code_changed = function(addr) {
- console.log('post code ' + addr.post_code);
egCore.net.request(
'open-ils.search', 'open-ils.search.zip', addr.post_code)
.then(function(resp) {
if (resp.alert) alert(resp.alert);
});
}
+
+ $scope.cards_dialog = function() {
+ $modal.open({
+ templateUrl: './circ/patron/t_patron_cards_dialog',
+ controller:
+ ['$scope','$modalInstance','cards',
+ function($scope , $modalInstance , cards) {
+ // scope here is the modal-level scope
+ $scope.args = {cards : cards};
+ $scope.ok = function() { $modalInstance.close($scope.args) }
+ $scope.cancel = function () { $modalInstance.dismiss() }
+ }],
+ resolve : {
+ cards : function() {
+ // scope here is the controller-level scope
+ return $scope.patron.cards;
+ }
+ }
+ }).result.then(
+ function(args) {
+ angular.forEach(args.cards, function(card) {
+ card.ischanged = true; // assume cards need updating, OK?
+ if (card._primary == 'on' &&
+ card.id != $scope.patron.card.id) {
+ $scope.patron.card = card;
+ }
+ });
+ }
+ );
+ }
+
}