Aggiunto pulsante Salva e chiudi per ritornare all'elenco del modulo

This commit is contained in:
Dasc3er 2021-03-15 11:10:46 +01:00
parent 6deca4bd9b
commit a07234ec4b
7 changed files with 32 additions and 12 deletions

View File

@ -175,9 +175,21 @@ if (empty($record) || !$has_access) {
{( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )}
<a class="btn btn-success" id="'.(!empty($record['deleted_at']) ? 'restore' : 'save').'">
<i class="fa fa-'.(!empty($record['deleted_at']) ? 'undo' : 'check').'"></i> '.(!empty($record['deleted_at']) ? tr('Salva e Ripristina') : tr('Salva')).'
</a>
<div class="btn-group" id="save-buttons">
<a class="btn btn-success" id="save">
<i class="fa fa-'.(!empty($record['deleted_at']) ? 'undo' : 'check').'"></i> '.(!empty($record['deleted_at']) ? tr('Salva e ripristina') : tr('Salva')).'
</a>
<a type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#" id="save-close">
<i class="fa fa-'.(!empty($record['deleted_at']) ? 'undo' : 'check').'"></i>
'.(!empty($record['deleted_at']) ? tr('Ripristina e chiudi') : tr('Salva e chiudi')).'
</a></li>
</ul>
</div>
</div>
</div>
@ -191,6 +203,11 @@ if (empty($record) || !$has_access) {
$("#save").click(function(){
//submitAjax(form);
$("#submit").trigger("click");
});
$("#save-close").on("click", function (){
form.find("[name=backto]").val("record-list");
$("#submit").trigger("click");
});';

View File

@ -151,10 +151,13 @@ $(document).ready(function() {';
}
echo '
$("#save").html("<i class=\"fa fa-flag-checkered\"></i> '.tr('Avvia importazione').'");
$("#save-buttons").find(".dropdown-menu, .dropdown-toggle").remove();
$("#save").unbind("click");
$("#save").on("click", function() {
var save = $("#save");
save.html("<i class=\"fa fa-flag-checkered\"></i> '.tr('Avvia importazione').'");
save.unbind("click");
save.on("click", function() {
count = 0;
importPage(0);
});

View File

@ -221,11 +221,11 @@ function controllaConti() {
if (continuare) {
$("#add-submit").prop("disabled", false);
$("#modello-button").prop("disabled", false);
$("#save").removeAttr("disabled");
$("#save, #save-close").removeAttr("disabled").removeClass("disabled");
} else {
$("#add-submit").prop("disabled", true);
$("#modello-button").prop("disabled", true);
$("#save").attr("disabled", "true");
$("#save, #save-close").attr("disabled", "true").addClass("disabled");
}
return continuare;

View File

@ -34,7 +34,7 @@ if (!empty($record['default'])) {
echo '
<script>
$(document).ready(function() {
$("#save").prop("disabled", true).addClass("disabled");
$("#save-buttons").hide();
});
</script>

View File

@ -209,7 +209,7 @@ if ($record['editable'] == 1) {
echo '
<script>
$(document).ready(function() {
$("#save").addClass("hide");
$("#save-buttons").hide();
$("#email-button").remove();
});

View File

@ -241,7 +241,7 @@ echo '
});
$(document).ready(function() {
$("#save").addClass("hide");
$("#save-buttons").hide();
$(".sortable").disableSelection();
$(".sortable").each(function() {

View File

@ -25,7 +25,7 @@ include_once __DIR__.'/../../core.php';
echo '
<script>
$(document).ready(function() {
$("#save").hide();
$("#save-buttons").hide();
});
</script>';