Fixed selects to keep values after network change
This commit is contained in:
@@ -300,6 +300,7 @@
|
||||
$("#network_id").select2({placeholder: ""});
|
||||
$("#pop_id").select2({placeholder: "", allowClear: true,});
|
||||
$("#type_id").select2({placeholder: ""});
|
||||
$("#networksection_id").select2({placeholder: "", allowClear: true,});
|
||||
|
||||
// disable mousewheel on input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
@@ -325,14 +326,18 @@
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
//console.log(success);
|
||||
pops = success.result.pops;
|
||||
var pops = success.result.pops;
|
||||
if(typeof pops !== 'object' || pops === null) {
|
||||
return true;
|
||||
}
|
||||
var selected = $("#pop_id option:selected").val();
|
||||
$("#pop_id option:gt(0)").remove();
|
||||
for(var pop_id in pops) {
|
||||
$("#pop_id").append($("<option></option>").attr("value", pop_id).text(pops[pop_id]));
|
||||
}
|
||||
if(selected) {
|
||||
$("#pop_id").val(selected);
|
||||
}
|
||||
}
|
||||
},
|
||||
'json'
|
||||
@@ -352,13 +357,18 @@
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
sections = success.result.sections;
|
||||
var sections = success.result.sections;
|
||||
if(typeof sections !== 'object' || sections === null) {
|
||||
return true;
|
||||
}
|
||||
var selected = $("#networksection_id option:selected").val();
|
||||
$("#networksection_id option:gt(0)").remove();
|
||||
for(var section_id in sections) {
|
||||
$("#networksection_id").append($("<option></option>").attr("value", pop_id).text(sections[section_id]));
|
||||
$("#networksection_id").append($("<option></option>").attr("value", section_id).text(sections[section_id]));
|
||||
}
|
||||
console.log("selected: " + selected);
|
||||
if(selected) {
|
||||
$("#networksection_id").val(selected);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -387,11 +397,15 @@
|
||||
return true;
|
||||
}
|
||||
types.forEach(function(type) {
|
||||
var selected = $("#" + type + "_id option:selected").val();
|
||||
$("#" + type + "_id").empty();
|
||||
$("#" + type + "_id").append($("<option></option>"));
|
||||
for(var perm_id in perms[type]) {
|
||||
$("#" + type + "_id").append($("<option></option>").attr("value", perm_id).text(perms[type][perm_id]));
|
||||
}
|
||||
if(selected) {
|
||||
$("#" + type + "_id").val(selected);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -74,6 +74,7 @@ class BuildingController extends mfBaseController {
|
||||
$data['status_id'] = ($r->status_id) ? $r->status_id : null;
|
||||
$data['pipeworker_id'] = ($r->pipeworker_id) ? $r->pipeworker_id : null;
|
||||
$data['lineworker_id'] = ($r->lineworker_id) ? $r->lineworker_id : null;
|
||||
$data['networksection_id'] = ($r->networksection_id) ? $r->networksection_id : null;
|
||||
|
||||
$data['oan_id'] = $r->oan_id;
|
||||
$data['street'] = $r->street;
|
||||
@@ -105,7 +106,6 @@ class BuildingController extends mfBaseController {
|
||||
}
|
||||
|
||||
//var_dump($address);exit;
|
||||
|
||||
$new_id = $building->save();
|
||||
if(!$new_id) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
|
||||
@@ -6,6 +6,8 @@ class BuildingModel {
|
||||
public $type_id = null;
|
||||
public $status_id = null;
|
||||
public $pipeworker_id = null;
|
||||
public $lineworker_id = null;
|
||||
public $networksection_id = null;
|
||||
public $code = null;
|
||||
public $oan_id = null;
|
||||
public $street = null;
|
||||
@@ -13,6 +15,7 @@ class BuildingModel {
|
||||
public $city = null;
|
||||
public $gps_lat = null;
|
||||
public $gps_long = null;
|
||||
public $laea = null;
|
||||
public $contact = null;
|
||||
public $phone = null;
|
||||
public $email = null;
|
||||
|
||||
Reference in New Issue
Block a user