Filtro referenti per sede

This commit is contained in:
Beppe 2023-01-13 09:35:27 +01:00
parent b3845575e1
commit f61b436450
6 changed files with 43 additions and 5 deletions

View File

@ -376,6 +376,10 @@ switch ($resource) {
$where[] = 'idanagrafica='.prepare($superselect['idanagrafica']);
}
if (isset($superselect['idsede_destinazione'])) {
$where[] = 'idsede='.prepare($superselect['idsede_destinazione']);
}
if (!empty($search)) {
$search_fields[] = 'an_referenti.nome LIKE '.prepare('%'.$search.'%');
}

View File

@ -79,7 +79,7 @@ if (strtotime($record['data_conclusione']) < strtotime($record['data_accettazion
<div class="col-md-3">
'.Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"').'
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'} ]}
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].',"idsede_destinazione": '.$record['idsede'].'} ]}
</div>
<div class="col-md-3">';
@ -530,5 +530,10 @@ $(document).ready(function() {
data_accettazione.data("DateTimePicker").date(e.date);
}
});
$("#idsede").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
});
</script>';

View File

@ -147,7 +147,7 @@ echo '
echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'} ]}
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "idsede_destinazione": '.$record['idsede_destinazione'].'} ]}
</div>';
// Conteggio numero articoli ddt in uscita
@ -574,3 +574,13 @@ if (in_array($record[$field_name], $user->sedi)) {
</a>
<?php
}
echo '
<script>
$("#idsede_destinazione").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
</script>';

View File

@ -362,7 +362,7 @@ echo '
echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|id_plugin='.Plugins::get('Referenti')['id'].'&id_parent='.$record['idanagrafica'].'||'.(intval($block_edit) ? 'disabled' : '').'" ]}
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "idsede_destinazione": '.$record['idsede_destinazione'].'}, "icon-after": "add|'.Modules::get('Anagrafiche')['id'].'|id_plugin='.Plugins::get('Referenti')['id'].'&id_parent='.$record['idanagrafica'].'||'.(intval($block_edit) ? 'disabled' : '').'" ]}
</div>';
echo '
@ -1069,6 +1069,11 @@ $(document).ready(function () {
data_competenza.data("DateTimePicker").date(e.date);
}
});
$("#idsede_destinazione").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
});
function cambiaStato() {

View File

@ -111,7 +111,7 @@ echo '
echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'} ]}
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "idsede_destinazione": '.$record['idsede'].'} ]}
</div>
<div class="col-md-3">
@ -333,6 +333,11 @@ $(document).ready(function() {
caricaRighe();
});
$("#idsede").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
$("#idanagrafica").change(function() {
updateSelectOption("idanagrafica", $(this).val());
session_set("superselect,idanagrafica", $(this).val(), 0);

View File

@ -86,7 +86,7 @@ echo '
echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"');
}
echo '
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'} ]}
{[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].',"idsede_destinazione": '.$record['idsede'].'} ]}
</div>
<div class="col-md-3">';
@ -437,3 +437,12 @@ if (!empty($elementi)) {
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> <?php echo tr('Elimina'); ?>
</a>
<script>
$("#idsede").change(function(){
updateSelectOption("idsede_destinazione", $(this).val());
$("#idreferente").selectReset();
});
</script>