mirror of
https://github.com/Karaka-Management/oms-BusinessExpenses.git
synced 2026-01-10 14:48:43 +00:00
fix templates
This commit is contained in:
parent
dd9e4dae7e
commit
9e382fca4b
|
|
@ -15,7 +15,7 @@
|
|||
"children": [
|
||||
{
|
||||
"id": 1001002001,
|
||||
"pid": "/",
|
||||
"pid": "/businessexpenses/expense",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
},
|
||||
{
|
||||
"id": 1001002002,
|
||||
"pid": "/",
|
||||
"pid": "/businessexpenses/expense",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/businessexpenses/expense/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 40,
|
||||
"order": 45,
|
||||
"from": "BusinessExpenses",
|
||||
"permission": { "permission": 2, "type": null, "element": null },
|
||||
"parent": 1001001001,
|
||||
|
|
@ -63,14 +63,14 @@
|
|||
"children": [
|
||||
{
|
||||
"id": 1001004001,
|
||||
"pid": "/",
|
||||
"pid": "/businessexpenses",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/businessexpenses/expense/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 40,
|
||||
"order": 1,
|
||||
"from": "BusinessExpenses",
|
||||
"permission": { "permission": 2, "type": null, "element": null },
|
||||
"parent": 1001003001,
|
||||
|
|
@ -79,19 +79,35 @@
|
|||
},
|
||||
{
|
||||
"id": 1001004002,
|
||||
"pid": "/",
|
||||
"pid": "/businessexpenses",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/businessexpenses/expense/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 40,
|
||||
"order": 5,
|
||||
"from": "BusinessExpenses",
|
||||
"permission": { "permission": 2, "type": null, "element": null },
|
||||
"parent": 1001003001,
|
||||
"children": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1001004003,
|
||||
"pid": "/businessexpenses",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Types",
|
||||
"uri": "{/base}/businessexpenses/type/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 10,
|
||||
"from": "BusinessExpenses",
|
||||
"permission": { "permission": 2, "type": null, "element": null },
|
||||
"parent": 1001003001,
|
||||
"children": [],
|
||||
"status": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@
|
|||
"de": "Kraftstoff"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "parking",
|
||||
"l11n": {
|
||||
"en": "Parking",
|
||||
"de": "Parken"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "entertainment",
|
||||
"l11n": {
|
||||
|
|
@ -54,6 +61,13 @@
|
|||
"en": "Present",
|
||||
"de": "Geschenk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "postage",
|
||||
"l11n": {
|
||||
"en": "Postage",
|
||||
"de": "Porto"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "other",
|
||||
|
|
|
|||
|
|
@ -374,6 +374,8 @@ final class ApiController extends Controller
|
|||
$expense->type = new NullBaseStringL11nType((int) $request->getDataInt('type'));
|
||||
$expense->status = ExpenseStatus::tryFromValue($request->getDataInt('status')) ?? ExpenseStatus::DRAFT;
|
||||
$expense->description = $request->getDataString('description') ?? '';
|
||||
$expense->start = $request->getDataDateTime('start') ?? $expense->start;
|
||||
$expense->end = $request->getDataDateTime('end') ?? $expense->end;
|
||||
|
||||
$country = $request->getDataString('country') ?? '';
|
||||
if (empty($country)) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\BusinessExpenses\Controller;
|
||||
|
||||
use Modules\BusinessExpenses\Models\ExpenseElementMapper;
|
||||
use Modules\BusinessExpenses\Models\ExpenseElementTypeMapper;
|
||||
use Modules\BusinessExpenses\Models\ExpenseMapper;
|
||||
use Modules\BusinessExpenses\Models\ExpenseTypeMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
|
|
@ -86,6 +88,7 @@ final class BackendController extends Controller
|
|||
->with('elements/type')
|
||||
->with('elements/type/l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('elements/type/l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['expense-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
||||
|
|
@ -93,6 +96,41 @@ final class BackendController extends Controller
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface Returns a renderable object
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewBusinessExpensesElement(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/BusinessExpenses/Theme/Backend/element-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001001001, $request, $response);
|
||||
|
||||
$view->data['element'] = ExpenseElementMapper::get()
|
||||
->with('notes')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$view->data['types'] = ExpenseElementTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['expense-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
||||
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
|
|
@ -121,7 +159,32 @@ final class BackendController extends Controller
|
|||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$view->data['expense-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface Returns a renderable object
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewBusinessExpensesElementCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/BusinessExpenses/Theme/Backend/element-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001001001, $request, $response);
|
||||
|
||||
$view->data['types'] = ExpenseElementTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'BusinessExpenses' => '',
|
||||
]];
|
||||
|
|
@ -21,17 +21,22 @@ return ['BusinessExpenses' => [
|
|||
'CreatedAt' => 'Erstellt',
|
||||
'Description' => 'Beschreibung',
|
||||
'End' => 'Ende',
|
||||
'Element' => 'Element',
|
||||
'Expenses' => 'Kosten',
|
||||
'From' => 'Von',
|
||||
'Gross' => 'Brutto',
|
||||
'Back' => 'Zurück',
|
||||
'Files' => 'Dateien',
|
||||
'Net' => 'Netto',
|
||||
'Notes' => 'Notizen',
|
||||
'Paid' => 'Bezahlt',
|
||||
'Report' => 'Bericht',
|
||||
'Total' => 'Gesamt',
|
||||
'Start' => 'Start',
|
||||
'Status' => 'Status',
|
||||
'Overview' => 'Übersicht',
|
||||
'Clocking' => 'Zeiterfassung',
|
||||
'Type' => 'Typ',
|
||||
'Costs' => 'Kosten',
|
||||
'Upload' => 'Hochladen',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -21,17 +21,22 @@ return ['BusinessExpenses' => [
|
|||
'CreatedAt' => 'Created At',
|
||||
'Description' => 'Description',
|
||||
'End' => 'End',
|
||||
'Element' => 'Element',
|
||||
'Expenses' => 'Expenses',
|
||||
'From' => 'From',
|
||||
'Gross' => 'Gross',
|
||||
'Files' => 'Files',
|
||||
'Back' => 'Back',
|
||||
'Net' => 'Net',
|
||||
'Notes' => 'Notes',
|
||||
'Paid' => 'Paid',
|
||||
'Report' => 'Report',
|
||||
'Total' => 'Total',
|
||||
'Start' => 'Start',
|
||||
'Status' => 'Status',
|
||||
'Overview' => 'Overview',
|
||||
'Clocking' => 'Clocking',
|
||||
'Type' => 'Type',
|
||||
'Costs' => 'Costs',
|
||||
'Upload' => 'Upload',
|
||||
]];
|
||||
|
|
|
|||
108
Theme/Backend/element-view.tpl.php
Normal file
108
Theme/Backend/element-view.tpl.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?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);
|
||||
|
||||
use Modules\BusinessExpenses\Models\NullExpense;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$element = $this->data['element'] ?? new NullExpense();
|
||||
$isNew = $element->id === 0;
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="tabview tab-2">
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Element'); ?></label>
|
||||
<li><label for="c-tab-2"><?= $this->getHtml('Files'); ?></label>
|
||||
<!--
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Entries'); ?></label>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-6">
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="box">
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build('{/base}/businessexpenses/expense/view?id=' . $element->expense); ?>"><?= $this->getHtml('Back'); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<section class="portlet">
|
||||
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}businessexpenses/expense/element?csrf={$CSRF}'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('Element'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" id="iId" name="id" value="<?= $element->id; ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iType"><?= $this->getHtml('Type'); ?></label>
|
||||
<select id="iType" name="type">
|
||||
<option value=""<?= $isNew ? ' selected' : ''; ?>>
|
||||
<?php
|
||||
foreach ($this->data['types'] as $type) : ?>
|
||||
<option value="<?= $type->id; ?>"<?= $element->type->id === $type->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<pre id="iDescription" class="textarea contenteditable" name="description" contenteditable="true"><?= $this->printHtml($element->description); ?></pre>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($element->start->format('Y-m-d\TH:i:s')); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEnd"><?= $this->getHtml('End'); ?></label>
|
||||
<input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($element->end->format('Y-m-d\TH:i:s')); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCosts"><?= $this->getHtml('Costs'); ?></label>
|
||||
<input type="number" id="iCosts" name="gross" step="any" value="<?= $element->gross->getNormalizedValue(); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($isNew) : ?>
|
||||
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
<?php else : ?>
|
||||
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<input type="radio" id="c-tab-2" name="tabular-2" checked>
|
||||
<div class="tab col-simple">
|
||||
<div class="col-xs-12">
|
||||
<?= $this->data['media-upload']->render('item-file', 'files', '', $element->files); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -14,14 +14,20 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Modules\BusinessExpenses\Models\NullExpense;
|
||||
use Modules\BusinessExpenses\Models\NullExpenseElement;
|
||||
use phpOMS\Stdlib\Base\FloatInt;
|
||||
use phpOMS\Stdlib\Base\SmartDateTime;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$expense = $this->getData('expense') ?? new NullExpense();
|
||||
$expense = $this->data['expense'] ?? new NullExpense();
|
||||
$sessions = $this->data['sessions'] ?? [];
|
||||
|
||||
$isNew = $expense->id === 0;
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="tabview tab-2">
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Overview'); ?></label>
|
||||
|
|
@ -30,8 +36,9 @@ echo $this->data['nav']->render(); ?>
|
|||
<li><label for="c-tab-4"><?= $this->getHtml('Clocking'); ?></label>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<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="row">
|
||||
<div class="col-xs-12 col-lg-6">
|
||||
|
|
@ -64,6 +71,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}businessexpenses/expense?csrf={$CSRF}'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('Report'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
|
|
@ -88,15 +96,23 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<div class="form-group">
|
||||
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<textarea id="iDescription" name="description"><?= $this->printHtml($expense->description); ?></textarea>
|
||||
<textarea id="iDescription" name="description"><?= $this->printTextarea($expense->description); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot"></div>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($isNew) : ?>
|
||||
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
<?php else : ?>
|
||||
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<?= $this->data['expense-notes']->render('expense-notes', '', $expense->notes); ?>
|
||||
|
|
@ -104,6 +120,23 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<?php
|
||||
$costs = [
|
||||
'total' => new FloatInt(),
|
||||
'week' => new FloatInt(),
|
||||
'day' => new FloatInt(),
|
||||
];
|
||||
|
||||
$elements = $expense->elements;
|
||||
|
||||
$current = SmartDateTime::createFromDateTime($expense->start);
|
||||
$current->smartModify(0, 0, -1);
|
||||
|
||||
$end = clone $expense->end;
|
||||
$element = empty($elements)
|
||||
? new NullExpenseElement()
|
||||
: \reset($elements);
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
|
|
@ -119,33 +152,47 @@ echo $this->data['nav']->render(); ?>
|
|||
<table id="iExpenseList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<label for="iExpenseList-sort-1">
|
||||
<input type="radio" name="iExpenseList-sort" id="iExpenseList-sort-1">
|
||||
<i class="sort-asc g-icon">expand_less</i>
|
||||
</label>
|
||||
<label for="iExpenseList-sort-2">
|
||||
<input type="radio" name="iExpenseList-sort" id="iExpenseList-sort-2">
|
||||
<i class="sort-desc g-icon">expand_more</i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter g-icon">filter_alt</i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('Start'); ?>
|
||||
<td><?= $this->getHtml('End'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Type'); ?>
|
||||
<td><?= $this->getHtml('Costs'); ?>
|
||||
<tbody>
|
||||
<?php foreach ($expense->elements as $element) :
|
||||
<?php
|
||||
while ($current->format('Y-m-d') !== $end->format('Y-m-d')) :
|
||||
$current->smartModify(0, 0, 1);
|
||||
|
||||
if ($element->id !== 0 && $element->start->format('Y-m-d') === $current->format('Y-m-d')) :
|
||||
$url = UriFactory::build('{/base}/businessexpenses/expense/element/view?{?}&id=' . $element->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td><a href="<?= $url; ?>"><?= $element->id; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $element->start->format('Y-m-d H:i'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $element->end?->format('Y-m-d H:i'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($element->type->l11n); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $element->start->format('Y-m-d H:i'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $element->end?->format('Y-m-d H:i'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($element->type->l11n); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->getCurrency($element->gross, symbol: ''); ?></a>
|
||||
<?php
|
||||
$costs['total']->add($element->gross->value);
|
||||
$costs['week']->add($element->gross->value);
|
||||
$costs['day']->add($element->gross->value);
|
||||
|
||||
$element = \next($elements);
|
||||
if ($element === false) {
|
||||
$element = new NullExpenseElement();
|
||||
}
|
||||
|
||||
// Required to handle multiple elements in one day
|
||||
if ($element->id !== 0 && $element->start->format('Y-m-d') === $current->format('Y-m-d')) {
|
||||
$current->smartModify(0, 0, -1);
|
||||
}
|
||||
?>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td class="disabled"><?= $current->format('Y-m-d'); ?>
|
||||
<td colspan="3" class="empty">
|
||||
<?php endif; ?>
|
||||
<?php endwhile; ?>
|
||||
<tr class="hl-3">
|
||||
<td colspan="3"><?= $this->getHtml('Total'); ?>
|
||||
<td><?= $costs['total']->getAmount(); ?>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -275,10 +322,10 @@ echo $this->data['nav']->render(); ?>
|
|||
<th colspan="6"> <?= $startWeek->format('Y/m/d'); ?> - <?= $endWeek->format('Y/m/d'); ?>
|
||||
<th><?= (int) ($busy['week'] / 3600); ?>h <?= ((int) ($busy['week'] / 60) % 60); ?>m
|
||||
<?php
|
||||
$endWeek = $startWeek;
|
||||
$startWeek = $startWeek->createModify(0, 0, -7);
|
||||
$busy['week'] = 0;
|
||||
endif;
|
||||
$endWeek = $startWeek;
|
||||
$startWeek = $startWeek->createModify(0, 0, -7);
|
||||
$busy['week'] = 0;
|
||||
endif;
|
||||
?>
|
||||
<?php
|
||||
$busy['month'] += $session->busy;
|
||||
|
|
@ -289,10 +336,10 @@ echo $this->data['nav']->render(); ?>
|
|||
<th colspan="6"> <?= $startMonth->format('Y/m/d'); ?> - <?= $endMonth->format('Y/m/d'); ?>
|
||||
<th><?= (int) ($busy['month'] / 3600); ?>h <?= ((int) ($busy['month'] / 60) % 60); ?>m
|
||||
<?php
|
||||
$endMonth = $startMonth;
|
||||
$startMonth = $startMonth->createModify(0, -1, 0);
|
||||
$busy['month'] = 0;
|
||||
endif;
|
||||
$endMonth = $startMonth;
|
||||
$startMonth = $startMonth->createModify(0, -1, 0);
|
||||
$busy['month'] = 0;
|
||||
endif;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
|
|
@ -304,5 +351,6 @@ echo $this->data['nav']->render(); ?>
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user