This commit is contained in:
Dennis Eichhorn 2024-01-02 23:34:17 +00:00
parent 87be36bf6e
commit eeabd5d0d0
19 changed files with 1094 additions and 29 deletions

136
Admin/Install/db.json Normal file
View File

@ -0,0 +1,136 @@
{
"checklist_checklist_template": {
"name": "checklist_checklist_template",
"fields": {
"checklist_checklist_template_id": {
"name": "checklist_checklist_template_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"checklist_checklist_template_name": {
"name": "checklist_checklist_template_name",
"type": "VARCHAR(255)",
"null": false
},
"checklist_checklist_template_description": {
"name": "checklist_checklist_template_description",
"type": "TEXT",
"null": false
},
"checklist_checklist_template_repeat": {
"name": "checklist_checklist_template_repeat",
"type": "TINYINT(1)",
"null": false
},
"checklist_checklist_template_interval": {
"name": "checklist_checklist_template_interval",
"type": "VARCHAR(255)",
"null": false
},
"checklist_checklist_template_start": {
"name": "checklist_checklist_template_start",
"type": "DATETIME",
"null": false
},
"checklist_checklist_template_end": {
"name": "checklist_checklist_template_end",
"type": "DATETIME",
"null": true,
"default": null
}
}
},
"checklist_checklist_template_task": {
"name": "checklist_checklist_template_task",
"fields": {
"checklist_checklist_template_task_id": {
"name": "checklist_checklist_template_task_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"checklist_checklist_template_task_order": {
"name": "checklist_checklist_template_task_order",
"type": "INT",
"null": false
},
"checklist_checklist_template_task_template": {
"name": "checklist_checklist_template_task_template",
"type": "INT",
"null": false,
"foreignTable": "checklist_checklist_template",
"foreignKey": "checklist_checklist_template_id"
},
"checklist_checklist_template_task_task": {
"name": "checklist_checklist_template_task_task",
"type": "INT",
"null": false,
"foreignTable": "task",
"foreignKey": "task_id"
}
}
},
"checklist_checklist": {
"name": "checklist_checklist",
"fields": {
"checklist_checklist_id": {
"name": "checklist_checklist_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"checklist_checklist_name": {
"name": "checklist_checklist_name",
"type": "VARCHAR(255)",
"null": false
},
"checklist_checklist_template": {
"name": "checklist_checklist_template",
"type": "INT",
"null": false,
"foreignTable": "checklist_checklist_template",
"foreignKey": "checklist_checklist_template_id"
},
"checklist_checklist_createdat": {
"name": "checklist_checklist_createdat",
"type": "DATETIME",
"null": false
}
}
},
"checklist_checklist_task": {
"name": "checklist_checklist_task",
"fields": {
"checklist_checklist_task_id": {
"name": "checklist_checklist_task_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"checklist_checklist_task_order": {
"name": "checklist_checklist_task_order",
"type": "INT",
"null": false
},
"checklist_checklist_task_template": {
"name": "checklist_checklist_task_template",
"type": "INT",
"null": false,
"foreignTable": "checklist_checklist",
"foreignKey": "checklist_checklist_id"
},
"checklist_checklist_task_task": {
"name": "checklist_checklist_template_task_task",
"type": "INT",
"null": false,
"foreignTable": "task",
"foreignKey": "task_id"
}
}
}
}

View File

@ -29,6 +29,17 @@ return [
],
],
],
'^.*/checklist/view.*$' => [
[
'dest' => '\Modules\Checklist\Controller\BackendController:viewChecklistView',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::CHECKLIST,
],
],
],
'^.*/checklist/template/list.*$' => [
[
'dest' => '\Modules\Checklist\Controller\BackendController:viewChecklistTemplateList',
@ -62,4 +73,15 @@ return [
],
],
],
'^.*/checklist/template/task.*$' => [
[
'dest' => '\Modules\Checklist\Controller\BackendController:viewChecklistTemplateTaskView',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::TEMPLATE,
],
],
],
];

View File

@ -0,0 +1,177 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Controller;
use Modules\Checklist\Models\ChecklistTemplate;
use Modules\Checklist\Models\ChecklistTemplateElement;
use Modules\Checklist\Models\ChecklistTemplateElementL11nMapper;
use Modules\Checklist\Models\ChecklistTemplateElementMapper;
use Modules\Checklist\Models\ChecklistTemplateMapper;
use Modules\Checklist\Models\ChecklistTemplateTask;
use Modules\Checklist\Models\ChecklistTemplateTaskMapper;
use Modules\Tasks\Models\TaskType;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
/**
* Checklist api controller class.
*
* @package Modules\Checklist
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class ApiController extends Controller
{
/**
* Api method to create an checklist
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiChecklistTemplateCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateChecklistTemplateCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$checklist = $this->createChecklistTemplateFromRequest($request);
$this->createModel($request->header->account, $checklist, ChecklistTemplateMapper::class, 'checklist_template', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $checklist);
}
/**
* Validate checklist create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateChecklistTemplateCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['name'] = !$request->hasData('name'))
) {
return $val;
}
return [];
}
/**
* Method to create checklist from request.
*
* @param RequestAbstract $request Request
*
* @return ChecklistTemplate
*
* @since 1.0.0
*/
private function createChecklistTemplateFromRequest(RequestAbstract $request) : ChecklistTemplate
{
$checklist = new ChecklistTemplate();
$checklist->name = (string) $request->getData('name');
$checklist->description = $request->getDataString('description') ?? '';
$checklist->repeat = 0;
$checklist->interval = $request->getDataString('interval') ?? '';
$checklist->start = $request->getDataDateTime('start') ?? new \DateTime('now');
$checklist->end = $request->getDataDateTime('end');
return $checklist;
}
/**
* Api method to create an checklist
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiChecklistTemplateTaskCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateChecklistTemplateTaskCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$checklist = $this->createChecklistTemplateTaskFromRequest($request);
$this->createModel($request->header->account, $checklist, ChecklistTemplateTaskMapper::class, 'checklist_template_task', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $checklist);
}
/**
* Validate checklist create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateChecklistTemplateTaskCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['template'] = !$request->hasData('template'))
) {
return $val;
}
return [];
}
/**
* Method to create checklist from request.
*
* @param RequestAbstract $request Request
*
* @return ChecklistTemplateTask
*
* @since 1.0.0
*/
private function createChecklistTemplateTaskFromRequest(RequestAbstract $request) : ChecklistTemplateTask
{
$request->setData('type', TaskType::TEMPLATE, true);
$checklistTask = new ChecklistTemplateTask();
$checklistTask->template = (int) $request->getData('template');
$checklistTask->task = $this->app->moduleManager->get('Tasks', 'Api')->createTaskFromRequest($request);
return $checklistTask;
}
}

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Modules\Checklist\Controller;
use Modules\Checklist\Models\ChecklistTemplateMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
@ -31,7 +32,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
@ -52,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
@ -69,11 +70,14 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Checklist/Theme/Backend/checklist-template-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003601001, $request, $response);
$view->data['templates'] = ChecklistTemplateMapper::getAll()
->execute();
return $view;
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -94,7 +98,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
@ -111,6 +115,16 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Checklist/Theme/Backend/checklist-template');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003601001, $request, $response);
$view->data['template'] = ChecklistTemplateMapper::get()
->with('tasks')
->with('tasks/taskElements')
->with('tasks/taskElements/accRelation')
->with('tasks/taskElements/accRelation/relation')
->with('tasks/taskElements/grpRelation')
->with('tasks/taskElements/grpRelation/relation')
->where('id', (int) $request->getData('id'))
->execute();
return $view;
}
}

BIN
Docs/Dev/img/er.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

65
Models/Checklist.php Normal file
View File

@ -0,0 +1,65 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
/**
* Checklist class.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Checklist
{
/**
* Account ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
public string $name = '';
public int $template = 0;
public \DateTimeImmutable $createdAt;
public array $tasks = [];
public function __construct()
{
$this->createdAt = new \DateTimeImmutable();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,76 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
use Modules\Tasks\Models\TaskMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Checklist mapper class.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class ChecklistMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'checklist_checklist_id' => ['name' => 'checklist_checklist_id', 'type' => 'int', 'internal' => 'id'],
'checklist_checklist_name' => ['name' => 'checklist_checklist_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'checklist_checklist_template' => ['name' => 'checklist_checklist_template', 'type' => 'int', 'internal' => 'template'],
'checklist_checklist_createdat' => ['name' => 'checklist_checklist_createdat', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'tasks' => [
'mapper' => TaskMapper::class,
'table' => 'checklist_checklist_task',
'self' => 'checklist_checklist_task_task',
'external' => null,
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'checklist_checklist';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'checklist_checklist_id';
}

View File

@ -0,0 +1,71 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
/**
* Checklist class.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class ChecklistTemplate
{
/**
* Account ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
public string $name = '';
public string $description = '';
public int $repeat = 0;
public string $interval = '';
public \DateTime $start;
public ?\DateTime $end = null;
public array $tasks = [];
public function __construct()
{
$this->start = new \DateTime();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,79 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
use Modules\Tasks\Models\TaskMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* ChecklistTemplate mapper class.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class ChecklistTemplateMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'checklist_checklist_template_id' => ['name' => 'checklist_checklist_template_id', 'type' => 'int', 'internal' => 'id'],
'checklist_checklist_template_name' => ['name' => 'checklist_checklist_template_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'checklist_checklist_template_description' => ['name' => 'checklist_checklist_template_description', 'type' => 'string', 'internal' => 'description'],
'checklist_checklist_template_repeat' => ['name' => 'checklist_checklist_template_repeat', 'type' => 'int', 'internal' => 'repeat'],
'checklist_checklist_template_interval' => ['name' => 'checklist_checklist_template_interval', 'type' => 'string', 'internal' => 'interval'],
'checklist_checklist_template_start' => ['name' => 'checklist_checklist_template_start', 'type' => 'DateTime', 'internal' => 'start'],
'checklist_checklist_template_end' => ['name' => 'checklist_checklist_template_end', 'type' => 'DateTime', 'internal' => 'end'],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'tasks' => [
'mapper' => TaskMapper::class,
'table' => 'checklist_checklist_template_task',
'external' => 'checklist_checklist_template_task_task',
'self' => 'checklist_checklist_template_task_template',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'checklist_checklist_template';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'checklist_checklist_template_id';
}

View File

@ -0,0 +1,60 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
use Modules\Tasks\Models\Task;
/**
* Checklist class.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class ChecklistTemplateTask
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
public int $order = 0;
public int $template = 0;
public Task $task;
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,74 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
use Modules\Tasks\Models\TaskMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* ChecklistTemplateTask mapper class.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class ChecklistTemplateTaskMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'checklist_checklist_template_task_id' => ['name' => 'checklist_checklist_template_task_id', 'type' => 'int', 'internal' => 'id'],
'checklist_checklist_template_task_order' => ['name' => 'checklist_checklist_template_task_order', 'type' => 'int', 'internal' => 'order'],
'checklist_checklist_template_task_template' => ['name' => 'checklist_checklist_template_task_template', 'type' => 'int', 'internal' => 'template'],
'checklist_checklist_template_task_task' => ['name' => 'checklist_checklist_template_task_task', 'type' => 'int', 'internal' => 'task'],
];
/**
* Has one relation.
*
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
* @since 1.0.0
*/
public const OWNS_ONE = [
'task' => [
'mapper' => TaskMapper::class,
'external' => 'checklist_checklist_template_task_task',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'checklist_checklist_template_task';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'checklist_checklist_template_task_id';
}

47
Models/NullChecklist.php Normal file
View File

@ -0,0 +1,47 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
/**
* Null model
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullChecklist extends Checklist
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
parent::__construct();
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
/**
* Null model
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullChecklistTemplate extends ChecklistTemplate
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
parent::__construct();
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Checklist\Models;
/**
* Null model
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullChecklistTask extends ChecklistTask
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -17,7 +17,7 @@ namespace Modules\Checklist\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Permision state enum.
* Permission category enum.
*
* @package Modules\Checklist\Models
* @license OMS License 2.0
@ -28,5 +28,7 @@ abstract class PermissionCategory extends Enum
{
public const CHECKLIST = 1;
public const TEMPLATE = 2;
public const TASK = 2;
public const TEMPLATE = 3;
}

View File

@ -0,0 +1,98 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Tasks
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Tasks\Models\TaskPriority;
use Modules\Tasks\Models\TaskType;
/** @var \phpOMS\Views\View $this */
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<form id="fTask" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/api}task?{?}&csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Task'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iiReceiver"><?= $this->getHtml('To'); ?></label>
<?= $this->getData('accGrpSelector')->render('iReceiver', 'forward', true); ?>
</div>
<div class="form-group">
<label for="iObserver"><?= $this->getHtml('CC'); ?></label>
<?= $this->getData('accGrpSelector')->render('iCC', 'cc', false); ?>
</div>
<div class="form-group">
<label for="iPriority"><?= $this->getHtml('Priority'); ?></label>
<select id="iPriority" name="priority">
<option value="<?= TaskPriority::NONE; ?>" selected><?= $this->getHtml('P0'); ?>
<option value="<?= TaskPriority::VLOW; ?>"><?= $this->getHtml('P1'); ?>
<option value="<?= TaskPriority::LOW; ?>"><?= $this->getHtml('P2'); ?>
<option value="<?= TaskPriority::MEDIUM; ?>"><?= $this->getHtml('P3'); ?>
<option value="<?= TaskPriority::HIGH; ?>"><?= $this->getHtml('P4'); ?>
<option value="<?= TaskPriority::VHIGH; ?>"><?= $this->getHtml('P5'); ?>
</select>
</div>
<div class="form-group">
<label for="iDue"><?= $this->getHtml('Due'); ?></label>
<input type="datetime-local" id="iDue" name="due" value="<?= $this->printHtml((new \DateTime('NOW'))->format('Y-m-d\TH:i:s')); ?>">
</div>
<div class="form-group">
<label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<input type="text" id="iTitle" name="title" placeholder="<?= $this->getHtml('Title'); ?>" required>
</div>
<div class="form-group">
<?= $this->data['editor']->render('task-editor'); ?>
</div>
<div class="form-group">
<?= $this->data['editor']->getData('text')->render('task-editor', 'plain', 'fTask'); ?>
</div>
</div>
<div class="portlet-foot">
<input id="iCreateSubmit" type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<input type="hidden" name="type" value="<?= TaskType::SINGLE; ?>">
</div>
</form>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Media'); ?></div>
<div class="portlet-body">
<form>
<div class="form-group">
<label for="iMedia"><?= $this->getHtml('Media'); ?></label>
<div class="ipt-wrap wf-100">
<div class="ipt-first"><input type="text" id="iMedia" name="mediaFile" placeholder="File"></div>
<div class="ipt-second"><button><?= $this->getHtml('Select'); ?></button></div>
</div>
</div>
<div class="form-group">
<input type="file" id="iUpload" name="upload" form="fTask" multiple>
<input form="fTask" type="hidden" name="type"><td>
</div>
</div>
</form>
</div>
</div>
</div>
<?= $this->getData('accGrpSelector')->getData('popup')->render(); ?>

View File

@ -15,42 +15,31 @@ declare(strict_types=1);
/**
* @var \phpOMS\Views\View $this
*/
$footerView = new \phpOMS\Views\PaginationView($this->l11nManager, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages(25);
$footerView->setPage(1);
$footerView->setResults(1);
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="box wf-100">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Templates'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<caption><?= $this->getHtml('Templates'); ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Status'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Creator'); ?>
<td><?= $this->getHtml('Created'); ?>
<tbody>
<?php $c = 0; foreach ([] as $key => $value) : ++$c;
$url = \phpOMS\Uri\UriFactory::build('checklist/single?{?}&id=' . $value->id); ?>
<tr>
<?php $c = 0;
foreach ($this->data['templates'] as $key => $value) : ++$c;
$url = \phpOMS\Uri\UriFactory::build('{/base}/checklist/template/view?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->parent); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getUnit()); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
<td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>

View File

@ -0,0 +1,63 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Checklist
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Tasks\Models\TaskPriority;
use phpOMS\Stdlib\Base\SmartDateTime;
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Tasks'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('Due/Priority', 'Tasks', 'Backend'); ?>
<td class="wf-100"><?= $this->getHtml('Title', 'Tasks', 'Backend'); ?>
<td class="wf-100"><?= $this->getHtml('For', 'Tasks', 'Backend'); ?>
<tbody>
<?php $c = 0;
foreach ($this->data['template']->tasks as $key => $task) : ++$c;
$url = \phpOMS\Uri\UriFactory::build('{/base}/checklist/template/task?{?}&id=' . $task->id);
?>
<tr data-href="<?= $url; ?>">
<td><?php if ($task->getPriority() === TaskPriority::NONE) : ?>
<?= SmartDateTime::formatDuration($task->due?->getTimestamp() - $task->createdAt?->getTimestamp()); ?>
<?php else : ?>
<?= $this->getHtml('P' . $task->getPriority(), 'Tasks', 'Backend'); ?>
<?php endif; ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($task->title); ?></a>
<td><?php
$element = \reset($task->taskElements);
foreach ($element->accRelation as $rel): ?>
<?= $this->printHtml(
\sprintf('%3$s %2$s %1$s', $rel->relation->name1, $rel->relation->name2, $rel->relation->name3)
); ?>
<?php endforeach; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>
</div>

View File

@ -14,7 +14,6 @@
"name": "Jingga",
"website": "jingga.app"
},
"description": "The administration module.",
"directory": "Checklist",
"dependencies": {
"Admin": "1.0.0",