Skip to content

Commit

Permalink
Fix non-populating external attributes on IntegrationsCreateForm.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Jul 7, 2024
1 parent e2d9276 commit 8080646
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions app/Views/integrationsCreateform.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,13 @@
</select>
</div>
</div>
<div class="row" style="padding-top:16px;">
<div class="offset-2 col-8" style="position:relative;">
<label for="data[attributes][select_external_attribute]" class="form-label"><?= __('Attribute') ?></label><br />
<select class="form-select" name="data[attributes][select_external_attribute]" id="data[attributes][select_external_attribute]" aria-label="<?= __('Attribute') ?>">
</select>
<div id="select_external_attribute">
<div class="row" style="padding-top:16px;">
<div class="offset-2 col-8" style="position:relative;">
<label for="data[attributes][select_external_attribute]" class="form-label"><?= __('Attribute') ?></label><br />
<select class="form-select" name="data[attributes][select_external_attribute]" id="data[attributes][select_external_attribute]" aria-label="<?= __('Attribute') ?>">
</select>
</div>
</div>
</div>
<div id="select_external_value">
Expand Down Expand Up @@ -480,6 +482,13 @@
field_count = field_count + 1;
});

for (i = 0; i < field_count; i++) {
if ($("#data\\[attributes\\]\\[fields\\]\\[" + i + "\\]\\[external_field_name\\]").val() > "" && $("#data\\[attributes\\]\\[fields\\]\\[" + i + "\\]\\[external_field_name\\]").val() !== 'name') {
$('#data\\[attributes\\]\\[select_external_attribute\\]').append("<option value=\"" + $("#data\\[attributes\\]\\[fields\\]\\[" + i + "\\]\\[external_field_name\\]").val() + "\">" + $("#data\\[attributes\\]\\[fields\\]\\[" + i + "\\]\\[external_field_name\\]").val() + "</option>");
}
}
$('#data\\[attributes\\]\\[select_external_attribute\\]').append("<option value=\"name\">name</option>");

$('#data\\[attributes\\]\\[select_internal_type\\]').change(function (e) {
$('#data\\[attributes\\]\\[select_internal_attribute\\]').empty();
if ($(this).val() == 'query') {
Expand Down Expand Up @@ -535,7 +544,7 @@
val = $(this).val();
found = false;
for (i = 0; i < field_count; i++) {
if (val == $("#data\\\[attributes\\\]\\\[fields\\\]\\\[" + i + "\\\]\\\[external_field_name\\\]").val()) {
if (val == $("#data\\[attributes\\]\\[fields\\]\\[" + i + "\\]\\[external_field_name\\]").val()) {
found = true;
}
}
Expand Down

0 comments on commit 8080646

Please sign in to comment.