mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-01-11 17:48:40 +00:00
style fixes, bug fixes
This commit is contained in:
parent
e2f4de99f2
commit
f40ad93760
|
|
@ -15,7 +15,8 @@ declare(strict_types=1);
|
|||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeL11n;
|
||||
use Modules\ContractManagement\Models\ContractTypeMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
|
@ -53,17 +54,21 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response));
|
||||
|
||||
$mapper = ContractMapper::getAll()
|
||||
->with('account')
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->setData('contracts',
|
||||
ContractMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '<')->limit(25)->execute()
|
||||
$mapper->where('id', $request->getDataInt('id') ?? 0, '<')->execute()
|
||||
);
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->setData('contracts',
|
||||
ContractMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '>')->limit(25)->execute()
|
||||
$mapper->where('id', $request->getDataInt('id') ?? 0, '>')->execute()
|
||||
);
|
||||
} else {
|
||||
$view->setData('contracts',
|
||||
ContractMapper::getAll()->where('id', 0, '>')->limit(25)->execute()
|
||||
$mapper->where('id', 0, '>')->execute()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +94,23 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-single');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response));
|
||||
|
||||
$view->addData('contract', ContractMapper::get()->where('id', (int) $request->getData('id'))->execute());
|
||||
$contract = ContractMapper::get()
|
||||
->with('account')
|
||||
->with('files')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->sort('files/id', 'DESC')
|
||||
->execute();
|
||||
$view->addData('contract', $contract);
|
||||
|
||||
$contractTypes = ContractTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->getLanguage())
|
||||
->execute();
|
||||
$view->setData('contractTypes', $contractTypes);
|
||||
|
||||
$units = UnitMapper::getAll()
|
||||
->execute();
|
||||
$view->setData('units', $units);
|
||||
|
||||
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
|
||||
$view->addData('editor', $editor);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,13 @@ class Contract
|
|||
|
||||
public string $description = '';
|
||||
|
||||
// The original start of the contract ignoring renewals
|
||||
public \DateTime $originalStart;
|
||||
|
||||
// Start of the contract considering renewals
|
||||
public ?\DateTime $start = null;
|
||||
|
||||
// End of the contract considering renewals
|
||||
public ?\DateTime $end = null;
|
||||
|
||||
/**
|
||||
|
|
@ -73,6 +78,7 @@ class Contract
|
|||
|
||||
public ?int $responsible = null;
|
||||
|
||||
// Contract with
|
||||
public Account $account;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,4 +20,11 @@ return ['ContractManagement' => [
|
|||
'Files' => 'Files',
|
||||
'Overview' => 'Overview',
|
||||
'Title' => 'Title',
|
||||
'With' => 'With',
|
||||
'Start' => 'Start',
|
||||
'Description' => 'Description',
|
||||
'AutoRenewal' => 'Auto Renewal',
|
||||
'Termination' => 'Termination',
|
||||
'Costs' => 'Costs',
|
||||
'Unit' => 'Unit',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Contracts'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||
<div class="portlet-head"><?= $this->getHtml('Contracts'); ?><i class="lni lni-download download btn end-xs"></i></div>
|
||||
<div class="slider">
|
||||
<table id="contractList" class="default sticky">
|
||||
<thead>
|
||||
|
|
@ -47,7 +47,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td class="wf-100"><?= $this->getHtml('Account'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('With'); ?>
|
||||
<label for="contractList-sort-3">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-3">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
|
|
|
|||
|
|
@ -12,31 +12,114 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract $contract
|
||||
*/
|
||||
$contract = $this->getData('contract');
|
||||
$contractFile = $contract->getFiles();
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="tabview tab-2">
|
||||
<div class="box wf-100 col-xs-12">
|
||||
<div class="tabview tab-2 col-simple">
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Overview'); ?></label></li>
|
||||
<li><label for="c-tab-2"><?= $this->getHtml('Files'); ?></label></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<div class="tab-content col-simple">
|
||||
<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 cold-sm-6 col-md-4">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Contract'); ?></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="<?= $contract->id; ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iTitle"><?= $this->getHtml('Title'); ?></label>
|
||||
<input type="text" id="iTitle" name="title" value="<?= $this->printHtml($contract->title); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iType"><?= $this->getHtml('Type'); ?></label>
|
||||
<select id="iType" name="type" data-tpl-text="/type" data-tpl-value="/type">
|
||||
<?php
|
||||
$types = $this->getData('contractTypes') ?? [];
|
||||
foreach ($types as $type) : ?>
|
||||
<option value="<?= $type->id; ?>" <?= $type->id === $contract->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($contract->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($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')); ?>">
|
||||
</div>
|
||||
|
||||
<label class="checkbox" for="iAutoRenewal">
|
||||
<input id="iAutoRenewal" type="checkbox" name="auto_renewal" value="1"<?= $contract->autoRenewal ? ' checked' : ''; ?>>
|
||||
<span class="checkmark"></span>
|
||||
<?= $this->getHtml('AutoRenewal'); ?>
|
||||
</label>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iTermination"><?= $this->getHtml('Termination'); ?></label>
|
||||
<input type="number" min="0" step="1" id="iTermination" name="termination" value="<?= $this->printHtml((string) $contract->renewal); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCosts"><?= $this->getHtml('Costs'); ?></label>
|
||||
<input type="number" id="iCosts" name="Costs" value="<?= $contract->costs === null ? '0' : $this->getCurrency($contract->costs, symbol: ''); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iUnit"><?= $this->getHtml('Unit'); ?></label>
|
||||
<select id="iUnit" name="unit">
|
||||
<option value="">
|
||||
<?php
|
||||
$units = $this->getData('units') ?? [];
|
||||
foreach ($units as $unit) : ?>
|
||||
<option value="<?= $unit->id; ?>"<?= $contract->unit->id === $unit->id ? ' selected' : ''; ?>><?= $this->printHtml($unit->name); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</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="tab col-simple">
|
||||
<div class="col-simple">
|
||||
<div class="col-xs-12 col-simple">
|
||||
<section id="mediaFile" class="portlet col-simple">
|
||||
<div class="portlet-body col-simple">
|
||||
<iframe class="col-simple" id="iContractFile" src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}media/export?id=' . \end($contractFile)->id)); ?>" loading="lazy" allowfullscreen></iframe>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user