From 42ebf10d7ddf4d018f9b08f150a71089bac861dc Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Fri, 7 Jul 2023 16:24:50 +0800 Subject: [PATCH] + Add batch create todo page. --- module/todo/js/batchcreate.ui.js | 23 ++++++ module/todo/ui/batchcreate.html.php | 117 ++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 module/todo/js/batchcreate.ui.js create mode 100644 module/todo/ui/batchcreate.html.php diff --git a/module/todo/js/batchcreate.ui.js b/module/todo/js/batchcreate.ui.js new file mode 100644 index 0000000000..3e80e6796e --- /dev/null +++ b/module/todo/js/batchcreate.ui.js @@ -0,0 +1,23 @@ + +window.renderRowData = function($row, index, row) +{ + if($row.find('td[data-name="beginAndEnd"] .inited').length == 0) + { + $tdDom = $row.find('td[data-name="beginAndEnd"]'); + $tdDom.empty().html($('#dateCellData').html()); + + $tdDom.find('input[name="begin"]').attr('name', `begin[${index}]`); + $tdDom.find('input[name="end"]').attr('name', `end[${index}]`); + + $tdDom.find('input[name="switchTime"]').attr('name', `switchTime[${index}]`).attr('id', `switchTime_${index}`); + $tdDom.find('label[for="switchTime_"]').attr('for', `switchTime_${index}`); + } +} + +$(function() +{ + $(document).off('click', '.time-check').on('click', '.time-check', function(e) + { + $(e.target).closest('.inited').find('.time-input').prop('disabled', !!e.target.checked); + }); +}); diff --git a/module/todo/ui/batchcreate.html.php b/module/todo/ui/batchcreate.html.php new file mode 100644 index 0000000000..a034e8a36a --- /dev/null +++ b/module/todo/ui/batchcreate.html.php @@ -0,0 +1,117 @@ + + * @package todo + * @link https://www.zentao.net + */ +namespace zin; + +jsVar('time', $time); +jsVar('times', $times); +div +( + setID('dateCellData'), + setClass('hidden'), + inputGroup + ( + setClass('inited'), + control + ( + setClass('time-input'), + set::type('select'), + set::name('begin'), + set::items($times) + ), + control + ( + setClass('time-input'), + set::type('select'), + set::name('end'), + set::items($times) + ), + span + ( + setClass('input-group-addon'), + checkBox + ( + setClass('time-check'), + set::name('switchTime'), + $lang->todo->periods['future'], + ) + ) + ), +); + +$visibleFields = array(); +foreach(explode(',', $showFields) as $field) +{ + if($field) $visibleFields[$field] = ''; +} +formBatchPanel +( + set::url(createLink('todo', 'batchEdit', "from=todoBatchEdit&type={$type}&userID={$userID}&status={$status}")), + set::onRenderRow(jsRaw('renderRowData')), + on::change('[data-name="type"]', 'setNameCell'), + formBatchItem + ( + set::name('id'), + set::label($lang->idAB), + set::control('index'), + set::width('30px'), + ), + formBatchItem + ( + set::name('type'), + set::label($lang->todo->type), + set::width('100px'), + set::control('select'), + set::value('custom'), + set::items($lang->todo->typeList), + ), + formBatchItem + ( + set::name('pri'), + set::label($lang->todo->pri), + set::width('60px'), + set::control('select'), + set::value('3'), + set::hidden(!isset($visibleFields['pri'])), + set::items($lang->todo->priList), + ), + formBatchItem + ( + set::name('name'), + set::label($lang->todo->name), + set::minWidth('100px') + ), + formBatchItem + ( + set::name('desc'), + set::label($lang->todo->desc), + set::control('textarea'), + set::width('100px'), + ), + formBatchItem + ( + set::name('assignedTo'), + set::label($lang->todo->assignedTo), + set::value($app->user->account), + set::ditto(true), + set::width('140px'), + set::control('select'), + set::items($users), + ), + formBatchItem + ( + set::name('beginAndEnd'), + set::label($lang->todo->beginAndEnd), + set::width('232px'), + set::hidden(!isset($visibleFields['beginAndEnd'])), + ), +); +/* ====== Render page ====== */ +render();