fix php version, lang files, basic tpl and sales impl.

This commit is contained in:
Dennis Eichhorn 2021-03-05 21:01:37 +01:00
parent 5121bd3276
commit c336769850
10 changed files with 343 additions and 111 deletions

View File

@ -0,0 +1,9 @@
[
{
"type": "collection",
"create_directory": true,
"name": "ClientManagement",
"virtualPath": "/Modules",
"user": 1
}
]

43
Admin/Install/Media.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\ClientManagement\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\ClientManagement\Admin\Install;
use phpOMS\DataStorage\Database\DatabasePool;
/**
* Media class.
*
* @package Modules\ClientManagement\Admin\Install
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Media
{
/**
* Install media providing
*
* @param string $path Module path
* @param DatabasePool $dbPool Database pool for database interaction
*
* @return void
*
* @since 1.0.0
*/
public static function install(string $path, DatabasePool $dbPool) : void
{
\Modules\Media\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/Media.install.json']);
}
}

View File

@ -108,5 +108,31 @@
"foreignKey": "clientmgmt_client_id" "foreignKey": "clientmgmt_client_id"
} }
} }
},
"clientmgmt_client_note": {
"name": "clientmgmt_client_note",
"fields": {
"clientmgmt_client_note_id": {
"name": "clientmgmt_client_note_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"clientmgmt_client_note_dst": {
"name": "clientmgmt_client_note_dst",
"type": "INT",
"null": false,
"foreignTable": "editor_doc",
"foreignKey": "editor_doc_id"
},
"clientmgmt_client_note_src": {
"name": "clientmgmt_client_note_src",
"type": "INT",
"null": false,
"foreignTable": "clientmgmt_client",
"foreignKey": "clientmgmt_client_id"
}
}
} }
} }

View File

@ -198,4 +198,26 @@ final class ApiController extends Controller
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Image', 'Image successfully updated', $uploaded); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Image', 'Image successfully updated', $uploaded);
} }
/**
* Api method to create item files
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiNoteCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
$request->setData('virtualpath', '/Modules/ClientManagement/' . $request->getData('id'), true);
$this->app->moduleManager->get('Editor')->apiEditorCreate($request, $response, $data);
$model = $response->get($request->uri->__toString())['response'];
$this->createModelRelation($request->header->account, $request->getData('id'), $model->getId(), ClientMapper::class, 'notes', '', $request->getOrigin());
}
} }

View File

@ -16,6 +16,7 @@ namespace Modules\ClientManagement\Models;
use Modules\Admin\Models\Address; use Modules\Admin\Models\Address;
use Modules\Admin\Models\NullAddress; use Modules\Admin\Models\NullAddress;
use Modules\Editor\Models\EditorDoc;
use Modules\Media\Models\Media; use Modules\Media\Models\Media;
use Modules\Profile\Models\ContactElement; use Modules\Profile\Models\ContactElement;
use Modules\Profile\Models\NullContactElement; use Modules\Profile\Models\NullContactElement;
@ -49,6 +50,14 @@ class Client
public Profile $profile; public Profile $profile;
/**
* Files.
*
* @var EditorDoc[]
* @since 1.0.0
*/
private array $notes = [];
private array $files = []; private array $files = [];
private array $contactElements = []; private array $contactElements = [];
@ -199,6 +208,32 @@ class Client
$this->info = $info; $this->info = $info;
} }
/**
* Add doc to item
*
* @param EditorDoc $note Note
*
* @return void
*
* @since 1.0.0
*/
public function addNote(EditorDoc $note) : void
{
$this->notes[] = $note;
}
/**
* Get notes
*
* @return EditorDoc[]
*
* @since 1.0.0
*/
public function getNotes() : array
{
return $this->notes;
}
/** /**
* Get media. * Get media.
* *

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
namespace Modules\ClientManagement\Models; namespace Modules\ClientManagement\Models;
use Modules\Admin\Models\AddressMapper; use Modules\Admin\Models\AddressMapper;
use Modules\Editor\Models\EditorDocMapper;
use Modules\Media\Models\MediaMapper; use Modules\Media\Models\MediaMapper;
use Modules\Profile\Models\ContactElementMapper; use Modules\Profile\Models\ContactElementMapper;
use Modules\Profile\Models\ProfileMapper; use Modules\Profile\Models\ProfileMapper;
@ -102,6 +103,12 @@ final class ClientMapper extends DataMapperAbstract
'external' => 'clientmgmt_client_media_dst', 'external' => 'clientmgmt_client_media_dst',
'self' => 'clientmgmt_client_media_src', 'self' => 'clientmgmt_client_media_src',
], ],
'notes' => [
'mapper' => EditorDocMapper::class, /* mapper of the related object */
'table' => 'clientmgmt_client_note', /* table of the related object, null if no relation table is used (many->1) */
'external' => 'clientmgmt_client_note_dst',
'self' => 'clientmgmt_client_note_src',
],
'contactElements' => [ 'contactElements' => [
'mapper' => ContactElementMapper::class, 'mapper' => ContactElementMapper::class,
'table' => 'clientmgmt_client_contactelement', 'table' => 'clientmgmt_client_contactelement',

133
Theme/Backend/Lang/de.lang.php Executable file → Normal file
View File

@ -4,7 +4,7 @@
* *
* PHP Version 8.0 * PHP Version 8.0
* *
* @package Modules\ClientManagement * @package Modules\Localization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -13,55 +13,84 @@
declare(strict_types=1); declare(strict_types=1);
return ['ClientManagement' => [ return ['ClientManagement' => [
'Accounting' => 'Buchhaltung', 'Accounting' => 'Buchhaltung',
'Address' => 'Addresse', 'Addition' => '',
'Addresses' => 'Addressen', 'Address' => 'Addresse',
'AreaManager' => 'Area Manager', 'Addresses' => 'Addressen',
'Articlegroup' => 'Artikelgruppe', 'AreaManager' => 'Area Manager',
'Bonus' => 'Bonus', 'Articlegroup' => 'Artikelgruppe',
'Business' => 'Business', 'Articles' => '',
'City' => 'Stadt', 'Balance' => '',
'Client' => 'Kunde', 'Bonus' => 'Bonus',
'Clients' => 'Kunden', 'Business' => 'Business',
'Contact' => 'Kontakt', 'CLV' => '',
'Country' => 'Land', 'Calendar' => '',
'Creditcard' => 'Kreditkarte', 'City' => 'Stadt',
'Date' => 'Datum', 'Client' => 'Kunde',
'Default' => 'Standard', 'Clients' => 'Kunden',
'Delivery' => 'Lieferung', 'Contact' => 'Kontakt',
'Discount' => 'Rabatt', 'Country' => 'Land',
'DiscountP' => 'Rabatt %', 'Created' => '',
'Email' => 'Email', 'CreditRating' => '',
'Fax' => 'Fax', 'Creditcard' => 'Kreditkarte',
'Files' => 'Dateien', 'DSO' => '',
'Freightage' => 'Frachtkosten', 'Date' => 'Datum',
'Group' => 'Gruppe', 'Default' => 'Standard',
'ID' => 'ID', 'Delivery' => 'Lieferung',
'Info' => 'Info', 'Discount' => 'Rabatt',
'Invoice' => 'Rechnung', 'DiscountP' => 'Rabatt %',
'IsDefault' => 'Ist Standard?', 'Documents' => '',
'Log' => 'Log', 'Due' => '',
'Logs' => 'Logs', 'Email' => 'Email',
'Profile' => 'Profile', 'Fax' => 'Fax',
'Name' => 'Name', 'Files' => 'Dateien',
'Name1' => 'Name1', 'Freightage' => 'Frachtkosten',
'Name2' => 'Name2', 'Group' => 'Gruppe',
'Name3' => 'Name3', 'ID' => 'ID',
'Office' => 'Büro', 'Info' => 'Info',
'Payment' => 'Zahlung', 'Invoice' => 'Rechnung',
'PaymentTerm' => 'Zahlungsziel', 'Invoices' => '',
'Phone' => 'Telefon', 'IsDefault' => 'Ist Standard?',
'Price' => 'Preis', 'LastContact' => '',
'Prices' => 'Preise', 'LastOrder' => '',
'Private' => 'Privat', 'Log' => 'Log',
'Productgroup' => 'Produktgruppe', 'Logs' => 'Logs',
'Purchase' => 'Einkauf', 'MRR' => '',
'Quantity' => 'Anzahl', 'MTDSales' => '',
'Sales' => 'Umsatz', 'Margin' => '',
'Segment' => 'Segment', 'Messages' => '',
'Subtype' => 'Untergruppe', 'Modified' => '',
'Support' => 'Support', 'Modules' => '',
'Type' => 'Typ', 'Name' => 'Name',
'Wire' => 'Wire', 'Name1' => 'Name1',
'Zip' => 'Postleitzahl', 'Name2' => 'Name2',
'Name3' => 'Name3',
'Net' => '',
'Notes' => '',
'Number' => '',
'Office' => 'Büro',
'Payment' => 'Zahlung',
'PaymentTerm' => 'Zahlungsziel',
'Permission' => '',
'Phone' => 'Telefon',
'Postal' => '',
'Price' => 'Preis',
'Prices' => 'Preise',
'Private' => 'Privat',
'Productgroup' => 'Produktgruppe',
'Profile' => 'Profile',
'Purchase' => 'Einkauf',
'Quantity' => 'Anzahl',
'RecentInvoices' => '',
'Sales' => 'Umsatz',
'Segment' => 'Segment',
'Segments' => '',
'Subtype' => 'Untergruppe',
'Support' => 'Support',
'Tags' => '',
'Type' => 'Typ',
'Website' => '',
'Wire' => 'Wire',
'YTDSales' => '',
'Zip' => 'Postleitzahl',
]]; ]];

133
Theme/Backend/Lang/en.lang.php Executable file → Normal file
View File

@ -4,7 +4,7 @@
* *
* PHP Version 8.0 * PHP Version 8.0
* *
* @package Modules\ClientManagement * @package Modules\Localization
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -13,55 +13,84 @@
declare(strict_types=1); declare(strict_types=1);
return ['ClientManagement' => [ return ['ClientManagement' => [
'Accounting' => 'Accounting', 'Accounting' => 'Accounting',
'Address' => 'Address', 'Addition' => 'Addition',
'Addresses' => 'Addresses', 'Address' => 'Address',
'AreaManager' => 'Area Manager', 'Addresses' => 'Addresses',
'Articlegroup' => 'Articlegroup', 'AreaManager' => 'Area Manager',
'Bonus' => 'Bonus', 'Articlegroup' => 'Articlegroup',
'Business' => 'Business', 'Articles' => 'Articles',
'City' => 'City', 'Balance' => 'Balance',
'Client' => 'Client', 'Bonus' => 'Bonus',
'Clients' => 'Clients', 'Business' => 'Business',
'Contact' => 'Contact', 'CLV' => 'CLV',
'Country' => 'Country', 'Calendar' => 'Calendar',
'Creditcard' => 'Creditcard', 'City' => 'City',
'Date' => 'Date', 'Client' => 'Client',
'Default' => 'Default', 'Clients' => 'Clients',
'Delivery' => 'Delivery', 'Contact' => 'Contact',
'Discount' => 'Discount', 'Country' => 'Country',
'DiscountP' => 'Discount %', 'Created' => 'Created',
'Email' => 'Email', 'CreditRating' => 'Credit Rating',
'Fax' => 'Fax', 'Creditcard' => 'Creditcard',
'Files' => 'Files', 'DSO' => 'DSO',
'Freightage' => 'Freightage', 'Date' => 'Date',
'Group' => 'Group', 'Default' => 'Default',
'ID' => 'ID', 'Delivery' => 'Delivery',
'Info' => 'Info', 'Discount' => 'Discount',
'Invoice' => 'Invoice', 'DiscountP' => 'Discount %',
'IsDefault' => 'Is default?', 'Documents' => 'Documents',
'Log' => 'Log', 'Due' => 'Due',
'Logs' => 'Logs', 'Email' => 'Email',
'Profile' => 'Profile', 'Fax' => 'Fax',
'Name' => 'Name', 'Files' => 'Files',
'Name1' => 'Name1', 'Freightage' => 'Freightage',
'Name2' => 'Name2', 'Group' => 'Group',
'Name3' => 'Name3', 'ID' => 'ID',
'Office' => 'Office', 'Info' => 'Info',
'Payment' => 'Payment', 'Invoice' => 'Invoice',
'PaymentTerm' => 'Payment Term', 'Invoices' => 'Invoices',
'Phone' => 'Phone', 'IsDefault' => 'Is default?',
'Price' => 'Price', 'LastContact' => 'Last Contact',
'Prices' => 'Prices', 'LastOrder' => 'Last Order',
'Private' => 'Private', 'Log' => 'Log',
'Productgroup' => 'Productgroup', 'Logs' => 'Logs',
'Purchase' => 'Purchase', 'MRR' => 'MRR',
'Quantity' => 'Quantity', 'MTDSales' => 'MTD Sales',
'Sales' => 'Sales', 'Margin' => 'Margin',
'Segment' => 'Segment', 'Messages' => 'Messages',
'Subtype' => 'Subtype', 'Modified' => 'Modified',
'Support' => 'Support', 'Modules' => 'Modules',
'Type' => 'Type', 'Name' => 'Name',
'Wire' => 'Wire', 'Name1' => 'Name1',
'Zip' => 'Zip', 'Name2' => 'Name2',
'Name3' => 'Name3',
'Net' => 'Net',
'Notes' => 'Notes',
'Number' => 'Number',
'Office' => 'Office',
'Payment' => 'Payment',
'PaymentTerm' => 'Payment Term',
'Permission' => 'Permission',
'Phone' => 'Phone',
'Postal' => 'Postal',
'Price' => 'Price',
'Prices' => 'Prices',
'Private' => 'Private',
'Productgroup' => 'Productgroup',
'Profile' => 'Profile',
'Purchase' => 'Purchase',
'Quantity' => 'Quantity',
'RecentInvoices' => 'Recent Invoices',
'Sales' => 'Sales',
'Segment' => 'Segment',
'Segments' => 'Segments',
'Subtype' => 'Subtype',
'Support' => 'Support',
'Tags' => 'Tags',
'Type' => 'Type',
'Website' => 'Website',
'Wire' => 'Wire',
'YTDSales' => 'YTD Sales',
'Zip' => 'Zip',
]]; ]];

View File

@ -22,6 +22,8 @@ $countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
* @var \Modules\ClientManagement\Models\Client $client * @var \Modules\ClientManagement\Models\Client $client
*/ */
$client = $this->getData('client'); $client = $this->getData('client');
$notes = $client->getNotes();
$files = $client->getFiles();
$newestInvoices = $this->getData('newestInvoices') ?? []; $newestInvoices = $this->getData('newestInvoices') ?? [];
$monthlySalesCosts = $this->getData('monthlySalesCosts') ?? []; $monthlySalesCosts = $this->getData('monthlySalesCosts') ?? [];
@ -130,7 +132,7 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-1"> <section class="portlet highlight-1">
<div class="portlet-body"> <div class="portlet-body">
<table> <table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>: <tr><td><?= $this->getHtml('YTDSales'); ?>:
<td> <td>
<tr><td><?= $this->getHtml('MTDSales'); ?>: <tr><td><?= $this->getHtml('MTDSales'); ?>:
@ -147,7 +149,7 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-2"> <section class="portlet highlight-2">
<div class="portlet-body"> <div class="portlet-body">
<table> <table class="wf-100">
<tr><td><?= $this->getHtml('LastContact'); ?>: <tr><td><?= $this->getHtml('LastContact'); ?>:
<td> <td>
<tr><td><?= $this->getHtml('LastOrder'); ?>: <tr><td><?= $this->getHtml('LastOrder'); ?>:
@ -164,7 +166,7 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-3"> <section class="portlet highlight-3">
<div class="portlet-body"> <div class="portlet-body">
<table> <table class="wf-100">
<tr><td><?= $this->getHtml('DSO'); ?>: <tr><td><?= $this->getHtml('DSO'); ?>:
<td> <td>
<tr><td><?= $this->getHtml('Due'); ?>: <tr><td><?= $this->getHtml('Due'); ?>:
@ -183,14 +185,42 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<section class="portlet"> <section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Notes'); ?></div> <div class="portlet-head"><?= $this->getHtml('Notes'); ?></div>
<div class="portlet-body"></div> <table id="iNotesItemList" class="default">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/prefix}editor/single?{?}&id=' . $note->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $note->title; ?></a>
<td><a href="<?= $url; ?>"><?= $note->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
</table>
</section> </section>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<section class="portlet"> <section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Documents'); ?></div> <div class="portlet-head"><?= $this->getHtml('Documents'); ?></div>
<div class="portlet-body"></div> <table id="iFilesClientList" class="default">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/prefix}media/single?{?}&id=' . $file->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $file->name; ?></a>
<td><a href="<?= $url; ?>"><?= $file->extension; ?></a>
<td><a href="<?= $url; ?>"><?= $file->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
</table>
</section> </section>
</div> </div>
</div> </div>

View File

@ -19,10 +19,12 @@
"dependencies": { "dependencies": {
"Admin": "1.0.0", "Admin": "1.0.0",
"Profile": "1.0.0", "Profile": "1.0.0",
"Media": "1.0.0" "Media": "1.0.0",
"Editor": "1.0.0"
}, },
"providing": { "providing": {
"Navigation": "*" "Navigation": "*",
"Media": "*"
}, },
"load": [ "load": [
{ {