mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-01-10 17:18:41 +00:00
fix templates
This commit is contained in:
parent
8cef004fa3
commit
2c3551854c
|
|
@ -14,8 +14,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\Attribute\Models\NullAttributeType;
|
||||
use Modules\Attribute\Models\NullAttributeValue;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeTypeL11nMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeTypeMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeValueL11nMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeValueMapper;
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11nMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
|
|
@ -90,7 +96,7 @@ final class BackendController extends Controller
|
|||
$view->data['types'] = ContractTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->limit(25)
|
||||
->limit(50)
|
||||
->paginate(
|
||||
'id',
|
||||
$request->getDataString('ptype') ?? '',
|
||||
|
|
@ -119,13 +125,65 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-type');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$type = ContractTypeMapper::get()
|
||||
$view->data['type'] = ContractTypeMapper::get()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$view->data['type'] = $type;
|
||||
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
|
||||
$view->data['l11nValues'] = ContractTypeL11nMapper::getAll()
|
||||
->where('ref', $view->data['type']->id)
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 viewContractTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-type');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $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
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewContractCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$view->data['contractTypes'] = ContractTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -192,4 +250,149 @@ 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
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewContractManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response);
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$view->attributes = ContractAttributeTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
$view->path = 'contract';
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 viewContractManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$view->attribute = ContractAttributeTypeMapper::get()
|
||||
->with('l11n')
|
||||
->with('defaults')
|
||||
->with('defaults/l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->where('defaults/l11n/language', [$response->header->l11n->language, null])
|
||||
->execute();
|
||||
|
||||
$view->l11ns = ContractAttributeTypeL11nMapper::getAll()
|
||||
->where('ref', $view->attribute->id)
|
||||
->executeGetArray();
|
||||
|
||||
$view->path = 'contract';
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 viewContractManagementAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$view->attribute = new NullAttributeType();
|
||||
|
||||
$view->path = 'contract';
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 viewContractManagementAttributeValueCreate(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(1007901001, $request, $response);
|
||||
|
||||
$view->type = ContractAttributeTypeMapper::get()->where('id', (int) $request->getData('type'))->execute();
|
||||
$view->attribute = new NullAttributeValue();
|
||||
|
||||
$view->path = 'contract';
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 viewContractManagementAttributeValue(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(1004802001, $request, $response);
|
||||
|
||||
$view->type = ContractAttributeTypeMapper::get()->where('id', (int) $request->getData('type'))->execute();
|
||||
|
||||
$view->attribute = ContractAttributeValueMapper::get()
|
||||
->with('l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('l11n/language', [$response->header->l11n->language, null])
|
||||
->execute();
|
||||
|
||||
$view->l11ns = ContractAttributeValueL11nMapper::getAll()
|
||||
->where('ref', $view->attribute->id)
|
||||
->executeGetArray();
|
||||
|
||||
// @todo Also find the ContractAttributeType
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ return ['ContractManagement' => [
|
|||
'End' => 'Ende',
|
||||
'Files' => 'Dateien',
|
||||
'Name' => 'Name',
|
||||
'ContractType' => 'Vertragsart',
|
||||
'Overview' => 'Übersicht',
|
||||
'Parties' => 'Parteien',
|
||||
'Start' => 'Start',
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ return ['ContractManagement' => [
|
|||
'Description' => 'Description',
|
||||
'End' => 'End',
|
||||
'Files' => 'Files',
|
||||
'Name' => '',
|
||||
'Name' => 'Name',
|
||||
'ContractType' => 'Contract Type',
|
||||
'Overview' => 'Overview',
|
||||
'Parties' => 'Parties',
|
||||
'Start' => 'Start',
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Contracts'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="contractList" class="default sticky">
|
||||
|
|
@ -105,6 +105,6 @@ echo $this->data['nav']->render(); ?>
|
|||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Localization\NullBaseStringL11nType;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Localization\BaseStringL11nType */
|
||||
$type = $this->data['type'] ?? new NullBaseStringL11nType();
|
||||
$isNew = $type->id === 0;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<form id="materialForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}contract/type?csrf={$CSRF}'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('ContractType'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" name="code" id="iName" value="<?= $this->printHtml($type->title); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="portlet-foot">
|
||||
<input type="hidden" name="id" value="<?= $type->id; ?>">
|
||||
<?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>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="row">
|
||||
<?= $this->data['l11nView']->render(
|
||||
$this->data['l11nValues'],
|
||||
[],
|
||||
'{/api}contract/type/l11n?csrf={$CSRF}'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
@ -12,17 +12,20 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\ContractManagement\Models\NullContract;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract $contract
|
||||
*/
|
||||
$contract = $this->data['contract'];
|
||||
$contract = $this->data['contract'] ?? new NullContract();
|
||||
$isNew = $contract->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>
|
||||
|
|
@ -32,8 +35,9 @@ echo $this->data['nav']->render(); ?>
|
|||
<li><label for="c-tab-5"><?= $this->getHtml('Parties'); ?></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-md-6">
|
||||
|
|
@ -56,7 +60,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<?php
|
||||
$types = $this->data['contractTypes'] ?? [];
|
||||
foreach ($types as $type) : ?>
|
||||
<option value="<?= $type->id; ?>" <?= $type->id === $contract->type->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
|
||||
<option value="<?= $type->id; ?>" <?= $type->id === $contract->type?->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -68,12 +72,12 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<div class="form-group">
|
||||
<label for="iStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($contract->start->format('Y-m-d\TH:i:s')); ?>">
|
||||
<input type="datetime-local" id="iStart" name="start" value="<?= $contract->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($contract->end->format('Y-m-d\TH:i:s')); ?>">
|
||||
<input type="datetime-local" id="iEnd" name="end" value="<?= $contract->end?->format('Y-m-d\TH:i:s'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -114,6 +118,7 @@ echo $this->data['nav']->render(); ?>
|
|||
</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 col-simple">
|
||||
<?= $this->data['media-upload']->render('contract-file', 'files', '', $contract->files); ?>
|
||||
|
|
@ -142,7 +147,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Contracts'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="contractList" class="default sticky">
|
||||
|
|
@ -213,9 +218,10 @@ echo $this->data['nav']->render(); ?>
|
|||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user