Commit 73ffeeae authored by Charlotte Bataille's avatar Charlotte Bataille
Browse files

feat/19663 : work in progress

parent 79f81f50
Pipeline #18491 failed with stages
in 33 seconds
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<div class="col-sm-9"> <div class="col-sm-9">
<select class="form-control archiveInput" name="archivalProfileReference" id="archivalProfile"> <select class="form-control archiveInput" name="archivalProfileReference" id="archivalProfile">
</select> </select>
<input type="hidden" id="archivalProfileToEdit" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
...@@ -568,13 +569,12 @@ ...@@ -568,13 +569,12 @@
} }
} }
$("#originatorOrgRegNumber").on('change', changeOriginator()); $("#originatorOrgRegNumber").on('change', function() {
function changeOriginator() {
var archivalProfile = $('#archivalProfile'); var archivalProfile = $('#archivalProfile');
archivalProfile.empty(); archivalProfile.empty();
var option = $('<option/>').val("").text("").appendTo(archivalProfile); var option = $('<option/>').val("").text("").appendTo(archivalProfile);
var originatorOrgRegNumber = $("#archiveForm").find("[name=originatorOrgRegNumber]").val(); var originatorOrgRegNumber = $("#archiveForm").find("[name=originatorOrgRegNumber]").val();
var archivalProfileToEdit = $('#archivalProfileToEdit').val();
if (originatorOrgRegNumber && !$('#parentArchiveId').val()) { if (originatorOrgRegNumber && !$('#parentArchiveId').val()) {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
...@@ -582,14 +582,15 @@ ...@@ -582,14 +582,15 @@
dataType: 'json', dataType: 'json',
contentType: 'application/json', contentType: 'application/json',
async: false, async: false,
success: function (response) { success: function (response) {
$.each(response, function(index, profile){ $.each(response, function(index, profile){
addSelectProfiles(profile); addSelectProfiles(profile);
}) })
archivalProfile.val(archivalProfileToEdit).change();
} }
}); });
} };
} });
function updateSelectProfilesFromArchivalProfileReference(archivalProfileReference) { function updateSelectProfilesFromArchivalProfileReference(archivalProfileReference) {
var archivalProfile = $('#archivalProfile'); var archivalProfile = $('#archivalProfile');
......
...@@ -958,8 +958,10 @@ input:invalid { ...@@ -958,8 +958,10 @@ input:invalid {
if (data.parentArchiveId) { if (data.parentArchiveId) {
// console.log("je suis une sous-archive"); // console.log("je suis une sous-archive");
} }
$('#archivalProfileToEdit').val(data.archivalProfileReference);
target.find("[name=originatorOrgRegNumber]").first().val(data.originatorOrgRegNumber).change(); target.find("[name=originatorOrgRegNumber]").first().val(data.originatorOrgRegNumber).change();
$('#archivalProfile').val(data.archivalProfileReference).change(); // $('#archivalProfile').val(data.archivalProfileReference).change();
} }
$.each(data, function(property, value) { $.each(data, function(property, value) {
if (property == "description") { if (property == "description") {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment