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 a66a61bd9a
commit 34147e3bf4
10 changed files with 297 additions and 51 deletions

View File

@ -0,0 +1,9 @@
[
{
"type": "collection",
"create_directory": true,
"name": "SupplierManagement",
"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\SupplierManagement\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\SupplierManagement\Admin\Install;
use phpOMS\DataStorage\Database\DatabasePool;
/**
* Media class.
*
* @package Modules\SupplierManagement\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

@ -107,5 +107,31 @@
"foreignKey": "suppliermgmt_supplier_id"
}
}
},
"suppliermgmt_supplier_note": {
"name": "suppliermgmt_supplier_note",
"fields": {
"suppliermgmt_supplier_note_id": {
"name": "suppliermgmt_supplier_note_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"suppliermgmt_supplier_note_dst": {
"name": "suppliermgmt_supplier_note_dst",
"type": "INT",
"null": false,
"foreignTable": "editor_doc",
"foreignKey": "editor_doc_id"
},
"suppliermgmt_supplier_note_src": {
"name": "suppliermgmt_supplier_note_src",
"type": "INT",
"null": false,
"foreignTable": "suppliermgmt_supplier",
"foreignKey": "suppliermgmt_supplier_id"
}
}
}
}

View File

@ -197,4 +197,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/SupplierManagement/' . $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(), SupplierMapper::class, 'notes', '', $request->getOrigin());
}
}

View File

@ -16,6 +16,7 @@ namespace Modules\SupplierManagement\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;
@ -53,6 +54,14 @@ class Supplier
public Profile $profile;
/**
* Files.
*
* @var EditorDoc[]
* @since 1.0.0
*/
private array $notes = [];
private array $files = [];
private array $contactElements = [];
@ -193,6 +202,32 @@ class Supplier
$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\SupplierManagement\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 SupplierMapper extends DataMapperAbstract
'external' => 'suppliermgmt_supplier_media_dst',
'self' => 'suppliermgmt_supplier_media_src',
],
'notes' => [
'mapper' => EditorDocMapper::class, /* mapper of the related object */
'table' => 'suppliermgmt_supplier_note', /* table of the related object, null if no relation table is used (many->1) */
'external' => 'suppliermgmt_supplier_note_dst',
'self' => 'suppliermgmt_supplier_note_src',
],
'contactElements' => [
'mapper' => ContactElementMapper::class,
'table' => 'suppliermgmt_supplier_contactelement',

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

@ -4,7 +4,7 @@
*
* PHP Version 8.0
*
* @package Modules\SupplierManagement
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@ -14,23 +14,33 @@ declare(strict_types=1);
return ['SupplierManagement' => [
'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' => '',
'DUE' => '',
'Date' => 'Datum',
'Default' => 'Standard',
'Delivery' => 'Lieferung',
'Discount' => 'Rabatt',
'DiscountP' => 'Rabatt %',
'Documents' => '',
'Email' => 'Email',
'Fax' => 'Fax',
'Files' => 'Dateien',
@ -39,31 +49,51 @@ return ['SupplierManagement' => [
'ID' => 'ID',
'Info' => 'Info',
'Invoice' => 'Rechnung',
'Invoices' => '',
'IsDefault' => 'Ist Standard?',
'LastContact' => '',
'LastOrder' => '',
'Log' => 'Log',
'Logs' => 'Logs',
'MRR' => '',
'MTDSales' => '',
'Main' => '',
'Margin' => '',
'Master' => 'Master',
'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' => '',
'Purchase' => 'Einkauf',
'Quantity' => 'Anzahl',
'RecentInvoices' => '',
'Sales' => 'Umsatz',
'Segment' => 'Segment',
'Segments' => '',
'Subtype' => 'Untergruppe',
'Supplier' => 'Lieferant',
'Suppliers' => 'Lieferanten',
'Support' => 'Support',
'Tags' => '',
'Type' => 'Typ',
'Wire' => 'Wire',
'YTDSales' => '',
'Zip' => 'Postleitzahl',
]];

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

@ -4,7 +4,7 @@
*
* PHP Version 8.0
*
* @package Modules\SupplierManagement
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@ -13,45 +13,87 @@
declare(strict_types=1);
return ['SupplierManagement' => [
'Accounting' => 'Accounting',
'Address' => 'Address',
'Addresses' => 'Addresses',
'Articlegroup' => 'Articlegroup',
'City' => 'City',
'Contact' => 'Contact',
'Country' => 'Country',
'Creditcard' => 'Creditcard',
'Date' => 'Date',
'Default' => 'Default',
'Delivery' => 'Delivery',
'Email' => 'Email',
'Fax' => 'Fax',
'Files' => 'Files',
'Freightage' => 'Freightage',
'Group' => 'Group',
'Info' => 'Info',
'Invoice' => 'Invoice',
'IsDefault' => 'Is default',
'Log' => 'Log',
'Logs' => 'Logs',
'Master' => 'Master',
'Name' => 'Name',
'Name1' => 'Name1',
'Name2' => 'Name2',
'Name3' => 'Name3',
'Office' => 'Office',
'Payment' => 'Payment',
'PaymentTerm' => 'Payment Term',
'Phone' => 'Phone',
'Productgroup' => 'Productgroup',
'Purchase' => 'Purchase',
'Sales' => 'Sales',
'Segment' => 'Segment',
'Subtype' => 'Subtype',
'Supplier' => 'Supplier',
'Suppliers' => 'Suppliers',
'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',
'DUE' => 'Due',
'Date' => 'Date',
'Default' => 'Default',
'Delivery' => 'Delivery',
'Discount' => 'Discount',
'DiscountP' => 'Discount %',
'Documents' => 'Documents',
'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',
'Main' => 'Main',
'Margin' => 'Margin',
'Master' => 'Master',
'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',
'Supplier' => 'Supplier',
'Suppliers' => 'Suppliers',
'Support' => 'Support',
'Tags' => 'Tags',
'Type' => 'Type',
'Wire' => 'Wire',
'YTDSales' => 'YTD Sales',
'Zip' => 'Zip',
]];

View File

@ -22,6 +22,8 @@ $countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
* @var \Modules\SupplierManagement\Models\Supplier $supplier
*/
$supplier = $this->getData('supplier');
$notes = $supplier->getNotes();
$files = $supplier->getFiles();
$newestInvoices = $this->getData('newestInvoices') ?? [];
$monthlyPurchaseCosts = $this->getData('monthlyPurchaseCosts') ?? [];
@ -126,7 +128,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'); ?>:
@ -143,7 +145,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'); ?>:
@ -160,10 +162,10 @@ 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'); ?>:
<tr><td><?= $this->getHtml('Due'); ?>:
<td>
<tr><td><?= $this->getHtml('Balance'); ?>:
<td>
@ -179,14 +181,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="iFilesSupplierList" 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

@ -17,10 +17,12 @@
"description": "Supplier management module.",
"directory": "SupplierManagement",
"dependencies": {
"Admin": "1.0.0"
"Admin": "1.0.0",
"Editor": "1.0.0"
},
"providing": {
"Navigation": "*"
"Navigation": "*",
"Media": "*"
},
"load": [
{