Added Products

This commit is contained in:
Frank Schubert
2021-07-05 16:12:28 +02:00
parent 5c99e8008e
commit 4fae807663
21 changed files with 1040 additions and 13 deletions
+1 -2
View File
@@ -10,8 +10,7 @@
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">the-tool</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboard</a></li>
<li class="breadcrumb-item active">Starter</li>
<li class="breadcrumb-item active">Dashboard</li>
</ol>
</div>
<h4 class="page-title">Dashboard</h4>
+5 -3
View File
@@ -133,6 +133,7 @@
<table class="table table-bordered">
<tr>
<th>Name</th>
<th>Netzeigentümer</th>
<?php foreach(TT_NETWORK_ROLES as $role): ?>
<th class="text-center"><?=__($role)?></th>
<?php endforeach ?>
@@ -141,10 +142,11 @@
<?php foreach($network->addresstypes as $address_id => $addresstypes): ?>
<tr>
<td><?=AddressModel::getOne($address_id)->getCompanyOrName()?></td>
<td><input type="checkbox" <?=($network->owner_id == $address_id) ? "checked='checked'" : ""?> disabled="disabled" /></td>
<?php foreach(TT_NETWORK_ROLES as $role): ?>
<td class="text-center">
<?php if(AddresstypeModel::getFirst(['address_id' => $address_id, 'addresstype' => [$role]]) !== null): ?>
<input
<input type="checkbox"
type="checkbox"
name="roles[<?=$address_id?>][]"
value="<?=$role?>"
@@ -158,7 +160,7 @@
</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>
<a href="<?=self::getUrl("NetworkAddress", "delete", ["network_id" => $network->id, "address_id" => $address_id])?>" onclick="if(!confirm('Berechtigungen wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
@@ -184,7 +186,7 @@
<tr>
<td>
<select class="select2 form-control " name="address_id" id="address_id">
<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; ?>
+2 -2
View File
@@ -148,10 +148,10 @@
$(this).on('wheel.disableScroll', function (e) {
e.preventDefault()
})
})
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('wheel.disableScroll')
})
});
</script>
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
+235
View File
@@ -0,0 +1,235 @@
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
<div class="wrapper">
<div class="container-fluid">
<!-- 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("Product")?>">Produkte</a></li>
<li class="breadcrumb-item active"><?=($product->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title">Produkte</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2"><?=($product->id) ? "Produkt bearbeiten" : "Neues Produkt"?></h4>
<form class="form-horizontal" method="post" action="<?=self::getUrl("Product", "save")?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?=$product->id?>" />
<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="<?=$product->name?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="description">Beschreibung</label>
<div class="col-lg-10">
<textarea name="description" id="description" class="form-control" rows="2"><?=$product->description?></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="external">Fremdprodukt</label>
<div class="col-lg-10">
<select class="select2 form-control " name="external" id="external">
<option value="0" <?=($product->external != 1) ? "selected='selected'" : ""?>>Nein</option>
<option value="1" <?=($product->external == 1) ? "selected='selected'" : ""?>>Ja</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="productgroup_id">Produktgruppe</label>
<div class="col-lg-10">
<select class="select2 form-control" name="productgroup_id" id="productgroup_id">
<option></option>
<option value="new">Neue Produktgruppe...</option>
<option value="1">1</option>
<?php foreach($productgroups as $group): ?>
<option value="<?=$group->id?>" <?=($product->productgroup_id == $group->id) ? "selected='selected'" : ""?>><?=$group->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row" id="productgroup_form" style="display:none;">
<label class="col-lg-2 col-form-label" for="productgroup_new"></label>
<div class="col-lg-10">
<div class="row">
<div class="col-lg-2">Neue Produktgruppe:</div>
<div class="col-lg-10">
Name: <input type="text" class="form-control" name="productgroup_new_name" id="productgroup_new_name" value="<?=$productgroup_new_name?>">
Code: <input type="text" class="form-control" name="productgroup_new_code" id="productgroup_new_code" value="<?=$productgroup_new_code?>">
Beschreibung: <textarea class="form-control" name="productgroup_new_description" id="productgroup_new_description"><?=$productgroup_new_description?></textarea>
Interne Notiz: <textarea class="form-control" name="productgroup_new_note" id="productgroup_new_note"><?=$productgroup_new_note?></textarea>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="producttech_id">Technologie</label>
<div class="col-lg-10">
<select class="select2 form-control " name="producttech_id" id="producttech_id">
<option></option>
<option value="new">Neue Technologie...</option>
<?php foreach($producttechs as $tech): ?>
<option value="<?=$tech->id?>" <?=($product->producttech_id == $tech->id) ? "selected='selected'" : ""?>><?=$tech->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row" id="producttech_form" style="display: none;">
<label class="col-lg-2 col-form-label" for="producttech_new"></label>
<div class="col-lg-10">
<div class="row">
<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?>">
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>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="price">Verkaufspreis</label>
<div class="col-lg-10">
<input type="text" name="price" id="price" class="form-control" value="<?=$this::dotToComma($product->price)?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="nne">Netznutzungsentgelt (NNE)</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="price_nne" id="price_nne" value="<?=$this::dotToComma($product->price_nne)?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="nbe">Netzbetriebsentgelt (NBE)</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="price_nbe" id="price_nbe" value="<?=$this::dotToComma($product->price_nbe)?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="billing_period">Verrechnungsperiode</label>
<div class="col-lg-10">
<select class="select2 form-control " name="billing_period" id="billing_period">
<option value="1" <?=($product->billing_period == 1) ? "selected='selected'" : ""?>>Jährlich</option>
<option value="12" <?=($product->billing_period == 12) ? "selected='selected'" : ""?>>Monatlich</option>
</select>
</div>
</div>
</div>
</div>
<?php if(is_array($attributes) && count($attributes)): ?>
<h4 class="header-title mb-2">Zusatzdaten</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="rtrcode">RTR Betreiber ID</label>
<div class="col-lg-10">
<input class="form-control" name="attributes[rtrcode]" id="rtrcode" value="<?=$address->attributes['rtrcode']->value?>">
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<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"><?=$product->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>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div> <!-- end container-fluid -->
</div>
<!-- end wrapper -->
<script type="text/javascript">
$("#productgroup_id").select2({
allowClear: true,
placeholder: ""
});
$("#producttech_id").select2({
allowClear: true,
placeholder: ""
});
$('#productgroup_id').change(function() {
var value = $('#productgroup_id option:selected').val();
console.log(value);
if(value == "new") {
$('#productgroup_form').show();
} else {
$('#productgroup_form').hide();
}
});
$('#producttech_id').change(function() {
var value = $('#producttech_id option:selected').val();
console.log(value);
if(value == "new") {
$('#producttech_form').show();
} else {
$('#producttech_form').hide();
}
});
// disable mousewheel on 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')
});
</script>
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
+69
View File
@@ -0,0 +1,69 @@
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
<div class="wrapper">
<div class="container-fluid">
<!-- 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"><a href="<?=self::getUrl("Product")?>">Produkte</a></li>
</ol>
</div>
<h4 class="page-title">Produkte</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">Liste aller Produkte</h4>
</div>
<div class="float-right">
<a class="btn btn-primary mb-2" href="<?=self::getUrl("Product", "add")?>"><i class="fas fa-plus"></i> Neues Produkt anlegen</a>
</div>
<table class="table table-striped table-hover">
<tr>
<th>Fremdprodukt</th>
<th>Gruppe</th>
<th>Name</th>
<th>Technologie</th>
<th>Verkaufspreis</th>
<th>Verr. Periode</th>
<th></th>
</tr>
<?php foreach($products as $product): ?>
<tr>
<td><?=($product->external == 1) ? "<i class='fas fa-check text-success'></i>" : ""?></td>
<td><?=$product->productgroup->name?></td>
<td><?=$product->name?></td>
<td><?=$product->producttech->name?></td>
<td><?=$product->price?></td>
<td><?=$product->billing_period?>x Jährlich</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>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
</div> <!-- end container-fluid -->
</div>
<!-- end wrapper -->
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
+1 -1
View File
@@ -3,7 +3,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
the tool &copy; 2021 <a href="https://www.xinon.at">Xinon GmbH</a> - Made by fronk - Simulor Theme by Coderthemes
the tool &copy; 2021 <a href="https://www.xinon.at">Xinon GmbH</a> - Made by fronk
</div>
<div class="col-md-6">
<div class="text-md-right footer-links d-none d-sm-block">
+3 -4
View File
@@ -7,11 +7,10 @@
<li class="has-submenu">
<a href="<?=self::getUrl("Dashboard")?>"><i class="fe-airplay"></i>Dashboard</a>
</li>
<li class="has-submenu">
<a href="#">
<i class="fas fa-database"></i>Stammdaten <div class="arrow-down"></div>
</a>
</a>
<ul class="submenu">
<li class="has-sub-submenu">
<a href="<?=self::getUrl("Address")?>">Personen & Firmen</a>
@@ -23,10 +22,10 @@
</li>
<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>
<!-- End navigation menu -->