mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-02-01 00:28:40 +00:00
many fixes and expands and module expansions
This commit is contained in:
parent
c5b1ef7549
commit
23173d806c
43
Admin/Install/Search.php
Normal file
43
Admin/Install/Search.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Tasks\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Tasks\Admin\Install;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
|
||||
/**
|
||||
* Search class.
|
||||
*
|
||||
* @package Modules\Tasks\Admin\Install
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Search
|
||||
{
|
||||
/**
|
||||
* Install navigation providing
|
||||
*
|
||||
* @param string $path Module path
|
||||
* @param DatabasePool $dbPool Database pool for database interaction
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(string $path, DatabasePool $dbPool) : void
|
||||
{
|
||||
\Modules\Search\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/SearchCommands.php']);
|
||||
}
|
||||
}
|
||||
30
Admin/Install/SearchCommands.php
Normal file
30
Admin/Install/SearchCommands.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Tasks
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Tasks\Controller\SearchController;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^:tag .*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller\SearchController:searchTags',
|
||||
'verb' => RouteVerb::ANY,
|
||||
'permission' => [
|
||||
'module' => SearchController::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -34,6 +34,11 @@
|
|||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"task_completion": {
|
||||
"name": "task_completion",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"task_closable": {
|
||||
"name": "task_closable",
|
||||
"type": "TINYINT",
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ final class ApiController extends Controller
|
|||
$task->setStatus((int) ($request->getData('status') ?? $task->getStatus()));
|
||||
$task->setType((int) ($request->getData('type') ?? $task->getType()));
|
||||
$task->setPriority((int) ($request->getData('priority') ?? $task->getPriority()));
|
||||
$task->completion = (int) ($request->getData('completion') ?? $task->completion);
|
||||
|
||||
return $task;
|
||||
}
|
||||
|
|
@ -255,6 +256,11 @@ final class ApiController extends Controller
|
|||
$task->setStatus($element->getStatus());
|
||||
$task->setPriority($element->getPriority());
|
||||
$task->due = $element->due;
|
||||
$task->completion = (int) ($request->getData('completion') ?? $task->completion);
|
||||
|
||||
if ($task->getStatus() === TaskStatus::DONE) {
|
||||
$task->completion = 100;
|
||||
}
|
||||
|
||||
$this->createModel($request->header->account, $element, TaskElementMapper::class, 'taskelement', $request->getOrigin());
|
||||
$this->updateModel($request->header->account, $task, $task, TaskMapper::class, 'task', $request->getOrigin());
|
||||
|
|
|
|||
62
Controller/SearchController.php
Normal file
62
Controller/SearchController.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Tasks
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Tasks\Controller;
|
||||
|
||||
use Modules\Tasks\Models\NavElementMapper;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\NotificationLevel;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Model\Message\Redirect;
|
||||
use phpOMS\System\MimeType;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* Search class.
|
||||
*
|
||||
* @package Modules\Tasks
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class SearchController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api method to search for tags
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function searchTags(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||
{
|
||||
// join tags with tag l11n
|
||||
// join tags with tasks
|
||||
// return where tag l11n matches X
|
||||
|
||||
$tags = [];
|
||||
|
||||
// @todo: probably cleanup return for link generation + sort by best match
|
||||
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||
|
||||
$response->set($request->uri->__toString(), $tags);
|
||||
}
|
||||
}
|
||||
|
|
@ -96,6 +96,13 @@ class Task implements \JsonSerializable
|
|||
*/
|
||||
protected int $status = TaskStatus::OPEN;
|
||||
|
||||
/**
|
||||
* Completion status
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $completion = -1;
|
||||
|
||||
/**
|
||||
* Task can be closed by user.
|
||||
*
|
||||
|
|
@ -149,7 +156,7 @@ class Task implements \JsonSerializable
|
|||
protected array $taskElements = [];
|
||||
|
||||
/**
|
||||
* Task elements.
|
||||
* Tags.
|
||||
*
|
||||
* @var Tag[]
|
||||
* @since 1.0.0
|
||||
|
|
@ -522,6 +529,11 @@ class Task implements \JsonSerializable
|
|||
return $this->taskElements;
|
||||
}
|
||||
|
||||
public function invertTaskElements() : array
|
||||
{
|
||||
return \array_reverse($this->taskElements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task elements.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ final class TaskMapper extends DataMapperAbstract
|
|||
'task_desc_raw' => ['name' => 'task_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||
'task_type' => ['name' => 'task_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'task_status' => ['name' => 'task_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'task_completion' => ['name' => 'task_completion', 'type' => 'int', 'internal' => 'completion'],
|
||||
'task_closable' => ['name' => 'task_closable', 'type' => 'bool', 'internal' => 'isClosable'],
|
||||
'task_editable' => ['name' => 'task_editable', 'type' => 'bool', 'internal' => 'isEditable'],
|
||||
'task_priority' => ['name' => 'task_priority', 'type' => 'int', 'internal' => 'priority'],
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
data-src="api/admin/find/accgrp?search={!#i<?= $this->getId(); ?>}">
|
||||
<template><!-- Template for the selected element --></template>
|
||||
</div>
|
||||
<div id="<?= $this->getId(); ?>-dropdown" class="dropdown" data-active="true" data-selected="<?= $task->getStatus(); ?>">
|
||||
<div id="<?= $this->getId(); ?>-popup" class="popup" data-active="true" data-selected="<?= $task->getStatus(); ?>">
|
||||
<template class="rowTemplate"><!-- Template for remote data or data manually to be added --></template>
|
||||
<tr><td data-value="<?= TaskStatus::OPEN; ?>"><?= $this->getHtml('S1'); ?>
|
||||
<tr><td data-value="<?= TaskStatus::WORKING; ?>"><?= $this->getHtml('S2'); ?>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use phpOMS\Uri\UriFactory;
|
|||
/** @var Modules\Tasks\Models\Task $task */
|
||||
$task = $this->getData('task');
|
||||
$taskMedia = $task->getMedia();
|
||||
$elements = $task->getTaskElements();
|
||||
$elements = $task->invertTaskElements();
|
||||
$cElements = \count($elements);
|
||||
$color = $this->getStatus($task->getStatus());
|
||||
|
||||
|
|
@ -346,6 +346,8 @@ echo $this->getData('nav')->render(); ?>
|
|||
<option value="<?= TaskStatus::CANCELED; ?>"<?= $task->getStatus() === TaskStatus::CANCELED ? ' selected' : '';?>><?= $this->getHtml('S4'); ?>
|
||||
<option value="<?= TaskStatus::DONE; ?>"<?= $task->getStatus() === TaskStatus::DONE ? ' selected' : '';?>><?= $this->getHtml('S5'); ?>
|
||||
</select>
|
||||
<tr><td><label for="iCompletion"><?= $this->getHtml('Completion'); ?></label>
|
||||
<tr><td><input id="iCompletion" name="completion" type="number" min="0" max="100">
|
||||
<tr><td><label for="iReceiver"><?= $this->getHtml('To'); ?></label>
|
||||
<tr><td><?= $this->getData('accGrpSelector')->render('iReceiver', 'to', true); ?>
|
||||
<tr><td><label for="iMedia"><?= $this->getHtml('Media'); ?></label>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user