started with template fixes

This commit is contained in:
Dennis Eichhorn 2024-03-29 15:26:00 +00:00
parent be05b3cf52
commit a6c746bfdf
8 changed files with 83 additions and 103 deletions

View File

@ -22,6 +22,7 @@ return [
[
'dest' => '\Modules\Checklist\Controller\ApiController:apiChecklistCreateFromTemplate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::CREATE,

View File

@ -130,7 +130,7 @@ final class BackendController extends Controller
public function viewChecklistTemplateCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Checklist/Theme/Backend/checklist-template-create');
$view->setTemplate('/Modules/Checklist/Theme/Backend/checklist-template');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003601001, $request, $response);
return $view;

View File

@ -26,4 +26,7 @@ return ['Checklist' => [
'Templates' => 'Vorlagen',
'TimeInMinutes' => 'Zeit in Minuten.',
'Title' => 'Titel',
'Template' => 'Template',
'Start' => 'Start',
'End' => 'Ende',
]];

View File

@ -26,4 +26,7 @@ return ['Checklist' => [
'Templates' => 'Templates',
'TimeInMinutes' => 'Time in minutes',
'Title' => 'Title',
'Template' => 'Template',
'Start' => 'Start',
'End' => 'End',
]];

View File

@ -53,7 +53,7 @@ echo $this->data['nav']->render(); ?>
<div class="form-group">
<label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<input type="text" id="iTitle" name="title" placeholder="<?= $this->getHtml('Title'); ?>" required>
<input type="text" id="iTitle" name="title" required>
</div>
<div class="form-group">
@ -80,7 +80,7 @@ echo $this->data['nav']->render(); ?>
<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-first"><input type="text" id="iMedia" name="mediaFile"></div>
<div class="ipt-second"><button><?= $this->getHtml('Select'); ?></button></div>
</div>
</div>

View File

@ -1,94 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Checklist
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getHtml('General'); ?></h1></header>
<div class="inner">
<form id="fChecklist" method="put" action="<?= \phpOMS\Uri\UriFactory::build('{/api}checklist/template?{?}&csrf={$CSRF}'); ?>">
<div class="form-group">
<label for="iName"><?= $this->getHtml('Name'); ?></label>
<input type="text" id="iName" name="name" required>
</div>
<div class="form-group">
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
<textarea id="iDescription" name="description"></textarea>
</div>
<div class="form-group">
<label for="iPermission"><?= $this->getHtml('Permissions'); ?></label>
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button>
<input type="text" id="iPermission" name="permission"></span>
<button><?= $this->getHtml('Add', '0', '0'); ?></button>
</div>
<div class="form-group">
<label for="iFiles"><?= $this->getHtml('Files'); ?></label>
<input id="iFiles" name="files" type="file" multiple>
</div>
<input type="submit" name="createChecklist" value="<?= $this->getHtml('Create', '0', '0'); ?>">
</form>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form>
<div class="portlet-head"><?= $this->getHtml('Tasks'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iETitle"><?= $this->getHtml('Title'); ?></label>
<input type="text" id="iETitle" name="eTitle" required>
</div>
<div class="form-group">
<label for="iEDescription"><?= $this->getHtml('Description'); ?></label>
<textarea id="iEDescription" name="eDescription"></textarea>
</div>
<div class="form-group">
<label for="iETime"><?= $this->getHtml('TimeInMinutes'); ?></label>
<input type="number" min="0" step="1" id="iETime" name="eTime" value="0">
</div>
<div class="form-group">
<label for="iEPermission"><?= $this->getHtml('Permissions'); ?></label>
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button>
<input type="text" id="iEPermission" name="ePermission">
</span>
<button data-action=""><?= $this->getHtml('Add', '0', '0'); ?></button>
</div>
<div class="form-group">
<label for="iEFiles"><?= $this->getHtml('Files'); ?></label>
<input id="iEFiles" name="eFiles" type="file" multiple>
</div>
</div>
<div class="portlet-foot">
<input type="submit" name="createChecklistElement" value="<?= $this->getHtml('Add', '0', '0'); ?>" data-action=""><td>
</div>
</form>
</section>
</div>
</div>

View File

@ -12,6 +12,8 @@
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
/**
* @var \phpOMS\Views\View $this
*/
@ -20,7 +22,9 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Templates'); ?><i class="g-icon download btn end-xs">download</i></div>
<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">
<thead>

View File

@ -12,26 +12,88 @@
*/
declare(strict_types=1);
use Modules\Checklist\Models\NullChecklistTemplate;
use Modules\Tasks\Models\TaskPriority;
use phpOMS\Stdlib\Base\SmartDateTime;
use phpOMS\Uri\UriFactory;
/**
* @var \phpOMS\Views\View $this
*/
$template = $this->data['template'] ?? new NullChecklistTemplate();
$isNew = $template->id === 0;
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<form id="fTemplate" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}checklist/template?{?}&csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Template'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" name="id" id="iId" value="<?= $template->id; ?>" disabled>
</div>
<div class="form-group">
<label for="iName"><?= $this->getHtml('Name'); ?></label>
<input type="text" id="iName" name="name" value="<?= $this->printHtml($template->name); ?>" required>
</div>
<div class="flex-line">
<div>
<div class="form-group">
<label for="iStart"><?= $this->getHtml('Start'); ?></label>
<input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($template->start->format('Y-m-d\TH:i:s')); ?>">
</div>
</div>
<div>
<div class="form-group">
<label for="iEnd"><?= $this->getHtml('End'); ?></label>
<input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($template->end?->format('Y-m-d\TH:i:s')); ?>">
</div>
</div>
</div>
<div class="form-group">
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
<textarea id="iDescription" name="desc"><?= $this->printHtml($template->description); ?></textarea>
</div>
<?php if ($isNew) : ?>
<div class="form-group">
</div>
<?php endif; ?>
</div>
<div class="portlet-foot">
<?php if ($isNew) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<form id="iChecklistCreate" action="<?= \phpOMS\Uri\UriFactory::build('{/api}checklist?{?}&csrf={$CSRF}'); ?>" method="POST">
<input id="iId" type="hidden" name="id" value="<?= $this->data['template']->id; ?>">
<input type="submit" class="end-xs save" value="<?= $this->getHtml('Create', '0', '0'); ?>">
</form>
<?php endif; ?>
</div>
</form>
</div>
</div>
</div>
<?php if (!$isNew) : ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head">
<?= $this->getHtml('Tasks'); ?>
<span class="end-xs">
<form id="iChecklistCreate" action="<?= \phpOMS\Uri\UriFactory::build('{/api}checklist?{?}&csrf={$CSRF}'); ?>" method="POST">
<input id="iId" type="hidden" name="id" value="<?= $this->data['template']->id; ?>">
<input type="submit" class="end-xs save" value="<?= $this->getHtml('Create', '0', '0'); ?>">
</form>
</span>
<a class="button" href="<?= \phpOMS\Uri\UriFactory::build('{/base}/checklist/template/task?{?}&csrf={$CSRF}'); ?>"><?= $this->getHtml('Add', '0', '0'); ?></a>
</span>
</div>
<div class="slider">
<table class="default sticky">
@ -69,3 +131,4 @@ echo $this->data['nav']->render(); ?>
</div>
</div>
</div>
<?php endif; ?>