continue task edit impl.

This commit is contained in:
Dennis Eichhorn 2020-05-02 21:03:21 +02:00
parent bda4d7efe3
commit 7b93c59f3f
3 changed files with 86 additions and 87 deletions

View File

@ -796,18 +796,19 @@ class Task implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'createdBy' => $this->createdBy, 'createdBy' => $this->createdBy,
'createdAt' => $this->createdAt, 'createdAt' => $this->createdAt,
'title' => $this->title, 'title' => $this->title,
'description' => $this->description, 'description' => $this->description,
'status' => $this->status, 'descriptionRaw' => $this->descriptionRaw,
'type' => $this->type, 'status' => $this->status,
'priority' => $this->priority, 'type' => $this->type,
'due' => $this->due, 'priority' => $this->priority,
'done' => $this->done, 'due' => $this->due,
'elements' => $this->taskElements, 'done' => $this->done,
'tags' => $this->tags, 'elements' => $this->taskElements,
'tags' => $this->tags,
]; ];
} }

View File

@ -22,11 +22,10 @@ echo $this->getData('nav')->render(); ?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<section class="box wf-100"> <div class="portlet">
<header><h1><?= $this->getHtml('Task') ?></h1></header> <form id="fTask" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/api}task?{?}&csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Task') ?></div>
<div class="inner"> <div class="portlet-body">
<form id="fTask" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/api}task?{?}&csrf={$CSRF}'); ?>">
<table class="layout wf-100" style="table-layout: fixed"> <table class="layout wf-100" style="table-layout: fixed">
<tbody> <tbody>
<tr><td><label for="iReceiver"><?= $this->getHtml('To') ?></label> <tr><td><label for="iReceiver"><?= $this->getHtml('To') ?></label>
@ -50,20 +49,20 @@ echo $this->getData('nav')->render(); ?>
<tr><td><label for="iMessage"><?= $this->getHtml('Message') ?></label> <tr><td><label for="iMessage"><?= $this->getHtml('Message') ?></label>
<tr><td><?= $this->getData('editor')->render('task-editor'); ?> <tr><td><?= $this->getData('editor')->render('task-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('task-editor', 'plain', 'fTask'); ?> <tr><td><?= $this->getData('editor')->getData('text')->render('task-editor', 'plain', 'fTask'); ?>
<tr><td>
<input id="iCreateSubmit" type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<input type="hidden" name="type" value="<?= $this->printHtml(TaskType::SINGLE); ?>">
</table> </table>
</form> </div>
</div> <div class="portlet-foot">
</section> <input id="iCreateSubmit" type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<input type="hidden" name="type" value="<?= $this->printHtml(TaskType::SINGLE); ?>">
</div>
</form>
</div>
</div> </div>
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<section class="box wf-100"> <div class="portlet">
<header><h1><?= $this->getHtml('Media') ?></h1></header> <div class="portlet-head"><?= $this->getHtml('Media') ?></div>
<div class="portlet-body">
<div class="inner">
<form> <form>
<table class="layout wf-100"> <table class="layout wf-100">
<tbody> <tbody>
@ -78,9 +77,9 @@ echo $this->getData('nav')->render(); ?>
<input type="file" id="iUpload" name="upload" form="fTask" multiple> <input type="file" id="iUpload" name="upload" form="fTask" multiple>
<input form="fTask" type="hidden" name="type"><td> <input form="fTask" type="hidden" name="type"><td>
</table> </table>
</form> </div>
</div> </form>
</section> </div>
</div> </div>
</div> </div>

View File

@ -31,60 +31,57 @@ echo $this->getData('nav')->render(); ?>
<div class="row"> <div class="row">
<div class="col-md-6 col-xs-12"> <div class="col-md-6 col-xs-12">
<section id="task" class="box wf-100" <div id="task" class="portlet"
data-ui-content=".inner" data-ui-content="#task"
data-ui-element="#task header, #task .task-content" data-ui-element="#task .portlet-head, #task .task-content"
data-tag="form" data-tag="form"
data-method="POST" data-method="POST"
data-uri="<?= \phpOMS\Uri\UriFactory::build('{/api}task?id={?id}&csrf={$CSRF}'); ?>"> data-uri="<?= \phpOMS\Uri\UriFactory::build('{/api}task?id={?id}&csrf={$CSRF}'); ?>">
<div class="inner"> <template><!-- todo: this needs to be here for the form js to work (edit). find a way to remove these. maybe check if add functionality is available. --></template>
<?php if ($task->isEditable()) : ?> <template><!-- todo: this needs to be here for the form js to work (edit). find a way to remove these. maybe check if add functionality is available. --></template>
<template><!-- todo: this needs to be here for the form js to work (edit). find a way to remove these. maybe check if add functionality is available. --></template> <template>
<template><!-- todo: this needs to be here for the form js to work (edit). find a way to remove these. maybe check if add functionality is available. --></template> <div class="portlet-head"><input type="text" data-tpl-text="/title" data-tpl-value="/title" data-value="" name="title"></div>
<template> </template>
<header><h1><input type="text" data-tpl-text="/title" data-tpl-value="/title" data-value="" name="title"></h1></header> <template>
</template> <div class="task-content">
<template> <!-- todo: handle different value/markdown paths how??? no idea -->
<div class="inner task-content"> <!-- todo: bind js after adding template -->
<!-- todo: handle different value/markdown paths how??? no idea --> <!-- todo: adding this multiple times doesn't work because the id and tab names collide, this needs to be adjusted dynamically in js!!! how? no idea yet. -->
<!-- todo: bind js after adding template --> <?= $this->getData('editor')->render('task-edit'); ?>
<!-- todo: adding this multiple times doesn't work because the id and tab names collide, this needs to be adjusted dynamically in js!!! how? no idea yet. --> <?= $this->getData('editor')->getData('text')->render(
<?= $this->getData('editor')->render('task-edit'); ?> 'task-edit',
<?= $this->getData('editor')->getData('text')->render( 'plain',
'task-edit', 'taskElementEdit',
'plain', '', '',
'taskElementEdit', '/content', '{/base}/api/task?id={?id}'
'', '', ); ?>
'/content', '{/api}task?id={?id}' </div>
); ?> </template>
<!--<textarea data-tpl-text="/content" data-tpl-value="/content" data-value=""></textarea>--> <div class="portlet-head" data-tpl-text="/title" data-tpl-value="/title" data-value=""><?= $this->printHtml($task->getTitle()); ?></div>
</div> <div class="portlet-body">
</template>
<?php endif; ?>
<span id="task-status-badge" class="floatRight nobreak tag task-status-<?= $this->printHtml($task->getStatus()); ?>"> <span id="task-status-badge" class="floatRight nobreak tag task-status-<?= $this->printHtml($task->getStatus()); ?>">
<?= $this->getHtml('S' . $task->getStatus()) ?> <?= $this->getHtml('S' . $task->getStatus()) ?>
</span> </span>
<div> <div>
<?= $this->printHtml($task->getCreatedBy()->getName1()); ?> - <?= $this->printHtml($task->getCreatedAt()->format('Y/m/d H:i')); ?> <?= $this->printHtml($task->getCreatedBy()->getName1()); ?> - <?= $this->printHtml($task->getCreatedAt()->format('Y/m/d H:i')); ?>
</div> </div>
</div> <article class="task-content"
<header> data-tpl-text="/content"
<h1 data-tpl-text="/title" data-tpl-value="/title" data-value=""><?= $this->printHtml($task->getTitle()); ?></h1> data-tpl-value="{/base}/api/task?id={?id}"
</header> data-tpl-value-path="/0/response/descriptionRaw"
<div class="inner task-content"> data-value=""
<article data-tpl-text="/content" data-tpl-value="{/api}task?id={?id}" data-value=""><?= $task->getDescription(); ?></article> ><?= $task->getDescription(); ?></article>
</div>
<?php if (!empty($taskMedia)) : ?> <?php if (!empty($taskMedia)) : ?>
<div class="inner"> <div class="inner">
<?php foreach ($taskMedia as $media) : ?> <?php foreach ($taskMedia as $media) : ?>
<span><?= $media->getName(); ?></span> <span><?= $media->getName(); ?></span>
<?php endforeach; ?> <?php endforeach; ?>
</div>
<?php endif; ?>
</div> </div>
<?php endif; ?> <?php if ($task->isEditable()) : ?>
<div class="portlet-foot">
<div class="inner" style="background: #efefef; border-top: 1px solid #dfdfdf;">
<div class="pAlignTable"> <div class="pAlignTable">
<div class="vC wf-100"> <div class="vC wf-100">
<?php if ($task->getPriority() === TaskPriority::NONE) : ?> <?php if ($task->getPriority() === TaskPriority::NONE) : ?>
@ -103,7 +100,8 @@ echo $this->getData('nav')->render(); ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
</section> <?php endif; ?>
</div>
<div id="elements"> <div id="elements">
<!-- todo: this doesn't work because single taskelements cannot be identified somehow we need to work with ids of elements, implement a counter for the current element or implement a nearest() function instead of the this.closest() --> <!-- todo: this doesn't work because single taskelements cannot be identified somehow we need to work with ids of elements, implement a counter for the current element or implement a nearest() function instead of the this.closest() -->
@ -125,7 +123,7 @@ echo $this->getData('nav')->render(); ?>
</div> </div>
<div class="inner taskelement-content"> <div class="inner taskelement-content">
<article data-tpl-text="/content" data-tpl-value="{/api}task?id={?id}" data-value=""></article> <article data-tpl-text="/content" data-tpl-value="{/api}task?id={?id}" data-tpl-value-path="/0/response/description" data-value=""></article>
</div> </div>
<div class="inner"> <div class="inner">
@ -183,7 +181,7 @@ echo $this->getData('nav')->render(); ?>
<?php if ($element->getDescription() !== '') : ?> <?php if ($element->getDescription() !== '') : ?>
<div class="inner taskelement-content"> <div class="inner taskelement-content">
<article data-tpl-text="/content" data-tpl-value="{/api}task?id={?id}" data-value=""><?= $element->getDescription(); ?></article> <article data-tpl-text="/content" data-tpl-value="{/api}task?id={?id}" data-tpl-value-path="/0/response/description" data-value=""><?= $element->getDescription(); ?></article>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -238,7 +236,7 @@ echo $this->getData('nav')->render(); ?>
<?= $this->getHtml('ForwardedTo') ?> <?= $this->getHtml('ForwardedTo') ?>
<?php foreach ($tos as $to) : ?> <?php foreach ($tos as $to) : ?>
<?php if ($to instanceof AccountRelation) : ?> <?php if ($to instanceof AccountRelation) : ?>
<a href="<?= phpOMS\Uri\UriFactory::build('{/prefix}profile/single?{?}&id=' . $to->getRelation()->getId()) ?>"><?= $this->printHtml($to->getRelation()->getName1()); ?></a> <a href="<?= phpOMS\Uri\UriFactory::build('{/prefix}profile/single?{?}&for=' . $to->getRelation()->getId()) ?>"><?= $this->printHtml($to->getRelation()->getName1()); ?></a>
<?php elseif ($to instanceof GroupRelation) : ?> <?php elseif ($to instanceof GroupRelation) : ?>
<?= $this->printHtml($to->getRelation()->getName()); ?> <?= $this->printHtml($to->getRelation()->getName()); ?>
<?php endif; ?> <?php endif; ?>
@ -251,11 +249,11 @@ echo $this->getData('nav')->render(); ?>
</div> </div>
<div class="col-md-6 col-xs-12"> <div class="col-md-6 col-xs-12">
<section class="box wf-100"> <div class="portlet">
<div class="inner"> <form id="taskElementCreate" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/api}task/element?{?}&csrf={$CSRF}'); ?>">
<form id="taskElementCreate" method="PUT" action="<?= \phpOMS\Uri\UriFactory::build('{/api}task/element?{?}&csrf={$CSRF}'); ?>"> <div class="portlet-head"><?= $this->getHtml('Message') ?></div>
<div class="portlet-body">
<table class="layout wf-100" style="table-layout: fixed"> <table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iMessage"><?= $this->getHtml('Message') ?></label>
<tr><td><?= $this->getData('editor')->render('task-editor'); ?> <tr><td><?= $this->getData('editor')->render('task-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render( <tr><td><?= $this->getData('editor')->getData('text')->render(
'task-editor', 'task-editor',
@ -296,12 +294,13 @@ echo $this->getData('nav')->render(); ?>
<tr><td><label for="iUpload"><?= $this->getHtml('Upload') ?></label> <tr><td><label for="iUpload"><?= $this->getHtml('Upload') ?></label>
<tr><td> <tr><td>
<input type="file" id="iUpload" name="fileUpload" form="fTask"> <input type="file" id="iUpload" name="fileUpload" form="fTask">
<tr><td>
<input type="submit" id="iTaskElementCreateButton" name="taskElementCreateButton" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<input type="hidden" name="task" value="<?= $this->printHtml($this->request->getData('id')); ?>"><input type="hidden" name="type" value="1">
</table> </table>
</form> </div>
</div> <div class="portlet-foot">
</section> <input type="submit" id="iTaskElementCreateButton" name="taskElementCreateButton" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<input type="hidden" name="task" value="<?= $this->printHtml($this->request->getData('id')); ?>"><input type="hidden" name="type" value="1">
</div>
</form>
</div>
</div> </div>
</div> </div>