mirror of
https://github.com/Karaka-Management/oms-Support.git
synced 2026-01-11 17:18:40 +00:00
Add ticket templates
This commit is contained in:
parent
215aa4c7ea
commit
32bc3142c5
|
|
@ -40,7 +40,23 @@ class Installer extends InstallerAbstract
|
|||
|
||||
switch ($dbPool->get('core')->getType()) {
|
||||
case DatabaseType::MYSQL:
|
||||
|
||||
$dbPool->get('core')->con->beginTransaction();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'support_ticket` (
|
||||
`support_ticket_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`support_ticket_task` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`support_ticket_id`),
|
||||
KEY `support_ticket_task` (`support_ticket_task`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'support_ticket`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_ibfk_1` FOREIGN KEY (`support_ticket`) REFERENCES `' . $dbPool->get('core')->prefix . 'task` (`task_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->commit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ use phpOMS\Module\ModuleAbstract;
|
|||
use phpOMS\Module\WebInterface;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
use Modules\Support\Models\Ticket;
|
||||
use Modules\Support\Models\TicketMapper;
|
||||
|
||||
/**
|
||||
* Support controller class.
|
||||
*
|
||||
|
|
@ -88,6 +91,9 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$view->setTemplate('/Modules/Support/Theme/Backend/support-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response));
|
||||
|
||||
$ticktes = TicketMapper::getNewest(50);
|
||||
$view->setData('tickets', $tickets);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Support;
|
||||
|
||||
use Modules\Tasks\Models\Task;
|
||||
use Modules\Tasks\Models\TaskType;
|
||||
|
||||
/**
|
||||
* Issue class.
|
||||
|
|
@ -25,31 +26,26 @@ use Modules\Tasks\Models\Task;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Ticket extends Task
|
||||
class Ticket
|
||||
{
|
||||
|
||||
private $id = 0;
|
||||
private $task = 0;
|
||||
|
||||
/**
|
||||
* Assigned group.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $group = 0;
|
||||
|
||||
/**
|
||||
* Assigned person.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $person = 0;
|
||||
private $task = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->task = new Task();
|
||||
$this->task->setType(TaskType::HIDDEN);
|
||||
}
|
||||
|
||||
public function getTask() : Task
|
||||
{
|
||||
return $this->task;
|
||||
}
|
||||
|
||||
public function setTask(Task $task) /* : void */
|
||||
{
|
||||
$this->task = $task;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,17 +12,19 @@
|
|||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace Modules\Tasks\Models;
|
||||
namespace Modules\Support\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Database\Query\Column;
|
||||
use phpOMS\DataStorage\Database\RelationType;
|
||||
|
||||
use Modules\Tasks\Models\Task;
|
||||
|
||||
/**
|
||||
* Mapper class.
|
||||
*
|
||||
* @category Tasks
|
||||
* @category Support
|
||||
* @package Modules
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
|
|
@ -38,8 +40,8 @@ class TicketMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'ticket_id' => ['name' => 'ticket_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'ticket_task' => ['name' => 'ticket_task', 'type' => 'int', 'internal' => 'task'],
|
||||
'support_ticket_id' => ['name' => 'support_ticket_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'support_ticket_task' => ['name' => 'support_ticket_task', 'type' => 'int', 'internal' => 'task'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -48,10 +50,10 @@ class TicketMapper extends DataMapperAbstract
|
|||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $isExtending = [
|
||||
protected static $ownsOne = [
|
||||
'task' => [
|
||||
'mapper' => \Modules\Tasks\Models\TaskMapper::class,
|
||||
'src' => 'ticket_task',
|
||||
'mapper' => Task::class,
|
||||
'src' => 'support_ticket_task',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -61,7 +63,7 @@ class TicketMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $table = 'ticket';
|
||||
protected static $table = 'support_ticket';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
|
|
|
|||
|
|
@ -13,24 +13,76 @@
|
|||
*/
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Tasks\Models\Task[] $tickets
|
||||
*/
|
||||
$tickets = $this->getData('tasks');
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="col-xs-12 col-md-9">
|
||||
<div class="box wf-100">
|
||||
<table class="table red">
|
||||
<caption><?= $this->getHtml('Tickets') ?></caption>
|
||||
<caption><?= $this->getHtml('Tasks') ?></caption>
|
||||
<thead>
|
||||
<tr><td><?= $this->getHtml('ID', 0, 0); ?>
|
||||
<td><?= $this->getHtml('Status') ?>
|
||||
<td><?= $this->getHtml('Priority') ?>
|
||||
<td><?= $this->getHtml('Due') ?>
|
||||
<td class="full"><?= $this->getHtml('Title') ?>
|
||||
<td><?= $this->getHtml('Responsible') ?>
|
||||
<td><?= $this->getHtml('Creator') ?>
|
||||
<td><?= $this->getHtml('Created') ?>
|
||||
<tfoot>
|
||||
<tbody>
|
||||
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
||||
<?php $c = 0; foreach($tickets as $key => $ticket) : $c++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/support/single?{?}&id=' . $ticket->getId());
|
||||
$color = 'darkred';
|
||||
if($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::DONE) { $color = 'green'; }
|
||||
elseif($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::OPEN) { $color = 'darkblue'; }
|
||||
elseif($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::WORKING) { $color = 'purple'; }
|
||||
elseif($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::CANCELED) { $color = 'red'; }
|
||||
elseif($ticket->getTask()->getStatus() === \Modules\Tasks\Models\TaskStatus::SUSPENDED) { $color = 'yellow'; } ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><span class="tag <?= htmlspecialchars($color, ENT_COMPAT, 'utf-8'); ?>"><?= $this->getHtml('S' . $ticket->getTask()->getStatus()) ?></span></a>
|
||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getDue()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getTitle(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getCreatedBy()->getName1(), ENT_COMPAT, 'utf-8'); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= htmlspecialchars($ticket->getTask()->getCreatedAt()->format('Y-m-d H:i'), ENT_COMPAT, 'utf-8'); ?></a>
|
||||
<?php endforeach; if($c == 0) : ?>
|
||||
<tr><td colspan="6" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-3">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Settings') ?></h1></header>
|
||||
<div class="inner">
|
||||
<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="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Settings') ?></h1></header>
|
||||
<div class="inner">
|
||||
<table class="list">
|
||||
<tr><th><?= $this->getHtml('Received') ?><td>0
|
||||
<tr><th><?= $this->getHtml('Created') ?><td>0
|
||||
<tr><th><?= $this->getHtml('Forwarded') ?><td>0
|
||||
<tr><th><?= $this->getHtml('AverageAmount') ?><td>0
|
||||
<tr><th><?= $this->getHtml('AverageProcessTime') ?><td>0
|
||||
<tr><th><?= $this->getHtml('InTime') ?><td>0
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -16,24 +16,28 @@
|
|||
*/
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<section class="box w-50">
|
||||
<header><h1><?= $this->getHtml('Ticket'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form action="<?= \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/api/reporter/template'); ?>" method="post">
|
||||
<table class="layout wf-100">
|
||||
<tbody>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Department'); ?></label>
|
||||
<tr><td><select></select>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Topic'); ?></label>
|
||||
<tr><td><select></select>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
|
||||
<tr><td><input id="iTitle" name="name" type="text" required>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Description'); ?></label>
|
||||
<tr><td><textarea required></textarea>
|
||||
<tr><td><label for="iFile"><?= $this->getHtml('Files'); ?></label>
|
||||
<tr><td><input id="iFile" name="fileVisual" type="file" multiple><input id="iFileHidden" name="files" type="hidden">
|
||||
<tr><td><input type="submit" value="<?= $this->getHtml('Create', 0, 0); ?>">
|
||||
</table>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('Ticket'); ?></h1></header>
|
||||
<div class="inner">
|
||||
<form action="<?= \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/api/reporter/template'); ?>" method="post">
|
||||
<table class="layout wf-100">
|
||||
<tbody>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Department'); ?></label>
|
||||
<tr><td><select></select>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Topic'); ?></label>
|
||||
<tr><td><select></select>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
|
||||
<tr><td><input id="iTitle" name="name" type="text" required>
|
||||
<tr><td><label for="iTitle"><?= $this->getHtml('Description'); ?></label>
|
||||
<tr><td><textarea required></textarea>
|
||||
<tr><td><label for="iFile"><?= $this->getHtml('Files'); ?></label>
|
||||
<tr><td><input id="iFile" name="fileVisual" type="file" multiple><input id="iFileHidden" name="files" type="hidden">
|
||||
<tr><td><input type="submit" value="<?= $this->getHtml('Create', 0, 0); ?>">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user