Added SLA to Products
This commit is contained in:
@@ -106,7 +106,8 @@
|
||||
<div class="col-lg-2">Neue Technologie:</div>
|
||||
<div class="col-lg-10">
|
||||
Name: <input type="text" class="form-control" name="producttech_new_name" id="producttech_new_name" value="<?=$producttech_new_name?>">
|
||||
Code: <input type="text" class="form-control" name="producttech_new_code" id="producttech_new_code" value="<?=$producttech_new_code?>">
|
||||
Kundentyp: <select name="producttech_new_customer_type" class="form-control"><option value="residential">Residential</option><option value="business">Business</option></select>
|
||||
RTR Code: <input type="text" class="form-control" name="producttech_new_rtrcode" id="producttech_new_rtrcode" value="<?=$producttech_new_rtrcode?>">
|
||||
Beschreibung: <textarea class="form-control" name="producttech_new_description" id="productgroup_new_description"><?=$producttech_new_description?></textarea>
|
||||
Interne Notiz: <textarea class="form-control" name="producttech_new_note" id="productgroup_new_note"><?=$producttech_new_note?></textarea>
|
||||
</div>
|
||||
@@ -115,7 +116,19 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="price">Verkaufspreis</label>
|
||||
<label class="col-lg-2 col-form-label" for="sla_id">SLA</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="sla_id" id="sla_id">
|
||||
<option></option>
|
||||
<?php foreach($slas as $sla): ?>
|
||||
<option value="<?=$sla->id?>" <?=($product->sla_id == $sla->id) ? "selected='selected'" : ""?>><?=$sla->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="price">Verkaufspreis Netto</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" name="price" id="price" class="form-control" value="<?=$this::dotToComma($product->price)?>" />
|
||||
</div>
|
||||
@@ -142,6 +155,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="ivt_id">IVT Produkt ID</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="ivt_id" id="ivt_id" value="<?=$product->ivt_id?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<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"><a href="<?=self::getUrl("Product")?>">Produkte</a></li>
|
||||
<li class="breadcrumb-item active">Produkte</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Produkte</h4>
|
||||
@@ -37,8 +37,11 @@
|
||||
<th>Gruppe</th>
|
||||
<th>Name</th>
|
||||
<th>Technologie</th>
|
||||
<th>Kundentyp</th>
|
||||
<th>Verkaufspreis</th>
|
||||
<th>Verr. Periode</th>
|
||||
<th>SLA</th>
|
||||
<th>IVT ID</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($products as $product): ?>
|
||||
@@ -47,8 +50,11 @@
|
||||
<td><?=$product->productgroup->name?></td>
|
||||
<td><?=$product->name?></td>
|
||||
<td><?=$product->producttech->name?></td>
|
||||
<td><?=__($product->producttech->customer_type)?></td>
|
||||
<td><?=$product->price?></td>
|
||||
<td><?=$product->billing_period?>x Jährlich</td>
|
||||
<td><?=$product->sla->name?></td>
|
||||
<td><?=$product->ivt_id?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("Product", "edit", ["id" => $product->id])?>"><i class="far fa-edit" title="Produkt Bearbeiten"></i></a>
|
||||
<a href="<?=self::getUrl("Product", "delete", ["id" => $product->id])?>" class="text-danger" onclick="if(!confirm('Berechtigungen wirklich löschen?')) return false;" title="Produkt Löschen"><i class="fas fa-trash"></i></a>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<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">Benutzer</li>
|
||||
<li class="breadcrumb-item active">Benutzer</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Benutzer</h4>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<li><a href="<?=self::getUrl("User")?>">Benutzer</a></li>
|
||||
<li><a href="<?=self::getUrl("Network")?>">Neztgebiete</a></li>
|
||||
<li><a href="<?=self::getUrl("Product")?>">Produkte</a></li>
|
||||
<li><a href="<?=self::getUrl("Productgroup")?>">Produktgruppen</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -17,5 +17,7 @@ class Product extends mfBaseModel {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ class ProductController extends mfBaseController {
|
||||
$this->layout()->setTemplate("Product/Form");
|
||||
$this->layout()->set("productgroups", ProductgroupModel::getAll());
|
||||
$this->layout()->set("producttechs", ProducttechModel::getAll());
|
||||
$this->layout()->set("slas", SlaModel::getAll());
|
||||
|
||||
}
|
||||
|
||||
@@ -57,18 +58,24 @@ class ProductController extends mfBaseController {
|
||||
$data = [];
|
||||
$data['name'] = $r->name;
|
||||
$data['description'] = $r->description;
|
||||
$data['sla_id'] = $r->sla_id;
|
||||
$data['external'] = ($r->external == 1) ? "1" : "0";
|
||||
$data['price_nne'] = Layout::commaToDot($r->price_nne);
|
||||
$data['price_nbe'] = Layout::commaToDot($r->price_nbe);
|
||||
$data['price'] = Layout::commaToDot($r->price);
|
||||
$data['billing_period'] = $r->billing_period;
|
||||
$data['ivt_id'] = ($r->ivt_id) ? $r->ivt_id : null;
|
||||
$data['note'] = $r->note;
|
||||
|
||||
if(is_numeric($r->producttech_id)) {
|
||||
$data['producttech_id'] = $r->producttech_id;
|
||||
} else {
|
||||
$data['producttech_id'] = null;
|
||||
}
|
||||
if(is_numeric($r->productgroup_id)) {
|
||||
$data['productgroup_id'] = $r->productgroup_id;
|
||||
} else {
|
||||
$data['productgroup_id'] = null;
|
||||
}
|
||||
|
||||
$data['edit_by'] = 1;
|
||||
@@ -105,7 +112,8 @@ class ProductController extends mfBaseController {
|
||||
if($r->producttech_id == "new") {
|
||||
$nt = [];
|
||||
$nt['name'] = $r->producttech_new_name;
|
||||
$nt['code'] = $r->producttech_new_code;
|
||||
$nt['rtrcode'] = $r->producttech_new_rtrcode;
|
||||
$nt['customer_type'] = ($r->producttech_new_customer_type == "business") ? "business" : "residential";
|
||||
$nt['description'] = $r->producttech_new_description;
|
||||
$nt['note'] = $r->producttech_new_note;
|
||||
$tech = ProducttechModel::create($nt);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class ProductModel {
|
||||
public $name = null;
|
||||
public $description = null;
|
||||
public $sla_id = null;
|
||||
public $external = null;
|
||||
public $productgroup_id = null;
|
||||
public $producttech_id = null;
|
||||
@@ -10,6 +11,7 @@ class ProductModel {
|
||||
public $price_nne = null;
|
||||
public $price_nbe = null;
|
||||
public $billing_period = null;
|
||||
public $ivt_id = null;
|
||||
|
||||
public $note = null;
|
||||
public $create_by = null;
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
class ProducttechModel {
|
||||
public $name = null;
|
||||
public $code = null;
|
||||
public $rtrcode = null;
|
||||
public $customer_type = null;
|
||||
public $description = null;
|
||||
|
||||
public $note = null;
|
||||
@@ -115,13 +116,18 @@ class ProducttechModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("code", $filter)) {
|
||||
$code = $db->escape($filter['code']);
|
||||
if($code) {
|
||||
$where .= " AND `code` like '$code'";
|
||||
if(array_key_exists("rtrcode", $filter)) {
|
||||
$rtrcode = $db->escape($filter['rtrcode']);
|
||||
if($rtrcode) {
|
||||
$where .= " AND `code` like '$rtrcode'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("customer_type", $filter)) {
|
||||
$customer_type = ($customer_type == "business") ? "business" : "residential";
|
||||
$where .= " AND `customer_type`='$customer_type'";
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
5
application/Sla/Sla.php
Normal file
5
application/Sla/Sla.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Sla extends mfBaseModel {
|
||||
|
||||
}
|
||||
122
application/Sla/SlaModel.php
Normal file
122
application/Sla/SlaModel.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
class SlaModel {
|
||||
public $name = null;
|
||||
public $description = null;
|
||||
|
||||
public $note = null;
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new Sla();
|
||||
|
||||
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 getOne($id) {
|
||||
if(!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Sla", "*", "id=$id LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Sla($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Sla", "*", "1 = 1 ORDER BY name");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Sla($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Sla", "*", "$where ORDER BY name LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Sla($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("Sla", "*", "$where ORDER BY name");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Sla($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
//var_dump($filter);exit;
|
||||
|
||||
if(array_key_exists("name", $filter)) {
|
||||
$name = $db->escape($filter['name']);
|
||||
if($name) {
|
||||
$where .= " AND `name` like '$name'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("nameLike", $filter)) {
|
||||
$name = $db->escape($filter['nameLike']);
|
||||
if($name) {
|
||||
$where .= " AND `name` like '%$name%'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ CREATE TABLE `Product` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
|
||||
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci,
|
||||
`customer_type` ENUM('residential','business') NOT NULL DEFAULT 'residential',
|
||||
`sla_id` int NOT NULL,
|
||||
`external` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`producttech_id` int DEFAULT NULL,
|
||||
`productgroup_id` int DEFAULT NULL,
|
||||
@@ -9,13 +11,14 @@ CREATE TABLE `Product` (
|
||||
`price_nbe` decimal(12,2) DEFAULT NULL,
|
||||
`price` decimal(12,2) NOT NULL,
|
||||
`billing_period` int NOT NULL COMMENT 'in months',
|
||||
`ivt_id` INT(11) NULL DEFAULT NULL,
|
||||
`note` text COLLATE utf8mb4_unicode_520_ci,
|
||||
`create_by` int NOT NULL,
|
||||
`edit_by` int NOT NULL,
|
||||
`create` int NOT NULL,
|
||||
`edit` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
||||
|
||||
CREATE TABLE `ProductNetwork` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
@@ -26,7 +29,7 @@ CREATE TABLE `ProductNetwork` (
|
||||
`create` int NOT NULL,
|
||||
`edit` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
||||
|
||||
CREATE TABLE `Productattribute` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
@@ -42,7 +45,7 @@ CREATE TABLE `Productattribute` (
|
||||
`create` int NOT NULL,
|
||||
`edit` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
||||
|
||||
CREATE TABLE `Productgroup` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
@@ -54,7 +57,7 @@ CREATE TABLE `Productgroup` (
|
||||
`create` int NOT NULL,
|
||||
`edit` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
||||
|
||||
CREATE TABLE `Producttech` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
@@ -67,7 +70,7 @@ CREATE TABLE `Producttech` (
|
||||
`create` int NOT NULL,
|
||||
`edit` int NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
||||
|
||||
CREATE TABLE `ProducttechAttribute` (
|
||||
`id` int NOT NULL,
|
||||
@@ -80,4 +83,4 @@ CREATE TABLE `ProducttechAttribute` (
|
||||
`edit_by` int NOT NULL,
|
||||
`create` int NOT NULL,
|
||||
`edit` int NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
|
||||
|
||||
@@ -18,6 +18,7 @@ $l['supplier'] = "Lieferant";
|
||||
$l['suppliers'] = "Lieferanten";
|
||||
$l['contact'] = "Kontakt";
|
||||
$l['billing'] = "Verrechnungsadresse";
|
||||
|
||||
$l['business'] = "Business";
|
||||
$l['residential'] = "Residential";
|
||||
|
||||
$lang['de'] = $l;
|
||||
Reference in New Issue
Block a user