From e6943559d0f8813f7cf88605c8bd2fadfdd62b76 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Jan 2024 23:34:19 +0000 Subject: [PATCH] update --- .../Shop/Controller/AppController.php | 14 +++++++------- Admin/Settings/Theme/Backend/settings.tpl.php | 4 ++-- Controller/BackendController.php | 16 +++++++++------- Models/PermissionCategory.php | 2 +- Models/TicketMapper.php | 15 +++++++++++++++ Theme/Backend/Lang/ar.lang.php | 2 +- Theme/Backend/Lang/de.lang.php | 3 +++ Theme/Backend/Lang/en.lang.php | 3 +++ Theme/Backend/support-list.tpl.php | 15 ++++++++------- Theme/Backend/support-ticket.tpl.php | 2 +- tests/Models/TicketTest.php | 1 - 11 files changed, 50 insertions(+), 27 deletions(-) diff --git a/Admin/Install/Application/Shop/Controller/AppController.php b/Admin/Install/Application/Shop/Controller/AppController.php index 13c1270..b30f08a 100755 --- a/Admin/Install/Application/Shop/Controller/AppController.php +++ b/Admin/Install/Application/Shop/Controller/AppController.php @@ -47,7 +47,7 @@ final class AppController extends ModuleAbstract protected static array $dependencies = []; /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -67,7 +67,7 @@ final class AppController extends ModuleAbstract } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -87,7 +87,7 @@ final class AppController extends ModuleAbstract } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -107,7 +107,7 @@ final class AppController extends ModuleAbstract } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -127,7 +127,7 @@ final class AppController extends ModuleAbstract } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -147,7 +147,7 @@ final class AppController extends ModuleAbstract } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -167,7 +167,7 @@ final class AppController extends ModuleAbstract } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response diff --git a/Admin/Settings/Theme/Backend/settings.tpl.php b/Admin/Settings/Theme/Backend/settings.tpl.php index ef210f6..76fabca 100755 --- a/Admin/Settings/Theme/Backend/settings.tpl.php +++ b/Admin/Settings/Theme/Backend/settings.tpl.php @@ -22,8 +22,8 @@ echo $this->data['nav']->render(); ?>
diff --git a/Controller/BackendController.php b/Controller/BackendController.php index dc0a1f6..ef48779 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -36,7 +36,7 @@ use phpOMS\Views\View; final class BackendController extends Controller { /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -53,7 +53,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -88,11 +88,13 @@ final class BackendController extends Controller $view->data['tickets'] = $mapperQuery->where('id', 0, '>')->execute(); } + $view->data['stats'] = TicketMapper::getStatOverview($request->header->account); + return $view; } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -141,7 +143,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -162,7 +164,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -183,7 +185,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -204,7 +206,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index 48edd41..e9f1bf0 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -17,7 +17,7 @@ namespace Modules\Support\Models; use phpOMS\Stdlib\Base\Enum; /** - * Permision state enum. + * Permission category enum. * * @package Modules\Support\Models * @license OMS License 2.0 diff --git a/Models/TicketMapper.php b/Models/TicketMapper.php index 268bd91..1305156 100755 --- a/Models/TicketMapper.php +++ b/Models/TicketMapper.php @@ -16,7 +16,9 @@ namespace Modules\Support\Models; use Modules\Admin\Models\AccountMapper; use Modules\Tasks\Models\TaskMapper; +use Modules\Tasks\Models\TaskStatus; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; +use phpOMS\Stdlib\Base\SmartDateTime; /** * Mapper class. @@ -104,4 +106,17 @@ final class TicketMapper extends DataMapperFactory * @since 1.0.0 */ public const PRIMARYFIELD = 'support_ticket_id'; + + public static function getStatOverview(int $account) : array + { + $start = SmartDateTime::startOfMonth(); + + return [ + 'total' => TicketMapper::count()->with('task')->where('task/createdAt', $start, '>=')->execute(), + 'unassigned' => TicketMapper::count()->with('task')->where('for', null)->execute(), + 'open' => TicketMapper::count()->with('task')->where('task/status', TaskStatus::OPEN)->execute(), + 'closed' => TicketMapper::count()->with('task')->where('task/createdAt', $start, '>=')->where('task/status', TaskStatus::DONE)->where('task/status', TaskStatus::CANCELED, '=', 'OR')->where('task/status', TaskStatus::SUSPENDED, '=', 'OR')->execute(), + 'inprogress' => TicketMapper::count()->with('task')->where('task/status', TaskStatus::WORKING)->execute(), + ]; + } } diff --git a/Theme/Backend/Lang/ar.lang.php b/Theme/Backend/Lang/ar.lang.php index 93cb5fa..22bbc13 100755 --- a/Theme/Backend/Lang/ar.lang.php +++ b/Theme/Backend/Lang/ar.lang.php @@ -16,7 +16,7 @@ return ['Support' => [ 'Account' => 'الحساب', 'All' => 'الجميع', 'Assigned' => '', - 'AverageAmount' => 'متوسط ​​المبلغ', + 'AverageAmount' => "متوسط \u{200b}\u{200b}المبلغ", 'AverageProcessTime' => 'avg. وقت المعالجة', 'Closed' => '', 'Completion' => '', diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index b796a99..116525c 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -49,6 +49,7 @@ return ['Support' => [ 'Settings' => 'Einstellungen', 'Size' => 'Größe', 'Statistics' => 'Statistiken', + 'Stats' => 'Stats', 'Status' => 'Status', 'Support' => 'Unterstützung', 'Ticket' => 'Fahrkarte', @@ -63,4 +64,6 @@ return ['Support' => [ 'Upload' => 'Hochladen', 'Week' => 'Woche', 'Year' => 'Jahr', + 'Total' => 'Gesamt', + 'InProgress' => 'In Bearbeitung', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 160656f..09d276f 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -49,6 +49,7 @@ return ['Support' => [ 'Settings' => 'Settings', 'Size' => 'Size', 'Statistics' => 'Statistics', + 'Stats' => 'Stats', 'Status' => 'Status', 'Support' => 'Support', 'Ticket' => 'Ticket', @@ -63,4 +64,6 @@ return ['Support' => [ 'Upload' => 'Upload', 'Week' => 'Week', 'Year' => 'Year', + 'Total' => 'Total', + 'InProgress' => 'In Progress', ]]; diff --git a/Theme/Backend/support-list.tpl.php b/Theme/Backend/support-list.tpl.php index 9b45aa5..536f6c0 100755 --- a/Theme/Backend/support-list.tpl.php +++ b/Theme/Backend/support-list.tpl.php @@ -62,6 +62,7 @@ echo $this->data['nav']->render(); ?>
+
-
getHtml('Settings'); ?>
+
getHtml('Stats'); ?>
-
getHtml('All'); ?>0 -
getHtml('Unassigned'); ?>0 -
getHtml('Open'); ?>0 -
getHtml('Unsolved'); ?>0 -
getHtml('Closed'); ?>0 -
getHtml('InTime'); ?>0 +
getHtml('Unassigned'); ?>data['stats']['unassigned']; ?> +
getHtml('Open'); ?>data['stats']['open']; ?> +
getHtml('InProgress'); ?>data['stats']['inprogress']; ?> +
getHtml('Closed'); ?>data['stats']['closed']; ?> +
getHtml('Total'); ?>data['stats']['total']; ?>
diff --git a/Theme/Backend/support-ticket.tpl.php b/Theme/Backend/support-ticket.tpl.php index 7d7c433..d7e8f7d 100755 --- a/Theme/Backend/support-ticket.tpl.php +++ b/Theme/Backend/support-ticket.tpl.php @@ -383,7 +383,7 @@ echo $this->data['nav']->render(); ?>
-
+
diff --git a/tests/Models/TicketTest.php b/tests/Models/TicketTest.php index d1040b3..c59243a 100755 --- a/tests/Models/TicketTest.php +++ b/tests/Models/TicketTest.php @@ -15,7 +15,6 @@ declare(strict_types=1); namespace Modules\Support\tests\Models; use Modules\Support\Models\Ticket; -use Modules\Support\Models\TicketAttribute; use Modules\Support\Models\TicketElement; /**