Files
thetool/Layout/default/Pop/Form.php
Daniel Spitzer 09aaede76b Pop Feature Erweiterungen
* Project 8454 (Erweiterung Felder Status, Speicherort, Dokustand Datum)
* Schrank breite um 1ne Col verbreitert
* neue Migration
2025-05-11 19:53:31 +02:00

235 lines
12 KiB
PHP

<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
if (isset($_GET['returnto']) && $_GET['returnto'] == "pop-detail") {
$cancelUrl = self::getUrl("Pop", "Detail", ["id" => $pop->id]);
$cancelText = "Pop Detail";
} else if (isset($_GET['returnto'])) {
$cancelUrl = self::getUrl("Pop");
$cancelText = "Pops";
} else {
$cancelUrl = self::getUrl("Network");
}
?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<style>
</style>
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<?php if (empty($_GET["returnto"])) {
?>
<li class="breadcrumb-item"><a href="<?= self::getUrl("Network") ?>">Netzgebiete</a></li>
<li class="breadcrumb-item">Pop</li>
<?php
} else {
?>
<li class="breadcrumb-item"><a
href="<?= $cancelUrl ?>"><?= ucfirst($cancelText) ?>
</a></li>
<?php
}
?>
<li class="breadcrumb-item active"><?= ($pop->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title"><?= ($pop->id) ? "POP bearbeiten" : "Neuer POP" ?></h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card bg-light">
<div class="card-body">
<h4 class="header-title mb-2"><?= ($pop->id) ? "POP bearbeiten" : "Neuer POP" ?></h4>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("Pop", "save", ["returnto" => $_GET["returnto"]]) ?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?= $pop->id ?>"/>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet</label>
<div class="col-lg-10">
<select class="select2 form-control " multiple="multiple" name="network_id[]"
id="owner_id">
<option></option>
<?php foreach ($networks as $network): ?>
<option value="<?= $network->id ?>" <?= (is_array($popnetwork) && in_array($network->id, $popnetwork)) ? "selected='selected'" : "" ?>><?= ($network->name) ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="name">Name</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="name" id="name"
value="<?= $pop->name ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="gps_lat">GPS Breite</label>
<div class="col-lg-10">
<input type="number" step="any" class="form-control" name="gps_lat" id="name"
value="<?= $pop->gps_lat ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="gps_long">GPS Länge</label>
<div class="col-lg-10">
<input type="number" step="any" class="form-control" name="gps_long" id="name"
value="<?= $pop->gps_long ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="location">Standortinfo</label>
<div class="col-lg-10">
<textarea id="note" class="form-control" name="location"
rows="5"><?= $pop->location ?></textarea>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<h2 class="header-title mb-2">Access VLANs</h2>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="vlan_public">Public</label>
<div class="col-lg-10">
<input type="number" class="form-control" name="vlan_public" id="vlan_public"
value="<?= $pop->vlan_public ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="vlan_nat">NAT</label>
<div class="col-lg-10">
<input type="number" class="form-control" name="vlan_nat" id="vlan_nat"
value="<?= $pop->vlan_nat ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="vlan_ipv6">IPv6</label>
<div class="col-lg-10">
<input type="number" class="form-control" name="vlan_ipv6" id="vlan_ipv6"
value="<?= $pop->vlan_ipv6 ?>">
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="state">Status</label>
<div class="col-lg-3">
<select class="select2 form-control " name="state"
id="state">
<option value="">&nbsp;</option>
<?php foreach ($stateArray as $key => $value): ?>
<option value="<?= $key ?>" <?= ($key == $pop->state) ? "selected='selected'" : "" ?>><?= $value ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="note">Dokustand</label>
<div class="col-lg-2">
<input type="date"
min="<?php //($pop->doku_date) ? date("Y-m-d", $pop->doku_date) : "" ?>"
value="<?= ($pop->doku_date) ? date("Y-m-d", $pop->doku_date) : "" ?>"
class="form-control" name="doku_date" id="doku_date">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="folder_link">Fotospeicherort</label>
<div class="col-lg-4">
<input type="text"
value="<?= ($pop->folder_link) ? : "" ?>"
class="form-control" name="folder_link" id="folder_link">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
<div class="col-lg-10">
<textarea id="note" class="form-control" name="note"
rows="5"><?= $pop->note ?></textarea>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a href="<?= $cancelUrl ?>">
<button type="button" class="btn btn-secondary">Abbrechen</button>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#parent_id").select2({
allowClear: true,
placeholder: ""
});
$("#addresstypes").select2();
// disable mousewheel on a input number field when in focus
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('wheel.disableScroll', function (e) {
e.preventDefault()
})
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('wheel.disableScroll')
});
$(".select2").select2({
});
// network_id // owner_id
// if get parameter network_id is set, select it if found
const urlParams = new URLSearchParams(window.location.search);
const network_id = urlParams.get('network_id');
if (network_id) {
console.log("network_id", network_id);
$("#owner_id").val(network_id).trigger('change');
}
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>