Can now save Network Roles
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
<ul class="nav nav-pills navtab-bg nav-justified">
|
||||
<li class="nav-item"><a class="nav-link active" href="#net-detail-<?=$network->id?>-detail" data-toggle="tab" aria-expanded="false">Details</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#net-detail-<?=$network->id?>-pops" data-toggle="tab" aria-expanded="false">POPs</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#net-detail-<?=$network->id?>-third" data-toggle="tab" aria-expanded="false">Berechtigungen</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#net-detail-<?=$network->id?>-roles" data-toggle="tab" aria-expanded="false">Berechtigungen</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="net-detail-<?=$network->id?>-detail" class="tab-pane show active">
|
||||
@@ -89,6 +89,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="net-detail-<?=$network->id?>-pops" class="tab-pane">
|
||||
<h4>POPs in <strong><?=$network->name?></strong></h4>
|
||||
<div class="card">
|
||||
@@ -121,48 +122,88 @@
|
||||
|
||||
<a class="btn btn-primary" href="<?=self::getUrl("Pop", "add", ['network_id' => $network->id])?>"><i class="fas fa-plus"></i> Neuen POP anlegen</a>
|
||||
</div>
|
||||
<div id="net-detail-<?=$network->id?>-third" class="tab-pane">
|
||||
|
||||
<div id="net-detail-<?=$network->id?>-roles" class="tab-pane">
|
||||
<h4>Berechtigungen</h4>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if(is_array($network->addresstypes) && count($network->addresstypes)): ?>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<?php foreach(['netowner','salespartner','pipeworker','lineworker','pipeplanner','lineplanner','netoperator',] as $role): ?>
|
||||
<th><?=__($role)?></th>
|
||||
<?php endforeach ?>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($network->addresstypes as $address_id => $addresstypes): ?>
|
||||
<tr>
|
||||
<td><?=AddressModel::getOne($address_id)->getCompanyOrName()?></td>
|
||||
<?php foreach(TT_NETWORK_ROLES as $role): ?>
|
||||
<td>
|
||||
<?php if(AddresstypeModel::getFirst(['address_id' => $address_id, 'addresstype' => [$role]]) !== null): ?>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="role_<?=$role?>[<?=$address_id?>]"
|
||||
value="1"
|
||||
<?php foreach($addresstypes as $type): ?>
|
||||
<?php if($type->type == $role): ?>
|
||||
checked='checked'
|
||||
<?php continue; endif; ?>
|
||||
<?php endforeach; ?>
|
||||
/>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
<td class="controls" style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("Pop", "edit", ["id" => $pop->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?=self::getUrl("Pop", "delete", ["id" => $pop->id])?>" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<form class="form" method="post" action="<?=self::getUrl("NetworkAddress", "save")?>">
|
||||
<input type="hidden" name="network_id" value="<?=$network->id?>" />
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<?php foreach(TT_NETWORK_ROLES as $role): ?>
|
||||
<th class="text-center"><?=__($role)?></th>
|
||||
<?php endforeach ?>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($network->addresstypes as $address_id => $addresstypes): ?>
|
||||
<tr>
|
||||
<td><?=AddressModel::getOne($address_id)->getCompanyOrName()?></td>
|
||||
<?php foreach(TT_NETWORK_ROLES as $role): ?>
|
||||
<td class="text-center">
|
||||
<?php if(AddresstypeModel::getFirst(['address_id' => $address_id, 'addresstype' => [$role]]) !== null): ?>
|
||||
<input
|
||||
type="checkbox"
|
||||
name="roles[<?=$address_id?>][]"
|
||||
value="<?=$role?>"
|
||||
<?php foreach($addresstypes as $type): ?>
|
||||
<?php if($type->type == $role): ?>
|
||||
checked='checked'
|
||||
<?php continue; endif; ?>
|
||||
<?php endforeach; ?>
|
||||
/>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
<td class="controls" style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("NetworkAddress", "delete", ["id" => $address_id])?>" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-check"></i> Speichern</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<p><i>Keine berechtigten Firmen/Personen vorhanden.</i></p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<h4 class="mt-4">Neu</h4>
|
||||
<form class="form" method="post" action="<?=self::getUrl("NetworkAddress", "create")?>">
|
||||
<input type="hidden" name="network_id" value="<?=$network->id?>" />
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Person / Firma</th>
|
||||
<?php foreach(TT_NETWORK_ROLES as $role): ?>
|
||||
<th class="text-center"><?=__($role)?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<select class="select2 form-control " name="address_id" id="address_id">
|
||||
<option></option>
|
||||
<?php foreach(AddressModel::search(["parents_only" => 1]) as $address): ?>
|
||||
<?php if(is_array($network->addresstypes) && array_key_exists($address->id, $network->addresstypes)) continue; ?>
|
||||
<option value="<?=$address->id?>"><?=($address->getCompanyOrName())?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
<?php foreach(TT_NETWORK_ROLES as $role): ?>
|
||||
<td class="text-center">
|
||||
<input type="checkbox" name="roles[]" value="<?=$role?>" />
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<button type="submit" class="btn btn-primary" ><i class="fas fa-plus"></i> Person / Firma hinzufügen</button>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user