diff --git a/Admin/Install/db.json b/Admin/Install/db.json index c3b2221..27ea992 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -36,6 +36,12 @@ "type": "INT", "null": false }, + "kanban_board_style": { + "name": "kanban_board_style", + "type": "TEXT", + "null": true, + "default": null + }, "kanban_board_created_at": { "name": "kanban_board_created_at", "type": "DATETIME", @@ -142,6 +148,11 @@ "type": "TINYINT", "null": false }, + "kanban_card_color": { + "name": "kanban_card_color", + "type": "VARCHAR(10)", + "null": false + }, "kanban_card_order": { "name": "kanban_card_order", "type": "INT", diff --git a/Controller/ApiController.php b/Controller/ApiController.php index b6c70da..593f427 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -87,6 +87,7 @@ final class ApiController extends Controller $card->name = (string) ($request->getData('title')); $card->descriptionRaw = (string) ($request->getData('plain') ?? ''); $card->description = Markdown::parse((string) ($request->getData('plain') ?? '')); + $card->style = (string) ($request->getData('style') ?? ''); $card->setColumn((int) $request->getData('column')); $card->setOrder((int) ($request->getData('order') ?? 1)); $card->setRef((int) ($request->getData('ref') ?? 0)); @@ -301,6 +302,50 @@ final class ApiController extends Controller return []; } + /** + * Routing end-point for application behaviour. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return void + * + * @api + * + * @since 1.0.0 + */ + public function apiKanbanBoardUpdate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void + { + $old = clone KanbanBoardMapper::get((int) $request->getData('id')); + $new = $this->updateBoardFromRequest($request); + $this->updateModel($request->header->account, $old, $new, KanbanBoardMapper::class, 'board', $request->getOrigin()); + $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Board', 'Board successfully updated', $new); + } + + /** + * Method to update board from request. + * + * @param RequestAbstract $request Request + * + * @return KanbanBoard + * + * @since 1.0.0 + */ + private function updateBoardFromRequest(RequestAbstract $request) : KanbanBoard + { + /** @var KanbanBoard $board */ + $board = KanbanBoardMapper::get((int) $request->getData('id')); + $board->name = $request->getData('title') ?? $board->name; + $board->description = Markdown::parse((string) ($request->getData('plain') ?? $board->descriptionRaw)); + $board->descriptionRaw = (string) ($request->getData('plain') ?? $board->descriptionRaw); + $board->setOrder((int) ($request->getData('order') ?? $board->order)); + $board->setStatus((int) ($request->getData('status') ?? $board->getStatus())); + $board->style = (string) ($request->getData('style') ?? $board->style); + + return $board; + } + /** * Routing end-point for application behaviour. * diff --git a/Models/KanbanBoard.php b/Models/KanbanBoard.php index a9f61f6..5196ee1 100755 --- a/Models/KanbanBoard.php +++ b/Models/KanbanBoard.php @@ -46,7 +46,7 @@ class KanbanBoard implements \JsonSerializable private int $status = BoardStatus::ACTIVE; - private int $order = 0; + public int $order = 0; /** * Description. @@ -64,6 +64,8 @@ class KanbanBoard implements \JsonSerializable */ public string $descriptionRaw = ''; + public string $style = ''; + /** * Tags. * diff --git a/Models/KanbanBoardMapper.php b/Models/KanbanBoardMapper.php index 6456a71..42ad0f2 100755 --- a/Models/KanbanBoardMapper.php +++ b/Models/KanbanBoardMapper.php @@ -41,6 +41,7 @@ final class KanbanBoardMapper extends DataMapperAbstract 'kanban_board_descraw' => ['name' => 'kanban_board_descraw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'], 'kanban_board_order' => ['name' => 'kanban_board_order', 'type' => 'int', 'internal' => 'order'], + 'kanban_board_style' => ['name' => 'kanban_board_style', 'type' => 'string', 'internal' => 'style'], 'kanban_board_created_by' => ['name' => 'kanban_board_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], ]; diff --git a/Models/KanbanCard.php b/Models/KanbanCard.php index 8fb554b..a338fc3 100755 --- a/Models/KanbanCard.php +++ b/Models/KanbanCard.php @@ -50,6 +50,8 @@ class KanbanCard implements \JsonSerializable private int $type = CardType::TEXT; + public string $color = ''; + /** * Description. * diff --git a/Models/KanbanCardMapper.php b/Models/KanbanCardMapper.php index 6422a5d..23146ed 100755 --- a/Models/KanbanCardMapper.php +++ b/Models/KanbanCardMapper.php @@ -43,6 +43,7 @@ final class KanbanCardMapper extends DataMapperAbstract 'kanban_card_type' => ['name' => 'kanban_card_type', 'type' => 'int', 'internal' => 'type'], 'kanban_card_status' => ['name' => 'kanban_card_status', 'type' => 'int', 'internal' => 'status'], 'kanban_card_order' => ['name' => 'kanban_card_order', 'type' => 'int', 'internal' => 'order'], + 'kanban_card_color' => ['name' => 'kanban_card_color', 'type' => 'string', 'internal' => 'color'], 'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'], 'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'], 'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], diff --git a/Models/styles.tpl.json b/Models/styles.tpl.json new file mode 100644 index 0000000..3076741 --- /dev/null +++ b/Models/styles.tpl.json @@ -0,0 +1,11 @@ +{ + "version": "", + "board": { + "dashboard_background": "", + "board_background": "", + + }, + "cards": [ + + ], +} \ No newline at end of file diff --git a/Theme/Backend/Lang/ar.lang.php b/Theme/Backend/Lang/ar.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/cs.lang.php b/Theme/Backend/Lang/cs.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/da.lang.php b/Theme/Backend/Lang/da.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/el.lang.php b/Theme/Backend/Lang/el.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php old mode 100644 new mode 100755 index 1436aba..3eb2891 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -14,4 +14,7 @@ declare(strict_types=1); return ['Kanban' => [ 'Dashboard' => 'Dashboard', + ':bStatus1' => 'Active', + ':bStatus2' => 'Inactive', + ':bStatus3' => 'Archived', ]]; diff --git a/Theme/Backend/Lang/es.lang.php b/Theme/Backend/Lang/es.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/fi.lang.php b/Theme/Backend/Lang/fi.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/fr.lang.php b/Theme/Backend/Lang/fr.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/hu.lang.php b/Theme/Backend/Lang/hu.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/it.lang.php b/Theme/Backend/Lang/it.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/ja.lang.php b/Theme/Backend/Lang/ja.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/ko.lang.php b/Theme/Backend/Lang/ko.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/no.lang.php b/Theme/Backend/Lang/no.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/pl.lang.php b/Theme/Backend/Lang/pl.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/pt.lang.php b/Theme/Backend/Lang/pt.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/ru.lang.php b/Theme/Backend/Lang/ru.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/sv.lang.php b/Theme/Backend/Lang/sv.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/th.lang.php b/Theme/Backend/Lang/th.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/tr.lang.php b/Theme/Backend/Lang/tr.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/uk.lang.php b/Theme/Backend/Lang/uk.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/Lang/zh.lang.php b/Theme/Backend/Lang/zh.lang.php old mode 100644 new mode 100755 diff --git a/Theme/Backend/kanban-archive.tpl.php b/Theme/Backend/kanban-archive.tpl.php index 7d5a988..be8cec2 100755 --- a/Theme/Backend/kanban-archive.tpl.php +++ b/Theme/Backend/kanban-archive.tpl.php @@ -30,6 +30,18 @@ echo $this->getData('nav')->render(); ?> + -
getHtml('Status'); ?> + + + getHtml('Title'); ?>
printHtml($board->title); ?> - printHtml($board->getPublish()->format('Y-m-d')); ?> + getHtml(':bStatus' . $board->getStatus()); ?> + printHtml($board->name); ?> + printHtml($board->createdAt->format('Y-m-d')); ?>
getHtml('Empty', '0', '0'); ?>