From 62827e6cf470449c117624058fb36ad94804bcc0 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 5 May 2020 14:25:42 +0200 Subject: Time tracking related plugins --- plugins/Timetrackingeditor/Template/create.php | 41 ++++++++++ plugins/Timetrackingeditor/Template/edit.php | 41 ++++++++++ plugins/Timetrackingeditor/Template/menu.php | 23 ++++++ plugins/Timetrackingeditor/Template/remove.php | 20 +++++ plugins/Timetrackingeditor/Template/start.php | 23 ++++++ plugins/Timetrackingeditor/Template/stop.php | 23 ++++++ .../Timetrackingeditor/Template/subtask/table.php | 89 ++++++++++++++++++++++ .../Template/time_tracking_editor.php | 53 +++++++++++++ 8 files changed, 313 insertions(+) create mode 100644 plugins/Timetrackingeditor/Template/create.php create mode 100644 plugins/Timetrackingeditor/Template/edit.php create mode 100644 plugins/Timetrackingeditor/Template/menu.php create mode 100644 plugins/Timetrackingeditor/Template/remove.php create mode 100644 plugins/Timetrackingeditor/Template/start.php create mode 100644 plugins/Timetrackingeditor/Template/stop.php create mode 100644 plugins/Timetrackingeditor/Template/subtask/table.php create mode 100644 plugins/Timetrackingeditor/Template/time_tracking_editor.php (limited to 'plugins/Timetrackingeditor/Template') diff --git a/plugins/Timetrackingeditor/Template/create.php b/plugins/Timetrackingeditor/Template/create.php new file mode 100644 index 00000000..362cfde4 --- /dev/null +++ b/plugins/Timetrackingeditor/Template/create.php @@ -0,0 +1,41 @@ + +
+ + form->csrf() ?> + + form->hidden('project_id', $values) ?> + form->hidden('task_id', $values) ?> + form->hidden('opposite_subtask_id', $values) ?> + + form->label(t('Subtask'), 'subtask') ?> + form->text( + 'subtask', + $values, + $errors, + array( + 'required', + (!isset($autofocus) || $autofocus == 'subtask' ? 'autofocus' : ''), + 'placeholder="'.t('Start to type subtask title...').'"', + 'title="'.t('Start to type subtask title...').'"', + 'data-dst-field="opposite_subtask_id"', + 'data-search-url="'.$this->url->href('SubtaskAjaxController', 'autocomplete', array('plugin' => 'timetrackingeditor', 'task_id' => $values['task_id'])).'"', + ), + 'autocomplete') ?> + + form->label(t('Time spent'), 'time_spent') ?> + form->numeric('time_spent', $values, $errors, array('maxlength="10"', 'required', (isset($autofocus) && $autofocus == "time_spent" ? 'autofocus' : '')), 'form-numeric') ?> hours + + form->label(t('Start Date'), 'start') ?> + form->text('start', $values, $errors, array('maxlength="10"', 'required'), 'form-date') ?> + + form->label(t('Comment'), 'comment') ?> + form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?> + + form->checkbox('is_billable', t('Billable?'), 1, isset($values['is_billable']) && $values['is_billable'] == 1) ?> + form->checkbox('add_another', t('Add another event'), 1, isset($values['add_another']) && $values['add_another'] == 1) ?> + + modal->submitButtons(); ?> + +
diff --git a/plugins/Timetrackingeditor/Template/edit.php b/plugins/Timetrackingeditor/Template/edit.php new file mode 100644 index 00000000..28323812 --- /dev/null +++ b/plugins/Timetrackingeditor/Template/edit.php @@ -0,0 +1,41 @@ + +
+ + form->csrf() ?> + + form->hidden('project_id', $values) ?> + form->hidden('task_id', $values) ?> + form->hidden('opposite_subtask_id', $values) ?> + form->hidden('id', $values) ?> + + + form->label(t('Subtask'), 'subtask') ?> + form->text( + 'subtask', + $values, + $errors, + array( + 'required', + 'autofocus', + 'placeholder="'.t('Start to type subtask title...').'"', + 'title="'.t('Start to type subtask title...').'"', + 'data-dst-field="opposite_subtask_id"', + 'data-search-url="'.$this->url->href('SubtaskAjaxController', 'autocomplete', array('plugin' => 'timetrackingeditor', 'task_id' => $values['task_id'])).'"', + ), + 'autocomplete') ?> + + form->label(t('Start Date'), 'start') ?> + form->text('start', $values, $errors, array('maxlength="10"', 'required'), 'form-date') ?> + + form->label(t('Time spent'), 'time_spent') ?> + form->numeric('time_spent', $values, $errors, array('maxlength="10"', 'required'), 'form-numeric') ?> hours + + form->label(t('Comment'), 'comment') ?> + form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?> + + form->checkbox('is_billable', t('Billable?'), 1, $values['is_billable'] == 1) ?> + + modal->submitButtons(); ?> +
diff --git a/plugins/Timetrackingeditor/Template/menu.php b/plugins/Timetrackingeditor/Template/menu.php new file mode 100644 index 00000000..fb715c4b --- /dev/null +++ b/plugins/Timetrackingeditor/Template/menu.php @@ -0,0 +1,23 @@ + diff --git a/plugins/Timetrackingeditor/Template/remove.php b/plugins/Timetrackingeditor/Template/remove.php new file mode 100644 index 00000000..f86ad424 --- /dev/null +++ b/plugins/Timetrackingeditor/Template/remove.php @@ -0,0 +1,20 @@ + + +
+
+ +
    +
  • + text->e($timetracking['subtask_title']) ?> +
  • +
+
+ +
+ url->link(t('Yes'), 'TimeTrackingEditorController', 'remove', array('plugin' => 'timetrackingeditor', 'id' => $timetracking['id'], 'project_id' => $timetracking['project_id'], 'subtask_id' => $timetracking['subtask_id']), true, 'btn btn-red') ?> + + url->link(t('cancel'), 'TimeTrackingEditorController', 'show', array('plugin' => 'timetrackingeditor','id' => $timetracking['id'], 'project_id' => $timetracking['project_id']), false, 'close-popover') ?> +
+
diff --git a/plugins/Timetrackingeditor/Template/start.php b/plugins/Timetrackingeditor/Template/start.php new file mode 100644 index 00000000..cc67febd --- /dev/null +++ b/plugins/Timetrackingeditor/Template/start.php @@ -0,0 +1,23 @@ + +
+ + form->csrf() ?> + + form->hidden('project_id', $values) ?> + form->hidden('task_id', $values) ?> + form->hidden('subtask_id', $values) ?> + + + + + form->label(t('Comment'), 'comment') ?> + form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?> + + form->checkbox('is_billable', t('Billable?'), 1, isset($values['is_billable']) && $values['is_billable'] == 1) ?> + +
+ modal->submitButtons() ?> +
+
diff --git a/plugins/Timetrackingeditor/Template/stop.php b/plugins/Timetrackingeditor/Template/stop.php new file mode 100644 index 00000000..63d3905d --- /dev/null +++ b/plugins/Timetrackingeditor/Template/stop.php @@ -0,0 +1,23 @@ + +
+ + form->csrf() ?> + + form->hidden('project_id', $values) ?> + form->hidden('task_id', $values) ?> + form->hidden('subtask_id', $values) ?> + + + + + form->label(t('Comment'), 'comment') ?> + form->textarea('comment', $values, $errors, array(), 'markdown-editor') ?> + + form->checkbox('is_billable', t('Billable?'), 1, isset($values['is_billable']) && $values['is_billable'] == 1) ?> + +
+ modal->submitButtons() ?> +
+
diff --git a/plugins/Timetrackingeditor/Template/subtask/table.php b/plugins/Timetrackingeditor/Template/subtask/table.php new file mode 100644 index 00000000..fa7f62ff --- /dev/null +++ b/plugins/Timetrackingeditor/Template/subtask/table.php @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + subtask->renderToggleStatus($task, $subtask, "table") ?> + + subtask->getTitle($subtask) ?> + + + + text->e($subtask['name'] ?: $subtask['username']) ?> + + +
    +
  • + + text->e($subtask['time_spent']).'h' ?> + + + + text->e($subtask['time_estimated']).'h' ?> + + + text->e($subtask['time_billable']).'h' ?> + + +
  • + user->getId()): ?> +
  • + + modal->medium("pause",t('Stop timer'), 'TimeTrackingEditorController', 'stop', + array('plugin' => 'Timetrackingeditor', + 'project_id' => $task['project_id'], + 'task_id' => $subtask['task_id'], + 'subtask_id' => $subtask['id'])) ?> + (dt->age($subtask['timer_start_date']) ?>) + + modal->medium("play-circle-o",t('Start timer'), 'TimeTrackingEditorController', 'start', + array('plugin' => 'Timetrackingeditor', + 'project_id' => $task['project_id'], + 'task_id' => $subtask['task_id'], + 'subtask_id' => $subtask['id'])) ?> + +
  • + +
+
+ render('subtask/menu', array( + 'task' => $task, + 'subtask' => $subtask, + )) ?> + + modal->medium("clock-o", t('New'), 'TimeTrackingEditorController', + 'create', array( + 'plugin' => 'Timetrackingeditor', + 'task_id' => $task['id'], + 'project_id' => $task['project_id'], + 'subtask_id' => $subtask['id'])) ?> +
+ diff --git a/plugins/Timetrackingeditor/Template/time_tracking_editor.php b/plugins/Timetrackingeditor/Template/time_tracking_editor.php new file mode 100644 index 00000000..2457305b --- /dev/null +++ b/plugins/Timetrackingeditor/Template/time_tracking_editor.php @@ -0,0 +1,53 @@ +
+

text->e($task['title']) ?>

+
+ +render('task/time_tracking_summary', array('task' => $task)) ?> + +

+ +modal->medium("plus",t('Add a new timetracking entry'), 'TimeTrackingEditorController', + 'create', array( + 'plugin' => 'timetrackingeditor', + 'task_id' => $task['id'], + 'project_id' => $task['project_id'])) ?> + +isEmpty()): ?> +

+ + + + + + + + + + + getCollection() as $record): ?> + + + + + + + + + +
order(t('User'), 'username') ?>order(t('Subtask'), 'subtask_title') ?>order(t('Start'), 'start') ?>order(t('End'), 'end') ?>order(t('Time spent'), \Kanboard\Model\SubtaskTimeTrackingModel::TABLE.'.time_spent') ?>
url->link($this->text->e($record['user_fullname'] ?: $record['username']), 'UserViewController', 'show', array('user_id' => $record['user_id'])) ?> + + + + app->tooltipMarkdown($record['comment']) ?> + dt->datetime($record['start']) ?>dt->datetime($record['end']) ?> + user->isCurrentUser($record['user_id'])) { ?> + render('timetrackingeditor:menu', array( + 'task' => $task, + 'subtask_id' => $record['subtask_id'], + 'id' => $record['id'] + )) ?> + +
+ + + -- cgit v1.2.3