template fixes + bug fixes + style fixes

This commit is contained in:
Dennis Eichhorn 2024-04-02 21:40:48 +00:00
parent 54d838e01a
commit 8329c8e773
5 changed files with 72 additions and 212 deletions

View File

@ -94,21 +94,5 @@
] ]
} }
] ]
},
{
"id": 1002902001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Support",
"uri": "{/base}/private/support/dashboard?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "Support",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003401001,
"children": [
]
} }
] ]

View File

@ -73,15 +73,4 @@ return [
], ],
], ],
], ],
'^/private/support/dashboard(\?.*$|$)' => [
[
'dest' => '\Modules\Support\Controller\BackendController:viewPrivateSupportDashboard',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DASHBOARD,
],
],
],
]; ];

View File

@ -82,7 +82,8 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Support/Theme/Backend/support-list'); $view->setTemplate('/Modules/Support/Theme/Backend/support-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
$mapperQuery = TicketMapper::getAll() // @todo Use ticket implementation "getAnyRelatedToUser($request->header->account)
$mapperQuery = TicketMapper::getAnyRelatedToUser($request->header->account)
->with('task') ->with('task')
->with('task/createdBy') ->with('task/createdBy')
->with('task/for') ->with('task/for')
@ -90,18 +91,40 @@ final class BackendController extends Controller
->with('task/taskElements/accRelation') ->with('task/taskElements/accRelation')
->with('task/taskElements/accRelation/relation') ->with('task/taskElements/accRelation/relation')
->with('app') ->with('app')
->sort('task/createdAt', OrderType::DESC)
->limit(25); ->limit(25);
if ($request->getData('ptype') === 'p') { if ($request->getData('ptype') === 'p') {
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<'); $mapperQuery->where('id', $request->getDataInt('offset') ?? 0, '<');
} elseif ($request->getData('ptype') === 'n') { } elseif ($request->getData('ptype') === 'n') {
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>'); $mapperQuery->where('id', $request->getDataInt('offset') ?? 0, '>');
} else { } else {
$mapperQuery->where('id', 0, '>'); $mapperQuery->where('id', 0, '>');
} }
$view->data['tickets'] = $mapperQuery->execute(); $view->data['tickets'] = $mapperQuery->execute();
$openQuery = new Builder($this->app->dbPool->get(), true);
$openQuery->innerJoin(TaskMapper::TABLE, TaskMapper::TABLE . '_d2_task')
->on(TicketMapper::TABLE . '_d1.support_ticket_task', '=', TaskMapper::TABLE . '_d2_task.task_id')
->innerJoin(TaskElementMapper::TABLE)
->on(TaskMapper::TABLE . '_d2_task.' . TaskMapper::PRIMARYFIELD, '=', TaskElementMapper::TABLE . '.task_element_task')
->innerJoin(AccountRelationMapper::TABLE)
->on(TaskElementMapper::TABLE . '.' . TaskElementMapper::PRIMARYFIELD, '=', AccountRelationMapper::TABLE . '.task_account_task_element')
->andWhere(AccountRelationMapper::TABLE . '.task_account_account', '=', $request->header->account);
/** @var \Modules\Tasks\Models\Task[] $open */
$open = TicketMapper::getAll()
->with('task')
->with('task/createdBy')
->where('task/type', TaskType::TEMPLATE, '!=')
->where('task/status', TaskStatus::OPEN)
->sort('task/createdAt', OrderType::DESC)
->query($openQuery)
->executeGetArray();
$view->data['open'] = $open;
$view->data['stats'] = TicketMapper::getStatOverview(); $view->data['stats'] = TicketMapper::getStatOverview();
return $view; return $view;
@ -163,7 +186,7 @@ final class BackendController extends Controller
->sort('createdAt', OrderType::DESC) ->sort('createdAt', OrderType::DESC)
->offset(1) ->offset(1)
->limit(5) ->limit(5)
->execute(); ->executeGetArray();
$dt = new \DateTime(); $dt = new \DateTime();
@ -174,7 +197,7 @@ final class BackendController extends Controller
->where('end', $dt, '>=') // @todo consider to also allow $end === null ->where('end', $dt, '>=') // @todo consider to also allow $end === null
->sort('createdAt', OrderType::DESC) ->sort('createdAt', OrderType::DESC)
->limit(5) ->limit(5)
->execute(); ->executeGetArray();
} else { } else {
$view->data['contracts'] = []; $view->data['contracts'] = [];
} }
@ -245,73 +268,6 @@ final class BackendController extends Controller
return $view; 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 viewPrivateSupportDashboard(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$head = $response->data['Content']->head;
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/user-support-dashboard');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
// @todo Use ticket implementation "getAnyRelatedToUser($request->header->account)
$mapperQuery = TicketMapper::getAnyRelatedToUser($request->header->account)
->with('task')
->with('task/createdBy')
->with('task/for')
->with('task/taskElements')
->with('task/taskElements/accRelation')
->with('task/taskElements/accRelation/relation')
->with('app')
->sort('task/createdAt', OrderType::DESC)
->limit(25);
if ($request->getData('ptype') === 'p') {
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<');
} elseif ($request->getData('ptype') === 'n') {
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>');
} else {
$mapperQuery->where('id', 0, '>');
}
$view->data['tickets'] = $mapperQuery->execute();
$openQuery = new Builder($this->app->dbPool->get(), true);
$openQuery->innerJoin(TaskMapper::TABLE, TaskMapper::TABLE . '_d2_task')
->on(TicketMapper::TABLE . '_d1.support_ticket_task', '=', TaskMapper::TABLE . '_d2_task.task_id')
->innerJoin(TaskElementMapper::TABLE)
->on(TaskMapper::TABLE . '_d2_task.' . TaskMapper::PRIMARYFIELD, '=', TaskElementMapper::TABLE . '.task_element_task')
->innerJoin(AccountRelationMapper::TABLE)
->on(TaskElementMapper::TABLE . '.' . TaskElementMapper::PRIMARYFIELD, '=', AccountRelationMapper::TABLE . '.task_account_task_element')
->andWhere(AccountRelationMapper::TABLE . '.task_account_account', '=', $request->header->account);
/** @var \Modules\Tasks\Models\Task[] $open */
$open = TicketMapper::getAll()
->with('task')
->with('task/createdBy')
->where('task/type', TaskType::TEMPLATE, '!=')
->where('task/status', TaskStatus::OPEN)
->sort('task/createdAt', OrderType::DESC)
->query($openQuery)
->execute();
$view->data['open'] = $open;
return $view;
}
/** /**
* Method which generates the module profile view. * Method which generates the module profile view.
* *
@ -330,11 +286,11 @@ final class BackendController extends Controller
$id = $request->getDataString('id') ?? ''; $id = $request->getDataString('id') ?? '';
$settings = SettingMapper::getAll()->where('module', $id)->execute(); $settings = SettingMapper::getAll()->where('module', $id)->executeGetArray();
$view->data['settings'] = $settings; $view->data['settings'] = $settings;
/** @var \Modules\Support\Models\SupportApp[] $applications */ /** @var \Modules\Support\Models\SupportApp[] $applications */
$applications = SupportAppMapper::getAll()->execute(); $applications = SupportAppMapper::getAll()->executeGetArray();
$view->data['applications'] = $applications; $view->data['applications'] = $applications;
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings'); $view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings');

View File

@ -24,6 +24,47 @@ echo $this->data['nav']->render(); ?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-9"> <div class="col-xs-12 col-md-9">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Open'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<thead>
<td><?= $this->getHtml('Status'); ?>
<td><?= $this->getHtml('Priority'); ?>
<td class="full"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('Creator'); ?>
<td><?= $this->getHtml('Assigned'); ?>
<td><?= $this->getHtml('For'); ?>
<td><?= $this->getHtml('Created'); ?>
<tbody>
<?php
$c = 0;
foreach ($this->data['open'] as $key => $ticket) : ++$c;
$url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>">
<span class="tag <?= $this->printHtml('task-status-' . $ticket->task->status); ?>">
<?= $this->getHtml('S' . $ticket->task->status, 'Tasks'); ?>
</span></a>
<td><a href="<?= $url; ?>"><?= $this->getHtml('P' . $ticket->task->priority, 'Tasks'); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->task->title); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $ticket->task->createdBy->id); ?>"><?= $this->printHtml($ticket->task->createdBy->name1); ?> <?= $this->printHtml($ticket->task->createdBy->name2); ?></a>
<td><?php $responsibles = $ticket->task->getResponsible();
foreach ($responsibles as $responsible) : ?>
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $responsible->id); ?>">
<?= $this->printHtml($responsible->name1); ?> <?= $this->printHtml($responsible->name2); ?>
</a>
<?php endforeach; ?>
<td><a class="content"><?= $this->printHtml($ticket->task->for->name1); ?> <?= $this->printHtml($ticket->task->for->name2); ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->task->createdAt->format('Y-m-d H:i')); ?></a>
<?php endforeach; if ($c == 0) : ?>
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
<section class="portlet"> <section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Tickets'); ?><i class="g-icon download btn end-xs">download</i></div> <div class="portlet-head"><?= $this->getHtml('Tickets'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider"> <div class="slider">
@ -39,7 +80,7 @@ echo $this->data['nav']->render(); ?>
<tbody> <tbody>
<?php <?php
$c = 0; $c = 0;
foreach ($tickets as $key => $ticket) : ++$c; foreach ($this->data['tickets'] as $key => $ticket) : ++$c;
$url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->id); $url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">

View File

@ -1,110 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Support
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Open'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<thead>
<td><?= $this->getHtml('Status'); ?>
<td><?= $this->getHtml('Priority'); ?>
<td class="full"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('Creator'); ?>
<td><?= $this->getHtml('Assigned'); ?>
<td><?= $this->getHtml('For'); ?>
<td><?= $this->getHtml('Created'); ?>
<tbody>
<?php
$c = 0;
foreach ($this->data['open'] as $key => $ticket) : ++$c;
$url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>">
<span class="tag <?= $this->printHtml('task-status-' . $ticket->task->status); ?>">
<?= $this->getHtml('S' . $ticket->task->status, 'Tasks'); ?>
</span></a>
<td><a href="<?= $url; ?>"><?= $this->getHtml('P' . $ticket->task->priority, 'Tasks'); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->task->title); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $ticket->task->createdBy->id); ?>"><?= $this->printHtml($ticket->task->createdBy->name1); ?> <?= $this->printHtml($ticket->task->createdBy->name2); ?></a>
<td><?php $responsibles = $ticket->task->getResponsible();
foreach ($responsibles as $responsible) : ?>
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $responsible->id); ?>">
<?= $this->printHtml($responsible->name1); ?> <?= $this->printHtml($responsible->name2); ?>
</a>
<?php endforeach; ?>
<td><a class="content"><?= $this->printHtml($ticket->task->for->name1); ?> <?= $this->printHtml($ticket->task->for->name2); ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->task->createdAt->format('Y-m-d H:i')); ?></a>
<?php endforeach; if ($c == 0) : ?>
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Tickets'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<thead>
<td><?= $this->getHtml('Status'); ?>
<td><?= $this->getHtml('Priority'); ?>
<td class="full"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('Creator'); ?>
<td><?= $this->getHtml('Assigned'); ?>
<td><?= $this->getHtml('For'); ?>
<td><?= $this->getHtml('Created'); ?>
<tbody>
<?php
$c = 0;
foreach ($this->data['tickets'] as $key => $ticket) : ++$c;
$url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>">
<span class="tag <?= $this->printHtml('task-status-' . $ticket->task->status); ?>">
<?= $this->getHtml('S' . $ticket->task->status, 'Tasks'); ?>
</span></a>
<td><a href="<?= $url; ?>"><?= $this->getHtml('P' . $ticket->task->priority, 'Tasks'); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->task->title); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $ticket->task->createdBy->id); ?>"><?= $this->printHtml($ticket->task->createdBy->name1); ?> <?= $this->printHtml($ticket->task->createdBy->name2); ?></a>
<td><?php $responsibles = $ticket->task->getResponsible();
foreach ($responsibles as $responsible) : ?>
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $responsible->id); ?>">
<?= $this->printHtml($responsible->name1); ?> <?= $this->printHtml($responsible->name2); ?>
</a>
<?php endforeach; ?>
<td><a class="content"><?= $this->printHtml($ticket->task->for->name1); ?> <?= $this->printHtml($ticket->task->for->name2); ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($ticket->task->createdAt->format('Y-m-d H:i')); ?></a>
<?php endforeach; if ($c == 0) : ?>
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>