mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 11:30:55 +01:00
Fix selezione tecnici dopo inserimento
This commit is contained in:
parent
2ee58b0c19
commit
f5769348bf
10
add.php
10
add.php
@ -39,7 +39,7 @@ $(document).ready(function(){
|
|||||||
cleanup_inputs();
|
cleanup_inputs();
|
||||||
|
|
||||||
var form = $("#custom_fields_top-add").parent().find("form").first();
|
var form = $("#custom_fields_top-add").parent().find("form").first();
|
||||||
|
|
||||||
// Campi a inizio form
|
// Campi a inizio form
|
||||||
form.prepend($("#custom_fields_top-add").html());
|
form.prepend($("#custom_fields_top-add").html());
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ $(document).ready(function(){
|
|||||||
if (!last.length) {
|
if (!last.length) {
|
||||||
last = form.find(".row").eq(-2);
|
last = form.find(".row").eq(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
last.after($("#custom_fields_bottom-add").html());
|
last.after($("#custom_fields_bottom-add").html());
|
||||||
restart_inputs();
|
restart_inputs();
|
||||||
});
|
});
|
||||||
@ -72,16 +72,14 @@ $(document).ready(function(){
|
|||||||
submitAjax(this, $form.variables, function(response) {
|
submitAjax(this, $form.variables, function(response) {
|
||||||
// Selezione automatica nuovo valore per il select
|
// Selezione automatica nuovo valore per il select
|
||||||
select = "#'.get('select').'";
|
select = "#'.get('select').'";
|
||||||
console.log($(select).val());
|
|
||||||
if ($(select).val() !== undefined) {
|
if ($(select).val() !== undefined) {
|
||||||
console.log(response.id + " | " + response.text);
|
|
||||||
$(select).selectSetNew(response.id, response.text, response.data);
|
$(select).selectSetNew(response.id, response.text, response.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$form.closest("div[id^=bs-popup").modal("hide");
|
$form.closest("div[id^=bs-popup").modal("hide");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -125,7 +125,14 @@ jQuery.fn.selectReset = function (placeholder) {
|
|||||||
* Da utilizzare per l'impostazione dei select basati su richieste AJAX.
|
* Da utilizzare per l'impostazione dei select basati su richieste AJAX.
|
||||||
*/
|
*/
|
||||||
jQuery.fn.selectSetNew = function (value, label, data) {
|
jQuery.fn.selectSetNew = function (value, label, data) {
|
||||||
this.selectReset();
|
// Fix selezione per valori multipli
|
||||||
|
var values = this.val();
|
||||||
|
if (this.prop("multiple")) {
|
||||||
|
values.push(value);
|
||||||
|
} else {
|
||||||
|
this.selectReset();
|
||||||
|
values = value;
|
||||||
|
}
|
||||||
|
|
||||||
this.selectAdd([{
|
this.selectAdd([{
|
||||||
'value': value,
|
'value': value,
|
||||||
@ -133,7 +140,7 @@ jQuery.fn.selectSetNew = function (value, label, data) {
|
|||||||
'data': data,
|
'data': data,
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
this.selectSet(value);
|
this.selectSet(values);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user