admin: on pki page, press enter to associate certificate
This commit is contained in:
parent
3f692984c7
commit
d093f3670b
@ -659,6 +659,23 @@ angular.module("FICApp")
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.validateSearch = function(keyEvent) {
|
||||||
|
if (keyEvent.which === 13) {
|
||||||
|
var myCertificate = null;
|
||||||
|
$scope.certificates.forEach(function(certificate) {
|
||||||
|
if (String(certificate.id).indexOf($scope.query.toUpperCase()) >= 0) {
|
||||||
|
if (myCertificate === null)
|
||||||
|
myCertificate = certificate;
|
||||||
|
else
|
||||||
|
myCertificate = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (myCertificate && myCertificate.id_team == null) {
|
||||||
|
$('#associationModal').data('certificate', myCertificate.id)
|
||||||
|
$('#associationModal').modal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
$scope.validatePKIForm = function(keyEvent) {
|
$scope.validatePKIForm = function(keyEvent) {
|
||||||
if (keyEvent.which === 13)
|
if (keyEvent.which === 13)
|
||||||
$scope.associate()
|
$scope.associate()
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" autofocus></p>
|
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" ng-keypress="validateSearch($event)" autofocus></p>
|
||||||
<table class="table table-hover table-bordered table-striped table-sm">
|
<table class="table table-hover table-bordered table-striped table-sm">
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
@ -81,15 +81,23 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form ng-submit="associate()">
|
<form ng-submit="associate()">
|
||||||
<div class="modal-body row">
|
<div class="modal-body">
|
||||||
<label for="tteam" class="col-md-auto col-form-label">Équipe</label>
|
<div class="form-group row">
|
||||||
<div class="col-md-auto">
|
<label for="tcert" class="col-md-3 col-form-label">Certificate</label>
|
||||||
<select class="custom-select custom-select-sm" id="tteam" ng-model="selectedTeam" ng-options="t.id as t.name for t in teams" ng-keypress="validatePKIForm($event)"></select>
|
<div class="col-md-9">
|
||||||
|
<input type="text" readonly class="form-control-plaintext" id="tcert">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="tteam" class="col-md-3 col-form-label">Équipe</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<select class="custom-select custom-select-sm" id="tteam" ng-model="selectedTeam" ng-options="t.id as t.name for t in teams" ng-keypress="validatePKIForm($event)"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Associer</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
|
||||||
<button type="submit" class="btn btn-primary">Associer</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -104,7 +112,13 @@
|
|||||||
var serial = button.data('certificate');
|
var serial = button.data('certificate');
|
||||||
|
|
||||||
var modal = $(this);
|
var modal = $(this);
|
||||||
modal.data('certificate', serial);
|
|
||||||
|
if (serial) {
|
||||||
|
modal.data('certificate', serial);
|
||||||
|
}
|
||||||
|
if (modal.data('certificate')) {
|
||||||
|
$("#tcert").val(modal.data('certificate'))
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user