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"
}
}
},
"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);
}
/**
* 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\NullAddress;
use Modules\Editor\Models\EditorDoc;
use Modules\Media\Models\Media;
use Modules\Profile\Models\ContactElement;
use Modules\Profile\Models\NullContactElement;
@ -49,6 +50,14 @@ class Client
public Profile $profile;
/**
* Files.
*
* @var EditorDoc[]
* @since 1.0.0
*/
private array $notes = [];
private array $files = [];
private array $contactElements = [];
@ -199,6 +208,32 @@ class Client
$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.
*

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
namespace Modules\ClientManagement\Models;
use Modules\Admin\Models\AddressMapper;
use Modules\Editor\Models\EditorDocMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Profile\Models\ContactElementMapper;
use Modules\Profile\Models\ProfileMapper;
@ -102,6 +103,12 @@ final class ClientMapper extends DataMapperAbstract
'external' => 'clientmgmt_client_media_dst',
'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' => [
'mapper' => ContactElementMapper::class,
'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
*
* @package Modules\ClientManagement
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@ -13,55 +13,84 @@
declare(strict_types=1);
return ['ClientManagement' => [
'Accounting' => 'Buchhaltung',
'Address' => 'Addresse',
'Addresses' => 'Addressen',
'AreaManager' => 'Area Manager',
'Articlegroup' => 'Artikelgruppe',
'Bonus' => 'Bonus',
'Business' => 'Business',
'City' => 'Stadt',
'Client' => 'Kunde',
'Clients' => 'Kunden',
'Contact' => 'Kontakt',
'Country' => 'Land',
'Creditcard' => 'Kreditkarte',
'Date' => 'Datum',
'Default' => 'Standard',
'Delivery' => 'Lieferung',
'Discount' => 'Rabatt',
'DiscountP' => 'Rabatt %',
'Email' => 'Email',
'Fax' => 'Fax',
'Files' => 'Dateien',
'Freightage' => 'Frachtkosten',
'Group' => 'Gruppe',
'ID' => 'ID',
'Info' => 'Info',
'Invoice' => 'Rechnung',
'IsDefault' => 'Ist Standard?',
'Log' => 'Log',
'Logs' => 'Logs',
'Profile' => 'Profile',
'Name' => 'Name',
'Name1' => 'Name1',
'Name2' => 'Name2',
'Name3' => 'Name3',
'Office' => 'Büro',
'Payment' => 'Zahlung',
'PaymentTerm' => 'Zahlungsziel',
'Phone' => 'Telefon',
'Price' => 'Preis',
'Prices' => 'Preise',
'Private' => 'Privat',
'Productgroup' => 'Produktgruppe',
'Purchase' => 'Einkauf',
'Quantity' => 'Anzahl',
'Sales' => 'Umsatz',
'Segment' => 'Segment',
'Subtype' => 'Untergruppe',
'Support' => 'Support',
'Type' => 'Typ',
'Wire' => 'Wire',
'Zip' => 'Postleitzahl',
'Accounting' => 'Buchhaltung',
'Addition' => '',
'Address' => 'Addresse',
'Addresses' => 'Addressen',
'AreaManager' => 'Area Manager',
'Articlegroup' => 'Artikelgruppe',
'Articles' => '',
'Balance' => '',
'Bonus' => 'Bonus',
'Business' => 'Business',
'CLV' => '',
'Calendar' => '',
'City' => 'Stadt',
'Client' => 'Kunde',
'Clients' => 'Kunden',
'Contact' => 'Kontakt',
'Country' => 'Land',
'Created' => '',
'CreditRating' => '',
'Creditcard' => 'Kreditkarte',
'DSO' => '',
'Date' => 'Datum',
'Default' => 'Standard',
'Delivery' => 'Lieferung',
'Discount' => 'Rabatt',
'DiscountP' => 'Rabatt %',
'Documents' => '',
'Due' => '',
'Email' => 'Email',
'Fax' => 'Fax',
'Files' => 'Dateien',
'Freightage' => 'Frachtkosten',
'Group' => 'Gruppe',
'ID' => 'ID',
'Info' => 'Info',
'Invoice' => 'Rechnung',
'Invoices' => '',
'IsDefault' => 'Ist Standard?',
'LastContact' => '',
'LastOrder' => '',
'Log' => 'Log',
'Logs' => 'Logs',
'MRR' => '',
'MTDSales' => '',
'Margin' => '',
'Messages' => '',
'Modified' => '',
'Modules' => '',
'Name' => 'Name',
'Name1' => 'Name1',
'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
*
* @package Modules\ClientManagement
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@ -13,55 +13,84 @@
declare(strict_types=1);
return ['ClientManagement' => [
'Accounting' => 'Accounting',
'Address' => 'Address',
'Addresses' => 'Addresses',
'AreaManager' => 'Area Manager',
'Articlegroup' => 'Articlegroup',
'Bonus' => 'Bonus',
'Business' => 'Business',
'City' => 'City',
'Client' => 'Client',
'Clients' => 'Clients',
'Contact' => 'Contact',
'Country' => 'Country',
'Creditcard' => 'Creditcard',
'Date' => 'Date',
'Default' => 'Default',
'Delivery' => 'Delivery',
'Discount' => 'Discount',
'DiscountP' => 'Discount %',
'Email' => 'Email',
'Fax' => 'Fax',
'Files' => 'Files',
'Freightage' => 'Freightage',
'Group' => 'Group',
'ID' => 'ID',
'Info' => 'Info',
'Invoice' => 'Invoice',
'IsDefault' => 'Is default?',
'Log' => 'Log',
'Logs' => 'Logs',
'Profile' => 'Profile',
'Name' => 'Name',
'Name1' => 'Name1',
'Name2' => 'Name2',
'Name3' => 'Name3',
'Office' => 'Office',
'Payment' => 'Payment',
'PaymentTerm' => 'Payment Term',
'Phone' => 'Phone',
'Price' => 'Price',
'Prices' => 'Prices',
'Private' => 'Private',
'Productgroup' => 'Productgroup',
'Purchase' => 'Purchase',
'Quantity' => 'Quantity',
'Sales' => 'Sales',
'Segment' => 'Segment',
'Subtype' => 'Subtype',
'Support' => 'Support',
'Type' => 'Type',
'Wire' => 'Wire',
'Zip' => 'Zip',
'Accounting' => 'Accounting',
'Addition' => 'Addition',
'Address' => 'Address',
'Addresses' => 'Addresses',
'AreaManager' => 'Area Manager',
'Articlegroup' => 'Articlegroup',
'Articles' => 'Articles',
'Balance' => 'Balance',
'Bonus' => 'Bonus',
'Business' => 'Business',
'CLV' => 'CLV',
'Calendar' => 'Calendar',
'City' => 'City',
'Client' => 'Client',
'Clients' => 'Clients',
'Contact' => 'Contact',
'Country' => 'Country',
'Created' => 'Created',
'CreditRating' => 'Credit Rating',
'Creditcard' => 'Creditcard',
'DSO' => 'DSO',
'Date' => 'Date',
'Default' => 'Default',
'Delivery' => 'Delivery',
'Discount' => 'Discount',
'DiscountP' => 'Discount %',
'Documents' => 'Documents',
'Due' => 'Due',
'Email' => 'Email',
'Fax' => 'Fax',
'Files' => 'Files',
'Freightage' => 'Freightage',
'Group' => 'Group',
'ID' => 'ID',
'Info' => 'Info',
'Invoice' => 'Invoice',
'Invoices' => 'Invoices',
'IsDefault' => 'Is default?',
'LastContact' => 'Last Contact',
'LastOrder' => 'Last Order',
'Log' => 'Log',
'Logs' => 'Logs',
'MRR' => 'MRR',
'MTDSales' => 'MTD Sales',
'Margin' => 'Margin',
'Messages' => 'Messages',
'Modified' => 'Modified',
'Modules' => 'Modules',
'Name' => 'Name',
'Name1' => 'Name1',
'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
*/
$client = $this->getData('client');
$notes = $client->getNotes();
$files = $client->getFiles();
$newestInvoices = $this->getData('newestInvoices') ?? [];
$monthlySalesCosts = $this->getData('monthlySalesCosts') ?? [];
@ -130,7 +132,7 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-1">
<div class="portlet-body">
<table>
<table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>:
<td>
<tr><td><?= $this->getHtml('MTDSales'); ?>:
@ -147,7 +149,7 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-2">
<div class="portlet-body">
<table>
<table class="wf-100">
<tr><td><?= $this->getHtml('LastContact'); ?>:
<td>
<tr><td><?= $this->getHtml('LastOrder'); ?>:
@ -164,7 +166,7 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-3">
<div class="portlet-body">
<table>
<table class="wf-100">
<tr><td><?= $this->getHtml('DSO'); ?>:
<td>
<tr><td><?= $this->getHtml('Due'); ?>:
@ -183,14 +185,42 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-md-6">
<section class="portlet">
<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>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<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>
</div>
</div>

View File

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