Added beginnings of Cpeprovisioning

This commit is contained in:
Frank Schubert
2021-10-14 22:21:10 +02:00
parent 6e2853b6fd
commit 839ba80a64
7 changed files with 333 additions and 5 deletions

View File

@@ -0,0 +1,242 @@
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
<!-- start page title -->
<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")?>">the-tool</a></li>
<li class="breadcrumb-item active">CPE Provisioning</li>
</ol>
</div>
<h4 class="page-title">CPE Provisioning</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<div class="float-left">
<h4 class="header-title">CPE Provisioning</h4>
</div>
<?php if($pagination['maxItems'] > $pagination['count']): ?>
<nav>
<ul class="pagination justify-content-center mb-1">
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod, "Index", ["filter" => $filter])?>" tabindex="-1">Erste</a>
</li>
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
</li>
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
<?php endfor; ?>
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
</li>
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
</li>
</ul>
</nav>
<?php endif; ?>
<div class="pagination justify-content-center">
<?php if($pagination['maxItems']): ?>
Zu provisionierende CPEs <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
<?php else: ?>
Keine CPEs zum provisionieren gefunden
<?php endif; ?>
</div>
<table class="table">
<?php $prov_count = 0; ?>
<?php foreach($products as $product): ?>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> bottom-no-border">
<th>Netzgebiet</th>
<th>Service PIN</th>
<th>Kunde</th>
<th>Produkt</th>
<th>Access Type</th>
<th>VLANs</th>
<th></th>
</tr>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> top-no-border">
<td><?=($product->termination_id) ? $product->termination->building->network->name : $product->order->owner->zip." ".$product->order->owner->city?></td>
<td><?=$product->order->owner->spin?></td>
<td><?=$product->order->owner->getCompanyOrName()?></td>
<td><?=$product->product->name?></td>
<td><?=$product->product->attributes['bras_type']->value?></td>
<td class="text-monospace">
<?php if($product->termination_id): ?>
<span class="order-date-pill active">Public: <strong><?=$product->termination->building->pop->vlan_public?></strong></span>
<span class="order-date-pill active">NAT: <strong><?=$product->termination->building->pop->vlan_nat?></strong></span>
<span class="order-date-pill active">IPv6: <strong><?=$product->termination->building->pop->vlan_ipv6?></strong></span>
<?php else: ?>
<span class="order-date-pill active">Public: <strong><?=$product->product->attributes['vlan_default_public']->value?></strong></span>
<span class="order-date-pill active">NAT: <strong><?=$product->product->attributes['vlan_default_nat']->value?></strong></span>
<span class="order-date-pill active">IPv6: <strong><?=$product->product->attributes['vlan_default_ipv6']->value?></strong></span>
<?php endif; ?>
</td>
<td style="font-size: 18px; cursor:pointer;">
<?php
$vot = false;
$hw = false;
$voip = false;
foreach($product->order->products as $prod) {
if(is_array($prod->product->attributes) && count($prod->product->attributes)) {
if(array_key_exists("hw_only", $prod->product->attributes)) {
if($prod->product->attributes["hw_only"]->value) {
$hw = true;
}
}
if(array_key_exists("voip_chan", $prod->product->attributes)) {
if($prod->product->attributes["voip_chan"]->value) {
$voip = true;
}
}
if(array_key_exists("vot", $prod->product->attributes)) {
if($prod->product->attributes["vot"]->value) {
$vot = true;
}
}
if($hw && $voip_chan) {
break;
}
}
}
?>
<?=($vot) ? "<i class='fas fa-tools text-info mr-2' title='Vorortinstallation'></i>" : ""?>
<?=($hw) ? "<i class='fas fa-shopping-bag text-info mr-2' title='Zusatzprodukt vorhanden'></i>" : ""?>
<?=($voip) ? "<i class='fas fa-phone text-info mr-2' title='Voice Produkt vorhanden'></i>" : ""?>
<?=($product->order->note) ? "<i class='fas fa-clipboard-list text-info title='Kommentar: ".str_replace('"', '&#34;', $product->order->note)."'></i>" : ""?>
</td>
</tr>
<tr class="<?=($prov_count % 2 == 0) ? "table-bg-even" : "table-bg-odd"?> ">
<td colspan="6">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label for="router_type-<?=$product->id?>">Router</label>
<select class="form-control" name="router_type" id="router_type-<?=$product->id?>">
<option></option>
<option value="eigener Router">Eigener Router</option>
<option value="anderes CPE">Anderes CPE</option>
<?php if(preg_match('/^(pppoe|dhcp)$/', $product->product->attributes['bras_type']->value)): ?>
<option value="TP-Link Archer C80">TP-Link Archer C80 (Inet, IPTV)</option>
<option value="FritzBox 4040">FritzBox 4040 (Inet, IPTV)</option>
<option value="FritzBox 7530">FritzBox 7530 (Inet, Phone, IPTV)</option>
<option value="FritzBox 7590">FritzBox 7590 (Inet, Phone, IPTV)</option>
<?php elseif($product->product->attributes['bras_type']->value = "static"): ?>
<option value="Mikrotik HAP AC">Mikrotik HAP AC (Inet, IPTV)</option>
<option value="Mikrotik HEX S">Mikrotik HEX S (Inet, IPTV)</option>
<option value="Mikrotik RB3011">Mikrotik RB3011 (Inet, IPTV)</option>
<?php elseif($product->product->attributes['bras_type']->value == "cmts"): ?>
<option value="FritzBox 6490 Cable">FritzBox 6490 Cable (Inet, Phone, IPTV)</option>
<?php endif; ?>
</select>
</div>
</div>
<div class="col-md-2">
<div class="form-group text-center">
<label class="form-label" for="create_shipment_task-<?=$product->id?>">Versandauftrag erstellen</label>
<input class="form-control" type="checkbox" value="1" name="create_shipment_task" id="create_shipment_task-<?=$product->id?>" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> />
</div>
</div>
<div class="col-md-1">
<div class="form-group">
<label class="form-label" for="ship_weight-<?=$product->id?>">Gewicht</label>
<input class="form-control" type="text" name="ship_weight" id="ship_weight-<?=$product->id?>" value="" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> />
</div>
</div>
<div class="col-md-1">
<div class="form-group">
<label class="form-label" for="ship_length-<?=$product->id?>">Länge</label>
<input class="form-control" type="text" name="ship_length" id="ship_length-<?=$product->id?>" value="" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> />
</div>
</div>
<div class="col-md-1">
<div class="form-group">
<label class="form-label" for="ship_width-<?=$product->id?>">Breite</label>
<input class="form-control" type="text" name="ship_width" id="ship_width-<?=$product->id?>" value="" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> />
</div>
</div>
<div class="col-md-1">
<div class="form-group">
<label class="form-label" for="ship_height-<?=$product->id?>">Höhe</label>
<input class="form-control" type="text" name="ship_height" id="ship_height-<?=$product->id?>" value="" <?=($vot) ? "disabled='disabled' title='Vorortinstallation bestellt'" : ""?> />
</div>
</div>
<div class="col-md-2">
<div class="form-group text-center">
<label class="form-label" for="routerconfig_finished-<?=$product->id?>">Routerkonfiguration fertiggestellt</label>
<input class="form-control" type="checkbox" value="1" name="routerconfig_finished" id="routerconfig_finished-<?=$product->id?>" />
</div>
</div>
<div class="col-md-1">
<div class="form-group">
<label class="form-label">&nbsp;</label>
<button class="form-control btn btn-primary" type="submit"><i class="fas fa-save"></i> Speichern</button>
</div>
</div>
</div>
</td>
<td></td>
</tr>
<?php $prov_count++ ?>
<?php endforeach; ?>
</table>
<?php if($pagination['maxItems'] > $pagination['count']): ?>
<nav>
<ul class="pagination justify-content-center mb-1">
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod, "Index", ["filter" => $filter])?>" tabindex="-1">Erste</a>
</li>
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
</li>
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
<?php endfor; ?>
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
</li>
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
</li>
</ul>
</nav>
<?php endif; ?>
<div class="pagination justify-content-center">
<?php if($pagination['maxItems']): ?>
Zu provisionierende CPEs <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
<?php else: ?>
Keine CPEs zum provisionieren gefunden
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>

View File

@@ -263,7 +263,7 @@
<a href="<?=self::getUrl("Pipework", "Index", ["filter" => ["code" => $order->terminations[0]->building->code, "status_id" => ""]])?>" target="_blank"><span class="status not-connected" title="Tiefbau ausständig">BNC</span></a>
<?php endif; ?>
<?php endif; ?>
<?php
$voip = false;
@@ -447,7 +447,7 @@
var hash = window.location.hash.substr(1);
var match = hash.match(/order=(\d+)/);
if(match && match[1]) {
order = match[1]
order = match[1];
toggleOrder(order);
//$('body').scrollTop($('#order-' + order).offset() - 50);
scrollToDiv('#order-' + order);
@@ -503,7 +503,7 @@
$('#vororttermin-' + id).addClass("is-valid");
$('#vororttermin-' + id).removeClass("is-invalid");
$('#date-pill-' + id + '-install_date').html('Vorortinstallation: <span class="text-monospace"><span class="text-success">14.10.2021</span></span>');
$('#date-pill-' + id + '-install_date').html('Vorortinstallation: <span class="text-monospace"><span class="text-success">' + data.order.date + '</span></span>');
$('#date-pill-' + id + '-install_date').addClass("active");
setTimeout(function() {

View File

@@ -11,7 +11,7 @@
<li class="breadcrumb-item active"><?=($producttech->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title">Produkte</h4>
<h4 class="page-title">Technologien</h4>
</div>
</div>
</div>

View File

@@ -44,6 +44,18 @@
</li>
<?php endif; ?>
<?php if($me->is(["Admin"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fas fa-hard-hat"></i>Netzbetrieb <div class="arrow-down"></div>
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Cpeprovisioning")?>">CPE Provisioning</a></li>
<li><a href="<?=self::getUrl("Cpeshipping")?>">CPE Versand</a></li>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin","salespartner"])): ?>
<li class="has-submenu">
<a href="#">

View File

@@ -0,0 +1,62 @@
<?php
class CpeprovisioningController extends mfBaseController {
protected function init() {
$this->needlogin=true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me",$me);
if(!$me->is(["Admin", "salespartner"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction() {
$this->layout()->setTemplate("Cpeprovisioning/Index");
$cpeproducts = [];
/*
* Get orderproducts in need of sending CPE
*/
$orders = OrderModel::search(["finish_date" => null]);
foreach($orders as $order) {
if($order->finish_after) {
// show at most 4 weeks before finish_after date
$after_ts = Layout::dateToInt($order->finish_after);
if($after_ts > date("U") + (31 * 86400)) {
$this->log->debug("Before 4 weeks before finish_after oid ".$order->id);
continue;
}
}
foreach($order->products as $orderproduct) {
$product = $orderproduct->product;
if(is_array($product->attributes) && count($product->attributes)) {
// filter out products without bras_type
if(array_key_exists("bras_type", $product->attributes) && $product->attributes['bras_type']->value) {
$cpeproducts[] = $orderproduct;
} else {
$this->log->debug("no bras_type oid ".$order->id);
continue;
}
} else {
// ignore products without attributes
$this->log->debug("no attributes oid ".$order->id);
continue;
}
}
}
//var_dump($cpeproducts);exit;
$this->layout()->set("products", $cpeproducts);
}
}

View File

@@ -682,7 +682,7 @@ class OrderController extends mfBaseController {
$order->install_date = $date;
$order->save();
$this->returnJson(["status" => "OK", "order" => ['id' => $order_id]]);
$this->returnJson(["status" => "OK", "order" => ['id' => $order_id, 'date' => date('d.m.Y', $date)]]);
}
protected function deleteAction() {

View File

@@ -278,4 +278,16 @@ td.controls {
.order-date-pill.active {
border-color: #25b343;
background-color: #f0fff0;
}
.top-no-border td,
.top-no-border th {
border-top: none;
padding-top: 2px;
}
.bottom-no-border td,
.bottom-no-border th {
border-bottom: none;
padding-bottom: 2px;
}