Started work on Address
This commit is contained in:
43
.gitignore
vendored
Normal file
43
.gitignore
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
composer.lock
|
||||
.buildpath
|
||||
.project
|
||||
.settings
|
||||
.idea
|
||||
nbproject
|
||||
config/config.php
|
||||
todo
|
||||
files/*
|
||||
vendor/
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.sql
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
*~
|
||||
*.bak
|
||||
*.swp
|
||||
|
||||
162
Layout/default/Address/Form.php
Normal file
162
Layout/default/Address/Form.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?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="javascript: void(0);">the-tool</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Addressen</a></li>
|
||||
<li class="breadcrumb-item active"><?=($address->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Addressen</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-4"><?=($address->id) ? "Adresse bearbeiten" : "Neue Adresse"?></h4>
|
||||
|
||||
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Address", "save")?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$address->id?>" />
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="company">Firmenname</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea name="company" id="company" class="form-control" rows="2"><?=$address->company?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="firstname">Vorname</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="firstname" id="firstname" value="<?=$address->firstname?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="lastname">Nachname</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="lastname" id="lastname" value="<?=$address->lastname?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="street">Strasse</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="street" id="street" value="<?=$address->street?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="zip">PLZ / Ort</label>
|
||||
<div class="col-lg-10">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" name="zip" id="zip" placeholder="PLZ" value="<?=$address->zip?>">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" class="form-control" name="city" id="city" placeholder="Ort" value="<?=$address->city?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="country">Land</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="country" id="country" value="<?=$address->country?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="phone">Telefon</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="tel" class="form-control" name="phone" id="phone" value="<?=$address->phone?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="mobile">Mobil</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="tel" class="form-control" name="mobile" id="mobile" value="<?=$address->mobile?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="fax">Fax</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="tel" class="form-control" name="fax" id="fax" value="<?=$address->fax?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="email">Email</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="email" class="form-control" name="email" id="email" value="<?=$address->email?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="addresstypes">Addresstyp</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control select2-multiple" namedis="addresstypes" id="addresstypes" multiple="multiple" data-placeholder="Choose ...">
|
||||
<option value="owner"><?=__("owner")?></option>
|
||||
<option value="employee"><?=__("employee")?></option>
|
||||
<option value="customer"><?=__("customer")?></option>
|
||||
<option value="supplier"><?=__("supplier")?></option>
|
||||
<option value="contact"><?=__("contact")?></option>
|
||||
<option value="billing"><?=__("billing")?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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"></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">
|
||||
$("#addresstypes").select2();
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
|
||||
82
Layout/default/Address/Index.php
Normal file
82
Layout/default/Address/Index.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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="javascript: void(0);">the-tool</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Addressen</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<?php if(is_array($filter['addresstype']) && count($filter['addresstype'])): ?>
|
||||
<?php foreach($filter['addresstype'] as $type) { $types[] = __($type); } ?>
|
||||
<?=implode(", ", $types)?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Addressen</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Adressen</h4>
|
||||
<p class="sub-header">Gefiltert nach Addresstyp: <?=implode(", ", $types)?></p>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary" href="<?=self::getUrl("Address", "add")?>"><i class="fas fa-plus"></i> Neue Adresse anlegen</a>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
<th>Firma</th>
|
||||
<th>Name</th>
|
||||
<th>Adresse</th>
|
||||
<th>Telefon</th>
|
||||
<th>Email</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($addresses as $address): ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?=nl2br($address->company)?></td>
|
||||
<td><?=$address->getFullName()?></td>
|
||||
<td>
|
||||
<?=$address->street?><br />
|
||||
<?=$address->zip?> <?=$address->city?>
|
||||
</td>
|
||||
<td><?=$address->phone?></td>
|
||||
<td><?=$address->email?></td>
|
||||
<td>
|
||||
<a href="<?=self::getUrl("Address", "edit", ["id" => $address->id])?>"><i class="far fa-edit"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?=self::getUrl("Address", "delete", ["id" => $address->id])?>" class="text-danger"><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"); ?>
|
||||
@@ -17,11 +17,7 @@
|
||||
</footer>
|
||||
<!-- end Footer -->
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="assets/js/vendor.min.js"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="assets/js/app.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,14 +8,22 @@
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
<link rel="shortcut icon" href="<?=self::getResourcePath()?>assets/images/favicon.ico">
|
||||
|
||||
<!-- App css -->
|
||||
<link href="<?=self::getResourcePath()?>fontawesome/css/all.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/css/app.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/css/icons.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/css/app.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/css/thetool.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<link href="<?=self::getResourcePath()?>assets/libs/select2/select2.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/libs/select2/select2.min.js"></script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -10,143 +10,20 @@
|
||||
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
<i class="fe-hard-drive"></i>Components <div class="arrow-down"></div></a>
|
||||
<i class="fas fa-database"></i>Stammdaten <div class="arrow-down"></div>
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<li>
|
||||
<a href="components-elements.html">UI Elements</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-rangeslider.html">Range Slider</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-alerts.html">Alerts</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-ribbons.html">Ribbons</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-sweet-alerts.html">Sweet Alerts</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-typography.html">Typography</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-charts.html">Charts</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="components-maps.html">Maps</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="has-submenu">
|
||||
<a href="#"> <i class="fe-edit"></i> Forms <div class="arrow-down"></div></a>
|
||||
<ul class="submenu">
|
||||
<li>
|
||||
<a href="form-elements.html">General Elements</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="form-advanced.html">Advanced Form</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="form-editors.html">Editors</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="form-uploads.html">File Uploads</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="has-submenu">
|
||||
<a href="#"> <i class="fe-grid"></i> Tables <div class="arrow-down"></div></a>
|
||||
<ul class="submenu">
|
||||
<li>
|
||||
<a href="tables-basic.html">Basic Tables</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="tables-advanced.html">Advanced Tables</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-submenu">
|
||||
<a href="#"> <i class="fe-anchor"></i> Icons <div class="arrow-down"></div></a>
|
||||
<ul class="submenu">
|
||||
<li>
|
||||
<a href="icons-feather.html">Feather Icons</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="icons-mdi.html">Material Design Icons</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="icons-dripicons.html">Dripicons</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="has-submenu">
|
||||
<a href="#"> <i class="fe-book-open"></i>Pages <div class="arrow-down"></div></a>
|
||||
<ul class="submenu megamenu">
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="pages-starter.html">Starter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-calendar.html">Calendar</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-timeline.html">Timeline</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-invoice.html">Invoice</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-contacts.html">Contacts</a>
|
||||
</li>
|
||||
<a href="<?=self::getUrl("Address")?>">Addressen</a>
|
||||
<ul class="subsubmenu">
|
||||
<li><a href="<?=self::getUrl("Address", "Index" , ["filter" => ["addresstype" => ["employee"]]])?>">Mitarbeiter</a></li>
|
||||
<li><a href="<?=self::getUrl("Address", "Index" , ["filter" => ["addresstype" => ["customer"]]])?>">Kunden</a></li>
|
||||
<li><a href="<?=self::getUrl("Address", "Index" , ["filter" => ["addresstype" => ["supplier"]]])?>">Lieferanten</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="pages-login.html">Login</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-register.html">Register</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-recoverpw.html">Recover Password</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-lock-screen.html">Lock Screen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="pages-404.html">Error 404</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="has-submenu">
|
||||
<a href="#"> <i class="fe-layout"></i>Layouts <div class="arrow-down"></div></a>
|
||||
<ul class="submenu">
|
||||
<li>
|
||||
<a href="layouts-topbar-light.html">Topbar light</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="layouts-menubar-light.html">Menubar Light</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="layouts-center-menu.html">Center Menu</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="layouts-normal-header.html">Unsticky Header</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<!-- End navigation menu -->
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item notify-item">
|
||||
<div class="notify-icon">
|
||||
<img src="assets/images/users/avatar-2.jpg" class="img-fluid rounded-circle" alt="" /> </div>
|
||||
<img src="<?=self::getResourcePath()?>assets/images/users/avatar-2.jpg" class="img-fluid rounded-circle" alt="" /> </div>
|
||||
<p class="notify-details">Cristina Pride</p>
|
||||
<p class="text-muted mb-0 user-msg">
|
||||
<small>Hi, How are you? What about our next meeting</small>
|
||||
@@ -60,7 +60,7 @@
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item notify-item">
|
||||
<div class="notify-icon">
|
||||
<img src="assets/images/users/avatar-4.jpg" class="img-fluid rounded-circle" alt="" /> </div>
|
||||
<img src="<?=self::getResourcePath()?>assets/images/users/avatar-4.jpg" class="img-fluid rounded-circle" alt="" /> </div>
|
||||
<p class="notify-details">Karen Robinson</p>
|
||||
<p class="text-muted mb-0 user-msg">
|
||||
<small>Wow ! this admin looks good and awesome design</small>
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
<li class="dropdown notification-list">
|
||||
<a class="nav-link dropdown-toggle nav-user mr-0" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
|
||||
<img src="assets/images/users/avatar-4.jpg" alt="user-image" class="rounded-circle">
|
||||
<img src="<?=self::getResourcePath()?>assets/images/users/avatar-4.jpg" alt="user-image" class="rounded-circle">
|
||||
<span class="pro-user-name ml-1">
|
||||
<?=$me->username?> <i class="mdi mdi-chevron-down"></i>
|
||||
</span>
|
||||
@@ -153,10 +153,10 @@
|
||||
<li class="logo-box float-left">
|
||||
<a href="index.html" class="logo">
|
||||
<span class="logo-lg">
|
||||
<img src="assets/images/the-tool-logo-kopf.png" alt="" style="height:80px; padding-top:12px; padding-left:32px;">
|
||||
<img src="<?=self::getResourcePath()?>assets/images/the-tool-logo-kopf.png" alt="" style="height:80px; padding-top:12px; padding-left:32px;">
|
||||
</span>
|
||||
<span class="logo-sm">
|
||||
<img src="assets/images/the-tool-logo-kopf.png" alt="" height="28">
|
||||
<img src="<?=self::getResourcePath()?>assets/images/the-tool-logo-kopf.png" alt="" height="28">
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
21
application/Address/Address.php
Normal file
21
application/Address/Address.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class Address extends mfBaseModel {
|
||||
protected $forcestr = ['company','zip','phone','fax','mobile','note'];
|
||||
|
||||
public function getFullName() {
|
||||
// Assumes "Firma1 Firma2" or "firstname lastname" as readable form
|
||||
$name = "";
|
||||
|
||||
if($this->firstname && $this->lastname) {
|
||||
$name = $this->firstname . " " . $this->lastname;
|
||||
} elseif($this->lastname) {
|
||||
$name = $this->lastname;
|
||||
} elseif($this->firstname) {
|
||||
$name = $this->firstname;
|
||||
}
|
||||
|
||||
return $name;
|
||||
|
||||
}
|
||||
}
|
||||
87
application/Address/AddressController.php
Normal file
87
application/Address/AddressController.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
class AddressController extends mfBaseController {
|
||||
private $filter;
|
||||
|
||||
protected function indexAction() {
|
||||
$filter = $this->request->filter;
|
||||
$addresses = AddressModel::search($filter);
|
||||
|
||||
$this->layout()->set("addresses", $addresses);
|
||||
$this->layout()->set("filter", $filter);
|
||||
$this->layout()->set("request", $this->request);
|
||||
}
|
||||
|
||||
protected function addAction() {
|
||||
$this->layout()->setTemplate("Address/Form");
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
$address = new Address($this->request->id);
|
||||
$this->layout()->set("address", $address);
|
||||
|
||||
if(!$address->id) {
|
||||
$this->layout()->setFlash("Addresse nicht gefunden", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
|
||||
//var_dump($r->get());exit;
|
||||
|
||||
$id = $r->id;
|
||||
|
||||
if(is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$address = new Address($id);
|
||||
if(!$address->id) {
|
||||
$this->layout()->setFlash("Addresse nicht gefunden", "error");
|
||||
$this->redirect("Address");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
|
||||
$data = [];
|
||||
$data['parent_id'] = $r->parent_id;
|
||||
$data['company'] = $r->company;
|
||||
$data['firstname'] = $r->firstname;
|
||||
$data['lastname'] = $r->lastname;
|
||||
$data['street'] = $r->street;
|
||||
$data['zip'] = $r->zip;
|
||||
$data['city'] = $r->city;
|
||||
$data['country'] = $r->country;
|
||||
$data['phone'] = $r->phone;
|
||||
$data['fax'] = $r->fax;
|
||||
$data['mobile'] = $r->mobile;
|
||||
$data['email'] = $r->email;
|
||||
$data['note'] = $r->note;
|
||||
|
||||
$data['edit_by'] = 1;
|
||||
|
||||
if($mode == "add") {
|
||||
$data['create_by'] = 1;
|
||||
$address = AddressModel::create($data);
|
||||
} else {
|
||||
$address->update($data);
|
||||
}
|
||||
|
||||
//var_dump($address);exit;
|
||||
|
||||
$new_id = $address->save();
|
||||
if(!$new_id) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
$this->layout()->set("address", $address);
|
||||
return $this->add();
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Adresse erfolgreich gespeichert.", "success");
|
||||
$this->redirect("Address", "Edit", ['id' => $new_id]);
|
||||
}
|
||||
|
||||
}
|
||||
125
application/Address/AddressModel.php
Normal file
125
application/Address/AddressModel.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
class AddressModel {
|
||||
public $parant_id = null;
|
||||
public $company = null;
|
||||
public $firstname = null;
|
||||
public $lastname = null;
|
||||
public $street = null;
|
||||
public $zip = null;
|
||||
public $city = null;
|
||||
public $country = null;
|
||||
public $phone = null;
|
||||
public $fax = null;
|
||||
public $mobile = null;
|
||||
public $email = null;
|
||||
public $note = null;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function find($data) {
|
||||
|
||||
}
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new Address();
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(property_exists(get_called_class(), $field)) {
|
||||
$model ->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
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("Address", "*", "id=$id LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Address($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Address", "*");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Address($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function search($filter) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT Address.* FROM Address
|
||||
LEFT JOIN Addresstype ON (Addresstype.address_id = Address.id)
|
||||
WHERE $where
|
||||
ORDER BY Address.id";
|
||||
//var_dump($sql);
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Address($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
/*
|
||||
* Address Type
|
||||
*/
|
||||
if(is_array($filter['addresstype']) && count($filter['addresstype'])) {
|
||||
$at = $filter['addresstype'];
|
||||
$in = [];
|
||||
if(in_array("owner", $at)) {
|
||||
$in[] = "Addresstype.type = 'owner'";
|
||||
}
|
||||
if(in_array("employee", $at)) {
|
||||
$in[] = "Addresstype.type = 'employee'";
|
||||
}
|
||||
if(in_array("customer", $at)) {
|
||||
$in[] = "Addresstype.type = 'customer'";
|
||||
}
|
||||
if(in_array("supplier", $at)) {
|
||||
$in[] = "Addresstype.type = 'supplier'";
|
||||
}
|
||||
if(in_array("contact", $at)) {
|
||||
$in[] = "Addresstype.type = 'contact'";
|
||||
}
|
||||
if(in_array("billing", $at)) {
|
||||
$in[] = "Addresstype.type = 'billing'";
|
||||
}
|
||||
|
||||
$or = "";
|
||||
if(count($in)) {
|
||||
$or = implode(" OR ", $in);
|
||||
$where .= " AND ( $or )";
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
14
lang/de.php
Normal file
14
lang/de.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$l = [];
|
||||
$l['owner'] = "Besitzer";
|
||||
$l['employee'] = "Mitarbeiter";
|
||||
$l['customer'] = "Kunde";
|
||||
$l['customers'] = "Kunden";
|
||||
$l['supplier'] = "Lieferant";
|
||||
$l['suppliers'] = "Lieferanten";
|
||||
$l['contact'] = "Kontakt";
|
||||
$l['billing'] = "Verrechnungsadresse";
|
||||
|
||||
|
||||
$lang['de'] = $l;
|
||||
@@ -6,6 +6,7 @@ include_once(realpath(dirname(__FILE__))."/mfBaseModel.php");
|
||||
class mfBaseController {
|
||||
protected $log;
|
||||
protected $needlogin = false;
|
||||
protected $request;
|
||||
private $mfAction;
|
||||
private $mfDBI;
|
||||
private $mfLayout;
|
||||
@@ -69,6 +70,8 @@ class mfBaseController {
|
||||
include MFBASECONTROLLER_INIT_INCLUDE_FILE;
|
||||
}
|
||||
|
||||
$this->request = new mfRequest($params);
|
||||
|
||||
// now run action
|
||||
if($params['action']) {
|
||||
$this->__call($params['action'],$params);
|
||||
|
||||
@@ -100,6 +100,12 @@ class mfBaseModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function update(Array $data) {
|
||||
foreach($data as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if(method_exists($this, "beforeSave")) {
|
||||
$this->beforeSave();
|
||||
|
||||
@@ -211,3 +211,12 @@ class mfLayout {
|
||||
return $this->inline->cycle[$this->inline->cyclecount++];
|
||||
}
|
||||
}
|
||||
|
||||
function __($string) {
|
||||
$lang = [];
|
||||
include(BASEDIR."/lang/de.php");
|
||||
if(array_key_exists($string, $lang['de'])) {
|
||||
return $lang['de'][$string];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
47
lib/mvcfronk/mfRequest/mfRequest.php
Normal file
47
lib/mvcfronk/mfRequest/mfRequest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
class mfRequest {
|
||||
protected static $instance;
|
||||
protected $request = [];
|
||||
|
||||
public function __construct(Array $request = []) {
|
||||
if(count($request)) {
|
||||
$this->request = $request;
|
||||
} else {
|
||||
// get request from POST/GET
|
||||
if(isset($_POST) && isset($_GET)) {
|
||||
$this->request = array_merge($_GET, $_POST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function singleton($request = false) {
|
||||
if(!isset(self::$instance)) {
|
||||
$c=__CLASS__;
|
||||
self::$instance=new $c($request);
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function set($name, $value) {
|
||||
if($name) {
|
||||
$this->request[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function get($name = null) {
|
||||
if($name) {
|
||||
if(array_key_exists($name, $this->request)) {
|
||||
//var_dump($this->request);exit;
|
||||
return $this->request[$name];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function __get($name) {
|
||||
return $this->get($name);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
index.file=index.php
|
||||
url=http://localhost/thetool/
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
</project-private>
|
||||
@@ -1,7 +0,0 @@
|
||||
include.path=${php.global.include.path}
|
||||
php.version=PHP_73
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=false
|
||||
web.root=.
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>thetool</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -17003,41 +17003,6 @@ readers do not read off random characters that represent icons */
|
||||
position: static;
|
||||
width: auto; }
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font Awesome 5 Brands';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-display: auto;
|
||||
src: url("../fonts/fa-brands-400.eot");
|
||||
src: url("../fonts/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-brands-400.woff2") format("woff2"), url("../fonts/fa-brands-400.woff") format("woff"), url("../fonts/fa-brands-400.ttf") format("truetype"), url("../fonts/fa-brands-400.svg#fontawesome") format("svg"); }
|
||||
|
||||
.fab {
|
||||
font-family: 'Font Awesome 5 Brands'; }
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: auto;
|
||||
src: url("../fonts/fa-regular-400.eot");
|
||||
src: url("../fonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-regular-400.woff2") format("woff2"), url("../fonts/fa-regular-400.woff") format("woff"), url("../fonts/fa-regular-400.ttf") format("truetype"), url("../fonts/fa-regular-400.svg#fontawesome") format("svg"); }
|
||||
|
||||
.far {
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-weight: 400; }
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
font-display: auto;
|
||||
src: url("../fonts/fa-solid-900.eot");
|
||||
src: url("../fonts/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../fonts/fa-solid-900.woff2") format("woff2"), url("../fonts/fa-solid-900.woff") format("woff"), url("../fonts/fa-solid-900.ttf") format("truetype"), url("../fonts/fa-solid-900.svg#fontawesome") format("svg"); }
|
||||
|
||||
.fa,
|
||||
.fas {
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-weight: 900; }
|
||||
|
||||
/*!
|
||||
* Line Awesome 1.1.0 by @icons_8 - https://icons8.com/line-awesome
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
#topnav {
|
||||
//background-color: #38414a;
|
||||
.subsubmenu {
|
||||
padding-left: 12px !important;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #00acc1 !important;
|
||||
color: #fff !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #fff !important;
|
||||
margin-right: 5px !important;
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/* select2 styles */
|
||||
|
||||
.select2-selection__choice {
|
||||
color: #fff !important;
|
||||
background-color: #28a745 !important;
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active,
|
||||
.nav-pills .show > .nav-link {
|
||||
color: #ffffff;
|
||||
background-color: #28a745 !important;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
border-top: 2px solid #28a745;
|
||||
}
|
||||
|
||||
.card-header.changelog,
|
||||
.note-toolbar.card-header {
|
||||
border-top: 2px solid #17a2b8;
|
||||
}
|
||||
|
||||
.card-header.no-decoration {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
|
||||
.custom-control-input:checked ~ .custom-control-label::before {
|
||||
color: #ffffff;
|
||||
border-color: #28a745;
|
||||
background-color: #28a745;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.time {
|
||||
float:right;
|
||||
color:#999;
|
||||
font-size: 12px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.ticket-text .date {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.ticket-text .card-header {
|
||||
/*text-align: center;*/
|
||||
}
|
||||
|
||||
.bg-light-red {
|
||||
background-color: #ffecec;
|
||||
}
|
||||
|
||||
.bg-light-blue {
|
||||
background-color: #ececff;
|
||||
}
|
||||
|
||||
.card-header.slim {
|
||||
padding-top: 0.3em !important;
|
||||
padding-bottom: 0.15em !important;
|
||||
}
|
||||
|
||||
.text-monospace {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.ticket-text.outgoing-email {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
7
public/js/adminlte.min.js
vendored
7
public/js/adminlte.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user