template fixes + bug fixes + style fixes

This commit is contained in:
Dennis Eichhorn 2024-04-02 21:40:47 +00:00
parent 71901a71b4
commit e6917cb2d2
7 changed files with 143 additions and 368 deletions

View File

@ -79,8 +79,8 @@
"pid": "/sales", "pid": "/sales",
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Values", "name": "Create",
"uri": "{/base}/sales/client/attribute/value/list?{?}", "uri": "{/base}/sales/client/attribute/type/create?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 15, "order": 15,

View File

@ -285,7 +285,7 @@ final class ApiController extends Controller
/** /**
* Create directory for an account * Create directory for an account
* *
* @param int $id Item number * @param int $id Item number
* @param int $createdBy Creator of the directory * @param int $createdBy Creator of the directory
* *
* @return Collection * @return Collection
@ -332,7 +332,7 @@ final class ApiController extends Controller
/** @var \Modules\Attribute\Models\AttributeType[] $types */ /** @var \Modules\Attribute\Models\AttributeType[] $types */
$types = ClientAttributeTypeMapper::getAll() $types = ClientAttributeTypeMapper::getAll()
->where('name', \array_keys($segmentation), 'IN') ->where('name', \array_keys($segmentation), 'IN')
->execute(); ->executeGetArray();
foreach ($types as $type) { foreach ($types as $type) {
$internalResponse = clone $response; $internalResponse = clone $response;

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Modules\ClientManagement\Controller; namespace Modules\ClientManagement\Controller;
use Modules\Attribute\Models\NullAttributeValue;
use Modules\Auditor\Models\AuditMapper; use Modules\Auditor\Models\AuditMapper;
use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeL11nMapper; use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeL11nMapper;
use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper; use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper;
@ -21,8 +22,6 @@ use Modules\ClientManagement\Models\Attribute\ClientAttributeValueL11nMapper;
use Modules\ClientManagement\Models\Attribute\ClientAttributeValueMapper; use Modules\ClientManagement\Models\Attribute\ClientAttributeValueMapper;
use Modules\ClientManagement\Models\ClientMapper; use Modules\ClientManagement\Models\ClientMapper;
use Modules\ClientManagement\Models\PermissionCategory; use Modules\ClientManagement\Models\PermissionCategory;
use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\Attribute\ItemAttributeValueL11nMapper;
use Modules\Media\Models\MediaMapper; use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper; use Modules\Media\Models\MediaTypeMapper;
use Modules\Organization\Models\Attribute\UnitAttributeMapper; use Modules\Organization\Models\Attribute\UnitAttributeMapper;
@ -62,13 +61,13 @@ final class BackendController extends Controller
*/ */
public function viewClientManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewClientManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response); $view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
$view->attributes = ClientAttributeTypeMapper::getAll() $view->attributes = ClientAttributeTypeMapper::getAll()
->with('l11n') ->with('l11n')
->where('l11n/language', $response->header->l11n->language) ->where('l11n/language', $response->header->l11n->language)
->execute(); ->executeGetArray();
$view->path = 'sales/client'; $view->path = 'sales/client';
@ -97,7 +96,7 @@ final class BackendController extends Controller
$attributes = ClientAttributeValueMapper::getAll() $attributes = ClientAttributeValueMapper::getAll()
->with('l11n') ->with('l11n')
->where('l11n/language', $response->header->l11n->language) ->where('l11n/language', $response->header->l11n->language)
->execute(); ->executeGetArray();
$view->data['attributes'] = $attributes; $view->data['attributes'] = $attributes;
@ -118,7 +117,7 @@ final class BackendController extends Controller
*/ */
public function viewClientManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewClientManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response); $view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
$view->attribute = ClientAttributeTypeMapper::get() $view->attribute = ClientAttributeTypeMapper::get()
@ -132,7 +131,7 @@ final class BackendController extends Controller
$view->l11ns = ClientAttributeTypeL11nMapper::getAll() $view->l11ns = ClientAttributeTypeL11nMapper::getAll()
->where('ref', $view->attribute->id) ->where('ref', $view->attribute->id)
->execute(); ->executeGetArray();
$view->path = 'sales/client'; $view->path = 'sales/client';
@ -153,7 +152,7 @@ final class BackendController extends Controller
*/ */
public function viewClientManagementAttributeValue(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewClientManagementAttributeValue(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response); $view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
$view->attribute = ClientAttributeValueMapper::get() $view->attribute = ClientAttributeValueMapper::get()
@ -164,7 +163,7 @@ final class BackendController extends Controller
$view->l11ns = ClientAttributeValueL11nMapper::getAll() $view->l11ns = ClientAttributeValueL11nMapper::getAll()
->where('ref', $view->attribute->id) ->where('ref', $view->attribute->id)
->execute(); ->executeGetArray();
// @todo Also find the ItemAttributeType // @todo Also find the ItemAttributeType
@ -195,7 +194,7 @@ final class BackendController extends Controller
->with('mainAddress') ->with('mainAddress')
->where('unit', $this->app->unitId) ->where('unit', $this->app->unitId)
->limit(25) ->limit(25)
->execute(); ->executeGetArray();
$view->data['client'] = $client; $view->data['client'] = $client;
@ -217,7 +216,7 @@ final class BackendController extends Controller
public function viewClientManagementClientCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewClientManagementClientCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/client-create'); $view->setTemplate('/Modules/ClientManagement/Theme/Backend/client-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003102001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003102001, $request, $response);
return $view; return $view;
@ -285,7 +284,7 @@ final class BackendController extends Controller
$view->data['attributeTypes'] = ClientAttributeTypeMapper::getAll() $view->data['attributeTypes'] = ClientAttributeTypeMapper::getAll()
->with('l11n') ->with('l11n')
->where('l11n/language', $response->header->l11n->language) ->where('l11n/language', $response->header->l11n->language)
->execute(); ->executeGetArray();
// Get item profile image // Get item profile image
// @feature Create a new read mapper function that returns relation models instead of its own model // @feature Create a new read mapper function that returns relation models instead of its own model
@ -318,17 +317,18 @@ final class BackendController extends Controller
$view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue(); $view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue();
$view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing'); $view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing');
$view->data['hasAccounting'] = $this->app->moduleManager->isActive('Accounting');
$view->data['prices'] = $view->data['hasBilling'] $view->data['prices'] = $view->data['hasBilling']
? \Modules\Billing\Models\Price\PriceMapper::getAll() ? \Modules\Billing\Models\Price\PriceMapper::getAll()
->where('client', $view->data['client']->id) ->where('client', $view->data['client']->id)
->where('type', \Modules\Billing\Models\Price\PriceType::SALES) ->where('type', \Modules\Billing\Models\Price\PriceType::SALES)
->execute() ->executeGetArray()
: []; : [];
/** @var \Modules\Attribute\Models\AttributeType[] $tmp */ /** @var \Modules\Attribute\Models\AttributeType[] $tmp */
$tmp = ItemAttributeTypeMapper::getAll() $tmp = ClientAttributeTypeMapper::getAll()
->with('defaults') ->with('defaults')
->with('defaults/l11n') ->with('defaults/l11n')
->where('name', [ ->where('name', [
@ -336,9 +336,9 @@ final class BackendController extends Controller
'sales_tax_code', 'purchase_tax_code', 'sales_tax_code', 'purchase_tax_code',
], 'IN') ], 'IN')
->where('defaults/l11n', (new Where($this->app->dbPool->get())) ->where('defaults/l11n', (new Where($this->app->dbPool->get()))
->where(ItemAttributeValueL11nMapper::getColumnByMember('ref') ?? '', '=', null) ->where(ClientAttributeValueL11nMapper::getColumnByMember('ref') ?? '', '=', null)
->orWhere(ItemAttributeValueL11nMapper::getColumnByMember('language') ?? '', '=', $response->header->l11n->language)) ->orWhere(ClientAttributeValueL11nMapper::getColumnByMember('language') ?? '', '=', $response->header->l11n->language))
->execute(); ->executeGetArray();
$defaultAttributeTypes = []; $defaultAttributeTypes = [];
foreach ($tmp as $t) { foreach ($tmp as $t) {
@ -358,7 +358,7 @@ final class BackendController extends Controller
->where('defaults/l11n', (new Where($this->app->dbPool->get())) ->where('defaults/l11n', (new Where($this->app->dbPool->get()))
->where(ClientAttributeValueL11nMapper::getColumnByMember('ref') ?? '', '=', null) ->where(ClientAttributeValueL11nMapper::getColumnByMember('ref') ?? '', '=', null)
->orWhere(ClientAttributeValueL11nMapper::getColumnByMember('language') ?? '', '=', $response->header->l11n->language)) ->orWhere(ClientAttributeValueL11nMapper::getColumnByMember('language') ?? '', '=', $response->header->l11n->language))
->execute(); ->executeGetArray();
$clientSegmentationTypes = []; $clientSegmentationTypes = [];
foreach ($tmp as $t) { foreach ($tmp as $t) {
@ -381,7 +381,7 @@ final class BackendController extends Controller
->where('type', StringUtils::intHash(ClientMapper::class)) ->where('type', StringUtils::intHash(ClientMapper::class))
->where('module', 'ClientManagement') ->where('module', 'ClientManagement')
->where('ref', (string) $view->data['client']->id) ->where('ref', (string) $view->data['client']->id)
->execute(); ->executeGetArray();
} }
$view->data['logs'] = $logs; $view->data['logs'] = $logs;
@ -392,7 +392,7 @@ final class BackendController extends Controller
->with('types') ->with('types')
->join('id', ClientMapper::class, 'files') // id = media id, files = client relations ->join('id', ClientMapper::class, 'files') // id = media id, files = client relations
->on('id', $view->data['client']->id, relation: 'files') // id = item id ->on('id', $view->data['client']->id, relation: 'files') // id = item id
->execute(); ->executeGetArray();
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response); $view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response);
@ -419,4 +419,29 @@ final class BackendController extends Controller
{ {
return new View($this->app->l11nManager, $request, $response); return new View($this->app->l11nManager, $request, $response);
} }
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewClientManagementAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
$view->type = ClientAttributeTypeMapper::get()->where('id', (int) $request->getData('type'))->execute();
$view->attribute = new NullAttributeValue();
$view->path = 'sales/client';
return $view;
}
} }

View File

@ -33,6 +33,7 @@ return ['ClientManagement' => [
'Country' => 'Land', 'Country' => 'Land',
'Created' => 'Erstellt', 'Created' => 'Erstellt',
'CreateBill' => 'Rechnung erstellen', 'CreateBill' => 'Rechnung erstellen',
'ViewAccount' => 'Buchhaltung',
'CreatedAt' => 'Erstellt', 'CreatedAt' => 'Erstellt',
'Creditcard' => 'Kreditkarte', 'Creditcard' => 'Kreditkarte',
'DSO' => 'DSO.', 'DSO' => 'DSO.',
@ -104,7 +105,7 @@ return ['ClientManagement' => [
'PrimarySupplier' => 'Hauptlieferant', 'PrimarySupplier' => 'Hauptlieferant',
'LeadTime' => 'Lieferzeit', 'LeadTime' => 'Lieferzeit',
'UnitQuantity' => 'Einheitsmenge', 'UnitQuantity' => 'Einheitsmenge',
'Suppliers' => 'Lieferanten', 'Suppliers' => 'Lieferanten',
'CostCenter' => 'Kostenstelle', 'CostCenter' => 'Kostenstelle',
'CostObject' => 'Kostenträger', 'CostObject' => 'Kostenträger',
'DefaultStock' => 'Standard Lager', 'DefaultStock' => 'Standard Lager',
@ -123,7 +124,11 @@ return ['ClientManagement' => [
'ClientGroup' => 'Kundengruppe', 'ClientGroup' => 'Kundengruppe',
'ClientType' => 'Kundenart', 'ClientType' => 'Kundenart',
'ItemType' => 'Artikeltyp', 'ItemType' => 'Artikeltyp',
'Item' => 'Item', 'Item' => 'Artikel',
'Status' => 'Status',
'EarningIndicator' => 'Verkaufssteuerkennzeichen', 'EarningIndicator' => 'Verkaufssteuerkennzeichen',
'CostIndicator' => 'Einkaufssteuerkennzeichen', 'CostIndicator' => 'Einkaufssteuerkennzeichen',
':status-1' => 'Aktiv',
':status-2' => 'Inaktiv',
':status-3' => 'Blockiert',
]]; ]];

View File

@ -33,6 +33,7 @@ return ['ClientManagement' => [
'Country' => 'Country', 'Country' => 'Country',
'Created' => 'Created', 'Created' => 'Created',
'CreateBill' => 'Create Bill', 'CreateBill' => 'Create Bill',
'ViewAccount' => 'View Account',
'CreatedAt' => 'Created at', 'CreatedAt' => 'Created at',
'Creditcard' => 'Creditcard', 'Creditcard' => 'Creditcard',
'DSO' => 'DSO', 'DSO' => 'DSO',
@ -124,6 +125,10 @@ return ['ClientManagement' => [
'ClientType' => 'Client Type', 'ClientType' => 'Client Type',
'ItemType' => 'Item Type', 'ItemType' => 'Item Type',
'Item' => 'Item', 'Item' => 'Item',
'Status' => 'Status',
'EarningIndicator' => 'Sales tax code', 'EarningIndicator' => 'Sales tax code',
'CostIndicator' => 'Purchase tax code', 'CostIndicator' => 'Purchase tax code',
':status-1' => 'Active',
':status-2' => 'Inactive',
':status-3' => 'Banned',
]]; ]];

View File

@ -1,289 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\ClientManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Contact'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Addresses'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('PaymentTerm'); ?></label>
<li><label for="c-tab-5"><?= $this->getHtml('Payment'); ?></label>
<li><label for="c-tab-6"><?= $this->getHtml('Prices'); ?></label>
<li><label for="c-tab-7"><?= $this->getHtml('AreaManager'); ?></label>
<li><label for="c-tab-8"><?= $this->getHtml('Files'); ?></label>
<li><label for="c-tab-9"><?= $this->getHtml('Logs'); ?></label>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Client'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="number" id="iId" min="1" name="id" required></span>
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" required>
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
<tr><td><input type="text" id="iName2" name="name2">
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
<tr><td><input type="text" id="iName3" name="name3">
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-client">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Contact'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iCType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iCType" name="actype">
<option><?= $this->getHtml('Email'); ?>
<option><?= $this->getHtml('Fax'); ?>
<option><?= $this->getHtml('Phone'); ?>
</select>
<tr><td><label for="iCStype"><?= $this->getHtml('Subtype'); ?></label>
<tr><td><select id="iCStype" name="acstype">
<option><?= $this->getHtml('Office'); ?>
<option><?= $this->getHtml('Sales'); ?>
<option><?= $this->getHtml('Purchase'); ?>
<option><?= $this->getHtml('Accounting'); ?>
<option><?= $this->getHtml('Support'); ?>
</select>
<tr><td><label for="iCInfo"><?= $this->getHtml('Info'); ?></label>
<tr><td><input type="text" id="iCInfo" name="cinfo">
<tr><td><label for="iCData"><?= $this->getHtml('Contact'); ?></label>
<tr><td><input type="text" id="iCData" name="cdata">
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Address'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iAType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iAType" name="atype">
<option><?= $this->getHtml('Default'); ?>
<option><?= $this->getHtml('Delivery'); ?>
<option><?= $this->getHtml('Invoice'); ?>
</select>
<tr><td><label for="iAddress"><?= $this->getHtml('Address'); ?></label>
<tr><td><input type="text" id="iAddress" name="address">
<tr><td><label for="iZip"><?= $this->getHtml('Zip'); ?></label>
<tr><td><input type="text" id="iZip" name="zip">
<tr><td><label for="iCountry"><?= $this->getHtml('Country'); ?></label>
<tr><td><input type="text" id="iCountry" name="country">
<tr><td><label for="iAInfo"><?= $this->getHtml('Info'); ?></label>
<tr><td><input type="text" id="iAInfo" name="ainfo">
<tr><td><span class="check"><input type="checkbox" id="iDefault" name="default" checked><label for="iDefault"><?= $this->getHtml('IsDefault'); ?></label></span>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('PaymentTerm'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text"></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text">
<tr><td><label for="iTerm"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iTerm" name="term" required>
<option>
</select>
<tr><td><span class="check"><input type="checkbox" id="iFreightage" name="freightage"><label for="iFreightage"><?= $this->getHtml('Freightage'); ?></label></span>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Payment'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iACType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iACType" name="actype">
<option><?= $this->getHtml('Wire'); ?>
<option><?= $this->getHtml('Creditcard'); ?>
</select>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-6" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Price'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('{/api}...'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td colspan="2"><label for="iPType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iPType" name="ptye">
<option>
</select><td>
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text"></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text">
<tr><td><label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<tr><td><input id="iPQuantity" name="quantity" type="text"><td>
<tr><td><label for="iPrice"><?= $this->getHtml('Price'); ?></label>
<tr><td><input id="iPrice" name="price" type="number" step="any" min="0"><td>
<tr><td><label for="iDiscount"><?= $this->getHtml('Discount'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0"><td>
<tr><td><label for="iDiscount"><?= $this->getHtml('DiscountP'); ?></label>
<tr><td><input id="iDiscountP" name="discountp" type="number" step="any" min="0"><td>
<tr><td><label for="iBonus"><?= $this->getHtml('Bonus'); ?></label>
<tr><td><input id="iBonus" name="bonus" type="number" step="any" min="0"><td>
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-7" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('AreaManager'); ?></h1></header>
<div class="inner">
<form action="<?= \phpOMS\Uri\UriFactory::build('{/api}...'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iManager"><?= $this->getHtml('AreaManager'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iManager" name="source" type="text"></span>
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text"></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-8" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>>
<div class="tab">
</div>
<input type="radio" id="c-tab-9" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-9' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12">
<?php
$footerView = new \phpOMS\Views\PaginationView($this->l11nManager, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages(20);
$footerView->setPage(1);
?>
<div class="box wf-100">
<table class="default sticky">
<caption><?= $this->getHtml('Logs'); ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
<td>IP
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Name'); ?>
<td class="wf-100"><?= $this->getHtml('Log'); ?>
<td><?= $this->getHtml('Date'); ?>
<tbody>
<tr>
<td><?= $this->printHtml($this->request->getOrigin()); ?>
<td><?= $this->printHtml((string) $this->request->header->account); ?>
<td><?= $this->printHtml((string) $this->request->header->account); ?>
<td>Creating customer
<td><?= $this->printHtml((new \DateTime('now'))->format('Y-m-d H:i:s')); ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -16,6 +16,8 @@ use Modules\Admin\Models\ContactType;
use Modules\Billing\Models\BillMapper; use Modules\Billing\Models\BillMapper;
use Modules\Billing\Models\Price\PriceType; use Modules\Billing\Models\Price\PriceType;
use Modules\Billing\Models\SalesBillMapper; use Modules\Billing\Models\SalesBillMapper;
use Modules\ClientManagement\Models\ClientStatus;
use Modules\ClientManagement\Models\NullClient;
use Modules\Media\Models\NullMedia; use Modules\Media\Models\NullMedia;
use phpOMS\DataStorage\Database\Query\OrderType; use phpOMS\DataStorage\Database\Query\OrderType;
use phpOMS\Localization\ISO3166CharEnum; use phpOMS\Localization\ISO3166CharEnum;
@ -38,9 +40,13 @@ $languages = ISO639Enum::getConstants();
/** /**
* @var \Modules\ClientManagement\Models\Client $client * @var \Modules\ClientManagement\Models\Client $client
*/ */
$client = $this->data['client']; $client = $this->data['client'] ?? new NullClient();
$isNew = $client->id === 0;
$clientImage = $this->data['clientImage'] ?? new NullMedia(); $clientImage = $this->data['clientImage'] ?? new NullMedia();
$clientStatus = ClientStatus::getConstants();
$logs = $this->data['logs'] ?? []; $logs = $this->data['logs'] ?? [];
/** /**
@ -49,41 +55,54 @@ $logs = $this->data['logs'] ?? [];
echo $this->data['nav']->render(); echo $this->data['nav']->render();
?> ?>
<div class="tabview tab-2"> <div class="tabview tab-2">
<?php if (!$isNew) : ?>
<div class="box"> <div class="box">
<ul class="tab-links"> <ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label> <li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Addresses'); ?></label> <li><label for="c-tab-2"><?= $this->getHtml('Addresses'); ?></label>
<li><label for="c-tab-5"><?= $this->getHtml('Payment'); ?></label> <li><label for="c-tab-3"><?= $this->getHtml('Payment'); ?></label>
<li><label for="c-tab-6"><?= $this->getHtml('Prices'); ?></label> <li><label for="c-tab-4"><?= $this->getHtml('Prices'); ?></label>
<li><label for="c-tab-7"><?= $this->getHtml('Attributes', 'Attribute', 'Backend'); ?></label> <li><label for="c-tab-5"><?= $this->getHtml('Attributes', 'Attribute', 'Backend'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Accounting'); ?></label> <li><label for="c-tab-6"><?= $this->getHtml('Accounting'); ?></label>
<li><label for="c-tab-13"><?= $this->getHtml('Notes'); ?></label> <li><label for="c-tab-7"><?= $this->getHtml('Notes'); ?></label>
<li><label for="c-tab-8"><?= $this->getHtml('Files'); ?></label> <li><label for="c-tab-8"><?= $this->getHtml('Files'); ?></label>
<li><label for="c-tab-9"><?= $this->getHtml('Bills'); ?></label> <li><label for="c-tab-9"><?= $this->getHtml('Bills'); ?></label>
<li><label for="c-tab-10"><?= $this->getHtml('Items'); ?></label> <li><label for="c-tab-10"><?= $this->getHtml('Items'); ?></label>
<?php if (!empty($logs)) : ?><li><label for="c-tab-17"><?= $this->getHtml('Logs'); ?></label><?php endif; ?> <?php if (!empty($logs)) : ?><li><label for="c-tab-17"><?= $this->getHtml('Logs'); ?></label><?php endif; ?>
</ul> </ul>
</div> </div>
<?php endif; ?>
<div class="tab-content"> <div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<div class="col-xs-12 col-lg-3 last-lg"> <div class="col-xs-12 col-lg-3 last-lg">
<?php if (!$isNew && (($this->data['hasBilling'] ?? false) || ($this->data['hasAccounting'] ?? false))) : ?>
<div class="box"> <div class="box">
<?php if(true) : ?> <?php if ($this->data['hasBilling'] ?? false) : ?>
<a class="button" href="<?= UriFactory::build('{/base}/sales/bill/create?client=' . $client->id); ?>"><?= $this->getHtml('CreateBill'); ?></a> <a class="button" href="<?= UriFactory::build('{/base}/sales/bill/create?client=' . $client->id); ?>"><?= $this->getHtml('CreateBill'); ?></a>
<?php endif; ?> <?php endif; ?>
<?php if (false) : ?> <?php if ($this->data['hasAccounting'] ?? false) : ?>
<a class="button"><?= $this->getHtml('ViewAccount', 'Accounting'); ?></a> <a class="button" href="<?= UriFactory::build('{/base}/accounting/account?number=' . $client->number); ?>"><?= $this->getHtml('ViewAccount'); ?></a>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>
<section class="portlet"> <section class="portlet">
<form> <form id="clientForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}sales/client?csrf={$CSRF}'); ?>">
<div class="portlet-body"> <div class="portlet-body">
<div class="form-group"> <div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label> <label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iId" min="1" name="id" value="<?= $this->printHtml($client->number); ?>" disabled></span> <span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iId" min="1" name="id" value="<?= $this->printHtml($client->number); ?>"<?= $isNew ? ' required' : ' disabled'; ?>></span>
</div>
<div class="form-group">
<label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<select id="iStatus" name="status">
<?php foreach ($clientStatus as $status) : ?>
<option value="<?= $status; ?>"<?= $client->status === $status ? ' selected': ''; ?>><?= $this->getHtml(':status-' . $status); ?>
<?php endforeach; ?>
</select>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -102,7 +121,12 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<div class="portlet-foot"> <div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-client-profile"> <input type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-client-profile"> <?php if ($isNew) : ?>
<input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-client">
<?php else : ?>
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-client-profile">
<input class="cancel end-xs" type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-client-profile">
<?php endif; ?>
</div> </div>
</form> </form>
</section> </section>
@ -115,17 +139,17 @@ echo $this->data['nav']->render();
<div class="portlet-body"> <div class="portlet-body">
<div class="form-group"> <div class="form-group">
<label for="iPhone"><?= $this->getHtml('Phone'); ?></label> <label for="iPhone"><?= $this->getHtml('Phone'); ?></label>
<input type="text" id="iPhone" name="name1" value="<?= $this->printHtml($client->account->getContactByType(ContactType::PHONE)->content); ?>"> <input type="text" id="iPhone" form="clientForm" name="phone" value="<?= $this->printHtml($client->account->getContactByType(ContactType::PHONE)->content); ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="iEmail"><?= $this->getHtml('Email'); ?></label> <label for="iEmail"><?= $this->getHtml('Email'); ?></label>
<input type="text" id="iEmail" name="name1" value="<?= $this->printHtml($client->account->getContactByType(ContactType::EMAIL)->content); ?>"> <input type="text" id="iEmail" form="clientForm" name="email" value="<?= $this->printHtml($client->account->getContactByType(ContactType::EMAIL)->content); ?>">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="iWebsite"><?= $this->getHtml('Website'); ?></label> <label for="iWebsite"><?= $this->getHtml('Website'); ?></label>
<input type="text" id="iWebsite" name="name1" value="<?= $this->printHtml($client->account->getContactByType(ContactType::WEBSITE)->content); ?>"> <input type="text" id="iWebsite" form="clientForm" name="website" value="<?= $this->printHtml($client->account->getContactByType(ContactType::WEBSITE)->content); ?>">
</div> </div>
</div> </div>
</section> </section>
@ -158,48 +182,51 @@ echo $this->data['nav']->render();
<?php if (!empty($client->mainAddress->fao)) : ?> <?php if (!empty($client->mainAddress->fao)) : ?>
<div class="form-group"> <div class="form-group">
<label for="iFAO"><?= $this->getHtml('FAO'); ?></label> <label for="iFAO"><?= $this->getHtml('FAO'); ?></label>
<input type="text" id="iFAO" name="fao" value="<?= $this->printHtml($client->mainAddress->fao); ?>"> <input type="text" id="iFAO" form="clientForm" name="fao" value="<?= $this->printHtml($client->mainAddress->fao); ?>">
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="form-group"> <div class="form-group">
<label for="iAddress"><?= $this->getHtml('Address'); ?></label> <label for="iAddress"><?= $this->getHtml('Address'); ?></label>
<input type="text" id="iAddress" name="address" value="<?= $this->printHtml($client->mainAddress->address); ?>" required> <input type="text" id="iAddress" form="clientForm" name="address" value="<?= $this->printHtml($client->mainAddress->address); ?>" required>
</div> </div>
<?php if (!empty($client->mainAddress->addressAddition)) : ?> <?php if (!empty($client->mainAddress->addressAddition)) : ?>
<div class="form-group"> <div class="form-group">
<label for="iAddition"><?= $this->getHtml('Addition'); ?></label> <label for="iAddition"><?= $this->getHtml('Addition'); ?></label>
<input type="text" id="iAddition" name="addition" value="<?= $this->printHtml($client->mainAddress->addressAddition); ?>"> <input type="text" id="iAddition" form="clientForm" name="addition" value="<?= $this->printHtml($client->mainAddress->addressAddition); ?>">
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="form-group"> <div class="form-group">
<label for="iPostal"><?= $this->getHtml('Postal'); ?></label> <label for="iPostal"><?= $this->getHtml('Postal'); ?></label>
<input type="text" id="iPostal" name="postal" value="<?= $this->printHtml($client->mainAddress->postal); ?>" required> <input type="text" id="iPostal" form="clientForm" name="postal" value="<?= $this->printHtml($client->mainAddress->postal); ?>" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="iCity"><?= $this->getHtml('City'); ?></label> <label for="iCity"><?= $this->getHtml('City'); ?></label>
<input type="text" id="iCity" name="city" value="<?= $this->printHtml($client->mainAddress->city); ?>" required> <input type="text" id="iCity" form="clientForm" name="city" value="<?= $this->printHtml($client->mainAddress->city); ?>" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="iCountry"><?= $this->getHtml('Country'); ?></label> <label for="iCountry"><?= $this->getHtml('Country'); ?></label>
<select id="iCountry" name="country"> <select id="iCountry" form="clientForm" name="country">
<?php foreach ($countryCodes as $code3 => $code2) : ?> <?php foreach ($countryCodes as $code3 => $code2) : ?>
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $client->mainAddress->country ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?> <option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $client->mainAddress->country ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<?php if (!$isNew) : ?>
<div class="form-group"> <div class="form-group">
<label for="iClientMap"><?= $this->getHtml('Map'); ?></label> <label for="iClientMap"><?= $this->getHtml('Map'); ?></label>
<div id="iClientMap" class="map" data-lat="<?= $client->mainAddress->lat; ?>" data-lon="<?= $client->mainAddress->lon; ?>"></div> <div id="iClientMap" class="map" data-lat="<?= $client->mainAddress->lat; ?>" data-lon="<?= $client->mainAddress->lon; ?>"></div>
</div> </div>
<?php endif; ?>
</div> </div>
</section> </section>
<?php if (!$isNew) : ?>
<section class="portlet"> <section class="portlet">
<div class="portlet-body"> <div class="portlet-body">
<img alt="<?= $this->printHtml($clientImage->name); ?>" width="100%" loading="lazy" class="item-image" <img alt="<?= $this->printHtml($clientImage->name); ?>" width="100%" loading="lazy" class="item-image"
@ -214,7 +241,10 @@ echo $this->data['nav']->render();
<textarea class="undecorated"><?= $this->printHtml($client->info); ?></textarea> <textarea class="undecorated"><?= $this->printHtml($client->info); ?></textarea>
</div> </div>
</section> </section>
<?php endif; ?>
</div> </div>
<?php if (!$isNew) : ?>
<div class="col-xs-12 col-lg-9 plain-grid"> <div class="col-xs-12 col-lg-9 plain-grid">
<?php if (!empty($client->notes) && ($warning = $client->getEditorDocByTypeName('client_backend_warning'))->id !== 0) : ?> <?php if (!empty($client->notes) && ($warning = $client->getEditorDocByTypeName('client_backend_warning'))->id !== 0) : ?>
<!-- If note warning exists --> <!-- If note warning exists -->
@ -227,7 +257,7 @@ echo $this->data['nav']->render();
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($this->data['hasBilling']) : ?> <?php if ($this->data['hasBilling'] ?? false) : ?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet hl-7"> <section class="portlet hl-7">
@ -321,7 +351,7 @@ echo $this->data['nav']->render();
foreach ($client->files as $file) : foreach ($client->files as $file) :
++$count; ++$count;
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id); $url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $file->name; ?></a> <td><a href="<?= $url; ?>"><?= $file->name; ?></a>
<td><a href="<?= $url; ?>"><?= $file->extension; ?></a> <td><a href="<?= $url; ?>"><?= $file->extension; ?></a>
@ -336,7 +366,7 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<?php if ($this->data['hasBilling']) : ?> <?php if ($this->data['hasBilling'] ?? false) : ?>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<section class="portlet"> <section class="portlet">
@ -360,19 +390,20 @@ echo $this->data['nav']->render();
->where('type/l11n/language', $this->response->header->l11n->language) ->where('type/l11n/language', $this->response->header->l11n->language)
->sort('id', OrderType::DESC) ->sort('id', OrderType::DESC)
->limit(5) ->limit(5)
->execute(); ->executeGetArray();
$count = 0; $count = 0;
/** @var \Modules\Billing\Models\Bill $invoice */ /** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) : foreach ($newestInvoices as $invoice) :
++$count; ++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id); $url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $invoice->id);
$clientUrl = UriFactory::build('{/base}/sales/client/view?{?}&id=' . $invoice->client->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a> <td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a> <td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a> <td><a class="content" href="<?= $clientUrl; ?>"><?= $invoice->billTo; ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a> <td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->performanceDate->format('Y-m-d'); ?></a> <td><a href="<?= $url; ?>"><?= $invoice->performanceDate->format('Y-m-d'); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
@ -386,10 +417,11 @@ echo $this->data['nav']->render();
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($this->data['hasBilling']) : <?php if ($this->data['hasBilling'] ?? false) :
$monthlySalesCosts = SalesBillMapper::getClientMonthlySalesCosts($client->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now')); $monthlySalesCosts = SalesBillMapper::getClientMonthlySalesCosts($client->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
if (!empty($monthlySalesCosts)) :
?> ?>
<?php if (!empty($monthlySalesCosts)) : ?>
<div class="row"> <div class="row">
<?php $segmentSales = SalesBillMapper::getClientAttributeNetSales($client->id, 'segment', 'en', (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now')); ?> <?php $segmentSales = SalesBillMapper::getClientAttributeNetSales($client->id, 'segment', 'en', (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now')); ?>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
@ -543,16 +575,18 @@ echo $this->data['nav']->render();
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>
</div> </div>
</div> </div>
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>> <?php if (!$isNew) : ?>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<?= $this->data['contact-component']->render('client-contact', 'contacts', $client->account->contacts); ?> <?= $this->data['contact-component']->render('client-contact', 'contacts', $client->account->contacts); ?>
<?= $this->data['address-component']->render('client-address', 'addresses', $client->account->addresses); ?> <?= $this->data['address-component']->render('client-address', 'addresses', $client->account->addresses); ?>
</div> </div>
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6 col-lg-4"> <div class="col-xs-12 col-md-6 col-lg-4">
@ -611,9 +645,6 @@ echo $this->data['nav']->render();
<option> <option>
</select> </select>
</div> </div>
<div class="form-group">
<span class="check"><input type="checkbox" id="iFreightage" name="freightage"><label for="iFreightage"><?= $this->getHtml('Freightage'); ?></label></span>
</div>
</div> </div>
<div class="portlet-foot"> <div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>"> <input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
@ -624,7 +655,7 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<input type="radio" id="c-tab-6" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
@ -950,7 +981,7 @@ echo $this->data['nav']->render();
<td data-tpl-text="/discount" data-tpl-value="/discount"><?= $value->discount->getAmount(); ?> <td data-tpl-text="/discount" data-tpl-value="/discount"><?= $value->discount->getAmount(); ?>
<td data-tpl-text="/discountr" data-tpl-value="/discountr"><?= $this->getPercentage($value->discountPercentage); ?> <td data-tpl-text="/discountr" data-tpl-value="/discountr"><?= $this->getPercentage($value->discountPercentage); ?>
<td data-tpl-text="/bonus" data-tpl-value="/bonus"><?= $value->bonus->getAmount(); ?> <td data-tpl-text="/bonus" data-tpl-value="/bonus"><?= $value->bonus->getAmount(); ?>
<td data-tpl-text="/item_item" data-tpl-value="/item_item"><?= $this->printHtml((string) $value->item); ?> <td data-tpl-text="/item_item" data-tpl-value="/item_item"><?= $this->printHtml((string) $value->item->id); ?>
<td data-tpl-text="/item_segment" data-tpl-value="/item_segment"><?= $this->printHtml((string) $value->itemsegment->getL11n()); ?> <td data-tpl-text="/item_segment" data-tpl-value="/item_segment"><?= $this->printHtml((string) $value->itemsegment->getL11n()); ?>
<td data-tpl-text="/item_section" data-tpl-value="/item_section"><?= $this->printHtml((string) $value->itemsection->getL11n()); ?> <td data-tpl-text="/item_section" data-tpl-value="/item_section"><?= $this->printHtml((string) $value->itemsection->getL11n()); ?>
<td data-tpl-text="/item_salesgroup" data-tpl-value="/item_salesgroup"><?= $this->printHtml((string) $value->itemsalesgroup->getL11n()); ?> <td data-tpl-text="/item_salesgroup" data-tpl-value="/item_salesgroup"><?= $this->printHtml((string) $value->itemsalesgroup->getL11n()); ?>
@ -975,7 +1006,7 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<input type="radio" id="c-tab-7" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<?= $this->data['attributeView']->render( <?= $this->data['attributeView']->render(
@ -1018,13 +1049,13 @@ echo $this->data['nav']->render();
->where('client', $client->id) ->where('client', $client->id)
->where('type/l11n/language', $this->response->header->l11n->language) ->where('type/l11n/language', $this->response->header->l11n->language)
->where('billDate', SmartDateTime::startOfYear($this->data['business_start']), '>=') ->where('billDate', SmartDateTime::startOfYear($this->data['business_start']), '>=')
->execute(); ->executeGetArray();
$count = 0; $count = 0;
/** @var \Modules\Billing\Models\Bill $invoice */ /** @var \Modules\Billing\Models\Bill $invoice */
foreach ($allInvoices as $invoice) : foreach ($allInvoices as $invoice) :
++$count; ++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id); $url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $invoice->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a> <td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
@ -1044,7 +1075,7 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-9' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-6" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
@ -1080,7 +1111,7 @@ echo $this->data['nav']->render();
<input type="radio" id="c-tab-10" name="tabular-2" checked> <input type="radio" id="c-tab-10" name="tabular-2" checked>
<div class="tab col-simple"> <div class="tab col-simple">
<?php $items = SalesBillMapper::getClientItem($client->id, SmartDateTime::startOfYear($this->data['business_start']), new SmartDateTime('now')); ?> <?php $billElements = SalesBillMapper::getClientItem($client->id, SmartDateTime::startOfYear($this->data['business_start']), new SmartDateTime('now')); ?>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<section class="portlet"> <section class="portlet">
@ -1216,13 +1247,10 @@ echo $this->data['nav']->render();
<tbody> <tbody>
<?php <?php
$count = 0; $count = 0;
foreach ($items as $key => $value) : foreach ($billElements as $key => $value) :
if ($value->itemNumber === '') {
continue;
}
++$count; ++$count;
$url = UriFactory::build('{/base}/sales/item/view?{?}&id=' . $value->id); $url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $value->bill->id);
$itemUrl = UriFactory::build('{/base}/sales/item/view?{?}&id=' . $value->item->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><label class="checkbox" for="iSalesItemSelect-<?= $key; ?>"> <td><label class="checkbox" for="iSalesItemSelect-<?= $key; ?>">
@ -1231,8 +1259,8 @@ echo $this->data['nav']->render();
</label> </label>
<td><?= $value->bill->performanceDate?->format('Y-m-d'); ?> <td><?= $value->bill->performanceDate?->format('Y-m-d'); ?>
<td><?= $this->printHtml($value->bill->getNumber()); ?> <td><?= $this->printHtml($value->bill->getNumber()); ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemNumber); ?></a> <td><a class="content" href="<?= $itemUrl; ?>"><?= $this->printHtml($value->itemNumber); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->itemName); ?></a> <td><a class="content" href="<?= $itemUrl; ?>"><?= $this->printHtml($value->itemName); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->quantity->getAmount()); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->quantity->getAmount()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($value->singleSalesPriceNet, symbol: ''); ?></a> <td><a href="<?= $url; ?>"><?= $this->getCurrency($value->singleSalesPriceNet, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($value->singleDiscountP, symbol: ''); ?></a> <td><a href="<?= $url; ?>"><?= $this->getCurrency($value->singleDiscountP, symbol: ''); ?></a>
@ -1250,7 +1278,7 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<input type="radio" id="c-tab-13" name="tabular-2" checked> <input type="radio" id="c-tab-7" name="tabular-2" checked>
<div class="tab col-simple"> <div class="tab col-simple">
<?= $this->data['note']->render('client-note', 'notes', $client->notes); ?> <?= $this->data['note']->render('client-note', 'notes', $client->notes); ?>
</div> </div>
@ -1318,5 +1346,6 @@ echo $this->data['nav']->render();
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?>
</div> </div>
</div> </div>