Fix compilaCampi banca da modal

This commit is contained in:
Luca 2023-03-23 19:33:50 +01:00
parent 0f60af2713
commit a2b0aeb96b
2 changed files with 11 additions and 7 deletions

View File

@ -71,8 +71,8 @@ echo '
</form>'; </form>';
?> ?>
<script> <script>
var iban = input("iban");
var iban = input("iban");
var branch_code = input("branch_code"); var branch_code = input("branch_code");
var bank_code = input("bank_code"); var bank_code = input("bank_code");
var id_nazione = input("id_nazione"); var id_nazione = input("id_nazione");
@ -121,10 +121,12 @@ echo '
if (response.id_nazione.iso2 === "IT"){ if (response.id_nazione.iso2 === "IT"){
bic.setRequired(false); bic.setRequired(false);
$("label[for=bic]").html('<?php echo tr('BIC'); ?>'); var label_text = $('label[for=bic] span .text-red').text();
$('label[for=bic] span .text-red').text(label_text.replace('*', ' '));
} else { } else {
bic.setRequired(true); bic.setRequired(true);
$("label[for=bic]").html('<?php echo tr('BIC'); ?><span class="text-red">*</span>'); var label_text = $('label[for=bic] span .text-red').text();
$('label[for=bic] span .text-red').text(label_text.replace(' ', '*'));
} }
}, },
error: function() { error: function() {
@ -167,9 +169,9 @@ echo '
function compilaCampi(values) { function compilaCampi(values) {
for([key, value] of Object.entries(values)) { for([key, value] of Object.entries(values)) {
if (typeof value === 'object' && value !== null) { if (typeof value === 'object' && value !== null) {
input(key).getElement().selectSetNew(value.id, value.text, value); input('#modals > div #'+key).getElement().selectSetNew(value.id, value.text, value);
} else { } else {
input(key).set(value); input('#modals > div #'+key).set(value);
} }
} }
} }

View File

@ -194,10 +194,12 @@ if (!empty($numero_documenti)) {
if (response.id_nazione.iso2 === "IT"){ if (response.id_nazione.iso2 === "IT"){
bic.setRequired(false); bic.setRequired(false);
$("label[for=bic]").html('<?php echo tr('BIC'); ?>'); var label_text = $('label[for=bic] span .text-red').text();
$('label[for=bic] span .text-red').text(label_text.replace('*', ' '));
} else { } else {
bic.setRequired(true); bic.setRequired(true);
$("label[for=bic]").html('<?php echo tr('BIC'); ?><span class="text-red">*</span>'); var label_text = $('label[for=bic] span .text-red').text();
$('label[for=bic] span .text-red').text(label_text.replace(' ', '*'));
} }
}, },
error: function() { error: function() {