mirror of
https://github.com/Karaka-Management/oms-Support.git
synced 2026-01-10 16:48:41 +00:00
update
This commit is contained in:
parent
cbf1212b2b
commit
1ba2133d85
23
Admin/Install/Messages.install.json
Normal file
23
Admin/Install/Messages.install.json
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "email_template",
|
||||||
|
"from": "",
|
||||||
|
"to": "",
|
||||||
|
"cc": "",
|
||||||
|
"bcc": "",
|
||||||
|
"ishtml": true,
|
||||||
|
"l11n": {
|
||||||
|
"en": {
|
||||||
|
"subject": "Ticket Notification #{ticket_id}",
|
||||||
|
"body": "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Ticket Notification</title></head><body style=\"font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5;\"><div class=\"container\" style=\"max-width: 600px; margin: 20px auto; padding: 20px; background-color: #fff;\"><h1 style=\"color: #333;\">Ticket Notification</h1><p>Hello {use_name},</p><p>Your ticket has been [created/updated] successfully. Below are the details:</p><div class=\"ticket-details\" style=\"margin-top: 20px; padding: 10px; background-color: #f9f9f9; border-radius: 5px;\"><h2 style=\"color: #333;\">Ticket Information</h2><p><strong>Ticket ID:</strong> {ticket_id}</p><p><strong>Status:</strong> {ticket_status}</p><p><strong>Subject:</strong> {ticket_subject}</p></div><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058</p></td></tr></table></td></tr></table></body></html>",
|
||||||
|
"bodyalt": "Dear {user_name},\n\nYour ticket has been [created/updated] successfully. Below are the details:\n\nTicket ID: {ticket_id}\nStatus: {ticket_status}\nSubject: {ticket_subject}\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"subject": "Ticket Benachrichtigung #{ticket_id}",
|
||||||
|
"body": "<!DOCTYPE html><html lang=\"de\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Ticket Benachrichtigung</title></head><body style=\"font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5;\"><div class=\"container\" style=\"max-width: 600px; margin: 20px auto; padding: 20px; background-color: #fff;\"><h1 style=\"color: #333;\">Ticket Benachrichtigung</h1><p>Hallo {use_name},</p><p>Ihr Ticket wurde erfolgreich [erstellt/upgedated]. Im Folgenden finden Sie die Details:</p><div class=\"ticket-details\" style=\"margin-top: 20px; padding: 10px; background-color: #f9f9f9; border-radius: 5px;\"><h2 style=\"color: #333;\">Ticket Information</h2><p><strong>Ticket ID:</strong> {ticket_id}</p><p><strong>Status:</strong> {ticket_status}</p><p><strong>Betreff:</strong> {ticket_subject}</p></div><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058</p></td></tr></table></td></tr></table></body></html>",
|
||||||
|
"bodyalt": "Sehr geehrte/r {user_name},\n\nIhr Ticket wurde erfolgreich [erstellt/upgedated]. Im Folgenden finden Sie die Details:\n\nTicket ID: {ticket_id}\nStatus: {ticket_status}\nBetreff: {ticket_subject}\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"send": false
|
||||||
|
}
|
||||||
|
]
|
||||||
66
Admin/Install/Messages.php
Normal file
66
Admin/Install/Messages.php
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Support\Admin\Install
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Support\Admin\Install;
|
||||||
|
|
||||||
|
use Modules\Support\Models\SettingsEnum;
|
||||||
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
|
use phpOMS\Message\Http\HttpRequest;
|
||||||
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Media class.
|
||||||
|
*
|
||||||
|
* @package Modules\Support\Admin\Install
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Messages
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Install media providing
|
||||||
|
*
|
||||||
|
* @param ApplicationAbstract $app Application
|
||||||
|
* @param string $path Module path
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public static function install(ApplicationAbstract $app, string $path) : void
|
||||||
|
{
|
||||||
|
$messages = \Modules\Messages\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Messages.install.json']);
|
||||||
|
|
||||||
|
/** @var \Modules\Admin\Controller\ApiController $module */
|
||||||
|
$module = $app->moduleManager->get('Admin');
|
||||||
|
|
||||||
|
$settings = [
|
||||||
|
[
|
||||||
|
'id' => null,
|
||||||
|
'name' => SettingsEnum::SUPPORT_EMAIL_TEMPLATE,
|
||||||
|
'content' => (string) $messages['email_template'][0]['id'],
|
||||||
|
'module' => 'Support',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = new HttpResponse();
|
||||||
|
$request = new HttpRequest();
|
||||||
|
|
||||||
|
$request->header->account = 1;
|
||||||
|
$request->setData('settings', \json_encode($settings));
|
||||||
|
|
||||||
|
$module->apiSettingsSet($request, $response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Support\Controller;
|
namespace Modules\Support\Controller;
|
||||||
|
|
||||||
|
use Modules\Admin\Models\AccountMapper;
|
||||||
|
use Modules\Admin\Models\ContactType;
|
||||||
use Modules\Support\Models\NullSupportApp;
|
use Modules\Support\Models\NullSupportApp;
|
||||||
use Modules\Support\Models\SupportApp;
|
use Modules\Support\Models\SupportApp;
|
||||||
use Modules\Support\Models\SupportAppMapper;
|
use Modules\Support\Models\SupportAppMapper;
|
||||||
|
|
@ -27,6 +29,9 @@ use Modules\Tasks\Models\TaskType;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
use Modules\Admin\Models\SettingsEnum as AdminSettingsEnum;
|
||||||
|
use Modules\Messages\Models\EmailMapper;
|
||||||
|
use Modules\Support\Models\SettingsEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Api controller for the tickets module.
|
* Api controller for the tickets module.
|
||||||
|
|
@ -83,9 +88,133 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
$ticket = $this->createTicketFromRequest($request);
|
$ticket = $this->createTicketFromRequest($request);
|
||||||
$this->createModel($request->header->account, $ticket, TicketMapper::class, 'ticket', $request->getOrigin());
|
$this->createModel($request->header->account, $ticket, TicketMapper::class, 'ticket', $request->getOrigin());
|
||||||
|
|
||||||
|
$this->notifyEmail($ticket, $response->header->l11n->language);
|
||||||
|
|
||||||
$this->createStandardCreateResponse($request, $response, $ticket);
|
$this->createStandardCreateResponse($request, $response, $ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function notifyEmail(Ticket $ticket, string $language) : void
|
||||||
|
{
|
||||||
|
// @todo decide what to send via email
|
||||||
|
// status changes, redirects, answers?
|
||||||
|
// Careful, don't notify own changes and internal changes (e.g. internal note)
|
||||||
|
|
||||||
|
$email = '';
|
||||||
|
|
||||||
|
$account = null;
|
||||||
|
|
||||||
|
if ($this->app->moduleManager->isActive('ClientManagement')) {
|
||||||
|
$client = \Modules\ClientManagement\Models\ClientMapper::get()
|
||||||
|
->with('attributes')
|
||||||
|
->with('attributes/types')
|
||||||
|
->with('attributes/value')
|
||||||
|
->with('account/contacts')
|
||||||
|
->where('account', $ticket->task->for->id)
|
||||||
|
->where('attributes/types/name', ['support_emails', 'support_email_address'], 'IN')
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
if ($client->getAttribute('support_emails')->value->getValue() === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @todo should this really be a string? Shouldn't this be a contact element? Same goes for billing.
|
||||||
|
$email = $client->getAttribute('support_email_address')->value->getValue();
|
||||||
|
$account = $client->account;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($email === '' || $email === null) {
|
||||||
|
$supplier = null;
|
||||||
|
|
||||||
|
if ($this->app->moduleManager->isActive('SupplierManagement')) {
|
||||||
|
$supplier = \Modules\SupplierManagement\Models\SupplierMapper::get()
|
||||||
|
->with('attributes')
|
||||||
|
->with('attributes/types')
|
||||||
|
->with('attributes/value')
|
||||||
|
->with('account/contacts')
|
||||||
|
->where('account', $ticket->task->for->id)
|
||||||
|
->where('attributes/types/name', ['support_emails', 'support_email_address'], 'IN')
|
||||||
|
->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($supplier->getAttribute('support_emails')->value->getValue() === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @todo should this really be a string? Shouldn't this be a contact element? Same goes for billing.
|
||||||
|
$email = $supplier->getAttribute('support_email_address')->value->getValue();
|
||||||
|
$account = $supplier->account;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($email === '' || $email === null) {
|
||||||
|
$account = AccountMapper::get()
|
||||||
|
->with('contacts')
|
||||||
|
->where('id', $ticket->task->for->id)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$email = $account->getContactByType(ContactType::EMAIL)->content;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($email === '' || $email === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$handler = $this->app->moduleManager->get('Admin', 'Api')->setUpServerMailHandler();
|
||||||
|
|
||||||
|
/** @var \Model\Setting $emailFrom */
|
||||||
|
$emailFrom = $this->app->appSettings->get(
|
||||||
|
names: AdminSettingsEnum::MAIL_SERVER_ADDR,
|
||||||
|
module: 'Admin'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($emailFrom->content)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var \Model\Setting $billingTemplate */
|
||||||
|
$supportTemplate = $this->app->appSettings->get(
|
||||||
|
names: SettingsEnum::SUPPORT_EMAIL_TEMPLATE,
|
||||||
|
module: 'Support'
|
||||||
|
);
|
||||||
|
|
||||||
|
$baseEmail = EmailMapper::get()
|
||||||
|
->with('l11n')
|
||||||
|
->where('id', (int) $supportTemplate->content)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$mail = clone $baseEmail;
|
||||||
|
$mail->setFrom($emailFrom->content);
|
||||||
|
$mail->addTo($email);
|
||||||
|
|
||||||
|
// @todo probably needs to be changed to messageId = \uniqid() . '-' . $ticket->id ?!
|
||||||
|
// Careful, uniqueid is overwritten in the email class, will need check for if empty
|
||||||
|
$mail->addCustomHeader('ticket_id', (string) $ticket->id);
|
||||||
|
|
||||||
|
$mailL11n = $baseEmail->getL11nByLanguage($language);
|
||||||
|
if ($mailL11n->id === 0) {
|
||||||
|
$mailL11n = $baseEmail->getL11nByLanguage($language = $this->app->l11nServer->language);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mailL11n->id === 0) {
|
||||||
|
$mailL11n = $baseEmail->getL11nByLanguage($language = 'en');
|
||||||
|
}
|
||||||
|
|
||||||
|
$mail->subject = $mailL11n->subject;
|
||||||
|
$mail->body = $mailL11n->body;
|
||||||
|
$mail->bodyAlt = $mailL11n->bodyAlt;
|
||||||
|
|
||||||
|
$lang = include __DIR__ . '/../../Tasks/Theme/Backend/Lang/' . $language . '.lang.php';
|
||||||
|
|
||||||
|
$mail->template = [
|
||||||
|
'{user_name}' => $account->login,
|
||||||
|
'{ticket_id}' => $ticket->id,
|
||||||
|
'{ticket_status}' => $lang['Tasks']['S' . $ticket->task->status],
|
||||||
|
'{ticket_subject}' => $ticket->task->title,
|
||||||
|
];
|
||||||
|
|
||||||
|
$handler->send($mail);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to create ticket from request.
|
* Method to create ticket from request.
|
||||||
*
|
*
|
||||||
|
|
@ -143,10 +272,17 @@ final class ApiController extends Controller
|
||||||
public function apiTicketSet(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
public function apiTicketSet(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||||
{
|
{
|
||||||
/** @var \Modules\Support\Models\Ticket $old */
|
/** @var \Modules\Support\Models\Ticket $old */
|
||||||
$old = TicketMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
$old = TicketMapper::get()
|
||||||
|
->with('task')
|
||||||
|
->where('id', (int) $request->getData('id'))
|
||||||
|
->execute();
|
||||||
|
|
||||||
$new = $this->updateTicketFromRequest($request, clone $old);
|
$new = $this->updateTicketFromRequest($request, clone $old);
|
||||||
|
|
||||||
$this->updateModel($request->header->account, $old, $new, TicketMapper::class, 'ticket', $request->getOrigin());
|
$this->updateModel($request->header->account, $old, $new, TicketMapper::class, 'ticket', $request->getOrigin());
|
||||||
|
|
||||||
|
$this->notifyEmail($new, $response->header->l11n->language);
|
||||||
|
|
||||||
$this->createStandardUpdateResponse($request, $response, $new);
|
$this->createStandardUpdateResponse($request, $response, $new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -210,7 +346,11 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Modules\Support\Models\Ticket $ticket */
|
/** @var \Modules\Support\Models\Ticket $ticket */
|
||||||
$ticket = TicketMapper::get()->with('task')->where('id', (int) ($request->getData('ticket')))->execute();
|
$ticket = TicketMapper::get()
|
||||||
|
->with('task')
|
||||||
|
->where('id', (int) ($request->getData('ticket')))
|
||||||
|
->execute();
|
||||||
|
|
||||||
$element = $this->createTicketElementFromRequest($request, $ticket);
|
$element = $this->createTicketElementFromRequest($request, $ticket);
|
||||||
|
|
||||||
$old = clone $ticket->task;
|
$old = clone $ticket->task;
|
||||||
|
|
@ -219,8 +359,13 @@ final class ApiController extends Controller
|
||||||
$ticket->task->priority = $element->taskElement->priority;
|
$ticket->task->priority = $element->taskElement->priority;
|
||||||
$ticket->task->due = $element->taskElement->due;
|
$ticket->task->due = $element->taskElement->due;
|
||||||
|
|
||||||
$this->createModel($request->header->account, $element, TicketElementMapper::class, 'ticketelement', $request->getOrigin());
|
$this->createModel($request->header->account, $element, TicketElementMapper::class, 'ticket_element', $request->getOrigin());
|
||||||
$this->updateModel($request->header->account, $old, $ticket->task, TaskMapper::class, 'ticket', $request->getOrigin());
|
$this->updateModel($request->header->account, $old, $ticket->task, TaskMapper::class, 'ticket', $request->getOrigin());
|
||||||
|
|
||||||
|
$ticket->task->taskElements[] = $element;
|
||||||
|
|
||||||
|
$this->notifyEmail($ticket, $response->header->l11n->language);
|
||||||
|
|
||||||
$this->createStandardCreateResponse($request, $response, $element);
|
$this->createStandardCreateResponse($request, $response, $element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,7 +427,14 @@ final class ApiController extends Controller
|
||||||
/** @var \Modules\Support\Models\TicketElement $old */
|
/** @var \Modules\Support\Models\TicketElement $old */
|
||||||
$old = TicketElementMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
$old = TicketElementMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||||
$new = $this->updateTicketElementFromRequest($request, $response, clone $old);
|
$new = $this->updateTicketElementFromRequest($request, $response, clone $old);
|
||||||
$this->updateModel($request->header->account, $old, $new, TicketElementMapper::class, 'ticketelement', $request->getOrigin());
|
$this->updateModel($request->header->account, $old, $new, TicketElementMapper::class, 'ticket_element', $request->getOrigin());
|
||||||
|
|
||||||
|
$ticket = TicketMapper::get()
|
||||||
|
->with('task')
|
||||||
|
->where('task', $new->taskElement->task)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$this->notifyEmail($ticket, $response->header->l11n->language);
|
||||||
|
|
||||||
//$this->updateModel($request->header->account, $ticket, $ticket, TicketMapper::class, 'ticket', $request->getOrigin());
|
//$this->updateModel($request->header->account, $ticket, $ticket, TicketMapper::class, 'ticket', $request->getOrigin());
|
||||||
$this->createStandardUpdateResponse($request, $response, $new);
|
$this->createStandardUpdateResponse($request, $response, $new);
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,17 @@ declare(strict_types=1);
|
||||||
namespace Modules\Support\Controller;
|
namespace Modules\Support\Controller;
|
||||||
|
|
||||||
use Model\SettingMapper;
|
use Model\SettingMapper;
|
||||||
|
use Modules\Media\Models\MediaMapper;
|
||||||
use Modules\Support\Models\SupportAppMapper;
|
use Modules\Support\Models\SupportAppMapper;
|
||||||
use Modules\Support\Models\TicketMapper;
|
use Modules\Support\Models\TicketMapper;
|
||||||
use Modules\Support\Views\TicketView;
|
use Modules\Support\Views\TicketView;
|
||||||
use phpOMS\Asset\AssetType;
|
use phpOMS\Asset\AssetType;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
|
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\Views\View;
|
use phpOMS\Views\View;
|
||||||
|
use Modules\Profile\Models\SettingsEnum as ProfileSettingsEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support controller class.
|
* Support controller class.
|
||||||
|
|
@ -128,12 +131,17 @@ final class BackendController extends Controller
|
||||||
->with('app')
|
->with('app')
|
||||||
->where('task/tags/title/language', $request->header->l11n->language);
|
->where('task/tags/title/language', $request->header->l11n->language);
|
||||||
|
|
||||||
/** @var \Modules\Support\Models\Ticket $ticket */
|
/** @var \Modules\Support\Models\Ticket */
|
||||||
$ticket = $request->hasData('for')
|
$view->data['ticket'] = $request->hasData('for')
|
||||||
? $mapperQuery->where('task', (int) $request->getData('for'))->execute()
|
? $mapperQuery->where('task', (int) $request->getData('for'))->execute()
|
||||||
: $mapperQuery->where('id', (int) $request->getData('id'))->execute();
|
: $mapperQuery->where('id', (int) $request->getData('id'))->execute();
|
||||||
|
|
||||||
$view->data['ticket'] = $ticket;
|
/** @var \Model\Setting $profileImage */
|
||||||
|
$profileImage = $this->app->appSettings->get(names: ProfileSettingsEnum::DEFAULT_PROFILE_IMAGE, module: 'Profile');
|
||||||
|
|
||||||
|
/** @var \Modules\Media\Models\Media $image */
|
||||||
|
$image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute();
|
||||||
|
$view->defaultProfileImage = $image;
|
||||||
|
|
||||||
$accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app->l11nManager, $request, $response);
|
$accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app->l11nManager, $request, $response);
|
||||||
$view->data['accGrpSelector'] = $accGrpSelector;
|
$view->data['accGrpSelector'] = $accGrpSelector;
|
||||||
|
|
@ -141,6 +149,28 @@ final class BackendController extends Controller
|
||||||
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
|
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
|
||||||
$view->data['editor'] = $editor;
|
$view->data['editor'] = $editor;
|
||||||
|
|
||||||
|
$view->data['tickets'] = TicketMapper::getAll()
|
||||||
|
->with('task')
|
||||||
|
->where('task/for', $view->data['ticket']->task->for->id)
|
||||||
|
->sort('createdAt', OrderType::DESC)
|
||||||
|
->offset(1)
|
||||||
|
->limit(5)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$dt = new \DateTime();
|
||||||
|
|
||||||
|
$view->data['hasContractManagement'] = $this->app->moduleManager->isActive('ContractManagement');
|
||||||
|
if ($view->data['hasContractManagement']) {
|
||||||
|
$view->data['contracts'] = \Modules\ContractManagement\Models\ContractMapper::getAll()
|
||||||
|
->where('account', $view->data['ticket']->task->for->id)
|
||||||
|
->where('end', $dt, '>=') // @todo consider to also allow $end === null
|
||||||
|
->sort('createdAt', OrderType::DESC)
|
||||||
|
->limit(5)
|
||||||
|
->execute();
|
||||||
|
} else {
|
||||||
|
$view->data['contracts'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
30
Models/SettingsEnum.php
Normal file
30
Models/SettingsEnum.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Support\Models
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Support\Models;
|
||||||
|
|
||||||
|
use phpOMS\Stdlib\Base\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module settings enum.
|
||||||
|
*
|
||||||
|
* @package Modules\Support\Models
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
abstract class SettingsEnum extends Enum
|
||||||
|
{
|
||||||
|
public const SUPPORT_EMAIL_TEMPLATE = '1002900001'; // Email template for support tickets
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ return ['Support' => [
|
||||||
'AverageProcessTime' => 'Durchschn. Prozess Zeit',
|
'AverageProcessTime' => 'Durchschn. Prozess Zeit',
|
||||||
'Closed' => 'Geschlossen',
|
'Closed' => 'Geschlossen',
|
||||||
'Completion' => 'Abgeschlossen',
|
'Completion' => 'Abgeschlossen',
|
||||||
|
'Advanced' => 'Fortgeschritten',
|
||||||
'Created' => 'Erstellt',
|
'Created' => 'Erstellt',
|
||||||
'Creator' => 'Ersteller',
|
'Creator' => 'Ersteller',
|
||||||
'Day' => 'Tag',
|
'Day' => 'Tag',
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ return ['Support' => [
|
||||||
'AverageProcessTime' => 'Avg. Process Time',
|
'AverageProcessTime' => 'Avg. Process Time',
|
||||||
'Closed' => 'Closed',
|
'Closed' => 'Closed',
|
||||||
'Completion' => 'Completion',
|
'Completion' => 'Completion',
|
||||||
|
'Advanced' => 'Advanced',
|
||||||
'Created' => 'Created',
|
'Created' => 'Created',
|
||||||
'Creator' => 'Creator',
|
'Creator' => 'Creator',
|
||||||
'Day' => 'Day',
|
'Day' => 'Day',
|
||||||
|
|
|
||||||
|
|
@ -62,26 +62,6 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-12 col-md-3">
|
<div class="col-xs-12 col-md-3">
|
||||||
<!-- @todo necessary?
|
|
||||||
<section class="portlet">
|
|
||||||
<div class="portlet-head"><?= $this->getHtml('Settings'); ?></div>
|
|
||||||
<div class="portlet-body">
|
|
||||||
<form>
|
|
||||||
<table class="layout wf-100">
|
|
||||||
<tr><td><label for="iIntervarl"><?= $this->getHtml('Interval'); ?></label>
|
|
||||||
<tr><td><select id="iIntervarl" name="interval">
|
|
||||||
<option><?= $this->getHtml('All'); ?>
|
|
||||||
<option><?= $this->getHtml('Day'); ?>
|
|
||||||
<option><?= $this->getHtml('Week'); ?>
|
|
||||||
<option selected><?= $this->getHtml('Month'); ?>
|
|
||||||
<option><?= $this->getHtml('Year'); ?>
|
|
||||||
</select>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<section class="portlet">
|
<section class="portlet">
|
||||||
<div class="portlet-head"><?= $this->getHtml('Stats'); ?></div>
|
<div class="portlet-head"><?= $this->getHtml('Stats'); ?></div>
|
||||||
<div class="portlet-body">
|
<div class="portlet-body">
|
||||||
|
|
|
||||||
|
|
@ -58,20 +58,18 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="portlet-head">
|
<div class="portlet-head middle-xs">
|
||||||
<div class="row middle-xs">
|
<span class="col-xs-0">
|
||||||
<span class="col-xs-0">
|
<img class="profile-image" loading="lazy" alt="<?= $this->getHtml('User', '0', '0'); ?>" src="<?= $this->getAccountImage($task->createdBy->id); ?>">
|
||||||
<img class="profile-image" loading="lazy" alt="<?= $this->getHtml('User', '0', '0'); ?>" src="<?= $this->getAccountImage($task->createdBy->id); ?>">
|
</span>
|
||||||
|
<span>
|
||||||
|
<?= $this->printHtml($task->createdBy->name1); ?> - <?= $this->printHtml($task->createdAt->format('Y/m/d H:i')); ?>
|
||||||
|
</span>
|
||||||
|
<span class="col-xs end-xs plain-grid">
|
||||||
|
<span id="task-status-badge" class="nobreak tag task-status-<?= $task->status; ?>">
|
||||||
|
<?= $this->getHtml('S' . $task->status, 'Tasks'); ?>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
</span>
|
||||||
<?= $this->printHtml($task->createdBy->name1); ?> - <?= $this->printHtml($task->createdAt->format('Y/m/d H:i')); ?>
|
|
||||||
</span>
|
|
||||||
<span class="col-xs end-xs plain-grid">
|
|
||||||
<span id="task-status-badge" class="nobreak tag task-status-<?= $task->status; ?>">
|
|
||||||
<?= $this->getHtml('S' . $task->status, 'Tasks'); ?>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="portlet-body">
|
<div class="portlet-body">
|
||||||
<span class="task-title" data-tpl-text="/title" data-tpl-value="/title" data-value=""><?= $this->printHtml($task->title); ?></span>
|
<span class="task-title" data-tpl-text="/title" data-tpl-value="/title" data-value=""><?= $this->printHtml($task->title); ?></span>
|
||||||
|
|
@ -347,31 +345,31 @@ echo $this->data['nav']->render(); ?>
|
||||||
<?= $this->getData('accGrpSelector')->render('iReceiver', 'to', true); ?>
|
<?= $this->getData('accGrpSelector')->render('iReceiver', 'to', true); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="more-container">
|
<div class="form-group wf-100">
|
||||||
|
<div class="more-container wf-100">
|
||||||
<input id="more-customer-sales" type="checkbox" name="more-container">
|
<input id="more-customer-sales" type="checkbox" name="more-container">
|
||||||
<label for="more-customer-sales">
|
<label for="more-customer-sales">
|
||||||
<span>Advanced</span>
|
<span><?= $this->getHtml('Advanced'); ?></span>
|
||||||
<i class="g-icon expand">chevron_right</i>
|
<i class="g-icon expand">chevron_right</i>
|
||||||
</label>
|
</label>
|
||||||
<div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="iPriority"><?= $this->getHtml('Priority'); ?></label>
|
|
||||||
<select id="iPriority" name="priority">
|
|
||||||
<option value="<?= TaskPriority::NONE; ?>"<?= $task->priority === TaskPriority::NONE ? ' selected' : '';?>><?= $this->getHtml('P0', 'Tasks'); ?>
|
|
||||||
<option value="<?= TaskPriority::VLOW; ?>"<?= $task->priority === TaskPriority::VLOW ? ' selected' : '';?>><?= $this->getHtml('P1', 'Tasks'); ?>
|
|
||||||
<option value="<?= TaskPriority::LOW; ?>"<?= $task->priority === TaskPriority::LOW ? ' selected' : '';?>><?= $this->getHtml('P2', 'Tasks'); ?>
|
|
||||||
<option value="<?= TaskPriority::MEDIUM; ?>"<?= $task->priority === TaskPriority::MEDIUM ? ' selected' : '';?>><?= $this->getHtml('P3', 'Tasks'); ?>
|
|
||||||
<option value="<?= TaskPriority::HIGH; ?>"<?= $task->priority === TaskPriority::HIGH ? ' selected' : '';?>><?= $this->getHtml('P4', 'Tasks'); ?>
|
|
||||||
<option value="<?= TaskPriority::VHIGH; ?>"<?= $task->priority === TaskPriority::VHIGH ? ' selected' : '';?>><?= $this->getHtml('P5', 'Tasks'); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="iDue"><?= $this->getHtml('Due'); ?></label>
|
<label for="iPriority"><?= $this->getHtml('Priority'); ?></label>
|
||||||
<input type="datetime-local" id="iDue" name="due" value="<?= $this->printHtml(
|
<select id="iPriority" name="priority">
|
||||||
empty($elements) ? $task->due->format('Y-m-d\TH:i:s') : \end($elements)->taskElement->due->format('Y-m-d\TH:i:s')
|
<option value="<?= TaskPriority::NONE; ?>"<?= $task->priority === TaskPriority::NONE ? ' selected' : '';?>><?= $this->getHtml('P0', 'Tasks'); ?>
|
||||||
); ?>">
|
<option value="<?= TaskPriority::VLOW; ?>"<?= $task->priority === TaskPriority::VLOW ? ' selected' : '';?>><?= $this->getHtml('P1', 'Tasks'); ?>
|
||||||
</div>
|
<option value="<?= TaskPriority::LOW; ?>"<?= $task->priority === TaskPriority::LOW ? ' selected' : '';?>><?= $this->getHtml('P2', 'Tasks'); ?>
|
||||||
|
<option value="<?= TaskPriority::MEDIUM; ?>"<?= $task->priority === TaskPriority::MEDIUM ? ' selected' : '';?>><?= $this->getHtml('P3', 'Tasks'); ?>
|
||||||
|
<option value="<?= TaskPriority::HIGH; ?>"<?= $task->priority === TaskPriority::HIGH ? ' selected' : '';?>><?= $this->getHtml('P4', 'Tasks'); ?>
|
||||||
|
<option value="<?= TaskPriority::VHIGH; ?>"<?= $task->priority === TaskPriority::VHIGH ? ' selected' : '';?>><?= $this->getHtml('P5', 'Tasks'); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="iDue"><?= $this->getHtml('Due'); ?></label>
|
||||||
|
<input type="datetime-local" id="iDue" name="due" value="<?= $this->printHtml(
|
||||||
|
empty($elements) ? $task->due->format('Y-m-d\TH:i:s') : \end($elements)->taskElement->due->format('Y-m-d\TH:i:s')
|
||||||
|
); ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
@ -379,6 +377,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<input id="iCompletion" name="completion" type="number" min="0" max="100">
|
<input id="iCompletion" name="completion" type="number" min="0" max="100">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="iMedia"><?= $this->getHtml('Media'); ?></label>
|
<label for="iMedia"><?= $this->getHtml('Media'); ?></label>
|
||||||
|
|
@ -399,5 +398,57 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<section class="portlet">
|
||||||
|
<div class="portlet-head"><?= $this->getHtml('Tickets'); ?></div>
|
||||||
|
<div class="slider">
|
||||||
|
<table id="iTicketList" class="default sticky">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td class="wf-100"><?= $this->printHtml('Title'); ?>
|
||||||
|
<td><?= $this->printHtml('Created'); ?>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$count = 0;
|
||||||
|
foreach ($this->data['tickets'] as $value) :
|
||||||
|
++$count;
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?= $this->printHtml($value->task->title); ?>
|
||||||
|
<td><?= $value->task->createdAt->format('Y-m-d'); ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if ($count === 0) : ?>
|
||||||
|
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php if ($this->data['hasContractManagement']) : ?>
|
||||||
|
<section class="portlet">
|
||||||
|
<div class="portlet-head"><?= $this->getHtml('Contracts', 'ContractManagement'); ?></div>
|
||||||
|
<div class="slider">
|
||||||
|
<table id="iContractList" class="default sticky">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td class="wf-100"><?= $this->printHtml('Title'); ?>
|
||||||
|
<td><?= $this->printHtml('Created'); ?>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$count = 0;
|
||||||
|
foreach ($this->data['contracts'] as $value) :
|
||||||
|
++$count;
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?= $this->printHtml($value->title); ?>
|
||||||
|
<td><?= $value->createdAt->format('Y-m-d'); ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if ($count === 0) : ?>
|
||||||
|
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user