changes linework to openable list

This commit is contained in:
Frank Schubert
2022-02-15 20:41:59 +01:00
parent a7ed80f6b9
commit 9f908e56db
17 changed files with 729 additions and 11 deletions

View File

@@ -0,0 +1,118 @@
<?php
$siteTitle = "Benutzer";
?>
<?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"><a href="<?=self::getUrl("Contract")?>">Verträge</a></li>
<li class="breadcrumb-item">Vertragsconfig</li>
</ol>
</div>
<h4 class="page-title">Vertragsconfig</h4>
</div>
</div>
</div>
<!-- end page title -->
<!-- Main content -->
<div class="row">
<div class="col-lg">
<div class="card">
<div class="card-body">
<?php if(is_array($groups) && count($groups)): ?>
<?php foreach($groups as $group): ?>
<h4>Gruppe <?=$group->name?></h4>
<form method="post" action="<?=$this->getUrl("User","save")?>">
<?php if(is_array($group->items) && count($group->items)): ?>
<?php foreach($group->items as $item): ?>
<div class="p-2 <?=($i % 2 == 0) ? "bg-light" : ""?>">
<div class="row">
<div class="col-md-11 float-left">
<h4 class="header-title">Attribut <span class="text-monospace text-pink"><?=$item->name?></span></h4>
</div>
<div class="col-md-1 float-right">
<small><a class="text-danger" href="<?=self::getUrl("ProducttechAttribute", "delete", ['id' => $item->id])?>" onclick="if(!confirm('Attribut wirklich löschen?')) return false;"><i class="fas fa-trash-alt"></i> löschen</a></small>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="item_<?=$item->id?>_name">Name <small class="text-monospace">[a-z0-9._-]</small></label>
<input type="text" class="form-control" id="item_<?=$item->id?>_name" name="item[<?=$item->id?>][name]" value="<?=$item->name?>" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="item_<?=$item->id?>_type">Datentyp</label>
<select class="form-control" id="item_<?=$item->id?>_type" name="item[<?=$item->id?>][type]">
<option value="string">String</option>
<option value="int">Ganzzahl</option>
<option value="decimal">Dezimalzahl</option>
<option value="enum">Auswahl</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group" id="ddata_<?=$item->id?>">
<label for="item_<?=$item->id?>_data">Auswahldaten (1 Element pro Zeile)</label>
<textarea class="form-control" id="item_<?=$item->id?>_data" name="item[<?=$item->id?>][data]"><?=$item->typedata?></textarea>
<input type="text" class="form-control" id="item_<?=$item->id?>_pattern" name="item[<?=$item->id?>][pattern]" value="<?=$item->pattern?>" />
</div>
</div>
</div>
<div class="form-group row">
<div class="col-md-4">
<div class="form-group">
<label for="item_<?=$item->id?>_displayname">Anzeigename</label>
<input type="text" class="form-control" id="item_<?=$item->id?>_displayname" name="item[<?=$item->id?>][displayname]" value="<?=$item->displayname?>" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="item_<?=$item->id?>_value">Standardwert</label>
<input type="text" class="form-control" id="item_<?=$item->id?>_value" name="item[<?=$item->id?>][value]" value="<?=$item->value?>">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="item_<?=$item->id?>_description">Beschreibung</label>
<input type="text" class="form-control" id="item_<?=$item->id?>_description" name="item[<?=$item->id?>][description]" value="<?=$item->description?>" />
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php else: ?>
<i>Keine Vertragsconfig Gruppen gefunden</i>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#address_id").select2({
allowClear: true,
placeholder: ""
});
</script>
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?><?php

View File

@@ -137,6 +137,17 @@
<?php if(!count($terminations)) continue; ?>
<h4><?=$networkname?></h4>
<table class="table workflow-table mb-2">
<tr>
<th>Anschluss</th>
<th>Baustatus</th>
<th>Patchstatus</th>
<th>BB hergestellt</th>
<th>BEP montiert</th>
<th>K-Kabel eingeblasen</th>
<th>Spleiß Netz</th>
<th>Spleiß Kunde</th>
<th>Fertig</th>
</tr>
<?php $bcount = 0; foreach($terminations as $term): ?>
<?php
$rowspan = 1;
@@ -146,7 +157,48 @@
}
}
?>
<tr id="termination-<?=$term->id?>" class="table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?>">
<?php if($bcount > 0): ?>
<tr id="termination-<?=$term->id?>-top-header" class="hidden">
<th>Anschluss</th>
<th>Baustatus</th>
<th>Patchstatus</th>
<th>BB hergestellt</th>
<th>BEP montiert</th>
<th>K-Kabel eingeblasen</th>
<th>Spleiß Netz</th>
<th>Spleiß Kunde</th>
<th>Fertig</th>
</tr>
<?php endif ?>
<tr id="termination-<?=$term->id?>-summary" class="pointer table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?>">
<td onclick="togglePipework(<?=$term->id?>)">
<div class="name">
<?php if($term->building->gps_lat && $term->building->gps_long): ?>
<a href="https://maps.google.com/maps?t=k&q=loc:<?=$term->building->gps_lat?>+<?=$term->building->gps_long?>" target="_blank">
<i class='fas fa-globe-europe'></i> <strong style="white-space: nowrap;"><?=$term->building->street?></strong>
</a>
<?php else: ?>
<strong style="white-space: nowrap;"><?=$term->building->street?></strong>
<?php endif; ?>
<br />
<span class="text-monospace">[<?=__($term->building->status->name."-b")?>]</span>
<br />
<a href="<?=self::getUrl("Pipework", "Index", ["filter" => ["code" => $term->building->code]])?>" target="_blank"><span class="text-success"><?=$term->code?></span></a>
</div>
<div class="up-arrow hidden">
<i class="fas fa-angle-up"></i>
</div>
</td>
<td onclick="togglePipework(<?=$term->id?>)"><?=(empty($term->building->getWorkflowvalue('pipework_finished') && empty($term->building->getWorkflowvalue('ist_pipework_finished')))) ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>"?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->isWorkflowPatchingDone()) ? "<i class='fas fa-check text-success'></i>" : "<i class='fas fa-times text-danger'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('backbone_finished') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('bep_deployed') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('customer_cable_injected') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('spliced_network') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('spliced_customer') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
<td onclick="togglePipework(<?=$term->id?>)"><?=($term->getWorkflowvalue('customer_passive_finished') != "1") ? "<i class='fas fa-times text-danger'></i>" : "<i class='fas fa-check text-success'></i>" ?></td>
</tr>
<tr id="termination-<?=$term->id?>" class="table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?> hidden">
<td>
<div>
<div>
@@ -196,7 +248,7 @@
Nicht fertiggestellt.
</div>
</td>
<td>
<td colspan="8">
<table class="table workflow-table table-bordered table-sm table-bg-<?=($bcount % 2 == 0) ? "odd" : "even"?>">
<tr>
<th>AP-Typ</th>
@@ -321,6 +373,19 @@
</form>
</td>
</tr>
<?php if($bcount < count($terminations) - 1): ?>
<tr id="termination-<?=$term->id?>-bottom-header" class="hidden">
<th>Anschluss</th>
<th>Baustatus</th>
<th>Patchstatus</th>
<th>BB hergestellt</th>
<th>BEP montiert</th>
<th>K-Kabel eingeblasen</th>
<th>Spleiß Netz</th>
<th>Spleiß Kunde</th>
<th>Fertig</th>
</tr>
<?php endif; ?>
<?php $bcount++; endforeach; ?>
</table>
<?php endforeach; ?>
@@ -482,6 +547,14 @@ $(document).ready(function() {
});
function togglePipework(id) {
$("#termination-" + id).toggle(200);
$("#termination-" + id + "-summary td .name").toggle();
$("#termination-" + id + "-summary td .up-arrow").toggle();
$("#termination-" + id + "-bottom-header").toggle();
$("#termination-" + id + "-top-header").toggle();
}
function validateWorkflowItem(id) {
var required_fields = {
pop_id: "int",

View File

@@ -0,0 +1,3 @@
<?php
/** @var Terminatino $term */
?>

View File

@@ -53,8 +53,8 @@
<label class="col-lg-2 col-form-label" for="routing">Routing</label>
<div class="col-lg-10">
<select name="routing" class="form-control">
<option value="kolmisoft" <?=($number->routing == "kolmisoft") ? "selected='selected'" : ""?>>kolmisoft</option>
<option value="sipit" <?=($number->routing == "sipit") ? "selected='selected'" : ""?>>sipit</option>
<option value="kolmisoft" <?=($number->routing == "kolmisoft") ? "selected='selected'" : ""?>><?=__("kolmisoft")?></option>
<option value="sipit" <?=($number->routing == "sipit") ? "selected='selected'" : ""?>><?=__("sipit")?></option>
</select>
</div>
</div>

View File

@@ -26,7 +26,7 @@
<span class="text-danger"><i class="fas fa-times"></i></span>
<?php endif; ?>
</td>
<td><?=$num->routing?></td>
<td><?=__($num->routing)?></td>
<td>
<?php if($num->ported_out): ?>
Exportiert

View File

@@ -87,7 +87,20 @@
</ul>
</li>
<?php endif; ?>
<!--
<?php if($me->is(["Admin"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fas fa-shopping-basket"></i>Verträge<div class="arrow-down"></div>
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Contract")?>"><i class="fas fa-file-contract"></i> Verträge</a></li>
<li><hr /></li>
<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fas fa-wrench"></i> Vertragsconfig</a></li>
</ul>
</li>
<?php endif; ?>
-->
</ul>
<!-- End navigation menu -->

View File

@@ -79,9 +79,46 @@ class Building extends mfBaseModel {
return $code;
}
public function getWorkflowvalue($itemname, $type = "string") {
public function getWorkflowvalue($itemname, $type = false) {
$item = WorkflowitemModel::getFirst(['name' => $itemname]);
if(!$item->id) {
return null;
}
switch($item->type) {
case "string":
$value_type = "string";
break;
case "enum":
$value_type = "string";
break;
case "gps":
$value_type = "string";
break;
case "color":
$value_type = "string";
break;
case "date":
$value_type = "string";
break;
case "int":
$value_type = "int";
break;
case "bool":
$value_type = "int";
break;
case "file":
$value_type = "int";
break;
case "text":
$value_type = "text";
break;
default:
$value_type = "string";
}
if(array_key_exists($itemname, $this->getProperty("workflowitems"))) {
return $this->getProperty("workflowitems")[$itemname]->value->{"value_$type"};
return $this->getProperty("workflowitems")[$itemname]->value->{"value_$value_type"};
}
return null;

View File

@@ -0,0 +1,23 @@
<?php
class ContractconfigController 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"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction() {
$groups = ContractconfigGroupModel::getAll();
$this->layout()->set("groups", $groups);
}
}

View File

@@ -0,0 +1,30 @@
<?php
class ContractconfigGroup extends mfBaseModel {
private $items;
private $value;
public function getProperty($name) {
if($this->$name == null) {
if($name == "items") {
$this->items = ContractconfigItemModel::search(['group_id' => $this->id]);
return $this->items;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);
if($this->$name->id) {
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}

View File

@@ -0,0 +1,114 @@
<?php
class ContractconfigGroupModel {
public $name;
public $description;
public $filename;
public $store_filename;
public $orig_filename;
public $subfolder;
public $create_by = null;
public $edit_by = null;
public $create = null;
public $edit = null;
public static function create(Array $data) {
$model = new ContractconfigGroup();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
$model ->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("ContractconfigGroup", "*", "1=1 ORDER BY name, `create`");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ContractconfigGroup($data);
}
}
return $items;
}
public static function getFirst() {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("ContractconfigGroup", "*", "$where LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new ContractconfigGroup($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("ContractconfigGroup", "*", "$where ORDER BY name, filename");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ContractconfigGroup($data);
}
}
return $items;
}
private function getSqlFilter($filter) {
$where = "1=1 ";
//var_dump($filter);exit;
if(array_key_exists("name", $filter)) {
$name = FronkDB::singleton()->escape($filter['name']);
if($name) {
$where .= " AND name='$name'";
}
}
if(array_key_exists("filename", $filter)) {
$filename = FronkDB::singleton()->escape($filter['filename']);
if($filename) {
$where .= " AND filename='$filename'";
}
}
if(array_key_exists("subfolder", $filter)) {
$subfolder = FronkDB::singleton()->escape($filter['subfolder']);
if($subfolder) {
$where .= " AND subfolder='$subfolder'";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -0,0 +1,5 @@
<?php
class ContractconfigItem extends mfBaseModel {
}

View File

@@ -0,0 +1,115 @@
<?php
class ContractconfigItemModel {
public $name;
public $description;
public $filename;
public $store_filename;
public $orig_filename;
public $subfolder;
public $create_by = null;
public $edit_by = null;
public $create = null;
public $edit = null;
public static function create(Array $data) {
$model = new ContractconfigItem();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
$model ->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("ContractconfigItem", "*", "1=1 ORDER BY name, `create`");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ContractconfigItem($data);
}
}
return $items;
}
public static function getFirst() {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("ContractconfigItem", "*", "$where LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new ContractconfigItem($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("ContractconfigItem", "*", "$where ORDER BY name");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ContractconfigItem($data);
}
}
return $items;
}
private function getSqlFilter($filter) {
$where = "1=1 ";
//var_dump($filter);exit;
if(array_key_exists("name", $filter)) {
$name = FronkDB::singleton()->escape($filter['name']);
if($name) {
$where .= " AND name='$name'";
}
}
if(array_key_exists("type", $filter)) {
$type = FronkDB::singleton()->escape($filter['type']);
if($type) {
$where .= " AND type='$type'";
}
}
if(array_key_exists("group_id", $filter)) {
$group_id = $filter['group_id'];
if(is_numeric($group_id)) {
$where .= " AND group_id=$group_id";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -0,0 +1,5 @@
<?php
class ContractconfigValue extends mfBaseModel {
}

View File

@@ -0,0 +1,114 @@
<?php
class ContractconfigValueModel {
public $name;
public $description;
public $filename;
public $store_filename;
public $orig_filename;
public $subfolder;
public $create_by = null;
public $edit_by = null;
public $create = null;
public $edit = null;
public static function create(Array $data) {
$model = new ContractconfigValue();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
$model ->$field = $value;
}
}
$me = new User();
$me->loadMe();
if($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("ContractconfigValue", "*", "1=1");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ContractconfigValue($data);
}
}
return $items;
}
public static function getFirst() {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("ContractconfigValue", "*", "$where LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new ContractconfigValue($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("ContractconfigValue", "*", "$where ORDER BY name, filename");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ContractconfigValue($data);
}
}
return $items;
}
private function getSqlFilter($filter) {
$where = "1=1 ";
//var_dump($filter);exit;
if(array_key_exists("name", $filter)) {
$name = FronkDB::singleton()->escape($filter['name']);
if($name) {
$where .= " AND name='$name'";
}
}
if(array_key_exists("filename", $filter)) {
$filename = FronkDB::singleton()->escape($filter['filename']);
if($filename) {
$where .= " AND filename='$filename'";
}
}
if(array_key_exists("subfolder", $filter)) {
$subfolder = FronkDB::singleton()->escape($filter['subfolder']);
if($subfolder) {
$where .= " AND subfolder='$subfolder'";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -25,7 +25,7 @@ class LineworkController extends mfBaseController {
// pagination defaults
$pagination = [];
$pagination['start'] = 0;
$pagination['count'] = 5;
$pagination['count'] = 20;
$pagination['maxItems'] = 0;
if(is_numeric($this->request->s)) {

View File

@@ -35,14 +35,79 @@ class Termination extends mfBaseModel {
return $address;
}
public function getWorkflowvalue($itemname, $type = "string") {
public function getWorkflowvalue($itemname, $type = false) {
$item = WorkflowitemModel::getFirst(['name' => $itemname]);
if(!$item->id) {
return null;
}
switch($item->type) {
case "string":
$value_type = "string";
break;
case "enum":
$value_type = "string";
break;
case "gps":
$value_type = "string";
break;
case "color":
$value_type = "string";
break;
case "date":
$value_type = "string";
break;
case "int":
$value_type = "int";
break;
case "bool":
$value_type = "int";
break;
case "file":
$value_type = "int";
break;
case "text":
$value_type = "text";
break;
default:
$value_type = "string";
}
if(array_key_exists($itemname, $this->getProperty("workflowitems"))) {
return $this->getProperty("workflowitems")[$itemname]->value->{"value_$type"};
return $this->getProperty("workflowitems")[$itemname]->value->{"value_$value_type"};
}
return null;
}
public function isWorkflowPatchingDone() {
$item_names = [
'pop_id',
'schrank',
'baugruppe',
'modul',
'ports',
'abschlusstyp',
'bb_kabel',
'bb_kabel_steps',
'bb_fasern',
'kundenkabel_typ',
'kundenkabel_fasern'
];
$done = true;
foreach($item_names as $name) {
$this->log->debug(__FILE__.": (Termination ".$this->id.") $name => $type == '".$this->getWorkflowvalue($name)."' (ist: '".$this->getWorkflowvalue("ist_".$name)."')");
if(empty($this->getWorkflowvalue($name)) && empty($this->getWorkflowvalue("ist_".$name))) {
$done = false;
break;
}
}
return $done;
}
public function getPop() {
$pop_id = $this->getWorkflowvalue('pop_id');
if(!$pop_id) {

View File

@@ -35,4 +35,7 @@ $l['passed-t'] = "Fasern im Gebäude";
$l['connected-t'] = "Passiv erschlossen";
$l['active-t'] = "Internetprodukt aktiv";
$l['kolmisoft'] = "VPORTAL (kolmisoft)";
$l['sipit'] = "SCA (sipit)";
$lang['de'] = $l;