This commit is contained in:
Dennis Eichhorn 2024-01-30 21:29:20 +00:00
parent 8106743eec
commit e4ae941cea
6 changed files with 51 additions and 10 deletions

View File

@ -42,6 +42,21 @@
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1007901001,
"children": []
},
{
"id": 1007903001,
"pid": "/contract",
"type": 3,
"subtype": 1,
"name": "Attributes",
"uri": "{/base}/contract/attribute/list?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "Kanban",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1007901001,
"children": []
}
]
}

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Modules\ContractManagement\Controller;
use Modules\ContractManagement\Models\Attribute\ContractAttributeTypeMapper;
use Modules\ContractManagement\Models\ContractMapper;
use Modules\ContractManagement\Models\ContractTypeMapper;
use Modules\Organization\Models\UnitMapper;
@ -153,32 +154,40 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
$contract = ContractMapper::get()
$view->data['contract'] = ContractMapper::get()
->with('account')
->with('attributes')
->with('attributes/type')
->with('attributes/value')
->with('attributes/type/l11n')
->with('files')
->with('notes')
->where('id', (int) $request->getData('id'))
->where('attributes/type/l11n/language', $response->header->l11n->language)
->sort('files/id', 'DESC')
->execute();
$view->data['contract'] = $contract;
$contractTypes = ContractTypeMapper::getAll()
$view->data['contractTypes'] = ContractTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['contractTypes'] = $contractTypes;
$units = UnitMapper::getAll()
$view->data['units'] = UnitMapper::getAll()
->execute();
$view->data['units'] = $units;
/** @var \Modules\Attribute\Models\AttributeType[] */
$view->data['attributeTypes'] = ContractAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['editor'] = new \Modules\Editor\Theme\Backend\Components\Editor\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['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
return $view;
}
}

View File

@ -52,11 +52,11 @@ final class ContractAttributeMapper extends DataMapperFactory
public const OWNS_ONE = [
'type' => [
'mapper' => ContractAttributeTypeMapper::class,
'external' => 'contractmgmt_attr_type',
'external' => 'contractmgmt_contract_attr_type',
],
'value' => [
'mapper' => ContractAttributeValueMapper::class,
'external' => 'contractmgmt_attr_value',
'external' => 'contractmgmt_contract_attr_value',
],
];

View File

@ -13,6 +13,7 @@
declare(strict_types=1);
return ['Navigation' => [
'Attributes' => 'Attribute',
'Contract' => 'Vertrag',
'ContractTypes' => 'Vertragsarten',
'Contracts' => 'Verträge',

View File

@ -13,6 +13,7 @@
declare(strict_types=1);
return ['Navigation' => [
'Attributes' => 'Attributes',
'Contract' => 'Contract',
'ContractTypes' => 'Types',
'Contracts' => 'Contracts',

View File

@ -26,6 +26,7 @@ echo $this->data['nav']->render(); ?>
<li><label for="c-tab-1"><?= $this->getHtml('Overview'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Files'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Notes', 'Editor', 'Backend'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('Attributes', 'Attribute', 'Backend'); ?></label>
<!-- if parrent contract show all parties that use this template/parent contract (e.g. show all customers who have this contract)
<li><label for="c-tab-4"><?= $this->getHtml('Parties'); ?></label>
-->
@ -122,5 +123,19 @@ echo $this->data['nav']->render(); ?>
<div class="tab col-simple">
<?= $this->data['note']->render('contract-note', 'notes', $contract->notes); ?>
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab col-simple">
<div class="row">
<?= $this->data['attributeView']->render(
$contract->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
'{/api}contract/attribute',
$contract->id
);
?>
</div>
</div>
</div>
</div>