Building/Form: pop is updated when network is changed
This commit is contained in:
@@ -190,7 +190,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="status_id">Status</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="status_id" id="type_id" <?=(!$me->is("Admin")) ? "disabled='disabled'" : ""?>>
|
||||
<select class="select2 form-control " name="status_id" id="status_id" <?=(!$me->is("Admin")) ? "disabled='disabled'" : ""?>>
|
||||
<option></option>
|
||||
<?php foreach($statuses as $status): ?>
|
||||
<option value="<?=$status->id?>" <?=($building->status_id == $status->id) ? "selected='selected'" : ""?>><?=__($status->name)?></option>
|
||||
@@ -202,6 +202,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="header-title mb-2">Berechtigungen</h4>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="pipeworker_id">Tiefbau</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="pipeworker_id" id="pipeworker_id" >
|
||||
<option></option>
|
||||
<?php foreach($pipeworkers as $pw): ?>
|
||||
<option value="<?=$pw->id?>" <?=($building->pipeworker_id == $pw->id) ? "selected='selected'" : ""?>><?=$pw->getCompanyOrName()?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="lineworker_id">Kabelbau</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="lineworker_id" id="type_id" <?=(!$me->is("Admin")) ? "disabled='disabled'" : ""?>>
|
||||
<option></option>
|
||||
<?php foreach($lineworkers as $lw): ?>
|
||||
<option value="<?=$lw->id?>" <?=($building->lineworker_id == $lw->id) ? "selected='selected'" : ""?>><?=$lw->getCompanyOrName()?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
@@ -241,13 +273,46 @@
|
||||
// disable mousewheel on input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault()
|
||||
e.preventDefault();
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
$(this).off('wheel.disableScroll');
|
||||
});
|
||||
|
||||
function updatePops() {
|
||||
var network_id = $("#network_id").val();
|
||||
if(!network_id) {
|
||||
return true;
|
||||
}
|
||||
// get new pops
|
||||
$.get("<?=self::getUrl("Pop","Api")?>",
|
||||
{
|
||||
"do": "getPops",
|
||||
network_id: network_id
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
console.log(success);
|
||||
pops = success.result.pops;
|
||||
if(typeof pops !== 'object' || pops === null) {
|
||||
return true;
|
||||
}
|
||||
$("#pop_id option:gt(0)").remove();
|
||||
console.log(pops);
|
||||
for(var pop_id in pops) {
|
||||
console.log(pop_id + ": " + pops[pop_id]);
|
||||
$("#pop_id").append($("<option></option>").attr("value", pop_id).text(pops[pop_id]));
|
||||
}
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
$("#network_id").change(function() {
|
||||
updatePops();
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -278,6 +343,9 @@
|
||||
|
||||
|
||||
|
||||
$( document ).ready(function() {
|
||||
updatePops();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user