mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 11:30:55 +01:00
Fix aggiunta al volo dei valori da finestra modale
Fix minori
This commit is contained in:
parent
3385ac0d32
commit
f10cc8015f
12
add.php
12
add.php
@ -79,20 +79,20 @@ if (isAjaxRequest()) {
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#form_'.$id_module.'-'.$id_plugin.'").find("form").submit(function () {
|
||||
let $form = $(this);
|
||||
var form = input(this);
|
||||
|
||||
salvaForm(this, {
|
||||
id_module: "'.$id_module.'",
|
||||
id_plugin: "'.$id_plugin.'",
|
||||
}).then(function(response) {
|
||||
// Selezione automatica nuovo valore per il select
|
||||
let select = "#'.get('select').'";
|
||||
if ($(select).val() !== undefined) {
|
||||
$(select).selectSetNew(response.id, response.text, response.data);
|
||||
$(select).change();
|
||||
var select = input("'.get('select').'");
|
||||
if (select) {
|
||||
select.getElement().selectSetNew(response.id, response.text, response.data);
|
||||
//select.change();
|
||||
}
|
||||
|
||||
$form.closest("div[id^=bs-popup").modal("hide");
|
||||
form.getElement().closest("div[id^=bs-popup").modal("hide");
|
||||
})
|
||||
|
||||
return false;
|
||||
|
@ -21,7 +21,7 @@ include_once __DIR__.'/../../../core.php';
|
||||
|
||||
switch ($resource) {
|
||||
case 'clienti':
|
||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')')), IF(deleted_at IS NULL, '', ' (".tr('eliminata').")'), IF(is_bloccata = 1, ' (".tr('bloccata').")', '') ) AS descrizione, idtipointervento_default AS idtipointervento, in_tipiintervento.descrizione AS idtipointervento_descrizione, an_anagrafiche.idzona FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT JOIN in_tipiintervento ON an_anagrafiche.idtipointervento_default=in_tipiintervento.idtipointervento LEFT JOIN an_relazioni ON an_anagrafiche.idrelazione=an_relazioni.id |where| ORDER BY ragione_sociale";
|
||||
$query = "SELECT an_anagrafiche.idanagrafica AS id, is_bloccata, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')')), IF(deleted_at IS NULL, '', ' (".tr('eliminata').")'), IF(is_bloccata = 1, ' (".tr('bloccata').")', '') ) AS descrizione, idtipointervento_default AS idtipointervento, in_tipiintervento.descrizione AS idtipointervento_descrizione, an_anagrafiche.idzona FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica LEFT JOIN in_tipiintervento ON an_anagrafiche.idtipointervento_default=in_tipiintervento.idtipointervento LEFT JOIN an_relazioni ON an_anagrafiche.idrelazione=an_relazioni.id |where| ORDER BY ragione_sociale";
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);
|
||||
@ -38,6 +38,23 @@ switch ($resource) {
|
||||
$search_fields[] = 'provincia LIKE '.prepare('%'.$search.'%');
|
||||
}
|
||||
|
||||
$data = AJAX::selectResults($query, $where, $filter, $search_fields, $limit, $custom);
|
||||
$rs = $data['results'];
|
||||
|
||||
foreach ($rs as $k => $r) {
|
||||
|
||||
$rs[$k] = array_merge($r, [
|
||||
'text' => $r['descrizione'],
|
||||
'disabled' => $r['is_bloccata'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$results = [
|
||||
'results' => $rs,
|
||||
'recordsFiltered' => $data['recordsFiltered'],
|
||||
];
|
||||
|
||||
break;
|
||||
|
||||
case 'fornitori':
|
||||
|
@ -515,10 +515,10 @@ echo '
|
||||
$("#dettagli_cliente").html("'.tr('Seleziona prima un cliente').'...");
|
||||
}
|
||||
|
||||
plus_sede = $("#idsede_destinazione").parent().find(".btn");
|
||||
plus_sede = $(".modal #idsede_destinazione").parent().find(".btn");
|
||||
plus_sede.attr("onclick", plus_sede.attr("onclick").replace(/id_parent=[0-9]*/, "id_parent=" + value));
|
||||
|
||||
plus_impianto = $("#idimpianti").parent().find(".btn");
|
||||
plus_impianto = $(".modal #idimpianti").parent().find(".btn");
|
||||
plus_impianto.attr("onclick", plus_impianto.attr("onclick").replace(/id_anagrafica=[0-9]*/, "id_anagrafica=" + value));
|
||||
});
|
||||
|
||||
|
@ -80,7 +80,7 @@ switch (filter('op')) {
|
||||
]);
|
||||
|
||||
if (isAjaxRequest()) {
|
||||
echo json_encode(['id' => $nome, 'text' => $descrizione]);
|
||||
echo json_encode(['id' => $id_record, 'text' => $descrizione]);
|
||||
}
|
||||
|
||||
flash()->info(tr('Aggiunta nuova tipologia di _TYPE_', [
|
||||
|
@ -29,8 +29,12 @@ echo '
|
||||
<input type="hidden" name="id_record" value="">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{[ "type": "text", "label": "'.tr('Nome sede').'", "name": "nomesede", "required": 1 ]}
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Anagrafica').'", "name": "id_anagrafica", "required": "1", "value": "'.$id_parent.'", "ajax-source": "anagrafiche", "disabled": 1 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Nome sede').'", "name": "nomesede", "required": 1 ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user