Building/Form: pipe- and lineworker is updated when network is changed
This commit is contained in:
@@ -207,7 +207,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="pipeworker_id">Tiefbau</label>
|
||||
<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>
|
||||
@@ -219,9 +219,9 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="lineworker_id">Kabelbau</label>
|
||||
<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'" : ""?>>
|
||||
<select class="select2 form-control " name="lineworker_id" id="lineworker_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>
|
||||
@@ -293,15 +293,12 @@
|
||||
},
|
||||
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]));
|
||||
}
|
||||
}
|
||||
@@ -310,15 +307,43 @@
|
||||
);
|
||||
}
|
||||
|
||||
$("#network_id").change(function() {
|
||||
updatePops();
|
||||
});
|
||||
|
||||
function updatePermissions() {
|
||||
var network_id = $("#network_id").val();
|
||||
if(!network_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var types = ["lineworker", "pipeworker"];
|
||||
|
||||
// get new pops
|
||||
$.get("<?=self::getUrl("Network","Api")?>",
|
||||
{
|
||||
"do": "getPermissions",
|
||||
network_id: network_id,
|
||||
types: types.join('|')
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
var perms = success.result.permissions;
|
||||
types.forEach(function(type) {
|
||||
$("#" + 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]));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
<?php if($building->gps_lat && $building->gps_long): ?>
|
||||
|
||||
////////////
|
||||
// Map
|
||||
////////////
|
||||
var gpslat = <?=($building->gps_lat) ? $building->gps_lat : 0?>;
|
||||
var gpslong = <?=($building->gps_long) ? $building->gps_long : 0?>;
|
||||
console.log(gpslat + "," + gpslong);
|
||||
@@ -342,9 +367,14 @@
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
$("#network_id").change(function() {
|
||||
updatePops();
|
||||
updatePermissions();
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
updatePops();
|
||||
updatePermissions();
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>mvcfronk Error 404 - Module not found</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Error 404</h1>
|
||||
<h3>The Module was not found</h3>
|
||||
<!-- <?=$Exception?> -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>500 - Internal application error</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Error 500</h1>
|
||||
<h3>An internal Error occured.</h3>
|
||||
<!-- <?=$Exception?> -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$code=$Exception->Code;
|
||||
if($code) {
|
||||
echo "Error $code: ";
|
||||
}
|
||||
echo $Exception->Message;
|
||||
echo "\n";
|
||||
@@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Error</title>
|
||||
</head>
|
||||
<body>
|
||||
<h3><?=$Exception?></h3>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user