Aggiunto menù a tendina Ordinamento in row-list

This commit is contained in:
MatteoPistorello 2023-05-24 17:15:29 +02:00
parent d8820523a0
commit 9a893f0ad7
10 changed files with 111 additions and 30 deletions

View File

@ -342,7 +342,7 @@ if (!$block_edit) {
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-4">
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
</div>
@ -350,7 +350,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div>
<div class="col-md-4" style="margin-top: 25px">
<div class="col-md-3" style="margin-top: 25px">
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>
@ -379,6 +379,10 @@ if (!$block_edit) {
</ul>
</div>
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
</div>
</div>
</form>';
}
@ -623,4 +627,16 @@ $(document).ready(function() {
$("#idreferente").selectReset();
});
});
input("ordinamento").on("change", function(){
if (input(this).get() == "desc") {
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
caricaRighe(null);
});
} else {
session_set("module_'.$id_module.',order_row_desc").then(function () {
caricaRighe(null);
});
}
});
</script>';

View File

@ -20,7 +20,8 @@
include_once __DIR__.'/init.php';
$block_edit = $record['is_completato'];
$righe = $contratto->getRighe();
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $contratto->getRighe()->sortByDesc('created_at') : $contratto->getRighe();
$direzione = $contratto->direzione;
$colspan = ($block_edit ? '5' : '6');
@ -177,7 +178,7 @@ foreach ($righe as $riga) {
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
<i class="fa fa-sort"></i>
</a>
</div>';

View File

@ -375,7 +375,7 @@ if (!$block_edit) {
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-4">
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
</div>
@ -383,7 +383,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($ddt->idsede_partenza).', "idsede_destinazione": '.intval($ddt->idsede_destinazione).', "idanagrafica": '.$ddt->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$ddt->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div>
<div class="col-md-4" style="margin-top: 25px">
<div class="col-md-3" style="margin-top: 25px">
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>
@ -424,6 +424,10 @@ if (!$block_edit) {
</ul>
</div>
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
</div>
</div>
</form>';
}
@ -648,10 +652,20 @@ if (in_array($record[$field_name], $user->sedi)) {
echo '
<script>
$("#idsede_destinazione").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
$("#idsede_destinazione").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
input("ordinamento").on("change", function(){
if (input(this).get() == "desc") {
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
caricaRighe(null);
});
} else {
session_set("module_'.$id_module.',order_row_desc").then(function () {
caricaRighe(null);
});
}
});
</script>';

View File

@ -20,7 +20,8 @@
include_once __DIR__.'/init.php';
$block_edit = $record['flag_completato'];
$righe = $ddt->getRighe();
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $ddt->getRighe()->sortByDesc('created_at') : $ddt->getRighe();
$colspan = ($block_edit ? '5' : '6');
$direzione = $ddt->direzione;
@ -223,7 +224,7 @@ foreach ($righe as $riga) {
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
<i class="fa fa-sort"></i>
</a>
</div>';

View File

@ -815,7 +815,7 @@ if (!$block_edit) {
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-4">
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
</div>
@ -823,7 +823,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": '.($dir == 'entrata' ? 0 : 1).', "idsede_partenza": '.intval($fattura->idsede_partenza).', "idsede_destinazione": '.intval($fattura->idsede_destinazione).', "idanagrafica": '.$fattura->idanagrafica.', "dir": "'.$dir.'", "idagente": '.$fattura->idagente.'}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div>
<div class="col-md-4" style="margin-top: 25px">
<div class="col-md-3" style="margin-top: 25px">
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>
@ -887,6 +887,10 @@ if (!$block_edit) {
</ul>
</div>
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
</div>
</div>
</form>';
}
@ -1199,4 +1203,16 @@ $("#link_form").bind("keypress", function(e) {
return false;
}
});
input("ordinamento").on("change", function(){
if (input(this).get() == "desc") {
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
caricaRighe(null);
});
} else {
session_set("module_'.$id_module.',order_row_desc").then(function () {
caricaRighe(null);
});
}
});
</script>';

View File

@ -23,7 +23,8 @@ include_once __DIR__.'/init.php';
$direzione = $fattura->direzione;
$block_edit = !empty($note_accredito) || in_array($record['stato'], ['Emessa', 'Pagato', 'Parzialmente pagato']) || !$abilita_genera;
$righe = $fattura->getRighe();
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $fattura->getRighe()->sortByDesc('created_at') : $fattura->getRighe();
echo '
<div class="table-responsive">
@ -284,7 +285,7 @@ foreach ($righe as $riga) {
}
echo '
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
<i class="fa fa-sort"></i>
</a>
</div>';

View File

@ -237,11 +237,11 @@ if (!$block_edit) {
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-4">
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
</div>
<div class="col-md-4">
<div class="col-md-3">
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div>
@ -292,6 +292,10 @@ if (!$block_edit) {
}
echo '
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
</div>
</div>
</form>';
}
@ -444,6 +448,18 @@ $("#link_form").bind("keypress", function(e) {
return false;
}
});
input("ordinamento").on("change", function(){
if (input(this).get() == "desc") {
session_set("module_'.$id_module.',order_row_desc", 1, "").then(function () {
caricaRighe(null);
});
} else {
session_set("module_'.$id_module.',order_row_desc").then(function () {
caricaRighe(null);
});
}
});
</script>';
// Collegamenti diretti

View File

@ -22,7 +22,8 @@ include_once __DIR__.'/init.php';
use Modules\Articoli\Articolo;
$block_edit = $record['flag_completato'];
$righe = $ordine->getRighe();
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $ordine->getRighe()->sortByDesc('created_at') : $ordine->getRighe();
$colspan = ($block_edit ? '6' : '7');
$direzione = $ordine->direzione;
@ -268,7 +269,7 @@ foreach ($righe as $riga) {
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
<i class="fa fa-sort"></i>
</a>
</div>';

View File

@ -257,7 +257,7 @@ if (!$block_edit) {
<input type="hidden" name="backto" value="record-edit">
<div class="row">
<div class="col-md-4">
<div class="col-md-3">
{[ "type": "text", "label": "'.tr('Aggiungi un articolo tramite barcode').'", "name": "barcode", "extra": "autocomplete=\"off\"", "icon-before": "<i class=\"fa fa-barcode\"></i>", "required": 0 ]}
</div>
@ -265,7 +265,7 @@ if (!$block_edit) {
{[ "type": "select", "label": "'.tr('Articolo').'", "name": "id_articolo", "value": "", "ajax-source": "articoli", "select-options": {"permetti_movimento_a_zero": 1}, "icon-after": "add|'.Modules::get('Articoli')['id'].'" ]}
</div>
<div class="col-md-4" style="margin-top: 25px">
<div class="col-md-3" style="margin-top: 25px">
<button title="'.tr('Aggiungi articolo alla vendita').'" class="btn btn-primary tip" type="button" onclick="salvaArticolo()">
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>
@ -294,6 +294,10 @@ if (!$block_edit) {
</ul>
</div>
</div>
<div class="col-md-2">
{[ "type": "select", "label": "'.tr('Ordinamento').'", "name": "ordinamento", "class": "no-search", "value": "'.($_SESSION['module_'.$id_module]['order_row_desc'] ? 'desc' : 'manuale').'", "values": "list=\"desc\": \"'.tr('Ultima riga inserita').'\", \"manuale\": \"'.tr('Manuale').'\"" ]}
</div>
</div>
</form>';
}
@ -519,10 +523,20 @@ if (!empty($elementi)) {
</a>
<script>
$("#idsede").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
$("#idsede").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
input("ordinamento").on("change", function(){
if (input(this).get() == "desc") {
session_set("module_<?php echo $id_module; ?>,order_row_desc", 1, "").then(function () {
caricaRighe(null);
});
} else {
session_set("module_<?php echo $id_module; ?>,order_row_desc").then(function () {
caricaRighe(null);
});
}
});
</script>

View File

@ -20,7 +20,8 @@
include_once __DIR__.'/init.php';
$block_edit = $record['is_completato'];
$righe = $preventivo->getRighe();
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $preventivo->getRighe()->sortByDesc('created_at') : $preventivo->getRighe();
$colspan = ($block_edit ? '6' : '7');
$direzione = $preventivo->direzione;
@ -210,7 +211,7 @@ foreach ($righe as $riga) {
<i class="fa fa-trash"></i>
</a>
<a class="btn btn-xs btn-default handle" title="'.tr('Modifica ordine delle righe').'">
<a class="btn btn-xs btn-default handle '.($order_row_desc ? 'disabled' : '').'" title="'.tr('Modifica ordine delle righe').'">
<i class="fa fa-sort"></i>
</a>
</div>';