Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
137 righe
4.7 KiB
137 righe
4.7 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$id_modulo = "unimod"; |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"],$id_modulo) && !empty($_GET["codice"])) { |
|
$contratto = stipula::init($_GET["codice"]); |
|
$unimod = new UnimodForm($contratto); |
|
|
|
if (!empty($contratto)) { |
|
$record = $contratto->info; |
|
$lock = $contratto->checkLock("unimod"); |
|
} |
|
if (!empty($record)) { |
|
$href = "/".$radice."/panel.php?codice=".$record["codice"]; |
|
|
|
$breadcrumb = array(); |
|
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"]; |
|
|
|
if (!empty($record["codice"])) { |
|
$breadcrumb = $contratto->getBreadcrumb($breadcrumb); |
|
$breadcrumb[$href] = __("Pannello"); |
|
} |
|
|
|
$breadcrumb[""] = __("Unimod"); |
|
|
|
include_once ($beRoot."/layout/top.php"); |
|
?> |
|
<form rel="validate" method="post" action="save.php" id="edit-form"> |
|
<input id="token" type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input id="codice" type="hidden" name="codice" value="<?= $record["codice"] ?>"> |
|
<div id="commands" class="mb-5"> |
|
<div class="commands container-fluid"> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<button class="btn btn-sm btn-success"><span class="fa fa-save"></span> <?= __("Salva") ?></button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div id="edit-form"> |
|
<div class="container"> |
|
|
|
<?if (!empty($_SESSION["unimod-errors"])) { |
|
?> |
|
<div class="alert alert-danger alert-dismissible fade show" role="alert"> |
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
|
<span aria-hidden="true">×</span> |
|
<span class="sr-only">Close</span> |
|
</button> |
|
<strong><i class="fas fa-exclamation-triangle mr-3"></i><?= __("Attenzione! Si sono verificati i seguenti errori:") ?></strong> |
|
<ul class="text-break"> |
|
<?foreach ($_SESSION["unimod-errors"] as $err) {?> |
|
<li><?=$unimod->translate($err->message)?></li> |
|
<?}?> |
|
</ul> |
|
</div> |
|
<? |
|
}?> |
|
<? |
|
unset($_SESSION["unimod-errors"]); |
|
?> |
|
|
|
<?$unimod->form()?> |
|
<button class="btn btn-block btn-lg btn-success mb-3"><span class="fa fa-save"></span> <?= __("Salva") ?></button> |
|
</div> |
|
</div> |
|
</form> |
|
<script type="text/javascript"> |
|
f_ready(); |
|
$(document).ready(function(){ |
|
//ckeditor manage |
|
let descrizione = $('textarea[name="telematico.dati-telematico.adempimento.dati-negozio.negozio.agevolazione._attributes.descrizione"]'); |
|
let editor = window.CKEDITOR.filter((element) => element.sourceElement.name == descrizione.attr('name'))[0]; |
|
let instance = $('[name="telematico.dati-telematico.adempimento.dati-negozio.negozio.agevolazione._attributes.tipo"]'); |
|
let editor_col = $('label[for="telematico.dati-telematico.adempimento.dati-negozio.negozio.agevolazione._attributes.descrizione"]').parent(); |
|
if (instance.val() != 99){ |
|
descrizione.attr('disabled',true); |
|
editor_col.hide(); |
|
} |
|
instance.on('change',function(){ |
|
if (instance.val() == 99){ |
|
editor.setReadOnly(false); |
|
descrizione.attr('disabled',false); |
|
editor_col.show(); |
|
} else { |
|
editor.setReadOnly(true); |
|
descrizione.attr('disabled',true); |
|
editor_col.hide(); |
|
} |
|
}); |
|
|
|
function bindInputs(input_1, input_2) { |
|
input_1.on('change',function(){ |
|
if (input_1.get(0).tagName == "SELECT") { |
|
input_2.val(input_1.val()); |
|
input_2.trigger("chosen:updated"); |
|
return |
|
} |
|
input_2.val(input_1.val()); |
|
}); |
|
} |
|
|
|
let numeri_repertorio = [ |
|
"primo_numero_repertorio", |
|
"secondo_numero_repertorio", |
|
]; |
|
numeri_repertorio.forEach((e) => { |
|
const input_1 = $(`[name="telematico.dati-telematico.adempimento.testo-atto.${e}"]`) |
|
const input_2 = $(`[name="telematico.dati-telematico.adempimento.chiave-adempimento.${e}"]`) |
|
bindInputs(input_1, input_2); |
|
bindInputs(input_2, input_1); |
|
input_2.val(input_2.val()).trigger('change'); |
|
}); |
|
|
|
$(".acausa_check").on('change', function(){ |
|
if ($(this).is(":checked")) { |
|
$(this).parent().parent().parent().find(".dcausa_check").prop("checked",false); |
|
} |
|
}) |
|
$(".dcausa_check").on('change', function(){ |
|
if ($(this).is(":checked")) { |
|
$(this).parent().parent().parent().find(".acausa_check").prop("checked",false); |
|
} |
|
}) |
|
}); |
|
|
|
</script><? |
|
include_once ($beRoot."/layout/bottom.php"); |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|